OGS
|
Interface of time discretization schemes for first-order ODEs.
The purpose of TimeDiscretization instances is to store the solution history of an ODE, i. e., to keep the solution at as many timestamps as is required by the respective time discretization scheme. Furthermore, TimeDiscretization instances compute the discretized approximation of the time derivative \( \partial x/\partial t \).
A first-order (implicit) ODE has the general form
\[ F(\dot x, x, t) \stackrel{!}{=} 0. \]
In order to solve it numerically a certain time discretization scheme, such as the forward or backward Euler methods, is used. The discretized ODE is then given by
\[ F(\hat x, x_C, t_C) \stackrel{!}{=} 0. \]
This interface has been designed with first-order implicit quasi-linear ODEs in mind. They can be expressed as follows and are given here only to serve as an example.
\[ M(x,t)\cdot \dot x + K(x,t) \cdot x - b(x,t) =: r(\dot x, x, t) \stackrel{!}{=} 0. \]
After time discretization this formula becomes:
\[ M(x_C,t_C)\cdot \hat x + K(x_C,t_C) \cdot x_C - b(x_C,t_C) =: r(\hat x, x_C, t_C) \stackrel{!}{=} 0. \]
The meaning of indices for \( x \) and \( t \) is as follows:
\( \hat x \) is the discrete approximation of \( \dot x := \partial x/\partial t\). It is assumed that \( \hat x \) can be written in the following form:
\[ \hat x = \alpha \cdot x_N - x_O, \]
where \( \alpha := \partial \hat x / \partial x_N \) is a scalar.
For different time discretization schemes \( x_C \), \( t_C \), \( x_N \), \( x_O \) and \( \alpha \) take different values. Those for the time implemented schemes are given in the table below.
Scheme | \( x_C \) | \( t_C \) | \( \alpha \) | \( x_N \) | \( x_O \) -----------— | ------------— | ------------— | ------------------— | ------------— | -------------------— Backward Euler | \( x_{n+1} \) | \( t_{n+1} \) | \( 1/\Delta t \) | \( x_{n+1} \) | \( x_n / \Delta t \)
Definition at line 92 of file TimeDiscretization.h.
#include <TimeDiscretization.h>
Public Member Functions | |
TimeDiscretization ()=default | |
virtual void | setInitialState (const double t0)=0 |
Sets the initial condition. | |
virtual void | nextTimestep (const double t, const double delta_t)=0 |
virtual double | getCurrentTime () const =0 |
virtual double | getCurrentTimeIncrement () const =0 |
virtual double | getPreviousTimeIncrement () const =0 |
Returns the value of \(\Delta t\) from the previous time step. | |
virtual void | getWeightedOldX (GlobalVector &y, GlobalVector const &x_old) const =0 |
Returns \( x_O \). | |
virtual | ~TimeDiscretization ()=default |
|
default |
|
virtualdefault |
|
pure virtual |
Returns \( t_C \), i.e., the time at which the equation will be assembled.
Implemented in NumLib::BackwardEuler.
|
pure virtual |
Returns \( \Delta t_C \), i.e., the time at which the equation will be assembled.
Implemented in NumLib::BackwardEuler.
|
pure virtual |
Returns the value of \(\Delta t\) from the previous time step.
Implemented in NumLib::BackwardEuler.
|
pure virtual |
Returns \( x_O \).
Implemented in NumLib::BackwardEuler.
|
pure virtual |
Indicate that the computation of a new timestep is being started now.
delta_t
must not change throughout the entire time integration process! This is not checked by this code! Implemented in NumLib::BackwardEuler.
|
pure virtual |
Sets the initial condition.
Implemented in NumLib::BackwardEuler.