40 m_AmOptions (
"CONSTANT 1000"),
43 m_sigmaIOptions (
"CONSTANT 0.4 0.2 0.2"),
44 m_sigmaEOptions (
"CONSTANT 0.4 0.2 0.2"),
45 m_volFracOptions (
""),
46 m_volFracItpFileI (
""),
47 m_volFracItpFileE (
""),
50 m_tissueAttributes ({-1}),
79 model->getLinkedSolver()->fillPdeVm(vm);
129 CEPS_SAYS(
"Setting up elements of the cardiac problem");
145 if (not attrs.empty())
154 if (params->
hasKey(
"membrane capacitance"))
159 if (params->
hasKey(
"membrane surface"))
166 if (params->
hasKey(
"sigma i"))
170 if (params->
hasKey(
"sigma e"))
194 for (
auto attr: model->getAttributes())
195 cmMap[attr] = model->getPaperCm(
true);
229 "There is no ionic model provided as input !"
267 CepsString(
"Incorrect options for volume fraction: please provide either :\n") +
268 " - a file name and the name of the scalar data array, defined on cells.\n" +
269 " - a string defining a physical coefficient (cf documentation)\n";
289 "Unable to open file with volume fraction interpolation map : " <<
m_volFracItpFileI
301 "Unable to open file with volume fraction interpolation map : " <<
m_volFracItpFileE
304 n =
ceps::readInt(ifileE,
"Unable to read number of lines in volume fraction table file");
326 tmpopts +=
"-1 sigma"+tag+
"Org"+suffix;
354 CepsString fullOpts =
"dico" + label +
" " + opts +
" TYPE IAPP";
355 if (this->
getTMVUnknowns().size()==1 and opts.find(
"UNKNOWN") == opts.npos)
356 fullOpts +=
" UNKNOWN 0";
364 if (model->getUnknown() == u)
365 model->addStimulation(stim);
382 CepsString fullOpts =
"dico" + label +
" " + opts;
384 if (this->
getTMVUnknowns().size()==1 and opts.find(
"UNKNOWN") == opts.npos)
385 fullOpts +=
" UNKNOWN 0";
387 if (opts.find(
"DIRICHLET") != opts.npos)
389 else if (opts.find(
"NEUMANN") != opts.npos)
394 "When specifying a boundary stimulation, the DIRICHLET or "
395 "NEUMANN keyword must be given in the options"
420 if (fiberOptions.empty())
432 CepsString keywordL = words.size() < 2 ?
"fibers" : words[1];
433 CepsString keywordT = words.size() < 3 ?
"fibers_transverse" : words[2];
434 CepsString keywordN = words.size() < 4 ?
"fibers_normal" : words[3];
456 "Using volume fraction requires that at least two components of the fibers orientation are provided"
476 sigmaI = ceps::getNew<TensorField<GeomCell>>(
m_functions->
getTensor(
"sigmaI"+suffix),&emp,doVolFrac);
477 sigmaE = ceps::getNew<TensorField<GeomCell>>(
m_functions->
getTensor(
"sigmaE"+suffix),&emp,doVolFrac);
500 m_fL(fL),m_fT(fT),m_fN(fN),m_sT(sT),m_sV(sV)
514 return g1*CepsMathTensor::Identity() + (g0-g1)*outer;
520 s = m_sV->eval(args).asDiagonal();
522 s = m_sT->eval(args);
524 f.col(0) = m_fL->eval(args);
525 f.col(1) = m_fT->eval(args);
527 f.col(2) = f.col(0).cross(f.col(1));
529 f.col(2) = m_fN->eval(args);
531 return f*s*f.transpose();
540 res1 = res1 | m_fT->getFlags();
542 res1 = res1 | m_fN->getFlags();
AbstractIonicModel * getIonicModelFromString(CepsString ionOpts, InputParameters *params, AbstractPdeProblem *pb, CepsMap< CepsUnknownIndex, CepsSet< CepsAttribute >> &prevAttrs, const CepsSet< CepsAttribute > &tissueAttrs)
Obtain a new instance of ionic model from input string.
#define CEPS_ABORT(message)
Stops the execution with a message. If testing is enabled, only throws a runtime_error.
#define CEPS_SAYS(message)
Writes a message in the debug log and in the terminal (stdio).
#define CEPS_ABORT_IF(condition, message)
Stops the execution with a message if condition is true. If testing is enabled, only throws a runtime...
#define CEPS_SEPARATOR
Writes a separator in the debug log and in the terminal.
std::basic_string< CepsChar > CepsString
C++ format string.
std::map< _Key, _Tp, _Compare, _Alloc > CepsMap
C++ map.
std::set< _Type, _Compare, _Alloc > CepsSet
C++ set.
Eigen::Matrix< CepsScalar, 3, 3 > CepsMathTensor
Tensor, eigen format.
std::vector< _Type, _Alloc > CepsVector
C++ vector.
CepsInt CepsAttribute
Used to define regions.
std::make_unsigned_t< CepsInt > CepsUInt
Unsigned version on CepsInt.
float CepsReal
Need single precision floating point.
Eigen::Matrix< CepsScalar, 3, 1 > CepsMathVertex
Vertex, eigen format.
std::shared_ptr< DistributedHaloVector > DHVecPtr
Typedef for pointer on Distributed Halo CepsVector.
CoeffInterpolatorSAFunc< _Result > * newCoeffInterpolatorSAFunc(const CepsMap< CepsReal, _Result > &map, ScalarSAFunc *coeff)
Direct way to build a coeffInterpolator.
CstPiecewiseSAFunc< _Result > * newCstPiecewiseSAFunc(const CepsMap< CepsAttribute, _Result > &map)
Direct way to build a CstPiecewiseSAFunc.
DistributedInfos< DegreeOfFreedom * > * getDistributedDofs() const
Get the stored Degree Of Freedom repartition.
Represents a ionic model for a group of cells, i.e. multiple systems of ODEs.
virtual void defineAnalyticSolution()
Set directly the analytic function, default sets no solution, unless there is a collection of referen...
AbstractDiscretization * m_discr
Discretization method (eg FE for now)
SourceTermManager * m_sourceTerms
All source terms.
Unknown * getUnknown(const CepsString &label) const
Get an unknown by its name.
InputParameters * m_parameters
Input file data.
Geometry * m_geom
Link to geometry on which the pb is defined.
void createSpatialDiscretization()
Compute the discretization structure.
Geometry * getGeometry() const
Link to geometry on which the pb is defined.
BoundaryConditionManager * m_boundaryConditions
All BCs should be there.
FunctionDictionary * m_functions
Collection of custom functions.
void add(const CepsString ¶ms)
Add a boundary condition term from parameters.
A functor that aligns conductivities along the fibers directions.
CepsEnum getFlags() const override
Combination of flags of all 3 arrays.
FiberAligner(VectorSAFunc *fL, VectorSAFunc *fT, VectorSAFunc *fN, TensorSAFunc *sT=nullptr, VectorSAFunc *sV=nullptr)
Constructor with a functor for each direction. Input conductivity can be either vector (diagonal) or ...
CepsMathTensor eval(CepsStandardArgs args) override
Get the full tensor.
void defineBoundaryConditions() override
For cardiac problems, use the "boundary stimulation" key to create boundary conditions using the same...
void getInitialCondition(DHVecPtr v) const override
Zero + asks each ionic model to fill the parts of the Vm vector with its initial value.
ScalarField< DegreeOfFreedom > * m_Cm
Membrane capacitance, may depend on x and t.
CepsString m_fibersOptions
Options for fiber orientation.
CepsString m_bcStimOptions
Options for stimulation, on boundary.
~CardiacProblem() override
Destructor.
CepsString m_CmOptions
Options for membrance capacitance.
void initializeCm()
Sets the membrane conductivity from the input parameters.
CepsString m_AmOptions
Options for membrane surface.
CepsString m_volFracOptions
Options for volume fraction.
void initializeIonicModels()
Creates and assign ionic models to tissue regions from input string.
void initializeAm()
Set the surface of membrane from input parameters.
CepsString m_ionOptions
Options for ionic models.
TensorField< GeomCell > * getSigmaE() const
Link to extracellular conductivity.
CardiacProblem(Geometry *g, InputParameters *params=nullptr)
Constructor with input file and geometry.
virtual void initializeConductivities()
Generates the functors that compute conductivity either from inputs or volume fraction.
void setupWithParameters(InputParameters *params) override
Sets options from the parameters.
virtual void initializeStimulations()
Generates stimulations and links them to ionic models. Called within define source terms.
CepsString m_sigmaIOptions
Options for intracellular conductivity.
TensorField< GeomCell > * m_sigmaI
Intracellular conductivity, defined on cells.
void createFibersAndConductivities(CepsString fiberOptions, TensorField< GeomCell > *&sigmaI, TensorField< GeomCell > *&sigmaE, CepsString suffix="")
Creates the entries in the dictionary for each direction of fibers from file This is splitted from in...
CepsVector< AbstractIonicModel * > getIonicModels() const
Vector of all initd ionic models.
virtual CepsVector< Unknown * > getTMVUnknowns() const =0
Returns a vector containing all unknowns that are a TMV (especially useful for bilayer)
CepsString m_sigmaEOptions
Options for extracellulat conductivity.
CepsVector< AbstractIonicModel * > m_ionicModels
All ionic models defined on the tissue.
CepsSet< CepsAttribute > m_tissueAttributes
Identifier for the tissue region, default {-1}.
ScalarField< DegreeOfFreedom > * m_Am
Surface (cm2) of cell membrane per cm3 of myocardium.
ScalarField< GeomCell > * m_volFrac
Fraction of tissue made of valid myocytes.
const CepsSet< CepsAttribute > & getTissueAttributes() const
All attributes that localize tissue.
TensorField< GeomCell > * m_sigmaE
Extracellulat conductivity, defined on cells.
ScalarField< DegreeOfFreedom > * getCm() const
Link to Cm coefficient.
CepsString m_stimOptions
Options for stimulation.
CepsString m_volFracItpFileI
Options for volume fraction.
CepsString m_volFracItpFileE
Options for volume fraction.
void initializeEquation() override
Initializes all the elements of the PDE from options.
ScalarField< DegreeOfFreedom > * getAm() const
Link to Am coefficient.
TensorField< GeomCell > * getSigmaI() const
Link to intracellular conductivity.
void defineSourceTerms() override
For cardiac problem, only calls initializeStimulation. Can be overriden.
A Field is an object wrapped around a SAFunc functor, defined on at least one domain.
void addDomain(const _Domain *domain)
Add another domain of definition.
void clearDomains()
Removes domains and support.
void addFromFile(const CepsString &label, const CepsString ¶ms, Geometry *geom, CepsBool neverMind=false)
Add a function read from data file, requires geometry. If the extension is compatible with CoeffReade...
CepsBool hasTensor(const CepsString &label) const
Tells if function "label" is registered.
const TensorEntry getTensor(const CepsString &label) const
Get a single tensor entry, const version.
const VectorEntry getVector(const CepsString &label) const
Get a single vector entry, const version.
void add(const CepsString &label, const CepsString ¶ms, Geometry *geom=nullptr)
Add an object from parameters.
void addFunction(const CepsString &label, const CepsString ¶ms)
Add a function deduced from tags only, works only with scalar return type.
const ScalarEntry getScalar(const CepsString &label) const
Get a single scalar entry, const version.
void addEntry(const CepsString &label, ScalarEntry func)
Ads an entry to the map of scalar functions.
Encapsulates all the geometrical data.
Mesh * getMeshOfDim(CepsUInt dim) const
Return the mesh of requested dimension.
CepsBool hasMeshOfDim(CepsUInt dim) const
true if geometry has data of requested dimension
Heat PDE, single unknown, constant diffusion coeff 1, homogeneous Neumann (no BC defined)
void defineUnknowns() override
Lists the unknowns of the problem (one here)
const CepsVector< GeomCell * > & getCells()
CepsVector of cells stored on this process.
A SAFunc is a ceps::Function that uses CepsStandardArgs as argument of call operator (),...
void add(const CepsString ¶ms, CepsBool computeSupport=false)
Add a source term from parameters.
ScalarSourceTerm * getSourceTerm(CepsString label) const
Get a source term, nullptr if not found.
Source term, essentially a ScalarField.
CepsUnknownIndex getUnknownId() const
Get the name of the unknown.
A class used to defined an unknown of a PDE problem The unknown can be defined on a specific region,...
CepsString toString(_Tp value)
Convert a given value to a string (input has to be compatible with std::to_string)
CepsSet< CepsInt > toInts(const CepsString &s)
Cast CepsString to a set of CepsInt.
CepsBool isValidPtr(_Type *ptr)
Tells if pointer is not null.
CepsInt readInt(std::istream &file, const CepsString &errorMessage="")
Reads an integral number from an istream, aborts if conversion fails advances the stream by 1 word.
CepsBool isNullPtr(_Type *ptr)
Tells if passed pointer is null.
CepsVector< CepsString > split(const CepsString &s, const CepsString &delimiters=CepsString(" \t"))
Splits a string using mulitple delimiters in a single string.
CepsMathTensor readTensor(std::istream &file, const CepsString &errorMessage="")
Reads 9 floating point numbers from an istream, aborts if conversion fails advances the stream by 9 w...
void destroyObject(_Type &)
Destroy[delete] any type.
CepsBool fileExists(const CepsString &fileName, const CepsString &directory)
CepsReal readReal(std::istream &file, const CepsString &errorMessage="")
Reads a floating point number from an istream, aborts if conversion fails advances the stream by 1 wo...
Structure used to pass arguments to SAFunc (see pde directory) The flags of the SAFunc allows extract...