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 #ifndef _SIMPLEDG0PARABOLICASSEMBLERIMPLEMENTATION_HPP_
00029 #define _SIMPLEDG0PARABOLICASSEMBLERIMPLEMENTATION_HPP_
00030
00031 #include "SimpleDg0ParabolicAssembler.hpp"
00032
00033
00035
00037
00038 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, bool NON_HEART, class CONCRETE>
00039 SimpleDg0ParabolicAssembler<ELEMENT_DIM, SPACE_DIM, NON_HEART, CONCRETE>::SimpleDg0ParabolicAssembler(
00040 AbstractMesh<ELEMENT_DIM,SPACE_DIM>* pMesh,
00041 AbstractLinearParabolicPde<SPACE_DIM>* pPde,
00042 BoundaryConditionsContainer<ELEMENT_DIM,SPACE_DIM,1>* pBoundaryConditions,
00043 unsigned numQuadPoints)
00044 : AbstractAssembler<ELEMENT_DIM,SPACE_DIM,1>(),
00045 BaseClassType(numQuadPoints),
00046 AbstractDynamicAssemblerMixin<ELEMENT_DIM,SPACE_DIM,1>()
00047 {
00048
00049
00050 mpParabolicPde = pPde;
00051 this->SetMesh(pMesh);
00052 this->SetBoundaryConditionsContainer(pBoundaryConditions);
00053
00054 this->SetMatrixIsConstant();
00055 }
00056
00057 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, bool NON_HEART, class CONCRETE>
00058 void SimpleDg0ParabolicAssembler<ELEMENT_DIM, SPACE_DIM, NON_HEART, CONCRETE>::PrepareForSolve()
00059 {
00060 BaseClassType::PrepareForSolve();
00061 assert(mpParabolicPde != NULL);
00062 }
00063
00064 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, bool NON_HEART, class CONCRETE>
00065 Vec SimpleDg0ParabolicAssembler<ELEMENT_DIM, SPACE_DIM, NON_HEART, CONCRETE>::Solve(
00066 Vec currentSolutionOrGuess,
00067 double currentTime)
00068 {
00069 return AbstractDynamicAssemblerMixin<ELEMENT_DIM,SPACE_DIM,1>::Solve(currentSolutionOrGuess, currentTime);
00070 }
00071
00072 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, bool NON_HEART, class CONCRETE>
00073 c_matrix<double,1*(ELEMENT_DIM+1),1*(ELEMENT_DIM+1)>
00074 SimpleDg0ParabolicAssembler<ELEMENT_DIM, SPACE_DIM, NON_HEART, CONCRETE>::ComputeMatrixTerm(
00075 c_vector<double, ELEMENT_DIM+1> &rPhi,
00076 c_matrix<double, ELEMENT_DIM, ELEMENT_DIM+1> &rGradPhi,
00077 ChastePoint<SPACE_DIM> &rX,
00078 c_vector<double,1> &u,
00079 c_matrix<double,1,SPACE_DIM> &rGradU ,
00080 Element<ELEMENT_DIM,SPACE_DIM>* pElement)
00081 {
00082 c_matrix<double, ELEMENT_DIM, ELEMENT_DIM> pde_diffusion_term = mpParabolicPde->ComputeDiffusionTerm(rX, pElement);
00083
00084 return prod( trans(rGradPhi), c_matrix<double, ELEMENT_DIM, ELEMENT_DIM+1>(prod(pde_diffusion_term, rGradPhi)) )
00085 + this->mDtInverse * mpParabolicPde->ComputeDuDtCoefficientFunction(rX) * outer_prod(rPhi, rPhi);
00086 }
00087
00088 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, bool NON_HEART, class CONCRETE>
00089 c_vector<double,1*(ELEMENT_DIM+1)>
00090 SimpleDg0ParabolicAssembler<ELEMENT_DIM, SPACE_DIM, NON_HEART, CONCRETE>::ComputeVectorTerm(
00091 c_vector<double, ELEMENT_DIM+1> &rPhi,
00092 c_matrix<double, ELEMENT_DIM, ELEMENT_DIM+1> &rGradPhi,
00093 ChastePoint<SPACE_DIM> &rX,
00094 c_vector<double,1> &u,
00095 c_matrix<double, 1, SPACE_DIM> &rGradU ,
00096 Element<ELEMENT_DIM,SPACE_DIM>* pElement)
00097
00098 {
00099 return (mpParabolicPde->ComputeNonlinearSourceTerm(rX, u(0)) + mpParabolicPde->ComputeLinearSourceTerm(rX)
00100 + this->mDtInverse * mpParabolicPde->ComputeDuDtCoefficientFunction(rX) * u(0)) * rPhi;
00101 }
00102
00103 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, bool NON_HEART, class CONCRETE>
00104 c_vector<double, ELEMENT_DIM>
00105 SimpleDg0ParabolicAssembler<ELEMENT_DIM, SPACE_DIM, NON_HEART, CONCRETE>::ComputeVectorSurfaceTerm(
00106 const BoundaryElement<ELEMENT_DIM-1,SPACE_DIM> &rSurfaceElement,
00107 c_vector<double, ELEMENT_DIM> &rPhi,
00108 ChastePoint<SPACE_DIM> &rX )
00109 {
00110
00111 double D_times_gradu_dot_n = this->mpBoundaryConditions->GetNeumannBCValue(&rSurfaceElement, rX);
00112 return rPhi * D_times_gradu_dot_n;
00113 }
00114
00115
00116 #endif //_SIMPLEDG0PARABOLICASSEMBLERIMPLEMENTATION_HPP_