11 #ifndef _LEVELRK4_V2_H__ 12 #define _LEVELRK4_V2_H__ 72 void copySolnData(TSoln& dest, const TSoln& src)
76 template <
typename TSoln,
typename TRhs,
typename TInterp,
typename TExOp,
typename... TOpArgs>
82 TInterp* a_timeInterpolator,
88 const bool a_initializeNewSoln,
91 TOpArgs&&... a_opArgs)
99 a_op.defineRHSData(RHSTmp,a_oldSoln);
100 a_op.defineSolnData(solnTmp,a_oldSoln);
101 a_op.copySolnData(solnTmp,a_oldSoln);
104 if (a_initializeNewSoln)
106 a_op.copySolnData(a_newSoln, a_oldSoln);
108 if (a_timeInterpolator !=
nullptr)
110 a_timeInterpolator->setDt(a_dt);
111 a_timeInterpolator->saveInitialSoln(a_oldSoln);
117 a_op.evalRHS(RHSTmp,a_oldSoln,0,a_time,a_dt/6,std::forward<TOpArgs>(a_opArgs)...);
118 if (a_timeInterpolator !=
nullptr)
120 a_timeInterpolator->saveRHS(RHSTmp);
126 a_op.updateODE(a_newSoln,RHSTmp,a_dt/6);
130 a_op.updateODE(solnTmp, RHSTmp,a_dt/2);
134 a_op.evalRHS(RHSTmp,solnTmp,1,a_time+a_dt/2,a_dt/3,std::forward<TOpArgs>(a_opArgs)...);
135 if (a_timeInterpolator !=
nullptr)
137 a_timeInterpolator->saveRHS(RHSTmp);
142 a_op.updateODE(a_newSoln,RHSTmp,a_dt/3);
145 a_op.copySolnData(solnTmp,a_oldSoln);
146 a_op.updateODE(solnTmp,RHSTmp,a_dt/2);
150 a_op.evalRHS(RHSTmp,solnTmp,2,a_time+a_dt/2,a_dt/3,std::forward<TOpArgs>(a_opArgs)...);
151 if (a_timeInterpolator !=
nullptr)
153 a_timeInterpolator->saveRHS(RHSTmp);
159 a_op.updateODE(a_newSoln,RHSTmp,a_dt/3);
162 a_op.copySolnData(solnTmp,a_oldSoln);
163 a_op.updateODE(solnTmp,RHSTmp,a_dt);
167 a_op.evalRHS(RHSTmp,solnTmp,3,a_time+a_dt,a_dt/6,std::forward<TOpArgs>(a_opArgs)...);
168 if (a_timeInterpolator !=
nullptr)
170 a_timeInterpolator->saveRHS(RHSTmp);
175 a_op.updateODE(a_newSoln,RHSTmp,a_dt/6);
void RK4LevelAdvance(TSoln &a_newSoln, TSoln &a_oldSoln, TInterp *a_timeInterpolator, Real a_time, Real a_dt, const bool a_initializeNewSoln, TExOp &a_op, TOpArgs &&... a_opArgs)
Templated implementation of RK4 advance for a single AMRLevel, allowing interpolation in time...
Definition: LevelRK4_v2.H:77
double Real
Definition: REAL.H:33