HyPar
1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
|
Contains function declarations for time integration. More...
#include <timeintegration_struct.h>
Go to the source code of this file.
Functions | |
int | TimeExplicitRKInitialize (char *, char *, void *, void *) |
int | TimeExplicitRKCleanup (void *) |
int | TimeGLMGEEInitialize (char *, char *, void *, void *) |
int | TimeGLMGEECleanup (void *) |
int | TimeInitialize (void *, int, int, int, void *) |
int | TimeCleanup (void *) |
int | TimePreStep (void *) |
int | TimeStep (void *) |
int | TimePostStep (void *) |
int | TimePrintStep (void *) |
int | TimeError (void *, void *, double *) |
int | TimeGetAuxSolutions (int *, double **, void *, int, int) |
int | TimeForwardEuler (void *) |
int | TimeRK (void *) |
int | TimeGLMGEE (void *) |
Contains function declarations for time integration.
Definition in file timeintegration.h.
int TimeExplicitRKInitialize | ( | char * | class, |
char * | type, | ||
void * | s, | ||
void * | m | ||
) |
Initialize the explicit Runge-Kutta time-integration method
Initialize the explicit Runge-Kutta time integrator: Depending on the specific explicit Runge-Kutta (ERK) method chosen, this function allocates memory for the Butcher tableaux and sets their coefficients.
class | Name of time integrator class; must match _RK_ |
type | Type of explicit Runge-Kutta method |
s | Object of type ExplicitRKParameters |
m | Unused argument |
Definition at line 17 of file TimeExplicitRKInitialize.c.
int TimeExplicitRKCleanup | ( | void * | s | ) |
Clean up variables related to the explicit Runge-Kutta time-integration method
Clean up allocations related to explicit Runge-Kutta time integration: This function frees up the arrays for the Butcher tableaux.
s | Object of type ExplicitRKParameters |
Definition at line 12 of file TimeExplicitRKCleanup.c.
int TimeGLMGEEInitialize | ( | char * | class, |
char * | type, | ||
void * | s, | ||
void * | m | ||
) |
Initialize the General Linear Methods with Global Error Estimators (GLM-GEE)
Initialize the GLM-GEE (_GLM_GEE_) time integation method: This function allocates the arrays to store the Butcher tableaux, and sets their coefficients, as well as other parameters for the GLM-GEE methods.
Reference:
class | Class of time integration method; must match _GLM_GEE_ |
type | Name of the _GLM_GEE_ method to use |
s | Object of type GLMGEEParameters |
m | MPI object of type MPIVariables |
Definition at line 24 of file TimeGLMGEEInitialize.c.
int TimeGLMGEECleanup | ( | void * | s | ) |
Clean up variables relted to General Linear Methods with Global Error Estimators (GLM-GEE)
Clean up allocations for the GLM-GEE (_GLM_GEE_) time integration method: This function frees the arrays used to store the Butcher tableaux
s | Object of type GLMGEEParameters |
Definition at line 14 of file TimeGLMGEECleanup.c.
int TimeInitialize | ( | void * | s, |
int | nsims, | ||
int | rank, | ||
int | nproc, | ||
void * | ts | ||
) |
Initialize the time integration
Initialize time integration: This function initializes all that is required for time integration.
s | Array of simulation objects of type SimulationObject |
nsims | number of simulation objects |
rank | MPI rank of this process |
nproc | number of MPI processes |
ts | Time integration object of type TimeIntegration |
Definition at line 28 of file TimeInitialize.c.
int TimeCleanup | ( | void * | ts | ) |
Clean up variables related to time integration
Clean up all allocations related to time integration
ts | Object of type TimeIntegration |
Definition at line 18 of file TimeCleanup.c.
int TimePreStep | ( | void * | ts | ) |
Function called at the beginning of a time step
Pre-time-step function: This function is called before each time step. Some notable things this does are:
ts | Object of type TimeIntegration |
Definition at line 22 of file TimePreStep.c.
int TimeStep | ( | void * | ts | ) |
Take one step in time
Advance one time step.
ts | Object of type TimeIntegration |
Definition at line 13 of file TimeStep.c.
int TimePostStep | ( | void * | ts | ) |
Function called at the end of a time step
Post-time-step function: this function is called at the end of each time step.
ts | Object of type TimeIntegration |
Definition at line 28 of file TimePostStep.c.
int TimePrintStep | ( | void * | ts | ) |
Print time integration related information
Print information to screen (also calls any physics-specific printing function, if defined).
ts | Object of type TimeIntegration |
Definition at line 16 of file TimePrintStep.c.
int TimeError | ( | void * | s, |
void * | m, | ||
double * | uex | ||
) |
Compute/estimate error in solution
Computes the time integration error in the solution: If the time integration method chosen has a mechanism to compute the error in the numerical integration, it is computed in this function. In addition, if an exact solution is available (see function argument uex, the error of the computed solution (stored in HyPar::u) with respect to this exact solution is also computed. These errors are written to a text file whose name depends on the time integration method being used.
Time integration method with error estimation currently implemented:
s | Solver object of type HyPar |
m | MPI object of type MPIVariables |
uex | Exact solution (stored with the same array layout as HyPar::u (may be NULL) |
Definition at line 27 of file TimeError.c.
int TimeGetAuxSolutions | ( | int * | N, |
double ** | uaux, | ||
void * | s, | ||
int | nu, | ||
int | ns | ||
) |
Function to get auxiliary solutions if available (for example, in GLM-GEE methods)
Return auxiliary solution: Some time integrators may have the concept of auxiliary solutions that they evolve along with the main solution HyPar::u (these may be used for error estimation, for example). This function returns a pointer to such an auxiliary solution. Note that the auxiliary solution has the same dimensions and array layout as the main solution.
Note that auxiliary solutions are numbered in the C convention: 0,1,...,N-1.
Time integration methods which use auxiliary solutions currently implemented:
N | Number of auxiliary solutions |
uaux | Pointer to the array holding the auxiliary solution |
s | Solver object of type HyPar |
nu | Index of the auxiliary solution to return |
ns | Index of the simulation domain of which the auxiliary solution to return |
Definition at line 29 of file TimeGetAuxSolutions.c.
int TimeForwardEuler | ( | void * | ts | ) |
Take a step in time using the Forward Euler method
Advance the ODE given by
\begin{equation} \frac{d{\bf u}}{dt} = {\bf F} \left({\bf u}\right) \end{equation}
by one time step of size HyPar::dt using the forward Euler method given by
\begin{equation} {\bf u}^{n+1} = {\bf u}^n + \Delta t {\bf F}\left( {\bf u}^n \right) \end{equation}
where the superscript represents the time level, \(\Delta t\) is the time step size HyPar::dt, and \({\bf F}\left({\bf u}\right)\) is computed by TimeIntegration::RHSFunction.
ts | Time integrator object of type TimeIntegration |
Definition at line 25 of file TimeForwardEuler.c.
int TimeRK | ( | void * | ts | ) |
Take a step in time using the explicit Runge-Kutta method
Advance the ODE given by
\begin{equation} \frac{d{\bf u}}{dt} = {\bf F} \left({\bf u}\right) \end{equation}
by one time step of size HyPar::dt using the forward Euler method given by
\begin{align} {\bf U}^{\left(i\right)} &= {\bf u}_n + \Delta t \sum_{j=1}^{i-1} a_{ij} {\bf F}\left({\bf U}^{\left(j\right)}\right), \\ {\bf u}_{n+1} &= {\bf u}_n + \Delta t \sum_{i=1}^s b_{i} {\bf F}\left({\bf U}^{\left(i\right)}\right), \end{align}
where the subscript represents the time level, the superscripts represent the stages, \(\Delta t\) is the time step size HyPar::dt, and \({\bf F}\left({\bf u}\right)\) is computed by TimeIntegration::RHSFunction. The Butcher tableaux coefficients are \(a_{ij}\) (ExplicitRKParameters::A) and \(b_i\) (ExplicitRKParameters::b).
Note: In the code TimeIntegration::Udot is equivalent to \({\bf F}\left({\bf u}\right)\).
ts | Object of type TimeIntegration |
Definition at line 35 of file TimeRK.c.
int TimeGLMGEE | ( | void * | ts | ) |
Take a step in time using the General Linear Methods with Global Error Estimators
Advance the ODE given by
\begin{equation} \frac{d{\bf u}}{dt} = {\bf F} \left({\bf u}\right) \end{equation}
by one time step of size HyPar::dt using the \(s\)-stage General Linear Method with Global Error Estimation (GLM-GEE), given by
\begin{align} {\bf U}^{\left(i\right)} &= c_{i0}{\bf u}_n + \sum_{j=1}^{r-1} c_{ij} \tilde{\bf u}_n^j + \Delta t \sum_{j=1}^{i-1} a_{ij} {\bf F}\left({\bf U}^{\left(j\right)}\right), i=1,\cdots,s\\ {\bf u}_{n+1} &= d_{00} {\bf u}_n + \sum_{j=1}^{r-1} d_{0j} \tilde{\bf u}_n^j + \Delta t \sum_{j=1}^s b_{0j} {\bf F}\left({\bf U}^{\left(j\right)}\right), \\ \tilde{\bf u}_{n+1}^i &= d_{i0} {\bf u}_n + \sum_{j=1}^{r-1} d_{ij} \tilde{\bf u}_n^j + \Delta t \sum_{j=1}^s b_{ij} {\bf F}\left({\bf U}^{\left(j\right)}\right), i=1,\cdots,r-1 \end{align}
where the superscripts in parentheses represent stages, the subscripts represent the time level, the superscripts without parentheses represent auxiliary solutions, \(\Delta t\) is the time step size HyPar::dt, \(\tilde{\bf u}^i, i=1,\cdots,r-1\) are the auxiliary solutions, and \({\bf F}\left({\bf u}\right)\) is computed by TimeIntegration::RHSFunction. The coefficients defining this methods are:
where \(s\) is the number of stages (GLMGEEParameters::nstages) and \(r\) is the number of auxiliary solutions propagated with the solution (GLMGEEParameters::r).
Note: In the code TimeIntegration::Udot is equivalent to \({\bf F}\left({\bf u}\right)\).
References:
ts | Object of type TimeIntegration |
Definition at line 45 of file TimeGLMGEE.c.