forked from ECP-WarpX/WarpX
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding support for pml in domain for multiple patches (ECP-WarpX#4632)
* this works only on single proc, but lifts the assumption of single patch for do pml in domain * fix cbl * building reduced ba and cba * Removing print statements * removing comment * assert that box length must be greater than size of pml when its grown inwards * same assertion for box length for coarse grid * simplified_list and no need for assert in coarse, but if fine works, coarse should * boxlist instead of simplified list * comments * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * CI test for double patch with particles entering and leaving pml inside the patch * checksum for new particles in pml 2d mr test with double patch * renaming plt to diag1 again * include level 0 maxfield to capture no j damping effect * removing incorect comment about heavy paritcle in input --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
5e66d0e
commit 6be87d6
Showing
5 changed files
with
136 additions
and
50 deletions.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
Examples/Tests/particles_in_pml/analysis_particles_in_pml_2dmr.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# Copyright 2019-2020 Luca Fedeli, Maxence Thevenet, Remi Lehe | ||
# | ||
# | ||
# This file is part of WarpX. | ||
# | ||
# License: BSD-3-Clause-LBNL | ||
|
||
""" | ||
This script tests the absorption of particles in the PML. | ||
The input file inputs_2d/inputs is used: it features a positive and a | ||
negative particle, going in opposite direction and eventually | ||
leaving the box. This script tests that the field in the box | ||
is close to 0 once the particles have left. With regular | ||
PML, this test fails, since the particles leave a spurious | ||
charge, with associated fields, behind them. | ||
""" | ||
import os | ||
import sys | ||
|
||
import yt | ||
|
||
yt.funcs.mylog.setLevel(0) | ||
sys.path.insert(1, '../../../../warpx/Regression/Checksum/') | ||
import checksumAPI | ||
|
||
# Open plotfile specified in command line | ||
filename = sys.argv[1] | ||
ds = yt.load( filename ) | ||
|
||
# Check that the field is low enough | ||
ad0 = ds.covering_grid(level=0, left_edge=ds.domain_left_edge, dims=ds.domain_dimensions) | ||
Ex_array_lev0 = ad0[('mesh','Ex')].to_ndarray() | ||
Ey_array_lev0 = ad0[('mesh','Ey')].to_ndarray() | ||
Ez_array_lev0 = ad0[('mesh','Ez')].to_ndarray() | ||
max_Efield_lev0 = max(Ex_array_lev0.max(), Ey_array_lev0.max(), Ez_array_lev0.max()) | ||
print( "max_Efield level0 = %s" %max_Efield_lev0 ) | ||
|
||
ad1 = ds.covering_grid(level=1, left_edge=ds.domain_left_edge, dims=ds.domain_dimensions) | ||
Ex_array_lev1 = ad1[('mesh','Ex')].to_ndarray() | ||
Ey_array_lev1 = ad1[('mesh','Ey')].to_ndarray() | ||
Ez_array_lev1 = ad1[('mesh','Ez')].to_ndarray() | ||
max_Efield_lev1 = max(Ex_array_lev1.max(), Ey_array_lev1.max(), Ez_array_lev1.max()) | ||
print( "max_Efield level1 = %s" %max_Efield_lev1 ) | ||
|
||
# The field associated with the particle does not have | ||
# the same amplitude in 2d and 3d | ||
if ds.dimensionality == 2: | ||
if ds.max_level == 0: | ||
tolerance_abs = 0.0003 | ||
elif ds.max_level == 1: | ||
tolerance_abs = 0.0006 | ||
elif ds.dimensionality == 3: | ||
if ds.max_level == 0: | ||
tolerance_abs = 10 | ||
elif ds.max_level == 1: | ||
tolerance_abs = 110 | ||
else: | ||
raise ValueError("Unknown dimensionality") | ||
|
||
print("tolerance_abs: " + str(tolerance_abs)) | ||
assert max_Efield_lev0 < tolerance_abs | ||
assert max_Efield_lev1 < tolerance_abs | ||
|
||
test_name = os.path.split(os.getcwd())[1] | ||
checksumAPI.evaluate_checksum(test_name, filename) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
Regression/Checksum/benchmarks_json/particles_in_pml_2d_MR.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters