Skip to content

Commit

Permalink
Add missing checksums
Browse files Browse the repository at this point in the history
  • Loading branch information
EZoni committed Oct 3, 2024
1 parent 2d7e944 commit 3ee6ecf
Show file tree
Hide file tree
Showing 13 changed files with 111 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
#!/usr/bin/env python3

import os
import sys

import numpy as np
import openpmd_api as io

sys.path.insert(1, "../../../../warpx/Regression/Checksum/")
from checksumAPI import evaluate_checksum

filename = sys.argv[1]
series = io.Series(f"{filename}/openpmd_%T.h5", io.Access.read_only)

Expand Down Expand Up @@ -63,3 +67,10 @@
assert (
(electron_meanz > 0) and (beam_meanz < 0)
), "problem with openPMD+RZ. Maybe openPMD+RZ mixed up the order of rho_<species> diagnostics?"

# compare checksums
evaluate_checksum(
test_name=os.path.split(os.getcwd())[1],
output_file=sys.argv[1],
output_format="openpmd",
)
11 changes: 10 additions & 1 deletion Examples/Tests/embedded_boundary_python_api/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,17 @@
# This script just checks that the PICMI file executed successfully.
# If it did there will be a plotfile for the final step.

import os
import sys

step = int(sys.argv[1][-5:])
sys.path.insert(1, "../../../../warpx/Regression/Checksum/")
from checksumAPI import evaluate_checksum

step = int(sys.argv[1][-5:])
assert step == 2

# compare checksums
evaluate_checksum(
test_name=os.path.split(os.getcwd())[1],
output_file=sys.argv[1],
)
12 changes: 12 additions & 0 deletions Examples/Tests/field_probe/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,15 @@
which can be solved analytically.
"""

import os
import sys

import numpy as np
import pandas as pd

sys.path.insert(1, "../../../../warpx/Regression/Checksum/")
from checksumAPI import evaluate_checksum

filename = "diags/reducedfiles/FP_line.txt"

# Open data file
Expand Down Expand Up @@ -59,3 +65,9 @@ def I_envelope(x, lam=0.2e-6, a=0.3e-6, D=1.7e-6):
print("Average error greater than 2.5%")

assert averror < 2.5

# compare checksums
evaluate_checksum(
test_name=os.path.split(os.getcwd())[1],
output_file=sys.argv[1],
)
2 changes: 1 addition & 1 deletion Examples/Tests/particle_boundary_process/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ add_warpx_test(
2 # dims
1 # nprocs
inputs_test_2d_particle_reflection_picmi.py # inputs
analysis_reflection.py # analysis
analysis_default_regression.py # analysis
diags/diag1000010 # output
OFF # dependency
)
Expand Down
15 changes: 0 additions & 15 deletions Examples/Tests/particle_boundary_process/analysis_reflection.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,12 @@
particle_diag = picmi.ParticleDiagnostic(
name="diag1",
period=10,
write_dir=".",
warpx_file_prefix="Python_particle_reflection_plt",
)
field_diag = picmi.FieldDiagnostic(
grid=grid,
name="diag1",
data_list=["E"],
period=10,
write_dir=".",
warpx_file_prefix="Python_particle_reflection_plt",
)

##########################
Expand Down
15 changes: 5 additions & 10 deletions Examples/Tests/restart/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,24 @@ add_warpx_test(
OFF # dependency
)

# TODO
# - Add checksums file
# - Enable analysis
add_warpx_test(
test_2d_runtime_components_picmi # name
2 # dims
1 # nprocs
inputs_test_2d_runtime_components_picmi.py # inputs
OFF #analysis_default_regression.py # analysis
OFF #diags/diag1000010 # output
analysis_default_regression.py # analysis
diags/diag1000010 # output
OFF # dependency
)

# TODO
# - Add checksums file
# - Enable analysis
# FIXME
add_warpx_test(
test_2d_runtime_components_picmi_restart # name
2 # dims
1 # nprocs
"inputs_test_2d_runtime_components_picmi.py amr.restart='../test_2d_runtime_components_picmi/diags/chk000005'" # inputs
OFF #analysis_default_restart.py # analysis
OFF #diags/diag1000010 # output
OFF #analysis_default_restart.py # analysis
OFF #diags/diag1000010 # output
test_2d_runtime_components_picmi # dependency
)

Expand Down
10 changes: 10 additions & 0 deletions Regression/Checksum/benchmarks_json/test_2d_field_probe.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"lev=0": {
"Bx": 0.0,
"By": 126826.78487921853,
"Bz": 0.0,
"Ex": 32517064310550.266,
"Ey": 0.0,
"Ez": 17321323003697.61
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"lev=0": {
"Ex": 4.865922376234882e-11,
"Ey": 0.0,
"Ez": 2.3293326580399806e-10
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"lev=0": {
"phi": 0.001516261626005395
},
"electrons": {
"particle_momentum_x": 7.75165529536844e-26,
"particle_momentum_y": 6.938526597814195e-26,
"particle_momentum_z": 6.572519525636007e-26,
"particle_newPid": 500.0,
"particle_position_x": 1.4999588764814886,
"particle_position_y": 1.4999551809410656,
"particle_weight": 200.0
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lev=0": {
"Ex": 0.0
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"lev=0": {
"Bt": 4299.677335258863,
"Bz": 34749.512290662635,
"Er": 1343319090029.9607,
"jr": 5229952989213.152,
"jt": 9.287962600874053e+17,
"jz": 3712414162446391.5,
"part_per_cell": 6288.0,
"part_per_grid": 25755648.0,
"rho": 102920475.65331206,
"rho_beam": 12377109.352622943,
"rho_electrons": 90543366.3006891
},
"beam": {
"particle_position_x": 3.651481908823126e-05,
"particle_position_y": 4.275668879776449e-05,
"particle_position_z": 0.0025531549045483943,
"particle_momentum_x": 3.879691286254116e-20,
"particle_momentum_y": 5.0782566944104114e-20,
"particle_momentum_z": 1.3503182565048374e-17,
"particle_weight": 6241509.074460764
},
"electrons": {
"particle_origX": 0.03652440297475791,
"particle_origZ": 0.06924276562500002,
"particle_position_x": 0.036524412900510936,
"particle_position_y": 0.03652445428108603,
"particle_position_z": 0.06924303765442104,
"particle_momentum_x": 5.508781425380743e-23,
"particle_momentum_y": 7.236141259605716e-21,
"particle_momentum_z": 4.4528442530356535e-22,
"particle_weight": 1118799420.1067173
}
}

0 comments on commit 3ee6ecf

Please sign in to comment.