Skip to content

Commit f8e2376

Browse files
authored
WarpX class: make do_divb_cleaning_external a private member variable (#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.
1 parent 7790292 commit f8e2376

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

Source/Initialization/WarpXInitData.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ WarpX::InitData ()
590590
WriteUsedInputsFile();
591591

592592
// Run div cleaner here on loaded external fields
593-
if (WarpX::do_divb_cleaning_external) {
593+
if (m_do_divb_cleaning_external) {
594594
WarpX::ProjectionCleanDivB();
595595
}
596596

Source/WarpX.H

+4-4
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,6 @@ public:
290290
//! Solve additional Maxwell equation for G in order to control errors in magnetic Gauss' law
291291
static bool do_divb_cleaning;
292292

293-
//! Solve Poisson equation when loading an external magnetic field to clean divergence
294-
//! This is useful to remove errors that could lead to non-zero B field divergence
295-
static bool do_divb_cleaning_external;
296-
297293
//! Order of the particle shape factors (splines) along x
298294
static int nox;
299295
//! Order of the particle shape factors (splines) along y
@@ -1582,6 +1578,10 @@ private:
15821578
int noy_fft = 16;
15831579
int noz_fft = 16;
15841580

1581+
//! Solve Poisson equation when loading an external magnetic field to clean divergence
1582+
//! This is useful to remove errors that could lead to non-zero B field divergence
1583+
bool m_do_divb_cleaning_external = false;
1584+
15851585
//! Domain decomposition on Level 0
15861586
amrex::IntVect numprocs{0};
15871587

Source/WarpX.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ int WarpX::max_particle_its_in_implicit_scheme = 21;
118118
ParticleReal WarpX::particle_tol_in_implicit_scheme = 1.e-10;
119119
bool WarpX::do_dive_cleaning = false;
120120
bool WarpX::do_divb_cleaning = false;
121-
bool WarpX::do_divb_cleaning_external = false;
122121
bool WarpX::do_single_precision_comms = false;
123122

124123
bool WarpX::do_shared_mem_charge_deposition = false;
@@ -1064,9 +1063,9 @@ WarpX::ReadParameters ()
10641063
|| WarpX::electrostatic_solver_id == ElectrostaticSolverAlgo::LabFrameElectroMagnetostatic)
10651064
&& WarpX::poisson_solver_id == PoissonSolverAlgo::Multigrid)))
10661065
{
1067-
do_divb_cleaning_external = true;
1066+
m_do_divb_cleaning_external = true;
10681067
}
1069-
pp_warpx.query("do_divb_cleaning_external", do_divb_cleaning_external);
1068+
pp_warpx.query("do_divb_cleaning_external", m_do_divb_cleaning_external);
10701069

10711070
// If true, the current is deposited on a nodal grid and centered onto
10721071
// a staggered grid. Setting warpx.do_current_centering=1 makes sense

0 commit comments

Comments
 (0)