36 #include "MonodomainSolver.hpp" 37 #include "MassMatrixAssembler.hpp" 38 #include "PetscMatTools.hpp" 41 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
44 assert(this->mpLinearSystem->rGetLhsMatrix() != NULL);
45 assert(this->mpLinearSystem->rGetRhsVector() != NULL);
53 mpMonodomainAssembler->SetMatrixToAssemble(this->mpLinearSystem->rGetLhsMatrix());
54 mpMonodomainAssembler->AssembleMatrix();
60 this->mpLinearSystem->FinaliseLhsMatrix();
65 this->mpLinearSystem->SetPrecondMatrixIsDifferentFromLhs();
74 this->mpLinearSystem->FinalisePrecondMatrix();
93 index!= dist_vec_matrix_based.
End();
96 double V = distributed_current_solution[index];
97 double F = - Am*this->mpMonodomainTissue->rGetIionicCacheReplicated()[index.Global]
98 - this->mpMonodomainTissue->rGetIntracellularStimulusCacheReplicated()[index.Global];
102 dist_vec_matrix_based.
Restore();
107 MatMult(mMassMatrix, mVecForConstructingRhs, this->mpLinearSystem->rGetRhsVector());
116 mpNeumannSurfaceTermsAssembler->SetVectorToAssemble(this->mpLinearSystem->rGetRhsVector(),
false);
117 mpNeumannSurfaceTermsAssembler->AssembleVector();
122 if (mpMonodomainCorrectionTermAssembler)
124 mpMonodomainCorrectionTermAssembler->SetVectorToAssemble(this->mpLinearSystem->rGetRhsVector(),
false);
126 mpMonodomainCorrectionTermAssembler->AssembleVector();
130 this->mpLinearSystem->FinaliseRhsVector();
133 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
136 if (this->mpLinearSystem != NULL)
156 this->mpLinearSystem->SetMatrixIsSymmetric(
true);
161 Vec& r_template = this->mpLinearSystem->rGetRhsVector();
162 VecDuplicate(r_template, &mVecForConstructingRhs);
165 VecGetOwnershipRange(r_template, &ownership_range_lo, &ownership_range_hi);
166 PetscInt local_size = ownership_range_hi - ownership_range_lo;
168 this->mpMesh->CalculateMaximumNodeConnectivityPerProcess(),
169 local_size, local_size);
172 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
179 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
185 mpMonodomainTissue(pTissue),
186 mpBoundaryConditions(pBoundaryConditions)
189 assert(pBoundaryConditions);
213 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
MonodomainCorrectionTermAssembler< ELEMENT_DIM, SPACE_DIM > * mpMonodomainCorrectionTermAssembler
AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > * mpMesh
NaturalNeumannSurfaceTermAssembler< ELEMENT_DIM, SPACE_DIM, 1 > * mpNeumannSurfaceTermsAssembler
MonodomainAssembler< ELEMENT_DIM, SPACE_DIM > * mpMonodomainAssembler
DistributedVector CreateDistributedVector(Vec vec, bool readOnly=false)
virtual void InitialiseForSolve(Vec initialSolution=nullptr)
static void BeginEvent(unsigned event)
void SetupLinearSystem(Vec currentSolution, bool computeMatrix)
Vec mVecForConstructingRhs
void SetUseMassLumping(bool useMassLumping=true)
static double GetNextTime()
virtual void InitialiseForSolve(Vec initialSolution)
MonodomainSolver(AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > *pMesh, MonodomainTissue< ELEMENT_DIM, SPACE_DIM > *pTissue, BoundaryConditionsContainer< ELEMENT_DIM, SPACE_DIM, 1 > *pBoundaryConditions)
static double GetPdeTimeStepInverse()
void PrepareForSetupLinearSystem(Vec currentSolution)
void SetCacheReplication(bool doCacheReplication)
double GetCapacitance() const
double GetSurfaceAreaToVolumeRatio() const
static void EndEvent(unsigned event)
void SetMatrixToAssemble(Mat &rMatToAssemble, bool zeroMatrixBeforeAssembly=true)
static HeartConfig * Instance()
virtual ~MonodomainSolver()
MonodomainTissue< ELEMENT_DIM, SPACE_DIM > * mpMonodomainTissue