36#include "OperatorSplittingMonodomainSolver.hpp"
39template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
42 assert(this->mpLinearSystem->rGetLhsMatrix() != NULL);
43 assert(this->mpLinearSystem->rGetRhsVector() != NULL);
50 mpMonodomainAssembler->SetMatrixToAssemble(this->mpLinearSystem->rGetLhsMatrix());
51 mpMonodomainAssembler->AssembleMatrix();
57 this->mpLinearSystem->FinaliseLhsMatrix();
76 index!= dist_vec_matrix_based.
End();
79 double V = distributed_current_solution[index];
87 dist_vec_matrix_based.
Restore();
92 MatMult(mMassMatrix, mVecForConstructingRhs, this->mpLinearSystem->rGetRhsVector());
101 mpNeumannSurfaceTermsAssembler->SetVectorToAssemble(this->mpLinearSystem->rGetRhsVector(),
false);
102 mpNeumannSurfaceTermsAssembler->AssembleVector();
105 this->mpLinearSystem->FinaliseRhsVector();
108template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
113 mpMonodomainTissue->SolveCellSystems(currentSolution, time, time+dt/2.0,
true);
116template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
125template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
128 if (this->mpLinearSystem != NULL)
150 this->mpLinearSystem->SetMatrixIsSymmetric(
true);
155 Vec& r_template = this->mpLinearSystem->rGetRhsVector();
156 VecDuplicate(r_template, &mVecForConstructingRhs);
159 VecGetOwnershipRange(r_template, &ownership_range_lo, &ownership_range_hi);
160 PetscInt local_size = ownership_range_hi - ownership_range_lo;
162 this->mpMesh->CalculateMaximumNodeConnectivityPerProcess(),
163 local_size, local_size);
166template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
172 mpBoundaryConditions(pBoundaryConditions),
173 mpMonodomainTissue(pTissue)
176 assert(pBoundaryConditions);
187template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
190 delete mpMonodomainAssembler;
191 delete mpNeumannSurfaceTermsAssembler;
193 if (mVecForConstructingRhs)
void SetCacheReplication(bool doCacheReplication)
void SetMatrixToAssemble(Mat &rMatToAssemble, bool zeroMatrixBeforeAssembly=true)
virtual void InitialiseForSolve(Vec initialSolution=nullptr)
AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > * mpMesh
DistributedVector CreateDistributedVector(Vec vec, bool readOnly=false)
static void BeginEvent(unsigned event)
static void EndEvent(unsigned event)
double GetCapacitance() const
double GetSurfaceAreaToVolumeRatio() const
static HeartConfig * Instance()
~OperatorSplittingMonodomainSolver()
void SetupLinearSystem(Vec currentSolution, bool computeMatrix)
NaturalNeumannSurfaceTermAssembler< ELEMENT_DIM, SPACE_DIM, 1 > * mpNeumannSurfaceTermsAssembler
OperatorSplittingMonodomainSolver(AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > *pMesh, MonodomainTissue< ELEMENT_DIM, SPACE_DIM > *pTissue, BoundaryConditionsContainer< ELEMENT_DIM, SPACE_DIM, 1 > *pBoundaryConditions)
void InitialiseForSolve(Vec initialSolution)
void FollowingSolveLinearSystem(Vec currentSolution)
void PrepareForSetupLinearSystem(Vec currentSolution)
Vec mVecForConstructingRhs
MonodomainAssembler< ELEMENT_DIM, SPACE_DIM > * mpMonodomainAssembler
MonodomainTissue< ELEMENT_DIM, SPACE_DIM > * mpMonodomainTissue
static double GetPdeTimeStep()
static double GetPdeTimeStepInverse()
static double GetNextTime()