4 #include <AMReX_REAL.H>
5 #include <AMReX_Vector.H>
6 #include <AMReX_ParmParse.H>
7 #include <AMReX_IntegratorBase.H>
21 std::function<void(
T&,
const T&,
const double,
const double)>
rhs;
22 std::function<void(
T&,
T&,
T&,
const double,
const double,
const double,
const int)>
slow_rhs_pre;
23 std::function<void(
T&,
T&,
T&,
T&,
const double,
const double,
const double,
const int)>
slow_rhs_post;
24 std::function<void(
int,
int,
int,
T&,
const T&,
T&,
T&,
const double,
const double,
61 std::function<void (
T&,
T&,
T&,
const double,
const double,
int)>
no_substep;
64 amrex::Vector<std::unique_ptr<T> >
T_store;
72 const bool include_ghost =
true;
73 amrex::IntegratorOps<T>::CreateLike(
T_store, S_data, include_ghost);
75 amrex::IntegratorOps<T>::CreateLike(
T_store, S_data, include_ghost);
134 void set_slow_rhs_pre (std::function<
void(
T&,
T&,
T&,
const double,
const double,
const double,
const int)> F)
144 const double,
const double,
166 std::function<void(
T&,
const T&,
const double,
const double)>
get_rhs ()
171 double advance (
T& S_old,
T& S_new,
double time,
const double time_step)
173 BL_PROFILE_REGION(
"MRI_advance");
174 using namespace amrex;
210 for (
int i(0); i<n_data; ++i)
213 MultiFab::Copy(S_new[i],S_old[i],0,0,num_vars[i],S_old[i].nGrowVect());
225 double time_stage = time;
226 double old_time_stage;
228 const double sub_timestep =
timestep / substep_ratio;
232 for (
int nrk = 0; nrk < 3; nrk++)
235 old_time_stage = time_stage;
241 nsubsteps = substep_ratio/3; dtau = sub_timestep ;
249 nsubsteps = substep_ratio/2; dtau = sub_timestep;
257 nsubsteps = substep_ratio; dtau = sub_timestep;
282 for (
int ks = 0; ks < nsubsteps; ++ks)
284 acoustic_substepping(ks, nsubsteps, nrk, *
F_slow, S_old, S_new, *
S_sum, dtau,
timestep, inv_fac,
285 time + ks*dtau, time + (ks+1) * dtau);
305 for (
int nrk = 0; nrk < 2; nrk++)
308 old_time_stage = time_stage;
310 if (nrk == 0) { nsubsteps = 1; dtau =
timestep; time_stage = time +
timestep; }
311 if (nrk == 1) { nsubsteps = 1; dtau =
timestep; time_stage = time +
timestep; }
constexpr amrex::Real three
Definition: ERF_Constants.H:11
constexpr amrex::Real two
Definition: ERF_Constants.H:10
constexpr amrex::Real one
Definition: ERF_Constants.H:9
constexpr amrex::Real myhalf
Definition: ERF_Constants.H:13
Real T
Definition: ERF_InitCustomPert_Bubble.H:106
AMREX_ALWAYS_ASSERT(bx.length()[2]==khi+1)
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int idx(int i, int j, int k, int nx, int ny)
Definition: ERF_InitForEnsemble.cpp:303
amrex::Real Real
Definition: ERF_ShocInterface.H:19
T * F_slow
Definition: ERF_MRI.H:66
std::function< void(T &, const T &, const double, const double)> get_rhs()
Definition: ERF_MRI.H:166
amrex::Vector< std::unique_ptr< T > > T_store
Definition: ERF_MRI.H:64
void set_slow_rhs_post(std::function< void(T &, T &, T &, T &, const double, const double, const double, const int)> F)
Definition: ERF_MRI.H:138
void map_data(std::function< void(T &)> Map)
Definition: ERF_MRI.H:332
void set_slow_rhs_pre(std::function< void(T &, T &, T &, const double, const double, const double, const int)> F)
Definition: ERF_MRI.H:134
int anelastic
Should we use the anelastic integrator.
Definition: ERF_MRI.H:46
void setNcompCons(int _ncomp_cons)
Definition: ERF_MRI.H:114
MRISplitIntegrator()=default
std::function< void(T &, const T &, const double, const double)> rhs
rhs is the right-hand-side function the integrator will use.
Definition: ERF_MRI.H:21
void setForceFirstStageSingleSubstep(int _force_stage1_single_substep)
Definition: ERF_MRI.H:129
int force_stage1_single_substep
Do we follow the recommendation to only perform a single substep in the first RK stage.
Definition: ERF_MRI.H:56
int ncomp_cons
How many components in the cell-centered MultiFab.
Definition: ERF_MRI.H:51
void setNoSubstepping(int _no_substepping)
Definition: ERF_MRI.H:124
double timestep
Integrator timestep size (Real)
Definition: ERF_MRI.H:31
std::function< void(T &, T &, T &, const double, const double, const double, const int)> slow_rhs_pre
Definition: ERF_MRI.H:22
void set_no_substep(std::function< void(T &, T &, T &, const double, const double, int)> F)
Definition: ERF_MRI.H:161
void initialize(const T &S_data)
Definition: ERF_MRI.H:90
MRISplitIntegrator(MRISplitIntegrator &&) noexcept=default
void initialize_data(const T &S_data)
Definition: ERF_MRI.H:68
MRISplitIntegrator(const T &S_data)
Definition: ERF_MRI.H:85
std::function< void(T &, T &, T &, T &, const double, const double, const double, const int)> slow_rhs_post
Definition: ERF_MRI.H:23
void setAnelastic(int _anelastic)
Definition: ERF_MRI.H:119
std::function< void(T &, T &, T &, const double, const double, int)> no_substep
The no_substep function is called when we have no acoustic substepping.
Definition: ERF_MRI.H:61
int get_slow_fast_timestep_ratio()
Definition: ERF_MRI.H:156
double advance(T &S_old, T &S_new, double time, const double time_step)
Definition: ERF_MRI.H:171
int slow_fast_timestep_ratio
The ratio of slow timestep size / fast timestep size (int)
Definition: ERF_MRI.H:36
void set_acoustic_substepping(std::function< void(int, int, int, T &, const T &, T &, T &, const double, const double, const amrex::Real, const double, const double)> F)
Definition: ERF_MRI.H:143
~MRISplitIntegrator()=default
void set_slow_fast_timestep_ratio(const int timestep_ratio=1)
Definition: ERF_MRI.H:151
T * S_sum
Definition: ERF_MRI.H:65
std::function< void(int, int, int, T &, const T &, T &, T &, const double, const double, const amrex::Real, const double, const double)> acoustic_substepping
Definition: ERF_MRI.H:26
int no_substepping
Should we not do acoustic substepping.
Definition: ERF_MRI.H:41
@ NumTypes
Definition: ERF_IndexDefines.H:197
Definition: ERF_ConsoleIO.cpp:12