BackwardEulerFoxModel2002Modified.cpp

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

Generated by  doxygen 1.6.2