Skip to content

Commit

Permalink
Changed location of initialization logic for external divb cleaning t…
Browse files Browse the repository at this point in the history
…o be after grid_type is initialized.
  • Loading branch information
clarkse committed Aug 20, 2024
1 parent 882d14d commit aeb2d1f
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions Source/WarpX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -907,21 +907,6 @@ WarpX::ReadParameters ()
pp_warpx.query("do_dive_cleaning", do_dive_cleaning);
pp_warpx.query("do_divb_cleaning", do_divb_cleaning);

// Update default to external projection divb cleaner if external fields are loaded,
// the grids are staggered, and the solver is compatible with the cleaner
if (m_p_ext_field_params->B_ext_grid_type != ExternalFieldType::default_zero
&& m_p_ext_field_params->B_ext_grid_type != ExternalFieldType::constant
&& grid_type != GridType::Collocated
&& (WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::Yee
|| WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::HybridPIC
|| ( (WarpX::electrostatic_solver_id == ElectrostaticSolverAlgo::LabFrame
|| WarpX::electrostatic_solver_id == ElectrostaticSolverAlgo::LabFrameElectroMagnetostatic)
&& WarpX::poisson_solver_id == PoissonSolverAlgo::Multigrid)))
{
do_divb_cleaning_external = true;
}
pp_warpx.query("do_divb_cleaning_external", do_divb_cleaning_external);

utils::parser::queryWithParser(
pp_warpx, "n_field_gather_buffer", n_field_gather_buffer);
utils::parser::queryWithParser(
Expand Down Expand Up @@ -1145,6 +1130,21 @@ WarpX::ReadParameters ()
"warpx.grid_type=hybrid is not implemented in RZ geometry");
#endif

// Update default to external projection divb cleaner if external fields are loaded,
// the grids are staggered, and the solver is compatible with the cleaner
if (m_p_ext_field_params->B_ext_grid_type != ExternalFieldType::default_zero
&& m_p_ext_field_params->B_ext_grid_type != ExternalFieldType::constant
&& grid_type != GridType::Collocated
&& (WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::Yee
|| WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::HybridPIC
|| ( (WarpX::electrostatic_solver_id == ElectrostaticSolverAlgo::LabFrame
|| WarpX::electrostatic_solver_id == ElectrostaticSolverAlgo::LabFrameElectroMagnetostatic)
&& WarpX::poisson_solver_id == PoissonSolverAlgo::Multigrid)))
{
do_divb_cleaning_external = true;
}
pp_warpx.query("do_divb_cleaning_external", do_divb_cleaning_external);

// If true, the current is deposited on a nodal grid and centered onto
// a staggered grid. Setting warpx.do_current_centering=1 makes sense
// only if warpx.grid_type=hybrid. Instead, if warpx.grid_type=nodal or
Expand Down

0 comments on commit aeb2d1f

Please sign in to comment.