BackwardEulerFoxModel2002Modified.hpp

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

Generated on Wed Mar 18 12:51:51 2009 for Chaste by  doxygen 1.5.5