45 if (this->mpLinearSystem != NULL)
53 Vec& r_template = this->mpLinearSystem->rGetRhsVector();
54 VecDuplicate(r_template, &mVecForConstructingRhs);
57 VecGetOwnershipRange(r_template, &ownership_range_lo, &ownership_range_hi);
58 PetscInt local_size = ownership_range_hi - ownership_range_lo;
60 2*this->mpMesh->CalculateMaximumNodeConnectivityPerProcess(),
61 local_size, local_size);
69 assert(this->mpLinearSystem->rGetLhsMatrix() != NULL);
70 assert(this->mpLinearSystem->rGetRhsVector() != NULL);
71 assert(currentSolution != NULL);
79 mpBidomainAssembler->SetMatrixToAssemble(this->mpLinearSystem->rGetLhsMatrix());
80 mpBidomainAssembler->AssembleMatrix();
84 assert(SPACE_DIM==ELEMENT_DIM);
89 this->mpLinearSystem->SwitchWriteModeLhsMatrix();
113 if (!(this->mBathSimulation))
116 index!= dist_vec_matrix_based.
End();
119 double V = distributed_current_solution_vm[index];
120 double F = - Am*this->mpBidomainTissue->rGetIionicCacheReplicated()[index.Global]
121 - this->mpBidomainTissue->rGetIntracellularStimulusCacheReplicated()[index.Global];
124 dist_vec_matrix_based_phie[index] = 0.0;
130 index!= dist_vec_matrix_based.
End();
136 double V = distributed_current_solution_vm[index];
137 double F = - Am*this->mpBidomainTissue->rGetIionicCacheReplicated()[index.Global]
138 - this->mpBidomainTissue->rGetIntracellularStimulusCacheReplicated()[index.Global];
144 dist_vec_matrix_based_vm[index] = 0.0;
147 dist_vec_matrix_based_phie[index] = 0.0;
152 dist_vec_matrix_based.
Restore();
157 MatMult(mMassMatrix, mVecForConstructingRhs, this->mpLinearSystem->rGetRhsVector());
167 mpBidomainNeumannSurfaceTermAssembler->ResetBoundaryConditionsContainer(this->mpBoundaryConditions);
168 mpBidomainNeumannSurfaceTermAssembler->SetVectorToAssemble(this->mpLinearSystem->rGetRhsVector(),
false);
169 mpBidomainNeumannSurfaceTermAssembler->AssembleVector();
175 if (mpBidomainCorrectionTermAssembler)
177 mpBidomainCorrectionTermAssembler->SetVectorToAssemble(this->mpLinearSystem->rGetRhsVector(),
false);
179 mpBidomainCorrectionTermAssembler->AssembleVector();
182 this->mpLinearSystem->FinaliseRhsVector();
184 this->mpBoundaryConditions->ApplyDirichletToLinearProblem(*(this->mpLinearSystem), computeMatrix);
186 if (this->mBathSimulation)
188 this->mpLinearSystem->FinaliseLhsMatrix();
189 this->FinaliseForBath(computeMatrix,
true);
194 this->mpLinearSystem->FinaliseLhsMatrix();
196 this->mpLinearSystem->FinaliseRhsVector();
void InitialiseForSolve(Vec initialSolution)
BidomainTissue< SPACE_DIM > * mpBidomainTissue
Vec mVecForConstructingRhs
void SetupLinearSystem(Vec currentSolution, bool computeMatrix)
BidomainCorrectionTermAssembler< ELEMENT_DIM, SPACE_DIM > * mpBidomainCorrectionTermAssembler
BidomainNeumannSurfaceTermAssembler< ELEMENT_DIM, SPACE_DIM > * mpBidomainNeumannSurfaceTermAssembler
BidomainSolver(bool bathSimulation, AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > *pMesh, BidomainTissue< SPACE_DIM > *pTissue, BoundaryConditionsContainer< ELEMENT_DIM, SPACE_DIM, 2 > *pBoundaryConditions)
BidomainAssembler< ELEMENT_DIM, SPACE_DIM > * mpBidomainAssembler
void InitialiseForSolve(Vec initialSolution)