Skip to content

Commit

Permalink
WarpX class: make do_divb_cleaning_external a private member variable (
Browse files Browse the repository at this point in the history
…#5598)

This PR changes `do_divb_cleaning_external` from a static WarpX class
variable to a private member variable (renamed
`m_do_divb_cleaning_external`).
This is a small step towards reducing the use of static variables in the
WarpX class.
  • Loading branch information
lucafedeli88 authored Jan 24, 2025
1 parent 7790292 commit f8e2376
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Source/Initialization/WarpXInitData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ WarpX::InitData ()
WriteUsedInputsFile();

// Run div cleaner here on loaded external fields
if (WarpX::do_divb_cleaning_external) {
if (m_do_divb_cleaning_external) {
WarpX::ProjectionCleanDivB();
}

Expand Down
8 changes: 4 additions & 4 deletions Source/WarpX.H
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,6 @@ public:
//! Solve additional Maxwell equation for G in order to control errors in magnetic Gauss' law
static bool do_divb_cleaning;

//! Solve Poisson equation when loading an external magnetic field to clean divergence
//! This is useful to remove errors that could lead to non-zero B field divergence
static bool do_divb_cleaning_external;

//! Order of the particle shape factors (splines) along x
static int nox;
//! Order of the particle shape factors (splines) along y
Expand Down Expand Up @@ -1582,6 +1578,10 @@ private:
int noy_fft = 16;
int noz_fft = 16;

//! Solve Poisson equation when loading an external magnetic field to clean divergence
//! This is useful to remove errors that could lead to non-zero B field divergence
bool m_do_divb_cleaning_external = false;

//! Domain decomposition on Level 0
amrex::IntVect numprocs{0};

Expand Down
5 changes: 2 additions & 3 deletions Source/WarpX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ int WarpX::max_particle_its_in_implicit_scheme = 21;
ParticleReal WarpX::particle_tol_in_implicit_scheme = 1.e-10;
bool WarpX::do_dive_cleaning = false;
bool WarpX::do_divb_cleaning = false;
bool WarpX::do_divb_cleaning_external = false;
bool WarpX::do_single_precision_comms = false;

bool WarpX::do_shared_mem_charge_deposition = false;
Expand Down Expand Up @@ -1064,9 +1063,9 @@ WarpX::ReadParameters ()
|| WarpX::electrostatic_solver_id == ElectrostaticSolverAlgo::LabFrameElectroMagnetostatic)
&& WarpX::poisson_solver_id == PoissonSolverAlgo::Multigrid)))
{
do_divb_cleaning_external = true;
m_do_divb_cleaning_external = true;
}
pp_warpx.query("do_divb_cleaning_external", do_divb_cleaning_external);
pp_warpx.query("do_divb_cleaning_external", m_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
Expand Down

0 comments on commit f8e2376

Please sign in to comment.