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 #include "BidomainAssembler.hpp"
00031 #include "PdeSimulationTime.hpp"
00032 #include "UblasIncludes.hpp"
00033 #include <boost/numeric/ublas/vector_proxy.hpp>
00034
00035
00036 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00037 c_matrix<double,2*(ELEMENT_DIM+1),2*(ELEMENT_DIM+1)>
00038 BidomainAssembler<ELEMENT_DIM,SPACE_DIM>::ComputeMatrixTerm(
00039 c_vector<double, ELEMENT_DIM+1> &rPhi,
00040 c_matrix<double, SPACE_DIM, ELEMENT_DIM+1> &rGradPhi,
00041 ChastePoint<SPACE_DIM> &rX,
00042 c_vector<double,2> &rU,
00043 c_matrix<double, 2, SPACE_DIM> &rGradU ,
00044 Element<ELEMENT_DIM,SPACE_DIM>* pElement)
00045 {
00046
00047 double Am = mpConfig->GetSurfaceAreaToVolumeRatio();
00048 double Cm = mpConfig->GetCapacitance();
00049
00050 const c_matrix<double, SPACE_DIM, SPACE_DIM>& sigma_i = this->mpCardiacTissue->rGetIntracellularConductivityTensor(pElement->GetIndex());
00051 const c_matrix<double, SPACE_DIM, SPACE_DIM>& sigma_e = this->mpCardiacTissue->rGetExtracellularConductivityTensor(pElement->GetIndex());
00052
00053
00054 c_matrix<double, SPACE_DIM, ELEMENT_DIM+1> temp = prod(sigma_i, rGradPhi);
00055 c_matrix<double, ELEMENT_DIM+1, ELEMENT_DIM+1> grad_phi_sigma_i_grad_phi =
00056 prod(trans(rGradPhi), temp);
00057
00058 c_matrix<double, ELEMENT_DIM+1, ELEMENT_DIM+1> basis_outer_prod =
00059 outer_prod(rPhi, rPhi);
00060
00061 c_matrix<double, SPACE_DIM, ELEMENT_DIM+1> temp2 = prod(sigma_e, rGradPhi);
00062 c_matrix<double, ELEMENT_DIM+1, ELEMENT_DIM+1> grad_phi_sigma_e_grad_phi =
00063 prod(trans(rGradPhi), temp2);
00064
00065
00066 c_matrix<double,2*(ELEMENT_DIM+1),2*(ELEMENT_DIM+1)> ret;
00067
00068
00069 matrix_slice<c_matrix<double, 2*ELEMENT_DIM+2, 2*ELEMENT_DIM+2> >
00070 slice00(ret, slice (0, 2, ELEMENT_DIM+1), slice (0, 2, ELEMENT_DIM+1));
00071 slice00 = (Am*Cm*PdeSimulationTime::GetPdeTimeStepInverse())*basis_outer_prod + grad_phi_sigma_i_grad_phi;
00072
00073
00074 matrix_slice<c_matrix<double, 2*ELEMENT_DIM+2, 2*ELEMENT_DIM+2> >
00075 slice10(ret, slice (1, 2, ELEMENT_DIM+1), slice (0, 2, ELEMENT_DIM+1));
00076 slice10 = grad_phi_sigma_i_grad_phi;
00077
00078
00079 matrix_slice<c_matrix<double, 2*ELEMENT_DIM+2, 2*ELEMENT_DIM+2> >
00080 slice01(ret, slice (0, 2, ELEMENT_DIM+1), slice (1, 2, ELEMENT_DIM+1));
00081 slice01 = grad_phi_sigma_i_grad_phi;
00082
00083
00084 matrix_slice<c_matrix<double, 2*ELEMENT_DIM+2, 2*ELEMENT_DIM+2> >
00085 slice11(ret, slice (1, 2, ELEMENT_DIM+1), slice (1, 2, ELEMENT_DIM+1));
00086 slice11 = grad_phi_sigma_i_grad_phi + grad_phi_sigma_e_grad_phi;
00087
00088 return ret;
00089 }
00090
00091
00092
00093
00094 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00095 BidomainAssembler<ELEMENT_DIM,SPACE_DIM>::BidomainAssembler(
00096 AbstractTetrahedralMesh<ELEMENT_DIM,SPACE_DIM>* pMesh,
00097 BidomainTissue<SPACE_DIM>* pTissue,
00098 unsigned numQuadPoints)
00099 : AbstractCardiacFeVolumeIntegralAssembler<ELEMENT_DIM,SPACE_DIM,2,false,true,CARDIAC>(pMesh,pTissue,numQuadPoints)
00100 {
00101 assert(pTissue != NULL);
00102 mpConfig = HeartConfig::Instance();
00103 }
00104
00105
00106
00108
00110
00111 template class BidomainAssembler<1,1>;
00112 template class BidomainAssembler<2,2>;
00113 template class BidomainAssembler<3,3>;