aboutsummaryrefslogtreecommitdiff
path: root/Examples/Modules
diff options
context:
space:
mode:
authorGravatar Remi Lehe <remi.lehe@normalesup.org> 2022-11-09 11:29:57 -0800
committerGravatar GitHub <noreply@github.com> 2022-11-09 19:29:57 +0000
commit3e98c31a491fb438cb98692c7a62dbcdd717c39b (patch)
treef9da28c9351338b5253bf86b80561fc92ad9f09a /Examples/Modules
parent6beaa9fc0f5a68694d8dfbb70d6eae01446e4490 (diff)
downloadWarpX-3e98c31a491fb438cb98692c7a62dbcdd717c39b.tar.gz
WarpX-3e98c31a491fb438cb98692c7a62dbcdd717c39b.tar.zst
WarpX-3e98c31a491fb438cb98692c7a62dbcdd717c39b.zip
BTD: remove old/legacy back-transformed diagnostics (#3485)
* Start removing old BTD * Remove GetCellCenteredData * Remove do_backtransform_fields and do_backtransform_particles * Remove more functions * Remove more variables * Update documentation * Fix CI test `RigidInjection_BTD` * Remove slicing from `BTD_ReducedSliceDiag` * Rename `BTD_ReducedSliceDiag` as `LaserAcceleration_BTD` * Query deprecated input and abort Co-authored-by: Edoardo Zoni <ezoni@lbl.gov>
Diffstat (limited to 'Examples/Modules')
-rwxr-xr-xExamples/Modules/RigidInjection/analysis_rigid_injection_BoostedFrame.py34
-rw-r--r--Examples/Modules/RigidInjection/inputs_2d_BoostedFrame5
-rwxr-xr-xExamples/Modules/boosted_diags/analysis.py (renamed from Examples/Modules/boosted_diags/analysis_3Dbacktransformed_diag.py)24
-rw-r--r--Examples/Modules/boosted_diags/inputs_3d (renamed from Examples/Modules/boosted_diags/inputs_3d_slice)16
4 files changed, 9 insertions, 70 deletions
diff --git a/Examples/Modules/RigidInjection/analysis_rigid_injection_BoostedFrame.py b/Examples/Modules/RigidInjection/analysis_rigid_injection_BoostedFrame.py
index 8881eac7b..ccb551832 100755
--- a/Examples/Modules/RigidInjection/analysis_rigid_injection_BoostedFrame.py
+++ b/Examples/Modules/RigidInjection/analysis_rigid_injection_BoostedFrame.py
@@ -25,7 +25,6 @@ import sys
import numpy as np
import openpmd_api as io
-import read_raw_data
from scipy.constants import m_e
import yt
@@ -36,18 +35,10 @@ import checksumAPI
filename = sys.argv[1]
-# Tolerances to check consistency between legacy BTD and new BTD
+# Tolerances to check consistency between plotfile BTD and openPMD BTD
rtol = 1e-16
atol = 1e-16
-# Read data from legacy back-transformed diagnostics
-snapshot = './lab_frame_data/snapshots/snapshot00001'
-x_legacy = read_raw_data.get_particle_field(snapshot, 'beam', 'x')
-z_legacy = read_raw_data.get_particle_field(snapshot, 'beam', 'z')
-ux_legacy = read_raw_data.get_particle_field(snapshot, 'beam', 'ux')
-uy_legacy = read_raw_data.get_particle_field(snapshot, 'beam', 'uy')
-uz_legacy = read_raw_data.get_particle_field(snapshot, 'beam', 'uz')
-
# Read data from new back-transformed diagnostics (plotfile)
ds_plotfile = yt.load(filename)
x_plotfile = ds_plotfile.all_data()['beam', 'particle_position_x'].v
@@ -66,19 +57,12 @@ uy_openpmd = ds_openpmd.particles['beam']['momentum']['y'][:]
uz_openpmd = ds_openpmd.particles['beam']['momentum']['z'][:]
series.flush()
-# Sort and compare arrays to check consistency between legacy BTD and new BTD (plotfile)
-assert(np.allclose(np.sort(x_legacy), np.sort(x_plotfile), rtol=rtol, atol=atol))
-assert(np.allclose(np.sort(z_legacy), np.sort(z_plotfile), rtol=rtol, atol=atol))
-assert(np.allclose(np.sort(ux_legacy*m_e), np.sort(ux_plotfile), rtol=rtol, atol=atol))
-assert(np.allclose(np.sort(uy_legacy*m_e), np.sort(uy_plotfile), rtol=rtol, atol=atol))
-assert(np.allclose(np.sort(uz_legacy*m_e), np.sort(uz_plotfile), rtol=rtol, atol=atol))
-
-# Sort and compare arrays to check consistency between legacy BTD and new BTD (openPMD)
-assert(np.allclose(np.sort(x_legacy), np.sort(x_openpmd), rtol=rtol, atol=atol))
-assert(np.allclose(np.sort(z_legacy), np.sort(z_openpmd), rtol=rtol, atol=atol))
-assert(np.allclose(np.sort(ux_legacy*m_e), np.sort(ux_openpmd), rtol=rtol, atol=atol))
-assert(np.allclose(np.sort(uy_legacy*m_e), np.sort(uy_openpmd), rtol=rtol, atol=atol))
-assert(np.allclose(np.sort(uz_legacy*m_e), np.sort(uz_openpmd), rtol=rtol, atol=atol))
+# Sort and compare arrays to check consistency between plotfile BTD and openPMD BTD
+assert(np.allclose(np.sort(x_plotfile), np.sort(x_openpmd), rtol=rtol, atol=atol))
+assert(np.allclose(np.sort(z_plotfile), np.sort(z_openpmd), rtol=rtol, atol=atol))
+assert(np.allclose(np.sort(ux_plotfile), np.sort(ux_openpmd), rtol=rtol, atol=atol))
+assert(np.allclose(np.sort(uy_plotfile), np.sort(uy_openpmd), rtol=rtol, atol=atol))
+assert(np.allclose(np.sort(uz_plotfile), np.sort(uz_openpmd), rtol=rtol, atol=atol))
# Initial parameters
z0 = 20.e-6
@@ -86,8 +70,8 @@ x0 = 1.e-6
theta0 = np.arcsin(0.1)
# Theoretical beam width after propagation with rigid injection
-z = np.mean(z_legacy)
-x = np.std(x_legacy)
+z = np.mean(z_plotfile)
+x = np.std(x_plotfile)
print(f'Beam position = {z}')
print(f'Beam width = {x}')
diff --git a/Examples/Modules/RigidInjection/inputs_2d_BoostedFrame b/Examples/Modules/RigidInjection/inputs_2d_BoostedFrame
index d5c4c2b3c..9bf858b8d 100644
--- a/Examples/Modules/RigidInjection/inputs_2d_BoostedFrame
+++ b/Examples/Modules/RigidInjection/inputs_2d_BoostedFrame
@@ -68,8 +68,3 @@ diag2.fields_to_plot = Ex Ey Ez Bx By Bz jx jy jz rho
diag2.format = openpmd
diag2.openpmd_backend = h5
diag2.buffer_size = 32
-
-# old BTD diagnostics
-warpx.do_back_transformed_diagnostics = 1
-warpx.num_snapshots_lab = 2
-warpx.dt_snapshots_lab = 1.8679589331096515e-13
diff --git a/Examples/Modules/boosted_diags/analysis_3Dbacktransformed_diag.py b/Examples/Modules/boosted_diags/analysis.py
index 6fa4e9c93..c6c089f98 100755
--- a/Examples/Modules/boosted_diags/analysis_3Dbacktransformed_diag.py
+++ b/Examples/Modules/boosted_diags/analysis.py
@@ -21,7 +21,6 @@ import sys
import numpy as np
import openpmd_api as io
-import read_raw_data
import yt
yt.funcs.mylog.setLevel(0)
@@ -35,22 +34,6 @@ filename = sys.argv[1]
rtol = 1e-16
atol = 1e-16
-# Read data from legacy back-transformed diagnostics (entire domain)
-snapshot = './lab_frame_data/snapshots/snapshot00003'
-header = './lab_frame_data/snapshots/Header'
-allrd, info = read_raw_data.read_lab_snapshot(snapshot, header)
-Ez_legacy = allrd['Ez']
-print(f'Ez_legacy.shape = {Ez_legacy.shape}')
-Ez_legacy_1D = np.squeeze(Ez_legacy[Ez_legacy.shape[0]//2,Ez_legacy.shape[1]//2,:])
-
-# Read data from reduced back-transformed diagnostics (slice)
-snapshot_slice = './lab_frame_data/slices/slice00003'
-header_slice = './lab_frame_data/slices/Header'
-allrd, info = read_raw_data.read_lab_snapshot(snapshot_slice, header_slice)
-Ez_legacy_slice = allrd['Ez']
-print(f'Ez_legacy_slice.shape = {Ez_legacy_slice.shape}')
-Ez_legacy_slice_1D = np.squeeze(Ez_legacy_slice[Ez_legacy_slice.shape[0]//2,1,:])
-
# Read data from new back-transformed diagnostics (plotfile)
ds_plotfile = yt.load(filename)
data = ds_plotfile.covering_grid(
@@ -69,12 +52,5 @@ series.flush()
# Compare arrays to check consistency between new BTD formats (plotfile and openPMD)
assert(np.allclose(Ez_plotfile, Ez_openpmd, rtol=rtol, atol=atol))
-# Check slicing
-err = np.max(np.abs(Ez_legacy_slice_1D-Ez_legacy_1D)) / np.max(np.abs(Ez_legacy_1D))
-tol = 1e-16
-print(f'error = {err}')
-print(f'tolerance = {tol}')
-assert(err < tol)
-
test_name = os.path.split(os.getcwd())[1]
checksumAPI.evaluate_checksum(test_name, filename)
diff --git a/Examples/Modules/boosted_diags/inputs_3d_slice b/Examples/Modules/boosted_diags/inputs_3d
index ff68b5909..ba98558be 100644
--- a/Examples/Modules/boosted_diags/inputs_3d_slice
+++ b/Examples/Modules/boosted_diags/inputs_3d
@@ -55,7 +55,6 @@ electrons.zmax = .003
electrons.profile = constant
electrons.density = 3.5e24
electrons.do_continuous_injection = 1
-electrons.do_back_transformed_diagnostics = 1
ions.charge = q_e
ions.mass = m_p
@@ -71,7 +70,6 @@ ions.zmax = .003
ions.profile = constant
ions.density = 3.5e24
ions.do_continuous_injection = 1
-ions.do_back_transformed_diagnostics = 1
beam.charge = -q_e
beam.mass = m_e
@@ -104,14 +102,6 @@ laser1.profile_t_peak = 40.e-15 # The time at which the laser reaches its pea
laser1.profile_focal_distance = 0.5e-3 # Focal distance from the antenna (in meters)
laser1.wavelength = 0.81e-6 # The wavelength of the laser (in meters)
-slice.dom_lo = xmin 0.0 zmin
-slice.dom_hi = xmax 0.0 zmax
-slice.coarsening_ratio = 1 1 1
-slice.plot_int = -1
-slice.num_slice_snapshots_lab = 4
-slice.dt_slice_snapshots_lab = 3.3356409519815207e-12
-slice.particle_slice_width_lab = 2.e-6
-
# Diagnostics
diagnostics.diags_names = diag1 diag2
@@ -132,9 +122,3 @@ diag2.fields_to_plot = Ex Ey Ez Bx By Bz jx jy jz rho
diag2.format = openpmd
diag2.buffer_size = 32
diag2.openpmd_backend = h5
-
-# old BTD diagnostics
-warpx.do_back_transformed_diagnostics = 1
-warpx.num_snapshots_lab = 4
-warpx.dz_snapshots_lab = 0.001
-warpx.back_transformed_diag_fields= Ex Ey Ez By rho