MonodomainCorrectionTermAssembler.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 "MonodomainCorrectionTermAssembler.hpp"
00031 
00032 template<unsigned ELEM_DIM, unsigned SPACE_DIM>
00033 MonodomainCorrectionTermAssembler<ELEM_DIM,SPACE_DIM>::MonodomainCorrectionTermAssembler(
00034         AbstractTetrahedralMesh<ELEM_DIM,SPACE_DIM>* pMesh,
00035         MonodomainTissue<ELEM_DIM,SPACE_DIM>* pTissue,
00036         unsigned numQuadPoints)
00037     : AbstractCorrectionTermAssembler<ELEM_DIM,SPACE_DIM,1>(pMesh,pTissue,numQuadPoints)
00038 {
00039     mpConfig = HeartConfig::Instance();
00040     assert(mpConfig->GetUseStateVariableInterpolation());
00041 }
00042 
00043 template<unsigned ELEM_DIM, unsigned SPACE_DIM>
00044 c_vector<double,1*(ELEM_DIM+1)> MonodomainCorrectionTermAssembler<ELEM_DIM,SPACE_DIM>::ComputeVectorTerm(
00045     c_vector<double, ELEM_DIM+1> &rPhi,
00046     c_matrix<double, SPACE_DIM, ELEM_DIM+1> &rGradPhi /* not used */,
00047     ChastePoint<SPACE_DIM> &rX /* not used */,
00048     c_vector<double,1> &rU,
00049     c_matrix<double, 1, SPACE_DIM> &rGradU /* not used */,
00050     Element<ELEM_DIM,SPACE_DIM>* pElement)
00051 {
00052     double Am = mpConfig->GetSurfaceAreaToVolumeRatio();
00053     
00054     // compute the ionic current at this quadrature point using the 
00055     // interpolated state variables, and a random choice of cell (all 
00056     // should be the same)
00057     unsigned node_global_index = pElement->GetNodeGlobalIndex(0);
00058     AbstractCardiacCell* p_any_cell = this->mpCardiacTissue->GetCardiacCellOrHaloCell(node_global_index);
00059     double ionic_sv_interp = p_any_cell->GetIIonic(&(this->mStateVariablesAtQuadPoint));
00060 
00061     // add on the SVI ionic current, and take away the original ICI (linearly
00062     // interpolated ionic current) that would have been added as part of
00063     // the matrix-based assembly stage.
00064     return rPhi * (-Am) * ( ionic_sv_interp - this->mIionicInterp );
00065 }
00066 
00067 
00068 
00069 
00071 // explicit instantiation
00073 
00074 template class MonodomainCorrectionTermAssembler<1,1>;
00075 template class MonodomainCorrectionTermAssembler<1,2>;
00076 template class MonodomainCorrectionTermAssembler<1,3>;
00077 template class MonodomainCorrectionTermAssembler<2,2>;
00078 template class MonodomainCorrectionTermAssembler<3,3>;

Generated on Tue May 31 14:31:41 2011 for Chaste by  doxygen 1.5.5