diff --git a/Source/WarpX.cpp b/Source/WarpX.cpp index f3c407ace91..6df11008687 100644 --- a/Source/WarpX.cpp +++ b/Source/WarpX.cpp @@ -907,9 +907,16 @@ 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 + // 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) + && 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; }