CEPS  24.01
Cardiac ElectroPhysiology Simulator
AbstractTimedPdeSolver Class Reference

Detailed Description

Base class for solving PDE with time dependance.

Definition at line 38 of file AbstractTimedPdeSolver.hpp.

#include <AbstractTimedPdeSolver.hpp>

Inheritance diagram for AbstractTimedPdeSolver:
[legend]

Public Member Functions

 AbstractTimedPdeSolver (AbstractTimedPdeProblem *pb)
 Default constructor. More...
 
virtual ~AbstractTimedPdeSolver ()
 Destructor. More...
 
void solve () override
 Solves the all PDE (all iterations) More...
 
void setupWithParameters (InputParameters *params) override
 Set attributes from input file. Parameters are passed as arguments in case one wants to use other parameters. More...
 
CepsUInt getExpectedNumberOfOutputs () const override
 Number of files written. More...
 
virtual void output (DHVecPtr solution, CepsBool immediateWriting=true)
 Prints the solution. More...
 
DHVecPtr getSolution () const
 Returns a copy of the distributed vector containing the current solution. More...
 
void enableErrorComputation ()
 Sets the comparison with analytic solution. More...
 
CepsArray2< CepsArray3< CepsArray3< CepsReal > > > getErrors () const
 Gets the currently computed errors. First index selects absolute(0) or relative(1) second index select max on t(0), integral on t(1), or error at end of time interval(2) third index is L-inf, L1, L2 selector. More...
 
- Public Member Functions inherited from AbstractPdeSolver
 AbstractPdeSolver ()=delete
 Deleted default constructor. More...
 
 AbstractPdeSolver (AbstractPdeProblem *pb)
 Constructor with problem. More...
 
 AbstractPdeSolver (const AbstractPdeSolver &that)=delete
 No copy. More...
 
AbstractPdeSolveroperator= (const AbstractPdeSolver &that)=delete
 No assignment. More...
 
 ~AbstractPdeSolver () override
 Destructor. More...
 
void disableOutput ()
 Stops output. More...
 
void enableOutput ()
 Starts output. More...
 
TimeWritergetTimeWriter () const
 Access to Time Writer to be able to add data. More...
 
void disableErrorComputation ()
 Sets the comparison with analytic solution. More...
 
- Public Member Functions inherited from CepsObject
 CepsObject ()=default
 default constructor More...
 
 CepsObject (const CepsObject &)=default
 Copy constructor. More...
 
virtual ~CepsObject ()=default
 Destructor. More...
 
CepsObjectoperator= (const CepsObject &)=default
 Assignment operator. More...
 
CepsObjecttoBaseObject ()
 Returns a pointer to CepsObject class. More...
 
const CepsObjecttoBaseObject () const
 Returns a pointer to CepsObject class, const version. More...
 
ProfilergetProfiler () const
 Access to profiler. More...
 

Protected Member Functions

AbstractTimedPdeProblemgetTimedProblem () const
 Returns a pointer with the appropriate type of pb. More...
 
virtual void displayProgress () const
 Tells time. More...
 
virtual CepsBool finished () const
 Tells if simulation reached end time or, if enabled, all points have seen an AP. More...
 
void determineSolverType (CepsString s)
 Initialize the type from parameter string. More...
 
virtual void allocateArrays ()
 Allocates the arrays with the correct number of multistep. More...
 
void updateAssemblers () override
 Update assemblers and recompute everything is needed. More...
 
virtual void fillSourceTermsVector (CepsReal tn)
 Adds contributions from all source terms into m_regSourcesNm[0]. More...
 
virtual void swapMultiStepPointers ()
 Swaps vectors of array pointers for next step (for multistep methods) More...
 
- Protected Member Functions inherited from AbstractPdeSolver
virtual void assembleAndSolve ()=0
 Main routine used during solving, perform one single step on time problem or solve directly in static ones. This function is defined in child classes. More...
 
virtual void initializeWriter ()
 Creates the solution writer. More...
 
virtual void initializeAssemblers ()=0
 Creates the right type of assemblers for LHS and BCs. Needs to be overriden. More...
 

Protected Attributes

DMatPtr m_dtMat
 Matrix of time derivative of the system. More...
 
DVecPtr m_timeDerEqsVec
 Vector of 1 or 0, depending on whether the dof equation has a time derivative or not. More...
 
DVecPtr m_noTimeDerEqsVec
 The opposite version of m_timeDerEqsVec, such as m_timeDerEqsVec + m_noTimeDerEqsVec = vec(1) More...
 
DHVecPtr m_uNp1
 Vectors of unknowns at time t^n+1. More...
 
CepsVector< DHVecPtrm_uNm
 Solution vectors at different time steps. Several vectors are needed for multi-step methods. (read u^{n-k}). m_uNm[0] is current solution. More...
 
CepsString m_type
 Numerical scheme descriptor. More...
 
CepsString m_rkType
 RK Method if the solver is of type "RK". More...
 
CepsUInt m_nbMultiSteps
 Maximum number of steps needed to compute next solution (eg CN:2) More...
 
TimeStepperm_timeStepper
 Monitors time evolution. More...
 
CepsVector< DHVecPtrm_regSourcesNm
 Sources at previous steps (if problem has source terms) More...
 
CepsVector< DHVecPtrm_lapSourcesNm
 Sources at previous steps (if problem has laplace source terms) More...
 
CepsVector< DHVecPtrm_rkF
 RK methods: intermediate rates. More...
 
CepsVector< DHVecPtrm_rkU
 RK methods: intermediate evaluations. More...
 
CepsReal m_scaleSystem
 A factor for both matrix and vector (typically 1/dt) More...
 
CepsBool m_cheatConvergence
 If true, use exact solution for first steps of multi steps methods. More...
 
CepsUInt m_nbIterSnapshot
 Output perdiodicity. More...
 
- Protected Attributes inherited from AbstractPdeSolver
AbstractPdeProblemm_problem
 Link to PDE to solve. More...
 
AbstractDiscretizationm_discretization
 Link to PDE discretization. More...
 
LinearSystemm_linearSystem
 Linear system. More...
 
DMatPtr m_lhs
 Left hand side of the system. More...
 
DVecPtr m_rhs
 Right hand side of the system. More...
 
AbstractAssemblerm_opAsb
 Assembler for the operator matrix. More...
 
DMatPtr m_opMat
 Matrix of operator. More...
 
AbstractAssemblerm_bcAsb
 Assembler for Robin and Neumann BCs. More...
 
DMatPtr m_bcMat
 Matrix of boundary conditions. More...
 
DVecPtr m_bcVec
 Vector of boundary conditions. More...
 
AbstractAssemblerm_lapSrcAsb
 Assembler for laplace source terms. More...
 
DMatPtr m_lapSrcMat
 Matrix used for laplace source terms. More...
 
CepsBool m_hasRegSrc
 Flag telling if there are regular source terms. More...
 
CepsBool m_hasLapSrc
 Flag telling if there are Delta f source terms. More...
 
CepsBool m_useMassLumping
 Put the mass on the diagonal of the matrix. More...
 
CepsBool m_doOutput
 Enables/disables outputs. More...
 
VtkWriterm_writer
 Manages output. More...
 
TimeWriterm_timeWriter
 Writer for time dependant data (even for static problems...) More...
 
CepsBool m_doError
 Compute error wrt analytic solution or reference. More...
 
PdeErrorCalculatorm_errors
 Error computation. More...
 

Static Protected Attributes

static constexpr CepsReal c_alphaSBDF [5] = {0., 1., 2. / 3., 6. / 11., 12. / 25.}
 LHS coeffcients of the SBDF schemes. More...
 
static constexpr CepsReal c_alphaCN [3] = {0., 1., 1. / 2.}
 LHS coeffcients of the CN scheme. More...
 
static constexpr CepsReal c_akSBDF [4][4] = {{1.}, {4. / 3., -1. / 3.}, {18. / 11., -9. / 11., 2. / 11.}, {48. / 25., -36. / 25., 16. / 25., -3. / 25.}}
 RHS coeffcients of the SBDF schemes. More...
 
- Static Protected Attributes inherited from CepsObject
static Profiler m_profiler
 The same profiler for each big object. More...
 

Constructor & Destructor Documentation

◆ AbstractTimedPdeSolver()

AbstractTimedPdeSolver::AbstractTimedPdeSolver ( AbstractTimedPdeProblem pb)
explicit

Default constructor.

Definition at line 34 of file AbstractTimedPdeSolver.cpp.

◆ ~AbstractTimedPdeSolver()

AbstractTimedPdeSolver::~AbstractTimedPdeSolver ( )
virtual

Destructor.

Definition at line 78 of file AbstractTimedPdeSolver.cpp.

Member Function Documentation

◆ allocateArrays()

void AbstractTimedPdeSolver::allocateArrays ( )
protectedvirtual

Allocates the arrays with the correct number of multistep.

Definition at line 312 of file AbstractTimedPdeSolver.cpp.

◆ determineSolverType()

void AbstractTimedPdeSolver::determineSolverType ( CepsString  s)
protected

Initialize the type from parameter string.

Definition at line 271 of file AbstractTimedPdeSolver.cpp.

◆ displayProgress()

void AbstractTimedPdeSolver::displayProgress ( ) const
protectedvirtual

Tells time.

Definition at line 250 of file AbstractTimedPdeSolver.cpp.

◆ enableErrorComputation()

void AbstractTimedPdeSolver::enableErrorComputation ( )

Sets the comparison with analytic solution.

Definition at line 209 of file AbstractTimedPdeSolver.cpp.

◆ fillSourceTermsVector()

void AbstractTimedPdeSolver::fillSourceTermsVector ( CepsReal  tn)
protectedvirtual

Adds contributions from all source terms into m_regSourcesNm[0].

Parameters
[in]tntime at which source terms will be evaluated

Reimplemented in CardiacSolver.

Definition at line 402 of file AbstractTimedPdeSolver.cpp.

◆ finished()

CepsBool AbstractTimedPdeSolver::finished ( ) const
protectedvirtual

Tells if simulation reached end time or, if enabled, all points have seen an AP.

Reimplemented in CardiacSolver.

Definition at line 265 of file AbstractTimedPdeSolver.cpp.

◆ getErrors()

CepsArray2< CepsArray3< CepsArray3< CepsReal > > > AbstractTimedPdeSolver::getErrors ( ) const

Gets the currently computed errors. First index selects absolute(0) or relative(1) second index select max on t(0), integral on t(1), or error at end of time interval(2) third index is L-inf, L1, L2 selector.

Definition at line 220 of file AbstractTimedPdeSolver.cpp.

◆ getExpectedNumberOfOutputs()

CepsUInt AbstractTimedPdeSolver::getExpectedNumberOfOutputs ( ) const
overridevirtual

Number of files written.

Implements AbstractPdeSolver.

Definition at line 149 of file AbstractTimedPdeSolver.cpp.

◆ getSolution()

DHVecPtr AbstractTimedPdeSolver::getSolution ( ) const

Returns a copy of the distributed vector containing the current solution.

Returns

Definition at line 203 of file AbstractTimedPdeSolver.cpp.

◆ getTimedProblem()

AbstractTimedPdeProblem * AbstractTimedPdeSolver::getTimedProblem ( ) const
protected

Returns a pointer with the appropriate type of pb.

Definition at line 244 of file AbstractTimedPdeSolver.cpp.

◆ output()

void AbstractTimedPdeSolver::output ( DHVecPtr  solution,
CepsBool  immediateWriting = true 
)
virtual

Prints the solution.

Reimplemented in CardiacSolver.

Definition at line 159 of file AbstractTimedPdeSolver.cpp.

◆ setupWithParameters()

void AbstractTimedPdeSolver::setupWithParameters ( InputParameters params)
overridevirtual

Set attributes from input file. Parameters are passed as arguments in case one wants to use other parameters.

Reimplemented from AbstractPdeSolver.

Definition at line 143 of file AbstractTimedPdeSolver.cpp.

◆ solve()

void AbstractTimedPdeSolver::solve ( )
overridevirtual

Solves the all PDE (all iterations)

Implements AbstractPdeSolver.

Definition at line 84 of file AbstractTimedPdeSolver.cpp.

◆ swapMultiStepPointers()

void AbstractTimedPdeSolver::swapMultiStepPointers ( )
protectedvirtual

Swaps vectors of array pointers for next step (for multistep methods)

Definition at line 435 of file AbstractTimedPdeSolver.cpp.

◆ updateAssemblers()

void AbstractTimedPdeSolver::updateAssemblers ( )
overrideprotectedvirtual

Update assemblers and recompute everything is needed.

Implements AbstractPdeSolver.

Definition at line 341 of file AbstractTimedPdeSolver.cpp.

Field Documentation

◆ c_akSBDF

constexpr CepsReal AbstractTimedPdeSolver::c_akSBDF[4][4] = {{1.}, {4. / 3., -1. / 3.}, {18. / 11., -9. / 11., 2. / 11.}, {48. / 25., -36. / 25., 16. / 25., -3. / 25.}}
staticconstexprprotected

RHS coeffcients of the SBDF schemes.

Definition at line 158 of file AbstractTimedPdeSolver.hpp.

◆ c_alphaCN

constexpr CepsReal AbstractTimedPdeSolver::c_alphaCN[3] = {0., 1., 1. / 2.}
staticconstexprprotected

LHS coeffcients of the CN scheme.

Definition at line 156 of file AbstractTimedPdeSolver.hpp.

◆ c_alphaSBDF

constexpr CepsReal AbstractTimedPdeSolver::c_alphaSBDF[5] = {0., 1., 2. / 3., 6. / 11., 12. / 25.}
staticconstexprprotected

LHS coeffcients of the SBDF schemes.

Definition at line 154 of file AbstractTimedPdeSolver.hpp.

◆ m_cheatConvergence

CepsBool AbstractTimedPdeSolver::m_cheatConvergence
protected

If true, use exact solution for first steps of multi steps methods.

Definition at line 161 of file AbstractTimedPdeSolver.hpp.

◆ m_dtMat

DMatPtr AbstractTimedPdeSolver::m_dtMat
protected

Matrix of time derivative of the system.

Definition at line 119 of file AbstractTimedPdeSolver.hpp.

◆ m_lapSourcesNm

CepsVector<DHVecPtr> AbstractTimedPdeSolver::m_lapSourcesNm
protected

Sources at previous steps (if problem has laplace source terms)

Definition at line 143 of file AbstractTimedPdeSolver.hpp.

◆ m_nbIterSnapshot

CepsUInt AbstractTimedPdeSolver::m_nbIterSnapshot
protected

Output perdiodicity.

Definition at line 163 of file AbstractTimedPdeSolver.hpp.

◆ m_nbMultiSteps

CepsUInt AbstractTimedPdeSolver::m_nbMultiSteps
protected

Maximum number of steps needed to compute next solution (eg CN:2)

Definition at line 136 of file AbstractTimedPdeSolver.hpp.

◆ m_noTimeDerEqsVec

DVecPtr AbstractTimedPdeSolver::m_noTimeDerEqsVec
protected

The opposite version of m_timeDerEqsVec, such as m_timeDerEqsVec + m_noTimeDerEqsVec = vec(1)

Definition at line 124 of file AbstractTimedPdeSolver.hpp.

◆ m_regSourcesNm

CepsVector<DHVecPtr> AbstractTimedPdeSolver::m_regSourcesNm
protected

Sources at previous steps (if problem has source terms)

Definition at line 141 of file AbstractTimedPdeSolver.hpp.

◆ m_rkF

CepsVector<DHVecPtr> AbstractTimedPdeSolver::m_rkF
protected

RK methods: intermediate rates.

Definition at line 146 of file AbstractTimedPdeSolver.hpp.

◆ m_rkType

CepsString AbstractTimedPdeSolver::m_rkType
protected

RK Method if the solver is of type "RK".

Definition at line 134 of file AbstractTimedPdeSolver.hpp.

◆ m_rkU

CepsVector<DHVecPtr> AbstractTimedPdeSolver::m_rkU
protected

RK methods: intermediate evaluations.

Definition at line 148 of file AbstractTimedPdeSolver.hpp.

◆ m_scaleSystem

CepsReal AbstractTimedPdeSolver::m_scaleSystem
protected

A factor for both matrix and vector (typically 1/dt)

Definition at line 151 of file AbstractTimedPdeSolver.hpp.

◆ m_timeDerEqsVec

DVecPtr AbstractTimedPdeSolver::m_timeDerEqsVec
protected

Vector of 1 or 0, depending on whether the dof equation has a time derivative or not.

Definition at line 122 of file AbstractTimedPdeSolver.hpp.

◆ m_timeStepper

TimeStepper* AbstractTimedPdeSolver::m_timeStepper
protected

Monitors time evolution.

Definition at line 138 of file AbstractTimedPdeSolver.hpp.

◆ m_type

CepsString AbstractTimedPdeSolver::m_type
protected

Numerical scheme descriptor.

Definition at line 132 of file AbstractTimedPdeSolver.hpp.

◆ m_uNm

CepsVector<DHVecPtr> AbstractTimedPdeSolver::m_uNm
protected

Solution vectors at different time steps. Several vectors are needed for multi-step methods. (read u^{n-k}). m_uNm[0] is current solution.

Definition at line 130 of file AbstractTimedPdeSolver.hpp.

◆ m_uNp1

DHVecPtr AbstractTimedPdeSolver::m_uNp1
protected

Vectors of unknowns at time t^n+1.

Definition at line 127 of file AbstractTimedPdeSolver.hpp.


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