36 #include "ExtendedBidomainAssembler.hpp" 39 #include "DistributedVector.hpp" 40 #include "PdeSimulationTime.hpp" 41 #include "ConstBoundaryCondition.hpp" 43 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
44 c_matrix<double,3*(ELEMENT_DIM+1),3*(ELEMENT_DIM+1)>
46 c_vector<double, ELEMENT_DIM+1> &rPhi,
47 c_matrix<double, SPACE_DIM, ELEMENT_DIM+1> &rGradPhi,
49 c_vector<double,3> &rU,
50 c_matrix<double, 3, SPACE_DIM> &rGradU ,
54 double Am1 = mpExtendedBidomainTissue->GetAmFirstCell();
55 double Am2 = mpExtendedBidomainTissue->GetAmSecondCell();
56 double Cm1 = mpExtendedBidomainTissue->GetCmFirstCell();
57 double Cm2 = mpExtendedBidomainTissue->GetCmSecondCell();
59 const c_matrix<double, SPACE_DIM, SPACE_DIM>& sigma_i_first_cell = mpExtendedBidomainTissue->rGetIntracellularConductivityTensor(pElement->
GetIndex());
60 const c_matrix<double, SPACE_DIM, SPACE_DIM>& sigma_i_second_cell = mpExtendedBidomainTissue->rGetIntracellularConductivityTensorSecondCell(pElement->
GetIndex());
61 const c_matrix<double, SPACE_DIM, SPACE_DIM>& sigma_e = mpExtendedBidomainTissue->rGetExtracellularConductivityTensor(pElement->
GetIndex());
65 c_matrix<double, SPACE_DIM, ELEMENT_DIM+1> temp_1 = prod(sigma_i_first_cell, rGradPhi);
66 c_matrix<double, ELEMENT_DIM+1, ELEMENT_DIM+1> grad_phi_sigma_i_first_cell_grad_phi =
67 prod(trans(rGradPhi), temp_1);
69 c_matrix<double, SPACE_DIM, ELEMENT_DIM+1> temp_2 = prod(sigma_i_second_cell, rGradPhi);
70 c_matrix<double, ELEMENT_DIM+1, ELEMENT_DIM+1> grad_phi_sigma_i_second_cell_grad_phi =
71 prod(trans(rGradPhi), temp_2);
73 c_matrix<double, ELEMENT_DIM+1, ELEMENT_DIM+1> basis_outer_prod =
74 outer_prod(rPhi, rPhi);
76 c_matrix<double, SPACE_DIM, ELEMENT_DIM+1> temp_ext = prod(sigma_e, rGradPhi);
77 c_matrix<double, ELEMENT_DIM+1, ELEMENT_DIM+1> grad_phi_sigma_e_grad_phi =
78 prod(trans(rGradPhi), temp_ext);
81 c_matrix<double,3*(ELEMENT_DIM+1),3*(ELEMENT_DIM+1)> ret;
84 matrix_slice<c_matrix<double, 3*ELEMENT_DIM+3, 3*ELEMENT_DIM+3> >
85 slice100(ret, slice (0, 3, ELEMENT_DIM+1), slice (0, 3, ELEMENT_DIM+1));
86 slice100 = (Am1*Cm1/delta_t)*basis_outer_prod + grad_phi_sigma_i_first_cell_grad_phi;
89 matrix_slice<c_matrix<double, 3*ELEMENT_DIM+3, 3*ELEMENT_DIM+3> >
90 slice200(ret, slice (0, 3, ELEMENT_DIM+1), slice (1, 3, ELEMENT_DIM+1));
91 slice200 = zero_matrix<double>(ELEMENT_DIM+1, ELEMENT_DIM+1);
94 matrix_slice<c_matrix<double, 3*ELEMENT_DIM+3, 3*ELEMENT_DIM+3> >
95 slice300(ret, slice (0, 3, ELEMENT_DIM+1), slice (2, 3, ELEMENT_DIM+1));
96 slice300 = grad_phi_sigma_i_first_cell_grad_phi;
99 matrix_slice<c_matrix<double, 3*ELEMENT_DIM+3, 3*ELEMENT_DIM+3> >
100 slice010(ret, slice (1, 3, ELEMENT_DIM+1), slice (0, 3, ELEMENT_DIM+1));
101 slice010 = zero_matrix<double>(ELEMENT_DIM+1, ELEMENT_DIM+1);
104 matrix_slice<c_matrix<double, 3*ELEMENT_DIM+3, 3*ELEMENT_DIM+3> >
105 slice020(ret, slice (1, 3, ELEMENT_DIM+1), slice (1, 3, ELEMENT_DIM+1));
106 slice020 = (Am2*Cm2/delta_t)*basis_outer_prod + grad_phi_sigma_i_second_cell_grad_phi;
109 matrix_slice<c_matrix<double, 3*ELEMENT_DIM+3, 3*ELEMENT_DIM+3> >
110 slice030(ret, slice (1, 3, ELEMENT_DIM+1), slice (2, 3, ELEMENT_DIM+1));
111 slice030 = grad_phi_sigma_i_second_cell_grad_phi;
114 matrix_slice<c_matrix<double, 3*ELEMENT_DIM+3, 3*ELEMENT_DIM+3> >
115 slice001(ret, slice (2, 3, ELEMENT_DIM+1), slice (0, 3, ELEMENT_DIM+1));
116 slice001 = grad_phi_sigma_i_first_cell_grad_phi;
119 matrix_slice<c_matrix<double, 3*ELEMENT_DIM+3, 3*ELEMENT_DIM+3> >
120 slice002(ret, slice (2, 3, ELEMENT_DIM+1), slice (1, 3, ELEMENT_DIM+1));
121 slice002 = grad_phi_sigma_i_second_cell_grad_phi;
124 matrix_slice<c_matrix<double, 3*ELEMENT_DIM+3, 3*ELEMENT_DIM+3> >
125 slice003(ret, slice (2, 3, ELEMENT_DIM+1), slice (2, 3, ELEMENT_DIM+1));
126 slice003 = grad_phi_sigma_e_grad_phi + grad_phi_sigma_i_first_cell_grad_phi + grad_phi_sigma_i_second_cell_grad_phi;
131 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
136 mpExtendedBidomainTissue(pTissue)
138 assert(pTissue != NULL);
141 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
virtual ~ExtendedBidomainAssembler()
virtual c_matrix< double, 3 *(ELEMENT_DIM+1), 3 *(ELEMENT_DIM+1)> ComputeMatrixTerm(c_vector< double, ELEMENT_DIM+1 > &rPhi, c_matrix< double, SPACE_DIM, ELEMENT_DIM+1 > &rGradPhi, ChastePoint< SPACE_DIM > &rX, c_vector< double, 3 > &rU, c_matrix< double, 3, SPACE_DIM > &rGradU, Element< ELEMENT_DIM, SPACE_DIM > *pElement)
static double GetPdeTimeStep()
unsigned GetIndex() const
ExtendedBidomainAssembler(AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > *pMesh, ExtendedBidomainTissue< SPACE_DIM > *pTissue)