BidomainCorrectionTermAssembler.cpp

00001 /*
00002 
00003 Copyright (C) University of Oxford, 2005-2011
00004 
00005 University of Oxford means the Chancellor, Masters and Scholars of the
00006 University of Oxford, having an administrative office at Wellington
00007 Square, Oxford OX1 2JD, UK.
00008 
00009 This file is part of Chaste.
00010 
00011 Chaste is free software: you can redistribute it and/or modify it
00012 under the terms of the GNU Lesser General Public License as published
00013 by the Free Software Foundation, either version 2.1 of the License, or
00014 (at your option) any later version.
00015 
00016 Chaste is distributed in the hope that it will be useful, but WITHOUT
00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
00019 License for more details. The offer of Chaste under the terms of the
00020 License is subject to the License being interpreted in accordance with
00021 English Law and subject to any action against the University of Oxford
00022 being under the jurisdiction of the English Courts.
00023 
00024 You should have received a copy of the GNU Lesser General Public License
00025 along with Chaste. If not, see <http://www.gnu.org/licenses/>.
00026 
00027 */
00028 
00029 
00030 #include "BidomainCorrectionTermAssembler.hpp"
00031 #include "UblasIncludes.hpp"
00032 #include <boost/numeric/ublas/vector_proxy.hpp>
00033 
00034 template<unsigned ELEM_DIM, unsigned SPACE_DIM>
00035 BidomainCorrectionTermAssembler<ELEM_DIM,SPACE_DIM>::BidomainCorrectionTermAssembler(
00036      AbstractTetrahedralMesh<ELEM_DIM,SPACE_DIM>* pMesh,
00037      BidomainTissue<SPACE_DIM>* pTissue,
00038      unsigned numQuadPoints)
00039         : AbstractCorrectionTermAssembler<ELEM_DIM,SPACE_DIM,2>(pMesh,pTissue,numQuadPoints)
00040 {
00041     mpConfig = HeartConfig::Instance();
00042     assert(mpConfig->GetUseStateVariableInterpolation());
00043 }
00044 
00045 template<unsigned ELEM_DIM, unsigned SPACE_DIM>
00046 c_vector<double,2*(ELEM_DIM+1)> BidomainCorrectionTermAssembler<ELEM_DIM,SPACE_DIM>::ComputeVectorTerm(
00047     c_vector<double, ELEM_DIM+1> &rPhi,
00048     c_matrix<double, SPACE_DIM, ELEM_DIM+1> &rGradPhi /* not used */,
00049     ChastePoint<SPACE_DIM> &rX /* not used */,
00050     c_vector<double,2> &rU,
00051     c_matrix<double, 2, SPACE_DIM> &rGradU /* not used */,
00052     Element<ELEM_DIM,SPACE_DIM>* pElement /* not used */)
00053 {
00054     double Am = mpConfig->GetSurfaceAreaToVolumeRatio();
00055 
00056     // compute the ionic current at this quadrature point using the
00057     // interpolated state variables, and a random choice of cell (all
00058     // should be the same)
00059     unsigned node_global_index = pElement->GetNodeGlobalIndex(0);
00060     AbstractCardiacCell* p_any_cell = this->mpCardiacTissue->GetCardiacCellOrHaloCell(node_global_index);
00061     double ionic_sv_interp = p_any_cell->GetIIonic(&(this->mStateVariablesAtQuadPoint));
00062 
00063     c_vector<double,2*(ELEM_DIM+1)> ret;
00064 
00065     vector_slice<c_vector<double, 2*(ELEM_DIM+1)> > slice_V  (ret, slice (0, 2, ELEM_DIM+1));
00066     vector_slice<c_vector<double, 2*(ELEM_DIM+1)> > slice_Phi(ret, slice (1, 2, ELEM_DIM+1));
00067 
00068     // add on the SVI ionic current, and take away the original NCI (linearly
00069     // interpolated ionic current) that would have been added as part of
00070     // the matrix-based assembly stage.
00071     noalias(slice_V)   = rPhi * (-Am) * ( ionic_sv_interp - this->mIionicInterp );
00072     // no correction needed for elliptic equation
00073     noalias(slice_Phi) = zero_vector<double>(ELEM_DIM+1);
00074 
00075     return ret;
00076 }
00077 
00078 
00080 // explicit instantiation
00082 
00083 template class BidomainCorrectionTermAssembler<1,1>;
00084 template class BidomainCorrectionTermAssembler<2,2>;
00085 template class BidomainCorrectionTermAssembler<3,3>;
Generated on Thu Dec 22 13:00:06 2011 for Chaste by  doxygen 1.6.3