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, ELEMENT_DIM, ELEMENT_DIM+1> &rGradPhi,
00038 ChastePoint<SPACE_DIM> &rX,
00039 c_vector<double,1> &u,
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) * u(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 phi_i, const Node<SPACE_DIM> *pNode)
00058 {
00059 mSourceTerm += phi_i * 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 currentSolution, double currentTime)
00066 {
00067 mpMonodomainPde->SolveCellSystems(currentSolution, currentTime, currentTime+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 BaseClassType::InitialiseForSolve(initialSolution);
00079 if(HeartConfig::Instance()->GetUseAbsoluteTolerance())
00080 {
00081 this->mpLinearSystem->SetAbsoluteTolerance(HeartConfig::Instance()->GetAbsoluteTolerance());
00082 }
00083 else
00084 {
00085 this->mpLinearSystem->SetRelativeTolerance(HeartConfig::Instance()->GetRelativeTolerance());
00086 }
00087 this->mpLinearSystem->SetKspType(HeartConfig::Instance()->GetKSPSolver());
00088 this->mpLinearSystem->SetPcType(HeartConfig::Instance()->GetKSPPreconditioner());
00089 }
00090
00091
00092 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00093 MonodomainDg0Assembler<ELEMENT_DIM,SPACE_DIM>::MonodomainDg0Assembler(
00094 AbstractMesh<ELEMENT_DIM,SPACE_DIM>* pMesh,
00095 MonodomainPde<SPACE_DIM>* pPde,
00096 BoundaryConditionsContainer<ELEMENT_DIM, SPACE_DIM, 1>* pBcc,
00097 unsigned numQuadPoints)
00098 : AbstractAssembler<ELEMENT_DIM,SPACE_DIM,1>(),
00099 BaseClassType(pMesh, pPde, NULL , numQuadPoints)
00100 {
00101 mpMonodomainPde = pPde;
00102
00103 this->mpBoundaryConditions = pBcc;
00104
00105 this->SetMesh(pMesh);
00106
00107 this->SetMatrixIsConstant();
00108 }
00109
00110 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00111 MonodomainDg0Assembler<ELEMENT_DIM,SPACE_DIM>::~MonodomainDg0Assembler()
00112 {
00113 }
00114
00115
00117
00119
00120 template class MonodomainDg0Assembler<1,1>;
00121 template class MonodomainDg0Assembler<2,2>;
00122 template class MonodomainDg0Assembler<3,3>;
00123
00124 #include "SimpleDg0ParabolicAssemblerImplementation.hpp"
00125
00126 template class SimpleDg0ParabolicAssembler<1, 1, false, MonodomainDg0Assembler<1, 1> >;
00127 template class SimpleDg0ParabolicAssembler<2, 2, false, MonodomainDg0Assembler<2, 2> >;
00128 template class SimpleDg0ParabolicAssembler<3, 3, false, MonodomainDg0Assembler<3, 3> >;