From f827d7e0afdbbdf0459c6f72ae8d34430c2a2d8f Mon Sep 17 00:00:00 2001 From: Edoardo Zoni Date: Wed, 2 Oct 2024 09:07:04 -0700 Subject: [PATCH] Add missing checksums --- .../embedded_boundary_python_api/analysis.py | 11 ++++++++++- Examples/Tests/field_probe/analysis.py | 12 ++++++++++++ .../particle_boundary_process/CMakeLists.txt | 2 +- .../analysis_default_regression.py | 1 + .../analysis_reflection.py | 15 --------------- .../inputs_test_2d_particle_reflection_picmi.py | 4 ---- .../benchmarks_json/test_2d_field_probe.json | 10 ++++++++++ .../test_2d_particle_reflection_picmi.json | 7 +++++++ .../test_3d_embedded_boundary_picmi.json | 5 +++++ 9 files changed, 46 insertions(+), 21 deletions(-) create mode 120000 Examples/Tests/particle_boundary_process/analysis_default_regression.py delete mode 100755 Examples/Tests/particle_boundary_process/analysis_reflection.py create mode 100644 Regression/Checksum/benchmarks_json/test_2d_field_probe.json create mode 100644 Regression/Checksum/benchmarks_json/test_2d_particle_reflection_picmi.json create mode 100644 Regression/Checksum/benchmarks_json/test_3d_embedded_boundary_picmi.json diff --git a/Examples/Tests/embedded_boundary_python_api/analysis.py b/Examples/Tests/embedded_boundary_python_api/analysis.py index 09cc2accfea..7fda682f618 100755 --- a/Examples/Tests/embedded_boundary_python_api/analysis.py +++ b/Examples/Tests/embedded_boundary_python_api/analysis.py @@ -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], +) diff --git a/Examples/Tests/field_probe/analysis.py b/Examples/Tests/field_probe/analysis.py index 57085fb7cdc..e974e284b65 100755 --- a/Examples/Tests/field_probe/analysis.py +++ b/Examples/Tests/field_probe/analysis.py @@ -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 @@ -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], +) diff --git a/Examples/Tests/particle_boundary_process/CMakeLists.txt b/Examples/Tests/particle_boundary_process/CMakeLists.txt index a7081fe9090..499cf445da5 100644 --- a/Examples/Tests/particle_boundary_process/CMakeLists.txt +++ b/Examples/Tests/particle_boundary_process/CMakeLists.txt @@ -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 ) diff --git a/Examples/Tests/particle_boundary_process/analysis_default_regression.py b/Examples/Tests/particle_boundary_process/analysis_default_regression.py new file mode 120000 index 00000000000..d8ce3fca419 --- /dev/null +++ b/Examples/Tests/particle_boundary_process/analysis_default_regression.py @@ -0,0 +1 @@ +../../analysis_default_regression.py \ No newline at end of file diff --git a/Examples/Tests/particle_boundary_process/analysis_reflection.py b/Examples/Tests/particle_boundary_process/analysis_reflection.py deleted file mode 100755 index 1187a58e75d..00000000000 --- a/Examples/Tests/particle_boundary_process/analysis_reflection.py +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env python3 - -# Copyright 2021 Modern Electron -# -# License: BSD-3-Clause-LBNL - -# This script just checks that the PICMI file executed successfully. -# If it did there will be a plotfile for the final step. - -import yt - -plotfile = "Python_particle_reflection_plt000010" -ds = yt.load(plotfile) # noqa - -assert True diff --git a/Examples/Tests/particle_boundary_process/inputs_test_2d_particle_reflection_picmi.py b/Examples/Tests/particle_boundary_process/inputs_test_2d_particle_reflection_picmi.py index 0803bc05d59..ef1b7d45e1a 100755 --- a/Examples/Tests/particle_boundary_process/inputs_test_2d_particle_reflection_picmi.py +++ b/Examples/Tests/particle_boundary_process/inputs_test_2d_particle_reflection_picmi.py @@ -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", ) ########################## diff --git a/Regression/Checksum/benchmarks_json/test_2d_field_probe.json b/Regression/Checksum/benchmarks_json/test_2d_field_probe.json new file mode 100644 index 00000000000..cb82acfc067 --- /dev/null +++ b/Regression/Checksum/benchmarks_json/test_2d_field_probe.json @@ -0,0 +1,10 @@ +{ + "lev=0": { + "Bx": 0.0, + "By": 126826.78487921853, + "Bz": 0.0, + "Ex": 32517064310550.266, + "Ey": 0.0, + "Ez": 17321323003697.61 + } +} diff --git a/Regression/Checksum/benchmarks_json/test_2d_particle_reflection_picmi.json b/Regression/Checksum/benchmarks_json/test_2d_particle_reflection_picmi.json new file mode 100644 index 00000000000..97d0c1f5e58 --- /dev/null +++ b/Regression/Checksum/benchmarks_json/test_2d_particle_reflection_picmi.json @@ -0,0 +1,7 @@ +{ + "lev=0": { + "Ex": 4.865922376234882e-11, + "Ey": 0.0, + "Ez": 2.3293326580399806e-10 + } +} diff --git a/Regression/Checksum/benchmarks_json/test_3d_embedded_boundary_picmi.json b/Regression/Checksum/benchmarks_json/test_3d_embedded_boundary_picmi.json new file mode 100644 index 00000000000..f3483a544b5 --- /dev/null +++ b/Regression/Checksum/benchmarks_json/test_3d_embedded_boundary_picmi.json @@ -0,0 +1,5 @@ +{ + "lev=0": { + "Ex": 0.0 + } +}