CEPS
24.01
Cardiac ElectroPhysiology Simulator
|
Base class for creating PDEs to solve.
Definition at line 42 of file AbstractPdeProblem.hpp.
#include <AbstractPdeProblem.hpp>
Public Types | |
using | ScalarFunction = ceps::Function< CepsReal(CepsStandardArgs)> |
Typedef for analytic solution. More... | |
Public Member Functions | |
AbstractPdeProblem (Geometry *geom, InputParameters *params=nullptr) | |
Constructor with geometry and optional parameters. More... | |
virtual | ~AbstractPdeProblem () |
destructor More... | |
AbstractPdeProblem (const AbstractPdeProblem &that)=delete | |
No copy constructor. More... | |
AbstractPdeProblem & | operator= (const AbstractPdeProblem &that)=delete |
No assignment operator. More... | |
InputParameters * | getParameters () const |
Text parameters. More... | |
virtual void | setupWithParameters (InputParameters *params) |
Set attributes from input file. Parameters are passed as arguments in case one wants to use other parameters. More... | |
virtual void | run () |
Computes the solution to the problem. Default does nothing, override it ! More... | |
void | setProblemName (const CepsString &name) |
Set the name of the problem. More... | |
CepsString | getProblemName () const |
Get the name of the problem. More... | |
Geometry * | getGeometry () const |
Link to geometry on which the pb is defined. More... | |
AbstractDiscretization * | getSpatialDiscretization () const |
Link to the spatial discretization (FE, FV, etc) More... | |
void | setSpatialDiscretization (AbstractDiscretization *discr) |
Link to the spatial discretization (FE, FV, etc) More... | |
void | createSpatialDiscretization () |
Compute the discretization structure. More... | |
virtual void | defineUnknowns ()=0 |
Define all the unknowns of the problem here. Must be overriden, and call all necessary addUnknown, addZeroDUnknown, addUnknownInteraction. More... | |
const CepsVector< Unknown * > & | getUnknowns () const |
List of unknowns of the pb. More... | |
Unknown * | getUnknown (const CepsString &label) const |
Get an unknown by its name. More... | |
Unknown * | getUnknown (CepsUnknownIndex uid) const |
Get an unknown by its id. More... | |
CepsVector< Unknown * > | getSpatialUnknowns () const |
A vector of all unknowns of pb defined on cells or points. More... | |
CepsVector< Unknown * > | getZeroDUnknowns () const |
A vector of all zeroD unknowns of the pb. More... | |
const CepsVector< UnknownInteraction * > & | getUnknownsInteractions () const |
All the interactions between unknowns. More... | |
CepsBool | unknownsInteract (Unknown *u1, Unknown *u2, const CepsSet< CepsAttribute > &attrs={CepsUniversal}) const |
Tells if unknowns interact on an entity with attributes. More... | |
CepsBool | ignoreZeroDUnknownsForError () const |
Tells if 0D must not be taken into account in error computation. More... | |
CepsBool | hasAnalyticSolution () const |
Tells if there is an analytic or reference solution. More... | |
ScalarFunction * | getAnalyticSolution () const |
Pointer on analytic or refScalarFunction solution. More... | |
virtual void | defineAnalyticSolution () |
Set directly the analytic function, default sets no solution, unless there is a collection of reference solution files, provided at init or from parameters. More... | |
void | setReferenceSolution (const CepsString &baseFiles, CepsReal snapDt) |
Externally define the referece solution from files. Can be used for convergence tests. More... | |
CepsBool | usesReferenceSolution () const |
Tells if analytic solution and if it is loaded from files. More... | |
CepsReal | getReferenceSolutionOutputPeriod () const |
Output dt of reference. More... | |
FunctionDictionary * | getFunctionDictionary () const |
Get functions manager. More... | |
void | setFunctionDictionary (FunctionDictionary *) |
Set functions manager. More... | |
virtual void | defineBoundaryConditions () |
Define the boundary conditions. Should be defined in derived classes. Default is no BC. More... | |
BoundaryConditionManager * | getBoundaryConditionManager () const |
Get boundary condition manager. More... | |
void | setBoundaryConditionManager (BoundaryConditionManager *bcm) |
Set boundary condition manager. More... | |
virtual void | defineSourceTerms () |
Define the source terms. Should be defined in derived classes. Default is no src term. More... | |
SourceTermManager * | getSourceTermManager () const |
Get boundary condition manager. More... | |
void | setSourceTermManager (SourceTermManager *stm) |
Set boundary condition manager. More... | |
virtual void | initializeEquation () |
Initializes equations (unknowns, bc, source term) and creates the spatial discretization This method should be called at the start of run() methods. More... | |
CepsString | getOutputFileBase () const |
Output file name includes the directory. More... | |
void | setOutputFileBase (CepsString fileName) |
Output file name includes the directory. More... | |
CepsOutputFormat | getOutputFormat () const |
Tells if output is binary or ascii. More... | |
void | setOutputFormat (CepsOutputFormat opt) |
Enable/disable binary output. More... | |
CepsBool | writesGlobalIndices () const |
Tells if global indices are written on top of solution. More... | |
void | writeGlobalIndices (CepsBool opt) |
Activate/deactivate global indices writing. More... | |
CepsVector< CepsReal3D > | getProbePoints () const |
Returns points where single data output should be written. More... | |
virtual CepsReal | getStartTime () const |
Returns 0. Here for compatibility. More... | |
virtual CepsReal | getEndTime () const |
Returns 0. Here for compatibility. More... | |
virtual CepsReal | getSnapshotTime () const |
Returns 0. Here for compatibility. 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 | |
void | addUnknown (const CepsString &label, CepsSet< CepsAttribute > attrs={}, CepsLocationFlag flag=CepsLocationFlag::Point, const CepsString &unit="") |
Register a new unknown. More... | |
void | addZeroDUnknown (CepsString label, const CepsString &unit="") |
Register a new unknown, defined outside of geometry. More... | |
void | addUnknownInteraction (CepsString label1, CepsString label2, CepsSet< CepsAttribute > attrs={}) |
Register interaction between unknowns. Also sets the interaction within Unknown instances label1 and label2. More... | |
Protected Attributes | |
CepsString | m_name |
Name of the problem. More... | |
Geometry * | m_geom |
Link to geometry on which the pb is defined. More... | |
InputParameters * | m_parameters |
Input file data. More... | |
AbstractDiscretization * | m_discr |
Discretization method (eg FE for now) More... | |
CepsBool | m_ownedDiscr |
True if instance used new to create discretization. More... | |
CepsVector< Unknown * > | m_unknowns |
All maths unknowns of the problem. More... | |
CepsVector< UnknownInteraction * > | m_unknownsInteractions |
Describes how unknowns interact. More... | |
ScalarFunction * | m_analyticSolution |
analytic or reference solution More... | |
CepsBool | m_ownedRefSol |
Flag for reference ownership. More... | |
CepsString | m_refSolFiles |
base name of reference solution file, if any More... | |
CepsReal | m_refSolSnapDt |
reference solution output period More... | |
FunctionDictionary * | m_functions |
Collection of custom functions. More... | |
BoundaryConditionManager * | m_boundaryConditions |
All BCs should be there. More... | |
SourceTermManager * | m_sourceTerms |
All source terms. More... | |
CepsBool | m_ownedFunctions |
True if instance used new to create dictionary. More... | |
CepsBool | m_ownedBCs |
True if instance used new to create BC manager. More... | |
CepsBool | m_ownedSrcs |
True if instance used new to create src term manager. More... | |
CepsString | m_outputFileBase |
File names prefix. More... | |
CepsOutputFormat | m_outputFormat |
Output format selector. More... | |
CepsBool | m_writeGlobalIDs |
Writes CEPS indices as well. More... | |
CepsVector< CepsReal3D > | m_probePoints |
Single point data outputs. More... | |
CepsBool | m_ignoreZeroDError |
Ignore 0D unknowns when computing errors. More... | |
Additional Inherited Members | |
Static Protected Attributes inherited from CepsObject | |
static Profiler | m_profiler |
The same profiler for each big object. More... | |
Typedef for analytic solution.
Definition at line 48 of file AbstractPdeProblem.hpp.
|
explicit |
Constructor with geometry and optional parameters.
geom | Geometry, required, otherwise it's not a pde |
params | Simulation parameters (nullptr = defaults) |
Definition at line 35 of file AbstractPdeProblem.cpp.
|
virtual |
destructor
Definition at line 66 of file AbstractPdeProblem.cpp.
|
delete |
No copy constructor.
|
protected |
Register a new unknown.
label | Name of the unknown (used in outputs, for instance) |
attrs | Attributes of regions on which the unknown is defined. Empty means everywhere |
flag | Location of unknown (points or cells), will be overwritten by spatial discretization |
unit | Optional unit |
Definition at line 458 of file AbstractPdeProblem.cpp.
|
protected |
Register interaction between unknowns. Also sets the interaction within Unknown instances label1 and label2.
label1 | name of first unknown |
label2 | name of sectond unknown |
attrs | attributes of regions on which interaction occurs. Empty means everywhere |
Definition at line 482 of file AbstractPdeProblem.cpp.
|
protected |
Register a new unknown, defined outside of geometry.
label | Name of the unknown (used in outputs, for instance) |
unit | Optional unit |
Definition at line 472 of file AbstractPdeProblem.cpp.
void AbstractPdeProblem::createSpatialDiscretization | ( | ) |
Compute the discretization structure.
Definition at line 170 of file AbstractPdeProblem.cpp.
|
virtual |
Set directly the analytic function, default sets no solution, unless there is a collection of reference solution files, provided at init or from parameters.
Reimplemented in FluxAnodeCathodeProblem, and DirichletAnodeCathodeProblem.
Definition at line 294 of file AbstractPdeProblem.cpp.
|
virtual |
Define the boundary conditions. Should be defined in derived classes. Default is no BC.
Reimplemented in FluxAnodeCathodeProblem, DirichletAnodeCathodeProblem, ExtendedBidomainProblem, CLMonodomainProblem, CardiacProblem, PacemakerPoissonProblem, and PacemakerBidomainProblem.
Definition at line 340 of file AbstractPdeProblem.cpp.
|
virtual |
Define the source terms. Should be defined in derived classes. Default is no src term.
Reimplemented in HeatProblem, FluxAnodeCathodeProblem, DirichletAnodeCathodeProblem, CardiacProblem, PacemakerPoissonProblem, and PacemakerBidomainProblem.
Definition at line 360 of file AbstractPdeProblem.cpp.
|
pure virtual |
Define all the unknowns of the problem here. Must be overriden, and call all necessary addUnknown, addZeroDUnknown, addUnknownInteraction.
Implemented in HeatProblem, LaplacianProblem, FluxAnodeCathodeProblem, DirichletAnodeCathodeProblem, MonodomainProblem, ExtendedBidomainProblem, CLMonodomainProblem, BilayerMonodomainProblem, BidomainProblem, PacemakerPoissonProblem, and PacemakerBidomainProblem.
AbstractPdeProblem::ScalarFunction * AbstractPdeProblem::getAnalyticSolution | ( | ) | const |
Pointer on analytic or refScalarFunction solution.
Definition at line 288 of file AbstractPdeProblem.cpp.
BoundaryConditionManager * AbstractPdeProblem::getBoundaryConditionManager | ( | ) | const |
Get boundary condition manager.
Definition at line 345 of file AbstractPdeProblem.cpp.
|
virtual |
Returns 0. Here for compatibility.
Reimplemented in AbstractTimedPdeProblem.
Definition at line 442 of file AbstractPdeProblem.cpp.
FunctionDictionary * AbstractPdeProblem::getFunctionDictionary | ( | ) | const |
Get functions manager.
Definition at line 325 of file AbstractPdeProblem.cpp.
Geometry * AbstractPdeProblem::getGeometry | ( | ) | const |
Link to geometry on which the pb is defined.
Definition at line 149 of file AbstractPdeProblem.cpp.
CepsString AbstractPdeProblem::getOutputFileBase | ( | ) | const |
Output file name includes the directory.
Definition at line 394 of file AbstractPdeProblem.cpp.
CepsOutputFormat AbstractPdeProblem::getOutputFormat | ( | ) | const |
Tells if output is binary or ascii.
Definition at line 406 of file AbstractPdeProblem.cpp.
InputParameters * AbstractPdeProblem::getParameters | ( | ) | const |
Text parameters.
Definition at line 85 of file AbstractPdeProblem.cpp.
CepsVector< CepsReal3D > AbstractPdeProblem::getProbePoints | ( | ) | const |
Returns points where single data output should be written.
Definition at line 430 of file AbstractPdeProblem.cpp.
CepsString AbstractPdeProblem::getProblemName | ( | ) | const |
Get the name of the problem.
Definition at line 143 of file AbstractPdeProblem.cpp.
CepsReal AbstractPdeProblem::getReferenceSolutionOutputPeriod | ( | ) | const |
Output dt of reference.
Definition at line 319 of file AbstractPdeProblem.cpp.
|
virtual |
Returns 0. Here for compatibility.
Reimplemented in AbstractTimedPdeProblem.
Definition at line 449 of file AbstractPdeProblem.cpp.
SourceTermManager * AbstractPdeProblem::getSourceTermManager | ( | ) | const |
Get boundary condition manager.
Definition at line 365 of file AbstractPdeProblem.cpp.
AbstractDiscretization * AbstractPdeProblem::getSpatialDiscretization | ( | ) | const |
Link to the spatial discretization (FE, FV, etc)
Definition at line 155 of file AbstractPdeProblem.cpp.
CepsVector< Unknown * > AbstractPdeProblem::getSpatialUnknowns | ( | ) | const |
A vector of all unknowns of pb defined on cells or points.
Definition at line 231 of file AbstractPdeProblem.cpp.
|
virtual |
Returns 0. Here for compatibility.
Reimplemented in AbstractTimedPdeProblem.
Definition at line 436 of file AbstractPdeProblem.cpp.
Unknown * AbstractPdeProblem::getUnknown | ( | CepsUnknownIndex | uid | ) | const |
Get an unknown by its id.
Definition at line 215 of file AbstractPdeProblem.cpp.
Unknown * AbstractPdeProblem::getUnknown | ( | const CepsString & | label | ) | const |
Get an unknown by its name.
Definition at line 205 of file AbstractPdeProblem.cpp.
const CepsVector< Unknown * > & AbstractPdeProblem::getUnknowns | ( | ) | const |
List of unknowns of the pb.
Definition at line 199 of file AbstractPdeProblem.cpp.
const CepsVector< UnknownInteraction * > & AbstractPdeProblem::getUnknownsInteractions | ( | ) | const |
All the interactions between unknowns.
Definition at line 225 of file AbstractPdeProblem.cpp.
CepsVector< Unknown * > AbstractPdeProblem::getZeroDUnknowns | ( | ) | const |
A vector of all zeroD unknowns of the pb.
Definition at line 241 of file AbstractPdeProblem.cpp.
CepsBool AbstractPdeProblem::hasAnalyticSolution | ( | ) | const |
Tells if there is an analytic or reference solution.
Definition at line 282 of file AbstractPdeProblem.cpp.
CepsBool AbstractPdeProblem::ignoreZeroDUnknownsForError | ( | ) | const |
Tells if 0D must not be taken into account in error computation.
Definition at line 273 of file AbstractPdeProblem.cpp.
|
virtual |
Initializes equations (unknowns, bc, source term) and creates the spatial discretization This method should be called at the start of run() methods.
Reimplemented in AbstractTimedPdeProblem, AbstractStaticPdeProblem, and CardiacProblem.
Definition at line 380 of file AbstractPdeProblem.cpp.
|
delete |
No assignment operator.
|
virtual |
Computes the solution to the problem. Default does nothing, override it !
Reimplemented in HeatProblem, LaplacianProblem, FluxAnodeCathodeProblem, DirichletAnodeCathodeProblem, MonodomainProblem, ExtendedBidomainProblem, CLMonodomainProblem, BilayerMonodomainProblem, BidomainProblem, PacemakerPoissonProblem, and PacemakerBidomainProblem.
Definition at line 132 of file AbstractPdeProblem.cpp.
void AbstractPdeProblem::setBoundaryConditionManager | ( | BoundaryConditionManager * | bcm | ) |
Set boundary condition manager.
Definition at line 351 of file AbstractPdeProblem.cpp.
void AbstractPdeProblem::setFunctionDictionary | ( | FunctionDictionary * | dico | ) |
Set functions manager.
Definition at line 331 of file AbstractPdeProblem.cpp.
void AbstractPdeProblem::setOutputFileBase | ( | CepsString | fileName | ) |
Output file name includes the directory.
Definition at line 400 of file AbstractPdeProblem.cpp.
void AbstractPdeProblem::setOutputFormat | ( | CepsOutputFormat | opt | ) |
Enable/disable binary output.
Definition at line 412 of file AbstractPdeProblem.cpp.
void AbstractPdeProblem::setProblemName | ( | const CepsString & | name | ) |
Set the name of the problem.
Definition at line 137 of file AbstractPdeProblem.cpp.
void AbstractPdeProblem::setReferenceSolution | ( | const CepsString & | baseFiles, |
CepsReal | snapDt | ||
) |
Externally define the referece solution from files. Can be used for convergence tests.
Definition at line 305 of file AbstractPdeProblem.cpp.
void AbstractPdeProblem::setSourceTermManager | ( | SourceTermManager * | stm | ) |
Set boundary condition manager.
Definition at line 371 of file AbstractPdeProblem.cpp.
void AbstractPdeProblem::setSpatialDiscretization | ( | AbstractDiscretization * | discr | ) |
Link to the spatial discretization (FE, FV, etc)
Definition at line 161 of file AbstractPdeProblem.cpp.
|
virtual |
Set attributes from input file. Parameters are passed as arguments in case one wants to use other parameters.
Reimplemented in HeatProblem, AbstractTimedPdeProblem, ExtendedBidomainProblem, CardiacProblem, PacemakerPoissonProblem, PacemakerBidomainProblem, LaplacianProblem, FluxAnodeCathodeProblem, DirichletAnodeCathodeProblem, and BilayerMonodomainProblem.
Definition at line 91 of file AbstractPdeProblem.cpp.
CepsBool AbstractPdeProblem::unknownsInteract | ( | Unknown * | u1, |
Unknown * | u2, | ||
const CepsSet< CepsAttribute > & | attrs = {CepsUniversal} |
||
) | const |
Tells if unknowns interact on an entity with attributes.
Definition at line 253 of file AbstractPdeProblem.cpp.
CepsBool AbstractPdeProblem::usesReferenceSolution | ( | ) | const |
Tells if analytic solution and if it is loaded from files.
Definition at line 313 of file AbstractPdeProblem.cpp.
void AbstractPdeProblem::writeGlobalIndices | ( | CepsBool | opt | ) |
Activate/deactivate global indices writing.
Definition at line 424 of file AbstractPdeProblem.cpp.
CepsBool AbstractPdeProblem::writesGlobalIndices | ( | ) | const |
Tells if global indices are written on top of solution.
Definition at line 418 of file AbstractPdeProblem.cpp.
|
protected |
analytic or reference solution
Definition at line 301 of file AbstractPdeProblem.hpp.
|
protected |
All BCs should be there.
Definition at line 306 of file AbstractPdeProblem.hpp.
|
protected |
Discretization method (eg FE for now)
Definition at line 295 of file AbstractPdeProblem.hpp.
|
protected |
Collection of custom functions.
Definition at line 305 of file AbstractPdeProblem.hpp.
|
protected |
Link to geometry on which the pb is defined.
Definition at line 293 of file AbstractPdeProblem.hpp.
|
protected |
Ignore 0D unknowns when computing errors.
Definition at line 317 of file AbstractPdeProblem.hpp.
|
protected |
Name of the problem.
Definition at line 291 of file AbstractPdeProblem.hpp.
|
protected |
File names prefix.
Definition at line 313 of file AbstractPdeProblem.hpp.
|
protected |
Output format selector.
Definition at line 314 of file AbstractPdeProblem.hpp.
|
protected |
True if instance used new to create BC manager.
Definition at line 310 of file AbstractPdeProblem.hpp.
|
protected |
True if instance used new to create discretization.
Definition at line 296 of file AbstractPdeProblem.hpp.
|
protected |
True if instance used new to create dictionary.
Definition at line 309 of file AbstractPdeProblem.hpp.
|
protected |
Flag for reference ownership.
Definition at line 302 of file AbstractPdeProblem.hpp.
|
protected |
True if instance used new to create src term manager.
Definition at line 311 of file AbstractPdeProblem.hpp.
|
protected |
Input file data.
Definition at line 294 of file AbstractPdeProblem.hpp.
|
protected |
Single point data outputs.
Definition at line 316 of file AbstractPdeProblem.hpp.
|
protected |
base name of reference solution file, if any
Definition at line 303 of file AbstractPdeProblem.hpp.
|
protected |
reference solution output period
Definition at line 304 of file AbstractPdeProblem.hpp.
|
protected |
All source terms.
Definition at line 307 of file AbstractPdeProblem.hpp.
|
protected |
All maths unknowns of the problem.
Definition at line 298 of file AbstractPdeProblem.hpp.
|
protected |
Describes how unknowns interact.
Definition at line 299 of file AbstractPdeProblem.hpp.
|
protected |
Writes CEPS indices as well.
Definition at line 315 of file AbstractPdeProblem.hpp.