From fcaecc271d4e0ed940d089f111f4c4ac14fc7574 Mon Sep 17 00:00:00 2001 From: Edoardo Zoni Date: Thu, 17 Aug 2023 13:54:34 -0700 Subject: [PATCH] More tests with openPMD output --- Examples/Tests/AcceleratorLattice/analysis.py | 9 +++++--- .../Tests/AcceleratorLattice/inputs_quad_3d | 8 +++++-- .../AcceleratorLattice/inputs_quad_boosted_3d | 8 +++++-- .../AcceleratorLattice/inputs_quad_moving_3d | 8 +++++-- Examples/Tests/nci_fdtd_stability/inputs_2d | 10 ++++---- ...ard_edged_quadrupoles_boosted_openpmd.json | 22 ++++++++++++++++++ ...d_edged_quadrupoles_boosted_plotfile.json} | 0 ...hard_edged_quadrupoles_moving_openpmd.json | 22 ++++++++++++++++++ ...rd_edged_quadrupoles_moving_plotfile.json} | 0 .../hard_edged_quadrupoles_openpmd.json | 23 +++++++++++++++++++ ...n => hard_edged_quadrupoles_plotfile.json} | 0 11 files changed, 95 insertions(+), 15 deletions(-) create mode 100644 Regression/Checksum/benchmarks_json/hard_edged_quadrupoles_boosted_openpmd.json rename Regression/Checksum/benchmarks_json/{hard_edged_quadrupoles_boosted.json => hard_edged_quadrupoles_boosted_plotfile.json} (100%) create mode 100644 Regression/Checksum/benchmarks_json/hard_edged_quadrupoles_moving_openpmd.json rename Regression/Checksum/benchmarks_json/{hard_edged_quadrupoles_moving.json => hard_edged_quadrupoles_moving_plotfile.json} (100%) create mode 100644 Regression/Checksum/benchmarks_json/hard_edged_quadrupoles_openpmd.json rename Regression/Checksum/benchmarks_json/{hard_edged_quadrupoles.json => hard_edged_quadrupoles_plotfile.json} (100%) diff --git a/Examples/Tests/AcceleratorLattice/analysis.py b/Examples/Tests/AcceleratorLattice/analysis.py index 55fb1b2ac96..d6ec99ac936 100755 --- a/Examples/Tests/AcceleratorLattice/analysis.py +++ b/Examples/Tests/AcceleratorLattice/analysis.py @@ -26,8 +26,10 @@ sys.path.insert(1, '../../../../warpx/Regression/Checksum/') import checksumAPI -filename = sys.argv[1] -ds = yt.load( filename ) +plotfile = sys.argv[1] +opmdfile = './diags/diag2' + +ds = yt.load(plotfile) ad = ds.all_data() gamma_boost = float(ds.parameters.get('warpx.gamma_boost', 1.)) @@ -113,4 +115,5 @@ def applylens(x0, vx0, vz0, gamma, lens_length, lens_strength): assert abs(np.abs((ux - ux_sim)/ux)) < 0.002, Exception('error in x particle velocity') test_name = os.path.split(os.getcwd())[1] -checksumAPI.evaluate_checksum(test_name, filename) +checksumAPI.evaluate_checksum(test_name, output_file=plotfile, output_format='plotfile') +checksumAPI.evaluate_checksum(test_name, output_file=opmdfile, output_format='openpmd') diff --git a/Examples/Tests/AcceleratorLattice/inputs_quad_3d b/Examples/Tests/AcceleratorLattice/inputs_quad_3d index 2bc98f64118..eb1cd5c96ad 100644 --- a/Examples/Tests/AcceleratorLattice/inputs_quad_3d +++ b/Examples/Tests/AcceleratorLattice/inputs_quad_3d @@ -46,6 +46,10 @@ quad2.ds = 0.4 quad2.dEdx = -1.e4 # Diagnostics -diagnostics.diags_names = diag1 -diag1.intervals = 50 +diagnostics.diags_names = diag1 diag2 diag1.diag_type = Full +diag1.format = plotfile +diag1.intervals = 50 +diag2.diag_type = Full +diag2.format = openpmd +diag2.intervals = 50 diff --git a/Examples/Tests/AcceleratorLattice/inputs_quad_boosted_3d b/Examples/Tests/AcceleratorLattice/inputs_quad_boosted_3d index 668ec73d2dd..3c77e02571f 100644 --- a/Examples/Tests/AcceleratorLattice/inputs_quad_boosted_3d +++ b/Examples/Tests/AcceleratorLattice/inputs_quad_boosted_3d @@ -40,6 +40,10 @@ quad2.ds = 0.4 quad2.dEdx = -1.e4 # Diagnostics -diagnostics.diags_names = diag1 -diag1.intervals = 50 +diagnostics.diags_names = diag1 diag2 diag1.diag_type = Full +diag1.format = plotfile +diag1.intervals = 50 +diag2.diag_type = Full +diag2.format = openpmd +diag2.intervals = 50 diff --git a/Examples/Tests/AcceleratorLattice/inputs_quad_moving_3d b/Examples/Tests/AcceleratorLattice/inputs_quad_moving_3d index e5ec0a59584..3a698d2df04 100644 --- a/Examples/Tests/AcceleratorLattice/inputs_quad_moving_3d +++ b/Examples/Tests/AcceleratorLattice/inputs_quad_moving_3d @@ -44,6 +44,10 @@ quad2.ds = 0.4 quad2.dEdx = -1.e4 # Diagnostics -diagnostics.diags_names = diag1 -diag1.intervals = 50 +diagnostics.diags_names = diag1 diag2 diag1.diag_type = Full +diag1.format = plotfile +diag1.intervals = 50 +diag2.diag_type = Full +diag2.format = openpmd +diag2.intervals = 50 diff --git a/Examples/Tests/nci_fdtd_stability/inputs_2d b/Examples/Tests/nci_fdtd_stability/inputs_2d index d738855aaf6..f433aed96b2 100644 --- a/Examples/Tests/nci_fdtd_stability/inputs_2d +++ b/Examples/Tests/nci_fdtd_stability/inputs_2d @@ -68,11 +68,9 @@ ions.ymax = +10.e-6 + 1e-7 # adding buffer of fraction of cell-size # Diagnostics diagnostics.diags_names = diag1 diag2 - -diag1.intervals = 10000 -diag1.format = plotfile diag1.diag_type = Full - -diag2.intervals = 10000 -diag2.format = openpmd +diag1.format = plotfile +diag1.intervals = 10000 diag2.diag_type = Full +diag2.format = openpmd +diag2.intervals = 10000 diff --git a/Regression/Checksum/benchmarks_json/hard_edged_quadrupoles_boosted_openpmd.json b/Regression/Checksum/benchmarks_json/hard_edged_quadrupoles_boosted_openpmd.json new file mode 100644 index 00000000000..d8170553193 --- /dev/null +++ b/Regression/Checksum/benchmarks_json/hard_edged_quadrupoles_boosted_openpmd.json @@ -0,0 +1,22 @@ +{ + "lev=0": { + "Bx": 3.254531465641299e-14, + "By": 3.276809240949724e-14, + "Bz": 1.0615286316115558e-16, + "Ex": 2.30845657253269e-05, + "Ey": 2.2656898931877975e-05, + "Ez": 1.997747654112569e-05, + "jx": 1.7819477343635878e-10, + "jy": 4.2163030523377745e-20, + "jz": 1.037883938249774e-07 + }, + "electron": { + "x": 0.049960237123814574, + "y": 8.397636119991403e-15, + "z": 0.10931687737912647, + "ux": 0.00021807544879239295, + "uy": 5.350848993804499e-14, + "uz": 0.12701663537367266, + "w": 1.0 + } +} diff --git a/Regression/Checksum/benchmarks_json/hard_edged_quadrupoles_boosted.json b/Regression/Checksum/benchmarks_json/hard_edged_quadrupoles_boosted_plotfile.json similarity index 100% rename from Regression/Checksum/benchmarks_json/hard_edged_quadrupoles_boosted.json rename to Regression/Checksum/benchmarks_json/hard_edged_quadrupoles_boosted_plotfile.json diff --git a/Regression/Checksum/benchmarks_json/hard_edged_quadrupoles_moving_openpmd.json b/Regression/Checksum/benchmarks_json/hard_edged_quadrupoles_moving_openpmd.json new file mode 100644 index 00000000000..2c60e1f4d22 --- /dev/null +++ b/Regression/Checksum/benchmarks_json/hard_edged_quadrupoles_moving_openpmd.json @@ -0,0 +1,22 @@ +{ + "lev=0": { + "Bx": 0.0, + "By": 0.0, + "Bz": 0.0, + "Ex": 6.0282565190090465e-05, + "Ey": 6.38479659567398e-05, + "Ez": 7.880459213065183e-05, + "jx": 0.0, + "jy": 0.0, + "jz": 0.0 + }, + "electron": { + "x": 0.03492328774188008, + "y": 9.300626840674328e-11, + "z": 1.4915217664724023, + "ux": 0.0007623569514165381, + "uy": 8.537801353786367e-12, + "uz": 0.10000000000071513, + "w": 1.0 + } +} diff --git a/Regression/Checksum/benchmarks_json/hard_edged_quadrupoles_moving.json b/Regression/Checksum/benchmarks_json/hard_edged_quadrupoles_moving_plotfile.json similarity index 100% rename from Regression/Checksum/benchmarks_json/hard_edged_quadrupoles_moving.json rename to Regression/Checksum/benchmarks_json/hard_edged_quadrupoles_moving_plotfile.json diff --git a/Regression/Checksum/benchmarks_json/hard_edged_quadrupoles_openpmd.json b/Regression/Checksum/benchmarks_json/hard_edged_quadrupoles_openpmd.json new file mode 100644 index 00000000000..dc23fe0c40c --- /dev/null +++ b/Regression/Checksum/benchmarks_json/hard_edged_quadrupoles_openpmd.json @@ -0,0 +1,23 @@ +{ + "lev=0": { + "Bx": 0.0, + "By": 0.0, + "Bz": 0.0, + "Ex": 9.882421146615367e-06, + "Ey": 1.044026104671425e-05, + "Ez": 1.0037396973247306e-05, + "jx": 0.0, + "jy": 0.0, + "jz": 0.0 + }, + "electron": { + "x": 0.03492328774658799, + "y": 2.2742551618036812e-11, + "z": 1.4915217664612082, + "ux": 0.0007623569511711921, + "uy": 2.2142207983801314e-12, + "uz": 0.09999999999967848, + "w": 1.0 + } +} + diff --git a/Regression/Checksum/benchmarks_json/hard_edged_quadrupoles.json b/Regression/Checksum/benchmarks_json/hard_edged_quadrupoles_plotfile.json similarity index 100% rename from Regression/Checksum/benchmarks_json/hard_edged_quadrupoles.json rename to Regression/Checksum/benchmarks_json/hard_edged_quadrupoles_plotfile.json