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