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

Make do_subcycling a private variable of the WarpX class #5546

Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion Source/Evolve/WarpXComputeDt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ WarpX::ComputeDt ()
dt.resize(0);
dt.resize(max_level+1,deltat);

if (do_subcycling) {
if (m_do_subcycling) {
for (int lev = max_level-1; lev >= 0; --lev) {
dt[lev] = dt[lev+1] * refRatio(lev)[0];
}
Expand Down
6 changes: 3 additions & 3 deletions Source/Evolve/WarpXEvolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,22 +187,22 @@ WarpX::Evolve (int numsteps)
OneStep_multiJ(cur_time);
}
// Electromagnetic case: no subcycling or no mesh refinement
else if ( !do_subcycling || (finest_level == 0))
else if ( !m_do_subcycling || (finest_level == 0))
{
OneStep_nosub(cur_time);
// E: guard cells are up-to-date
// B: guard cells are NOT up-to-date
// F: guard cells are NOT up-to-date
}
// Electromagnetic case: subcycling with one level of mesh refinement
else if (do_subcycling && (finest_level == 1))
else if (m_do_subcycling && (finest_level == 1))
{
OneStep_sub1(cur_time);
}
else
{
WARPX_ABORT_WITH_MESSAGE(
"do_subcycling = " + std::to_string(do_subcycling)
"do_subcycling = " + std::to_string(m_do_subcycling)
+ " is an unsupported do_subcycling type.");
}

Expand Down
2 changes: 1 addition & 1 deletion Source/Initialization/WarpXInitData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ WarpX::computeMaxStepBoostAccelerator() {
const Real interaction_time_boost = (len_plasma_boost-zmin_domain_boost_step_0)/
(moving_window_v-v_plasma_boost);
// Divide by dt, and update value of max_step.
const auto computed_max_step = (do_subcycling)?
const auto computed_max_step = (m_do_subcycling)?
static_cast<int>(interaction_time_boost/dt[0]):
static_cast<int>(interaction_time_boost/dt[maxLevel()]);
max_step = computed_max_step;
Expand Down
4 changes: 3 additions & 1 deletion Source/WarpX.H
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,6 @@ public:
//! Specifies the type of grid used for the above sorting, i.e. cell-centered, nodal, or mixed
static amrex::IntVect sort_idx_type;

static bool do_subcycling;
static bool do_multi_J;
static int do_multi_J_n_depositions;

Expand Down Expand Up @@ -1454,6 +1453,9 @@ private:
std::optional<amrex::Real> m_const_dt;
std::optional<amrex::Real> m_max_dt;

// whether to use subcycling
bool m_do_subcycling = false;

// Macroscopic properties
std::unique_ptr<MacroscopicProperties> m_macroscopic_properties;

Expand Down
11 changes: 5 additions & 6 deletions Source/WarpX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ amrex::IntVect WarpX::sort_idx_type(AMREX_D_DECL(0,0,0));

bool WarpX::do_dynamic_scheduling = true;

bool WarpX::do_subcycling = false;
bool WarpX::do_multi_J = false;
int WarpX::do_multi_J_n_depositions;
bool WarpX::safe_guard_cells = false;
Expand Down Expand Up @@ -448,7 +447,7 @@ WarpX::WarpX ()
// (e.g., use_fdtd_nci_corr)
if (WarpX::electromagnetic_solver_id == ElectromagneticSolverAlgo::PSATD) {
AMREX_ALWAYS_ASSERT(use_fdtd_nci_corr == 0);
AMREX_ALWAYS_ASSERT(do_subcycling == 0);
AMREX_ALWAYS_ASSERT(m_do_subcycling == 0);
}

if (WarpX::current_deposition_algo != CurrentDepositionAlgo::Esirkepov) {
Expand Down Expand Up @@ -622,7 +621,7 @@ WarpX::ReadParameters ()
utils::parser::queryWithParser(pp_warpx, "cfl", cfl);
pp_warpx.query("verbose", verbose);
utils::parser::queryWithParser(pp_warpx, "regrid_int", regrid_int);
pp_warpx.query("do_subcycling", do_subcycling);
pp_warpx.query("do_subcycling", m_do_subcycling);
pp_warpx.query("do_multi_J", do_multi_J);
if (do_multi_J)
{
Expand All @@ -636,7 +635,7 @@ WarpX::ReadParameters ()
override_sync_intervals =
utils::parser::IntervalsParser(override_sync_intervals_string_vec);

WARPX_ALWAYS_ASSERT_WITH_MESSAGE(do_subcycling != 1 || max_level <= 1,
WARPX_ALWAYS_ASSERT_WITH_MESSAGE(m_do_subcycling != 1 || max_level <= 1,
"Subcycling method 1 only works for 2 levels.");

ReadBoostedFrameParameters(gamma_boost, beta_boost, boost_direction);
Expand Down Expand Up @@ -2045,7 +2044,7 @@ WarpX::AllocLevelData (int lev, const BoxArray& ba, const DistributionMapping& d
guard_cells.Init(
dt[lev],
dx,
do_subcycling,
m_do_subcycling,
WarpX::use_fdtd_nci_corr,
grid_type,
do_moving_window,
Expand Down Expand Up @@ -2408,7 +2407,7 @@ WarpX::AllocLevelMFs (int lev, const BoxArray& ba, const DistributionMapping& dm
ncomps, ngPhi, 0.0_rt );
}

if (do_subcycling && lev == 0)
if (m_do_subcycling && lev == 0)
{
m_fields.alloc_init(FieldType::current_store, Direction{0}, lev, amrex::convert(ba,jx_nodal_flag), dm, ncomps, ngJ, 0.0_rt);
m_fields.alloc_init(FieldType::current_store, Direction{1}, lev, amrex::convert(ba,jy_nodal_flag), dm, ncomps, ngJ, 0.0_rt);
Expand Down
Loading