Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do_pml should not be parsed anymore. #2183

Merged
merged 13 commits into from
Aug 16, 2021
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Docs/source/dataanalysis/inputs.2d
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ insitu.int = 2
insitu.start = 0
insitu.config = ez2d.xml
geometry.coord_sys = 0 # 0: Cartesian
geometry.is_periodic = 0 0 # Is periodic?
boundary.field_lo = pml pml
boundary.field_hi = pml pml
geometry.prob_lo = -125.e-6 -149.e-6
geometry.prob_hi = 125.e-6 1.e-6
warpx.fine_tag_lo = -12.e-6 -110.e-6
Expand All @@ -29,7 +30,6 @@ algo.particle_pusher = 0
algo.particle_shape = 3
algo.maxwell_solver = ckc
warpx.use_filter = 1
warpx.do_pml = 1
warpx.pml_ncell = 10
warpx.cfl = .99
warpx.do_moving_window = 1
Expand Down
2 changes: 1 addition & 1 deletion Docs/source/usage/parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ Domain Boundary Conditions
--------------------------

* ``boundary.field_lo`` and ``boundary.field_hi`` (`2 strings` for 2D, `3 strings` for 3D, `pml` by default)
Boundary conditions applied to field at the lower and upper domain boundaries. Depending on the type of boundary condition, the value for ``geometry.is_periodic`` will be set, overriding the user-input for the input parameter, ``geometry.is_periodic``. If not set, the default value for the fields at the domain boundary will be set to pml.
Boundary conditions applied to fields at the lower and upper domain boundaries.
Options are:

* ``Periodic``: This option can be used to set periodic domain boundaries. Note that if the fields for lo in a certain dimension are set to periodic, then the corresponding upper boundary must also be set to periodic. If particle boundaries are not specified in the input file, then particles boundaries by default will be set to periodic. If particles boundaries are specified, then they must be set to periodic corresponding to the periodic field boundaries.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
hi = [25e-6, 25e-6, 200.e-6])

solver = picmi.ElectromagneticSolver(grid=grid, cfl=1,
warpx_do_pml = True,
warpx_pml_ncell = 10)

beam_distribution = picmi.UniformDistribution(density = 1.e23,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
moving_window_zvelocity = 0.,
warpx_max_grid_size=64)

solver = picmi.ElectromagneticSolver(grid=grid, cfl=1., warpx_do_pml=False)
solver = picmi.ElectromagneticSolver(grid=grid, cfl=1.)

##########################
# diagnostics
Expand Down
1 change: 0 additions & 1 deletion Examples/Tests/SilverMueller/inputs_2d_x
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ warpx.verbose = 1

# Algorithms
warpx.cfl = 1.0
warpx.do_pml = 0
warpx.use_filter = 0

warpx.do_moving_window = 0
Expand Down
1 change: 0 additions & 1 deletion Examples/Tests/SilverMueller/inputs_2d_z
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ warpx.verbose = 1

# Algorithms
warpx.cfl = 1.0
warpx.do_pml = 0
warpx.use_filter = 0

warpx.do_moving_window = 0
Expand Down
1 change: 0 additions & 1 deletion Examples/Tests/SilverMueller/inputs_rz_z
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ warpx.n_rz_azimuthal_modes = 2

# Algorithms
warpx.cfl = 1.0
warpx.do_pml = 0
warpx.use_filter = 0

warpx.do_moving_window = 0
Expand Down
2 changes: 0 additions & 2 deletions Examples/Tests/boundaries/inputs_3d
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ boundary.field_hi = pec pec periodic
boundary.particle_lo = reflecting absorbing periodic
boundary.particle_hi = reflecting absorbing periodic

warpx.do_pml = 0

# Algorithms
algo.particle_shape = 1

Expand Down
1 change: 0 additions & 1 deletion Examples/Tests/galilean/inputs_rz
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ particles.species_names = electrons ions

warpx.do_nodal = 1
warpx.use_filter = 1
warpx.do_pml = 0

psatd.nox = 16
psatd.noy = 16
Expand Down
1 change: 0 additions & 1 deletion Examples/Tests/multi_J/inputs_rz
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ algo.particle_shape = 3

# Numerics
warpx.do_moving_window = 1
warpx.do_pml = 0
warpx.moving_window_dir = z
warpx.moving_window_v = 1.
warpx.n_rz_azimuthal_modes = 1
Expand Down
4 changes: 2 additions & 2 deletions Examples/Tests/photon_pusher/analysis_photon_pusher.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ def generate():
f.write("amr.max_grid_size = 8\n")
f.write("amr.plot_int = 1\n")
f.write("geometry.coord_sys = 0\n")
f.write("geometry.is_periodic = 1 1 1\n")
f.write("boundary.field_lo = periodic periodic periodic\n")
f.write("boundary.field_hi = periodic periodic periodic\n")
f.write("geometry.prob_lo = -0.5e-6 -0.5e-6 -0.5e-6\n")
f.write("geometry.prob_hi = 0.5e-6 0.5e-6 0.5e-6\n")
f.write("warpx.do_pml = 0\n")
f.write("algo.charge_deposition = standard\n")
f.write("algo.field_gathering = energy-conserving\n")
f.write("warpx.cfl = 1.0\n")
Expand Down
1 change: 0 additions & 1 deletion Examples/Tests/plasma_lens/inputs_3d
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ boundary.field_hi = pec pec pec
boundary.particle_lo = absorbing absorbing absorbing
boundary.particle_hi = absorbing absorbing absorbing

warpx.do_pml = 0
warpx.const_dt = 1.e-7
warpx.do_electrostatic = labframe

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,10 @@ def generate():
f.write("amr.blocking_factor = 32\n")
f.write("amr.max_grid_size = 64\n")
f.write("geometry.coord_sys = 0\n")
f.write("geometry.is_periodic = 1 1 1\n")
f.write("boundary.field_lo = periodic periodic periodic\n")
f.write("boundary.field_hi = periodic periodic periodic\n")
f.write("geometry.prob_lo = {} {} {}\n".format(-sim_size, -sim_size, -sim_size))
f.write("geometry.prob_hi = {} {} {}\n".format(sim_size, sim_size, sim_size))
f.write("warpx.do_pml = 0\n")
f.write("algo.charge_deposition = standard\n")
f.write("algo.field_gathering = energy-conserving\n")
f.write("warpx.cfl = 1.0\n")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ amr.max_grid_size = 64
geometry.coord_sys = 0
geometry.prob_lo = -8e-07 -8e-07 -8e-07
geometry.prob_hi = 8e-07 8e-07 8e-07
warpx.do_pml = 0
algo.charge_deposition = standard
algo.field_gathering = energy-conserving
warpx.cfl = 1.0
Expand Down
2 changes: 0 additions & 2 deletions Python/pywarpx/picmi.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,6 @@ class ElectromagneticSolver(picmistandard.PICMI_ElectromagneticSolver):
def init(self, kw):
assert self.method is None or self.method in ['Yee', 'CKC', 'PSATD'], Exception("Only 'Yee', 'CKC', and 'PSATD' are supported")

self.do_pml = kw.pop('warpx_do_pml', None)
self.pml_ncell = kw.pop('warpx_pml_ncell', None)

if self.method == 'PSATD':
Expand All @@ -539,7 +538,6 @@ def initialize_inputs(self):

self.grid.initialize_inputs()

pywarpx.warpx.do_pml = self.do_pml
pywarpx.warpx.pml_ncell = self.pml_ncell
pywarpx.warpx.do_nodal = self.l_nodal

Expand Down
1 change: 1 addition & 0 deletions Source/WarpX.H
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ public:
void DampJPML (int lev, PatchType patch_type);

void CopyJPML ();
bool isAnyBoundaryPML();

/**
* \brief Synchronize the nodal points of the PML MultiFabs
Expand Down
51 changes: 16 additions & 35 deletions Source/WarpX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -666,14 +666,13 @@ WarpX::ReadParameters ()
}
}

pp_warpx.query("do_pml", do_pml);
pp_warpx.query("pml_ncell", pml_ncell);
pp_warpx.query("pml_delta", pml_delta);
pp_warpx.query("pml_has_particles", pml_has_particles);
pp_warpx.query("do_pml_j_damping", do_pml_j_damping);
pp_warpx.query("do_pml_in_domain", do_pml_in_domain);

if (do_multi_J && do_pml)
if (do_multi_J && isAnyBoundaryPML())
{
amrex::Abort("Multi-J algorithm not implemented with PMLs");
}
Expand Down Expand Up @@ -737,38 +736,8 @@ WarpX::ReadParameters ()
}

#ifdef WARPX_DIM_RZ
AMREX_ALWAYS_ASSERT_WITH_MESSAGE( do_pml==0,
"PML are not implemented in RZ geometry ; please set `warpx.do_pml=0`");
#endif
// setting default to 0
Vector<int> parse_do_pml_Lo(AMREX_SPACEDIM,0);
// Switching pml lo to 1 when do_pml = 1 and if domain is non-periodic
// Note to remove this code when new BC API is fully functional
if (do_pml == 1) {
for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
if ( Geom(0).isPeriodic(idim) == 0) parse_do_pml_Lo[idim] = 1;
}
}
pp_warpx.queryarr("do_pml_Lo", parse_do_pml_Lo);
do_pml_Lo[0] = parse_do_pml_Lo[0];
do_pml_Lo[1] = parse_do_pml_Lo[1];
#if (AMREX_SPACEDIM == 3)
do_pml_Lo[2] = parse_do_pml_Lo[2];
#endif
// setting default to 0
Vector<int> parse_do_pml_Hi(AMREX_SPACEDIM,0);
// Switching pml hi to 1 when do_pml = 1 and if domain is non-periodic
// Note to remove this code when new BC API is fully functional
if (do_pml == 1) {
for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
if ( Geom(0).isPeriodic(idim) == 0) parse_do_pml_Hi[idim] = 1;
}
}
pp_warpx.queryarr("do_pml_Hi", parse_do_pml_Hi);
do_pml_Hi[0] = parse_do_pml_Hi[0];
do_pml_Hi[1] = parse_do_pml_Hi[1];
#if (AMREX_SPACEDIM == 3)
do_pml_Hi[2] = parse_do_pml_Hi[2];
AMREX_ALWAYS_ASSERT_WITH_MESSAGE( isAnyBoundaryPML() == false,
"PML are not implemented in RZ geometry; please set a different boundary condition using boundary.field_lo and boundary.field_hi.");
#endif

if ( (do_pml_j_damping==1)&&(do_pml_in_domain==0) ){
Expand Down Expand Up @@ -1234,7 +1203,9 @@ WarpX::BackwardCompatibility ()
amrex::Abort("warpx.use_kspace_filter is not supported anymore. "
"Please use the flag use_filter, see documentation.");
}

if ( pp_warpx.query("do_pml", backward_int) ) {
amrex::Abort( "do_pml is not supported anymore. Please use boundary.field_lo and boundary.field_hi to set the boundary conditions.");
}
ParmParse pp_interpolation("interpolation");
if (pp_interpolation.query("nox", backward_int) ||
pp_interpolation.query("noy", backward_int) ||
Expand Down Expand Up @@ -2305,3 +2276,13 @@ WarpX::PicsarVersion ()
return std::string("Unknown");
#endif
}

bool
WarpX::isAnyBoundaryPML()
{
for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
if ( WarpX::field_boundary_lo[idim] == FieldBoundaryType::PML) return true;
if ( WarpX::field_boundary_hi[idim] == FieldBoundaryType::PML) return true;
}
return false;
}
1 change: 0 additions & 1 deletion Tools/PerformanceTests/automated_test_1_uniform_rest_32ppc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ boundary.particle_hi = absorbing absorbing periodic
warpx.verbose = 1

algo.particle_shape = 3
warpx.do_pml = 0

# CFL
warpx.cfl = 1.0
Expand Down
1 change: 0 additions & 1 deletion Tools/PerformanceTests/automated_test_2_uniform_rest_1ppc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ boundary.particle_hi = absorbing absorbing absorbing
warpx.verbose = 1

algo.particle_shape = 3
warpx.do_pml = 1

# CFL
warpx.cfl = 1.0
Expand Down
1 change: 0 additions & 1 deletion Tools/PerformanceTests/automated_test_3_uniform_drift_4ppc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ warpx.verbose = 1

# Algorithms
algo.particle_shape = 3
warpx.do_pml = 0

# CFL
warpx.cfl = 1.0
Expand Down
1 change: 0 additions & 1 deletion Tools/PerformanceTests/automated_test_4_labdiags_2ppc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ warpx.verbose = 1
algo.particle_shape = 3
warpx.use_filter = 1
warpx.cfl = 1.0
warpx.do_pml = 0

# Moving window
warpx.do_moving_window = 1
Expand Down
1 change: 0 additions & 1 deletion Tools/PerformanceTests/automated_test_5_loadimbalance
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ boundary.particle_hi = absorbing absorbing periodic
warpx.verbose = 1
algo.load_balance_intervals = -5
algo.particle_shape = 3
warpx.do_pml = 0

# CFL
warpx.cfl = 1.0
Expand Down
1 change: 0 additions & 1 deletion Tools/PerformanceTests/automated_test_6_output_2ppc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ boundary.particle_hi = absorbing absorbing absorbing
warpx.verbose = 1

algo.particle_shape = 3
warpx.do_pml = 0

# CFL
warpx.cfl = 1.0
Expand Down