Kerchoffs2003ContractionModel.cpp

00001 /*
00002 
00003 Copyright (c) 2005-2015, University of Oxford.
00004 All rights reserved.
00005 
00006 University of Oxford means the Chancellor, Masters and Scholars of the
00007 University of Oxford, having an administrative office at Wellington
00008 Square, Oxford OX1 2JD, UK.
00009 
00010 This file is part of Chaste.
00011 
00012 Redistribution and use in source and binary forms, with or without
00013 modification, are permitted provided that the following conditions are met:
00014  * Redistributions of source code must retain the above copyright notice,
00015    this list of conditions and the following disclaimer.
00016  * Redistributions in binary form must reproduce the above copyright notice,
00017    this list of conditions and the following disclaimer in the documentation
00018    and/or other materials provided with the distribution.
00019  * Neither the name of the University of Oxford nor the names of its
00020    contributors may be used to endorse or promote products derived from this
00021    software without specific prior written permission.
00022 
00023 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00024 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00025 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00026 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
00027 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00028 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
00029 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00030 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00031 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
00032 OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00033 
00034 */
00035 
00036 
00037 #include "Kerchoffs2003ContractionModel.hpp"
00038 #include "Exception.hpp"
00039 #include "TimeStepper.hpp"
00040 #include <iostream>
00041 
00042 const double Kerchoffs2003ContractionModel::a6 = 2.0; // 1/um
00043 const double Kerchoffs2003ContractionModel::a7 = 1.5; // um
00044 const double Kerchoffs2003ContractionModel::T0 = 180; // kPa
00045 const double Kerchoffs2003ContractionModel::Ea = 20;  // 1/um
00046 const double Kerchoffs2003ContractionModel::v0 = 0.0075; // um/ms
00047 const double Kerchoffs2003ContractionModel::ls0 = 1.9; // um
00048 const double Kerchoffs2003ContractionModel::ld = -0.4; // um
00049 const double Kerchoffs2003ContractionModel::mActivationVoltage = 0.0;
00050 const double Kerchoffs2003ContractionModel::mDeactivationVoltage = -70.0;
00051 
00052 Kerchoffs2003ContractionModel::Kerchoffs2003ContractionModel()
00053     : AbstractOdeBasedContractionModel(1)
00054 {
00055     mpSystemInfo = OdeSystemInformation<Kerchoffs2003ContractionModel>::Instance();
00056 
00057     mSarcomereLength = ls0;
00058 
00059     mStateVariables.push_back(mSarcomereLength-1.0/Ea); //steady state
00060 
00061     mIsActivated = false;
00062     mElectricallyUnactivated = true;
00063     mActivationTime = 0.0;
00064     mTime = 0.0;
00065 
00066     this->mParameters.resize(3);
00067     SetParameter("tr", 75.0); // ms
00068     SetParameter("td", 75.0); // ms
00069     SetParameter("b", 150.0); // ms/um
00070 }
00071 
00072 
00073 void Kerchoffs2003ContractionModel::EvaluateYDerivatives(double time,
00074                                                          const std::vector<double>& rY,
00075                                                          std::vector<double>& rDY)
00076 {
00077     double lc = rY[0];
00078     rDY[0]=( Ea*(mSarcomereLength-lc) - 1 )*v0;
00079 }
00080 
00081 
00082 void Kerchoffs2003ContractionModel::SetInputParameters(ContractionModelInputParameters& rInputParameters)
00083 {
00084     assert(rInputParameters.voltage != DOUBLE_UNSET);
00085 
00086     if (mIsActivated && (rInputParameters.voltage < mDeactivationVoltage))
00087     {
00088         // inactive (resting) - note don't set mIsActivated=false yet
00089         // as the cell may yet be producing force, and the code is such
00090         // that if mIsActivated=false, Ta=0
00091         mElectricallyUnactivated = true;
00092     }
00093 
00094     if (!mIsActivated && (rInputParameters.voltage > mActivationVoltage))
00095     {
00096         // activated
00097         mIsActivated = true;
00098         mActivationTime = mTime;
00099         mElectricallyUnactivated = false;
00100     }
00101 }
00102 
00103 void Kerchoffs2003ContractionModel::SetStretchAndStretchRate(double stretch, double stretchRate)
00104 {
00105     mSarcomereLength = stretch*ls0;
00106 }
00107 
00108 
00109 double Kerchoffs2003ContractionModel::GetActiveTension(double lc)
00110 {
00111     double f_iso = 0;
00112     if(lc > a7)
00113     {
00114         f_iso = T0 * pow(tanh(a6*(lc-a7)),2);
00115     }
00116 
00117     double f_twitch = 0;
00118     double b = this->GetParameter("b");
00119     double t_max = b*(mSarcomereLength - ld);
00120     if(mIsActivated)
00121     {
00122         double t_a = mTime - mActivationTime;
00123 
00124         if(t_a < t_max)
00125         {
00126             double tr = this->GetParameter("tr");
00127             double td = this->GetParameter("td");
00128             f_twitch = pow( tanh(t_a/tr)*tanh((t_max-t_a)/td), 2);
00129         }
00130         else if(mElectricallyUnactivated)
00131         {
00132             // t_a < t_ma => f_twitch=0 => Ta=0
00133             // In this case, if electrically unactivated as well,
00134             // set the state to be unactivated.
00135             mIsActivated = false;
00136         }
00137     }
00138 
00139     // expl is unstable for dt = 0.01, 0.001, impl is fine
00140     return (mSarcomereLength/ls0)*f_iso*f_twitch*(mSarcomereLength-lc)*Ea;
00141 }
00142 
00143 
00144 double Kerchoffs2003ContractionModel::GetActiveTension()
00145 {
00146     return GetActiveTension(mStateVariables[0]);
00147 }
00148 
00149 double Kerchoffs2003ContractionModel::GetNextActiveTension()
00150 {
00151     return GetActiveTension(mTemporaryStateVariables[0]);
00152 }
00153 
00154 template<>
00155 void OdeSystemInformation<Kerchoffs2003ContractionModel>::Initialise()
00156 {
00157     this->mVariableNames.push_back("lc");
00158     this->mVariableUnits.push_back("um");
00159 
00160     this->mParameterNames.push_back("tr");
00161     this->mParameterUnits.push_back("ms");
00162     this->mParameterNames.push_back("td");
00163     this->mParameterUnits.push_back("ms");
00164     this->mParameterNames.push_back("b");
00165     this->mParameterUnits.push_back("ms/um");
00166 
00167     this->mInitialised = true;
00168 }

Generated by  doxygen 1.6.2