CEPS
24.01
Cardiac ElectroPhysiology Simulator
|
Base class for solving PDE with time dependance.
Definition at line 38 of file AbstractTimedPdeSolver.hpp.
#include <AbstractTimedPdeSolver.hpp>
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... | |
AbstractPdeSolver & | operator= (const AbstractPdeSolver &that)=delete |
No assignment. More... | |
~AbstractPdeSolver () override | |
Destructor. More... | |
void | disableOutput () |
Stops output. More... | |
void | enableOutput () |
Starts output. More... | |
TimeWriter * | getTimeWriter () 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... | |
CepsObject & | operator= (const CepsObject &)=default |
Assignment operator. More... | |
CepsObject * | toBaseObject () |
Returns a pointer to CepsObject class. More... | |
const CepsObject * | toBaseObject () const |
Returns a pointer to CepsObject class, const version. More... | |
Profiler * | getProfiler () const |
Access to profiler. More... | |
Protected Member Functions | |
AbstractTimedPdeProblem * | getTimedProblem () 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< DHVecPtr > | m_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... | |
TimeStepper * | m_timeStepper |
Monitors time evolution. More... | |
CepsVector< DHVecPtr > | m_regSourcesNm |
Sources at previous steps (if problem has source terms) More... | |
CepsVector< DHVecPtr > | m_lapSourcesNm |
Sources at previous steps (if problem has laplace source terms) More... | |
CepsVector< DHVecPtr > | m_rkF |
RK methods: intermediate rates. More... | |
CepsVector< DHVecPtr > | m_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 | |
AbstractPdeProblem * | m_problem |
Link to PDE to solve. More... | |
AbstractDiscretization * | m_discretization |
Link to PDE discretization. More... | |
LinearSystem * | m_linearSystem |
Linear system. More... | |
DMatPtr | m_lhs |
Left hand side of the system. More... | |
DVecPtr | m_rhs |
Right hand side of the system. More... | |
AbstractAssembler * | m_opAsb |
Assembler for the operator matrix. More... | |
DMatPtr | m_opMat |
Matrix of operator. More... | |
AbstractAssembler * | m_bcAsb |
Assembler for Robin and Neumann BCs. More... | |
DMatPtr | m_bcMat |
Matrix of boundary conditions. More... | |
DVecPtr | m_bcVec |
Vector of boundary conditions. More... | |
AbstractAssembler * | m_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... | |
VtkWriter * | m_writer |
Manages output. More... | |
TimeWriter * | m_timeWriter |
Writer for time dependant data (even for static problems...) More... | |
CepsBool | m_doError |
Compute error wrt analytic solution or reference. More... | |
PdeErrorCalculator * | m_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... | |
|
explicit |
Default constructor.
Definition at line 34 of file AbstractTimedPdeSolver.cpp.
|
virtual |
Destructor.
Definition at line 78 of file AbstractTimedPdeSolver.cpp.
|
protectedvirtual |
Allocates the arrays with the correct number of multistep.
Definition at line 312 of file AbstractTimedPdeSolver.cpp.
|
protected |
Initialize the type from parameter string.
Definition at line 271 of file AbstractTimedPdeSolver.cpp.
|
protectedvirtual |
Tells time.
Definition at line 250 of file AbstractTimedPdeSolver.cpp.
void AbstractTimedPdeSolver::enableErrorComputation | ( | ) |
Sets the comparison with analytic solution.
Definition at line 209 of file AbstractTimedPdeSolver.cpp.
|
protectedvirtual |
Adds contributions from all source terms into m_regSourcesNm[0].
[in] | tn | time at which source terms will be evaluated |
Reimplemented in CardiacSolver.
Definition at line 402 of file AbstractTimedPdeSolver.cpp.
|
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.
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.
|
overridevirtual |
Number of files written.
Implements AbstractPdeSolver.
Definition at line 149 of file AbstractTimedPdeSolver.cpp.
DHVecPtr AbstractTimedPdeSolver::getSolution | ( | ) | const |
Returns a copy of the distributed vector containing the current solution.
Definition at line 203 of file AbstractTimedPdeSolver.cpp.
|
protected |
Returns a pointer with the appropriate type of pb.
Definition at line 244 of file AbstractTimedPdeSolver.cpp.
Prints the solution.
Reimplemented in CardiacSolver.
Definition at line 159 of file AbstractTimedPdeSolver.cpp.
|
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.
|
overridevirtual |
Solves the all PDE (all iterations)
Implements AbstractPdeSolver.
Definition at line 84 of file AbstractTimedPdeSolver.cpp.
|
protectedvirtual |
Swaps vectors of array pointers for next step (for multistep methods)
Definition at line 435 of file AbstractTimedPdeSolver.cpp.
|
overrideprotectedvirtual |
Update assemblers and recompute everything is needed.
Implements AbstractPdeSolver.
Definition at line 341 of file AbstractTimedPdeSolver.cpp.
|
staticconstexprprotected |
RHS coeffcients of the SBDF schemes.
Definition at line 158 of file AbstractTimedPdeSolver.hpp.
|
staticconstexprprotected |
LHS coeffcients of the CN scheme.
Definition at line 156 of file AbstractTimedPdeSolver.hpp.
|
staticconstexprprotected |
LHS coeffcients of the SBDF schemes.
Definition at line 154 of file AbstractTimedPdeSolver.hpp.
|
protected |
If true, use exact solution for first steps of multi steps methods.
Definition at line 161 of file AbstractTimedPdeSolver.hpp.
|
protected |
Matrix of time derivative of the system.
Definition at line 119 of file AbstractTimedPdeSolver.hpp.
|
protected |
Sources at previous steps (if problem has laplace source terms)
Definition at line 143 of file AbstractTimedPdeSolver.hpp.
|
protected |
Output perdiodicity.
Definition at line 163 of file AbstractTimedPdeSolver.hpp.
|
protected |
Maximum number of steps needed to compute next solution (eg CN:2)
Definition at line 136 of file AbstractTimedPdeSolver.hpp.
|
protected |
The opposite version of m_timeDerEqsVec, such as m_timeDerEqsVec + m_noTimeDerEqsVec = vec(1)
Definition at line 124 of file AbstractTimedPdeSolver.hpp.
|
protected |
Sources at previous steps (if problem has source terms)
Definition at line 141 of file AbstractTimedPdeSolver.hpp.
|
protected |
RK methods: intermediate rates.
Definition at line 146 of file AbstractTimedPdeSolver.hpp.
|
protected |
RK Method if the solver is of type "RK".
Definition at line 134 of file AbstractTimedPdeSolver.hpp.
|
protected |
RK methods: intermediate evaluations.
Definition at line 148 of file AbstractTimedPdeSolver.hpp.
|
protected |
A factor for both matrix and vector (typically 1/dt)
Definition at line 151 of file AbstractTimedPdeSolver.hpp.
|
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.
|
protected |
Monitors time evolution.
Definition at line 138 of file AbstractTimedPdeSolver.hpp.
|
protected |
Numerical scheme descriptor.
Definition at line 132 of file AbstractTimedPdeSolver.hpp.
|
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.
|
protected |
Vectors of unknowns at time t^n+1.
Definition at line 127 of file AbstractTimedPdeSolver.hpp.