OGS
NumLib::BackwardEuler Class Referencefinal

Detailed Description

Backward Euler scheme.

Definition at line 145 of file TimeDiscretization.h.

#include <TimeDiscretization.h>

Inheritance diagram for NumLib::BackwardEuler:
[legend]
Collaboration diagram for NumLib::BackwardEuler:
[legend]

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
 
void getWeightedOldX (GlobalVector &y, GlobalVector const &x_old) const override
 Returns \( x_O \). More...
 
- Public Member Functions inherited from NumLib::TimeDiscretization
 TimeDiscretization ()=default
 
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...
 

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 155 of file TimeDiscretization.h.

155 { 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 156 of file TimeDiscretization.h.

156 { return _delta_t; }
double _delta_t
the timestep size

References _delta_t.

◆ getWeightedOldX()

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

Returns \( x_O \).

Implements NumLib::TimeDiscretization.

Definition at line 64 of file TimeDiscretization.cpp.

66 {
67  namespace LinAlg = MathLib::LinAlg;
68 
69  // y = x_old / delta_t
70  LinAlg::copy(x_old, y);
71  LinAlg::scale(y, 1.0 / _delta_t);
72 }
void copy(PETScVector const &x, PETScVector &y)
Definition: LinAlg.cpp:37
void scale(PETScVector &x, PetscScalar const a)
Definition: LinAlg.cpp:44

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 149 of file TimeDiscretization.h.

150  {
151  _t = t;
152  _delta_t = delta_t;
153  }
static const double t

References _delta_t, _t, and MathLib::t.

◆ setInitialState()

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

Sets the initial condition.

Implements NumLib::TimeDiscretization.

Definition at line 148 of file TimeDiscretization.h.

148 { _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 162 of file TimeDiscretization.h.

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

◆ _t

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

\( t_C \)

Definition at line 161 of file TimeDiscretization.h.

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


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