TysonNovak2001OdeSystem.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include "TysonNovak2001OdeSystem.hpp"
00030 #include "OdeSystemInformation.hpp"
00031 #include "MathsCustomFunctions.hpp"
00032
00033 TysonNovak2001OdeSystem::TysonNovak2001OdeSystem(std::vector<double> stateVariables)
00034 : AbstractOdeSystemWithAnalyticJacobian(6)
00035 {
00036 mpSystemInfo = OdeSystemInformation<TysonNovak2001OdeSystem>::Instance();
00037
00038 Init();
00039
00040 if (stateVariables != std::vector<double>())
00041 {
00042 SetStateVariables(stateVariables);
00043 }
00044 }
00045
00046 TysonNovak2001OdeSystem::~TysonNovak2001OdeSystem()
00047 {
00048
00049 }
00050
00051 void TysonNovak2001OdeSystem::Init()
00052 {
00053
00054 mK1 = 0.04;
00055 mK2d = 0.04;
00056 mK2dd = 1.0;
00057 mK2ddd = 1.0;
00058 mCycB_threshold = 0.1;
00059 mK3d = 1.0;
00060 mK3dd = 10.0;
00061 mK4d = 2.0;
00062 mK4 = 35;
00063 mJ3 = 0.04;
00064 mJ4 = 0.04;
00065 mK5d = 0.005;
00066 mK5dd = 0.2;
00067 mK6 = 0.1;
00068 mJ5 = 0.3;
00069 mN = 4u;
00070 mK7 = 1.0;
00071 mK8 = 0.5;
00072 mJ7 = 1e-3;
00073 mJ8 = 1e-3;
00074 mMad = 1.0;
00075 mK9 = 0.1;
00076 mK10 = 0.02;
00077 mK11 = 1.0;
00078 mK12d = 0.2;
00079 mK12dd = 50.0;
00080 mK12ddd = 100.0;
00081 mKeq = 1e3;
00082 mK13 = 1.0;
00083 mK14 = 1.0;
00084 mK15d = 1.5;
00085 mK15dd = 0.05;
00086 mK16d = 1.0;
00087 mK16dd = 3.0;
00088 mJ15 = 0.01;
00089 mJ16 = 0.01;
00090 mMu = 0.01;
00091 mMstar = 10.0;
00092 }
00093
00094 void TysonNovak2001OdeSystem::EvaluateYDerivatives(double time, const std::vector<double>& rY, std::vector<double>& rDY)
00095 {
00096 double x1 = rY[0];
00097 double x2 = rY[1];
00098 double x3 = rY[2];
00099 double x4 = rY[3];
00100 double x5 = rY[4];
00101 double x6 = rY[5];
00102
00103 double dx1 = 0.0;
00104 double dx2 = 0.0;
00105 double dx3 = 0.0;
00106 double dx4 = 0.0;
00107 double dx5 = 0.0;
00108 double dx6 = 0.0;
00109
00110 double temp1 = 0.0;
00111 double temp2 = 0.0;
00112 double temp3 = 0.0;
00113
00123 dx1 = mK1-(mK2d+mK2dd*x2)*x1;
00124
00125
00126
00127
00128 temp1 = ((mK3d+mK3dd*x4)*(1.0-x2))/(mJ3+1.0-x2);
00129 temp2 = (mK4*x6*x1*x2)/(mJ4+x2);
00130 dx2 = temp1-temp2;
00131
00132 temp1 = mK5dd*(SmallPow(x1*x6/mJ5,mN)/(1+SmallPow(x1*x6/mJ5,mN)));
00133 temp2 = mK6*x3;
00134 dx3 = mK5d + temp1 - temp2;
00135
00136 temp1 = (mK7*x5*(x3-x4))/(mJ7+x3-x4);
00137 temp2 = (mK8*mMad*x4)/(mJ8+x4);
00138 temp3 = mK6*x4;
00139 dx4 = temp1 - temp2 - temp3;
00140
00141 dx5 = mK9*x6*x1*(1.0-x5) - mK10*x5;
00142
00143 dx6 = mMu*x6*(1.0-x6/mMstar);
00144
00145
00146 rDY[0] = dx1*60.0;
00147 rDY[1] = dx2*60.0;
00148 rDY[2] = dx3*60.0;
00149 rDY[3] = dx4*60.0;
00150 rDY[4] = dx5*60.0;
00151 rDY[5] = dx6*60.0;
00152 }
00153
00154 void TysonNovak2001OdeSystem::AnalyticJacobian(const std::vector<double>& rSolutionGuess, double** jacobian, double time, double timeStep)
00155 {
00156 timeStep *= 60.0;
00157 double x1 = rSolutionGuess[0];
00158 double x2 = rSolutionGuess[1];
00159 double x3 = rSolutionGuess[2];
00160 double x4 = rSolutionGuess[3];
00161 double x5 = rSolutionGuess[4];
00162 double x6 = rSolutionGuess[5];
00163
00164
00165 double df1_dx1 = -mK2d - mK2dd*x2;
00166 double df1_dx2 = -mK2dd*x1;
00167
00168 jacobian[0][0] = 1-timeStep*df1_dx1;
00169 jacobian[0][1] = -timeStep*df1_dx2;
00170
00171
00172 double df2_dx1 = -mK4*x6*x2/(mJ4+x2);
00173 double df2_dx2 = -mJ3*(mK3d + mK3dd*x4)/(SmallPow((mJ3 + 1 - x2),2))
00174 -mJ4*mK4*x6*x1/(SmallPow((mJ4+x2),2));
00175 double df2_dx4 = mK3dd*(1-x2)/(mJ3+1-x2);
00176 double df2_dx6 = -mK4*x1*x2/(mJ4+x2);
00177
00178 jacobian[1][0] = -timeStep*df2_dx1;
00179 jacobian[1][1] = 1-timeStep*df2_dx2;
00180 jacobian[1][3] = -timeStep*df2_dx4;
00181 jacobian[1][5] = -timeStep*df2_dx6;
00182
00183
00184 double z = x1*x6/mJ5;
00185 double df3_dx1 = (mK5dd*x6/mJ5)*mN*SmallPow(z,mN-1)/(SmallPow((1-SmallPow(z,mN)),2));
00186 double df3_dx3 = -mK6;
00187 double df3_dx6 = (mK5dd*x1/mJ5)*mN*SmallPow(z,mN-1)/(SmallPow((1-SmallPow(z,mN)),2));
00188
00189 jacobian[2][0] = -timeStep*df3_dx1;
00190 jacobian[2][2] = 1-timeStep*df3_dx3;
00191 jacobian[2][5] = -timeStep*df3_dx6;
00192
00193
00194 double df4_dx3 = mJ7*mK7*x5/(SmallPow(mJ7+x3-x4,2));
00195 double df4_dx4 = -mJ7*mK7*x5/(SmallPow(mJ7+x3-x4,2)) - mK6 - mJ8*mK8*mMad/(SmallPow(mJ8+x4,2));
00196 double df4_dx5 = mK7*(x3-x4)/(mJ7+x3-x4);
00197
00198 jacobian[3][2] = -timeStep*df4_dx3;
00199 jacobian[3][3] = 1-timeStep*df4_dx4;
00200 jacobian[3][4] = -timeStep*df4_dx5;
00201
00202
00203 double df5_dx1 = mK9*x6*(1-x5);
00204 double df5_dx5 = -mK10 - mK9*x6*x1;
00205 double df5_dx6 = mK9*x1*(1-x5);
00206
00207 jacobian[4][0] = -timeStep*df5_dx1;
00208 jacobian[4][4] = 1-timeStep*df5_dx5;
00209 jacobian[4][5] = -timeStep*df5_dx6;
00210
00211
00212 double df6_dx6 = mMu - 2*mMu*x6/mMstar;
00213
00214 jacobian[5][5] = 1-timeStep*df6_dx6;
00215 }
00216
00217 bool TysonNovak2001OdeSystem::CalculateStoppingEvent(double time, const std::vector<double>& rY)
00218 {
00219 std::vector<double> dy(rY.size());
00220 EvaluateYDerivatives(time, rY, dy);
00221
00222
00223
00224 return ( (rY[5] > 0.6 )&& (rY[0] < mCycB_threshold) && dy[0] < 0.0 );
00225 }
00226
00227 double TysonNovak2001OdeSystem::CalculateRootFunction(double time, const std::vector<double>& rY)
00228 {
00229 std::vector<double> dy(rY.size());
00230 EvaluateYDerivatives(time, rY, dy);
00231
00232
00233
00234 if (rY[5]<0.6)
00235 {
00236 return 1.0;
00237 }
00238
00239 if (dy[0] >= 0.0)
00240 {
00241 return 1.0;
00242 }
00243 return rY[0]-mCycB_threshold;
00244 }
00245
00246 template<>
00247 void OdeSystemInformation<TysonNovak2001OdeSystem>::Initialise()
00248 {
00249
00250
00251
00252
00253
00254
00255
00256 this->mVariableNames.push_back("CycB");
00257 this->mVariableUnits.push_back("nM");
00258
00259 this->mInitialConditions.push_back(0.099999999999977);
00260
00261 this->mVariableNames.push_back("Cdh1");
00262 this->mVariableUnits.push_back("nM");
00263
00264 this->mInitialConditions.push_back(0.989026454281841);
00265
00266 this->mVariableNames.push_back("Cdc20T");
00267 this->mVariableUnits.push_back("nM");
00268
00269 this->mInitialConditions.push_back(1.547942029285891);
00270
00271 this->mVariableNames.push_back("Cdc20A");
00272 this->mVariableUnits.push_back("nM");
00273
00274 this->mInitialConditions.push_back(1.421110920135839);
00275
00276 this->mVariableNames.push_back("IEP");
00277 this->mVariableUnits.push_back("nM");
00278
00279 this->mInitialConditions.push_back(0.672838844290094);
00280
00281 this->mVariableNames.push_back("mass");
00282 this->mVariableUnits.push_back("");
00283
00284 this->mInitialConditions.push_back(0.970831277863956 / 2);
00285
00286 this->mInitialised = true;
00287 }
00288
00289
00290 #include "SerializationExportWrapperForCpp.hpp"
00291 CHASTE_CLASS_EXPORT(TysonNovak2001OdeSystem)