BackwardEulerFoxModel2002Modified.hpp

Go to the documentation of this file.
00001 #ifndef _BackwardEulerFoxModel2002Modified_
00002 #define _BackwardEulerFoxModel2002Modified_
00003 
00015 #include <boost/serialization/access.hpp>
00016 #include <boost/serialization/base_object.hpp>
00017 #include <cmath>
00018 #include <cassert>
00019 #include "AbstractBackwardEulerCardiacCell.hpp"
00020 #include "CardiacNewtonSolver.hpp"
00021 #include "Exception.hpp"
00022 #include "AbstractStimulusFunction.hpp"
00023 #include "OdeSystemInformation.hpp"
00024 
00025 // Needs to be included last
00026 #include <boost/serialization/export.hpp>
00027 
00031 class BackwardEulerFoxModel2002Modified : public AbstractBackwardEulerCardiacCell<3>
00032 {
00033   private:
00035     friend class boost::serialization::access;
00042     template<class Archive>
00043     void serialize(Archive & archive, const unsigned int version)
00044     {
00045         // This calls serialize on the base class.
00046         archive & boost::serialization::base_object<AbstractBackwardEulerCardiacCell<3> >(*this);
00047     }
00048 public:
00049     BackwardEulerFoxModel2002Modified(boost::shared_ptr<AbstractStimulusFunction> pIntracellularStimulus)
00050         : AbstractBackwardEulerCardiacCell<3>(13, 0, pIntracellularStimulus)
00051     {
00052         // Time units: millisecond
00053         mpSystemInfo = OdeSystemInformation<BackwardEulerFoxModel2002Modified>::Instance();
00054         Init();
00055     }
00056 
00060     BackwardEulerFoxModel2002Modified(boost::shared_ptr<AbstractIvpOdeSolver> /* unused */,
00061                                       boost::shared_ptr<AbstractStimulusFunction> pIntracellularStimulus)
00062         : AbstractBackwardEulerCardiacCell<3>(13, 0, pIntracellularStimulus)
00063     {
00064         // Time units: millisecond
00065         mpSystemInfo = OdeSystemInformation<BackwardEulerFoxModel2002Modified>::Instance();
00066         Init();
00067     }
00068 
00069 
00070     ~BackwardEulerFoxModel2002Modified(void)
00071     {
00072     }
00073 
00074     double GetIIonic()
00075     {
00076         std::vector<double>& rY = rGetStateVariables();
00077         double var_membrane__V = rY[0];
00078         // Units: millivolt; Initial value: -94.7
00079         double var_fast_sodium_current_m_gate__m = rY[1];
00080         // Units: dimensionless; Initial value: 0.00024676
00081         double var_fast_sodium_current_h_gate__h = rY[2];
00082         // Units: dimensionless; Initial value: 0.99869
00083         double var_fast_sodium_current_j_gate__j = rY[3];
00084         // Units: dimensionless; Initial value: 0.99887
00085         double var_rapid_activating_delayed_rectifiyer_K_current_X_kr_gate__X_kr = rY[4];
00086         // Units: dimensionless; Initial value: 0.229
00087         double var_slow_activating_delayed_rectifiyer_K_current_X_ks_gate__X_ks = rY[5];
00088         // Units: dimensionless; Initial value: 0.0001
00089         double var_transient_outward_potassium_current_X_to_gate__X_to = rY[6];
00090         // Units: dimensionless; Initial value: 0.00003742
00091         double var_transient_outward_potassium_current_Y_to_gate__Y_to = rY[7];
00092         // Units: dimensionless; Initial value: 1
00093         double var_L_type_Ca_current_f_gate__f = rY[8];
00094         // Units: dimensionless; Initial value: 0.983
00095         double var_L_type_Ca_current_d_gate__d = rY[9];
00096         // Units: dimensionless; Initial value: 0.0001
00097         double var_L_type_Ca_current_f_Ca_gate__f_Ca = rY[10];
00098         // Units: dimensionless; Initial value: 0.942
00099         double var_calcium_dynamics__Ca_i = rY[11];
00100         // Units: micromolar; Initial value: 0.0472
00101 
00102         const double var_membrane__R = 8.314;
00103         const double var_membrane__T = 310.0;
00104         const double var_membrane__F = 96.5;
00105         double var_fast_sodium_current__h = var_fast_sodium_current_h_gate__h;
00106         const double var_fast_sodium_current__g_Na = 12.8;
00107         double var_fast_sodium_current__j = var_fast_sodium_current_j_gate__j;
00108         double var_fast_sodium_current__T = var_membrane__T;
00109         double var_fast_sodium_current__R = var_membrane__R;
00110         const double var_standard_ionic_concentrations__Na_i = 10.0;
00111         double var_fast_sodium_current__Na_i = var_standard_ionic_concentrations__Na_i;
00112         const double var_standard_ionic_concentrations__Na_o = 138.0;
00113         double var_fast_sodium_current__Na_o = var_standard_ionic_concentrations__Na_o;
00114         double var_fast_sodium_current__F = var_membrane__F;
00115         double var_fast_sodium_current__E_Na = ((var_fast_sodium_current__R * var_fast_sodium_current__T) / var_fast_sodium_current__F) * log(var_fast_sodium_current__Na_o / var_fast_sodium_current__Na_i);
00116         double var_fast_sodium_current__V = var_membrane__V;
00117         double var_fast_sodium_current__m = var_fast_sodium_current_m_gate__m;
00118         double var_fast_sodium_current__i_Na = var_fast_sodium_current__g_Na * pow(var_fast_sodium_current__m, 3.0) * var_fast_sodium_current__h * var_fast_sodium_current__j * (var_fast_sodium_current__V - var_fast_sodium_current__E_Na);
00119         double var_membrane__i_Na = var_fast_sodium_current__i_Na;
00120         const double var_L_type_Ca_current__P_Ca = 1.26e-05; //2.26e-05;
00121         double var_L_type_Ca_current__V = var_membrane__V;
00122         const double var_standard_ionic_concentrations__Ca_o = 2000.0;
00123         double var_L_type_Ca_current__Ca_o = var_standard_ionic_concentrations__Ca_o;
00124         double var_L_type_Ca_current__T = var_membrane__T;
00125         const double var_L_type_Ca_current__C_sc = 1.0;
00126         double var_L_type_Ca_current__Ca_i = var_calcium_dynamics__Ca_i;
00127         double var_L_type_Ca_current__R = var_membrane__R;
00128         double var_L_type_Ca_current__F = var_membrane__F;
00129         double var_L_type_Ca_current__i_Ca_max = ((((var_L_type_Ca_current__P_Ca / var_L_type_Ca_current__C_sc) * 4.0 * var_L_type_Ca_current__V * pow(var_L_type_Ca_current__F, 2.0)) / (var_L_type_Ca_current__R * var_L_type_Ca_current__T)) * ((var_L_type_Ca_current__Ca_i * exp((2.0 * var_L_type_Ca_current__V * var_L_type_Ca_current__F) / (var_L_type_Ca_current__R * var_L_type_Ca_current__T))) - (0.341 * var_L_type_Ca_current__Ca_o))) / (exp((2.0 * var_L_type_Ca_current__V * var_L_type_Ca_current__F) / (var_L_type_Ca_current__R * var_L_type_Ca_current__T)) - 1.0);
00130         double var_L_type_Ca_current__d = var_L_type_Ca_current_d_gate__d;
00131         double var_L_type_Ca_current__f = var_L_type_Ca_current_f_gate__f;
00132         double var_L_type_Ca_current__f_Ca = var_L_type_Ca_current_f_Ca_gate__f_Ca;
00133         double var_L_type_Ca_current__i_Ca = var_L_type_Ca_current__i_Ca_max * var_L_type_Ca_current__f * var_L_type_Ca_current__d * var_L_type_Ca_current__f_Ca;
00134         double var_membrane__i_Ca = var_L_type_Ca_current__i_Ca;
00135         const double var_standard_ionic_concentrations__K_o = 4.0;
00136         double var_L_type_Ca_current__K_o = var_standard_ionic_concentrations__K_o;
00137         const double var_L_type_Ca_current__i_Ca_half =  -0.265;
00138         const double var_L_type_Ca_current__P_CaK = 5.79e-07;
00139         const double var_standard_ionic_concentrations__K_i = 149.4;
00140         double var_L_type_Ca_current__K_i = var_standard_ionic_concentrations__K_i;
00141         double var_L_type_Ca_current__i_CaK = ((((((var_L_type_Ca_current__P_CaK / var_L_type_Ca_current__C_sc) * var_L_type_Ca_current__f * var_L_type_Ca_current__d * var_L_type_Ca_current__f_Ca) / (1.0 + (var_L_type_Ca_current__i_Ca_max / var_L_type_Ca_current__i_Ca_half))) * 1000.0 * var_L_type_Ca_current__V * pow(var_L_type_Ca_current__F, 2.0)) / (var_L_type_Ca_current__R * var_L_type_Ca_current__T)) * ((var_L_type_Ca_current__K_i * exp((var_L_type_Ca_current__V * var_L_type_Ca_current__F) / (var_L_type_Ca_current__R * var_L_type_Ca_current__T))) - var_L_type_Ca_current__K_o)) / (exp((var_L_type_Ca_current__V * var_L_type_Ca_current__F) / (var_L_type_Ca_current__R * var_L_type_Ca_current__T)) - 1.0);
00142         double var_membrane__i_CaK = var_L_type_Ca_current__i_CaK;
00143         double var_rapid_activating_delayed_rectifiyer_K_current__V = var_membrane__V;
00144         double var_rapid_activating_delayed_rectifiyer_K_current__R_V = 1.0 / (1.0 + (2.5 * exp(0.1 * (var_rapid_activating_delayed_rectifiyer_K_current__V + 28.0))));
00145         double var_rapid_activating_delayed_rectifiyer_K_current__X_kr = var_rapid_activating_delayed_rectifiyer_K_current_X_kr_gate__X_kr;
00146         double var_rapid_activating_delayed_rectifiyer_K_current__R = var_membrane__R;
00147         double var_rapid_activating_delayed_rectifiyer_K_current__K_o = var_standard_ionic_concentrations__K_o;
00148         double var_rapid_activating_delayed_rectifiyer_K_current__T = var_membrane__T;
00149         double var_rapid_activating_delayed_rectifiyer_K_current__K_i = var_standard_ionic_concentrations__K_i;
00150         double var_rapid_activating_delayed_rectifiyer_K_current__F = var_membrane__F;
00151         double var_rapid_activating_delayed_rectifiyer_K_current__E_K = ((var_rapid_activating_delayed_rectifiyer_K_current__R * var_rapid_activating_delayed_rectifiyer_K_current__T) / var_rapid_activating_delayed_rectifiyer_K_current__F) * log(var_rapid_activating_delayed_rectifiyer_K_current__K_o / var_rapid_activating_delayed_rectifiyer_K_current__K_i);
00152         const double var_rapid_activating_delayed_rectifiyer_K_current__g_Kr = 0.0136;
00153         double var_rapid_activating_delayed_rectifiyer_K_current__i_Kr = var_rapid_activating_delayed_rectifiyer_K_current__g_Kr * var_rapid_activating_delayed_rectifiyer_K_current__R_V * var_rapid_activating_delayed_rectifiyer_K_current__X_kr * sqrt(var_rapid_activating_delayed_rectifiyer_K_current__K_o / 4.0) * (var_rapid_activating_delayed_rectifiyer_K_current__V - var_rapid_activating_delayed_rectifiyer_K_current__E_K);
00154         double var_membrane__i_Kr = var_rapid_activating_delayed_rectifiyer_K_current__i_Kr;
00155         const double var_slow_activating_delayed_rectifiyer_K_current__g_Ks = 0.0245;
00156         double var_slow_activating_delayed_rectifiyer_K_current__V = var_membrane__V;
00157         double var_slow_activating_delayed_rectifiyer_K_current__K_i = var_standard_ionic_concentrations__K_i;
00158         double var_slow_activating_delayed_rectifiyer_K_current__F = var_membrane__F;
00159         double var_slow_activating_delayed_rectifiyer_K_current__K_o = var_standard_ionic_concentrations__K_o;
00160         double var_slow_activating_delayed_rectifiyer_K_current__T = var_membrane__T;
00161         double var_slow_activating_delayed_rectifiyer_K_current__Na_o = var_standard_ionic_concentrations__Na_o;
00162         double var_slow_activating_delayed_rectifiyer_K_current__R = var_membrane__R;
00163         double var_slow_activating_delayed_rectifiyer_K_current__Na_i = var_standard_ionic_concentrations__Na_i;
00164         double var_slow_activating_delayed_rectifiyer_K_current__E_Ks = ((var_slow_activating_delayed_rectifiyer_K_current__R * var_slow_activating_delayed_rectifiyer_K_current__T) / var_slow_activating_delayed_rectifiyer_K_current__F) * log((var_slow_activating_delayed_rectifiyer_K_current__K_o + (0.01833 * var_slow_activating_delayed_rectifiyer_K_current__Na_o)) / (var_slow_activating_delayed_rectifiyer_K_current__K_i + (0.01833 * var_slow_activating_delayed_rectifiyer_K_current__Na_i)));
00165         double var_slow_activating_delayed_rectifiyer_K_current__X_ks = var_slow_activating_delayed_rectifiyer_K_current_X_ks_gate__X_ks;
00166         double var_slow_activating_delayed_rectifiyer_K_current__i_Ks = var_slow_activating_delayed_rectifiyer_K_current__g_Ks * pow(var_slow_activating_delayed_rectifiyer_K_current__X_ks, 2.0) * (var_slow_activating_delayed_rectifiyer_K_current__V - var_slow_activating_delayed_rectifiyer_K_current__E_Ks);
00167         double var_membrane__i_Ks = var_slow_activating_delayed_rectifiyer_K_current__i_Ks;
00168         const double var_transient_outward_potassium_current__g_to = 0.23815;
00169         double var_transient_outward_potassium_current__V = var_membrane__V;
00170         double var_transient_outward_potassium_current__X_to = var_transient_outward_potassium_current_X_to_gate__X_to;
00171         double var_transient_outward_potassium_current__E_K = var_rapid_activating_delayed_rectifiyer_K_current__E_K;
00172         double var_transient_outward_potassium_current__Y_to = var_transient_outward_potassium_current_Y_to_gate__Y_to;
00173         double var_transient_outward_potassium_current__i_to = var_transient_outward_potassium_current__g_to * var_transient_outward_potassium_current__X_to * var_transient_outward_potassium_current__Y_to * (var_transient_outward_potassium_current__V - var_transient_outward_potassium_current__E_K);
00174         double var_membrane__i_to = var_transient_outward_potassium_current__i_to;
00175         const double var_time_independent_potassium_current__g_K1 = 2.8;
00176         double var_time_independent_potassium_current__F = var_membrane__F;
00177         double var_time_independent_potassium_current_K1_gate__F = var_time_independent_potassium_current__F;
00178         double var_time_independent_potassium_current__V = var_membrane__V;
00179         double var_time_independent_potassium_current_K1_gate__V = var_time_independent_potassium_current__V;
00180         double var_time_independent_potassium_current__T = var_membrane__T;
00181         double var_time_independent_potassium_current_K1_gate__T = var_time_independent_potassium_current__T;
00182         double var_time_independent_potassium_current__R = var_membrane__R;
00183         double var_time_independent_potassium_current_K1_gate__R = var_time_independent_potassium_current__R;
00184         double var_time_independent_potassium_current__E_K = var_rapid_activating_delayed_rectifiyer_K_current__E_K;
00185         double var_time_independent_potassium_current_K1_gate__E_K = var_time_independent_potassium_current__E_K;
00186         double var_time_independent_potassium_current_K1_gate__K1_infinity = 1.0 / (2.0 + exp(((1.62 * var_time_independent_potassium_current_K1_gate__F) / (var_time_independent_potassium_current_K1_gate__R * var_time_independent_potassium_current_K1_gate__T)) * (var_time_independent_potassium_current_K1_gate__V - var_time_independent_potassium_current_K1_gate__E_K)));
00187         double var_time_independent_potassium_current__K1_infinity = var_time_independent_potassium_current_K1_gate__K1_infinity;
00188         double var_time_independent_potassium_current__K_o = var_standard_ionic_concentrations__K_o;
00189         const double var_time_independent_potassium_current__K_mK1 = 13.0;
00190         double var_time_independent_potassium_current__i_K1 = ((var_time_independent_potassium_current__g_K1 * var_time_independent_potassium_current__K1_infinity * var_time_independent_potassium_current__K_o) / (var_time_independent_potassium_current__K_o + var_time_independent_potassium_current__K_mK1)) * (var_time_independent_potassium_current__V - var_time_independent_potassium_current__E_K);
00191         double var_membrane__i_K1 = var_time_independent_potassium_current__i_K1;
00192         double var_plateau_potassium_current__V = var_membrane__V;
00193         double var_plateau_potassium_current__E_K = var_rapid_activating_delayed_rectifiyer_K_current__E_K;
00194         const double var_plateau_potassium_current__g_Kp = 0.002216;
00195         double var_plateau_potassium_current_Kp_gate__V = var_plateau_potassium_current__V;
00196         double var_plateau_potassium_current_Kp_gate__Kp_V = 1.0 / (1.0 + exp((7.488 - var_plateau_potassium_current_Kp_gate__V) / 5.98));
00197         double var_plateau_potassium_current__Kp_V = var_plateau_potassium_current_Kp_gate__Kp_V;
00198         double var_plateau_potassium_current__i_Kp = var_plateau_potassium_current__g_Kp * var_plateau_potassium_current__Kp_V * (var_plateau_potassium_current__V - var_plateau_potassium_current__E_K);
00199         double var_membrane__i_Kp = var_plateau_potassium_current__i_Kp;
00200         double var_Na_Ca_exchanger__Na_o = var_standard_ionic_concentrations__Na_o;
00201         const double var_Na_Ca_exchanger__K_NaCa = 1500.0;
00202         double var_Na_Ca_exchanger__V = var_membrane__V;
00203         double var_Na_Ca_exchanger__Ca_o = var_standard_ionic_concentrations__Ca_o;
00204         const double var_Na_Ca_exchanger__eta = 0.35;
00205         double var_Na_Ca_exchanger__Na_i = var_standard_ionic_concentrations__Na_i;
00206         double var_Na_Ca_exchanger__T = var_membrane__T;
00207         double var_Na_Ca_exchanger__R = var_membrane__R;
00208         const double var_Na_Ca_exchanger__K_sat = 0.2;
00209         const double var_Na_Ca_exchanger__K_mCa = 1380.0;
00210         double var_Na_Ca_exchanger__F = var_membrane__F;
00211         const double var_Na_Ca_exchanger__K_mNa = 87.5;
00212         double var_Na_Ca_exchanger__Ca_i = var_calcium_dynamics__Ca_i;
00213         double var_Na_Ca_exchanger__i_NaCa = (var_Na_Ca_exchanger__K_NaCa / ((pow(var_Na_Ca_exchanger__K_mNa, 3.0) + pow(var_Na_Ca_exchanger__Na_o, 3.0)) * (var_Na_Ca_exchanger__K_mCa + var_Na_Ca_exchanger__Ca_o) * (1.0 + (var_Na_Ca_exchanger__K_sat * exp(((var_Na_Ca_exchanger__eta - 1.0) * var_Na_Ca_exchanger__V * var_Na_Ca_exchanger__F) / (var_Na_Ca_exchanger__R * var_Na_Ca_exchanger__T)))))) * ((exp((var_Na_Ca_exchanger__eta * var_Na_Ca_exchanger__V * var_Na_Ca_exchanger__F) / (var_Na_Ca_exchanger__R * var_Na_Ca_exchanger__T)) * pow(var_Na_Ca_exchanger__Na_i, 3.0) * var_Na_Ca_exchanger__Ca_o) - (exp(((var_Na_Ca_exchanger__eta - 1.0) * var_Na_Ca_exchanger__V * var_Na_Ca_exchanger__F) / (var_Na_Ca_exchanger__R * var_Na_Ca_exchanger__T)) * pow(var_Na_Ca_exchanger__Na_o, 3.0) * var_Na_Ca_exchanger__Ca_i));
00214         double var_membrane__i_NaCa = var_Na_Ca_exchanger__i_NaCa;
00215         double var_sodium_potassium_pump__Na_i = var_standard_ionic_concentrations__Na_i;
00216         double var_sodium_potassium_pump__K_o = var_standard_ionic_concentrations__K_o;
00217         const double var_sodium_potassium_pump__i_NaK_max = 0.693;
00218         const double var_sodium_potassium_pump__K_mNai = 10.0;
00219         double var_sodium_potassium_pump__T = var_membrane__T;
00220         double var_sodium_potassium_pump__R = var_membrane__R;
00221         double var_sodium_potassium_pump__Na_o = var_standard_ionic_concentrations__Na_o;
00222         double var_sodium_potassium_pump__sigma = (1.0 / 7.0) * (exp(var_sodium_potassium_pump__Na_o / 67.3) - 1.0);
00223         double var_sodium_potassium_pump__V = var_membrane__V;
00224         double var_sodium_potassium_pump__F = var_membrane__F;
00225         double var_sodium_potassium_pump__f_NaK = 1.0 / (1.0 + (0.1245 * exp(((-0.1) * var_sodium_potassium_pump__V * var_sodium_potassium_pump__F) / (var_sodium_potassium_pump__R * var_sodium_potassium_pump__T))) + (0.0365 * var_sodium_potassium_pump__sigma * exp(((-var_sodium_potassium_pump__V) * var_sodium_potassium_pump__F) / (var_sodium_potassium_pump__R * var_sodium_potassium_pump__T))));
00226         const double var_sodium_potassium_pump__K_mKo = 1.5;
00227         double var_sodium_potassium_pump__i_NaK = (((var_sodium_potassium_pump__i_NaK_max * var_sodium_potassium_pump__f_NaK) / (1.0 + pow(var_sodium_potassium_pump__K_mNai / var_sodium_potassium_pump__Na_i, 1.5))) * var_sodium_potassium_pump__K_o) / (var_sodium_potassium_pump__K_o + var_sodium_potassium_pump__K_mKo);
00228         double var_membrane__i_NaK = var_sodium_potassium_pump__i_NaK;
00229         const double var_sarcolemmal_calcium_pump__i_pCa_max = 0.05;
00230         double var_sarcolemmal_calcium_pump__Ca_i = var_calcium_dynamics__Ca_i;
00231         const double var_sarcolemmal_calcium_pump__K_mpCa = 0.05;
00232         double var_sarcolemmal_calcium_pump__i_p_Ca = (var_sarcolemmal_calcium_pump__i_pCa_max * var_sarcolemmal_calcium_pump__Ca_i) / (var_sarcolemmal_calcium_pump__K_mpCa + var_sarcolemmal_calcium_pump__Ca_i);
00233         double var_membrane__i_p_Ca = var_sarcolemmal_calcium_pump__i_p_Ca;
00234         const double var_calcium_background_current__g_Cab = 0.0003842;
00235         double var_calcium_background_current__R = var_membrane__R;
00236         double var_calcium_background_current__Ca_i = var_calcium_dynamics__Ca_i;
00237         double var_calcium_background_current__F = var_membrane__F;
00238         double var_calcium_background_current__Ca_o = var_standard_ionic_concentrations__Ca_o;
00239         double var_calcium_background_current__T = var_membrane__T;
00240         double var_calcium_background_current__E_Ca = ((var_calcium_background_current__R * var_calcium_background_current__T) / (2.0 * var_calcium_background_current__F)) * log(var_calcium_background_current__Ca_o / var_calcium_background_current__Ca_i);
00241         double var_calcium_background_current__V = var_membrane__V;
00242         double var_calcium_background_current__i_Ca_b = var_calcium_background_current__g_Cab * (var_calcium_background_current__V - var_calcium_background_current__E_Ca);
00243         double var_membrane__i_Ca_b = var_calcium_background_current__i_Ca_b;
00244         double var_sodium_background_current__V = var_membrane__V;
00245         const double var_sodium_background_current__g_Nab = 0.0031;
00246         double var_sodium_background_current__E_Na = var_fast_sodium_current__E_Na;
00247         double var_sodium_background_current__i_Na_b = var_sodium_background_current__g_Nab * (var_sodium_background_current__V - var_sodium_background_current__E_Na);
00248         double var_membrane__i_Na_b = var_sodium_background_current__i_Na_b;
00249 
00250         return var_membrane__i_Na+var_membrane__i_Ca+var_membrane__i_CaK+var_membrane__i_Kr+var_membrane__i_Ks+var_membrane__i_to+var_membrane__i_K1+var_membrane__i_Kp+var_membrane__i_NaCa+var_membrane__i_NaK+var_membrane__i_p_Ca+var_membrane__i_Ca_b+var_membrane__i_Na_b;
00251     }
00252 
00253     void ComputeResidual(const double rCurrentGuess[3], double rResidual[3])
00254     {
00255         std::vector<double>& rY = rGetStateVariables();
00256         double var_membrane__V = rY[0];
00257         // Units: millivolt; Initial value: -94.7
00258         // Units: dimensionless; Initial value: 1
00259         double var_L_type_Ca_current_f_gate__f = rY[8];
00260         // Units: dimensionless; Initial value: 0.983
00261         double var_L_type_Ca_current_d_gate__d = rY[9];
00262         // Units: dimensionless; Initial value: 0.0001
00263 
00264         double var_L_type_Ca_current_f_Ca_gate__f_Ca = rCurrentGuess[0];
00265         double var_calcium_dynamics__Ca_SR = rCurrentGuess[1];
00266         double var_calcium_dynamics__Ca_i = rCurrentGuess[2];
00267 
00268         const double var_membrane__R = 8.314;
00269         const double var_membrane__T = 310.0;
00270         const double var_membrane__F = 96.5;
00271         const double var_standard_ionic_concentrations__Na_i = 10.0;
00272         const double var_standard_ionic_concentrations__Na_o = 138.0;
00273         const double var_L_type_Ca_current__P_Ca = 1.26e-05; //2.26e-05;
00274         double var_L_type_Ca_current__V = var_membrane__V;
00275         const double var_standard_ionic_concentrations__Ca_o = 2000.0;
00276         double var_L_type_Ca_current__Ca_o = var_standard_ionic_concentrations__Ca_o;
00277         double var_L_type_Ca_current__T = var_membrane__T;
00278         const double var_L_type_Ca_current__C_sc = 1.0;
00279         double var_L_type_Ca_current__Ca_i = var_calcium_dynamics__Ca_i;
00280         double var_L_type_Ca_current__R = var_membrane__R;
00281         double var_L_type_Ca_current__F = var_membrane__F;
00282         double var_L_type_Ca_current__i_Ca_max = ((((var_L_type_Ca_current__P_Ca / var_L_type_Ca_current__C_sc) * 4.0 * var_L_type_Ca_current__V * pow(var_L_type_Ca_current__F, 2.0)) / (var_L_type_Ca_current__R * var_L_type_Ca_current__T)) * ((var_L_type_Ca_current__Ca_i * exp((2.0 * var_L_type_Ca_current__V * var_L_type_Ca_current__F) / (var_L_type_Ca_current__R * var_L_type_Ca_current__T))) - (0.341 * var_L_type_Ca_current__Ca_o))) / (exp((2.0 * var_L_type_Ca_current__V * var_L_type_Ca_current__F) / (var_L_type_Ca_current__R * var_L_type_Ca_current__T)) - 1.0);
00283         double var_L_type_Ca_current__d = var_L_type_Ca_current_d_gate__d;
00284         double var_L_type_Ca_current__f = var_L_type_Ca_current_f_gate__f;
00285         double var_L_type_Ca_current__f_Ca = var_L_type_Ca_current_f_Ca_gate__f_Ca;
00286         double var_L_type_Ca_current__i_Ca = var_L_type_Ca_current__i_Ca_max * var_L_type_Ca_current__f * var_L_type_Ca_current__d * var_L_type_Ca_current__f_Ca;
00287         double var_Na_Ca_exchanger__Na_o = var_standard_ionic_concentrations__Na_o;
00288         const double var_Na_Ca_exchanger__K_NaCa = 1500.0;
00289         double var_Na_Ca_exchanger__V = var_membrane__V;
00290         double var_Na_Ca_exchanger__Ca_o = var_standard_ionic_concentrations__Ca_o;
00291         const double var_Na_Ca_exchanger__eta = 0.35;
00292         double var_Na_Ca_exchanger__Na_i = var_standard_ionic_concentrations__Na_i;
00293         double var_Na_Ca_exchanger__T = var_membrane__T;
00294         double var_Na_Ca_exchanger__R = var_membrane__R;
00295         const double var_Na_Ca_exchanger__K_sat = 0.2;
00296         const double var_Na_Ca_exchanger__K_mCa = 1380.0;
00297         double var_Na_Ca_exchanger__F = var_membrane__F;
00298         const double var_Na_Ca_exchanger__K_mNa = 87.5;
00299         double var_Na_Ca_exchanger__Ca_i = var_calcium_dynamics__Ca_i;
00300         double var_Na_Ca_exchanger__i_NaCa = (var_Na_Ca_exchanger__K_NaCa / ((pow(var_Na_Ca_exchanger__K_mNa, 3.0) + pow(var_Na_Ca_exchanger__Na_o, 3.0)) * (var_Na_Ca_exchanger__K_mCa + var_Na_Ca_exchanger__Ca_o) * (1.0 + (var_Na_Ca_exchanger__K_sat * exp(((var_Na_Ca_exchanger__eta - 1.0) * var_Na_Ca_exchanger__V * var_Na_Ca_exchanger__F) / (var_Na_Ca_exchanger__R * var_Na_Ca_exchanger__T)))))) * ((exp((var_Na_Ca_exchanger__eta * var_Na_Ca_exchanger__V * var_Na_Ca_exchanger__F) / (var_Na_Ca_exchanger__R * var_Na_Ca_exchanger__T)) * pow(var_Na_Ca_exchanger__Na_i, 3.0) * var_Na_Ca_exchanger__Ca_o) - (exp(((var_Na_Ca_exchanger__eta - 1.0) * var_Na_Ca_exchanger__V * var_Na_Ca_exchanger__F) / (var_Na_Ca_exchanger__R * var_Na_Ca_exchanger__T)) * pow(var_Na_Ca_exchanger__Na_o, 3.0) * var_Na_Ca_exchanger__Ca_i));
00301         const double var_sarcolemmal_calcium_pump__i_pCa_max = 0.05;
00302         double var_sarcolemmal_calcium_pump__Ca_i = var_calcium_dynamics__Ca_i;
00303         const double var_sarcolemmal_calcium_pump__K_mpCa = 0.05;
00304         double var_sarcolemmal_calcium_pump__i_p_Ca = (var_sarcolemmal_calcium_pump__i_pCa_max * var_sarcolemmal_calcium_pump__Ca_i) / (var_sarcolemmal_calcium_pump__K_mpCa + var_sarcolemmal_calcium_pump__Ca_i);
00305         const double var_calcium_background_current__g_Cab = 0.0003842;
00306         double var_calcium_background_current__R = var_membrane__R;
00307         double var_calcium_background_current__Ca_i = var_calcium_dynamics__Ca_i;
00308         double var_calcium_background_current__F = var_membrane__F;
00309         double var_calcium_background_current__Ca_o = var_standard_ionic_concentrations__Ca_o;
00310         double var_calcium_background_current__T = var_membrane__T;
00311         double var_calcium_background_current__E_Ca = ((var_calcium_background_current__R * var_calcium_background_current__T) / (2.0 * var_calcium_background_current__F)) * log(var_calcium_background_current__Ca_o / var_calcium_background_current__Ca_i);
00312         double var_calcium_background_current__V = var_membrane__V;
00313         double var_calcium_background_current__i_Ca_b = var_calcium_background_current__g_Cab * (var_calcium_background_current__V - var_calcium_background_current__E_Ca);
00314         double var_L_type_Ca_current_f_Ca_gate__tau_f_Ca = 30.0;
00315         double var_L_type_Ca_current_f_Ca_gate__Ca_i = var_L_type_Ca_current__Ca_i;
00316         const double var_L_type_Ca_current_f_Ca_gate__K_mfCa = 0.18;
00317         double var_L_type_Ca_current_f_Ca_gate__f_Ca_infinity = 1.0 / (1.0 + pow(var_L_type_Ca_current_f_Ca_gate__Ca_i / var_L_type_Ca_current_f_Ca_gate__K_mfCa, 3.0));
00318         const double var_calcium_dynamics__K_mCMDN = 2.0;
00319         const double var_calcium_dynamics__CMDN_tot = 10.0;
00320         double var_calcium_dynamics__beta_i = 1.0 / (1.0 + ((var_calcium_dynamics__CMDN_tot * var_calcium_dynamics__K_mCMDN) / pow(var_calcium_dynamics__K_mCMDN + var_calcium_dynamics__Ca_i, 2.0)));
00321         const double var_calcium_dynamics__V_myo = 2.584e-05;
00322         double var_calcium_dynamics__F = var_membrane__F;
00323         double var_calcium_dynamics__C_sc = var_L_type_Ca_current__C_sc;
00324         const double var_calcium_dynamics__A_Cap = 0.0001534;
00325         double var_calcium_dynamics__d = var_L_type_Ca_current__d;
00326         double var_calcium_dynamics__V = var_membrane__V;
00327         const double var_calcium_dynamics__P_rel = 6.0;
00328         double var_calcium_dynamics__gamma = 1.0 / (1.0 + pow(2000.0 / var_calcium_dynamics__Ca_SR, 3.0));
00329         double var_calcium_dynamics__f = var_L_type_Ca_current__f;
00330         double var_calcium_dynamics__f_Ca = var_L_type_Ca_current__f_Ca;
00331         double var_calcium_dynamics__J_rel = (var_calcium_dynamics__P_rel * var_calcium_dynamics__f * var_calcium_dynamics__d * var_calcium_dynamics__f_Ca * ((var_calcium_dynamics__gamma * var_calcium_dynamics__Ca_SR) - var_calcium_dynamics__Ca_i)) / (1.0 + (1.65 * exp(var_calcium_dynamics__V / 20.0)));
00332         const double var_calcium_dynamics__P_leak = 1e-06;
00333         double var_calcium_dynamics__J_leak = var_calcium_dynamics__P_leak * (var_calcium_dynamics__Ca_SR - var_calcium_dynamics__Ca_i);
00334         const double var_calcium_dynamics__V_up = 0.1;
00335         const double var_calcium_dynamics__K_mup = 0.32;
00336         double var_calcium_dynamics__J_up = var_calcium_dynamics__V_up / (1.0 + pow(var_calcium_dynamics__K_mup / var_calcium_dynamics__Ca_i, 2.0));
00337         double var_calcium_dynamics__i_Ca = var_L_type_Ca_current__i_Ca;
00338         double var_calcium_dynamics__i_Ca_b = var_calcium_background_current__i_Ca_b;
00339         double var_calcium_dynamics__i_p_Ca = var_sarcolemmal_calcium_pump__i_p_Ca;
00340         double var_calcium_dynamics__i_NaCa = var_Na_Ca_exchanger__i_NaCa;
00341         const double var_calcium_dynamics__K_mCSQN = 600.0;
00342         const double var_calcium_dynamics__CSQN_tot = 10000.0;
00343         const double var_calcium_dynamics__V_SR = 2e-06;
00344         double var_calcium_dynamics__beta_SR = 1.0 / (1.0 + ((var_calcium_dynamics__CSQN_tot * var_calcium_dynamics__K_mCSQN) / pow(var_calcium_dynamics__K_mCSQN + var_calcium_dynamics__Ca_SR, 2.0)));
00345         double d_dt_L_type_Ca_current_f_Ca_gate__f_Ca = (var_L_type_Ca_current_f_Ca_gate__f_Ca_infinity - var_L_type_Ca_current_f_Ca_gate__f_Ca) / var_L_type_Ca_current_f_Ca_gate__tau_f_Ca;
00346         double d_dt_calcium_dynamics__Ca_SR = (var_calcium_dynamics__beta_SR * ((var_calcium_dynamics__J_up - var_calcium_dynamics__J_leak) - var_calcium_dynamics__J_rel) * var_calcium_dynamics__V_myo) / var_calcium_dynamics__V_SR;
00347         double d_dt_calcium_dynamics__Ca_i = var_calcium_dynamics__beta_i * (((var_calcium_dynamics__J_rel + var_calcium_dynamics__J_leak) - var_calcium_dynamics__J_up) - (((var_calcium_dynamics__A_Cap * var_calcium_dynamics__C_sc) / (2.0 * var_calcium_dynamics__F * var_calcium_dynamics__V_myo)) * ((var_calcium_dynamics__i_Ca + var_calcium_dynamics__i_Ca_b + var_calcium_dynamics__i_p_Ca) - (2.0 * var_calcium_dynamics__i_NaCa))));
00348 
00349         rResidual[0] = rCurrentGuess[0] - rY[10] - mDt*d_dt_L_type_Ca_current_f_Ca_gate__f_Ca;
00350         rResidual[2] = rCurrentGuess[2] - rY[11] - mDt*d_dt_calcium_dynamics__Ca_i;
00351         rResidual[1] = rCurrentGuess[1] - rY[12] - mDt*d_dt_calcium_dynamics__Ca_SR;
00352     }
00353 
00354     void ComputeJacobian(const double rCurrentGuess[3], double rJacobian[3][3])
00355     {
00356         std::vector<double>& rY = rGetStateVariables();
00357         double var_membrane__V = rY[0];
00358         // Units: millivolt; Initial value: -94.7
00359         double var_L_type_Ca_current_f_gate__f = rY[8];
00360         // Units: dimensionless; Initial value: 0.983
00361         double var_L_type_Ca_current_d_gate__d = rY[9];
00362         // Units: dimensionless; Initial value: 0.0001
00363 
00364         double var_L_type_Ca_current_f_Ca_gate__f_Ca = rCurrentGuess[0];
00365         double var_calcium_dynamics__Ca_SR = rCurrentGuess[1];
00366         double var_calcium_dynamics__Ca_i = rCurrentGuess[2];
00367 
00368         const double var_membrane__R = 8.314;
00369         const double var_membrane__T = 310.0;
00370         const double var_membrane__F = 96.5;
00371         const double var_standard_ionic_concentrations__Na_i = 10.0;
00372         const double var_standard_ionic_concentrations__Na_o = 138.0;
00373         const double var_L_type_Ca_current__P_Ca = 1.26e-05; //2.26e-05;
00374         const double var_standard_ionic_concentrations__Ca_o = 2000.0;
00375         const double var_L_type_Ca_current__C_sc = 1.0;
00376         const double var_Na_Ca_exchanger__K_NaCa = 1500.0;
00377         const double var_Na_Ca_exchanger__eta = 0.35;
00378         const double var_Na_Ca_exchanger__K_sat = 0.2;
00379         const double var_Na_Ca_exchanger__K_mCa = 1380.0;
00380         const double var_Na_Ca_exchanger__K_mNa = 87.5;
00381         const double var_sarcolemmal_calcium_pump__i_pCa_max = 0.05;
00382         const double var_sarcolemmal_calcium_pump__K_mpCa = 0.05;
00383         const double var_calcium_background_current__g_Cab = 0.0003842;
00384         const double var_L_type_Ca_current_f_Ca_gate__K_mfCa = 0.18;
00385         const double var_calcium_dynamics__K_mCMDN = 2.0;
00386         const double var_calcium_dynamics__CMDN_tot = 10.0;
00387         const double var_calcium_dynamics__V_myo = 2.584e-05;
00388         const double var_calcium_dynamics__A_Cap = 0.0001534;
00389         const double var_calcium_dynamics__P_rel = 6.0;
00390         const double var_calcium_dynamics__P_leak = 1e-06;
00391         const double var_calcium_dynamics__V_up = 0.1;
00392         const double var_calcium_dynamics__K_mup = 0.32;
00393         const double var_calcium_dynamics__K_mCSQN = 600.0;
00394         const double var_calcium_dynamics__CSQN_tot = 10000.0;
00395         const double var_calcium_dynamics__V_SR = 2e-06;
00396 
00397         rJacobian[0][0] = 1.0 + ((1.0 / 30.0) * mDt);
00398         rJacobian[0][1] = 0.0;
00399         rJacobian[0][2] = ((((1.0 / 10.0) * mDt) / pow(1.0 + (pow(var_calcium_dynamics__Ca_i, 3.0) / pow(var_L_type_Ca_current_f_Ca_gate__K_mfCa, 3.0)), 2.0)) * pow(var_calcium_dynamics__Ca_i, 2.0)) / pow(var_L_type_Ca_current_f_Ca_gate__K_mfCa, 3.0);
00400         rJacobian[1][0] = (((((((mDt / (1.0 + ((var_calcium_dynamics__CSQN_tot * var_calcium_dynamics__K_mCSQN) / pow(var_calcium_dynamics__K_mCSQN + var_calcium_dynamics__Ca_SR, 2.0)))) * var_calcium_dynamics__P_rel) * var_L_type_Ca_current_f_gate__f) * var_L_type_Ca_current_d_gate__d) * (((1.0 / (1.0 + (8000000000.0 / pow(var_calcium_dynamics__Ca_SR, 3.0)))) * var_calcium_dynamics__Ca_SR) - var_calcium_dynamics__Ca_i)) / (1.0 + (1.65 * exp((1.0 / 20.0) * var_membrane__V)))) * var_calcium_dynamics__V_myo) / var_calcium_dynamics__V_SR;
00401         rJacobian[1][1] = (1.0 - ((((((((2.0 * mDt) / pow(1.0 + ((var_calcium_dynamics__CSQN_tot * var_calcium_dynamics__K_mCSQN) / pow(var_calcium_dynamics__K_mCSQN + var_calcium_dynamics__Ca_SR, 2.0)), 2.0)) * (((var_calcium_dynamics__V_up / (1.0 + (pow(var_calcium_dynamics__K_mup, 2.0) / pow(var_calcium_dynamics__Ca_i, 2.0)))) - (var_calcium_dynamics__P_leak * (var_calcium_dynamics__Ca_SR - var_calcium_dynamics__Ca_i))) - (((((var_calcium_dynamics__P_rel * var_L_type_Ca_current_f_gate__f) * var_L_type_Ca_current_d_gate__d) * var_L_type_Ca_current_f_Ca_gate__f_Ca) * (((1.0 / (1.0 + (8000000000.0 / pow(var_calcium_dynamics__Ca_SR, 3.0)))) * var_calcium_dynamics__Ca_SR) - var_calcium_dynamics__Ca_i)) / (1.0 + (1.65 * exp((1.0 / 20.0) * var_membrane__V)))))) * var_calcium_dynamics__V_myo) / var_calcium_dynamics__V_SR) * var_calcium_dynamics__CSQN_tot) * var_calcium_dynamics__K_mCSQN) / pow(var_calcium_dynamics__K_mCSQN + var_calcium_dynamics__Ca_SR, 3.0))) - ((((mDt / (1.0 + ((var_calcium_dynamics__CSQN_tot * var_calcium_dynamics__K_mCSQN) / pow(var_calcium_dynamics__K_mCSQN + var_calcium_dynamics__Ca_SR, 2.0)))) * ((-var_calcium_dynamics__P_leak) - (((((var_calcium_dynamics__P_rel * var_L_type_Ca_current_f_gate__f) * var_L_type_Ca_current_d_gate__d) * var_L_type_Ca_current_f_Ca_gate__f_Ca) * (((24000000000.0 / pow(1.0 + (8000000000.0 / pow(var_calcium_dynamics__Ca_SR, 3.0)), 2.0)) / pow(var_calcium_dynamics__Ca_SR, 3.0)) + (1.0 / (1.0 + (8000000000.0 / pow(var_calcium_dynamics__Ca_SR, 3.0)))))) / (1.0 + (1.65 * exp((1.0 / 20.0) * var_membrane__V)))))) * var_calcium_dynamics__V_myo) / var_calcium_dynamics__V_SR);
00402         rJacobian[1][2] = ((((-mDt) / (1.0 + ((var_calcium_dynamics__CSQN_tot * var_calcium_dynamics__K_mCSQN) / pow(var_calcium_dynamics__K_mCSQN + var_calcium_dynamics__Ca_SR, 2.0)))) * ((((((2.0 * var_calcium_dynamics__V_up) / pow(1.0 + (pow(var_calcium_dynamics__K_mup, 2.0) / pow(var_calcium_dynamics__Ca_i, 2.0)), 2.0)) * pow(var_calcium_dynamics__K_mup, 2.0)) / pow(var_calcium_dynamics__Ca_i, 3.0)) + var_calcium_dynamics__P_leak) + ((((var_calcium_dynamics__P_rel * var_L_type_Ca_current_f_gate__f) * var_L_type_Ca_current_d_gate__d) * var_L_type_Ca_current_f_Ca_gate__f_Ca) / (1.0 + (1.65 * exp((1.0 / 20.0) * var_membrane__V)))))) * var_calcium_dynamics__V_myo) / var_calcium_dynamics__V_SR;
00403         rJacobian[2][0] = ((-mDt) / (1.0 + ((var_calcium_dynamics__CMDN_tot * var_calcium_dynamics__K_mCMDN) / pow(var_calcium_dynamics__K_mCMDN + var_calcium_dynamics__Ca_i, 2.0)))) * (((((var_calcium_dynamics__P_rel * var_L_type_Ca_current_f_gate__f) * var_L_type_Ca_current_d_gate__d) * (((1.0 / (1.0 + (8000000000.0 / pow(var_calcium_dynamics__Ca_SR, 3.0)))) * var_calcium_dynamics__Ca_SR) - var_calcium_dynamics__Ca_i)) / (1.0 + (1.65 * exp((1.0 / 20.0) * var_membrane__V)))) - (((((((((((2.0 * var_calcium_dynamics__A_Cap) * var_membrane__F) / var_calcium_dynamics__V_myo) * var_L_type_Ca_current__P_Ca) * var_membrane__V) / var_membrane__R) / var_membrane__T) * ((var_calcium_dynamics__Ca_i * exp((((2.0 * var_membrane__V) * var_membrane__F) / var_membrane__R) / var_membrane__T)) - (0.341 * var_standard_ionic_concentrations__Ca_o))) / (exp((((2.0 * var_membrane__V) * var_membrane__F) / var_membrane__R) / var_membrane__T) - 1.0)) * var_L_type_Ca_current_f_gate__f) * var_L_type_Ca_current_d_gate__d));
00404         rJacobian[2][1] = ((-mDt) / (1.0 + ((var_calcium_dynamics__CMDN_tot * var_calcium_dynamics__K_mCMDN) / pow(var_calcium_dynamics__K_mCMDN + var_calcium_dynamics__Ca_i, 2.0)))) * ((((((var_calcium_dynamics__P_rel * var_L_type_Ca_current_f_gate__f) * var_L_type_Ca_current_d_gate__d) * var_L_type_Ca_current_f_Ca_gate__f_Ca) * (((24000000000.0 / pow(1.0 + (8000000000.0 / pow(var_calcium_dynamics__Ca_SR, 3.0)), 2.0)) / pow(var_calcium_dynamics__Ca_SR, 3.0)) + (1.0 / (1.0 + (8000000000.0 / pow(var_calcium_dynamics__Ca_SR, 3.0)))))) / (1.0 + (1.65 * exp((1.0 / 20.0) * var_membrane__V)))) + var_calcium_dynamics__P_leak);
00405         rJacobian[2][2] = (1.0 - ((((((2.0 * mDt) / pow(1.0 + ((var_calcium_dynamics__CMDN_tot * var_calcium_dynamics__K_mCMDN) / pow(var_calcium_dynamics__K_mCMDN + var_calcium_dynamics__Ca_i, 2.0)), 2.0)) * ((((((((var_calcium_dynamics__P_rel * var_L_type_Ca_current_f_gate__f) * var_L_type_Ca_current_d_gate__d) * var_L_type_Ca_current_f_Ca_gate__f_Ca) * (((1.0 / (1.0 + (8000000000.0 / pow(var_calcium_dynamics__Ca_SR, 3.0)))) * var_calcium_dynamics__Ca_SR) - var_calcium_dynamics__Ca_i)) / (1.0 + (1.65 * exp((1.0 / 20.0) * var_membrane__V)))) + (var_calcium_dynamics__P_leak * (var_calcium_dynamics__Ca_SR - var_calcium_dynamics__Ca_i))) - (var_calcium_dynamics__V_up / (1.0 + (pow(var_calcium_dynamics__K_mup, 2.0) / pow(var_calcium_dynamics__Ca_i, 2.0))))) - ((((((1.0 / 2.0) * var_calcium_dynamics__A_Cap) * var_L_type_Ca_current__C_sc) / var_membrane__F) / var_calcium_dynamics__V_myo) * ((((((((((((((4.0 * var_L_type_Ca_current__P_Ca) / var_L_type_Ca_current__C_sc) * var_membrane__V) * pow(var_membrane__F, 2.0)) / var_membrane__R) / var_membrane__T) * ((var_calcium_dynamics__Ca_i * exp((((2.0 * var_membrane__V) * var_membrane__F) / var_membrane__R) / var_membrane__T)) - (0.341 * var_standard_ionic_concentrations__Ca_o))) / (exp((((2.0 * var_membrane__V) * var_membrane__F) / var_membrane__R) / var_membrane__T) - 1.0)) * var_L_type_Ca_current_f_gate__f) * var_L_type_Ca_current_d_gate__d) * var_L_type_Ca_current_f_Ca_gate__f_Ca) + (var_calcium_background_current__g_Cab * (var_membrane__V - (((((1.0 / 2.0) * var_membrane__R) * var_membrane__T) / var_membrane__F) * log(var_standard_ionic_concentrations__Ca_o / var_calcium_dynamics__Ca_i))))) + ((var_sarcolemmal_calcium_pump__i_pCa_max * var_calcium_dynamics__Ca_i) / (var_sarcolemmal_calcium_pump__K_mpCa + var_calcium_dynamics__Ca_i))) - (((((2.0 * var_Na_Ca_exchanger__K_NaCa) / (pow(var_Na_Ca_exchanger__K_mNa, 3.0) + pow(var_standard_ionic_concentrations__Na_o, 3.0))) / (var_Na_Ca_exchanger__K_mCa + var_standard_ionic_concentrations__Ca_o)) / (1.0 + (var_Na_Ca_exchanger__K_sat * exp(((((var_Na_Ca_exchanger__eta - 1.0) * var_membrane__V) * var_membrane__F) / var_membrane__R) / var_membrane__T)))) * (((exp((((var_Na_Ca_exchanger__eta * var_membrane__V) * var_membrane__F) / var_membrane__R) / var_membrane__T) * pow(var_standard_ionic_concentrations__Na_i, 3.0)) * var_standard_ionic_concentrations__Ca_o) - ((exp(((((var_Na_Ca_exchanger__eta - 1.0) * var_membrane__V) * var_membrane__F) / var_membrane__R) / var_membrane__T) * pow(var_standard_ionic_concentrations__Na_o, 3.0)) * var_calcium_dynamics__Ca_i))))))) * var_calcium_dynamics__CMDN_tot) * var_calcium_dynamics__K_mCMDN) / pow(var_calcium_dynamics__K_mCMDN + var_calcium_dynamics__Ca_i, 3.0))) - ((mDt / (1.0 + ((var_calcium_dynamics__CMDN_tot * var_calcium_dynamics__K_mCMDN) / pow(var_calcium_dynamics__K_mCMDN + var_calcium_dynamics__Ca_i, 2.0)))) * ((((((((-var_calcium_dynamics__P_rel) * var_L_type_Ca_current_f_gate__f) * var_L_type_Ca_current_d_gate__d) * var_L_type_Ca_current_f_Ca_gate__f_Ca) / (1.0 + (1.65 * exp((1.0 / 20.0) * var_membrane__V)))) - var_calcium_dynamics__P_leak) - ((((2.0 * var_calcium_dynamics__V_up) / pow(1.0 + (pow(var_calcium_dynamics__K_mup, 2.0) / pow(var_calcium_dynamics__Ca_i, 2.0)), 2.0)) * pow(var_calcium_dynamics__K_mup, 2.0)) / pow(var_calcium_dynamics__Ca_i, 3.0))) - ((((((1.0 / 2.0) * var_calcium_dynamics__A_Cap) * var_L_type_Ca_current__C_sc) / var_membrane__F) / var_calcium_dynamics__V_myo) * (((((((((((((((4.0 * var_L_type_Ca_current__P_Ca) / var_L_type_Ca_current__C_sc) * var_membrane__V) * pow(var_membrane__F, 2.0)) / var_membrane__R) / var_membrane__T) * exp((((2.0 * var_membrane__V) * var_membrane__F) / var_membrane__R) / var_membrane__T)) / (exp((((2.0 * var_membrane__V) * var_membrane__F) / var_membrane__R) / var_membrane__T) - 1.0)) * var_L_type_Ca_current_f_gate__f) * var_L_type_Ca_current_d_gate__d) * var_L_type_Ca_current_f_Ca_gate__f_Ca) + ((((((1.0 / 2.0) * var_calcium_background_current__g_Cab) * var_membrane__R) * var_membrane__T) / var_membrane__F) / var_calcium_dynamics__Ca_i)) + (var_sarcolemmal_calcium_pump__i_pCa_max / (var_sarcolemmal_calcium_pump__K_mpCa + var_calcium_dynamics__Ca_i))) - ((var_sarcolemmal_calcium_pump__i_pCa_max * var_calcium_dynamics__Ca_i) / pow(var_sarcolemmal_calcium_pump__K_mpCa + var_calcium_dynamics__Ca_i, 2.0))) + ((((((2.0 * var_Na_Ca_exchanger__K_NaCa) / (pow(var_Na_Ca_exchanger__K_mNa, 3.0) + pow(var_standard_ionic_concentrations__Na_o, 3.0))) / (var_Na_Ca_exchanger__K_mCa + var_standard_ionic_concentrations__Ca_o)) / (1.0 + (var_Na_Ca_exchanger__K_sat * exp(((((var_Na_Ca_exchanger__eta - 1.0) * var_membrane__V) * var_membrane__F) / var_membrane__R) / var_membrane__T)))) * exp(((((var_Na_Ca_exchanger__eta - 1.0) * var_membrane__V) * var_membrane__F) / var_membrane__R) / var_membrane__T)) * pow(var_standard_ionic_concentrations__Na_o, 3.0))))));
00406     }
00407 
00408 protected:
00409     void UpdateTransmembranePotential(double var_environment__time)
00410     {
00411         // Time units: millisecond
00412         std::vector<double>& rY = rGetStateVariables();
00413         double var_membrane__V = rY[0];
00414         // Units: millivolt; Initial value: -94.7
00415         double var_fast_sodium_current_m_gate__m = rY[1];
00416         // Units: dimensionless; Initial value: 0.00024676
00417         double var_fast_sodium_current_h_gate__h = rY[2];
00418         // Units: dimensionless; Initial value: 0.99869
00419         double var_fast_sodium_current_j_gate__j = rY[3];
00420         // Units: dimensionless; Initial value: 0.99887
00421         double var_rapid_activating_delayed_rectifiyer_K_current_X_kr_gate__X_kr = rY[4];
00422         // Units: dimensionless; Initial value: 0.229
00423         double var_slow_activating_delayed_rectifiyer_K_current_X_ks_gate__X_ks = rY[5];
00424         // Units: dimensionless; Initial value: 0.0001
00425         double var_transient_outward_potassium_current_X_to_gate__X_to = rY[6];
00426         // Units: dimensionless; Initial value: 0.00003742
00427         double var_transient_outward_potassium_current_Y_to_gate__Y_to = rY[7];
00428         // Units: dimensionless; Initial value: 1
00429         double var_L_type_Ca_current_f_gate__f = rY[8];
00430         // Units: dimensionless; Initial value: 0.983
00431         double var_L_type_Ca_current_d_gate__d = rY[9];
00432         // Units: dimensionless; Initial value: 0.0001
00433         double var_L_type_Ca_current_f_Ca_gate__f_Ca = rY[10];
00434         // Units: dimensionless; Initial value: 0.942
00435         double var_calcium_dynamics__Ca_i = rY[11];
00436         // Units: micromolar; Initial value: 0.0472
00437 
00438         const double var_membrane__R = 8.314;
00439         const double var_membrane__T = 310.0;
00440         const double var_membrane__F = 96.5;
00441         double var_membrane__time = var_environment__time;
00442         double var_fast_sodium_current__h = var_fast_sodium_current_h_gate__h;
00443         const double var_fast_sodium_current__g_Na = 12.8;
00444         double var_fast_sodium_current__j = var_fast_sodium_current_j_gate__j;
00445         double var_fast_sodium_current__T = var_membrane__T;
00446         double var_fast_sodium_current__R = var_membrane__R;
00447         const double var_standard_ionic_concentrations__Na_i = 10.0;
00448         double var_fast_sodium_current__Na_i = var_standard_ionic_concentrations__Na_i;
00449         const double var_standard_ionic_concentrations__Na_o = 138.0;
00450         double var_fast_sodium_current__Na_o = var_standard_ionic_concentrations__Na_o;
00451         double var_fast_sodium_current__F = var_membrane__F;
00452         double var_fast_sodium_current__E_Na = ((var_fast_sodium_current__R * var_fast_sodium_current__T) / var_fast_sodium_current__F) * log(var_fast_sodium_current__Na_o / var_fast_sodium_current__Na_i);
00453         double var_fast_sodium_current__V = var_membrane__V;
00454         double var_fast_sodium_current__m = var_fast_sodium_current_m_gate__m;
00455         double var_fast_sodium_current__i_Na = var_fast_sodium_current__g_Na * pow(var_fast_sodium_current__m, 3.0) * var_fast_sodium_current__h * var_fast_sodium_current__j * (var_fast_sodium_current__V - var_fast_sodium_current__E_Na);
00456         double var_membrane__i_Na = var_fast_sodium_current__i_Na;
00457         const double var_L_type_Ca_current__P_Ca = 1.26e-05; //2.26e-05;
00458         double var_L_type_Ca_current__V = var_membrane__V;
00459         const double var_standard_ionic_concentrations__Ca_o = 2000.0;
00460         double var_L_type_Ca_current__Ca_o = var_standard_ionic_concentrations__Ca_o;
00461         double var_L_type_Ca_current__T = var_membrane__T;
00462         const double var_L_type_Ca_current__C_sc = 1.0;
00463         double var_L_type_Ca_current__Ca_i = var_calcium_dynamics__Ca_i;
00464         double var_L_type_Ca_current__R = var_membrane__R;
00465         double var_L_type_Ca_current__F = var_membrane__F;
00466         double var_L_type_Ca_current__i_Ca_max = ((((var_L_type_Ca_current__P_Ca / var_L_type_Ca_current__C_sc) * 4.0 * var_L_type_Ca_current__V * pow(var_L_type_Ca_current__F, 2.0)) / (var_L_type_Ca_current__R * var_L_type_Ca_current__T)) * ((var_L_type_Ca_current__Ca_i * exp((2.0 * var_L_type_Ca_current__V * var_L_type_Ca_current__F) / (var_L_type_Ca_current__R * var_L_type_Ca_current__T))) - (0.341 * var_L_type_Ca_current__Ca_o))) / (exp((2.0 * var_L_type_Ca_current__V * var_L_type_Ca_current__F) / (var_L_type_Ca_current__R * var_L_type_Ca_current__T)) - 1.0);
00467         double var_L_type_Ca_current__d = var_L_type_Ca_current_d_gate__d;
00468         double var_L_type_Ca_current__f = var_L_type_Ca_current_f_gate__f;
00469         double var_L_type_Ca_current__f_Ca = var_L_type_Ca_current_f_Ca_gate__f_Ca;
00470         double var_L_type_Ca_current__i_Ca = var_L_type_Ca_current__i_Ca_max * var_L_type_Ca_current__f * var_L_type_Ca_current__d * var_L_type_Ca_current__f_Ca;
00471         double var_membrane__i_Ca = var_L_type_Ca_current__i_Ca;
00472         const double var_standard_ionic_concentrations__K_o = 4.0;
00473         double var_L_type_Ca_current__K_o = var_standard_ionic_concentrations__K_o;
00474         const double var_L_type_Ca_current__i_Ca_half =  -0.265;
00475         const double var_L_type_Ca_current__P_CaK = 5.79e-07;
00476         const double var_standard_ionic_concentrations__K_i = 149.4;
00477         double var_L_type_Ca_current__K_i = var_standard_ionic_concentrations__K_i;
00478         double var_L_type_Ca_current__i_CaK = ((((((var_L_type_Ca_current__P_CaK / var_L_type_Ca_current__C_sc) * var_L_type_Ca_current__f * var_L_type_Ca_current__d * var_L_type_Ca_current__f_Ca) / (1.0 + (var_L_type_Ca_current__i_Ca_max / var_L_type_Ca_current__i_Ca_half))) * 1000.0 * var_L_type_Ca_current__V * pow(var_L_type_Ca_current__F, 2.0)) / (var_L_type_Ca_current__R * var_L_type_Ca_current__T)) * ((var_L_type_Ca_current__K_i * exp((var_L_type_Ca_current__V * var_L_type_Ca_current__F) / (var_L_type_Ca_current__R * var_L_type_Ca_current__T))) - var_L_type_Ca_current__K_o)) / (exp((var_L_type_Ca_current__V * var_L_type_Ca_current__F) / (var_L_type_Ca_current__R * var_L_type_Ca_current__T)) - 1.0);
00479         double var_membrane__i_CaK = var_L_type_Ca_current__i_CaK;
00480         double var_rapid_activating_delayed_rectifiyer_K_current__V = var_membrane__V;
00481         double var_rapid_activating_delayed_rectifiyer_K_current__R_V = 1.0 / (1.0 + (2.5 * exp(0.1 * (var_rapid_activating_delayed_rectifiyer_K_current__V + 28.0))));
00482         double var_rapid_activating_delayed_rectifiyer_K_current__X_kr = var_rapid_activating_delayed_rectifiyer_K_current_X_kr_gate__X_kr;
00483         double var_rapid_activating_delayed_rectifiyer_K_current__R = var_membrane__R;
00484         double var_rapid_activating_delayed_rectifiyer_K_current__K_o = var_standard_ionic_concentrations__K_o;
00485         double var_rapid_activating_delayed_rectifiyer_K_current__T = var_membrane__T;
00486         double var_rapid_activating_delayed_rectifiyer_K_current__K_i = var_standard_ionic_concentrations__K_i;
00487         double var_rapid_activating_delayed_rectifiyer_K_current__F = var_membrane__F;
00488         double var_rapid_activating_delayed_rectifiyer_K_current__E_K = ((var_rapid_activating_delayed_rectifiyer_K_current__R * var_rapid_activating_delayed_rectifiyer_K_current__T) / var_rapid_activating_delayed_rectifiyer_K_current__F) * log(var_rapid_activating_delayed_rectifiyer_K_current__K_o / var_rapid_activating_delayed_rectifiyer_K_current__K_i);
00489         const double var_rapid_activating_delayed_rectifiyer_K_current__g_Kr = 0.0136;
00490         double var_rapid_activating_delayed_rectifiyer_K_current__i_Kr = var_rapid_activating_delayed_rectifiyer_K_current__g_Kr * var_rapid_activating_delayed_rectifiyer_K_current__R_V * var_rapid_activating_delayed_rectifiyer_K_current__X_kr * sqrt(var_rapid_activating_delayed_rectifiyer_K_current__K_o / 4.0) * (var_rapid_activating_delayed_rectifiyer_K_current__V - var_rapid_activating_delayed_rectifiyer_K_current__E_K);
00491         double var_membrane__i_Kr = var_rapid_activating_delayed_rectifiyer_K_current__i_Kr;
00492         const double var_slow_activating_delayed_rectifiyer_K_current__g_Ks = 0.0245;
00493         double var_slow_activating_delayed_rectifiyer_K_current__V = var_membrane__V;
00494         double var_slow_activating_delayed_rectifiyer_K_current__K_i = var_standard_ionic_concentrations__K_i;
00495         double var_slow_activating_delayed_rectifiyer_K_current__F = var_membrane__F;
00496         double var_slow_activating_delayed_rectifiyer_K_current__K_o = var_standard_ionic_concentrations__K_o;
00497         double var_slow_activating_delayed_rectifiyer_K_current__T = var_membrane__T;
00498         double var_slow_activating_delayed_rectifiyer_K_current__Na_o = var_standard_ionic_concentrations__Na_o;
00499         double var_slow_activating_delayed_rectifiyer_K_current__R = var_membrane__R;
00500         double var_slow_activating_delayed_rectifiyer_K_current__Na_i = var_standard_ionic_concentrations__Na_i;
00501         double var_slow_activating_delayed_rectifiyer_K_current__E_Ks = ((var_slow_activating_delayed_rectifiyer_K_current__R * var_slow_activating_delayed_rectifiyer_K_current__T) / var_slow_activating_delayed_rectifiyer_K_current__F) * log((var_slow_activating_delayed_rectifiyer_K_current__K_o + (0.01833 * var_slow_activating_delayed_rectifiyer_K_current__Na_o)) / (var_slow_activating_delayed_rectifiyer_K_current__K_i + (0.01833 * var_slow_activating_delayed_rectifiyer_K_current__Na_i)));
00502         double var_slow_activating_delayed_rectifiyer_K_current__X_ks = var_slow_activating_delayed_rectifiyer_K_current_X_ks_gate__X_ks;
00503         double var_slow_activating_delayed_rectifiyer_K_current__i_Ks = var_slow_activating_delayed_rectifiyer_K_current__g_Ks * pow(var_slow_activating_delayed_rectifiyer_K_current__X_ks, 2.0) * (var_slow_activating_delayed_rectifiyer_K_current__V - var_slow_activating_delayed_rectifiyer_K_current__E_Ks);
00504         double var_membrane__i_Ks = var_slow_activating_delayed_rectifiyer_K_current__i_Ks;
00505         const double var_transient_outward_potassium_current__g_to = 0.23815;
00506         double var_transient_outward_potassium_current__V = var_membrane__V;
00507         double var_transient_outward_potassium_current__X_to = var_transient_outward_potassium_current_X_to_gate__X_to;
00508         double var_transient_outward_potassium_current__E_K = var_rapid_activating_delayed_rectifiyer_K_current__E_K;
00509         double var_transient_outward_potassium_current__Y_to = var_transient_outward_potassium_current_Y_to_gate__Y_to;
00510         double var_transient_outward_potassium_current__i_to = var_transient_outward_potassium_current__g_to * var_transient_outward_potassium_current__X_to * var_transient_outward_potassium_current__Y_to * (var_transient_outward_potassium_current__V - var_transient_outward_potassium_current__E_K);
00511         double var_membrane__i_to = var_transient_outward_potassium_current__i_to;
00512         const double var_time_independent_potassium_current__g_K1 = 2.8;
00513         double var_time_independent_potassium_current__F = var_membrane__F;
00514         double var_time_independent_potassium_current_K1_gate__F = var_time_independent_potassium_current__F;
00515         double var_time_independent_potassium_current__V = var_membrane__V;
00516         double var_time_independent_potassium_current_K1_gate__V = var_time_independent_potassium_current__V;
00517         double var_time_independent_potassium_current__T = var_membrane__T;
00518         double var_time_independent_potassium_current_K1_gate__T = var_time_independent_potassium_current__T;
00519         double var_time_independent_potassium_current__R = var_membrane__R;
00520         double var_time_independent_potassium_current_K1_gate__R = var_time_independent_potassium_current__R;
00521         double var_time_independent_potassium_current__E_K = var_rapid_activating_delayed_rectifiyer_K_current__E_K;
00522         double var_time_independent_potassium_current_K1_gate__E_K = var_time_independent_potassium_current__E_K;
00523         double var_time_independent_potassium_current_K1_gate__K1_infinity = 1.0 / (2.0 + exp(((1.62 * var_time_independent_potassium_current_K1_gate__F) / (var_time_independent_potassium_current_K1_gate__R * var_time_independent_potassium_current_K1_gate__T)) * (var_time_independent_potassium_current_K1_gate__V - var_time_independent_potassium_current_K1_gate__E_K)));
00524         double var_time_independent_potassium_current__K1_infinity = var_time_independent_potassium_current_K1_gate__K1_infinity;
00525         double var_time_independent_potassium_current__K_o = var_standard_ionic_concentrations__K_o;
00526         const double var_time_independent_potassium_current__K_mK1 = 13.0;
00527         double var_time_independent_potassium_current__i_K1 = ((var_time_independent_potassium_current__g_K1 * var_time_independent_potassium_current__K1_infinity * var_time_independent_potassium_current__K_o) / (var_time_independent_potassium_current__K_o + var_time_independent_potassium_current__K_mK1)) * (var_time_independent_potassium_current__V - var_time_independent_potassium_current__E_K);
00528         double var_membrane__i_K1 = var_time_independent_potassium_current__i_K1;
00529         double var_plateau_potassium_current__V = var_membrane__V;
00530         double var_plateau_potassium_current__E_K = var_rapid_activating_delayed_rectifiyer_K_current__E_K;
00531         const double var_plateau_potassium_current__g_Kp = 0.002216;
00532         double var_plateau_potassium_current_Kp_gate__V = var_plateau_potassium_current__V;
00533         double var_plateau_potassium_current_Kp_gate__Kp_V = 1.0 / (1.0 + exp((7.488 - var_plateau_potassium_current_Kp_gate__V) / 5.98));
00534         double var_plateau_potassium_current__Kp_V = var_plateau_potassium_current_Kp_gate__Kp_V;
00535         double var_plateau_potassium_current__i_Kp = var_plateau_potassium_current__g_Kp * var_plateau_potassium_current__Kp_V * (var_plateau_potassium_current__V - var_plateau_potassium_current__E_K);
00536         double var_membrane__i_Kp = var_plateau_potassium_current__i_Kp;
00537         double var_Na_Ca_exchanger__Na_o = var_standard_ionic_concentrations__Na_o;
00538         const double var_Na_Ca_exchanger__K_NaCa = 1500.0;
00539         double var_Na_Ca_exchanger__V = var_membrane__V;
00540         double var_Na_Ca_exchanger__Ca_o = var_standard_ionic_concentrations__Ca_o;
00541         const double var_Na_Ca_exchanger__eta = 0.35;
00542         double var_Na_Ca_exchanger__Na_i = var_standard_ionic_concentrations__Na_i;
00543         double var_Na_Ca_exchanger__T = var_membrane__T;
00544         double var_Na_Ca_exchanger__R = var_membrane__R;
00545         const double var_Na_Ca_exchanger__K_sat = 0.2;
00546         const double var_Na_Ca_exchanger__K_mCa = 1380.0;
00547         double var_Na_Ca_exchanger__F = var_membrane__F;
00548         const double var_Na_Ca_exchanger__K_mNa = 87.5;
00549         double var_Na_Ca_exchanger__Ca_i = var_calcium_dynamics__Ca_i;
00550         double var_Na_Ca_exchanger__i_NaCa = (var_Na_Ca_exchanger__K_NaCa / ((pow(var_Na_Ca_exchanger__K_mNa, 3.0) + pow(var_Na_Ca_exchanger__Na_o, 3.0)) * (var_Na_Ca_exchanger__K_mCa + var_Na_Ca_exchanger__Ca_o) * (1.0 + (var_Na_Ca_exchanger__K_sat * exp(((var_Na_Ca_exchanger__eta - 1.0) * var_Na_Ca_exchanger__V * var_Na_Ca_exchanger__F) / (var_Na_Ca_exchanger__R * var_Na_Ca_exchanger__T)))))) * ((exp((var_Na_Ca_exchanger__eta * var_Na_Ca_exchanger__V * var_Na_Ca_exchanger__F) / (var_Na_Ca_exchanger__R * var_Na_Ca_exchanger__T)) * pow(var_Na_Ca_exchanger__Na_i, 3.0) * var_Na_Ca_exchanger__Ca_o) - (exp(((var_Na_Ca_exchanger__eta - 1.0) * var_Na_Ca_exchanger__V * var_Na_Ca_exchanger__F) / (var_Na_Ca_exchanger__R * var_Na_Ca_exchanger__T)) * pow(var_Na_Ca_exchanger__Na_o, 3.0) * var_Na_Ca_exchanger__Ca_i));
00551         double var_membrane__i_NaCa = var_Na_Ca_exchanger__i_NaCa;
00552         double var_sodium_potassium_pump__Na_i = var_standard_ionic_concentrations__Na_i;
00553         double var_sodium_potassium_pump__K_o = var_standard_ionic_concentrations__K_o;
00554         const double var_sodium_potassium_pump__i_NaK_max = 0.693;
00555         const double var_sodium_potassium_pump__K_mNai = 10.0;
00556         double var_sodium_potassium_pump__T = var_membrane__T;
00557         double var_sodium_potassium_pump__R = var_membrane__R;
00558         double var_sodium_potassium_pump__Na_o = var_standard_ionic_concentrations__Na_o;
00559         double var_sodium_potassium_pump__sigma = (1.0 / 7.0) * (exp(var_sodium_potassium_pump__Na_o / 67.3) - 1.0);
00560         double var_sodium_potassium_pump__V = var_membrane__V;
00561         double var_sodium_potassium_pump__F = var_membrane__F;
00562         double var_sodium_potassium_pump__f_NaK = 1.0 / (1.0 + (0.1245 * exp(((-0.1) * var_sodium_potassium_pump__V * var_sodium_potassium_pump__F) / (var_sodium_potassium_pump__R * var_sodium_potassium_pump__T))) + (0.0365 * var_sodium_potassium_pump__sigma * exp(((-var_sodium_potassium_pump__V) * var_sodium_potassium_pump__F) / (var_sodium_potassium_pump__R * var_sodium_potassium_pump__T))));
00563         const double var_sodium_potassium_pump__K_mKo = 1.5;
00564         double var_sodium_potassium_pump__i_NaK = (((var_sodium_potassium_pump__i_NaK_max * var_sodium_potassium_pump__f_NaK) / (1.0 + pow(var_sodium_potassium_pump__K_mNai / var_sodium_potassium_pump__Na_i, 1.5))) * var_sodium_potassium_pump__K_o) / (var_sodium_potassium_pump__K_o + var_sodium_potassium_pump__K_mKo);
00565         double var_membrane__i_NaK = var_sodium_potassium_pump__i_NaK;
00566         const double var_sarcolemmal_calcium_pump__i_pCa_max = 0.05;
00567         double var_sarcolemmal_calcium_pump__Ca_i = var_calcium_dynamics__Ca_i;
00568         const double var_sarcolemmal_calcium_pump__K_mpCa = 0.05;
00569         double var_sarcolemmal_calcium_pump__i_p_Ca = (var_sarcolemmal_calcium_pump__i_pCa_max * var_sarcolemmal_calcium_pump__Ca_i) / (var_sarcolemmal_calcium_pump__K_mpCa + var_sarcolemmal_calcium_pump__Ca_i);
00570         double var_membrane__i_p_Ca = var_sarcolemmal_calcium_pump__i_p_Ca;
00571         const double var_calcium_background_current__g_Cab = 0.0003842;
00572         double var_calcium_background_current__R = var_membrane__R;
00573         double var_calcium_background_current__Ca_i = var_calcium_dynamics__Ca_i;
00574         double var_calcium_background_current__F = var_membrane__F;
00575         double var_calcium_background_current__Ca_o = var_standard_ionic_concentrations__Ca_o;
00576         double var_calcium_background_current__T = var_membrane__T;
00577         double var_calcium_background_current__E_Ca = ((var_calcium_background_current__R * var_calcium_background_current__T) / (2.0 * var_calcium_background_current__F)) * log(var_calcium_background_current__Ca_o / var_calcium_background_current__Ca_i);
00578         double var_calcium_background_current__V = var_membrane__V;
00579         double var_calcium_background_current__i_Ca_b = var_calcium_background_current__g_Cab * (var_calcium_background_current__V - var_calcium_background_current__E_Ca);
00580         double var_membrane__i_Ca_b = var_calcium_background_current__i_Ca_b;
00581         double var_sodium_background_current__V = var_membrane__V;
00582         const double var_sodium_background_current__g_Nab = 0.0031;
00583         double var_sodium_background_current__E_Na = var_fast_sodium_current__E_Na;
00584         double var_sodium_background_current__i_Na_b = var_sodium_background_current__g_Nab * (var_sodium_background_current__V - var_sodium_background_current__E_Na);
00585         double var_membrane__i_Na_b = var_sodium_background_current__i_Na_b;
00586         double var_membrane__i_Stim = GetStimulus(var_membrane__time);
00587         double d_dt_membrane__V = -(var_membrane__i_Na + var_membrane__i_Ca + var_membrane__i_CaK + var_membrane__i_Kr + var_membrane__i_Ks + var_membrane__i_to + var_membrane__i_K1 + var_membrane__i_Kp + var_membrane__i_NaCa + var_membrane__i_NaK + var_membrane__i_p_Ca + var_membrane__i_Na_b + var_membrane__i_Ca_b + var_membrane__i_Stim);
00588 
00589         rY[0] += mDt * d_dt_membrane__V;
00590     }
00591 
00592     void ComputeOneStepExceptVoltage(double var_environment__time)
00593     {
00594         // Time units: millisecond
00595         std::vector<double>& rY = rGetStateVariables();
00596         double var_membrane__V = rY[0];
00597         // Units: millivolt; Initial value: -94.7
00598 
00599         double var_fast_sodium_current__V = var_membrane__V;
00600         double var_L_type_Ca_current__V = var_membrane__V;
00601         double var_rapid_activating_delayed_rectifiyer_K_current__V = var_membrane__V;
00602         double var_slow_activating_delayed_rectifiyer_K_current__V = var_membrane__V;
00603         double var_transient_outward_potassium_current__V = var_membrane__V;
00604         double var_fast_sodium_current_m_gate__V = var_fast_sodium_current__V;
00605         double var_fast_sodium_current_m_gate__E0_m = var_fast_sodium_current_m_gate__V + 47.13;
00606         double var_fast_sodium_current_m_gate__alpha_m = (0.32 * var_fast_sodium_current_m_gate__E0_m) / (1.0 - exp((-0.1) * var_fast_sodium_current_m_gate__E0_m));
00607         double var_fast_sodium_current_m_gate__beta_m = 0.08 * exp((-var_fast_sodium_current_m_gate__V) / 11.0);
00608         double var_fast_sodium_current_h_gate__V = var_fast_sodium_current__V;
00609         double var_fast_sodium_current_h_gate__alpha_h = 0.135 * exp((var_fast_sodium_current_h_gate__V + 80.0) / (-6.8));
00610         double var_fast_sodium_current_h_gate__beta_h = 7.5 / (1.0 + exp((-0.1) * (var_fast_sodium_current_h_gate__V + 11.0)));
00611         double var_fast_sodium_current_j_gate__V = var_fast_sodium_current__V;
00612         double var_fast_sodium_current_j_gate__alpha_j = (0.175 * exp((var_fast_sodium_current_j_gate__V + 100.0) / (-23.0))) / (1.0 + exp(0.15 * (var_fast_sodium_current_j_gate__V + 79.0)));
00613         double var_fast_sodium_current_j_gate__beta_j = 0.3 / (1.0 + exp((-0.1) * (var_fast_sodium_current_j_gate__V + 32.0)));
00614         double var_rapid_activating_delayed_rectifiyer_K_current_X_kr_gate__V = var_rapid_activating_delayed_rectifiyer_K_current__V;
00615         double var_rapid_activating_delayed_rectifiyer_K_current_X_kr_gate__X_kr_inf = 1.0 / (1.0 + exp((-2.182) - (0.1819 * var_rapid_activating_delayed_rectifiyer_K_current_X_kr_gate__V)));
00616         double var_rapid_activating_delayed_rectifiyer_K_current_X_kr_gate__tau_X_kr = 43.0 + (1.0 / (exp((-5.495) + (0.1691 * var_rapid_activating_delayed_rectifiyer_K_current_X_kr_gate__V)) + exp((-7.677) - (0.0128 * var_rapid_activating_delayed_rectifiyer_K_current_X_kr_gate__V))));
00617         double var_slow_activating_delayed_rectifiyer_K_current_X_ks_gate__V = var_slow_activating_delayed_rectifiyer_K_current__V;
00618         double var_slow_activating_delayed_rectifiyer_K_current_X_ks_gate__tau_X_ks = 1.0 / (((7.19e-05 * (var_slow_activating_delayed_rectifiyer_K_current_X_ks_gate__V - 10.0)) / (1.0 - exp((-0.148) * (var_slow_activating_delayed_rectifiyer_K_current_X_ks_gate__V - 10.0)))) + ((0.000131 * (var_slow_activating_delayed_rectifiyer_K_current_X_ks_gate__V - 10.0)) / (exp(0.0687 * (var_slow_activating_delayed_rectifiyer_K_current_X_ks_gate__V - 10.0)) - 1.0)));
00619         double var_slow_activating_delayed_rectifiyer_K_current_X_ks_gate__X_ks_infinity = 1.0 / (1.0 + exp((var_slow_activating_delayed_rectifiyer_K_current_X_ks_gate__V - 16.0) / (-13.6)));
00620         double var_transient_outward_potassium_current_X_to_gate__V = var_transient_outward_potassium_current__V;
00621         double var_transient_outward_potassium_current_X_to_gate__alpha_X_to = 0.04516 * exp(0.03577 * var_transient_outward_potassium_current_X_to_gate__V);
00622         double var_transient_outward_potassium_current_X_to_gate__beta_X_to = 0.0989 * exp((-0.06237) * var_transient_outward_potassium_current_X_to_gate__V);
00623         double var_transient_outward_potassium_current_Y_to_gate__V = var_transient_outward_potassium_current__V;
00624         double var_transient_outward_potassium_current_Y_to_gate__alpha_Y_to = (0.005415 * exp((var_transient_outward_potassium_current_Y_to_gate__V + 33.5) / (-5.0))) / (1.0 + (0.051335 * exp((var_transient_outward_potassium_current_Y_to_gate__V + 33.5) / (-5.0))));
00625         double var_transient_outward_potassium_current_Y_to_gate__beta_Y_to = (0.005415 * exp((var_transient_outward_potassium_current_Y_to_gate__V + 33.5) / 5.0)) / (1.0 + (0.051335 * exp((var_transient_outward_potassium_current_Y_to_gate__V + 33.5) / 5.0)));
00626         double var_L_type_Ca_current_f_gate__V = var_L_type_Ca_current__V;
00627         double var_L_type_Ca_current_f_gate__f_infinity = 1.0 / (1.0 + exp((var_L_type_Ca_current_f_gate__V + 12.5) / 5.0));
00628         double var_L_type_Ca_current_f_gate__tau_f = 30.0 + (200.0 / (1.0 + exp((var_L_type_Ca_current_f_gate__V + 20.0) / 9.5)));
00629         double var_L_type_Ca_current_d_gate__V = var_L_type_Ca_current__V;
00630         double var_L_type_Ca_current_d_gate__d_infinity = 1.0 / (1.0 + exp((var_L_type_Ca_current_d_gate__V + 10.0) / (-6.24)));
00631         double var_L_type_Ca_current_d_gate__E0_m = var_L_type_Ca_current_d_gate__V + 40.0;
00632         double var_L_type_Ca_current_d_gate__tau_d = 1.0 / (((0.25 * exp((-0.01) * var_L_type_Ca_current_d_gate__V)) / (1.0 + exp((-0.07) * var_L_type_Ca_current_d_gate__V))) + ((0.07 * exp((-0.05) * var_L_type_Ca_current_d_gate__E0_m)) / (1.0 + exp(0.05 * var_L_type_Ca_current_d_gate__E0_m))));
00633 
00634         const double _g_0 = var_L_type_Ca_current_d_gate__d_infinity / var_L_type_Ca_current_d_gate__tau_d;
00635         const double _h_0 = (-1.0) / var_L_type_Ca_current_d_gate__tau_d;
00636         const double _g_1 = var_L_type_Ca_current_f_gate__f_infinity / var_L_type_Ca_current_f_gate__tau_f;
00637         const double _h_1 = (-1.0) / var_L_type_Ca_current_f_gate__tau_f;
00638         const double _g_2 = var_fast_sodium_current_h_gate__alpha_h * 1.0;
00639         const double _h_2 = (var_fast_sodium_current_h_gate__alpha_h * (-1.0)) - (var_fast_sodium_current_h_gate__beta_h * 1.0);
00640         const double _g_3 = var_fast_sodium_current_j_gate__alpha_j * 1.0;
00641         const double _h_3 = (var_fast_sodium_current_j_gate__alpha_j * (-1.0)) - (var_fast_sodium_current_j_gate__beta_j * 1.0);
00642         const double _g_4 = var_fast_sodium_current_m_gate__alpha_m * 1.0;
00643         const double _h_4 = (var_fast_sodium_current_m_gate__alpha_m * (-1.0)) - (var_fast_sodium_current_m_gate__beta_m * 1.0);
00644         const double _g_5 = var_rapid_activating_delayed_rectifiyer_K_current_X_kr_gate__X_kr_inf / var_rapid_activating_delayed_rectifiyer_K_current_X_kr_gate__tau_X_kr;
00645         const double _h_5 = (-1.0) / var_rapid_activating_delayed_rectifiyer_K_current_X_kr_gate__tau_X_kr;
00646         const double _g_6 = var_slow_activating_delayed_rectifiyer_K_current_X_ks_gate__X_ks_infinity / var_slow_activating_delayed_rectifiyer_K_current_X_ks_gate__tau_X_ks;
00647         const double _h_6 = (-1.0) / var_slow_activating_delayed_rectifiyer_K_current_X_ks_gate__tau_X_ks;
00648         const double _g_7 = var_transient_outward_potassium_current_X_to_gate__alpha_X_to * 1.0;
00649         const double _h_7 = (var_transient_outward_potassium_current_X_to_gate__alpha_X_to * (-1.0)) - (var_transient_outward_potassium_current_X_to_gate__beta_X_to * 1.0);
00650         const double _g_8 = var_transient_outward_potassium_current_Y_to_gate__alpha_Y_to * 1.0;
00651         const double _h_8 = (var_transient_outward_potassium_current_Y_to_gate__alpha_Y_to * (-1.0)) - (var_transient_outward_potassium_current_Y_to_gate__beta_Y_to * 1.0);
00652 
00653         rY[1] = (rY[1] + _g_4*mDt) / (1 - _h_4*mDt);
00654         rY[2] = (rY[2] + _g_2*mDt) / (1 - _h_2*mDt);
00655         rY[3] = (rY[3] + _g_3*mDt) / (1 - _h_3*mDt);
00656         rY[4] = (rY[4] + _g_5*mDt) / (1 - _h_5*mDt);
00657         rY[5] = (rY[5] + _g_6*mDt) / (1 - _h_6*mDt);
00658         rY[6] = (rY[6] + _g_7*mDt) / (1 - _h_7*mDt);
00659         rY[7] = (rY[7] + _g_8*mDt) / (1 - _h_8*mDt);
00660         rY[8] = (rY[8] + _g_1*mDt) / (1 - _h_1*mDt);
00661         rY[9] = (rY[9] + _g_0*mDt) / (1 - _h_0*mDt);
00662 
00663         double _guess[3] = {rY[10],rY[11],rY[12]};
00664         CardiacNewtonSolver<3> *_solver = CardiacNewtonSolver<3>::Instance();
00665         _solver->Solve(*this, _guess);
00666         rY[10] = _guess[0];
00667         rY[12] = _guess[1];
00668         rY[11] = _guess[2];
00669     }
00670 
00671 };
00672 
00673 template<>
00674 void OdeSystemInformation<BackwardEulerFoxModel2002Modified>::Initialise(void)
00675 {
00676     this->mVariableNames.push_back("V");
00677     this->mVariableUnits.push_back("millivolt");
00678     this->mInitialConditions.push_back(-94.7);
00679 
00680     this->mVariableNames.push_back("m");
00681     this->mVariableUnits.push_back("dimensionless");
00682     this->mInitialConditions.push_back(0.00024676);
00683 
00684     this->mVariableNames.push_back("h");
00685     this->mVariableUnits.push_back("dimensionless");
00686     this->mInitialConditions.push_back(0.99869);
00687 
00688     this->mVariableNames.push_back("j");
00689     this->mVariableUnits.push_back("dimensionless");
00690     this->mInitialConditions.push_back(0.99887);
00691 
00692     this->mVariableNames.push_back("X_kr");
00693     this->mVariableUnits.push_back("dimensionless");
00694     this->mInitialConditions.push_back(0.229);
00695 
00696     this->mVariableNames.push_back("X_ks");
00697     this->mVariableUnits.push_back("dimensionless");
00698     this->mInitialConditions.push_back(0.0001);
00699 
00700     this->mVariableNames.push_back("X_to");
00701     this->mVariableUnits.push_back("dimensionless");
00702     this->mInitialConditions.push_back(0.00003742);
00703 
00704     this->mVariableNames.push_back("Y_to");
00705     this->mVariableUnits.push_back("dimensionless");
00706     this->mInitialConditions.push_back(1);
00707 
00708     this->mVariableNames.push_back("f");
00709     this->mVariableUnits.push_back("dimensionless");
00710     this->mInitialConditions.push_back(0.983);
00711 
00712     this->mVariableNames.push_back("d");
00713     this->mVariableUnits.push_back("dimensionless");
00714     this->mInitialConditions.push_back(0.0001);
00715 
00716     this->mVariableNames.push_back("f_Ca");
00717     this->mVariableUnits.push_back("dimensionless");
00718     this->mInitialConditions.push_back(0.942);
00719 
00720     this->mVariableNames.push_back("CaI");
00721     this->mVariableUnits.push_back("micromolar");
00722     this->mInitialConditions.push_back(0.0472);
00723 
00724     this->mVariableNames.push_back("Ca_SR");
00725     this->mVariableUnits.push_back("micromolar");
00726     this->mInitialConditions.push_back(320);
00727 
00728     this->mInitialised = true;
00729 }
00730 
00731 BOOST_CLASS_EXPORT(BackwardEulerFoxModel2002Modified)
00732 
00733 namespace boost
00734 {
00735 namespace serialization
00736 {
00741 template<class Archive>
00742 inline void save_construct_data(
00743     Archive & ar, const BackwardEulerFoxModel2002Modified * t, const unsigned int file_version)
00744 {    
00745     const boost::shared_ptr<AbstractIvpOdeSolver> p_solver = t->GetSolver();
00746     const boost::shared_ptr<AbstractStimulusFunction> p_stimulus = t->GetStimulusFunction();
00747     ar << p_solver;
00748     ar << p_stimulus;
00749 }
00750 
00757 template<class Archive>
00758 inline void load_construct_data(
00759     Archive & ar, BackwardEulerFoxModel2002Modified * t, const unsigned int file_version)
00760 {
00761     boost::shared_ptr<AbstractIvpOdeSolver> p_solver;
00762     boost::shared_ptr<AbstractStimulusFunction> p_stimulus;
00763     ar >> p_solver;
00764     ar >> p_stimulus;
00765     ::new(t)BackwardEulerFoxModel2002Modified(p_solver, p_stimulus);
00766 }
00767 }
00768 } // namespace ...
00769 
00770 #endif

Generated on Tue Aug 4 16:10:21 2009 for Chaste by  doxygen 1.5.5