Skip to content

Commit

Permalink
Merge branch 'add_analysis_embedded_boundary_removal_depth' of https:…
Browse files Browse the repository at this point in the history
…//github.com/oshapoval/WarpX into add_analysis_embedded_boundary_removal_depth
  • Loading branch information
oshapoval committed Sep 17, 2024
2 parents 5615c12 + e27d29e commit 92c76a6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Examples/Tests/embedded_boundary_removal_depth/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
test_name = os.path.split(os.getcwd())[1]
checksumAPI.evaluate_checksum(test_name, filename, output_format="openpmd")


def get_avg_divE(ts, start_avg_iter, end_avg_iter, ar_size):
avg_divE = np.zeros((ar_size, ar_size))
for iteration in tqdm.tqdm(ts.iterations[start_avg_iter:end_avg_iter]):
Expand All @@ -44,6 +45,7 @@ def plot(array, vmax=1e-9):
ax.set_ylabel("z (m)")
ax.set_title("Averaged divE")


ts = OpenPMDTimeSeries("./diags/diag1/")

ar_size = 32
Expand All @@ -56,10 +58,12 @@ def plot(array, vmax=1e-9):

tolerance = 1e-9


def check_tolerance(array, tolerance):
assert np.all(
array <= tolerance
), f"Test did not pass: one or more elements exceed the tolerance of {tolerance}."
print("All elements of are within the tolerance.")


check_tolerance(divE_avg, tolerance)

0 comments on commit 92c76a6

Please sign in to comment.