OGS
NumLib::BackwardEuler Class Referencefinal

Detailed Description

Backward Euler scheme.

Definition at line 157 of file TimeDiscretization.h.

#include <TimeDiscretization.h>

Inheritance diagram for NumLib::BackwardEuler:
Collaboration diagram for NumLib::BackwardEuler:

Public Member Functions

void setInitialState (const double t0) override
 Sets the initial condition. More...
 
void nextTimestep (const double t, const double delta_t) override
 
double getCurrentTime () const override
 
double getCurrentTimeIncrement () const override
 
double getNewXWeight () const override
 Returns \( \alpha = \partial \hat x / \partial x_N \). More...
 
void getWeightedOldX (GlobalVector &y, GlobalVector const &x_old) const override
 Returns \( x_O \). More...
 
- Public Member Functions inherited from NumLib::TimeDiscretization
 TimeDiscretization ()=default
 
double computeRelativeChangeFromPreviousTimestep (GlobalVector const &x, GlobalVector const &x_old, MathLib::VecNormType norm_type)
 
void getXdot (GlobalVector const &x_at_new_timestep, GlobalVector const &x_old, GlobalVector &xdot) const
 
virtual ~TimeDiscretization ()=default
 

Private Attributes

double _t = std::numeric_limits<double>::quiet_NaN()
 \( t_C \) More...
 
double _delta_t
 the timestep size More...
 

Additional Inherited Members

- Protected Attributes inherited from NumLib::TimeDiscretization
std::unique_ptr< GlobalVector > _dx
 Used to store \( u_{n+1}-u_{n}\). More...
 

Member Function Documentation

◆ getCurrentTime()

double NumLib::BackwardEuler::getCurrentTime ( ) const
inlineoverridevirtual

Returns \( t_C \), i.e., the time at which the equation will be assembled.

Implements NumLib::TimeDiscretization.

Definition at line 168 of file TimeDiscretization.h.

168 { return _t; }

References _t.

◆ getCurrentTimeIncrement()

double NumLib::BackwardEuler::getCurrentTimeIncrement ( ) const
inlineoverridevirtual

Returns \( \Delta t_C \), i.e., the time at which the equation will be assembled.

Implements NumLib::TimeDiscretization.

Definition at line 169 of file TimeDiscretization.h.

169 { return _delta_t; }

References _delta_t.

◆ getNewXWeight()

double NumLib::BackwardEuler::getNewXWeight ( ) const
inlineoverridevirtual

Returns \( \alpha = \partial \hat x / \partial x_N \).

Implements NumLib::TimeDiscretization.

Definition at line 170 of file TimeDiscretization.h.

170 { return 1.0 / _delta_t; }

References _delta_t.

◆ getWeightedOldX()

void NumLib::BackwardEuler::getWeightedOldX ( GlobalVector &  y,
GlobalVector const &  x_old 
) const
inlineoverridevirtual

Returns \( x_O \).

Implements NumLib::TimeDiscretization.

Definition at line 171 of file TimeDiscretization.h.

173  {
174  namespace LinAlg = MathLib::LinAlg;
175 
176  // y = x_old / delta_t
177  LinAlg::copy(x_old, y);
178  LinAlg::scale(y, 1.0 / _delta_t);
179  }

References _delta_t, MathLib::LinAlg::copy(), and MathLib::LinAlg::scale().

◆ nextTimestep()

void NumLib::BackwardEuler::nextTimestep ( const double  t,
const double  delta_t 
)
inlineoverridevirtual

Indicate that the computation of a new timestep is being started now.

Warning
Currently changing timestep sizes are not supported. Thus, delta_t must not change throughout the entire time integration process! This is not checked by this code!

Implements NumLib::TimeDiscretization.

Definition at line 162 of file TimeDiscretization.h.

163  {
164  _t = t;
165  _delta_t = delta_t;
166  }

References _delta_t, and _t.

◆ setInitialState()

void NumLib::BackwardEuler::setInitialState ( const double  t0)
inlineoverridevirtual

Sets the initial condition.

Implements NumLib::TimeDiscretization.

Definition at line 160 of file TimeDiscretization.h.

160 { _t = t0; }

References _t.

Member Data Documentation

◆ _delta_t

double NumLib::BackwardEuler::_delta_t
private
Initial value:
=
std::numeric_limits<double>::quiet_NaN()

the timestep size

Definition at line 183 of file TimeDiscretization.h.

Referenced by getCurrentTimeIncrement(), getNewXWeight(), getWeightedOldX(), and nextTimestep().

◆ _t

double NumLib::BackwardEuler::_t = std::numeric_limits<double>::quiet_NaN()
private

\( t_C \)

Definition at line 182 of file TimeDiscretization.h.

Referenced by getCurrentTime(), nextTimestep(), and setInitialState().


The documentation for this class was generated from the following file:
MathLib::LinAlg::scale
void scale(MatrixOrVector &x, double const a)
Scales x by a.
Definition: LinAlg.h:44
MathLib::LinAlg::copy
void copy(MatrixOrVector const &x, MatrixOrVector &y)
Copies x to y.
Definition: LinAlg.h:37
MathLib::LinAlg
NumLib::BackwardEuler::_delta_t
double _delta_t
the timestep size
Definition: TimeDiscretization.h:183
NumLib::BackwardEuler::_t
double _t
Definition: TimeDiscretization.h:182