45 #ifndef _ELECTROETAMONODOMAINSOLVER_H_ 46 #define _ELECTROETAMONODOMAINSOLVER_H_ 49 #include <lifev/core/filter/ExporterEnsight.hpp> 51 #include <lifev/core/filter/ExporterHDF5.hpp> 53 #include <lifev/core/filter/ExporterEmpty.hpp> 55 #include <Epetra_LocalMap.h> 57 #include <lifev/core/array/MatrixSmall.hpp> 59 #include <lifev/core/array/MapEpetra.hpp> 60 #include <lifev/core/array/MatrixEpetra.hpp> 61 #include <lifev/core/array/VectorEpetra.hpp> 62 #include <lifev/core/fem/SobolevNorms.hpp> 63 #include <lifev/core/fem/GeometricMap.hpp> 64 #include <lifev/electrophysiology/solver/IonicModels/ElectroIonicModel.hpp> 65 #include <lifev/electrophysiology/stimulus/ElectroStimulus.hpp> 67 #include <lifev/core/util/LifeChrono.hpp> 68 #include <lifev/core/fem/FESpace.hpp> 69 #include <lifev/electrophysiology/util/HeartUtility.hpp> 71 #include <lifev/eta/fem/ETFESpace.hpp> 72 #include <lifev/eta/expression/Integrate.hpp> 73 #include <lifev/core/mesh/MeshLoadingUtility.hpp> 75 #include <lifev/core/algorithm/LinearSolver.hpp> 76 #include <lifev/core/algorithm/Preconditioner.hpp> 77 #include <lifev/core/algorithm/PreconditionerML.hpp> 78 #include <lifev/core/algorithm/PreconditionerIfpack.hpp> 86 template<
typename Mesh,
typename IonicModel>
294 return M_elementsOrder;
401 return M_ionicModelPtr->appliedCurrentPtr();
438 this->M_surfaceVolumeRatio = surfaceVolumeRatio;
447 this->M_initialTime = initialTime;
456 this->M_timeStep = timeStep;
465 this->M_endTime = endTime;
474 this->M_diffusionTensor = diffusionTensor;
483 this->M_ionicModelPtr = ionicModelPtr;
492 (* (M_ionicModelPtr) ) = ionicModel;
502 this->M_commPtr = commPtr;
510 (* (M_commPtr) ) = comm;
519 this->M_localMeshPtr = localMeshPtr;
528 (* (M_localMeshPtr) ) = localMesh;
538 this->M_fullMeshPtr = fullMeshPtr;
546 (* (M_fullMeshPtr) ) = fullMesh;
556 this->M_ETFESpacePtr = ETFESpacePtr;
565 (* (M_ETFESpacePtr) ) = ETFESpace;
574 this->M_feSpacePtr = feSpacePtr;
583 (* (M_feSpacePtr) ) = feSpace;
593 this->M_massMatrixPtr = massMatrixPtr;
602 (* (M_massMatrixPtr) ) = massMatrix;
611 this->M_fullMassMatrixPtr = fullMassMatrixPtr;
620 (* (M_fullMassMatrixPtr) ) = fullMassMatrix;
629 this->M_stiffnessMatrixPtr = stiffnessMatrixPtr;
638 (* (M_stiffnessMatrixPtr) ) = stiffnessMatrix;
648 this->M_globalMatrixPtr = globalMatrixPtr;
657 (* (M_globalMatrixPtr) ) = globalMatrix;
667 this->M_rhsPtr = rhsPtr;
676 (* (M_rhsPtr) ) = rhs;
686 this->M_rhsPtrUnique = rhsPtrUnique;
696 (* (M_rhsPtrUnique) ) = rhsPtrUnique;
705 this->M_potentialPtr = potentialPtr;
715 (* (M_potentialPtr) ) = potential;
724 M_ionicModelPtr->setAppliedCurrentPtr (appliedCurrentPtr);
733 M_ionicModelPtr->setAppliedCurrent (appliedCurrent);
742 this->M_linearSolverPtr = linearSolverPtr;
751 (* (M_linearSolverPtr) ) = linearSolver;
760 this->M_globalSolution = globalSolution;
769 for (
int j = 0; j < M_ionicModelPtr->Size(); j++)
771 (* (M_globalSolution.at (j) ) ) = (* (globalSolution.at (j) ) );
782 M_globalSolution.at (j) = gatingVariable;
792 * (M_globalSolution.at (j) ) = gatingVariable;
801 this->M_globalRhs = globalRhs;
810 for (
int j = 0; j < M_ionicModelPtr->Size(); j++)
812 (* (M_globalRhs.at (j) ) ) = (* (globalRhs.at (j) ) );
822 this->M_fiberPtr = fiberPtr;
831 (* (M_fiberPtr) ) = fiber;
853 virtual void setup (
GetPot& dataFile,
short int ionicSize);
862 virtual void setup (std::string meshName, std::string meshPath,
GetPot& dataFile,
863 short int ionicSize);
915 (*M_potentialPtr) = k;
924 (* (M_ionicModelPtr->appliedCurrentPtr() ) ) = k;
956 MeshUtility::loadMesh (M_localMeshPtr, M_fullMeshPtr, meshName, meshPath);
966 M_feSpacePtr->interpolate (
967 static_cast<FESpace<RegionMesh<LinearTetra>, MapEpetra>::function_Type> (f),
968 *M_potentialPtr, time);
979 M_ionicModelPtr->setAppliedCurrentFromFunction (f, M_feSpacePtr, time);
991 M_ionicModelPtr->setAppliedCurrentFromElectroStimulus (stimulus, M_feSpacePtr, time);
1031 (*M_rhsPtrUnique) += (*M_massMatrixPtr) * (*M_potentialPtr)
1032 * (M_ionicModelPtr -> membraneCapacitance() / (M_timeStep) );
1110 std::string folder =
"./");
1125 inline void setupFibers (std::string fibersFile,
const std::string& filePath =
"./")
1127 ElectrophysiologyUtility::importFibers (M_fiberPtr, fibersFile, M_localMeshPtr, filePath);
1142 inline void setupFibers (std::string fibersFile, std::string directory,
1145 ElectrophysiologyUtility::importFibersFromTextFile (M_fiberPtr, fibersFile,
1290 exporter.postProcess (t);
1304 M_ionicModelPtr->initialize (M_globalSolution);
1316 Real threshold = 0.0);
1418 template<
typename Mesh,
typename IonicModel>
1427 template<
typename Mesh,
typename IonicModel>
1429 std::string meshName, std::string meshPath,
GetPot& dataFile,
1435 setup (meshName, meshPath, dataFile, M_ionicModelPtr->Size() );
1439 template<
typename Mesh,
typename IonicModel>
1441 std::string meshName, std::string meshPath,
GetPot& dataFile,
1447 setup (meshName, meshPath, dataFile, M_ionicModelPtr->Size() );
1450 template<
typename Mesh,
typename IonicModel>
1457 setup (dataFile, M_ionicModelPtr->Size() );
1461 template<
typename Mesh,
typename IonicModel>
1488 setupGlobalSolution (M_ionicModelPtr->Size() );
1490 setupGlobalRhs (M_ionicModelPtr->Size() );
1495 template<
typename Mesh,
typename IonicModel>
1499 if (M_verbose && M_commPtr -> MyPID() == 0)
1501 std::cout <<
"\n WARNING!!! ETA Monodomain Solver: you are using the assignment operator! This method is outdated.";
1502 std::cout <<
"\n WARNING!!! ETA Monodomain Solver: Don't count on it, at this moment. Feel free to update yourself...";
1525 M_elementsOrder = solver.M_elementsOrder;
1528 M_identity = solver.M_identity;
1534 template<
typename Mesh,
typename IonicModel>
1538 std::shared_ptr<FESpace<mesh_Type, MapEpetra> > Space3D (
1539 new FESpace<mesh_Type, MapEpetra> (M_localMeshPtr, M_elementsOrder,
1542 M_fiberPtr.reset (
new vector_Type (Space3D->map() ) );
1544 int d1 = (*M_fiberPtr).epetraVector().MyLength() / 3;
1547 for (
int k (0); k < d1; k++)
1549 j = (*M_fiberPtr).blockMap().GID (k + d1);
1550 (*M_fiberPtr) [j] = 1.0;
1554 template<
typename Mesh,
typename IonicModel>
1558 std::shared_ptr<FESpace<mesh_Type, MapEpetra> > Space3D (
1559 new FESpace<mesh_Type, MapEpetra> (M_localMeshPtr, M_elementsOrder,
1562 M_fiberPtr.reset (
new vector_Type (Space3D->map() ) );
1564 ElectrophysiologyUtility::setupFibers (*M_fiberPtr, fibers);
1567 template<
typename Mesh,
typename IonicModel>
1569 std::string postDir)
1571 std::shared_ptr<FESpace<mesh_Type, MapEpetra> > Space3D (
1572 new FESpace<mesh_Type, MapEpetra> (M_localMeshPtr, M_elementsOrder,
1575 ExporterHDF5 < mesh_Type > exp;
1576 exp.setMeshProcId (M_localMeshPtr, M_commPtr->MyPID() );
1577 exp.setPostDir (postDir);
1578 exp.setPrefix (
"FiberDirection");
1579 exp.addVariable (ExporterData<mesh_Type>::VectorField,
"fibers", Space3D,
1580 M_fiberPtr, UInt (0) );
1581 exp.postProcess (0);
1585 template<
typename Mesh,
typename IonicModel>
1589 std::shared_ptr<FESpace<mesh_Type, MapEpetra> > Space3D (
1590 new FESpace<mesh_Type, MapEpetra> (M_localMeshPtr, M_elementsOrder,
1593 exporter.addVariable (ExporterData<mesh_Type>::VectorField,
"fibers",
1594 Space3D, M_fiberPtr, UInt (0) );
1595 exporter.postProcess (0);
1598 template<
typename Mesh,
typename IonicModel>
1602 importer->setPrefix (prefix);
1603 importer->setPostDir (postDir);
1605 importer->setMeshProcId (M_feSpacePtr->mesh(),
1606 M_feSpacePtr->map().comm().MyPID() );
1608 importer->addVariable (IOData_Type::ScalarField,
"Variable0", M_feSpacePtr,
1609 M_potentialPtr,
static_cast<UInt> (0) );
1610 for (
int i (1); i < M_ionicModelPtr->Size(); i++)
1611 importer->addVariable (IOData_Type::ScalarField,
1612 "Variable" + number2string (i), M_feSpacePtr,
1613 M_globalSolution.at (i),
static_cast<UInt> (0) );
1614 importer->importFromTime (time);
1615 importer->closeFile();
1618 template<
typename Mesh,
typename IonicModel>
1620 short int ionicSize)
1622 M_feSpacePtr.reset (
new feSpace_Type (M_localMeshPtr, M_elementsOrder, 1, M_commPtr) );
1624 M_ETFESpacePtr.reset (
new ETFESpace_Type (M_localMeshPtr, & (M_feSpacePtr -> refFE() ) , M_commPtr) );
1626 M_massMatrixPtr.reset (
new matrix_Type (M_ETFESpacePtr->map() ) );
1628 M_stiffnessMatrixPtr.reset (
new matrix_Type (M_ETFESpacePtr->map() ) );
1630 M_globalMatrixPtr.reset (
new matrix_Type (M_ETFESpacePtr->map() ) );
1632 M_rhsPtr.reset (
new vector_Type (M_ETFESpacePtr->map(), Repeated) );
1634 M_rhsPtrUnique.reset (
new vector_Type (* (M_rhsPtr), Unique) );
1636 M_potentialPtr.reset (
new vector_Type (M_ETFESpacePtr->map() ) );
1651 M_ionicModelPtr->setAppliedCurrent (Iapp);
1658 template<
typename Mesh,
typename IonicModel>
1660 std::string meshPath,
1662 short int ionicSize)
1665 partitionMesh (meshName, meshPath);
1669 template<
typename Mesh,
typename IonicModel>
1678 *M_massMatrixPtr *= 0.0;
1679 if (M_verbose && M_localMeshPtr->comm()->MyPID() == 0)
1681 std::cout <<
"\nETA Monodomain Solver: Setting up mass matrix";
1687 integrate (elements (M_localMeshPtr), M_feSpacePtr->qr(),
1688 M_ETFESpacePtr, M_ETFESpacePtr, phi_i * phi_j)
1692 M_massMatrixPtr->globalAssemble();
1696 template<
typename Mesh,
typename IonicModel>
1701 *M_massMatrixPtr *= 0.0;
1702 if (M_verbose && M_localMeshPtr->comm()->MyPID() == 0)
1704 std::cout <<
"\nETA Monodomain Solver: Setting up lumped mass matrix";
1709 integrate (elements (M_localMeshPtr), quadRuleTetra4ptNodal,
1710 M_ETFESpacePtr, M_ETFESpacePtr, phi_i * phi_j)
1714 M_massMatrixPtr->globalAssemble();
1718 template<
typename Mesh,
typename IonicModel>
1724 template<
typename Mesh,
typename IonicModel>
1728 if (M_verbose && M_localMeshPtr->comm()->MyPID() == 0)
1731 <<
"\nETA Monodomain Solver: Setting up stiffness matrix (only fiber field)";
1734 *M_stiffnessMatrixPtr *= 0.0;
1739 new ETFESpaceVectorial_Type (M_localMeshPtr, & (M_feSpacePtr -> refFE() ), M_commPtr) );
1744 auto I = value(M_identity);
1745 auto f0 = value (spaceVectorial, *M_fiberPtr);
1746 auto D = value (sigmat) * I + (value (sigmal) - value (sigmat) ) * outerProduct (f0, f0);
1748 integrate (elements (M_localMeshPtr), M_feSpacePtr->qr(), M_ETFESpacePtr,
1750 dot ( D * grad (phi_i), grad (phi_j) ) )
1751 >> M_stiffnessMatrixPtr;
1755 M_stiffnessMatrixPtr->globalAssemble();
1758 template<
typename Mesh,
typename IonicModel>
1761 (*M_globalMatrixPtr) *= 0;
1762 (*M_globalMatrixPtr) = (*M_stiffnessMatrixPtr);
1763 (*M_globalMatrixPtr) *= 1.0 / M_surfaceVolumeRatio;
1764 (*M_globalMatrixPtr) += ( (*M_massMatrixPtr) * ( M_ionicModelPtr -> membraneCapacitance() / M_timeStep) );
1767 template<
typename Mesh,
typename IonicModel>
1773 precRawPtr =
new prec_Type;
1774 precRawPtr->setDataFromGetPot (dataFile,
"prec");
1775 precPtr.reset (precRawPtr);
1777 Teuchos::RCP < Teuchos::ParameterList > solverParamList = Teuchos::rcp (
new Teuchos::ParameterList);
1779 std::string xmlpath = dataFile (
"electrophysiology/monodomain_xml_path",
"./");
1780 std::string xmlfile = dataFile (
"electrophysiology/monodomain_xml_file",
"MonodomainSolverParamList.xml");
1782 solverParamList = Teuchos::getParametersFromXmlFile (xmlpath + xmlfile);
1784 M_linearSolverPtr->setCommunicator (M_commPtr);
1785 M_linearSolverPtr->setParameters (*solverParamList);
1786 M_linearSolverPtr->setPreconditioner (precPtr);
1787 M_linearSolverPtr->setOperator (M_globalMatrixPtr);
1790 template<
typename Mesh,
typename IonicModel>
1791 void ElectroETAMonodomainSolver<Mesh, IonicModel>::setupGlobalSolution (
1792 short int ionicSize)
1794 M_globalSolution.push_back (M_potentialPtr);
1795 for (
int k = 1; k < ionicSize; ++k)
1797 M_globalSolution.push_back (
1798 * (
new vectorPtr_Type (
new VectorEpetra (M_ETFESpacePtr->map() ) ) ) );
1802 template<
typename Mesh,
typename IonicModel>
1803 void ElectroETAMonodomainSolver<Mesh, IonicModel>::setupGlobalRhs (
1804 short int ionicSize)
1806 M_globalRhs.push_back (M_rhsPtrUnique);
1807 for (
int k = 1; k < ionicSize; ++k)
1809 M_globalRhs.push_back (
1810 * (
new vectorPtr_Type (
new VectorEpetra (M_ETFESpacePtr->map() ) ) ) );
1815 template<
typename Mesh,
typename IonicModel>
1816 void ElectroETAMonodomainSolver<Mesh, IonicModel>::setupPotentialExporter (
1817 IOFile_Type& exporter, std::string fileName)
1819 exporter.setMeshProcId (M_localMeshPtr, M_commPtr->MyPID() );
1820 exporter.setPrefix (fileName);
1821 exporter.exportPID (M_localMeshPtr, M_commPtr);
1822 exporter.addVariable (ExporterData<mesh_Type>::ScalarField,
"Potential",
1823 M_feSpacePtr, M_potentialPtr, UInt (0) );
1826 template<
typename Mesh,
typename IonicModel>
1827 void ElectroETAMonodomainSolver<Mesh, IonicModel>::setupExporter (
1828 IOFile_Type& exporter, std::string fileName, std::string folder)
1830 exporter.setMeshProcId (M_localMeshPtr, M_commPtr->MyPID() );
1831 exporter.setPrefix (fileName);
1832 exporter.exportPID (M_localMeshPtr, M_commPtr);
1833 exporter.setPostDir (folder);
1834 std::string variableName;
1835 for (
int i = 0; i < M_ionicModelPtr->Size(); i++)
1837 variableName =
"Variable" + std::to_string<std::string> (i);
1838 exporter.addVariable (ExporterData<mesh_Type>::ScalarField, variableName,
1839 M_feSpacePtr, M_globalSolution.at (i), UInt (0) );
1844 template<
typename Mesh,
typename IonicModel>
1845 void ElectroETAMonodomainSolver<Mesh, IonicModel>::solveOneReactionStepFE (
1848 M_ionicModelPtr->superIonicModel::computeRhs (M_globalSolution, M_globalRhs);
1850 for (
int i = 0; i < M_ionicModelPtr->Size(); i++)
1853 * (M_globalSolution.at (i) ) = * (M_globalSolution.at (i) )
1854 + ( (M_timeStep) / subiterations / M_ionicModelPtr -> membraneCapacitance() ) * (* (M_globalRhs.at (i) ) );
1856 * (M_globalSolution.at (i) ) = * (M_globalSolution.at (i) )
1857 + ( (M_timeStep) / subiterations) * (* (M_globalRhs.at (i) ) );
1862 template<
typename Mesh,
typename IonicModel>
1863 void ElectroETAMonodomainSolver<Mesh, IonicModel>::solveOneReactionStepFE (matrix_Type& mass,
int subiterations)
1865 M_ionicModelPtr->superIonicModel::computeRhs (M_globalSolution, M_globalRhs);
1867 for (
int i = 0; i < M_ionicModelPtr->Size(); i++)
1872 vector_Type aux ( M_potentialPtr -> map() );
1873 aux = mass.operator * ( (* (M_globalRhs.at (i) ) ) );
1874 * (M_globalSolution.at (i) ) = * (M_globalSolution.at (i) )
1875 + ( (M_timeStep) / subiterations / M_ionicModelPtr -> membraneCapacitance() ) * aux;
1878 * (M_globalSolution.at (i) ) = * (M_globalSolution.at (i) )
1879 + ( (M_timeStep) / subiterations) * (* (M_globalRhs.at (i) ) );
1885 template<
typename Mesh,
typename IonicModel>
1886 void ElectroETAMonodomainSolver<Mesh, IonicModel>::solveOneReactionStepRL (
1889 M_ionicModelPtr->superIonicModel::computeRhs (M_globalSolution, M_globalRhs);
1891 * (M_globalSolution.at (0) ) = * (M_globalSolution.at (0) )
1892 + ( (M_timeStep) / subiterations / M_ionicModelPtr -> membraneCapacitance() ) * (* (M_globalRhs.at (0) ) );
1894 M_ionicModelPtr->superIonicModel::computeGatingVariablesWithRushLarsen (
1895 M_globalSolution, M_timeStep / subiterations);
1896 int offset = M_ionicModelPtr->numberOfGatingVariables() + 1;
1897 for (
int i = offset; i < M_ionicModelPtr->Size(); i++)
1899 * (M_globalSolution.at (i) ) = * (M_globalSolution.at (i) )
1900 + ( (M_timeStep) / subiterations) * (* (M_globalRhs.at (i) ) );
1905 template<
typename Mesh,
typename IonicModel>
1906 void ElectroETAMonodomainSolver<Mesh, IonicModel>::solveOneDiffusionStepBDF2 (
1907 vectorPtr_Type previousPotentialPtr)
1909 matrixPtr_Type OperatorBDF2 (
new matrix_Type (M_feSpacePtr->map() ) );
1910 vectorPtr_Type rhsBDF2 (
new vector_Type (M_feSpacePtr->map() ) );
1911 (*OperatorBDF2) *= 0;
1912 (*OperatorBDF2) = (*M_stiffnessMatrixPtr);
1913 (*OperatorBDF2) += (*M_stiffnessMatrixPtr);
1914 (*OperatorBDF2) += ( (*M_massMatrixPtr) * (3.0 / M_timeStep) );
1916 (*rhsBDF2) = 4.0 * (*M_rhsPtrUnique);
1917 (*rhsBDF2) -= (*M_massMatrixPtr) * (*previousPotentialPtr)
1918 * (1.0 / M_timeStep);
1919 M_linearSolverPtr->setOperator (OperatorBDF2);
1920 M_linearSolverPtr->setRightHandSide (rhsBDF2);
1921 M_linearSolverPtr->solve (M_potentialPtr);
1924 template<
typename Mesh,
typename IonicModel>
1925 void ElectroETAMonodomainSolver<Mesh, IonicModel>::solveOneDiffusionStepBE()
1927 M_linearSolverPtr->setRightHandSide (M_rhsPtrUnique);
1928 M_linearSolverPtr->solve (M_potentialPtr);
1931 template<
typename Mesh,
typename IonicModel>
1932 void ElectroETAMonodomainSolver<Mesh, IonicModel>::solveOneSplittingStep()
1934 solveOneReactionStepFE();
1935 (*M_rhsPtrUnique) *= 0;
1937 solveOneDiffusionStepBE();
1940 template<
typename Mesh,
typename IonicModel>
1941 void ElectroETAMonodomainSolver<Mesh, IonicModel>::solveOneSplittingStep (
1942 IOFile_Type& exporter, Real t)
1944 solveOneSplittingStep();
1945 exportSolution (exporter, t);
1948 template<
typename Mesh,
typename IonicModel>
1949 void ElectroETAMonodomainSolver<Mesh, IonicModel>::solveSplitting()
1951 for (Real t = M_initialTime; t < M_endTime;)
1954 solveOneSplittingStep();
1958 template<
typename Mesh,
typename IonicModel>
1959 void ElectroETAMonodomainSolver<Mesh, IonicModel>::solveSplitting (
1960 IOFile_Type& exporter)
1962 if (M_endTime > M_timeStep)
1964 for (Real t = M_initialTime; t < M_endTime;)
1967 solveOneSplittingStep (exporter, t);
1972 template<
typename Mesh,
typename IonicModel>
1973 void ElectroETAMonodomainSolver<Mesh, IonicModel>::solveSplitting (
1974 IOFile_Type& exporter, Real dt)
1978 &&
"Cannot save the solution for step smaller than the timestep!");
1979 int iter ( (dt / M_timeStep) + 1e-9);
1981 if (M_endTime > M_timeStep)
1983 for (Real t = M_initialTime; t < M_endTime;)
1990 solveOneSplittingStep (exporter, t);
1994 solveOneSplittingStep();
2001 template<
typename Mesh,
typename IonicModel>
2002 void ElectroETAMonodomainSolver<Mesh, IonicModel>::solveOneStepGatingVariablesFE()
2004 M_ionicModelPtr->superIonicModel::computeGatingRhs (M_globalSolution,
2007 for (
int i = 1; i < M_ionicModelPtr->Size(); i++)
2009 * (M_globalSolution.at (i) ) = * (M_globalSolution.at (i) )
2010 + M_timeStep * (* (M_globalRhs.at (i) ) );
2013 template<
typename Mesh,
typename IonicModel>
2014 void ElectroETAMonodomainSolver<Mesh, IonicModel>::solveOneStepGatingVariablesRL()
2017 M_ionicModelPtr->superIonicModel::computeGatingVariablesWithRushLarsen (
2018 M_globalSolution, M_timeStep);
2019 M_ionicModelPtr->superIonicModel::computeNonGatingRhs (M_globalSolution,
2021 int offset = M_ionicModelPtr->numberOfGatingVariables() + 1;
2022 for (
int i = offset; i < M_ionicModelPtr->Size(); i++)
2024 * (M_globalRhs[i]) *= M_timeStep;
2025 * (M_globalSolution[i]) += * (M_globalRhs[i]);
2029 template<
typename Mesh,
typename IonicModel>
2030 void ElectroETAMonodomainSolver<Mesh, IonicModel>::computeRhsICI()
2032 M_ionicModelPtr->superIonicModel::computePotentialRhsICI (M_globalSolution,
2033 M_globalRhs, (*M_massMatrixPtr) );
2037 template<
typename Mesh,
typename IonicModel>
2038 void ElectroETAMonodomainSolver<Mesh, IonicModel>::computeRhsICIWithFullMass ()
2040 if (M_fullMassMatrixPtr)
2042 M_ionicModelPtr->superIonicModel::computePotentialRhsICI (M_globalSolution,
2043 M_globalRhs, *M_fullMassMatrixPtr);
2047 assert (0 &&
"fullMassMatrix Pointer was not set! Use the computeRhsICI() method!");
2052 template<
typename Mesh,
typename IonicModel>
2053 void ElectroETAMonodomainSolver<Mesh, IonicModel>::computeRhsSVI()
2055 if (M_verbose && M_commPtr -> MyPID() == 0)
2057 std::cout <<
"\nETA Monodomain Solver: updating rhs with SVI";
2059 M_ionicModelPtr->superIonicModel::computePotentialRhsSVI (M_globalSolution,
2060 M_globalRhs, (*M_feSpacePtr) );
2064 template<
typename Mesh,
typename IonicModel>
2065 void ElectroETAMonodomainSolver<Mesh, IonicModel>::solveOneICIStep()
2068 M_linearSolverPtr->setRightHandSide (M_rhsPtrUnique);
2069 M_linearSolverPtr->solve (M_potentialPtr);
2072 template<
typename Mesh,
typename IonicModel>
2073 void ElectroETAMonodomainSolver<Mesh, IonicModel>::solveOneICIStepWithFullMass ()
2075 computeRhsICIWithFullMass ();
2076 M_linearSolverPtr->setRightHandSide (M_rhsPtrUnique);
2077 M_linearSolverPtr->solve (M_potentialPtr);
2080 template<
typename Mesh,
typename IonicModel>
2081 void ElectroETAMonodomainSolver<Mesh, IonicModel>::solveOneSVIStep()
2084 M_linearSolverPtr->setRightHandSide (M_rhsPtrUnique);
2085 M_linearSolverPtr->solve (M_potentialPtr);
2088 template<
typename Mesh,
typename IonicModel>
2089 void ElectroETAMonodomainSolver<Mesh, IonicModel>::solveICI()
2091 for (Real t = M_initialTime; t < M_endTime;)
2094 solveOneStepGatingVariablesFE();
2099 template<
typename Mesh,
typename IonicModel>
2100 void ElectroETAMonodomainSolver<Mesh, IonicModel>::solveSVI()
2102 for (Real t = M_initialTime; t < M_endTime;)
2105 solveOneStepGatingVariablesFE();
2110 template<
typename Mesh,
typename IonicModel>
2111 void ElectroETAMonodomainSolver<Mesh, IonicModel>::solveOneICIStep (
2112 IOFile_Type& exporter, Real t)
2115 exportSolution (exporter, t);
2118 template<
typename Mesh,
typename IonicModel>
2119 void ElectroETAMonodomainSolver<Mesh, IonicModel>::solveOneICIStepWithFullMass (
2120 IOFile_Type& exporter, Real t)
2122 solveOneICIStepWithFullMass();
2123 exportSolution (exporter, t);
2126 template<
typename Mesh,
typename IonicModel>
2127 void ElectroETAMonodomainSolver<Mesh, IonicModel>::solveOneSVIStep (
2128 IOFile_Type& exporter, Real t)
2131 exportSolution (exporter, t);
2134 template<
typename Mesh,
typename IonicModel>
2135 void ElectroETAMonodomainSolver<Mesh, IonicModel>::solveICI (
2136 IOFile_Type& exporter)
2139 Real dt = M_timeStep;
2140 for (Real t = M_initialTime; t < M_endTime;)
2145 M_timeStep = M_endTime - (t - dt);
2147 solveOneStepGatingVariablesFE();
2148 solveOneICIStep (exporter, t);
2152 template<
typename Mesh,
typename IonicModel>
2153 void ElectroETAMonodomainSolver<Mesh, IonicModel>::solveSVI (
2154 IOFile_Type& exporter)
2156 for (Real t = M_initialTime; t < M_endTime;)
2159 solveOneStepGatingVariablesFE();
2160 solveOneSVIStep (exporter, t);
2164 template<
typename Mesh,
typename IonicModel>
2165 void ElectroETAMonodomainSolver<Mesh, IonicModel>::solveICI (
2166 IOFile_Type& exporter, Real dt)
2170 &&
"Cannot save the solution for step smaller than the timestep!");
2171 int iter ( (dt / M_timeStep) + 1e-9);
2174 if (M_endTime > M_timeStep)
2176 for (Real t = M_initialTime; t < M_endTime;)
2182 M_timeStep = M_endTime - (t - dt);
2185 solveOneStepGatingVariablesFE();
2188 solveOneICIStep (exporter, t);
2200 template<
typename Mesh,
typename IonicModel>
2201 void ElectroETAMonodomainSolver<Mesh, IonicModel>::solveICIWithFullMass (
2202 IOFile_Type& exporter, Real dt)
2206 &&
"Cannot save the solution for step smaller than the timestep!");
2207 if (!M_fullMassMatrixPtr)
2209 solveICI (exporter, dt);
2213 int iter ( (dt / M_timeStep) + 1e-9);
2216 if (M_endTime > M_timeStep)
2218 for (Real t = M_initialTime; t < M_endTime;)
2224 M_timeStep = M_endTime - (t - dt);
2227 solveOneStepGatingVariablesFE();
2230 solveOneICIStepWithFullMass (exporter, t);
2234 solveOneICIStepWithFullMass( );
2242 template<
typename Mesh,
typename IonicModel>
2243 void ElectroETAMonodomainSolver<Mesh, IonicModel>::solveSVI (
2244 IOFile_Type& exporter, Real dt)
2248 &&
"Cannot save the solution for step smaller than the timestep!");
2249 int iter ( (dt / M_timeStep) + 1e-9);
2251 if (M_endTime > M_timeStep)
2253 for (Real t = M_initialTime; t < M_endTime;)
2258 solveOneStepGatingVariablesFE();
2261 solveOneSVIStep (exporter, t);
2272 template<
typename Mesh,
typename IonicModel>
2273 void ElectroETAMonodomainSolver<Mesh, IonicModel>::registerActivationTime (
2274 vector_Type& activationTimeVector, Real time, Real threshold)
2276 int n1 = M_potentialPtr->epetraVector().MyLength();
2278 for (
int l (0); l < n1; l++)
2280 i = M_potentialPtr->blockMap().GID (l);
2281 if (activationTimeVector[i] < 0 && (* (M_potentialPtr) ) [i] > threshold)
2283 activationTimeVector[i] = time;
2290 template<
typename Mesh,
typename IonicModel>
2291 void ElectroETAMonodomainSolver<Mesh, IonicModel>::init()
2293 M_linearSolverPtr.reset (
new LinearSolver() );
2294 M_globalSolution = vectorOfPtr_Type();
2295 M_globalRhs = vectorOfPtr_Type();
2297 M_identity (0, 0) = 1.0;
2298 M_identity (0, 1) = 0.0;
2299 M_identity (0, 2) = 0.0;
2300 M_identity (1, 0) = 0.0;
2301 M_identity (1, 1) = 1.0;
2302 M_identity (1, 2) = 0.0;
2303 M_identity (2, 0) = 0.0;
2304 M_identity (2, 1) = 0.0;
2305 M_identity (2, 2) = 1.0;
2307 M_commPtr.reset (
new Epetra_MpiComm (MPI_COMM_WORLD) );
2308 M_localMeshPtr.reset (
new mesh_Type (M_commPtr) );
2309 M_fullMeshPtr.reset (
new mesh_Type (M_commPtr) );
2312 template<
typename Mesh,
typename IonicModel>
2313 void ElectroETAMonodomainSolver<Mesh, IonicModel>::init (
2314 ionicModelPtr_Type model)
2317 M_ionicModelPtr = model;
2320 template<
typename Mesh,
typename IonicModel>
2321 void ElectroETAMonodomainSolver<Mesh, IonicModel>::init (commPtr_Type comm)
2324 M_localMeshPtr.reset (
new mesh_Type (M_commPtr) );
2325 M_fullMeshPtr.reset (
new mesh_Type (M_commPtr) );
2329 template<
typename Mesh,
typename IonicModel>
2330 void ElectroETAMonodomainSolver<Mesh, IonicModel>::init (meshPtr_Type meshPtr)
2334 M_localMeshPtr = meshPtr;
2335 M_fullMeshPtr.reset (
new mesh_Type (M_commPtr) );
2336 M_commPtr = meshPtr->comm();
2340 template<
typename Mesh,
typename IonicModel>
2341 void ElectroETAMonodomainSolver<Mesh, IonicModel>::setParameters()
2343 M_surfaceVolumeRatio = 1400.0;
2344 M_diffusionTensor[0] = 1.0;
2345 M_diffusionTensor[1] = 1.0;
2346 M_diffusionTensor[2] = 1.0;
2347 M_initialTime = 0.0;
2350 M_elementsOrder =
"P1";
2351 M_lumpedMassMatrix =
false;
2355 template<
typename Mesh,
typename IonicModel>
2356 void ElectroETAMonodomainSolver<Mesh, IonicModel>::setParameters (
2359 M_surfaceVolumeRatio = list.get (
"surfaceVolumeRatio", 1400.0);
2360 M_diffusionTensor[0] = list.get (
"longitudinalDiffusion", 1.0);
2361 M_diffusionTensor[1] = list.get (
"transversalDiffusion", 1.0);
2362 M_diffusionTensor[2] = M_diffusionTensor[1];
2363 M_initialTime = list.get (
"initialTime", 0.0);
2364 M_endTime = list.get (
"endTime", 100.0);
2365 M_timeStep = list.get (
"timeStep", 0.01);
2366 M_elementsOrder = list.get (
"elementsOrder",
"P1");
2367 M_lumpedMassMatrix = list.get (
"LumpedMass",
false);
2371 template<
typename Mesh,
typename IonicModel>
2372 void ElectroETAMonodomainSolver<Mesh, IonicModel>::setVerbosity (
2375 M_verbose = verbose;
void computeRhsSVI()
Compute the rhs using state variable interpolation.
void setEndTime(const Real &endTime)
set the time step
void init(ionicModelPtr_Type model)
initialization in constructor
VectorEpetra - The Epetra Vector format Wrapper.
void setPotentialPtr(const vectorPtr_Type potentialPtr)
set the pointer to the potential
virtual void setup(GetPot &dataFile, short int ionicSize)
setup method used in the constructor
void setFullMesh(const mesh_Type &fullMesh)
set the non partitioned mesh
void solveOneICIStep(IOFile_Type &exporter, Real t)
Solve one full step with ionic current interpolation and export the solution.
void initializeAppliedCurrent(Real k=0.0)
Initialize the applied current to the value k.
ElectroETAMonodomainSolver(std::string meshName, std::string meshPath, GetPot &dataFile, ionicModelPtr_Type model, commPtr_Type comm)
Constructor.
void solveOneDiffusionStepBE()
Solves one diffusion step using the backward Euler scheme.
void solveICI(IOFile_Type &exporter, Real dt)
Solve the system using ICI from M_initialTime to the M_endTime with time step M_timeStep and export t...
void setMassMatrix(const matrix_Type &massMatrix)
set the mass matrix
void setRhs(const vector_Type &rhs)
set the right hand side
std::shared_ptr< ETFESpace< mesh_Type, MapEpetra, 3, 1 > > ETFESpacePtr_Type
ETFESpacePtr_Type M_ETFESpacePtr
MatrixEpetra< Real > matrix_Type
Distributed Matrix // For parallel usage.
const vectorOfPtr_Type & globalRhs() const
get the pointer to the vector of pointers containing the rhs for transmembrane potential (at 0) and t...
linearSolverPtr_Type M_linearSolverPtr
void setLumpedMassMatrix(bool isLumped)
set the the choice of lumping
void exportFiberDirection(std::string postDir="./")
Generates a file where the fiber direction is saved.
void solveOneICIStepWithFullMass(IOFile_Type &exporter, Real t)
Solve one full step with ionic current interpolation and export the solution.
void solveOneICIStepWithFullMass()
solves using ionic current interpolation
void solveICIWithFullMass(IOFile_Type &exporter, Real dt)
Solve the system using ICI from M_initialTime to the M_endTime with time step M_timeStep and export t...
void setVerbosity(bool verbose)
set the verbosity
void solveSplitting()
Solve the system with operator splitting from M_initialTime to the M_endTime with time step M_timeSte...
const meshPtr_Type localMeshPtr() const
get the pointer to the partitioned mesh
void importSolution(std::string prefix, std::string postDir, Real time=0.0)
Importer: lead a solution from an hdf5 file.
void partitionMesh(std::string meshName, std::string meshPath)
partition the mesh
ExporterEnsight data exporter.
virtual void setupStiffnessMatrix()
create stiffness matrix
void setupFibers(VectorSmall< 3 > fibers)
Generates the fiber direction given the three component of the vector (F_x,F_y,F_z) ...
matrixPtr_Type M_stiffnessMatrixPtr
const matrixPtr_Type massMatrixPtr() const
get the pointer to the mass matrix
const vectorOfPtr_Type & globalSolution() const
get the pointer to the vector of pointers containing the transmembrane potential (at 0) and the gatin...
FESpace - Short description here please!
LinearSolver linearSolver_Type
Linear Solver.
void setETFESpacePtr(const ETFESpacePtr_Type ETFESpacePtr)
set the pointer to the ETA fe space
std::string M_elementsOrder
matrixSmall_Type M_identity
matrixPtr_Type M_fullMassMatrixPtr
void setFiberPtr(const vectorPtr_Type fiberPtr)
set the pointer to the fiber direction vector
ElectroIonicModel superIonicModel
Base class of the ionic model.
void setTimeStep(const Real &timeStep)
set the ending time
vectorPtr_Type fiberPtr()
get the pointer to the fiber vector
void importFromHDF5(std::string const &fileName, std::string const &matrixName="matrix")
Read a matrix from a HDF5 (.h5) file.
std::shared_ptr< matrix_Type > matrixPtr_Type
void solveSplitting(IOFile_Type &exporter)
Solve the system with operator splitting from M_initialTime to the M_endTime with time step M_timeSte...
virtual void solveOneICIStep()
Solve one full step with ionic current interpolation.
ETFESpace< mesh_Type, MapEpetra, 3, 1 > ETFESpace_Type
Expression template scalar finite element space To be used in the expression assembly namespace...
void setupGlobalMatrix()
setup the total matrix
meshPtr_Type M_fullMeshPtr
std::vector< vectorPtr_Type > vectorOfPtr_Type
virtual std::vector< std::vector< Real > > getJac(const std::vector< Real > &v, Real h=1.0e-8)
This methods computes the Jacobian numerically.
void setupGlobalRhs(short int ionicSize)
creates a vector of pointers to store the rhs
const Real & endTime() const
get the time step
std::shared_ptr< mesh_Type > meshPtr_Type
void solveOneSVIStep(IOFile_Type &exporter, Real t)
Solve one full step with ionic current interpolation and export the solution.
void exportFiberDirection(IOFile_Type &exporter)
save the fiber direction into the given exporter
vectorPtr_Type M_potentialPtr
std::shared_ptr< comm_Type > commPtr_Type
void setFullMassMatrixPtr(const matrixPtr_Type fullMassMatrixPtr)
set the pointer to the full mass matrix
const matrixPtr_Type globalMatrixPtr() const
get the pointer to the global matrix
void setMassMatrixPtr(const matrixPtr_Type massMatrixPtr)
set the pointer to the mass matrix
void exportSolution(IOFile_Type &exporter, Real t)
Save the solution in the exporter.
vectorOfPtr_Type M_globalSolution
matrixPtr_Type M_globalMatrixPtr
LifeV::Preconditioner basePrec_Type
Preconditioner.
VectorSmall< 3 > M_diffusionTensor
std::shared_ptr< prec_Type > precPtr_Type
void setFullMassMatrix(const matrix_Type &fullMassMatrix)
set the full mass matrix
void setAppliedCurrentFromFunction(function_Type &f, Real time=0.0)
given a boost function initialize the applied current
ExporterData< mesh_Type > IOData_Type
Exporter data.
const linearSolverPtr_Type linearSolverPtr() const
get the pointer to the linear solver
Exporter< mesh_Type > IOFile_Type
Exporter to save the solution.
void setETFESpace(const ETFESpace_Type &ETFESpace)
set the scalar ETA fe space
ElectroETAMonodomainSolver(GetPot &dataFile, ionicModelPtr_Type model, meshPtr_Type meshPtr)
Constructor.
void init()
initialization in constructor
std::shared_ptr< feSpace_Type > feSpacePtr_Type
void setGlobalMatrix(const matrix_Type &globalMatrix)
set the global matrix
const vectorPtr_Type rhsPtr() const
get the pointer to the right hand side
void setParameters()
Set default parameters.
const Real & initialTime() const
get the initial time (by default 0)
void setFullMeshPtr(const meshPtr_Type fullMeshPtr)
set the pointer to the non partitioned mesh
void setCommPtr(const commPtr_Type commPtr)
set the pointer to the Epetra communicator
void setInitialConditions()
Initialize the solution with resting values of the ionic model.
void solveOneSVIStep()
Solve one full step with state variable interpolation.
ElectroETAMonodomainSolver< Mesh, IonicModel > & operator=(const ElectroETAMonodomainSolver &solver)
Operator=()
void solveICI(IOFile_Type &exporter)
solve system using ICI from M_initialTime to the M_endTime with time step M_timeStep and export the s...
std::shared_ptr< ETFESpaceVectorial_Type > ETFESpaceVectorialPtr_Type
std::shared_ptr< VectorEpetra > vectorPtr_Type
const meshPtr_Type fullMeshPtr() const
get the pointer to the partitioned mesh
std::function< Real(const Real &t, const Real &x, const Real &y, const Real &z, const ID &i) > function_Type
boost function
const ETFESpacePtr_Type ETFESpacePtr() const
get the pointer to the ETA finite element space
void solveOneDiffusionStepBDF2(vectorPtr_Type previousPotentialPtr)
Solves one diffusion step using the BDF2 scheme.
Epetra_Import const & importer()
Getter for the Epetra_Import.
vectorPtr_Type solutionPtr_Type
void setIonicModelPtr(const ionicModelPtr_Type ionicModelPtr)
set the pointer to the ionic model
void solveOneSplittingStep()
Solve one full step with operator splitting.
void setStiffnessMatrix(const matrix_Type &stiffnessMatrix)
set the stiffness matrix
const vectorPtr_Type potentialPtr() const
get the pointer to the transmembrane potential
void setGlobalSolution(const vectorOfPtr_Type &globalSolution)
set the vectors of unknowns: containing the transmembrane potential (at 0) and the gating variables ...
void setupLinearSolver(GetPot dataFile)
setup the linear solver
const Real & timeStep() const
get the final time
std::shared_ptr< IOFile_Type > IOFilePtr_Type
const Real & surfaceVolumeRatio() const
get the surface to volume ratio
const vectorPtr_Type rhsPtrUnique() const
get the pointer to the unique version of the right hand side
void setupLumpedMassMatrix()
create mass matrix
void solveOneReactionStepRL(int subiterations=1)
Solves one reaction step using the Rush-Larsen scheme.
void solveOneReactionStepFE(int subiterations=1)
Solves one reaction step using the forward Euler scheme and N subiterations.
void solveSVI(IOFile_Type &exporter, Real dt)
Solve the using SVI from M_initialTime to the M_endTime with time step M_timeStep and export the solu...
matrixPtr_Type M_massMatrixPtr
VectorEpetra vector_Type
Distributed vector // For parallel usage.
void setPotentialFromFunction(function_Type &f, Real time=0.0)
given a boost function initialize the potential
void solveSVI(IOFile_Type &exporter)
solve system using SVI from M_initialTime to the M_endTime with time step M_timeStep and export the s...
void setGlobalSolutionPtrs(const vectorOfPtr_Type &globalSolution)
set the vector of pointers containing the transmembrane potential (at 0) and the gating variables ...
ExporterEnsight< mesh_Type > ensightIOFile_Type
feSpacePtr_Type M_feSpacePtr
void setLocalMesh(const mesh_Type &localMesh)
set the partitioned mesh
const matrixPtr_Type fullMassMatrixPtr() const
get the pointer to the mass matrix
void setupMassMatrix()
create mass matrix
ETFESpace< mesh_Type, MapEpetra, 3, 3 > ETFESpaceVectorial_Type
Expression template vectorial finite element space To be used in the expression assembly namespace...
void setInitialTime(const Real &initialTime)
set the starting time
const std::string elementsOrder() const
get the order of the elements
std::shared_ptr< basePrec_Type > basePrecPtr_Type
void setRhsPtrUnique(const vectorPtr_Type rhsPtrUnique)
set the pointer to the unique version of the right hand side
void setIonicModel(const ionicModel_Type &ionicModel)
set ionic model
void setPotential(const vector_Type &potential)
set the potential
void setParameters(list_Type list)
Set parameters from an xml file.
const VectorSmall< 3 > & diffusionTensor() const
get the diagonal diffusion tensor
ElectroETAMonodomainSolver(const ElectroETAMonodomainSolver &solver)
Copy Constructor.
Epetra_Comm comm_Type
Communicator to exchange informations among processes.
void setLinearSolver(const linearSolver_Type &linearSolver)
set the linear solver
const feSpacePtr_Type feSpacePtr() const
get the pointer to the usual finite element space
void initializePotential(Real k=0.0)
Initialize the potential to the value k.
void setupPotentialExporter(IOFile_Type &exporter, std::string fileName="Potential")
add to a given exporter the pointer to the potential saved with name fileName
const vectorPtr_Type appliedCurrentPtr()
get the pointer to the applied current vector
void setLocalMeshPtr(const meshPtr_Type localMeshPtr)
set the pointer to the partitioned mesh
vectorPtr_Type M_rhsPtrUnique
void setComm(const comm_Type &comm)
set the Epetra communicator
void setVariablePtr(const vector_Type &gatingVariable, int j)
set the [j]-th gating variable
void solveSVI()
solve system using SVI from M_initialTime to the M_endTime with time step M_timeStep ...
std::shared_ptr< LinearSolver > linearSolverPtr_Type
LifeV::PreconditionerML prec_Type
MultiLevel Preconditioner.
void setAppliedCurrentPtr(const vectorPtr_Type appliedCurrentPtr)
set the pointer to the applied current vector
double Real
Generic real data.
void solveOneReactionStepFE(matrix_Type &mass, int subiterations=1)
Solves one reaction step using the forward Euler scheme.
void setRhsUnique(const vector_Type &rhsPtrUnique)
set the unique version of the right hand side
ionicModelPtr_Type M_ionicModelPtr
const ionicModelPtr_Type ionicModelPtr() const
get the pointer to the ionic model
vectorOfPtr_Type M_globalRhs
FESpace< mesh_Type, MapEpetra > feSpace_Type
Finite element space.
IonicModel ionicModel_Type
Ionic model.
void setFeSpace(const feSpace_Type &feSpace)
set the fe space
void setupFibers()
Generates a default fiber direction (0,1,0)
void setFiber(const vector_Type &fiber)
set the fiber direction vector
void setRhsPtr(const vectorPtr_Type rhsPtr)
set the pointer to the right hand side
void setStiffnessMatrixPtr(const matrixPtr_Type stiffnessMatrixPtr)
set the pointer to the stiffness matrix
void setSurfaceVolumeRatio(const Real &surfaceVolumeRatio)
set the surface to volume ratio
vector_Type solution_Type
ExporterHDF5< mesh_Type > hdf5IOFile_Type
void setupStiffnessMatrix(VectorSmall< 3 > diffusion)
create stiffness matrix given a diagonal diffusion tensor
void solveOneStepGatingVariablesFE()
Solves the gating variables with forward Euler.
virtual ~ElectroETAMonodomainSolver()
Destructor.
void setLinearSolverPtr(const linearSolverPtr_Type linearSolverPtr)
set the pointer to the linear solver
const commPtr_Type commPtr() const
get the pointer to the Epetra communicator
virtual void setup(std::string meshName, std::string meshPath, GetPot &dataFile, short int ionicSize)
setup method used in the constructor
void registerActivationTime(vector_Type &activationTimeVector, Real time, Real threshold=0.0)
save the fiber direction into the given exporter
VectorEpetra & operator*=(const data_type &scalar)
Multiplication operator.
void solveICI()
solve system using ICI from M_initialTime to the M_endTime with time step M_timeStep ...
void setAppliedCurrent(const vector_Type &appliedCurrent)
set the applied current vector
vectorPtr_Type M_fiberPtr
void solveSplitting(IOFile_Type &exporter, Real dt)
Solve the system with operator splitting from M_initialTime to the M_endTime with time step M_timeSte...
void solveOneStepGatingVariablesRL()
Solves the gating variables with Rush-Larsen scheme.
void setupGlobalSolution(short int ionicSize)
creates a vector of pointers to store the solution
bool lumpedMassMatrix() const
getter for the boolean to know if we want a lumped matrix
ElectroETAMonodomainSolver()
Empty Constructor.
MatrixSmall< 3, 3 > matrixSmall_Type
3x3 matrix
meshPtr_Type M_localMeshPtr
Teuchos::ParameterList list_Type
xml list to read parameters
void setFeSpacePtr(const feSpacePtr_Type feSpacePtr)
set the pointer to the usual fe space
const matrixPtr_Type stiffnessMatrixPtr() const
get the pointer to the stiffness matrix
const vectorPtr_Type fiberPtr() const
get the pointer to the fiber vector
void solveOneSplittingStep(IOFile_Type &exporter, Real t)
Solve one full step with operator splitting and export the solution.
void setVariablePtr(const vectorPtr_Type gatingVariable, int j)
set the pointer to the [j]-th gating variable
void setGlobalRhs(const vectorOfPtr_Type &globalRhs)
set the vectors containing the rhs for the transmembrane potential (at 0) and the gating variables ...
class ETFESpace A light, templated version of the FESpace
ElectroETAMonodomainSolver(std::string meshName, std::string meshPath, GetPot &dataFile, ionicModelPtr_Type model)
Constructor.
Real M_surfaceVolumeRatio
void setGlobalRhsPtrs(const vectorOfPtr_Type &globalRhs)
set the vector of pointers containing the rhs for the transmembrane potential (at 0) and the gating v...
void updateRhs()
Update the rhs.
void computeRhsICI()
Compute the rhs using ionic current interpolation.
void computeRhsICIWithFullMass()
Compute the rhs using ionic current interpolation.
void setupFibers(std::string fibersFile, const std::string &filePath="./")
Imports the fiber direction from a hdf5 file.
void setupFibers(std::string fibersFile, std::string directory, int format=0)
Imports the fiber direction from a vtk file ( format = 0), or text file.
std::shared_ptr< superIonicModel > ionicModelPtr_Type
void setAppliedCurrentFromElectroStimulus(ElectroStimulus &stimulus, Real time=0.0)
given a ElectroStimulus object initialize the applied current
void setupExporter(IOFile_Type &exporter, std::string fileName="output", std::string folder="./")
add to a given exporter the pointer to the potential and to the gating variables saved with name file...
void setGlobalMatrixPtr(const matrixPtr_Type globalMatrixPtr)
set the pointer to the global matrix
void setDiffusionTensor(const VectorSmall< 3 > &diffusionTensor)
set the diagonal diffusion tensor
meshPtr_Type localMeshPtr()
get the pointer to the partitioned mesh