CEPS  24.01
Cardiac ElectroPhysiology Simulator
CardiacSolver Class Reference

Detailed Description

Solves cardiac problems, that all share the same structure.

The class regroups the solving algorithms for various numerical schemes (SBDF, Runge-Kutta, Crank-Nicolson). Whatever the dimension of the unknown U (one or two scalars), the problems can be written in the weak form

[M + alpha K] U = 1/Cm (Iion+Iapp) + 1/(AmCm) src

where M and K are respectively the mass and stiffness matrix

The ionic models return directly 1/Cm (Iion+Iapp), as long as the stimulations were correctly set with the Stimulation flag (TYPE IAPP input parameter), and linked to the ionic models

Definition at line 53 of file CardiacSolver.hpp.

#include <CardiacSolver.hpp>

Inheritance diagram for CardiacSolver:
[legend]

Public Member Functions

virtual ~CardiacSolver ()
 Destructor. More...
 
 CardiacSolver (CardiacProblem *problem)
 Constructor with associated PDE problem. More...
 
void solve () override
 Performs all iterations of the PDE solver. More...
 
CepsString getResultsLocationMessage () const
 To be displayed at the end of computation. More...
 
CardiacProblemgetCardiacProblem () const
 Converts own pointer to abstract pde problem to cardiac problem. More...
 
ActivationTrackergetActivationTracker () const
 Link to activation tracker. More...
 
- Public Member Functions inherited from HeatSolver
 HeatSolver ()=delete
 Deleted constructor. More...
 
 HeatSolver (HeatProblem *problem)
 Constructor (valid with HeatProblem and PseudoWaveFrontProblem) More...
 
 ~HeatSolver () override
 Destructor. More...
 
- Public Member Functions inherited from FETimedSolver
 FETimedSolver ()=delete
 Deleted constructor. More...
 
 FETimedSolver (AbstractTimedPdeProblem *problem)
 Constructor (valid with HeatProblem and PseudoWaveFrontProblem) More...
 
 ~FETimedSolver () override
 Destructor. More...
 
- Public Member Functions inherited from AbstractTimedPdeSolver
 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...
 
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

void assembleAndSolve () override
 Performs one iteration of the solver. More...
 
CepsBool finished () const override
 Tells if simulation reached end time or, if enabled, all points have seen an AP. More...
 
void fillSourceTermsVector (CepsReal tn) override
 Computes all contributions to source terms (ionic current, stimcurrent, field sources) with a loop on source terms. More...
 
void output (DHVecPtr dummy, CepsBool immediatWriting=true) override
 Calls the appropriate post-processing and writing methods. More...
 
- Protected Member Functions inherited from HeatSolver
void initializeAssemblers () override
 Creates the right type of assemblers for LHS and BCs. Needs to be overriden. More...
 
HeatProblemgetHeatProblem () const
 Returns a pointer to the pb with appropriate type. More...
 
- Protected Member Functions inherited from FETimedSolver
void assembleAndSolve () override
 Main routine used during solving, assemble the system depending on the scheme and solve the linear system. More...
 
void assembleAndSolveSBDF (CepsUInt nSteps)
 Updates matrix and RHS for the SBDF numerical scheme. More...
 
void assembleAndSolveCN (CepsUInt nSteps)
 Updates matrix and RHS for the CN numerical scheme. More...
 
- Protected Member Functions inherited from AbstractTimedPdeSolver
AbstractTimedPdeProblemgetTimedProblem () const
 Returns a pointer with the appropriate type of pb. More...
 
virtual void displayProgress () const
 Tells time. 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 swapMultiStepPointers ()
 Swaps vectors of array pointers for next step (for multistep methods) More...
 
- Protected Member Functions inherited from AbstractPdeSolver
virtual void initializeWriter ()
 Creates the solution writer. More...
 

Protected Attributes

ActivationTrackerm_activationTracker
 Output computation and writing. More...
 
CepsVector< IonicSolver * > m_ionSolvers
 One solver per ionic model in the problem. More...
 
CepsString m_ionSolvOpts
 Options for ionic ODE solvers. More...
 
CepsBool m_writeIIon
 Flag for additional output. More...
 
CepsBool m_writeIapp
 Flag for additional output. More...
 
CepsReal m_postProcessPeriod
 Period of post process calculations. More...
 
std::set< CepsUIntm_saveDepolarizationTime
 Components of which to save depolarization times. More...
 
CepsBool m_stopAtCompleteActivation
 stop when all points have activation time computed More...
 
CepsBool m_stopAtCompleteRepolarization
 stop when all points have APD computed More...
 
- Protected Attributes inherited from FETimedSolver
FiniteElementsm_fe
 Geometry and reference FE. More...
 
DHVecPtr m_temp1
 Temporary vector for assembly of source terms. More...
 
DHVecPtr m_temp2
 Temporary vector for assembly of source terms. More...
 
- Protected Attributes inherited from AbstractTimedPdeSolver
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...
 

Additional Inherited Members

- Static Protected Attributes inherited from AbstractTimedPdeSolver
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

◆ ~CardiacSolver()

CardiacSolver::~CardiacSolver ( )
virtual

Destructor.

Definition at line 71 of file CardiacSolver.cpp.

◆ CardiacSolver()

CardiacSolver::CardiacSolver ( CardiacProblem problem)

Constructor with associated PDE problem.

Definition at line 32 of file CardiacSolver.cpp.

Member Function Documentation

◆ assembleAndSolve()

void CardiacSolver::assembleAndSolve ( )
overrideprotectedvirtual

Performs one iteration of the solver.

Implements AbstractPdeSolver.

Definition at line 109 of file CardiacSolver.cpp.

◆ fillSourceTermsVector()

void CardiacSolver::fillSourceTermsVector ( CepsReal  tn)
overrideprotectedvirtual

Computes all contributions to source terms (ionic current, stimcurrent, field sources) with a loop on source terms.

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

Reimplemented from AbstractTimedPdeSolver.

Definition at line 127 of file CardiacSolver.cpp.

◆ finished()

CepsBool CardiacSolver::finished ( ) const
overrideprotectedvirtual

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

Reimplemented from AbstractTimedPdeSolver.

Definition at line 94 of file CardiacSolver.cpp.

◆ getActivationTracker()

ActivationTracker * CardiacSolver::getActivationTracker ( ) const

Link to activation tracker.

Definition at line 87 of file CardiacSolver.cpp.

◆ getCardiacProblem()

CardiacProblem * CardiacSolver::getCardiacProblem ( ) const

Converts own pointer to abstract pde problem to cardiac problem.

Definition at line 103 of file CardiacSolver.cpp.

◆ getResultsLocationMessage()

CepsString CardiacSolver::getResultsLocationMessage ( ) const

To be displayed at the end of computation.

◆ output()

void CardiacSolver::output ( DHVecPtr  dummy,
CepsBool  immediatWriting = true 
)
overrideprotectedvirtual

Calls the appropriate post-processing and writing methods.

Reimplemented from AbstractTimedPdeSolver.

Definition at line 161 of file CardiacSolver.cpp.

◆ solve()

void CardiacSolver::solve ( )
overridevirtual

Performs all iterations of the PDE solver.

Implements AbstractPdeSolver.

Definition at line 79 of file CardiacSolver.cpp.

Field Documentation

◆ m_activationTracker

ActivationTracker* CardiacSolver::m_activationTracker
protected

Output computation and writing.

Definition at line 120 of file CardiacSolver.hpp.

◆ m_ionSolvers

CepsVector<IonicSolver*> CardiacSolver::m_ionSolvers
protected

One solver per ionic model in the problem.

Definition at line 123 of file CardiacSolver.hpp.

◆ m_ionSolvOpts

CepsString CardiacSolver::m_ionSolvOpts
protected

Options for ionic ODE solvers.

Definition at line 124 of file CardiacSolver.hpp.

◆ m_postProcessPeriod

CepsReal CardiacSolver::m_postProcessPeriod
protected

Period of post process calculations.

Definition at line 129 of file CardiacSolver.hpp.

◆ m_saveDepolarizationTime

std::set<CepsUInt> CardiacSolver::m_saveDepolarizationTime
protected

Components of which to save depolarization times.

Definition at line 130 of file CardiacSolver.hpp.

◆ m_stopAtCompleteActivation

CepsBool CardiacSolver::m_stopAtCompleteActivation
protected

stop when all points have activation time computed

Definition at line 133 of file CardiacSolver.hpp.

◆ m_stopAtCompleteRepolarization

CepsBool CardiacSolver::m_stopAtCompleteRepolarization
protected

stop when all points have APD computed

Definition at line 134 of file CardiacSolver.hpp.

◆ m_writeIapp

CepsBool CardiacSolver::m_writeIapp
protected

Flag for additional output.

Definition at line 128 of file CardiacSolver.hpp.

◆ m_writeIIon

CepsBool CardiacSolver::m_writeIIon
protected

Flag for additional output.

Definition at line 127 of file CardiacSolver.hpp.


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