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 #include "ExtendedBidomainAssembler.hpp"
00037
00038 #include "Exception.hpp"
00039 #include "DistributedVector.hpp"
00040 #include "PdeSimulationTime.hpp"
00041 #include "ConstBoundaryCondition.hpp"
00042
00043 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00044 c_matrix<double,3*(ELEMENT_DIM+1),3*(ELEMENT_DIM+1)>
00045 ExtendedBidomainAssembler<ELEMENT_DIM,SPACE_DIM>::ComputeMatrixTerm(
00046 c_vector<double, ELEMENT_DIM+1> &rPhi,
00047 c_matrix<double, SPACE_DIM, ELEMENT_DIM+1> &rGradPhi,
00048 ChastePoint<SPACE_DIM> &rX,
00049 c_vector<double,3> &rU,
00050 c_matrix<double, 3, SPACE_DIM> &rGradU ,
00051 Element<ELEMENT_DIM,SPACE_DIM>* pElement)
00052 {
00053
00054 double Am1 = mpExtendedBidomainTissue->GetAmFirstCell();
00055 double Am2 = mpExtendedBidomainTissue->GetAmSecondCell();
00056 double Cm1 = mpExtendedBidomainTissue->GetCmFirstCell();
00057 double Cm2 = mpExtendedBidomainTissue->GetCmSecondCell();
00058
00059 const c_matrix<double, SPACE_DIM, SPACE_DIM>& sigma_i_first_cell = mpExtendedBidomainTissue->rGetIntracellularConductivityTensor(pElement->GetIndex());
00060 const c_matrix<double, SPACE_DIM, SPACE_DIM>& sigma_i_second_cell = mpExtendedBidomainTissue->rGetIntracellularConductivityTensorSecondCell(pElement->GetIndex());
00061 const c_matrix<double, SPACE_DIM, SPACE_DIM>& sigma_e = mpExtendedBidomainTissue->rGetExtracellularConductivityTensor(pElement->GetIndex());
00062
00063 double delta_t = PdeSimulationTime::GetPdeTimeStep();
00064
00065 c_matrix<double, SPACE_DIM, ELEMENT_DIM+1> temp_1 = prod(sigma_i_first_cell, rGradPhi);
00066 c_matrix<double, ELEMENT_DIM+1, ELEMENT_DIM+1> grad_phi_sigma_i_first_cell_grad_phi =
00067 prod(trans(rGradPhi), temp_1);
00068
00069 c_matrix<double, SPACE_DIM, ELEMENT_DIM+1> temp_2 = prod(sigma_i_second_cell, rGradPhi);
00070 c_matrix<double, ELEMENT_DIM+1, ELEMENT_DIM+1> grad_phi_sigma_i_second_cell_grad_phi =
00071 prod(trans(rGradPhi), temp_2);
00072
00073 c_matrix<double, ELEMENT_DIM+1, ELEMENT_DIM+1> basis_outer_prod =
00074 outer_prod(rPhi, rPhi);
00075
00076 c_matrix<double, SPACE_DIM, ELEMENT_DIM+1> temp_ext = prod(sigma_e, rGradPhi);
00077 c_matrix<double, ELEMENT_DIM+1, ELEMENT_DIM+1> grad_phi_sigma_e_grad_phi =
00078 prod(trans(rGradPhi), temp_ext);
00079
00080
00081 c_matrix<double,3*(ELEMENT_DIM+1),3*(ELEMENT_DIM+1)> ret;
00082
00083
00084 matrix_slice<c_matrix<double, 3*ELEMENT_DIM+3, 3*ELEMENT_DIM+3> >
00085 slice100(ret, slice (0, 3, ELEMENT_DIM+1), slice (0, 3, ELEMENT_DIM+1));
00086 slice100 = (Am1*Cm1/delta_t)*basis_outer_prod + grad_phi_sigma_i_first_cell_grad_phi;
00087
00088
00089 matrix_slice<c_matrix<double, 3*ELEMENT_DIM+3, 3*ELEMENT_DIM+3> >
00090 slice200(ret, slice (0, 3, ELEMENT_DIM+1), slice (1, 3, ELEMENT_DIM+1));
00091 slice200 = zero_matrix<double>(ELEMENT_DIM+1, ELEMENT_DIM+1);
00092
00093
00094 matrix_slice<c_matrix<double, 3*ELEMENT_DIM+3, 3*ELEMENT_DIM+3> >
00095 slice300(ret, slice (0, 3, ELEMENT_DIM+1), slice (2, 3, ELEMENT_DIM+1));
00096 slice300 = grad_phi_sigma_i_first_cell_grad_phi;
00097
00098
00099 matrix_slice<c_matrix<double, 3*ELEMENT_DIM+3, 3*ELEMENT_DIM+3> >
00100 slice010(ret, slice (1, 3, ELEMENT_DIM+1), slice (0, 3, ELEMENT_DIM+1));
00101 slice010 = zero_matrix<double>(ELEMENT_DIM+1, ELEMENT_DIM+1);
00102
00103
00104 matrix_slice<c_matrix<double, 3*ELEMENT_DIM+3, 3*ELEMENT_DIM+3> >
00105 slice020(ret, slice (1, 3, ELEMENT_DIM+1), slice (1, 3, ELEMENT_DIM+1));
00106 slice020 = (Am2*Cm2/delta_t)*basis_outer_prod + grad_phi_sigma_i_second_cell_grad_phi;
00107
00108
00109 matrix_slice<c_matrix<double, 3*ELEMENT_DIM+3, 3*ELEMENT_DIM+3> >
00110 slice030(ret, slice (1, 3, ELEMENT_DIM+1), slice (2, 3, ELEMENT_DIM+1));
00111 slice030 = grad_phi_sigma_i_second_cell_grad_phi;
00112
00113
00114 matrix_slice<c_matrix<double, 3*ELEMENT_DIM+3, 3*ELEMENT_DIM+3> >
00115 slice001(ret, slice (2, 3, ELEMENT_DIM+1), slice (0, 3, ELEMENT_DIM+1));
00116 slice001 = grad_phi_sigma_i_first_cell_grad_phi;
00117
00118
00119 matrix_slice<c_matrix<double, 3*ELEMENT_DIM+3, 3*ELEMENT_DIM+3> >
00120 slice002(ret, slice (2, 3, ELEMENT_DIM+1), slice (1, 3, ELEMENT_DIM+1));
00121 slice002 = grad_phi_sigma_i_second_cell_grad_phi;
00122
00123
00124 matrix_slice<c_matrix<double, 3*ELEMENT_DIM+3, 3*ELEMENT_DIM+3> >
00125 slice003(ret, slice (2, 3, ELEMENT_DIM+1), slice (2, 3, ELEMENT_DIM+1));
00126 slice003 = grad_phi_sigma_e_grad_phi + grad_phi_sigma_i_first_cell_grad_phi + grad_phi_sigma_i_second_cell_grad_phi;
00127
00128 return ret;
00129 }
00130
00131
00132 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00133 ExtendedBidomainAssembler<ELEMENT_DIM,SPACE_DIM>::ExtendedBidomainAssembler(
00134 AbstractTetrahedralMesh<ELEMENT_DIM,SPACE_DIM>* pMesh,
00135 ExtendedBidomainTissue<SPACE_DIM>* pTissue)
00136 : AbstractCardiacFeVolumeIntegralAssembler<ELEMENT_DIM,SPACE_DIM,3,true,true,NORMAL>(pMesh,pTissue),
00137 mpExtendedBidomainTissue(pTissue)
00138 {
00139 assert(pTissue != NULL);
00140 }
00141
00142 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00143 ExtendedBidomainAssembler<ELEMENT_DIM,SPACE_DIM>::~ExtendedBidomainAssembler()
00144 {
00145 }
00146
00148
00150
00151 template class ExtendedBidomainAssembler<1,1>;
00152 template class ExtendedBidomainAssembler<2,2>;
00153 template class ExtendedBidomainAssembler<3,3>;