Chaste  Release::2017.1
Kerchoffs2003ContractionModel.cpp
1 /*
2 
3 Copyright (c) 2005-2017, University of Oxford.
4 All rights reserved.
5 
6 University of Oxford means the Chancellor, Masters and Scholars of the
7 University of Oxford, having an administrative office at Wellington
8 Square, Oxford OX1 2JD, UK.
9 
10 This file is part of Chaste.
11 
12 Redistribution and use in source and binary forms, with or without
13 modification, are permitted provided that the following conditions are met:
14  * Redistributions of source code must retain the above copyright notice,
15  this list of conditions and the following disclaimer.
16  * Redistributions in binary form must reproduce the above copyright notice,
17  this list of conditions and the following disclaimer in the documentation
18  and/or other materials provided with the distribution.
19  * Neither the name of the University of Oxford nor the names of its
20  contributors may be used to endorse or promote products derived from this
21  software without specific prior written permission.
22 
23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
27 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
29 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
32 OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 
34 */
35 
36 
37 #include "Kerchoffs2003ContractionModel.hpp"
38 #include "Exception.hpp"
39 #include "TimeStepper.hpp"
40 #include <iostream>
41 
42 const double Kerchoffs2003ContractionModel::a6 = 2.0; // 1/um
43 const double Kerchoffs2003ContractionModel::a7 = 1.5; // um
44 const double Kerchoffs2003ContractionModel::T0 = 180; // kPa
45 const double Kerchoffs2003ContractionModel::Ea = 20; // 1/um
46 const double Kerchoffs2003ContractionModel::v0 = 0.0075; // um/ms
47 const double Kerchoffs2003ContractionModel::ls0 = 1.9; // um
48 const double Kerchoffs2003ContractionModel::ld = -0.4; // um
51 
54 {
56 
58 
59  mStateVariables.push_back(mSarcomereLength-1.0/Ea); //steady state
60 
61  mIsActivated = false;
63  mActivationTime = 0.0;
64  mTime = 0.0;
65 
66  this->mParameters.resize(3);
67  SetParameter("tr", 75.0); // ms
68  SetParameter("td", 75.0); // ms
69  SetParameter("b", 150.0); // ms/um
70 }
71 
72 
74  const std::vector<double>& rY,
75  std::vector<double>& rDY)
76 {
77  double lc = rY[0];
78  rDY[0]=( Ea*(mSarcomereLength-lc) - 1 )*v0;
79 }
80 
81 
83 {
84  assert(rInputParameters.voltage != DOUBLE_UNSET);
85 
86  if (mIsActivated && (rInputParameters.voltage < mDeactivationVoltage))
87  {
88  // inactive (resting) - note don't set mIsActivated=false yet
89  // as the cell may yet be producing force, and the code is such
90  // that if mIsActivated=false, Ta=0
92  }
93 
94  if (!mIsActivated && (rInputParameters.voltage > mActivationVoltage))
95  {
96  // activated
97  mIsActivated = true;
100  }
101 }
102 
103 void Kerchoffs2003ContractionModel::SetStretchAndStretchRate(double stretch, double stretchRate)
104 {
105  mSarcomereLength = stretch*ls0;
106 }
107 
108 
110 {
111  double f_iso = 0;
112  if (lc > a7)
113  {
114  f_iso = T0 * pow(tanh(a6*(lc-a7)),2);
115  }
116 
117  double f_twitch = 0;
118  double b = this->GetParameter("b");
119  double t_max = b*(mSarcomereLength - ld);
120  if (mIsActivated)
121  {
122  double t_a = mTime - mActivationTime;
123 
124  if (t_a < t_max)
125  {
126  double tr = this->GetParameter("tr");
127  double td = this->GetParameter("td");
128  f_twitch = pow( tanh(t_a/tr)*tanh((t_max-t_a)/td), 2);
129  }
130  else if (mElectricallyUnactivated)
131  {
132  // t_a < t_ma => f_twitch=0 => Ta=0
133  // In this case, if electrically unactivated as well,
134  // set the state to be unactivated.
135  mIsActivated = false;
136  }
137  }
138 
139  // expl is unstable for dt = 0.01, 0.001, impl is fine
140  return (mSarcomereLength/ls0)*f_iso*f_twitch*(mSarcomereLength-lc)*Ea;
141 }
142 
143 
145 {
147 }
148 
150 {
152 }
153 
154 template<>
156 {
157  this->mVariableNames.push_back("lc");
158  this->mVariableUnits.push_back("um");
159 
160  this->mParameterNames.push_back("tr");
161  this->mParameterUnits.push_back("ms");
162  this->mParameterNames.push_back("td");
163  this->mParameterUnits.push_back("ms");
164  this->mParameterNames.push_back("b");
165  this->mParameterUnits.push_back("ms/um");
166 
167  this->mInitialised = true;
168 }
static boost::shared_ptr< OdeSystemInformation< ODE_SYSTEM > > Instance()
void SetStretchAndStretchRate(double stretch, double stretchRate)
const double DOUBLE_UNSET
Definition: Exception.hpp:56
void SetParameter(const std::string &rName, double value)
void EvaluateYDerivatives(double time, const std::vector< double > &rY, std::vector< double > &rDY)
boost::shared_ptr< AbstractOdeSystemInformation > mpSystemInfo
void SetInputParameters(ContractionModelInputParameters &rInputParameters)