Kerchoffs2003ContractionModel.cpp

00001 /*
00002 
00003 Copyright (C) University of Oxford, 2005-2010
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 "Kerchoffs2003ContractionModel.hpp"
00031 #include "TimeStepper.hpp"
00032 #include <iostream>
00033 
00034 const double Kerchoffs2003ContractionModel::a6 = 2.0; // 1/um
00035 const double Kerchoffs2003ContractionModel::a7 = 1.5; // um
00036 const double Kerchoffs2003ContractionModel::T0 = 180; // kPa
00037 const double Kerchoffs2003ContractionModel::Ea = 20;  // 1/um
00038 const double Kerchoffs2003ContractionModel::v0 = 0.0075; // um/ms
00039 const double Kerchoffs2003ContractionModel::ls0 = 1.9; // um
00040 const double Kerchoffs2003ContractionModel::tr = 75; // ms
00041 const double Kerchoffs2003ContractionModel::td = 75; // ms
00042 const double Kerchoffs2003ContractionModel::b = 150; // ms/um
00043 const double Kerchoffs2003ContractionModel::ld = -0.4; // um
00044 
00045 Kerchoffs2003ContractionModel::Kerchoffs2003ContractionModel()
00046     : AbstractOdeBasedContractionModel(1)
00047 {
00048     mpSystemInfo = OdeSystemInformation<Kerchoffs2003ContractionModel>::Instance();
00049 
00050     mSarcomereLength = ls0;
00051 
00052     mStateVariables.push_back(mSarcomereLength-1.0/Ea); //steady state
00053 
00054     mIsActivated = false;
00055     mActivationTime = 0.0;
00056     mTime = 0.0;
00057 }
00058 
00059 
00060 void Kerchoffs2003ContractionModel::EvaluateYDerivatives(double time,
00061                                                          const std::vector<double>& rY,
00062                                                          std::vector<double>& rDY)
00063 {
00064     double lc = rY[0];
00065     rDY[0]=( Ea*(mSarcomereLength-lc) - 1 )*v0;
00066 }
00067 
00068 
00069 void Kerchoffs2003ContractionModel::SetInputParameters(ContractionModelInputParameters& rInputParameters)
00070 {
00071     assert(rInputParameters.voltage != DOUBLE_UNSET);
00072 
00073     if (mIsActivated && (rInputParameters.voltage < mDeactivationVoltage))
00074     {
00075         // inactive (resting)
00076         mIsActivated = false;
00077     }
00078 
00079     if (!mIsActivated && (rInputParameters.voltage > mActivationVoltage))
00080     {
00081         // activated
00082         mIsActivated = true;
00083         mActivationTime = mTime;
00084     }
00085 }
00086 
00087 void Kerchoffs2003ContractionModel::SetStretchAndStretchRate(double stretch, double stretchRate)
00088 {
00089     mSarcomereLength = stretch*ls0;
00090 }
00091 
00092 
00093 double Kerchoffs2003ContractionModel::GetActiveTension(double lc)
00094 {
00095     double f_iso = 0;
00096     if(lc > a7)
00097     {
00098         f_iso = T0 * pow((tanh(a6*(lc-a7))),2);
00099     }
00100 
00101     double f_twitch = 0;
00102     double t_max = b*(mSarcomereLength - ld);
00103     if(mIsActivated)
00104     {
00105         double t_a = mTime - mActivationTime;
00106 
00107         if(t_a < t_max)
00108         {
00109             f_twitch = pow( tanh(t_a/tr)*tanh((t_max-t_a)/td), 2);
00110         }
00111     }
00112 
00113     // expl is unstable for dt = 0.01, 0.001, impl is fine
00114     return (mSarcomereLength/ls0)*f_iso*f_twitch*(mSarcomereLength-lc)*Ea;
00115 }
00116 
00117 
00118 double Kerchoffs2003ContractionModel::GetActiveTension()
00119 {
00120     return GetActiveTension(mStateVariables[0]);
00121 }
00122 
00123 double Kerchoffs2003ContractionModel::GetNextActiveTension()
00124 {
00125     return GetActiveTension(mTemporaryStateVariables[0]);
00126 }
00127 
00128 template<>
00129 void OdeSystemInformation<Kerchoffs2003ContractionModel>::Initialise()
00130 {
00131     this->mVariableNames.push_back("lc");
00132     this->mVariableUnits.push_back("um");
00133     this->mInitialised = true;
00134 }

Generated by  doxygen 1.6.2