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 2, 2024
1 parent a38774a commit e9ac10f
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 4 deletions.
15 changes: 15 additions & 0 deletions Examples/Tests/electrostatic_dirichlet_bc/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,16 @@
# Possible running time: ~ 19 s

import glob
import os
import re
import sys

import numpy as np
import yt

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

files = sorted(glob.glob("diags/diag1*"))[1:]
assert len(files) > 0

Expand All @@ -39,3 +45,12 @@

assert np.allclose(potentials_lo, expected_potentials_lo, rtol=0.1)
assert np.allclose(potentials_hi, expected_potentials_hi, rtol=0.1)

# The PICMI and native input versions run the same test, so
# their results are compared to the same benchmark file
test_name = os.path.split(os.getcwd())[1]
test_name = re.sub("_picmi", "", test_name)
evaluate_checksum(
test_name=test_name,
output_file=sys.argv[1],
)
18 changes: 14 additions & 4 deletions Examples/Tests/particle_boundary_process/analysis_absorption.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
#!/usr/bin/env python3

import sys

import yt

# This test shoots a beam of electrons at cubic embedded boundary geometry
# At time step 40, none of the particles have hit the boundary yet. At time
# step 60, all of them should have been absorbed by the boundary. In the
# absence of the cube, none of the particles would have had time to exit
# the problem domain yet.

import os
import sys

import yt

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

# all particles are still there
ds40 = yt.load("diags/diag1000040")
np40 = ds40.index.particle_headers["electrons"].num_particles
Expand All @@ -20,3 +24,9 @@
ds60 = yt.load(filename)
np60 = ds60.index.particle_headers["electrons"].num_particles
assert np60 == 0

# compare checksums
evaluate_checksum(
test_name=os.path.split(os.getcwd())[1],
output_file=sys.argv[1],
)
5 changes: 5 additions & 0 deletions Regression/Checksum/benchmarks_json/test_2d_dirichlet_bc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lev=0": {
"phi": 10817.97280547637
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"lev=0": {
"Bx": 202106.71291347666,
"By": 202106.71291347663,
"Bz": 3371.897999274175,
"Ex": 38304043178806.11,
"Ey": 38304043178806.11,
"Ez": 83057027925874.84
}
}

0 comments on commit e9ac10f

Please sign in to comment.