Chombo + EB + MF  3.2
Macros | Functions
LevelRK4_v2.H File Reference

Go to the source code of this file.

Macros

#define _LEVELRK4_V2_H__
 

Functions

template<typename TSoln , typename TRhs , typename TInterp , typename TExOp , typename... TOpArgs>
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. More...
 

Macro Definition Documentation

◆ _LEVELRK4_V2_H__

#define _LEVELRK4_V2_H__

Function Documentation

◆ RK4LevelAdvance()

template<typename TSoln , typename TRhs , typename TInterp , typename TExOp , typename... TOpArgs>
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.

The difference from LevelRK4.H is that this allows for any arguments to the evalRHS operator. The arguments are perfectly forwarded.

This implements fourth-order Runge-Kutta time advance of an ODE, and saves intermediate results for use in interpolation in time. ODE is d(Soln)/dt = RHS

Template types:

  • TSoln is the datatype for the solution
  • TInterp is a storage class for intermediate values
  • TFR is a flux-register datatype
  • TExOp is an object encapsulating the actual ODE operations
  • TOpArgs are perfectly forwarded arguments to the operator

TInterp requirements: TInterp must have the following functions:

// set time step
void setDt(Real dt)
// save initial solution
void saveInitialSoln(TSoln& soln)
// save this value of d(soln)/dt
void saveRHS(TSoln& rhs)

TOp requirements: TOp must have the following functions:

// evaluate d(soln)/dt at current time based on soln
void evalRHS(TSoln& rhs, // d(soln)/dt based on soln
TSoln& soln, // soln at current time
TFR& fineFR, // flux register w/ finer level
TFR& crseFR, // flux register w/ crse level
const TSoln& oldCrseSoln, // old-time crse solution
Real oldCrseTime, // old crse time
const TSoln& newCrseSoln, // new-time crse solution
Real newCrseTime, // new crse time
Real time, // current time centering of soln
Real fluxWeight // weight to apply to fluxRegister updates
)
// implements soln += dt*rhs
void updateODE(TSoln& soln,
const TSoln& rhs,
Real dt)
// define data holder newSoln based on existingSoln,
// including ghost cell specification
void defineSolnData(TSoln& newSoln,
const TSoln& existingSoln)
// define data holder for RHS based on existingSoln
// including ghost cell specification
// (which in most cases is no ghost cells)
void defineRHSData(TSoln& newRHS, const TSoln& existingSoln)
/// copy data in src into dest
void copySolnData(TSoln& dest, const TSoln& src)
Parameters
a_newSolnthe cell-centered solution at the new time (a_time + a_dt)
a_oldSolnthe cell-centered solution at the old time (a_time)
a_timeInterpolatorobject that encapsulates time interpolation
a_timetime centering of a_oldSoln
a_dttime step
a_initializeNewSolnwhether a_newSoln is initialized with a_oldSoln (default true)
a_opobject which encapsulates the ODE functionality (must meet the requirements detailed above)