Plugins
ug::LinearImplicitEuler< TAlgebra > Class Template Reference

#include <linear_implicit_timestep.h>

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

Public Types

typedef TAlgebra algebra_type
 Type of algebra. More...
 
typedef ITimeDiscretization< TAlgebra > base_type
 Type of base class. More...
 
typedef IDomainDiscretization< algebra_typedomain_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::ITimeDiscretization< TAlgebra >
typedef TAlgebra algebra_type
 
typedef IDomainDiscretization< TAlgebra > domain_discretization_type
 
typedef algebra_type::vector_type vector_type
 
- Public Types inherited from ug::IAssemble< class >
typedef TAlgebra algebra_type
 
typedef TAlgebra::matrix_type matrix_type
 
typedef TAlgebra::vector_type vector_type
 
- Public Types inherited from ug::DebugWritingObject< TAlgebra >
typedef TAlgebra algebra_type
 
typedef TAlgebra::matrix_type matrix_type
 
typedef TAlgebra::vector_type vector_type
 
- Public Types inherited from VectorDebugWritingObject< TAlgebra::vector_type >
typedef TAlgebra::vector_type vector_type
 

Public Member Functions

void adjust_solution (vector_type &u, const GridLevel &gl)
 
void assemble_defect (vector_type &d, const vector_type &u, const GridLevel &gl)
 Meant to assemble d(u), but abused here... (u not used!) More...
 
void assemble_jacobian (matrix_type &J, const vector_type &u, const GridLevel &gl)
 Meant to assemble J(u) c = d(u), but abused here... (u not used!) More...
 
void assemble_linear (matrix_type &A, vector_type &b, const GridLevel &gl)
 Should return (M+tau A) delta = tau f. More...
 
void assemble_rhs (vector_type &b, const GridLevel &gl)
 
void assemble_rhs (vector_type &b, const vector_type &u, const GridLevel &gl)
 
void disable_linear_mode ()
 
void disable_matrix_cache ()
 
void enable_linear_mode ()
 Some simplifications for linear systems. (In this case, the mass matrix is not re-assembled.) More...
 
void enable_matrix_cache ()
 
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
 
void invalidate ()
 Invalidate all cached operators. More...
 
void invalidate_gamma ()
 Invalidate Gamma operator. More...
 
 LinearImplicitEuler (SmartPtr< IDomainDiscretization< algebra_type > > spDD)
 CTOR. More...
 
 LinearImplicitEuler (SmartPtr< IDomainDiscretization< algebra_type > > spDefectDisc, SmartPtr< IDomainDiscretization< algebra_type > > spMatrixJDisc)
 CTOR. More...
 
 LinearImplicitEuler (SmartPtr< IDomainDiscretization< algebra_type > > spDefectDisc, SmartPtr< IDomainDiscretization< algebra_type > > spMatrixJDisc, SmartPtr< IDomainDiscretization< algebra_type > > spGammaDisc)
 CTOR. More...
 
virtual size_t num_prev_steps () const
 
virtual size_t num_stages () const
 
virtual void prepare_step (SmartPtr< VectorTimeSeries< vector_type > > prevSol, number dt)
 
virtual void prepare_step_elem (SmartPtr< VectorTimeSeries< vector_type > > prevSol, number dt, const GridLevel &gl)
 
void set_gamma_disc (SmartPtr< IDomainDiscretization< algebra_type > > spGammaDisc)
 
void set_matrix_cache (bool useCache)
 
virtual void set_stage (size_t stage)
 
bool use_linear_mode () const
 
virtual ~LinearImplicitEuler ()
 DTOR. More...
 
- Public Member Functions inherited from ug::ITimeDiscretization< TAlgebra >
virtual SmartPtr< IConstraint< TAlgebra > > constraint (size_t i)
 
SmartPtr< IDomainDiscretization< TAlgebra > > domain_disc () const
 
virtual void finish_step (SmartPtr< VectorTimeSeries< vector_type > > currSol)=0
 
void finish_step_elem (SmartPtr< VectorTimeSeries< vector_type > > currSol)
 
void finish_step_elem (SmartPtr< VectorTimeSeries< vector_type > > currSol)
 
virtual void finish_step_elem (SmartPtr< VectorTimeSeries< vector_type > > currSol, const GridLevel &gl)=0
 
virtual void finish_step_elem (SmartPtr< VectorTimeSeries< vector_type > > currSol, const GridLevel &gl)=0
 
 ITimeDiscretization (SmartPtr< IDomainDiscretization< TAlgebra > > spDD)
 
virtual size_t num_constraints () const
 
virtual void prepare_step (SmartPtr< VectorTimeSeries< vector_type > > prevSol, number dt)=0
 
void prepare_step_elem (SmartPtr< VectorTimeSeries< vector_type > > prevSol, number dt)
 
void prepare_step_elem (SmartPtr< VectorTimeSeries< vector_type > > prevSol, number dt)
 
virtual void prepare_step_elem (SmartPtr< VectorTimeSeries< vector_type > > prevSol, number dt, const GridLevel &gl)=0
 
virtual void prepare_step_elem (SmartPtr< VectorTimeSeries< vector_type > > prevSol, number dt, const GridLevel &gl)=0
 
- Public Member Functions inherited from ug::IAssemble< class >
void adjust_solution (vector_type &u)
 
virtual void adjust_solution (vector_type &u, const GridLevel &gl)=0
 
void assemble_defect (vector_type &d, const vector_type &u)
 
virtual void assemble_defect (vector_type &d, const vector_type &u, const GridLevel &gl)=0
 
void assemble_jacobian (matrix_type &J, const vector_type &u)
 
virtual void assemble_jacobian (matrix_type &J, const vector_type &u, const GridLevel &gl)=0
 
void assemble_linear (matrix_type &A, vector_type &b)
 
virtual void assemble_linear (matrix_type &A, vector_type &b, const GridLevel &gl)=0
 
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)
 
void assemble_rhs (vector_type &b)
 
virtual void assemble_rhs (vector_type &b, const GridLevel &gl)=0
 
virtual void assemble_rhs (vector_type &rhs, const vector_type &u)
 
virtual void assemble_rhs (vector_type &rhs, const vector_type &u, const GridLevel &gl)=0
 
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)
 
virtual ~IAssemble ()
 
- Public Member Functions inherited from ug::DebugWritingObject< TAlgebra >
SmartPtr< IDebugWriter< algebra_type > > debug_writer ()
 
ConstSmartPtr< IDebugWriter< algebra_type > > debug_writer () const
 
bool debug_writer_valid () const
 
 DebugWritingObject ()
 
 DebugWritingObject (const DebugWritingObject< algebra_type > &parent)
 
 DebugWritingObject (SmartPtr< IDebugWriter< algebra_type > > spDebugWriter)
 
virtual void set_debug (SmartPtr< IDebugWriter< algebra_type > > spDebugWriter)
 
virtual ~DebugWritingObject ()
 
- Public Member Functions inherited from VectorDebugWritingObject< TAlgebra::vector_type >
virtual void set_debug (SmartPtr< IVectorDebugWriter< vector_type > > spDebugWriter)
 
SmartPtr< IVectorDebugWriter< vector_type > > vector_debug_writer ()
 
ConstSmartPtr< IVectorDebugWriter< vector_type > > vector_debug_writer () const
 
bool vector_debug_writer_valid () const
 
 VectorDebugWritingObject ()
 
 VectorDebugWritingObject (SmartPtr< IVectorDebugWriter< vector_type > > spDebugWriter)
 
void write_debug (const vector_type &vec, const char *filename)
 
virtual ~VectorDebugWritingObject ()
 

Protected Member Functions

virtual number update_scaling (std::vector< number > &vSM, std::vector< number > &vSA, number dt, number currentTime, ConstSmartPtr< VectorTimeSeries< vector_type > > prevSol)
 
- Protected Member Functions inherited from ug::DebugWritingObject< TAlgebra >
void enter_debug_writer_section (const char *secDir)
 
void enter_debug_writer_section (std::string secDir)
 
void leave_debug_writer_section ()
 
void write_debug (const matrix_type &mat, const char *filename)
 
void write_debug (const matrix_type &mat, std::string name)
 
- Protected Member Functions inherited from VectorDebugWritingObject< TAlgebra::vector_type >
void enter_vector_debug_writer_section (const char *secDir)
 
void enter_vector_debug_writer_section (std::string secDir)
 
void leave_vector_debug_writer_section ()
 
void print_debugger_message (const char *msg)
 
void print_debugger_message (std::string msg)
 
virtual void write_debug (const vector_type &vec, std::string name)
 

Protected Attributes

bool m_bGammaNeedsUpdate
 
bool m_bMatrixJNeedsUpdate
 
number m_dt
 Time Step size. More...
 
number m_futureTime
 Future Time. More...
 
SmartPtr< VectorTimeSeries< vector_type > > m_pPrevSol
 Previous solutions. More...
 
SmartPtr< IDomainDiscretization< algebra_type > > m_spGammaDisc
 Gamma disc. More...
 
SmartPtr< AssembledLinearOperator< algebra_type > > m_spGammaOp
 Gamma operator. More...
 
SmartPtr< matrix_typem_spMatrixCacheMk
 
SmartPtr< IDomainDiscretization< algebra_type > > m_spMatrixJDisc
 
SmartPtr< AssembledLinearOperator< algebra_type > > m_spMatrixJOp
 Operator. More...
 
bool m_useCachedMatrices
 
bool m_useLinearMode
 
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
 
- Protected Attributes inherited from ug::DebugWritingObject< TAlgebra >
SmartPtr< IDebugWriter< algebra_type > > m_spDebugWriter
 
- Protected Attributes inherited from VectorDebugWritingObject< TAlgebra::vector_type >
SmartPtr< IVectorDebugWriter< vector_type > > m_spVectorDebugWriter
 

Static Protected Attributes

static const size_t m_prevSteps =1
 number of previous steps needed. More...
 

Detailed Description

template<class TAlgebra>
class ug::LinearImplicitEuler< TAlgebra >

This time stepping scheme discretizes equations of the form

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

as

\[ (M - \Delta t J) \left( u(t^{k+1}) - u(t^k) \right) = \Delta t \cdot f(t^{k}) \]

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

Member Typedef Documentation

◆ algebra_type

template<class TAlgebra >
typedef TAlgebra ug::LinearImplicitEuler< TAlgebra >::algebra_type

Type of algebra.

◆ base_type

template<class TAlgebra >
typedef ITimeDiscretization<TAlgebra> ug::LinearImplicitEuler< TAlgebra >::base_type

Type of base class.

◆ domain_discretization_type

Domain Discretization type.

◆ matrix_type

template<class TAlgebra >
typedef algebra_type::matrix_type ug::LinearImplicitEuler< TAlgebra >::matrix_type

Type of algebra matrix.

◆ vector_type

template<class TAlgebra >
typedef algebra_type::vector_type ug::LinearImplicitEuler< TAlgebra >::vector_type

Type of algebra vector.

Constructor & Destructor Documentation

◆ LinearImplicitEuler() [1/3]

template<class TAlgebra >
ug::LinearImplicitEuler< TAlgebra >::LinearImplicitEuler ( SmartPtr< IDomainDiscretization< algebra_type > >  spDD)
inline

CTOR.

◆ LinearImplicitEuler() [2/3]

template<class TAlgebra >
ug::LinearImplicitEuler< TAlgebra >::LinearImplicitEuler ( SmartPtr< IDomainDiscretization< algebra_type > >  spDefectDisc,
SmartPtr< IDomainDiscretization< algebra_type > >  spMatrixJDisc 
)
inline

CTOR.

◆ LinearImplicitEuler() [3/3]

template<class TAlgebra >
ug::LinearImplicitEuler< TAlgebra >::LinearImplicitEuler ( SmartPtr< IDomainDiscretization< algebra_type > >  spDefectDisc,
SmartPtr< IDomainDiscretization< algebra_type > >  spMatrixJDisc,
SmartPtr< IDomainDiscretization< algebra_type > >  spGammaDisc 
)
inline

CTOR.

◆ ~LinearImplicitEuler()

template<class TAlgebra >
virtual ug::LinearImplicitEuler< TAlgebra >::~LinearImplicitEuler ( )
inlinevirtual

DTOR.

Member Function Documentation

◆ adjust_solution()

template<typename TAlgebra >
void ug::LinearImplicitEuler< TAlgebra >::adjust_solution ( vector_type u,
const GridLevel gl 
)

◆ assemble_defect()

template<typename TAlgebra >
void ug::LinearImplicitEuler< TAlgebra >::assemble_defect ( vector_type d,
const vector_type u,
const GridLevel gl 
)

Meant to assemble d(u), but abused here... (u not used!)

WARNING: This function is abused Must return : d_A(k-1):= tau * F(k-1) - A(k-1) u(k-1)

References ug::LIB_LIMEX, PROFILE_BEGIN_GROUP, UG_CATCH_THROW, UG_DLOG, and UG_THROW.

◆ assemble_jacobian()

template<typename TAlgebra >
void ug::LinearImplicitEuler< TAlgebra >::assemble_jacobian ( matrix_type J_limex,
const vector_type u,
const GridLevel gl 
)

Meant to assemble J(u) c = d(u), but abused here... (u not used!)

WARNING: This function is abused Must return: $Mk + \tau J$

References ug::GetNNZs(), ug::LIB_LIMEX, PROFILE_BEGIN_GROUP, SPNULL, UG_ASSERT, UG_CATCH_THROW, UG_DLOG, and UG_THROW.

◆ assemble_linear()

template<typename TAlgebra >
void ug::LinearImplicitEuler< TAlgebra >::assemble_linear ( matrix_type A,
vector_type b,
const GridLevel gl 
)

Should return (M+tau A) delta = tau f.

References ug::LIB_LIMEX, PROFILE_BEGIN_GROUP, UG_ASSERT, UG_CATCH_THROW, UG_DLOG, and UG_THROW.

◆ assemble_rhs() [1/2]

template<typename TAlgebra >
void ug::LinearImplicitEuler< TAlgebra >::assemble_rhs ( vector_type b,
const GridLevel gl 
)

◆ assemble_rhs() [2/2]

template<typename TAlgebra >
void ug::LinearImplicitEuler< TAlgebra >::assemble_rhs ( vector_type b,
const vector_type u,
const GridLevel gl 
)

◆ disable_linear_mode()

template<class TAlgebra >
void ug::LinearImplicitEuler< TAlgebra >::disable_linear_mode ( )
inline

◆ disable_matrix_cache()

template<class TAlgebra >
void ug::LinearImplicitEuler< TAlgebra >::disable_matrix_cache ( )
inline

◆ enable_linear_mode()

template<class TAlgebra >
void ug::LinearImplicitEuler< TAlgebra >::enable_linear_mode ( )
inline

Some simplifications for linear systems. (In this case, the mass matrix is not re-assembled.)

References ug::LinearImplicitEuler< TAlgebra >::m_useLinearMode.

◆ enable_matrix_cache()

template<class TAlgebra >
void ug::LinearImplicitEuler< TAlgebra >::enable_matrix_cache ( )
inline

◆ finish_step()

template<class TAlgebra >
virtual void ug::LinearImplicitEuler< TAlgebra >::finish_step ( SmartPtr< VectorTimeSeries< vector_type > >  currSol)
inlinevirtual

◆ finish_step_elem()

template<typename TAlgebra >
void ug::LinearImplicitEuler< TAlgebra >::finish_step_elem ( SmartPtr< VectorTimeSeries< vector_type > >  currSol,
const GridLevel gl 
)
virtual

◆ future_time()

template<class TAlgebra >
virtual number ug::LinearImplicitEuler< TAlgebra >::future_time ( ) const
inlinevirtual

◆ invalidate()

◆ invalidate_gamma()

template<class TAlgebra >
void ug::LinearImplicitEuler< TAlgebra >::invalidate_gamma ( )
inline

◆ num_prev_steps()

template<class TAlgebra >
virtual size_t ug::LinearImplicitEuler< TAlgebra >::num_prev_steps ( ) const
inlinevirtual

◆ num_stages()

template<class TAlgebra >
virtual size_t ug::LinearImplicitEuler< TAlgebra >::num_stages ( ) const
inlinevirtual

◆ prepare_step()

template<typename TAlgebra >
void ug::LinearImplicitEuler< TAlgebra >::prepare_step ( SmartPtr< VectorTimeSeries< vector_type > >  prevSol,
number  dt 
)
virtual

◆ prepare_step_elem()

template<typename TAlgebra >
void ug::LinearImplicitEuler< TAlgebra >::prepare_step_elem ( SmartPtr< VectorTimeSeries< vector_type > >  prevSol,
number  dt,
const GridLevel gl 
)
virtual

◆ set_gamma_disc()

template<class TAlgebra >
void ug::LinearImplicitEuler< TAlgebra >::set_gamma_disc ( SmartPtr< IDomainDiscretization< algebra_type > >  spGammaDisc)
inline

◆ set_matrix_cache()

template<class TAlgebra >
void ug::LinearImplicitEuler< TAlgebra >::set_matrix_cache ( bool  useCache)
inline

◆ set_stage()

template<class TAlgebra >
virtual void ug::LinearImplicitEuler< TAlgebra >::set_stage ( size_t  stage)
inlinevirtual

◆ update_scaling()

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

◆ use_linear_mode()

template<class TAlgebra >
bool ug::LinearImplicitEuler< TAlgebra >::use_linear_mode ( ) const
inline

Member Data Documentation

◆ m_bGammaNeedsUpdate

template<class TAlgebra >
bool ug::LinearImplicitEuler< TAlgebra >::m_bGammaNeedsUpdate
protected

◆ m_bMatrixJNeedsUpdate

template<class TAlgebra >
bool ug::LinearImplicitEuler< TAlgebra >::m_bMatrixJNeedsUpdate
protected

◆ m_dt

template<class TAlgebra >
number ug::LinearImplicitEuler< TAlgebra >::m_dt
protected

Time Step size.

◆ m_futureTime

template<class TAlgebra >
number ug::LinearImplicitEuler< TAlgebra >::m_futureTime
protected

◆ m_pPrevSol

template<class TAlgebra >
SmartPtr<VectorTimeSeries<vector_type> > ug::LinearImplicitEuler< TAlgebra >::m_pPrevSol
protected

Previous solutions.

◆ m_prevSteps

template<class TAlgebra >
const size_t ug::LinearImplicitEuler< TAlgebra >::m_prevSteps =1
staticprotected

number of previous steps needed.

Referenced by ug::LinearImplicitEuler< TAlgebra >::num_prev_steps().

◆ m_spGammaDisc

template<class TAlgebra >
SmartPtr<IDomainDiscretization<algebra_type> > ug::LinearImplicitEuler< TAlgebra >::m_spGammaDisc
protected

◆ m_spGammaOp

template<class TAlgebra >
SmartPtr<AssembledLinearOperator<algebra_type> > ug::LinearImplicitEuler< TAlgebra >::m_spGammaOp
protected

◆ m_spMatrixCacheMk

template<class TAlgebra >
SmartPtr<matrix_type> ug::LinearImplicitEuler< TAlgebra >::m_spMatrixCacheMk
protected

◆ m_spMatrixJDisc

template<class TAlgebra >
SmartPtr<IDomainDiscretization<algebra_type> > ug::LinearImplicitEuler< TAlgebra >::m_spMatrixJDisc
protected

◆ m_spMatrixJOp

template<class TAlgebra >
SmartPtr<AssembledLinearOperator<algebra_type> > ug::LinearImplicitEuler< TAlgebra >::m_spMatrixJOp
protected

Operator.

◆ m_useCachedMatrices

◆ m_useLinearMode

◆ m_vScaleMass

template<class TAlgebra >
std::vector<number> ug::LinearImplicitEuler< TAlgebra >::m_vScaleMass
protected

Scaling for mass part.

◆ m_vScaleStiff

template<class TAlgebra >
std::vector<number> ug::LinearImplicitEuler< TAlgebra >::m_vScaleStiff
protected

Scaling for stiffness part.


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