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 AbstractTetrahedralMesh<ELEMENT_DIM,SPACE_DIM>* pMesh,
00041 AbstractLinearParabolicPde<ELEMENT_DIM,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
00055
00056
00057 this->SetMatrixIsConstant();
00058 }
00059
00060 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, bool NON_HEART, class CONCRETE>
00061 void SimpleDg0ParabolicAssembler<ELEMENT_DIM, SPACE_DIM, NON_HEART, CONCRETE>::PrepareForSolve()
00062 {
00063 BaseClassType::PrepareForSolve();
00064 assert(mpParabolicPde != NULL);
00065 }
00066
00067 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, bool NON_HEART, class CONCRETE>
00068 Vec SimpleDg0ParabolicAssembler<ELEMENT_DIM, SPACE_DIM, NON_HEART, CONCRETE>::Solve(
00069 Vec currentSolutionOrGuess,
00070 double currentTime)
00071 {
00072 return AbstractDynamicAssemblerMixin<ELEMENT_DIM,SPACE_DIM,1>::Solve(currentSolutionOrGuess, currentTime);
00073 }
00074
00075 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, bool NON_HEART, class CONCRETE>
00076 c_matrix<double,1*(ELEMENT_DIM+1),1*(ELEMENT_DIM+1)>
00077 SimpleDg0ParabolicAssembler<ELEMENT_DIM, SPACE_DIM, NON_HEART, CONCRETE>::ComputeMatrixTerm(
00078 c_vector<double, ELEMENT_DIM+1>& rPhi,
00079 c_matrix<double, SPACE_DIM, ELEMENT_DIM+1>& rGradPhi,
00080 ChastePoint<SPACE_DIM>& rX,
00081 c_vector<double,1>& rU,
00082 c_matrix<double,1,SPACE_DIM>& rGradU ,
00083 Element<ELEMENT_DIM,SPACE_DIM>* pElement)
00084 {
00085 c_matrix<double, SPACE_DIM, SPACE_DIM> pde_diffusion_term = mpParabolicPde->ComputeDiffusionTerm(rX, pElement);
00086
00087 return prod( trans(rGradPhi), c_matrix<double, SPACE_DIM, ELEMENT_DIM+1>(prod(pde_diffusion_term, rGradPhi)) )
00088 + this->mDtInverse * mpParabolicPde->ComputeDuDtCoefficientFunction(rX) * outer_prod(rPhi, rPhi);
00089 }
00090
00091 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, bool NON_HEART, class CONCRETE>
00092 c_vector<double,1*(ELEMENT_DIM+1)>
00093 SimpleDg0ParabolicAssembler<ELEMENT_DIM, SPACE_DIM, NON_HEART, CONCRETE>::ComputeVectorTerm(
00094 c_vector<double, ELEMENT_DIM+1>& rPhi,
00095 c_matrix<double, SPACE_DIM, ELEMENT_DIM+1>& rGradPhi,
00096 ChastePoint<SPACE_DIM>& rX,
00097 c_vector<double,1>& rU,
00098 c_matrix<double, 1, SPACE_DIM>& rGradU ,
00099 Element<ELEMENT_DIM,SPACE_DIM>* pElement)
00100
00101 {
00102 return (mpParabolicPde->ComputeNonlinearSourceTerm(rX, rU(0)) + mpParabolicPde->ComputeLinearSourceTerm(rX)
00103 + this->mDtInverse * mpParabolicPde->ComputeDuDtCoefficientFunction(rX) * rU(0)) * rPhi;
00104 }
00105
00106 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, bool NON_HEART, class CONCRETE>
00107 c_vector<double, ELEMENT_DIM>
00108 SimpleDg0ParabolicAssembler<ELEMENT_DIM, SPACE_DIM, NON_HEART, CONCRETE>::ComputeVectorSurfaceTerm(
00109 const BoundaryElement<ELEMENT_DIM-1,SPACE_DIM>& rSurfaceElement,
00110 c_vector<double, ELEMENT_DIM>& rPhi,
00111 ChastePoint<SPACE_DIM>& rX)
00112 {
00113
00114 double D_times_gradu_dot_n = this->mpBoundaryConditions->GetNeumannBCValue(&rSurfaceElement, rX);
00115 return rPhi * D_times_gradu_dot_n;
00116 }
00117
00118
00119 #endif //_SIMPLEDG0PARABOLICASSEMBLERIMPLEMENTATION_HPP_