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 #include "MonodomainDg0Assembler.hpp"
00030 #include "GaussianQuadratureRule.hpp"
00031 #include "HeartConfig.hpp"
00032
00033
00034 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00035 c_vector<double,1*(ELEMENT_DIM+1)> MonodomainDg0Assembler<ELEMENT_DIM,SPACE_DIM>::ComputeVectorTerm(
00036 c_vector<double, ELEMENT_DIM+1> &rPhi,
00037 c_matrix<double, SPACE_DIM, ELEMENT_DIM+1> &rGradPhi,
00038 ChastePoint<SPACE_DIM> &rX,
00039 c_vector<double,1> &rU,
00040 c_matrix<double, 1, SPACE_DIM> &rGradU ,
00041 Element<ELEMENT_DIM,SPACE_DIM>* pElement)
00042 {
00043 return rPhi * (mSourceTerm + this->mDtInverse *
00044 mpMonodomainPde->ComputeDuDtCoefficientFunction(rX) * rU(0));
00045 }
00046
00047
00048 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00049 void MonodomainDg0Assembler<ELEMENT_DIM,SPACE_DIM>::ResetInterpolatedQuantities( void )
00050 {
00051 mSourceTerm=0;
00052 }
00053
00054
00055 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00056 void MonodomainDg0Assembler<ELEMENT_DIM,SPACE_DIM>::IncrementInterpolatedQuantities(
00057 double phiI, const Node<SPACE_DIM> *pNode)
00058 {
00059 mSourceTerm += phiI * mpMonodomainPde->ComputeNonlinearSourceTermAtNode(*pNode, this->mCurrentSolutionOrGuessReplicated[ pNode->GetIndex() ] );
00060 }
00061
00062
00063 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00064 void MonodomainDg0Assembler<ELEMENT_DIM,SPACE_DIM>::PrepareForAssembleSystem(
00065 Vec existingSolution, double time)
00066 {
00067 mpMonodomainPde->SolveCellSystems(existingSolution, time, time+this->mDt);
00068 }
00069
00070
00071 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00072 void MonodomainDg0Assembler<ELEMENT_DIM,SPACE_DIM>::InitialiseForSolve(Vec initialSolution)
00073 {
00074 if (this->mpLinearSystem != NULL)
00075 {
00076 return;
00077 }
00078
00079
00080 BaseClassType::InitialiseForSolve(initialSolution);
00081
00082 if(HeartConfig::Instance()->GetUseAbsoluteTolerance())
00083 {
00084 this->mpLinearSystem->SetAbsoluteTolerance(HeartConfig::Instance()->GetAbsoluteTolerance());
00085 }
00086 else
00087 {
00088 this->mpLinearSystem->SetRelativeTolerance(HeartConfig::Instance()->GetRelativeTolerance());
00089 }
00090
00091 this->mpLinearSystem->SetKspType(HeartConfig::Instance()->GetKSPSolver());
00092 this->mpLinearSystem->SetPcType(HeartConfig::Instance()->GetKSPPreconditioner());
00093 this->mpLinearSystem->SetMatrixIsSymmetric(true);
00094 }
00095
00096
00097 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00098 MonodomainDg0Assembler<ELEMENT_DIM,SPACE_DIM>::MonodomainDg0Assembler(
00099 AbstractTetrahedralMesh<ELEMENT_DIM,SPACE_DIM>* pMesh,
00100 MonodomainPde<ELEMENT_DIM, SPACE_DIM>* pPde,
00101 BoundaryConditionsContainer<ELEMENT_DIM, SPACE_DIM, 1>* pBcc,
00102 unsigned numQuadPoints)
00103 : AbstractAssembler<ELEMENT_DIM,SPACE_DIM,1>(),
00104 BaseClassType(pMesh, pPde, NULL , numQuadPoints)
00105 {
00106 mpMonodomainPde = pPde;
00107
00108 this->mpBoundaryConditions = pBcc;
00109
00110 this->SetMesh(pMesh);
00111
00112 this->SetMatrixIsConstant();
00113 }
00114
00115 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00116 MonodomainDg0Assembler<ELEMENT_DIM,SPACE_DIM>::~MonodomainDg0Assembler()
00117 {
00118 }
00119
00120
00122
00124
00125 template class MonodomainDg0Assembler<1,1>;
00126 template class MonodomainDg0Assembler<1,2>;
00127 template class MonodomainDg0Assembler<1,3>;
00128 template class MonodomainDg0Assembler<2,2>;
00129 template class MonodomainDg0Assembler<3,3>;
00130
00131 #include "SimpleDg0ParabolicAssemblerImplementation.hpp"
00132
00133 template class SimpleDg0ParabolicAssembler<1, 1, false, MonodomainDg0Assembler<1, 1> >;
00134 template class SimpleDg0ParabolicAssembler<1, 2, false, MonodomainDg0Assembler<1, 2> >;
00135 template class SimpleDg0ParabolicAssembler<1, 3, false, MonodomainDg0Assembler<1, 3> >;
00136 template class SimpleDg0ParabolicAssembler<2, 2, false, MonodomainDg0Assembler<2, 2> >;
00137 template class SimpleDg0ParabolicAssembler<3, 3, false, MonodomainDg0Assembler<3, 3> >;