diff options
Diffstat (limited to 'Examples/Modules')
-rwxr-xr-x | Examples/Modules/RigidInjection/analysis_rigid_injection_LabFrame.py | 15 | ||||
-rw-r--r-- | Examples/Modules/RigidInjection/inputs_2d_LabFrame | 4 |
2 files changed, 19 insertions, 0 deletions
diff --git a/Examples/Modules/RigidInjection/analysis_rigid_injection_LabFrame.py b/Examples/Modules/RigidInjection/analysis_rigid_injection_LabFrame.py index 624fd8f7c..ee88e3225 100755 --- a/Examples/Modules/RigidInjection/analysis_rigid_injection_LabFrame.py +++ b/Examples/Modules/RigidInjection/analysis_rigid_injection_LabFrame.py @@ -18,6 +18,9 @@ the theory (with a 5% error allowed). As a help to the user, the script also compares beam width to the theory in case rigid injection is OFF (i.e., the beam starts expanding from -5 microns), in which case a warning is raised. + +Additionally, this script tests that runtime attributes are correctly initialized +with the gaussian_beam injection style. ''' import os @@ -85,5 +88,17 @@ print("tolerance_rel: " + str(tolerance_rel)) assert( error_rel < tolerance_rel ) + +### Check that user runtime attributes are correctly initialized +filename_start = filename[:-5] + '00000' +ds_start = yt.load( filename_start ) +ad_start = ds_start.all_data() +x = ad_start['beam', 'particle_position_x'] +z = ad_start['beam', 'particle_position_y'] +orig_z = ad_start['beam', 'particle_orig_z'] +center = ad_start['beam', 'particle_center'] +assert(np.array_equal(z, orig_z)) +assert(np.array_equal(1*(np.abs(x) < 5.e-7), center)) + test_name = os.path.split(os.getcwd())[1] checksumAPI.evaluate_checksum(test_name, filename) diff --git a/Examples/Modules/RigidInjection/inputs_2d_LabFrame b/Examples/Modules/RigidInjection/inputs_2d_LabFrame index 76c2fc0c9..e5fe21c73 100644 --- a/Examples/Modules/RigidInjection/inputs_2d_LabFrame +++ b/Examples/Modules/RigidInjection/inputs_2d_LabFrame @@ -43,6 +43,10 @@ beam.uy_th = 100. beam.uz_th = 0. beam.zinject_plane = 20.e-6 beam.rigid_advance = true +beam.addRealAttributes = orig_z +beam.addIntegerAttributes = center +beam.attribute.orig_z(x,y,z,ux,uy,uz,t) = z +beam.attribute.center(x,y,z,ux,uy,uz,t) = 1*(sqrt(x*x + y*y)<5.e-7) # Diagnostics diagnostics.diags_names = diag1 |