00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include "AbstractMonodomainSolver.hpp"
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061 #include "AbstractMonodomainSolver.hpp"
00062
00063
00064
00065 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00066 void AbstractMonodomainSolver<ELEMENT_DIM,SPACE_DIM>::PrepareForSetupLinearSystem(Vec currentSolution)
00067 {
00068
00069 double time = PdeSimulationTime::GetTime();
00070 mpMonodomainTissue->SolveCellSystems(currentSolution, time, time+this->mDt);
00071 }
00072
00073
00074 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00075 void AbstractMonodomainSolver<ELEMENT_DIM,SPACE_DIM>::InitialiseForSolve(Vec initialSolution)
00076 {
00077 if (this->mpLinearSystem != NULL)
00078 {
00079 return;
00080 }
00081
00082
00083 AbstractLinearPdeSolver<ELEMENT_DIM,SPACE_DIM,1>::InitialiseForSolve(initialSolution);
00084
00085
00086 if(HeartConfig::Instance()->GetUseAbsoluteTolerance())
00087 {
00088 this->mpLinearSystem->SetAbsoluteTolerance(HeartConfig::Instance()->GetAbsoluteTolerance());
00089 }
00090 else
00091 {
00092 this->mpLinearSystem->SetRelativeTolerance(HeartConfig::Instance()->GetRelativeTolerance());
00093 }
00094
00095 this->mpLinearSystem->SetKspType(HeartConfig::Instance()->GetKSPSolver());
00096 this->mpLinearSystem->SetPcType(HeartConfig::Instance()->GetKSPPreconditioner());
00097 this->mpLinearSystem->SetMatrixIsSymmetric(true);
00098 }
00099
00100
00101
00102 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00103 AbstractMonodomainSolver<ELEMENT_DIM,SPACE_DIM>::AbstractMonodomainSolver(
00104 AbstractTetrahedralMesh<ELEMENT_DIM,SPACE_DIM>* pMesh,
00105 MonodomainTissue<ELEMENT_DIM,SPACE_DIM>* pTissue,
00106 BoundaryConditionsContainer<ELEMENT_DIM,SPACE_DIM,1>* pBoundaryConditions,
00107 unsigned numQuadPoints)
00108 : AbstractDynamicLinearPdeSolver<ELEMENT_DIM,SPACE_DIM,1>(pMesh),
00109 mpBoundaryConditions(pBoundaryConditions),
00110 mpMonodomainTissue(pTissue),
00111 mNumQuadPoints(numQuadPoints)
00112 {
00113 assert(pTissue);
00114 assert(pBoundaryConditions);
00115 this->mMatrixIsConstant = true;
00116
00117 mpMonodomainAssembler = NULL;
00118 }
00119
00120
00121 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00122 AbstractMonodomainSolver<ELEMENT_DIM,SPACE_DIM>::~AbstractMonodomainSolver()
00123 {
00124 if(mpMonodomainAssembler)
00125 {
00126 delete mpMonodomainAssembler;
00127 }
00128 }
00129
00130
00131
00132
00134
00136
00137 template class AbstractMonodomainSolver<1,1>;
00138 template class AbstractMonodomainSolver<1,2>;
00139 template class AbstractMonodomainSolver<1,3>;
00140 template class AbstractMonodomainSolver<2,2>;
00141 template class AbstractMonodomainSolver<3,3>;
00142