OGS
NumLib::BackwardEuler Class Referencefinal

Detailed Description

Backward Euler scheme.

Definition at line 127 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.
 
void nextTimestep (const double t, const double delta_t) override
 
double getCurrentTime () const override
 
double getCurrentTimeIncrement () const override
 
double getPreviousTimeIncrement () const override
 Returns the value of \(\Delta t\) from the previous time step.
 
void getWeightedOldX (GlobalVector &y, GlobalVector const &x_old) const override
 Returns \( x_O \).
 
- Public Member Functions inherited from NumLib::TimeDiscretization
 TimeDiscretization ()=default
 
virtual ~TimeDiscretization ()=default
 

Private Attributes

double _t = std::numeric_limits<double>::quiet_NaN()
 \( t_C \)
 
double _delta_t
 the timestep size
 
double _delta_t_prev = std::numeric_limits<double>::quiet_NaN()
 The timestep size of the previous timestep.
 

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

138{ 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 139 of file TimeDiscretization.h.

139{ return _delta_t; }
double _delta_t
the timestep size

References _delta_t.

◆ getPreviousTimeIncrement()

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

Returns the value of \(\Delta t\) from the previous time step.

Implements NumLib::TimeDiscretization.

Definition at line 140 of file TimeDiscretization.h.

140{ return _delta_t_prev; }
double _delta_t_prev
The timestep size of the previous timestep.

References _delta_t_prev.

◆ getWeightedOldX()

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

Returns \( x_O \).

Implements NumLib::TimeDiscretization.

Definition at line 18 of file TimeDiscretization.cpp.

20{
21 namespace LinAlg = MathLib::LinAlg;
22
23 // y = x_old / delta_t
24 LinAlg::copy(x_old, y);
25 LinAlg::scale(y, 1.0 / _delta_t);
26}
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 131 of file TimeDiscretization.h.

132 {
134 _t = t;
135 _delta_t = delta_t;
136 }

References _delta_t, _delta_t_prev, and _t.

◆ setInitialState()

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

Sets the initial condition.

Implements NumLib::TimeDiscretization.

Definition at line 130 of file TimeDiscretization.h.

130{ _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 146 of file TimeDiscretization.h.

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

◆ _delta_t_prev

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

The timestep size of the previous timestep.

Definition at line 150 of file TimeDiscretization.h.

Referenced by getPreviousTimeIncrement(), and nextTimestep().

◆ _t

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

\( t_C \)

Definition at line 145 of file TimeDiscretization.h.

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


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