Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TenTusscher06.cpp
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File TenTusscher06.cpp
4 //
5 // For more information, please see: http://www.nektar.info
6 //
7 // The MIT License
8 //
9 // Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10 // Department of Aeronautics, Imperial College London (UK), and Scientific
11 // Computing and Imaging Institute, University of Utah (USA).
12 //
13 // License for the specific language governing rights and limitations under
14 // Permission is hereby granted, free of charge, to any person obtaining a
15 // copy of this software and associated documentation files (the "Software"),
16 // to deal in the Software without restriction, including without limitation
17 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 // and/or sell copies of the Software, and to permit persons to whom the
19 // Software is furnished to do so, subject to the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be included
22 // in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 // DEALINGS IN THE SOFTWARE.
31 //
32 // Description: ten Tusscher 2006 Epicardium cell model
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #include <iostream>
37 #include <string>
38 //#include <LibUtilities/BasicUtils/Vmath.hpp>
40 
41 namespace Nektar
42 {
43 
44 std::string TenTusscher06::className
46  "TenTusscher06",
48  "ten Tusscher 2006.");
49 
50 std::string TenTusscher06::lookupIds[4] = {
52  "Epicardium", TenTusscher06::eEpicardium),
54  "Endocardium", TenTusscher06::eEndocardium),
56  "Mid", TenTusscher06::eMid),
58  "Ischemia", TenTusscher06::eIschemia)
59 };
60 
61 std::string TenTusscher06::def =
63  "CellModelVariant", "eEpicardium");
64 
65 /**
66  *
67  */
70  const MultiRegions::ExpListSharedPtr& pField):
71  CellModel(pSession, pField)
72 {
73  model_variant = pSession->GetSolverInfoAsEnum<
74  TenTusscher06::Variants>("CellModelVariant");
75 
76  switch (model_variant) {
77  case eEpicardium:
78  g_to = 0.294;
79  g_Ks = 0.392;
80  s_inf_factor = 20.0;
81  s_tau_f1 = 85.0;
82  s_tau_f2 = 45.0;
83  s_tau_f3 = 320.0;
84  s_tau_f4 = 0.0;
85  s_tau_f5 = 1.0;
86  k_0 = 5.4;
87  break;
88  case eEndocardium:
89  g_to = 0.073;
90  g_Ks = 0.392;
91  s_inf_factor = 28.0;
92  s_tau_f1 = 1000.0;
93  s_tau_f2 = 67.0;
94  s_tau_f3 = 1000.0;
95  s_tau_f4 = 8.0;
96  s_tau_f5 = 0.0;
97  k_0 = 5.4;
98  break;
99  case eMid:
100  g_to = 0.294;
101  g_Ks = 0.098;
102  s_inf_factor = 20.0;
103  s_tau_f1 = 85.0;
104  s_tau_f2 = 45.0;
105  s_tau_f3 = 320.0;
106  s_tau_f4 = 0.0;
107  s_tau_f5 = 1.0;
108  k_0 = 5.4;
109  break;
110  case eIschemia:
111  g_to = 0.294;
112  g_Ks = 0.392;
113  s_inf_factor = 20.0;
114  s_tau_f1 = 85.0;
115  s_tau_f2 = 45.0;
116  s_tau_f3 = 320.0;
117  s_tau_f4 = 0.0;
118  s_tau_f5 = 1.0;
119  k_0 = 9.0;
120  break;
121  }
122  m_nvar = 19;
123 
124  m_gates.push_back(1);
125  m_gates.push_back(2);
126  m_gates.push_back(3);
127  m_gates.push_back(4);
128  m_gates.push_back(5);
129  m_gates.push_back(6);
130  m_gates.push_back(7);
131  m_gates.push_back(8);
132  m_gates.push_back(9);
133  m_gates.push_back(10);
134  m_gates.push_back(11);
135  m_gates.push_back(12);
136  m_concentrations.push_back(13);
137  m_concentrations.push_back(14);
138  m_concentrations.push_back(15);
139  m_concentrations.push_back(16);
140  m_concentrations.push_back(17);
141  m_concentrations.push_back(18);
142 }
143 
144 
145 /**
146  *
147  */
149  const Array<OneD, const Array<OneD, NekDouble> >&inarray,
150  Array<OneD, Array<OneD, NekDouble> >&outarray,
151  const NekDouble time)
152 {
153  for (unsigned int i = 0; i < m_nq; ++i)
154  {
155  // Inputs:
156  // Time units: millisecond
157  NekDouble var_chaste_interface__membrane__V = inarray[0][i];
158  // Units: millivolt; Initial value: -85.23
159  NekDouble var_chaste_interface__rapid_time_dependent_potassium_current_Xr1_gate__Xr1 = inarray[1][i];
160  // Units: dimensionless; Initial value: 0.00621
161  NekDouble var_chaste_interface__rapid_time_dependent_potassium_current_Xr2_gate__Xr2 = inarray[2][i];
162  // Units: dimensionless; Initial value: 0.4712
163  NekDouble var_chaste_interface__slow_time_dependent_potassium_current_Xs_gate__Xs = inarray[3][i];
164  // Units: dimensionless; Initial value: 0.0095
165  NekDouble var_chaste_interface__fast_sodium_current_m_gate__m = inarray[4][i];
166  // Units: dimensionless; Initial value: 0.00172
167  NekDouble var_chaste_interface__fast_sodium_current_h_gate__h = inarray[5][i];
168  // Units: dimensionless; Initial value: 0.7444
169  NekDouble var_chaste_interface__fast_sodium_current_j_gate__j = inarray[6][i];
170  // Units: dimensionless; Initial value: 0.7045
171  NekDouble var_chaste_interface__L_type_Ca_current_d_gate__d = inarray[7][i];
172  // Units: dimensionless; Initial value: 3.373e-5
173  NekDouble var_chaste_interface__L_type_Ca_current_f_gate__f = inarray[8][i];
174  // Units: dimensionless; Initial value: 0.7888
175  NekDouble var_chaste_interface__L_type_Ca_current_f2_gate__f2 = inarray[9][i];
176  // Units: dimensionless; Initial value: 0.9755
177  NekDouble var_chaste_interface__L_type_Ca_current_fCass_gate__fCass = inarray[10][i];
178  // Units: dimensionless; Initial value: 0.9953
179  NekDouble var_chaste_interface__transient_outward_current_s_gate__s = inarray[11][i];
180  // Units: dimensionless; Initial value: 0.999998
181  NekDouble var_chaste_interface__transient_outward_current_r_gate__r = inarray[12][i];
182  // Units: dimensionless; Initial value: 2.42e-8
183  NekDouble var_chaste_interface__calcium_dynamics__Ca_i = inarray[13][i];
184  // Units: millimolar; Initial value: 0.000126
185  NekDouble var_chaste_interface__calcium_dynamics__Ca_SR = inarray[14][i];
186  // Units: millimolar; Initial value: 3.64
187  NekDouble var_chaste_interface__calcium_dynamics__Ca_ss = inarray[15][i];
188  // Units: millimolar; Initial value: 0.00036
189  NekDouble var_chaste_interface__calcium_dynamics__R_prime = inarray[16][i];
190  // Units: dimensionless; Initial value: 0.9073
191  NekDouble var_chaste_interface__sodium_dynamics__Na_i = inarray[17][i];
192  // Units: millimolar; Initial value: 8.604
193  NekDouble var_chaste_interface__potassium_dynamics__K_i = inarray[18][i];
194  // Units: millimolar; Initial value: 136.89
195 
196 
197  // Mathematics
198  NekDouble d_dt_chaste_interface__membrane__V;
199  const NekDouble var_membrane__R = 8314.472; // joule_per_mole_kelvin
200  const NekDouble var_membrane__T = 310.0; // kelvin
201  const NekDouble var_membrane__F = 96485.3415; // coulomb_per_millimole
202  const NekDouble var_membrane__Cm = 0.185; // microF
203  const NekDouble var_membrane__V_c = 0.016404; // micrometre3
204  const NekDouble var_inward_rectifier_potassium_current__V = var_chaste_interface__membrane__V; // millivolt
205  const NekDouble var_reversal_potentials__K_i = var_chaste_interface__potassium_dynamics__K_i; // millimolar
206  const NekDouble var_reversal_potentials__R = var_membrane__R; // joule_per_mole_kelvin
207  const NekDouble var_reversal_potentials__T = var_membrane__T; // kelvin
208  const NekDouble var_reversal_potentials__F = var_membrane__F; // coulomb_per_millimole
209  const NekDouble var_potassium_dynamics__K_o = k_0; // millimolar
210  const NekDouble var_reversal_potentials__K_o = var_potassium_dynamics__K_o; // millimolar
211  const NekDouble var_reversal_potentials__E_K = ((var_reversal_potentials__R * var_reversal_potentials__T) / var_reversal_potentials__F) * log(var_reversal_potentials__K_o / var_reversal_potentials__K_i); // millivolt
212  const NekDouble var_inward_rectifier_potassium_current__E_K = var_reversal_potentials__E_K; // millivolt
213  const NekDouble var_inward_rectifier_potassium_current__beta_K1 = ((3.0 * exp(0.0002 * ((var_inward_rectifier_potassium_current__V - var_inward_rectifier_potassium_current__E_K) + 100.0))) + exp(0.1 * ((var_inward_rectifier_potassium_current__V - var_inward_rectifier_potassium_current__E_K) - 10.0))) / (1.0 + exp((-0.5) * (var_inward_rectifier_potassium_current__V - var_inward_rectifier_potassium_current__E_K))); // dimensionless
214  const NekDouble var_inward_rectifier_potassium_current__alpha_K1 = 0.1 / (1.0 + exp(0.06 * ((var_inward_rectifier_potassium_current__V - var_inward_rectifier_potassium_current__E_K) - 200.0))); // dimensionless
215  const NekDouble var_inward_rectifier_potassium_current__xK1_inf = var_inward_rectifier_potassium_current__alpha_K1 / (var_inward_rectifier_potassium_current__alpha_K1 + var_inward_rectifier_potassium_current__beta_K1); // dimensionless
216  const NekDouble var_inward_rectifier_potassium_current__K_o = var_potassium_dynamics__K_o; // millimolar
217  const NekDouble var_inward_rectifier_potassium_current__g_K1 = 5.405; // nanoS_per_picoF
218  const NekDouble var_inward_rectifier_potassium_current__i_K1 = var_inward_rectifier_potassium_current__g_K1 * var_inward_rectifier_potassium_current__xK1_inf * sqrt(var_inward_rectifier_potassium_current__K_o / 5.4) * (var_inward_rectifier_potassium_current__V - var_inward_rectifier_potassium_current__E_K); // picoA_per_picoF
219  const NekDouble var_transient_outward_current__s = var_chaste_interface__transient_outward_current_s_gate__s; // dimensionless
220  const NekDouble var_transient_outward_current__r = var_chaste_interface__transient_outward_current_r_gate__r; // dimensionless
221  const NekDouble var_transient_outward_current__g_to = g_to; // nanoS_per_picoF
222  const NekDouble var_transient_outward_current__V = var_chaste_interface__membrane__V; // millivolt
223  const NekDouble var_transient_outward_current__E_K = var_reversal_potentials__E_K; // millivolt
224  const NekDouble var_transient_outward_current__i_to = var_transient_outward_current__g_to * var_transient_outward_current__r * var_transient_outward_current__s * (var_transient_outward_current__V - var_transient_outward_current__E_K); // picoA_per_picoF
225  const NekDouble var_rapid_time_dependent_potassium_current__Xr1 = var_chaste_interface__rapid_time_dependent_potassium_current_Xr1_gate__Xr1; // dimensionless
226  const NekDouble var_rapid_time_dependent_potassium_current__Xr2 = var_chaste_interface__rapid_time_dependent_potassium_current_Xr2_gate__Xr2; // dimensionless
227  const NekDouble var_rapid_time_dependent_potassium_current__V = var_chaste_interface__membrane__V; // millivolt
228  const NekDouble var_rapid_time_dependent_potassium_current__K_o = var_potassium_dynamics__K_o; // millimolar
229  const NekDouble var_rapid_time_dependent_potassium_current__E_K = var_reversal_potentials__E_K; // millivolt
230  const NekDouble var_rapid_time_dependent_potassium_current__g_Kr = 0.153; // nanoS_per_picoF
231  const NekDouble var_rapid_time_dependent_potassium_current__i_Kr = var_rapid_time_dependent_potassium_current__g_Kr * sqrt(var_rapid_time_dependent_potassium_current__K_o / 5.4) * var_rapid_time_dependent_potassium_current__Xr1 * var_rapid_time_dependent_potassium_current__Xr2 * (var_rapid_time_dependent_potassium_current__V - var_rapid_time_dependent_potassium_current__E_K); // picoA_per_picoF
232  const NekDouble var_slow_time_dependent_potassium_current__g_Ks = g_Ks; // nanoS_per_picoF
233  const NekDouble var_sodium_dynamics__Na_o = 140.0; // millimolar
234  const NekDouble var_reversal_potentials__Na_o = var_sodium_dynamics__Na_o; // millimolar
235  const NekDouble var_reversal_potentials__Na_i = var_chaste_interface__sodium_dynamics__Na_i; // millimolar
236  const NekDouble var_reversal_potentials__P_kna = 0.03; // dimensionless
237  const NekDouble var_reversal_potentials__E_Ks = ((var_reversal_potentials__R * var_reversal_potentials__T) / var_reversal_potentials__F) * log((var_reversal_potentials__K_o + (var_reversal_potentials__P_kna * var_reversal_potentials__Na_o)) / (var_reversal_potentials__K_i + (var_reversal_potentials__P_kna * var_reversal_potentials__Na_i))); // millivolt
238  const NekDouble var_slow_time_dependent_potassium_current__E_Ks = var_reversal_potentials__E_Ks; // millivolt
239  const NekDouble var_slow_time_dependent_potassium_current__V = var_chaste_interface__membrane__V; // millivolt
240  const NekDouble var_slow_time_dependent_potassium_current__Xs = var_chaste_interface__slow_time_dependent_potassium_current_Xs_gate__Xs; // dimensionless
241  const NekDouble var_slow_time_dependent_potassium_current__i_Ks = var_slow_time_dependent_potassium_current__g_Ks * pow(var_slow_time_dependent_potassium_current__Xs, 2.0) * (var_slow_time_dependent_potassium_current__V - var_slow_time_dependent_potassium_current__E_Ks); // picoA_per_picoF
242  const NekDouble var_L_type_Ca_current__Ca_ss = var_chaste_interface__calcium_dynamics__Ca_ss; // millimolar
243  const NekDouble var_L_type_Ca_current__g_CaL = 3.98e-05; // litre_per_farad_second
244  const NekDouble var_L_type_Ca_current__f = var_chaste_interface__L_type_Ca_current_f_gate__f; // dimensionless
245  const NekDouble var_L_type_Ca_current__d = var_chaste_interface__L_type_Ca_current_d_gate__d; // dimensionless
246  const NekDouble var_L_type_Ca_current__F = var_membrane__F; // coulomb_per_millimole
247  const NekDouble var_L_type_Ca_current__f2 = var_chaste_interface__L_type_Ca_current_f2_gate__f2; // dimensionless
248  const NekDouble var_L_type_Ca_current__fCass = var_chaste_interface__L_type_Ca_current_fCass_gate__fCass; // dimensionless
249  const NekDouble var_L_type_Ca_current__V = var_chaste_interface__membrane__V; // millivolt
250  const NekDouble var_L_type_Ca_current__T = var_membrane__T; // kelvin
251  const NekDouble var_calcium_dynamics__Ca_o = 2.0; // millimolar
252  const NekDouble var_L_type_Ca_current__Ca_o = var_calcium_dynamics__Ca_o; // millimolar
253  const NekDouble var_L_type_Ca_current__R = var_membrane__R; // joule_per_mole_kelvin
254  const NekDouble var_L_type_Ca_current__i_CaL = (((var_L_type_Ca_current__g_CaL * var_L_type_Ca_current__d * var_L_type_Ca_current__f * var_L_type_Ca_current__f2 * var_L_type_Ca_current__fCass * 4.0 * (var_L_type_Ca_current__V - 15.0) * pow(var_L_type_Ca_current__F, 2.0)) / (var_L_type_Ca_current__R * var_L_type_Ca_current__T)) * ((0.25 * var_L_type_Ca_current__Ca_ss * exp((2.0 * (var_L_type_Ca_current__V - 15.0) * var_L_type_Ca_current__F) / (var_L_type_Ca_current__R * var_L_type_Ca_current__T))) - var_L_type_Ca_current__Ca_o)) / (exp((2.0 * (var_L_type_Ca_current__V - 15.0) * var_L_type_Ca_current__F) / (var_L_type_Ca_current__R * var_L_type_Ca_current__T)) - 1.0); // picoA_per_picoF
255  const NekDouble var_sodium_potassium_pump_current__Na_i = var_chaste_interface__sodium_dynamics__Na_i; // millimolar
256  const NekDouble var_sodium_potassium_pump_current__R = var_membrane__R; // joule_per_mole_kelvin
257  const NekDouble var_sodium_potassium_pump_current__T = var_membrane__T; // kelvin
258  const NekDouble var_sodium_potassium_pump_current__V = var_chaste_interface__membrane__V; // millivolt
259  const NekDouble var_sodium_potassium_pump_current__K_mk = 1.0; // millimolar
260  const NekDouble var_sodium_potassium_pump_current__P_NaK = 2.724; // picoA_per_picoF
261  const NekDouble var_sodium_potassium_pump_current__K_mNa = 40.0; // millimolar
262  const NekDouble var_sodium_potassium_pump_current__F = var_membrane__F; // coulomb_per_millimole
263  const NekDouble var_sodium_potassium_pump_current__K_o = var_potassium_dynamics__K_o; // millimolar
264  const NekDouble var_sodium_potassium_pump_current__i_NaK = ((((var_sodium_potassium_pump_current__P_NaK * var_sodium_potassium_pump_current__K_o) / (var_sodium_potassium_pump_current__K_o + var_sodium_potassium_pump_current__K_mk)) * var_sodium_potassium_pump_current__Na_i) / (var_sodium_potassium_pump_current__Na_i + var_sodium_potassium_pump_current__K_mNa)) / (1.0 + (0.1245 * exp(((-0.1) * var_sodium_potassium_pump_current__V * var_sodium_potassium_pump_current__F) / (var_sodium_potassium_pump_current__R * var_sodium_potassium_pump_current__T))) + (0.0353 * exp(((-var_sodium_potassium_pump_current__V) * var_sodium_potassium_pump_current__F) / (var_sodium_potassium_pump_current__R * var_sodium_potassium_pump_current__T)))); // picoA_per_picoF
265  const NekDouble var_fast_sodium_current__j = var_chaste_interface__fast_sodium_current_j_gate__j; // dimensionless
266  const NekDouble var_fast_sodium_current__h = var_chaste_interface__fast_sodium_current_h_gate__h; // dimensionless
267  const NekDouble var_fast_sodium_current__g_Na = 14.838; // nanoS_per_picoF
268  const NekDouble var_fast_sodium_current__m = var_chaste_interface__fast_sodium_current_m_gate__m; // dimensionless
269  const NekDouble var_fast_sodium_current__V = var_chaste_interface__membrane__V; // millivolt
270  const NekDouble var_reversal_potentials__E_Na = ((var_reversal_potentials__R * var_reversal_potentials__T) / var_reversal_potentials__F) * log(var_reversal_potentials__Na_o / var_reversal_potentials__Na_i); // millivolt
271  const NekDouble var_fast_sodium_current__E_Na = var_reversal_potentials__E_Na; // millivolt
272  const NekDouble 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); // picoA_per_picoF
273  const NekDouble var_sodium_background_current__V = var_chaste_interface__membrane__V; // millivolt
274  const NekDouble var_sodium_background_current__E_Na = var_reversal_potentials__E_Na; // millivolt
275  const NekDouble var_sodium_background_current__g_bna = 0.00029; // nanoS_per_picoF
276  const NekDouble var_sodium_background_current__i_b_Na = var_sodium_background_current__g_bna * (var_sodium_background_current__V - var_sodium_background_current__E_Na); // picoA_per_picoF
277  const NekDouble var_sodium_calcium_exchanger_current__alpha = 2.5; // dimensionless
278  const NekDouble var_sodium_calcium_exchanger_current__gamma = 0.35; // dimensionless
279  const NekDouble var_sodium_calcium_exchanger_current__K_sat = 0.1; // dimensionless
280  const NekDouble var_sodium_calcium_exchanger_current__Km_Ca = 1.38; // millimolar
281  const NekDouble var_sodium_calcium_exchanger_current__K_NaCa = 1000.0; // picoA_per_picoF
282  const NekDouble var_sodium_calcium_exchanger_current__F = var_membrane__F; // coulomb_per_millimole
283  const NekDouble var_sodium_calcium_exchanger_current__Ca_i = var_chaste_interface__calcium_dynamics__Ca_i; // millimolar
284  const NekDouble var_sodium_calcium_exchanger_current__Ca_o = var_calcium_dynamics__Ca_o; // millimolar
285  const NekDouble var_sodium_calcium_exchanger_current__V = var_chaste_interface__membrane__V; // millivolt
286  const NekDouble var_sodium_calcium_exchanger_current__R = var_membrane__R; // joule_per_mole_kelvin
287  const NekDouble var_sodium_calcium_exchanger_current__Km_Nai = 87.5; // millimolar
288  const NekDouble var_sodium_calcium_exchanger_current__Na_o = var_sodium_dynamics__Na_o; // millimolar
289  const NekDouble var_sodium_calcium_exchanger_current__Na_i = var_chaste_interface__sodium_dynamics__Na_i; // millimolar
290  const NekDouble var_sodium_calcium_exchanger_current__T = var_membrane__T; // kelvin
291  const NekDouble var_sodium_calcium_exchanger_current__i_NaCa = (var_sodium_calcium_exchanger_current__K_NaCa * ((exp((var_sodium_calcium_exchanger_current__gamma * var_sodium_calcium_exchanger_current__V * var_sodium_calcium_exchanger_current__F) / (var_sodium_calcium_exchanger_current__R * var_sodium_calcium_exchanger_current__T)) * pow(var_sodium_calcium_exchanger_current__Na_i, 3.0) * var_sodium_calcium_exchanger_current__Ca_o) - (exp(((var_sodium_calcium_exchanger_current__gamma - 1.0) * var_sodium_calcium_exchanger_current__V * var_sodium_calcium_exchanger_current__F) / (var_sodium_calcium_exchanger_current__R * var_sodium_calcium_exchanger_current__T)) * pow(var_sodium_calcium_exchanger_current__Na_o, 3.0) * var_sodium_calcium_exchanger_current__Ca_i * var_sodium_calcium_exchanger_current__alpha))) / ((pow(var_sodium_calcium_exchanger_current__Km_Nai, 3.0) + pow(var_sodium_calcium_exchanger_current__Na_o, 3.0)) * (var_sodium_calcium_exchanger_current__Km_Ca + var_sodium_calcium_exchanger_current__Ca_o) * (1.0 + (var_sodium_calcium_exchanger_current__K_sat * exp(((var_sodium_calcium_exchanger_current__gamma - 1.0) * var_sodium_calcium_exchanger_current__V * var_sodium_calcium_exchanger_current__F) / (var_sodium_calcium_exchanger_current__R * var_sodium_calcium_exchanger_current__T))))); // picoA_per_picoF
292  const NekDouble var_reversal_potentials__Ca_o = var_calcium_dynamics__Ca_o; // millimolar
293  const NekDouble var_reversal_potentials__Ca_i = var_chaste_interface__calcium_dynamics__Ca_i; // millimolar
294  const NekDouble var_reversal_potentials__E_Ca = ((0.5 * var_reversal_potentials__R * var_reversal_potentials__T) / var_reversal_potentials__F) * log(var_reversal_potentials__Ca_o / var_reversal_potentials__Ca_i); // millivolt
295  const NekDouble var_calcium_background_current__E_Ca = var_reversal_potentials__E_Ca; // millivolt
296  const NekDouble var_calcium_background_current__g_bca = 0.000592; // nanoS_per_picoF
297  const NekDouble var_calcium_background_current__V = var_chaste_interface__membrane__V; // millivolt
298  const NekDouble var_calcium_background_current__i_b_Ca = var_calcium_background_current__g_bca * (var_calcium_background_current__V - var_calcium_background_current__E_Ca); // picoA_per_picoF
299  const NekDouble var_potassium_pump_current__g_pK = 0.0146; // nanoS_per_picoF
300  const NekDouble var_potassium_pump_current__V = var_chaste_interface__membrane__V; // millivolt
301  const NekDouble var_potassium_pump_current__E_K = var_reversal_potentials__E_K; // millivolt
302  const NekDouble var_potassium_pump_current__i_p_K = (var_potassium_pump_current__g_pK * (var_potassium_pump_current__V - var_potassium_pump_current__E_K)) / (1.0 + exp((25.0 - var_potassium_pump_current__V) / 5.98)); // picoA_per_picoF
303  const NekDouble var_calcium_pump_current__K_pCa = 0.0005; // millimolar
304  const NekDouble var_calcium_pump_current__Ca_i = var_chaste_interface__calcium_dynamics__Ca_i; // millimolar
305  const NekDouble var_calcium_pump_current__g_pCa = 0.1238; // picoA_per_picoF
306  const NekDouble var_calcium_pump_current__i_p_Ca = (var_calcium_pump_current__g_pCa * var_calcium_pump_current__Ca_i) / (var_calcium_pump_current__Ca_i + var_calcium_pump_current__K_pCa); // picoA_per_picoF
307  const NekDouble var_chaste_interface__membrane__i_Stim = 0.0;
308  const NekDouble var_rapid_time_dependent_potassium_current_Xr1_gate__V = var_rapid_time_dependent_potassium_current__V; // millivolt
309  const NekDouble var_rapid_time_dependent_potassium_current_Xr1_gate__alpha_xr1 = 450.0 / (1.0 + exp(((-45.0) - var_rapid_time_dependent_potassium_current_Xr1_gate__V) / 10.0)); // dimensionless
310  const NekDouble var_rapid_time_dependent_potassium_current_Xr1_gate__beta_xr1 = 6.0 / (1.0 + exp((var_rapid_time_dependent_potassium_current_Xr1_gate__V + 30.0) / 11.5)); // dimensionless
311  const NekDouble var_rapid_time_dependent_potassium_current_Xr1_gate__tau_xr1 = 1.0 * var_rapid_time_dependent_potassium_current_Xr1_gate__alpha_xr1 * var_rapid_time_dependent_potassium_current_Xr1_gate__beta_xr1; // millisecond
312  const NekDouble var_rapid_time_dependent_potassium_current_Xr1_gate__xr1_inf = 1.0 / (1.0 + exp(((-26.0) - var_rapid_time_dependent_potassium_current_Xr1_gate__V) / 7.0)); // dimensionless
313  const NekDouble var_rapid_time_dependent_potassium_current_Xr2_gate__V = var_rapid_time_dependent_potassium_current__V; // millivolt
314  const NekDouble var_rapid_time_dependent_potassium_current_Xr2_gate__alpha_xr2 = 3.0 / (1.0 + exp(((-60.0) - var_rapid_time_dependent_potassium_current_Xr2_gate__V) / 20.0)); // dimensionless
315  const NekDouble var_rapid_time_dependent_potassium_current_Xr2_gate__beta_xr2 = 1.12 / (1.0 + exp((var_rapid_time_dependent_potassium_current_Xr2_gate__V - 60.0) / 20.0)); // dimensionless
316  const NekDouble var_rapid_time_dependent_potassium_current_Xr2_gate__tau_xr2 = 1.0 * var_rapid_time_dependent_potassium_current_Xr2_gate__alpha_xr2 * var_rapid_time_dependent_potassium_current_Xr2_gate__beta_xr2; // millisecond
317  const NekDouble var_rapid_time_dependent_potassium_current_Xr2_gate__xr2_inf = 1.0 / (1.0 + exp((var_rapid_time_dependent_potassium_current_Xr2_gate__V + 88.0) / 24.0)); // dimensionless
318  const NekDouble var_slow_time_dependent_potassium_current_Xs_gate__V = var_slow_time_dependent_potassium_current__V; // millivolt
319  const NekDouble var_slow_time_dependent_potassium_current_Xs_gate__beta_xs = 1.0 / (1.0 + exp((var_slow_time_dependent_potassium_current_Xs_gate__V - 35.0) / 15.0)); // dimensionless
320  const NekDouble var_slow_time_dependent_potassium_current_Xs_gate__alpha_xs = 1400.0 / sqrt(1.0 + exp((5.0 - var_slow_time_dependent_potassium_current_Xs_gate__V) / 6.0)); // dimensionless
321  const NekDouble var_slow_time_dependent_potassium_current_Xs_gate__tau_xs = (1.0 * var_slow_time_dependent_potassium_current_Xs_gate__alpha_xs * var_slow_time_dependent_potassium_current_Xs_gate__beta_xs) + 80.0; // millisecond
322  const NekDouble var_slow_time_dependent_potassium_current_Xs_gate__xs_inf = 1.0 / (1.0 + exp(((-5.0) - var_slow_time_dependent_potassium_current_Xs_gate__V) / 14.0)); // dimensionless
323  const NekDouble var_fast_sodium_current_m_gate__V = var_fast_sodium_current__V; // millivolt
324  const NekDouble var_fast_sodium_current_m_gate__alpha_m = 1.0 / (1.0 + exp(((-60.0) - var_fast_sodium_current_m_gate__V) / 5.0)); // dimensionless
325  const NekDouble var_fast_sodium_current_m_gate__beta_m = (0.1 / (1.0 + exp((var_fast_sodium_current_m_gate__V + 35.0) / 5.0))) + (0.1 / (1.0 + exp((var_fast_sodium_current_m_gate__V - 50.0) / 200.0))); // dimensionless
326  const NekDouble var_fast_sodium_current_m_gate__tau_m = 1.0 * var_fast_sodium_current_m_gate__alpha_m * var_fast_sodium_current_m_gate__beta_m; // millisecond
327  const NekDouble var_fast_sodium_current_m_gate__m_inf = 1.0 / pow(1.0 + exp(((-56.86) - var_fast_sodium_current_m_gate__V) / 9.03), 2.0); // dimensionless
328  const NekDouble var_fast_sodium_current_h_gate__V = var_fast_sodium_current__V; // millivolt
329  const NekDouble var_fast_sodium_current_h_gate__h_inf = 1.0 / pow(1.0 + exp((var_fast_sodium_current_h_gate__V + 71.55) / 7.43), 2.0); // dimensionless
330  const NekDouble var_fast_sodium_current_h_gate__beta_h = (var_fast_sodium_current_h_gate__V < (-40.0)) ? ((2.7 * exp(0.079 * var_fast_sodium_current_h_gate__V)) + (310000.0 * exp(0.3485 * var_fast_sodium_current_h_gate__V))) : (0.77 / (0.13 * (1.0 + exp((var_fast_sodium_current_h_gate__V + 10.66) / (-11.1))))); // per_millisecond
331  const NekDouble var_fast_sodium_current_h_gate__alpha_h = (var_fast_sodium_current_h_gate__V < (-40.0)) ? (0.057 * exp((-(var_fast_sodium_current_h_gate__V + 80.0)) / 6.8)) : 0.0; // per_millisecond
332  const NekDouble var_fast_sodium_current_h_gate__tau_h = 1.0 / (var_fast_sodium_current_h_gate__alpha_h + var_fast_sodium_current_h_gate__beta_h); // millisecond
333  const NekDouble var_fast_sodium_current_j_gate__V = var_fast_sodium_current__V; // millivolt
334  const NekDouble var_fast_sodium_current_j_gate__j_inf = 1.0 / pow(1.0 + exp((var_fast_sodium_current_j_gate__V + 71.55) / 7.43), 2.0); // dimensionless
335  const NekDouble var_fast_sodium_current_j_gate__alpha_j = (var_fast_sodium_current_j_gate__V < (-40.0)) ? ((((((-25428.0) * exp(0.2444 * var_fast_sodium_current_j_gate__V)) - (6.948e-06 * exp((-0.04391) * var_fast_sodium_current_j_gate__V))) * (var_fast_sodium_current_j_gate__V + 37.78)) / 1.0) / (1.0 + exp(0.311 * (var_fast_sodium_current_j_gate__V + 79.23)))) : 0.0; // per_millisecond
336  const NekDouble var_fast_sodium_current_j_gate__beta_j = (var_fast_sodium_current_j_gate__V < (-40.0)) ? ((0.02424 * exp((-0.01052) * var_fast_sodium_current_j_gate__V)) / (1.0 + exp((-0.1378) * (var_fast_sodium_current_j_gate__V + 40.14)))) : ((0.6 * exp(0.057 * var_fast_sodium_current_j_gate__V)) / (1.0 + exp((-0.1) * (var_fast_sodium_current_j_gate__V + 32.0)))); // per_millisecond
337  const NekDouble var_fast_sodium_current_j_gate__tau_j = 1.0 / (var_fast_sodium_current_j_gate__alpha_j + var_fast_sodium_current_j_gate__beta_j); // millisecond
338  const NekDouble var_L_type_Ca_current_d_gate__V = var_L_type_Ca_current__V; // millivolt
339  const NekDouble var_L_type_Ca_current_d_gate__alpha_d = (1.4 / (1.0 + exp(((-35.0) - var_L_type_Ca_current_d_gate__V) / 13.0))) + 0.25; // dimensionless
340  const NekDouble var_L_type_Ca_current_d_gate__gamma_d = 1.0 / (1.0 + exp((50.0 - var_L_type_Ca_current_d_gate__V) / 20.0)); // millisecond
341  const NekDouble var_L_type_Ca_current_d_gate__beta_d = 1.4 / (1.0 + exp((var_L_type_Ca_current_d_gate__V + 5.0) / 5.0)); // dimensionless
342  const NekDouble var_L_type_Ca_current_d_gate__tau_d = (1.0 * var_L_type_Ca_current_d_gate__alpha_d * var_L_type_Ca_current_d_gate__beta_d) + var_L_type_Ca_current_d_gate__gamma_d; // millisecond
343  const NekDouble var_L_type_Ca_current_d_gate__d_inf = 1.0 / (1.0 + exp(((-8.0) - var_L_type_Ca_current_d_gate__V) / 7.5)); // dimensionless
344  const NekDouble var_L_type_Ca_current_f_gate__V = var_L_type_Ca_current__V; // millivolt
345  const NekDouble var_L_type_Ca_current_f_gate__tau_f = (1102.5 * exp((-pow(var_L_type_Ca_current_f_gate__V + 27.0, 2.0)) / 225.0)) + (200.0 / (1.0 + exp((13.0 - var_L_type_Ca_current_f_gate__V) / 10.0))) + (180.0 / (1.0 + exp((var_L_type_Ca_current_f_gate__V + 30.0) / 10.0))) + 20.0; // millisecond
346  const NekDouble var_L_type_Ca_current_f_gate__f_inf = 1.0 / (1.0 + exp((var_L_type_Ca_current_f_gate__V + 20.0) / 7.0)); // dimensionless
347  const NekDouble var_L_type_Ca_current_f2_gate__V = var_L_type_Ca_current__V; // millivolt
348  const NekDouble var_L_type_Ca_current_f2_gate__f2_inf = (0.67 / (1.0 + exp((var_L_type_Ca_current_f2_gate__V + 35.0) / 7.0))) + 0.33; // dimensionless
349  const NekDouble var_L_type_Ca_current_f2_gate__tau_f2 = (562.0 * exp((-pow(var_L_type_Ca_current_f2_gate__V + 27.0, 2.0)) / 240.0)) + (31.0 / (1.0 + exp((25.0 - var_L_type_Ca_current_f2_gate__V) / 10.0))) + (80.0 / (1.0 + exp((var_L_type_Ca_current_f2_gate__V + 30.0) / 10.0))); // millisecond
350  const NekDouble var_L_type_Ca_current_fCass_gate__Ca_ss = var_L_type_Ca_current__Ca_ss; // millimolar
351  const NekDouble var_L_type_Ca_current_fCass_gate__tau_fCass = (80.0 / (1.0 + pow(var_L_type_Ca_current_fCass_gate__Ca_ss / 0.05, 2.0))) + 2.0; // millisecond
352  const NekDouble var_L_type_Ca_current_fCass_gate__fCass_inf = (0.6 / (1.0 + pow(var_L_type_Ca_current_fCass_gate__Ca_ss / 0.05, 2.0))) + 0.4; // dimensionless
353  const NekDouble var_transient_outward_current_s_gate__V = var_transient_outward_current__V; // millivolt
354  const NekDouble var_transient_outward_current_s_gate__s_inf = 1.0 / (1.0 + exp((var_transient_outward_current_s_gate__V + s_inf_factor) / 5.0)); // dimensionless
355  const NekDouble var_transient_outward_current_s_gate__tau_s = (s_tau_f1 * exp((-pow(var_transient_outward_current_s_gate__V + s_tau_f2, 2.0)) / s_tau_f3)) + s_tau_f4 + s_tau_f5*((5.0 / (1.0 + exp((var_transient_outward_current_s_gate__V - 20.0) / 5.0))) + 3.0); // millisecond
356  const NekDouble var_transient_outward_current_r_gate__V = var_transient_outward_current__V; // millivolt
357  const NekDouble var_transient_outward_current_r_gate__r_inf = 1.0 / (1.0 + exp((20.0 - var_transient_outward_current_r_gate__V) / 6.0)); // dimensionless
358  const NekDouble var_transient_outward_current_r_gate__tau_r = (9.5 * exp((-pow(var_transient_outward_current_r_gate__V + 40.0, 2.0)) / 1800.0)) + 0.8; // millisecond
359  const NekDouble var_calcium_dynamics__Ca_i = var_chaste_interface__calcium_dynamics__Ca_i; // millimolar
360  const NekDouble var_calcium_dynamics__Ca_SR = var_chaste_interface__calcium_dynamics__Ca_SR; // millimolar
361  const NekDouble var_calcium_dynamics__Ca_ss = var_chaste_interface__calcium_dynamics__Ca_ss; // millimolar
362  const NekDouble var_calcium_dynamics__V_rel = 0.102; // per_millisecond
363  const NekDouble var_calcium_dynamics__R_prime = var_chaste_interface__calcium_dynamics__R_prime; // dimensionless
364  const NekDouble var_calcium_dynamics__k1_prime = 0.15; // per_millimolar2_per_millisecond
365  const NekDouble var_calcium_dynamics__max_sr = 2.5; // dimensionless
366  const NekDouble var_calcium_dynamics__EC = 1.5; // millimolar
367  const NekDouble var_calcium_dynamics__min_sr = 1.0; // dimensionless
368  const NekDouble var_calcium_dynamics__kcasr = var_calcium_dynamics__max_sr - ((var_calcium_dynamics__max_sr - var_calcium_dynamics__min_sr) / (1.0 + pow(var_calcium_dynamics__EC / var_calcium_dynamics__Ca_SR, 2.0))); // dimensionless
369  const NekDouble var_calcium_dynamics__k1 = var_calcium_dynamics__k1_prime / var_calcium_dynamics__kcasr; // per_millimolar2_per_millisecond
370  const NekDouble var_calcium_dynamics__k3 = 0.06; // per_millisecond
371  const NekDouble var_calcium_dynamics__O = (var_calcium_dynamics__k1 * pow(var_calcium_dynamics__Ca_ss, 2.0) * var_calcium_dynamics__R_prime) / (var_calcium_dynamics__k3 + (var_calcium_dynamics__k1 * pow(var_calcium_dynamics__Ca_ss, 2.0))); // dimensionless
372  const NekDouble var_calcium_dynamics__i_rel = var_calcium_dynamics__V_rel * var_calcium_dynamics__O * (var_calcium_dynamics__Ca_SR - var_calcium_dynamics__Ca_ss); // millimolar_per_millisecond
373  const NekDouble var_calcium_dynamics__Vmax_up = 0.006375; // millimolar_per_millisecond
374  const NekDouble var_calcium_dynamics__K_up = 0.00025; // millimolar
375  const NekDouble var_calcium_dynamics__i_up = var_calcium_dynamics__Vmax_up / (1.0 + (pow(var_calcium_dynamics__K_up, 2.0) / pow(var_calcium_dynamics__Ca_i, 2.0))); // millimolar_per_millisecond
376  const NekDouble var_calcium_dynamics__V_leak = 0.00036; // per_millisecond
377  const NekDouble var_calcium_dynamics__i_leak = var_calcium_dynamics__V_leak * (var_calcium_dynamics__Ca_SR - var_calcium_dynamics__Ca_i); // millimolar_per_millisecond
378  const NekDouble var_calcium_dynamics__V_xfer = 0.0038; // per_millisecond
379  const NekDouble var_calcium_dynamics__i_xfer = var_calcium_dynamics__V_xfer * (var_calcium_dynamics__Ca_ss - var_calcium_dynamics__Ca_i); // millimolar_per_millisecond
380  const NekDouble var_calcium_dynamics__k2_prime = 0.045; // per_millimolar_per_millisecond
381  const NekDouble var_calcium_dynamics__k2 = var_calcium_dynamics__k2_prime * var_calcium_dynamics__kcasr; // per_millimolar_per_millisecond
382  const NekDouble var_calcium_dynamics__k4 = 0.005; // per_millisecond
383  const NekDouble var_calcium_dynamics__Buf_c = 0.2; // millimolar
384  const NekDouble var_calcium_dynamics__K_buf_c = 0.001; // millimolar
385  const NekDouble var_calcium_dynamics__Ca_i_bufc = 1.0 / (1.0 + ((var_calcium_dynamics__Buf_c * var_calcium_dynamics__K_buf_c) / pow(var_calcium_dynamics__Ca_i + var_calcium_dynamics__K_buf_c, 2.0))); // dimensionless
386  const NekDouble var_calcium_dynamics__K_buf_sr = 0.3; // millimolar
387  const NekDouble var_calcium_dynamics__Buf_sr = 10.0; // millimolar
388  const NekDouble var_calcium_dynamics__Ca_sr_bufsr = 1.0 / (1.0 + ((var_calcium_dynamics__Buf_sr * var_calcium_dynamics__K_buf_sr) / pow(var_calcium_dynamics__Ca_SR + var_calcium_dynamics__K_buf_sr, 2.0))); // dimensionless
389  const NekDouble var_calcium_dynamics__Buf_ss = 0.4; // millimolar
390  const NekDouble var_calcium_dynamics__K_buf_ss = 0.00025; // millimolar
391  const NekDouble var_calcium_dynamics__Ca_ss_bufss = 1.0 / (1.0 + ((var_calcium_dynamics__Buf_ss * var_calcium_dynamics__K_buf_ss) / pow(var_calcium_dynamics__Ca_ss + var_calcium_dynamics__K_buf_ss, 2.0))); // dimensionless
392  const NekDouble var_calcium_dynamics__V_sr = 0.001094; // micrometre3
393  const NekDouble var_calcium_dynamics__V_ss = 5.468e-05; // micrometre3
394  const NekDouble var_calcium_dynamics__V_c = var_membrane__V_c; // micrometre3
395  const NekDouble var_calcium_dynamics__F = var_membrane__F; // coulomb_per_millimole
396  const NekDouble var_calcium_dynamics__Cm = var_membrane__Cm; // microF
397  const NekDouble var_calcium_dynamics__i_CaL = var_L_type_Ca_current__i_CaL; // picoA_per_picoF
398  const NekDouble var_calcium_dynamics__i_NaCa = var_sodium_calcium_exchanger_current__i_NaCa; // picoA_per_picoF
399  const NekDouble var_calcium_dynamics__i_p_Ca = var_calcium_pump_current__i_p_Ca; // picoA_per_picoF
400  const NekDouble var_calcium_dynamics__i_b_Ca = var_calcium_background_current__i_b_Ca; // picoA_per_picoF
401  const NekDouble var_calcium_dynamics__d_Ca_i_d_environment__time = var_calcium_dynamics__Ca_i_bufc * (((((var_calcium_dynamics__i_leak - var_calcium_dynamics__i_up) * var_calcium_dynamics__V_sr) / var_calcium_dynamics__V_c) + var_calcium_dynamics__i_xfer) - ((1.0 * ((var_calcium_dynamics__i_b_Ca + var_calcium_dynamics__i_p_Ca) - (2.0 * var_calcium_dynamics__i_NaCa)) * var_calcium_dynamics__Cm) / (2.0 * 1.0 * var_calcium_dynamics__V_c * var_calcium_dynamics__F))); // 'millimole per litre per millisecond'
402  const NekDouble var_calcium_dynamics__d_Ca_SR_d_environment__time = var_calcium_dynamics__Ca_sr_bufsr * (var_calcium_dynamics__i_up - (var_calcium_dynamics__i_rel + var_calcium_dynamics__i_leak)); // 'millimole per litre per millisecond'
403  const NekDouble var_calcium_dynamics__d_Ca_ss_d_environment__time = var_calcium_dynamics__Ca_ss_bufss * (((((-1.0) * var_calcium_dynamics__i_CaL * var_calcium_dynamics__Cm) / (2.0 * 1.0 * var_calcium_dynamics__V_ss * var_calcium_dynamics__F)) + ((var_calcium_dynamics__i_rel * var_calcium_dynamics__V_sr) / var_calcium_dynamics__V_ss)) - ((var_calcium_dynamics__i_xfer * var_calcium_dynamics__V_c) / var_calcium_dynamics__V_ss)); // 'millimole per litre per millisecond'
404  const NekDouble var_calcium_dynamics__d_R_prime_d_environment__time = ((-var_calcium_dynamics__k2) * var_calcium_dynamics__Ca_ss * var_calcium_dynamics__R_prime) + (var_calcium_dynamics__k4 * (1.0 - var_calcium_dynamics__R_prime)); // per_millisecond
405  const NekDouble var_sodium_dynamics__F = var_membrane__F; // coulomb_per_millimole
406  const NekDouble var_sodium_dynamics__Cm = var_membrane__Cm; // microF
407  const NekDouble var_sodium_dynamics__V_c = var_membrane__V_c; // micrometre3
408  const NekDouble var_sodium_dynamics__i_Na = var_fast_sodium_current__i_Na; // picoA_per_picoF
409  const NekDouble var_sodium_dynamics__i_NaCa = var_sodium_calcium_exchanger_current__i_NaCa; // picoA_per_picoF
410  const NekDouble var_sodium_dynamics__i_NaK = var_sodium_potassium_pump_current__i_NaK; // picoA_per_picoF
411  const NekDouble var_sodium_dynamics__i_b_Na = var_sodium_background_current__i_b_Na; // picoA_per_picoF
412  const NekDouble var_sodium_dynamics__d_Na_i_d_environment__time = (((-1.0) * (var_sodium_dynamics__i_Na + var_sodium_dynamics__i_b_Na + (3.0 * var_sodium_dynamics__i_NaK) + (3.0 * var_sodium_dynamics__i_NaCa))) / (1.0 * var_sodium_dynamics__V_c * var_sodium_dynamics__F)) * var_sodium_dynamics__Cm; // 'millimole per litre per millisecond'
413  const NekDouble var_potassium_dynamics__F = var_membrane__F; // coulomb_per_millimole
414  const NekDouble var_potassium_dynamics__Cm = var_membrane__Cm; // microF
415  const NekDouble var_potassium_dynamics__V_c = var_membrane__V_c; // micrometre3
416  const NekDouble var_potassium_dynamics__i_K1 = var_inward_rectifier_potassium_current__i_K1; // picoA_per_picoF
417  const NekDouble var_potassium_dynamics__i_to = var_transient_outward_current__i_to; // picoA_per_picoF
418  const NekDouble var_potassium_dynamics__i_NaK = var_sodium_potassium_pump_current__i_NaK; // picoA_per_picoF
419  const NekDouble var_potassium_dynamics__i_Kr = var_rapid_time_dependent_potassium_current__i_Kr; // picoA_per_picoF
420  const NekDouble var_potassium_dynamics__i_Ks = var_slow_time_dependent_potassium_current__i_Ks; // picoA_per_picoF
421  const NekDouble var_potassium_dynamics__i_p_K = var_potassium_pump_current__i_p_K; // picoA_per_picoF
422  const NekDouble var_potassium_dynamics__chaste_interface__chaste_membrane_capacitance = 1.0; // uF_per_cm2
423  const NekDouble var_potassium_dynamics__i_Stim_converter = var_chaste_interface__membrane__i_Stim; // uA_per_cm2
424  const NekDouble var_potassium_dynamics__i_Stim = var_potassium_dynamics__i_Stim_converter / var_potassium_dynamics__chaste_interface__chaste_membrane_capacitance; // picoA_per_picoF
425  const NekDouble var_potassium_dynamics__d_K_i_d_environment__time = (((-1.0) * ((var_potassium_dynamics__i_K1 + var_potassium_dynamics__i_to + var_potassium_dynamics__i_Kr + var_potassium_dynamics__i_Ks + var_potassium_dynamics__i_p_K + var_potassium_dynamics__i_Stim) - (2.0 * var_potassium_dynamics__i_NaK))) / (1.0 * var_potassium_dynamics__V_c * var_potassium_dynamics__F)) * var_potassium_dynamics__Cm; // 'millimole per litre per millisecond'
426  const NekDouble var_chaste_interface__calcium_dynamics__d_Ca_i_d_environment__time = var_calcium_dynamics__d_Ca_i_d_environment__time; // millimolar_per_millisecond
427  const NekDouble var_chaste_interface__calcium_dynamics__d_Ca_SR_d_environment__time = var_calcium_dynamics__d_Ca_SR_d_environment__time; // millimolar_per_millisecond
428  const NekDouble var_chaste_interface__calcium_dynamics__d_Ca_ss_d_environment__time = var_calcium_dynamics__d_Ca_ss_d_environment__time; // millimolar_per_millisecond
429  const NekDouble var_chaste_interface__calcium_dynamics__d_R_prime_d_environment__time = var_calcium_dynamics__d_R_prime_d_environment__time; // per_millisecond
430  const NekDouble var_chaste_interface__sodium_dynamics__d_Na_i_d_environment__time = var_sodium_dynamics__d_Na_i_d_environment__time; // millimolar_per_millisecond
431  const NekDouble var_chaste_interface__potassium_dynamics__d_K_i_d_environment__time = var_potassium_dynamics__d_K_i_d_environment__time; // millimolar_per_millisecond
432  const NekDouble d_dt_chaste_interface__calcium_dynamics__Ca_i = var_chaste_interface__calcium_dynamics__d_Ca_i_d_environment__time; // 'millimole per litre per millisecond'
433  const NekDouble d_dt_chaste_interface__calcium_dynamics__Ca_SR = var_chaste_interface__calcium_dynamics__d_Ca_SR_d_environment__time; // 'millimole per litre per millisecond'
434  const NekDouble d_dt_chaste_interface__calcium_dynamics__Ca_ss = var_chaste_interface__calcium_dynamics__d_Ca_ss_d_environment__time; // 'millimole per litre per millisecond'
435  const NekDouble d_dt_chaste_interface__calcium_dynamics__R_prime = var_chaste_interface__calcium_dynamics__d_R_prime_d_environment__time; // per_millisecond
436  const NekDouble d_dt_chaste_interface__sodium_dynamics__Na_i = var_chaste_interface__sodium_dynamics__d_Na_i_d_environment__time; // 'millimole per litre per millisecond'
437  const NekDouble d_dt_chaste_interface__potassium_dynamics__K_i = var_chaste_interface__potassium_dynamics__d_K_i_d_environment__time; // 'millimole per litre per millisecond'
438 
439  const NekDouble var_membrane__i_K1 = var_inward_rectifier_potassium_current__i_K1; // picoA_per_picoF
440  const NekDouble var_membrane__i_to = var_transient_outward_current__i_to; // picoA_per_picoF
441  const NekDouble var_membrane__i_Kr = var_rapid_time_dependent_potassium_current__i_Kr; // picoA_per_picoF
442  const NekDouble var_membrane__i_Ks = var_slow_time_dependent_potassium_current__i_Ks; // picoA_per_picoF
443  const NekDouble var_membrane__i_CaL = var_L_type_Ca_current__i_CaL; // picoA_per_picoF
444  const NekDouble var_membrane__i_NaK = var_sodium_potassium_pump_current__i_NaK; // picoA_per_picoF
445  const NekDouble var_membrane__i_Na = var_fast_sodium_current__i_Na; // picoA_per_picoF
446  const NekDouble var_membrane__i_b_Na = var_sodium_background_current__i_b_Na; // picoA_per_picoF
447  const NekDouble var_membrane__i_NaCa = var_sodium_calcium_exchanger_current__i_NaCa; // picoA_per_picoF
448  const NekDouble var_membrane__i_b_Ca = var_calcium_background_current__i_b_Ca; // picoA_per_picoF
449  const NekDouble var_membrane__i_p_K = var_potassium_pump_current__i_p_K; // picoA_per_picoF
450  const NekDouble var_membrane__i_p_Ca = var_calcium_pump_current__i_p_Ca; // picoA_per_picoF
451  const NekDouble var_membrane__i_Stim_converter = var_chaste_interface__membrane__i_Stim; // uA_per_cm2
452  const NekDouble var_membrane__chaste_interface__chaste_membrane_capacitance = 1.0; // uF_per_cm2
453  const NekDouble var_membrane__i_Stim = var_membrane__i_Stim_converter / var_membrane__chaste_interface__chaste_membrane_capacitance; // picoA_per_picoF
454  const NekDouble var_membrane__d_V_d_environment__time = ((-1.0) / 1.0) * (var_membrane__i_K1 + var_membrane__i_to + var_membrane__i_Kr + var_membrane__i_Ks + var_membrane__i_CaL + var_membrane__i_NaK + var_membrane__i_Na + var_membrane__i_b_Na + var_membrane__i_NaCa + var_membrane__i_b_Ca + var_membrane__i_p_K + var_membrane__i_p_Ca + var_membrane__i_Stim); // 'millivolt per millisecond'
455  const NekDouble var_chaste_interface__membrane__d_V_d_environment__time = var_membrane__d_V_d_environment__time; // ___units_1
456  d_dt_chaste_interface__membrane__V = var_chaste_interface__membrane__d_V_d_environment__time; // 'millivolt per millisecond'
457  outarray[0][i] = d_dt_chaste_interface__membrane__V;
458  outarray[1][i] = var_rapid_time_dependent_potassium_current_Xr1_gate__xr1_inf;
459  m_gates_tau[0][i] = var_rapid_time_dependent_potassium_current_Xr1_gate__tau_xr1;
460  outarray[2][i] = var_rapid_time_dependent_potassium_current_Xr2_gate__xr2_inf;
461  m_gates_tau[1][i] = var_rapid_time_dependent_potassium_current_Xr2_gate__tau_xr2;
462  outarray[3][i] = var_slow_time_dependent_potassium_current_Xs_gate__xs_inf;
463  m_gates_tau[2][i] = var_slow_time_dependent_potassium_current_Xs_gate__tau_xs;
464  outarray[4][i] = var_fast_sodium_current_m_gate__m_inf;
465  m_gates_tau[3][i] = var_fast_sodium_current_m_gate__tau_m;
466  outarray[5][i] = var_fast_sodium_current_h_gate__h_inf;
467  m_gates_tau[4][i] = var_fast_sodium_current_h_gate__tau_h;
468  outarray[6][i] = var_fast_sodium_current_j_gate__j_inf;
469  m_gates_tau[5][i] = var_fast_sodium_current_j_gate__tau_j;
470  outarray[7][i] = var_L_type_Ca_current_d_gate__d_inf;
471  m_gates_tau[6][i] = var_L_type_Ca_current_d_gate__tau_d;
472  outarray[8][i] = var_L_type_Ca_current_f_gate__f_inf;
473  m_gates_tau[7][i] = var_L_type_Ca_current_f_gate__tau_f;
474  outarray[9][i] = var_L_type_Ca_current_f2_gate__f2_inf;
475  m_gates_tau[8][i] = var_L_type_Ca_current_f2_gate__tau_f2;
476  outarray[10][i] = var_L_type_Ca_current_fCass_gate__fCass_inf;
477  m_gates_tau[9][i] = var_L_type_Ca_current_fCass_gate__tau_fCass;
478  outarray[11][i] = var_transient_outward_current_s_gate__s_inf;
479  m_gates_tau[10][i] = var_transient_outward_current_s_gate__tau_s;
480  outarray[12][i] = var_transient_outward_current_r_gate__r_inf;
481  m_gates_tau[11][i] = var_transient_outward_current_r_gate__tau_r;
482  outarray[13][i] = d_dt_chaste_interface__calcium_dynamics__Ca_i;
483  outarray[14][i] = d_dt_chaste_interface__calcium_dynamics__Ca_SR;
484  outarray[15][i] = d_dt_chaste_interface__calcium_dynamics__Ca_ss;
485  outarray[16][i] = d_dt_chaste_interface__calcium_dynamics__R_prime;
486  outarray[17][i] = d_dt_chaste_interface__sodium_dynamics__Na_i;
487  outarray[18][i] = d_dt_chaste_interface__potassium_dynamics__K_i;
488  }
489 
490 }
491 
492 
493 /**
494  *
495  */
497 {
498  SolverUtils::AddSummaryItem(s, "Cell model", "TenTusscher06");
499 }
500 
501 
502 /**
503  *
504  */
506 {
507  // Values taken from CellML website
508  switch (model_variant)
509  {
510  case eEpicardium:
511  Vmath::Fill(m_nq, -85.23, m_cellSol[0], 1);
512  Vmath::Fill(m_nq, 0.00621, m_cellSol[1], 1);
513  Vmath::Fill(m_nq, 0.4712, m_cellSol[2], 1);
514  Vmath::Fill(m_nq, 0.0095, m_cellSol[3], 1);
515  Vmath::Fill(m_nq, 0.00172, m_cellSol[4], 1);
516  Vmath::Fill(m_nq, 0.7444, m_cellSol[5], 1);
517  Vmath::Fill(m_nq, 0.7045, m_cellSol[6], 1);
518  Vmath::Fill(m_nq, 3.373e-5, m_cellSol[7], 1);
519  Vmath::Fill(m_nq, 0.7888, m_cellSol[8], 1);
520  Vmath::Fill(m_nq, 0.9755, m_cellSol[9], 1);
521  Vmath::Fill(m_nq, 0.9953, m_cellSol[10], 1);
522  Vmath::Fill(m_nq, 0.999998, m_cellSol[11], 1);
523  Vmath::Fill(m_nq, 2.42e-8, m_cellSol[12], 1);
524  Vmath::Fill(m_nq, 0.000126, m_cellSol[13], 1);
525  Vmath::Fill(m_nq, 3.64, m_cellSol[14], 1);
526  Vmath::Fill(m_nq, 0.00036, m_cellSol[15], 1);
527  Vmath::Fill(m_nq, 0.9073, m_cellSol[16], 1);
528  Vmath::Fill(m_nq, 8.604, m_cellSol[17], 1);
529  Vmath::Fill(m_nq, 136.89, m_cellSol[18], 1);
530  break;
531  case eEndocardium:
532  Vmath::Fill(m_nq, -86.709, m_cellSol[0], 1);
533  Vmath::Fill(m_nq, 0.00448, m_cellSol[1], 1);
534  Vmath::Fill(m_nq, 0.476, m_cellSol[2], 1);
535  Vmath::Fill(m_nq, 0.0087, m_cellSol[3], 1);
536  Vmath::Fill(m_nq, 0.00155, m_cellSol[4], 1);
537  Vmath::Fill(m_nq, 0.7573, m_cellSol[5], 1);
538  Vmath::Fill(m_nq, 0.7225, m_cellSol[6], 1);
539  Vmath::Fill(m_nq, 3.164e-5, m_cellSol[7], 1);
540  Vmath::Fill(m_nq, 0.8009, m_cellSol[8], 1);
541  Vmath::Fill(m_nq, 0.9778, m_cellSol[9], 1);
542  Vmath::Fill(m_nq, 0.9953, m_cellSol[10], 1);
543  Vmath::Fill(m_nq, 0.3212, m_cellSol[11], 1);
544  Vmath::Fill(m_nq, 2.235e-8, m_cellSol[12], 1);
545  Vmath::Fill(m_nq, 0.00013, m_cellSol[13], 1);
546  Vmath::Fill(m_nq, 3.715, m_cellSol[14], 1);
547  Vmath::Fill(m_nq, 0.00036, m_cellSol[15], 1);
548  Vmath::Fill(m_nq, 0.9068, m_cellSol[16], 1);
549  Vmath::Fill(m_nq, 10.355, m_cellSol[17], 1);
550  Vmath::Fill(m_nq, 138.4, m_cellSol[18], 1);
551  break;
552  case eMid:
553  Vmath::Fill(m_nq, -85.423, m_cellSol[0], 1);
554  Vmath::Fill(m_nq, 0.0165, m_cellSol[1], 1);
555  Vmath::Fill(m_nq, 0.473, m_cellSol[2], 1);
556  Vmath::Fill(m_nq, 0.0174, m_cellSol[3], 1);
557  Vmath::Fill(m_nq, 0.00165, m_cellSol[4], 1);
558  Vmath::Fill(m_nq, 0.749, m_cellSol[5], 1);
559  Vmath::Fill(m_nq, 0.6788, m_cellSol[6], 1);
560  Vmath::Fill(m_nq, 3.288e-5, m_cellSol[7], 1);
561  Vmath::Fill(m_nq, 0.7026, m_cellSol[8], 1);
562  Vmath::Fill(m_nq, 0.9526, m_cellSol[9], 1);
563  Vmath::Fill(m_nq, 0.9942, m_cellSol[10], 1);
564  Vmath::Fill(m_nq, 0.999998, m_cellSol[11], 1);
565  Vmath::Fill(m_nq, 2.347e-8, m_cellSol[12], 1);
566  Vmath::Fill(m_nq, 0.000153, m_cellSol[13], 1);
567  Vmath::Fill(m_nq, 4.272, m_cellSol[14], 1);
568  Vmath::Fill(m_nq, 0.00042, m_cellSol[15], 1);
569  Vmath::Fill(m_nq, 0.8978, m_cellSol[16], 1);
570  Vmath::Fill(m_nq, 10.132, m_cellSol[17], 1);
571  Vmath::Fill(m_nq, 138.52, m_cellSol[18], 1);
572  break;
573  case eIschemia:
574  Vmath::Fill(m_nq, -85.23, m_cellSol[0], 1);
575  Vmath::Fill(m_nq, 0.00621, m_cellSol[1], 1);
576  Vmath::Fill(m_nq, 0.4712, m_cellSol[2], 1);
577  Vmath::Fill(m_nq, 0.0095, m_cellSol[3], 1);
578  Vmath::Fill(m_nq, 0.00172, m_cellSol[4], 1);
579  Vmath::Fill(m_nq, 0.7444, m_cellSol[5], 1);
580  Vmath::Fill(m_nq, 0.7045, m_cellSol[6], 1);
581  Vmath::Fill(m_nq, 3.373e-5, m_cellSol[7], 1);
582  Vmath::Fill(m_nq, 0.7888, m_cellSol[8], 1);
583  Vmath::Fill(m_nq, 0.9755, m_cellSol[9], 1);
584  Vmath::Fill(m_nq, 0.9953, m_cellSol[10], 1);
585  Vmath::Fill(m_nq, 0.999998, m_cellSol[11], 1);
586  Vmath::Fill(m_nq, 2.42e-8, m_cellSol[12], 1);
587  Vmath::Fill(m_nq, 0.000126, m_cellSol[13], 1);
588  Vmath::Fill(m_nq, 3.64, m_cellSol[14], 1);
589  Vmath::Fill(m_nq, 0.00036, m_cellSol[15], 1);
590  Vmath::Fill(m_nq, 0.9073, m_cellSol[16], 1);
591  Vmath::Fill(m_nq, 8.604, m_cellSol[17], 1);
592  Vmath::Fill(m_nq, 136.89, m_cellSol[18], 1);
593  break;
594  }
595 
596 }
597 
598 }
599