METHOD
RK2 Class Reference

#include <RK2.h>

Inheritance diagram for RK2:
Collaboration diagram for RK2:

Public Member Functions

 RK2 (Data *data, Model *model, Bcs *bcs, FluxMethod *fluxMethod, ModelExtension *modelExtension=NULL)
 
virtual ~RK2 ()
 
void predictorStep (double *cons, double *prims, double *aux, double dt)
 
void correctorStep (double *cons, double *prims, double *aux, double dt)
 
void step (double *cons, double *prims, double *aux, double dt=0)
 
- Public Member Functions inherited from TimeIntegrator
 TimeIntegrator (Data *data, Model *model, Bcs *bcs, FluxMethod *fluxMethod, ModelExtension *modelExtension=NULL)
 
virtual ~TimeIntegrator ()
 
void finalise (double *cons, double *prims, double *aux)
 
- Public Member Functions inherited from TimeIntegratorBase
 TimeIntegratorBase (Data *data, Model *model, Bcs *bcs, FluxMethod *fluxMethod, ModelExtension *modelExtension=NULL)
 
virtual ~TimeIntegratorBase ()
 

Public Attributes

double * p1cons
 
double * p1prims
 
double * p1aux
 
double * args1
 
double * args2
 
- Public Attributes inherited from TimeIntegratorBase
Datadata
 
Modelmodel
 
Bcsbcs
 
FluxMethodfluxMethod
 
ModelExtensionmodelExtension
 

Detailed Description

TVD Runge-Kutta 2nd order time integrator

Integrator performs a single step using the TVD RK2 algorithm. See Shu & Osher 1988 for original description.
Note
Method is fully explicit and only deals with the flux contributions of the two stages of the second order Runge-Kutta integrator. Method should not really be used in isolation as most (if not all) models we will be using will contain some source terms.
The step function performs the following:

\begin{align} U^{n+1} = \frac{1}{2} U^n + \frac{1}{2} U^{(1)} + \frac{1}{2} \Delta t \mathcal{F}(U^{(1)}) \end{align}

where the first stage result is

\begin{align} U^{(1)} = U^n + \Delta t \mathcal{F}(U^n). \end{align}

Definition at line 29 of file RK2.h.

Constructor & Destructor Documentation

◆ RK2()

RK2::RK2 ( Data data,
Model model,
Bcs bcs,
FluxMethod fluxMethod,
ModelExtension modelExtension = NULL 
)

Constructor.

Constructor requires simulation data and the flux and source functions from the model class. Stores the necessary pointer.

Parameters
[in]*dataPointer to Data class containing global simulation data
[in]*modelpointer to Model object
[in]*bcspointer to Bcs object
[in]*fluxMethodpointer to FluxMethod object
[in]*modelExtensionpointer to the ModelExtension object
See also
TimeIntegrator::TimeIntegrator

◆ ~RK2()

virtual RK2::~RK2 ( )
virtual

Member Function Documentation

◆ correctorStep()

void RK2::correctorStep ( double *  cons,
double *  prims,
double *  aux,
double  dt 
)
Calculate the final result given by,

\begin{align} U^{n+1} = \frac{1}{2} U^n + \frac{1}{2} U^{(1)} + \frac{1}{2} \Delta t \mathcal{F}(U^{(1)}) \end{align}

Parameters
[in]*conspointer to conserved vector work array. Size is \(N_{cons} \times N_x \times N_y \times N_z\)
[in]*primspointer to primitive vector work array. Size is \(N_{prims} \times N_x \times N_y \times N_z\)
[in]*auxpointer to auxiliary vector work array. Size is \(N_{aux} \times N_x \times N_y \times N_z\)
dtthe step size desired to move by. Defaults to the value in the Data class

◆ predictorStep()

void RK2::predictorStep ( double *  cons,
double *  prims,
double *  aux,
double  dt 
)

Predictor.

Calculate the first interstage result given by,

\begin{align} U^{(1)} = U^n + \Delta t \mathcal{F}(U^n). \end{align}

Parameters
[in]*conspointer to conserved vector work array. Size is \(N_{cons} \times N_x \times N_y \times N_z\)
[in]*primspointer to primitive vector work array. Size is \(N_{prims} \times N_x \times N_y \times N_z\)
[in]*auxpointer to auxiliary vector work array. Size is \(N_{aux} \times N_x \times N_y \times N_z\)
dtthe step size desired to move by. Defaults to the value in the Data class

◆ step()

void RK2::step ( double *  cons,
double *  prims,
double *  aux,
double  dt = 0 
)
virtual

Performs a single time step.

The timestep will use the current values of the conserved, primitive and auxiliary variables at t=t0 and compute the values of all of them at time \(t=t_0 + dt\). I.e. the conserved vector is evolved forward, and the corresponding prims and aux vars are found.

Parameters
[in]*conspointer to conserved vector work array. Size is \(N_{cons} \times N_x \times N_y \times N_z\)
[in]*primspointer to primitive vector work array. Size is \(N_{prims} \times N_x \times N_y \times N_z\)
[in]*auxpointer to auxiliary vector work array. Size is \(N_{aux} \times N_x \times N_y \times N_z\)
dtthe step size desired to move by. Defaults to the value in the Data class
See also
TimeIntegrator::step

Implements TimeIntegratorBase.

Reimplemented in RKSplit2.

Member Data Documentation

◆ args1

double * RK2::args1

Definition at line 34 of file RK2.h.

◆ args2

double * RK2::args2

Definition at line 34 of file RK2.h.

◆ p1aux

double * RK2::p1aux

Definition at line 34 of file RK2.h.

◆ p1cons

double* RK2::p1cons

Definition at line 34 of file RK2.h.

◆ p1prims

double * RK2::p1prims

Definition at line 34 of file RK2.h.


The documentation for this class was generated from the following file: