Chombo + EB  3.0
Macros | Functions
LevelRK4.H File Reference

Go to the source code of this file.

Macros

#define _LEVELRK4_H__
 

Functions

template<class TSoln , class TFR , class TOp >
void RK4LevelAdvance (TSoln &a_newSoln, TSoln &a_oldSoln, const TSoln &a_oldCrseSoln, Real a_oldCrseTime, const TSoln &a_newCrseSoln, Real a_newCrseTime, TFR &a_crseFRPtr, TFR &a_fineFRPtr, Real a_time, Real a_dt, TOp &a_op, const bool a_initializeNewSoln=true)
 Basic templated implementation of RK4 advance for a single AMRLevel. More...
 
template<class TSoln , class TInterp , class TFR , class TOp >
void RK4LevelAdvance (TSoln &a_newSoln, TSoln &a_oldSoln, TInterp &a_interpPtr, const TSoln &a_oldCrseSoln, Real a_oldCrseTime, const TSoln &a_newCrseSoln, Real a_newCrseTime, TFR &a_crseFRPtr, TFR &a_fineFRPtr, Real a_time, Real a_dt, TOp &a_op, const bool a_initializeNewSoln=true)
 Templated implementation of RK4 advance for a single AMRLevel, allowing interpolation in time. More...
 

Macro Definition Documentation

◆ _LEVELRK4_H__

#define _LEVELRK4_H__

Function Documentation

◆ RK4LevelAdvance() [1/2]

template<class TSoln , class TFR , class TOp >
void RK4LevelAdvance ( TSoln &  a_newSoln,
TSoln &  a_oldSoln,
const TSoln &  a_oldCrseSoln,
Real  a_oldCrseTime,
const TSoln &  a_newCrseSoln,
Real  a_newCrseTime,
TFR &  a_crseFRPtr,
TFR &  a_fineFRPtr,
Real  a_time,
Real  a_dt,
TOp &  a_op,
const bool  a_initializeNewSoln = true 
)

Basic templated implementation of RK4 advance for a single AMRLevel.

This implements fourth-order Runge-Kutta time advance of an ODE. ODE is d(Soln)/dt = RHS

Template types:

  • TSoln is the datatype for the solution
  • TFR is a flux-register datatype
  • TOp is an object encapsulating the actual ODE operations

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_oldCrseSolnold-time coarse-level solution (if it exists)
a_oldCrseTimetime-centering of a_oldCrseSoln
a_newCrseSolnnew-time coarse-level solution (if it exists)
a_newCrseTimetime-centering of a_newCrseSoln
a_crseFRPtrthe pointer to the flux register between this level and the next coarser level
a_fineFRPtrthe pointer to the flux register between this level and the next finer level
a_timetime centering of a_oldSoln
a_dttime step
a_opobject which encapsulates the ODE functionality (must meet the requirements detailed above)
a_initializeNewSolnwhether a_newSoln is initialized with a_oldSoln (default true)

◆ RK4LevelAdvance() [2/2]

template<class TSoln , class TInterp , class TFR , class TOp >
void RK4LevelAdvance ( TSoln &  a_newSoln,
TSoln &  a_oldSoln,
TInterp &  a_interpPtr,
const TSoln &  a_oldCrseSoln,
Real  a_oldCrseTime,
const TSoln &  a_newCrseSoln,
Real  a_newCrseTime,
TFR &  a_crseFRPtr,
TFR &  a_fineFRPtr,
Real  a_time,
Real  a_dt,
TOp &  a_op,
const bool  a_initializeNewSoln = true 
)

Templated implementation of RK4 advance for a single AMRLevel, allowing interpolation in time.

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
  • TOp is an object encapsulating the actual ODE operations

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_interpPtrobject that encapsulates time interpolation
a_oldCrseSolnold-time coarse-level solution (if it exists)
a_oldCrseTimetime-centering of a_oldCrseSoln
a_newCrseSolnnew-time coarse-level solution (if it exists)
a_newCrseTimetime-centering of a_newCrseSoln
a_crseFRPtrthe pointer to the flux register between this level and the next coarser level
a_fineFRPtrthe pointer to the flux register between this level and the next finer level
a_timetime centering of a_oldSoln
a_dttime step
a_opobject which encapsulates the ODE functionality (must meet the requirements detailed above)
a_initializeNewSolnwhether a_newSoln is initialized with a_oldSoln (default true)