ug4
ug::ThetaTimeStep< TAlgebra > Class Template Reference

theta time stepping scheme More...

#include <theta_time_step.h>

+ Inheritance diagram for ug::ThetaTimeStep< TAlgebra >:

Public Types

typedef TAlgebra algebra_type
 Type of algebra. More...
 
typedef IDomainDiscretization< TAlgebra > domain_discretization_type
 Domain Discretization type. More...
 
typedef algebra_type::matrix_type matrix_type
 Type of algebra matrix. More...
 
typedef algebra_type::vector_type vector_type
 Type of algebra vector. More...
 
- Public Types inherited from ug::MultiStepTimeDiscretization< TAlgebra >
typedef TAlgebra algebra_type
 Type of algebra. More...
 
typedef IDomainDiscretization< algebra_typedomain_discretization_type
 Domain Discretization type. More...
 
typedef CPUAlgebra::vector_type error_vector_type
 Type of algebra vector. More...
 
typedef algebra_type::matrix_type matrix_type
 Type of algebra matrix. More...
 
typedef algebra_type::vector_type vector_type
 Type of algebra vector. More...
 
- Public Types inherited from ug::ITimeDiscretization< TAlgebra >
typedef TAlgebra algebra_type
 Algebra type. More...
 
typedef IDomainDiscretization< TAlgebra > domain_discretization_type
 Domain Discretization type. More...
 
typedef algebra_type::vector_type vector_type
 Vector type. More...
 
- Public Types inherited from ug::IAssemble< TAlgebra >
typedef TAlgebra algebra_type
 Algebra type. More...
 
typedef TAlgebra::matrix_type matrix_type
 Type of algebra matrix. More...
 
typedef TAlgebra::vector_type vector_type
 Type of algebra vector. More...
 

Public Member Functions

virtual size_t num_stages () const
 returns number of stages More...
 
void set_scheme (const char *scheme)
 sets the scheme More...
 
virtual void set_stage (size_t stage)
 sets the stage More...
 
void set_theta (number theta)
 sets the theta value More...
 
 ThetaTimeStep (SmartPtr< IDomainDiscretization< TAlgebra > > spDD)
 default constructor (implicit Euler) More...
 
 ThetaTimeStep (SmartPtr< IDomainDiscretization< TAlgebra > > spDD, const char *scheme)
 theta = 1.0 -> Implicit Euler, 0.0 -> Explicit Euler More...
 
 ThetaTimeStep (SmartPtr< IDomainDiscretization< TAlgebra > > spDD, number theta)
 theta = 1.0 -> Implicit Euler, 0.0 -> Explicit Euler More...
 
virtual ~ThetaTimeStep ()
 
- Public Member Functions inherited from ug::MultiStepTimeDiscretization< TAlgebra >
void adjust_solution (vector_type &u, const GridLevel &gl)
 sets dirichlet values in solution vector More...
 
void assemble_defect (vector_type &d, const vector_type &u, const GridLevel &gl)
 assembles Defect More...
 
void assemble_jacobian (matrix_type &J, const vector_type &u, const GridLevel &gl)
 assembles Jacobian (or Approximation of Jacobian) More...
 
void assemble_linear (matrix_type &A, vector_type &b, const GridLevel &gl)
 Assembles Matrix and Right-Hand-Side for a linear problem. More...
 
void assemble_rhs (vector_type &b, const GridLevel &gl)
 Assembles Right-Hand-Side for a linear problem. More...
 
void assemble_rhs (vector_type &b, const vector_type &u, const GridLevel &gl)
 assembles rhs More...
 
void calc_error (const vector_type &u)
 
void calc_error (const vector_type &u, error_vector_type &u_vtk)
 
void calc_error (const vector_type &u, error_vector_type *u_vtk)
 Error estimator ///. More...
 
virtual void finish_step (SmartPtr< VectorTimeSeries< vector_type > > currSol)
 
virtual void finish_step_elem (SmartPtr< VectorTimeSeries< vector_type > > currSol, const GridLevel &gl)
 
virtual number future_time () const
 returns the future time point (i.e. the one that will be computed) More...
 
void invalidate_error ()
 
bool is_error_valid ()
 returns whether error indicators are valid More...
 
 MultiStepTimeDiscretization (SmartPtr< IDomainDiscretization< algebra_type > > spDD)
 constructor More...
 
virtual size_t num_prev_steps () const
 returns number of previous time steps needed More...
 
virtual void prepare_step (SmartPtr< VectorTimeSeries< vector_type > > prevSol, number dt)
 prepares the assembling of Defect/Jacobian for a time step More...
 
virtual void prepare_step_elem (SmartPtr< VectorTimeSeries< vector_type > > prevSol, number dt, const GridLevel &gl)
 prepares the assembling of Defect/Jacobian for a time step More...
 
virtual ~MultiStepTimeDiscretization ()
 
- Public Member Functions inherited from ug::ITimeDiscretization< TAlgebra >
virtual SmartPtr< IConstraint< TAlgebra > > constraint (size_t i)
 returns the i'th constraint More...
 
SmartPtr< IDomainDiscretization< TAlgebra > > domain_disc () const
 return underlying domain disc More...
 
 ITimeDiscretization (SmartPtr< IDomainDiscretization< TAlgebra > > spDD)
 create and set domain discretization More...
 
virtual size_t num_constraints () const
 returns the number of constraint More...
 
void prepare_step_elem (SmartPtr< VectorTimeSeries< vector_type > > prevSol, number dt)
 prepares the assembling of Defect/Jacobian for a time step More...
 
void finish_step_elem (SmartPtr< VectorTimeSeries< vector_type > > currSol)
 
- Public Member Functions inherited from ug::IAssemble< TAlgebra >
void adjust_solution (vector_type &u)
 
void assemble_defect (vector_type &d, const vector_type &u)
 
void assemble_jacobian (matrix_type &J, const vector_type &u)
 
void assemble_linear (matrix_type &A, vector_type &b)
 
void assemble_mass_matrix (matrix_type &M, const vector_type &u)
 
virtual void assemble_mass_matrix (matrix_type &M, const vector_type &u, const GridLevel &gl)
 assembles mass matrix More...
 
void assemble_rhs (vector_type &b)
 
virtual void assemble_rhs (vector_type &rhs, const vector_type &u)
 
void assemble_stiffness_matrix (matrix_type &A, const vector_type &u)
 
virtual void assemble_stiffness_matrix (matrix_type &A, const vector_type &u, const GridLevel &gl)
 assembles stiffness matrix More...
 
virtual ~IAssemble ()
 Virtual Destructor. More...
 

Protected Member Functions

virtual number update_scaling (std::vector< number > &vSM, std::vector< number > &vSA, number dt, number currentTime, ConstSmartPtr< VectorTimeSeries< vector_type > > prevSol)
 Error estimator ///. More...
 

Protected Attributes

std::string m_scheme
 
size_t m_stage
 
number m_theta
 
- Protected Attributes inherited from ug::MultiStepTimeDiscretization< TAlgebra >
number m_dt
 Time Step size. More...
 
number m_futureTime
 Future Time. More...
 
SmartPtr< VectorTimeSeries< vector_type > > m_pPrevSol
 Previous solutions. More...
 
size_t m_prevSteps
 number of previous steps needed. More...
 
std::vector< numberm_vScaleMass
 Scaling for mass part. More...
 
std::vector< numberm_vScaleStiff
 Scaling for stiffness part. More...
 
- Protected Attributes inherited from ug::ITimeDiscretization< TAlgebra >
SmartPtr< IDomainDiscretization< TAlgebra > > m_spDomDisc
 Domain Discretization. More...
 

Detailed Description

template<typename TAlgebra>
class ug::ThetaTimeStep< TAlgebra >

theta time stepping scheme

This time stepping scheme discretizes equations of the form

\[ \partial_t u(t) = f(t) \]

as

\[ \frac{u(t^{k+1}) - u(t^k)}{\Delta t} = (1-\theta) \cdot f(t^{k+1}) + \theta \cdot f(t^k) \]

Thus, for \(\theta = 1 \) this is the Backward-Euler time stepping.

Member Typedef Documentation

◆ algebra_type

template<typename TAlgebra >
typedef TAlgebra ug::ThetaTimeStep< TAlgebra >::algebra_type

Type of algebra.

◆ domain_discretization_type

template<typename TAlgebra >
typedef IDomainDiscretization<TAlgebra> ug::ThetaTimeStep< TAlgebra >::domain_discretization_type

Domain Discretization type.

◆ matrix_type

template<typename TAlgebra >
typedef algebra_type::matrix_type ug::ThetaTimeStep< TAlgebra >::matrix_type

Type of algebra matrix.

◆ vector_type

template<typename TAlgebra >
typedef algebra_type::vector_type ug::ThetaTimeStep< TAlgebra >::vector_type

Type of algebra vector.

Constructor & Destructor Documentation

◆ ThetaTimeStep() [1/3]

template<typename TAlgebra >
ug::ThetaTimeStep< TAlgebra >::ThetaTimeStep ( SmartPtr< IDomainDiscretization< TAlgebra > >  spDD)
inline

◆ ThetaTimeStep() [2/3]

template<typename TAlgebra >
ug::ThetaTimeStep< TAlgebra >::ThetaTimeStep ( SmartPtr< IDomainDiscretization< TAlgebra > >  spDD,
number  theta 
)
inline

theta = 1.0 -> Implicit Euler, 0.0 -> Explicit Euler

References ug::MultiStepTimeDiscretization< TAlgebra >::m_prevSteps, and ug::ThetaTimeStep< TAlgebra >::set_theta().

◆ ThetaTimeStep() [3/3]

template<typename TAlgebra >
ug::ThetaTimeStep< TAlgebra >::ThetaTimeStep ( SmartPtr< IDomainDiscretization< TAlgebra > >  spDD,
const char *  scheme 
)
inline

theta = 1.0 -> Implicit Euler, 0.0 -> Explicit Euler

References ug::MultiStepTimeDiscretization< TAlgebra >::m_prevSteps, and ug::ThetaTimeStep< TAlgebra >::set_theta().

◆ ~ThetaTimeStep()

template<typename TAlgebra >
virtual ug::ThetaTimeStep< TAlgebra >::~ThetaTimeStep ( )
inlinevirtual

Member Function Documentation

◆ num_stages()

template<typename TAlgebra >
virtual size_t ug::ThetaTimeStep< TAlgebra >::num_stages ( ) const
inlinevirtual

returns number of stages

Implements ug::ITimeDiscretization< TAlgebra >.

References ug::ThetaTimeStep< TAlgebra >::m_scheme, and UG_THROW.

◆ set_scheme()

template<typename TAlgebra >
void ug::ThetaTimeStep< TAlgebra >::set_scheme ( const char *  scheme)
inline

sets the scheme

References ug::ThetaTimeStep< TAlgebra >::m_scheme.

◆ set_stage()

template<typename TAlgebra >
virtual void ug::ThetaTimeStep< TAlgebra >::set_stage ( size_t  stage)
inlinevirtual

◆ set_theta()

template<typename TAlgebra >
void ug::ThetaTimeStep< TAlgebra >::set_theta ( number  theta)
inline

◆ update_scaling()

template<typename TAlgebra >
virtual number ug::ThetaTimeStep< TAlgebra >::update_scaling ( std::vector< number > &  vSM,
std::vector< number > &  vSA,
number  dt,
number  currentTime,
ConstSmartPtr< VectorTimeSeries< vector_type > >  prevSol 
)
inlineprotectedvirtual

Error estimator ///.

updates the scaling factors, returns the future time

Implements ug::MultiStepTimeDiscretization< TAlgebra >.

References ug::ThetaTimeStep< TAlgebra >::m_scheme, ug::ThetaTimeStep< TAlgebra >::m_stage, ug::ThetaTimeStep< TAlgebra >::m_theta, and UG_THROW.

Member Data Documentation

◆ m_scheme

◆ m_stage

template<typename TAlgebra >
size_t ug::ThetaTimeStep< TAlgebra >::m_stage
protected

◆ m_theta

template<typename TAlgebra >
number ug::ThetaTimeStep< TAlgebra >::m_theta
protected

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