Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CourtemancheRamirezNattel98.cpp
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File CourtemancheRamirezNattel.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: Courtemanche-Ramirez-Nattel ionic atrial cell model.
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #include <iostream>
37 #include <string>
38 
41 
42 using namespace std;
43 
44 namespace Nektar
45 {
46  std::string CourtemancheRamirezNattel98::className
48  "CourtemancheRamirezNattel98",
49  CourtemancheRamirezNattel98::create,
50  "Ionic model of human atrial cell electrophysiology.");
51 
52  // Register cell model variants
53  std::string CourtemancheRamirezNattel98::lookupIds[2] = {
54  LibUtilities::SessionReader::RegisterEnumValue("CellModelVariant",
55  "Original", CourtemancheRamirezNattel98::eOriginal),
56  LibUtilities::SessionReader::RegisterEnumValue("CellModelVariant",
57  "AF", CourtemancheRamirezNattel98::eAF)
58  };
59 
60  // Register default variant
61  std::string CourtemancheRamirezNattel98::def =
62  LibUtilities::SessionReader::RegisterDefaultSolverInfo(
63  "CellModelVariant", "Original");
64 
65  /**
66  *
67  */
68  CourtemancheRamirezNattel98::CourtemancheRamirezNattel98(
70  const MultiRegions::ExpListSharedPtr& pField)
71  : CellModel(pSession, pField)
72  {
73  model_variant = pSession->GetSolverInfoAsEnum<
74  CourtemancheRamirezNattel98::Variants>("CellModelVariant");
75 
76  C_m = 100; // picoF
77  g_Na = 7.8; // nanoS_per_picoF
78  g_K1 = 0.09; // nanoS_per_picoF
79  g_Kr = 0.029411765;
80  g_Ks = 0.12941176;
81  g_b_Na = 0.0006744375;
82  g_b_Ca = 0.001131;
83  R = 8.3143;
84  T = 310.0;
85  F = 96.4867;
86  Na_o = 140.0; // millimolar
87  K_o = 5.4; // millimolar
88  sigma = 1.0/7.0*(exp(Na_o/67.3)-1);
89  K_i = 1.5;
90  K_m_Na_i = 10.0;
91  I_Na_K_max = 0.59933874;
92  I_NaCa_max = 1600.0;
93  gamma = 0.35;
94  Ca_o = 1.8;
95  K_m_Na = 87.5;
96  K_m_Ca = 1.38;
97  K_sat = 0.1;
98  I_p_Ca_max = 0.275;
99  Trpn_max = 0.07;
100  Km_Trpn = 0.0005;
101  Cmdn_max = 0.05;
102  Csqn_max = 10.0;
103  Km_Cmdn = 0.00238;
104  Km_Csqn = 0.8;
105  NSR_I_up_max = 0.005;
106  NSR_I_Ca_max = 15.0;
107  NSR_K_up = 0.00092;
108  JSR_K_rel = 30.0;
109  JSR_V_cell = 20100.0;
110  JSR_V_rel = 0.0048 * JSR_V_cell;
111  JSR_V_up = 0.0552 * JSR_V_cell;
112  tau_tr = 180.0;
113  K_Q10 = 3.0;
114  V_i = 0.68*JSR_V_cell;
115 
116  switch (model_variant) {
117  case eOriginal:
118  g_to = 0.1652; // nanoS_per_picoF
119  g_Kur_scaling = 1.0;
120  g_Ca_L = 0.12375;
121  break;
122  case eAF:
123  g_to = 0.0826; // nanoS_per_picoF
124  g_Kur_scaling = 0.5;
125  g_Ca_L = 0.037125;
126  break;
127  }
128 
129  m_nvar = 21;
130 
131  // List gates and concentrations
132  m_gates.push_back(1);
133  m_gates.push_back(2);
134  m_gates.push_back(3);
135  m_gates.push_back(4);
136  m_gates.push_back(5);
137  m_gates.push_back(6);
138  m_gates.push_back(7);
139  m_gates.push_back(8);
140  m_gates.push_back(9);
141  m_gates.push_back(10);
142  m_gates.push_back(11);
143  m_gates.push_back(12);
144  m_gates.push_back(13);
145  m_gates.push_back(14);
146  m_gates.push_back(15);
147  m_concentrations.push_back(16);
148  m_concentrations.push_back(17);
149  m_concentrations.push_back(18);
150  m_concentrations.push_back(19);
151  m_concentrations.push_back(20);
152  }
153 
154 
155 
156  /**
157  *
158  */
160  {
161 
162  }
163 
164 
165 
167  const Array<OneD, const Array<OneD, NekDouble> >&inarray,
168  Array<OneD, Array<OneD, NekDouble> >&outarray,
169  const NekDouble time)
170  {
171  ASSERTL0(inarray.get() != outarray.get(),
172  "Must have different arrays for input and output.");
173 
174  // Variables
175  // 0 V membrane potential
176  // 2 m fast sodium current m gate
177  // 3 h fast sodium current h gate
178  // 4 j fast sodium current j gate
179  // 5 o_a transient outward potassium o_a gate
180  // 6 o_i transient outward potassium o_i gate
181  // 7 u_a ultra-rapid delayed rectifier K current gate
182  // 8 u_i ultra-rapid delayed rectifier K current gate
183  // 9 x_r rapid delayed rectifier K current gate
184  // 10 x_s slow delayed rectifier K current gate
185  // 11 d L_type calcium gate
186  // 12 f L-type calcium gate
187  // 13 f_Ca L-type calcium gate
188  // 14 u Ca release u gate
189  // 15 v Ca release v gate
190  // 16 w Ca release w gate
191  // 17 Na_i Sodium
192  // 18 Ca_i Calcium
193  // 19 K_i Potassium
194  // 20 Ca_rel Calcium Rel
195  // 21 Ca_up Calcium up
196  int n = m_nq;
197  int i = 0;
198  NekDouble alpha, beta;
199  Vmath::Zero(n, outarray[0], 1);
200 
201  Array<OneD, NekDouble> &tmp = outarray[11];
202  Array<OneD, NekDouble> &tmp2 = outarray[12];
203 
204  // E_Na
205  Array<OneD, NekDouble> &tmp_E_na = outarray[14];
206  Vmath::Sdiv(n, Na_o, inarray[16], 1, tmp_E_na, 1);
207  Vmath::Vlog(n, tmp_E_na, 1, tmp_E_na, 1);
208  Vmath::Smul(n, R*T/F, tmp_E_na, 1, tmp_E_na, 1);
209 
210  // Sodium I_Na
211  Array<OneD, NekDouble> &tmp_I_Na = outarray[15];
212  Vmath::Vsub(n, inarray[0], 1, tmp_E_na, 1, tmp_I_Na, 1);
213  Vmath::Vmul(n, inarray[1], 1, tmp_I_Na, 1, tmp_I_Na, 1);
214  Vmath::Vmul(n, inarray[1], 1, tmp_I_Na, 1, tmp_I_Na, 1);
215  Vmath::Vmul(n, inarray[1], 1, tmp_I_Na, 1, tmp_I_Na, 1);
216  Vmath::Vmul(n, inarray[2], 1, tmp_I_Na, 1, tmp_I_Na, 1);
217  Vmath::Vmul(n, inarray[3], 1, tmp_I_Na, 1, tmp_I_Na, 1);
218  Vmath::Smul(n, C_m*g_Na, tmp_I_Na, 1, tmp_I_Na, 1);
219  Vmath::Vsub(n, outarray[0], 1, tmp_I_Na, 1, outarray[0], 1);
220  Vmath::Smul(n, -1.0, tmp_I_Na, 1, outarray[16], 1);
221 
222  // Background current, sodium
223  Array<OneD, NekDouble> &tmp_I_b_Na = outarray[15];
224  Vmath::Vsub(n, inarray[0], 1, tmp_E_na, 1, tmp_I_b_Na, 1);
225  Vmath::Smul(n, C_m*g_b_Na, tmp_I_b_Na, 1, tmp_I_b_Na, 1);
226  Vmath::Vsub(n, outarray[0], 1, tmp_I_b_Na, 1, outarray[0], 1);
227  Vmath::Vsub(n, outarray[16], 1, tmp_I_b_Na, 1, outarray[16], 1);
228 
229  // V - E_K
230  Array<OneD, NekDouble> &tmp_V_E_k = outarray[14];
231  Vmath::Sdiv(n, K_o, inarray[18], 1, tmp_V_E_k, 1);
232  Vmath::Vlog(n, tmp_V_E_k, 1, tmp_V_E_k, 1);
233  Vmath::Smul(n, R*T/F, tmp_V_E_k, 1, tmp_V_E_k, 1);
234  Vmath::Vsub(n, inarray[0], 1, tmp_V_E_k, 1, tmp_V_E_k, 1);
235 
236  // Potassium I_K1
237  Array<OneD, NekDouble> &tmp_I_K1 = outarray[15];
238  Vmath::Sadd(n, 80.0, inarray[0], 1, tmp_I_K1, 1);
239  Vmath::Smul(n, 0.07, tmp_I_K1, 1, tmp_I_K1, 1);
240  Vmath::Vexp(n, tmp_I_K1, 1, tmp_I_K1, 1);
241  Vmath::Sadd(n, 1.0, tmp_I_K1, 1, tmp_I_K1, 1);
242  Vmath::Vdiv(n, tmp_V_E_k, 1, tmp_I_K1, 1, tmp_I_K1, 1);
243  Vmath::Smul(n, C_m*g_K1, tmp_I_K1, 1, tmp_I_K1, 1);
244  Vmath::Vsub(n, outarray[0], 1, tmp_I_K1, 1, outarray[0], 1);
245  Vmath::Smul(n, -1.0, tmp_I_K1, 1, outarray[18], 1);
246 
247  // Transient Outward K+ current
248  Array<OneD, NekDouble> &tmp_I_to = outarray[15];
249  Vmath::Vmul(n, inarray[5], 1, tmp_V_E_k, 1, tmp_I_to, 1);
250  Vmath::Vmul(n, inarray[4], 1, tmp_I_to, 1, tmp_I_to, 1);
251  Vmath::Vmul(n, inarray[4], 1, tmp_I_to, 1, tmp_I_to, 1);
252  Vmath::Vmul(n, inarray[4], 1, tmp_I_to, 1, tmp_I_to, 1);
253  Vmath::Smul(n, C_m*g_to, tmp_I_to, 1, tmp_I_to, 1);
254  Vmath::Vsub(n, outarray[0], 1, tmp_I_to, 1, outarray[0], 1);
255  Vmath::Vsub(n, outarray[18], 1, tmp_I_to, 1, outarray[18], 1);
256 
257  // Ultrarapid Delayed rectifier K+ current
258  Array<OneD, NekDouble> &tmp_I_kur = outarray[15];
259  Vmath::Sadd(n, -15.0, inarray[0], 1, tmp_I_kur, 1);
260  Vmath::Smul(n, -1.0/13.0, tmp_I_kur, 1, tmp_I_kur, 1);
261  Vmath::Vexp(n, tmp_I_kur, 1, tmp_I_kur, 1);
262  Vmath::Sadd(n, 1.0, tmp_I_kur, 1, tmp_I_kur, 1);
263  Vmath::Sdiv(n, 0.05, tmp_I_kur, 1, tmp_I_kur, 1);
264  Vmath::Sadd(n, 0.005, tmp_I_kur, 1, tmp_I_kur, 1);
265  Vmath::Vmul(n, tmp_V_E_k, 1, tmp_I_kur, 1, tmp_I_kur, 1);
266  Vmath::Vmul(n, inarray[6], 1, tmp_I_kur, 1, tmp_I_kur, 1);
267  Vmath::Vmul(n, inarray[6], 1, tmp_I_kur, 1, tmp_I_kur, 1);
268  Vmath::Vmul(n, inarray[6], 1, tmp_I_kur, 1, tmp_I_kur, 1);
269  Vmath::Vmul(n, inarray[7], 1, tmp_I_kur, 1, tmp_I_kur, 1);
270  Vmath::Smul(n, C_m*g_Kur_scaling, tmp_I_kur, 1, tmp_I_kur, 1);
271  Vmath::Vsub(n, outarray[0], 1, tmp_I_kur, 1, outarray[0], 1);
272  Vmath::Vsub(n, outarray[18], 1, tmp_I_kur, 1, outarray[18], 1);
273 
274  // Rapid delayed outward rectifier K+ current
275  Array<OneD, NekDouble> &tmp_I_Kr = outarray[15];
276  Vmath::Sadd(n, 15.0, inarray[0], 1, tmp_I_Kr, 1);
277  Vmath::Smul(n, 1.0/22.4, tmp_I_Kr, 1, tmp_I_Kr, 1);
278  Vmath::Vexp(n, tmp_I_Kr, 1, tmp_I_Kr, 1);
279  Vmath::Sadd(n, 1.0, tmp_I_Kr, 1, tmp_I_Kr, 1);
280  Vmath::Vdiv(n, tmp_V_E_k, 1, tmp_I_Kr, 1, tmp_I_Kr, 1);
281  Vmath::Vmul(n, inarray[8], 1, tmp_I_Kr, 1, tmp_I_Kr, 1);
282  Vmath::Smul(n, C_m*g_Kr, tmp_I_Kr, 1, tmp_I_Kr, 1);
283  Vmath::Vsub(n, outarray[0], 1, tmp_I_Kr, 1, outarray[0], 1);
284  Vmath::Vsub(n, outarray[18], 1, tmp_I_Kr, 1, outarray[18], 1);
285 
286  // Slow delayed outward rectifier K+ Current
287  Array<OneD, NekDouble> &tmp_I_Ks = outarray[15];
288  Vmath::Vmul(n, inarray[9], 1, tmp_V_E_k, 1, tmp_I_Ks, 1);
289  Vmath::Vmul(n, inarray[9], 1, tmp_I_Ks, 1, tmp_I_Ks, 1);
290  Vmath::Smul(n, C_m*g_Ks, tmp_I_Ks, 1, tmp_I_Ks, 1);
291  Vmath::Vsub(n, outarray[0], 1, tmp_I_Ks, 1, outarray[0], 1);
292  Vmath::Vsub(n, outarray[18], 1, tmp_I_Ks, 1, outarray[18], 1);
293 
294  // Background current, calcium
295  Array<OneD, NekDouble> &tmp_I_b_Ca = outarray[1];
296  Vmath::Sdiv(n, Ca_o, inarray[17], 1, tmp_I_b_Ca, 1);
297  Vmath::Vlog(n, tmp_I_b_Ca, 1, tmp_I_b_Ca, 1);
298  Vmath::Smul(n, 0.5*R*T/F, tmp_I_b_Ca, 1, tmp_I_b_Ca, 1);
299  Vmath::Vsub(n, inarray[0], 1, tmp_I_b_Ca, 1, tmp_I_b_Ca, 1);
300  Vmath::Smul(n, C_m*g_b_Ca, tmp_I_b_Ca, 1, tmp_I_b_Ca, 1);
301  Vmath::Vsub(n, outarray[0], 1, tmp_I_b_Ca, 1, outarray[0], 1);
302 
303  // L-Type Ca2+ current
304  Array<OneD, NekDouble> &tmp_I_Ca_L = outarray[2];
305  Vmath::Sadd(n, -65.0, inarray[0], 1, tmp_I_Ca_L, 1);
306  Vmath::Vmul(n, inarray[10], 1, tmp_I_Ca_L, 1, tmp_I_Ca_L, 1);
307  Vmath::Vmul(n, inarray[11], 1, tmp_I_Ca_L, 1, tmp_I_Ca_L, 1);
308  Vmath::Vmul(n, inarray[12], 1, tmp_I_Ca_L, 1, tmp_I_Ca_L, 1);
309  Vmath::Smul(n, C_m*g_Ca_L, tmp_I_Ca_L, 1, tmp_I_Ca_L, 1);
310  Vmath::Vsub(n, outarray[0], 1, tmp_I_Ca_L, 1, outarray[0], 1);
311 
312  // Na-K Pump Current
313  Array<OneD, NekDouble> &tmp_f_Na_k = outarray[14];
314  Vmath::Smul(n, -F/R/T, inarray[0], 1, tmp_f_Na_k, 1);
315  Vmath::Vexp(n, tmp_f_Na_k, 1, tmp, 1);
316  Vmath::Smul(n, 0.0365*sigma, tmp, 1, tmp, 1);
317  Vmath::Smul(n, -0.1*F/R/T, inarray[0], 1, tmp_f_Na_k, 1);
318  Vmath::Vexp(n, tmp_f_Na_k, 1, tmp_f_Na_k, 1);
319  Vmath::Smul(n, 0.1245, tmp_f_Na_k, 1, tmp_f_Na_k, 1);
320  Vmath::Vadd(n, tmp_f_Na_k, 1, tmp, 1, tmp_f_Na_k, 1);
321  Vmath::Sadd(n, 1.0, tmp_f_Na_k, 1, tmp_f_Na_k, 1);
322 
323  Array<OneD, NekDouble> &tmp_I_Na_K = outarray[15];
324  Vmath::Sdiv(n, K_m_Na_i, inarray[16], 1, tmp_I_Na_K, 1);
325  Vmath::Vpow(n, tmp_I_Na_K, 1, 1.5, tmp_I_Na_K, 1);
326  Vmath::Sadd(n, 1.0, tmp_I_Na_K, 1, tmp_I_Na_K, 1);
327  Vmath::Vmul(n, tmp_f_Na_k, 1, tmp_I_Na_K, 1, tmp_I_Na_K, 1);
328  Vmath::Sdiv(n, C_m*I_Na_K_max*K_o/(K_o+K_i), tmp_I_Na_K, 1, tmp_I_Na_K, 1);
329  Vmath::Vsub(n, outarray[0], 1, tmp_I_Na_K, 1, outarray[0], 1);
330  Vmath::Svtvp(n, -3.0, tmp_I_Na_K, 1, outarray[16], 1, outarray[16], 1);
331  Vmath::Svtvp(n, 2.0, tmp_I_Na_K, 1, outarray[18], 1, outarray[18], 1);
332 
333  // Na-Ca exchanger current
334  Array<OneD, NekDouble> &tmp_I_Na_Ca = outarray[3];
335  Vmath::Smul(n, (gamma-1)*F/R/T, inarray[0], 1, tmp, 1);
336  Vmath::Vexp(n, tmp, 1, tmp, 1);
337  Vmath::Smul(n, K_sat, tmp, 1, tmp_I_Na_Ca, 1);
338  Vmath::Sadd(n, 1.0, tmp_I_Na_Ca, 1, tmp_I_Na_Ca, 1);
339  Vmath::Smul(n, (K_m_Na*K_m_Na*K_m_Na + Na_o*Na_o*Na_o)*(K_m_Ca + Ca_o), tmp_I_Na_Ca, 1, tmp_I_Na_Ca, 1);
340 
341  Vmath::Smul(n, Na_o*Na_o*Na_o, tmp, 1, tmp2, 1);
342  Vmath::Vmul(n, tmp2, 1, inarray[17], 1, tmp2, 1);
343  Vmath::Smul(n, gamma*F/R/T, inarray[0], 1, tmp, 1);
344  Vmath::Vexp(n, tmp, 1, tmp, 1);
345  Vmath::Vmul(n, inarray[16], 1, tmp, 1, tmp, 1);
346  Vmath::Vmul(n, inarray[16], 1, tmp, 1, tmp, 1);
347  Vmath::Vmul(n, inarray[16], 1, tmp, 1, tmp, 1);
348  Vmath::Svtvm(n, Ca_o, tmp, 1, tmp2, 1, tmp, 1);
349  Vmath::Smul(n, C_m*I_NaCa_max, tmp, 1, tmp, 1);
350  Vmath::Vdiv(n, tmp, 1, tmp_I_Na_Ca, 1, tmp_I_Na_Ca, 1);
351  Vmath::Vsub(n, outarray[0], 1, tmp_I_Na_Ca, 1, outarray[0], 1);
352  Vmath::Svtvp(n, -3.0, tmp_I_Na_Ca, 1, outarray[16], 1, outarray[16], 1);
353 
354  // Calcium Pump current
355  Array<OneD, NekDouble> &tmp_I_p_Ca = outarray[4];
356  Vmath::Sadd(n, 0.0005, inarray[17], 1, tmp_I_p_Ca, 1);
357  Vmath::Vdiv(n, inarray[17], 1, tmp_I_p_Ca, 1, tmp_I_p_Ca, 1);
358  Vmath::Smul(n, C_m*I_p_Ca_max, tmp_I_p_Ca, 1, tmp_I_p_Ca, 1);
359  Vmath::Vsub(n, outarray[0], 1, tmp_I_p_Ca, 1, outarray[0], 1);
360 
361  // Scale currents by capacitance
362  Vmath::Smul(n, 1.0/C_m, outarray[0], 1, outarray[0], 1);
363 
364  // Scale sodium and potassium by FV_i
365  Vmath::Smul(n, 1.0/F/V_i, outarray[16], 1, outarray[16], 1);
366  Vmath::Smul(n, 1.0/F/V_i, outarray[18], 1, outarray[18], 1);
367 
368  // I_tr
369  Array<OneD, NekDouble> &tmp_I_tr = outarray[5];
370  Vmath::Vsub(n, inarray[20], 1, inarray[19], 1, tmp_I_tr, 1);
371  Vmath::Smul(n, 1.0/tau_tr, tmp_I_tr, 1, tmp_I_tr, 1);
372 
373  // I_up_leak
374  Array<OneD, NekDouble> &tmp_I_up_leak = outarray[6];
375  Vmath::Smul(n, NSR_I_up_max/NSR_I_Ca_max, inarray[20], 1, tmp_I_up_leak, 1);
376 
377  // I_up
378  Array<OneD, NekDouble> &tmp_I_up = outarray[7];
379  Vmath::Sdiv(n, NSR_K_up, inarray[17], 1, tmp_I_up, 1);
380  Vmath::Sadd(n, 1.0, tmp_I_up, 1, tmp_I_up, 1);
381  Vmath::Sdiv(n, NSR_I_up_max, tmp_I_up, 1, tmp_I_up, 1);
382 
383  // I_rel
384  Array<OneD, NekDouble> &tmp_I_rel = outarray[8];
385  Vmath::Vsub(n, inarray[19], 1, inarray[17], 1, tmp_I_rel, 1);
386  Vmath::Vmul(n, tmp_I_rel, 1, inarray[13], 1, tmp_I_rel, 1);
387  Vmath::Vmul(n, tmp_I_rel, 1, inarray[13], 1, tmp_I_rel, 1);
388  Vmath::Vmul(n, tmp_I_rel, 1, inarray[14], 1, tmp_I_rel, 1);
389  Vmath::Vmul(n, tmp_I_rel, 1, inarray[15], 1, tmp_I_rel, 1);
390  Vmath::Smul(n, JSR_K_rel, tmp_I_rel, 1, tmp_I_rel, 1);
391 
392  // B1
393  Array<OneD, NekDouble> &tmp_B1 = outarray[9];
394  Vmath::Svtvm(n, 2.0, tmp_I_Na_Ca, 1, tmp_I_p_Ca, 1, tmp_B1, 1);
395  Vmath::Vsub(n, tmp_B1, 1, tmp_I_Ca_L, 1, tmp_B1, 1);
396  Vmath::Vsub(n, tmp_B1, 1, tmp_I_b_Ca, 1, tmp_B1, 1);
397  Vmath::Smul(n, 0.5/F, tmp_B1, 1, tmp_B1, 1);
398  Vmath::Svtvp(n, JSR_V_up, tmp_I_up_leak, 1, tmp_B1, 1, tmp_B1, 1);
399  Vmath::Svtvp(n, -JSR_V_up, tmp_I_up, 1, tmp_B1, 1, tmp_B1, 1);
400  Vmath::Svtvp(n, JSR_V_rel, tmp_I_rel, 1, tmp_B1, 1, tmp_B1, 1);
401  Vmath::Smul(n, 1.0/V_i, tmp_B1, 1, tmp_B1, 1);
402 
403  // B2
404  Array<OneD, NekDouble> &tmp_B2 = outarray[10];
405  Vmath::Sadd(n, Km_Cmdn, inarray[17], 1, tmp_B2, 1);
406  Vmath::Vmul(n, tmp_B2, 1, tmp_B2, 1, tmp_B2, 1);
407  Vmath::Sdiv(n, Cmdn_max*Km_Cmdn, tmp_B2, 1, tmp_B2, 1);
408  Vmath::Sadd(n, Km_Trpn, inarray[17], 1, tmp, 1);
409  Vmath::Vmul(n, tmp, 1, tmp, 1, tmp, 1);
410  Vmath::Sdiv(n, Trpn_max*Km_Trpn, tmp, 1, tmp, 1);
411  Vmath::Vadd(n, tmp, 1, tmp_B2, 1, tmp_B2, 1);
412  Vmath::Sadd(n, 1.0, tmp_B2, 1, tmp_B2, 1);
413 
414  // Calcium concentration (18)
415  Vmath::Vdiv(n, tmp_B1, 1, tmp_B2, 1, outarray[17], 1);
416 
417  // Calcium up (21)
418  Vmath::Vsub(n, tmp_I_up, 1, tmp_I_up_leak, 1, outarray[20], 1);
419  Vmath::Svtvp(n, -JSR_V_rel/JSR_V_up, tmp_I_tr, 1, outarray[20], 1, outarray[20], 1);
420 
421  // Calcium rel (20)
422  Vmath::Vsub(n, tmp_I_tr, 1, tmp_I_rel, 1, tmp, 1);
423  Vmath::Sadd(n, Km_Csqn, inarray[19], 1, outarray[19], 1);
424  Vmath::Vmul(n, outarray[19], 1, outarray[19], 1, outarray[19], 1);
425  Vmath::Sdiv(n, Csqn_max*Km_Csqn, outarray[19], 1, outarray[19], 1);
426  Vmath::Sadd(n, 1.0, outarray[19], 1, outarray[19], 1);
427  Vmath::Vdiv(n, tmp, 1, outarray[19], 1, outarray[19], 1);
428 
429  // Process gating variables
430  const NekDouble * v;
431  const NekDouble * x;
432  NekDouble * x_tau;
433  NekDouble * x_new;
434  // m
435  for (i = 0, v = &inarray[0][0], x = &inarray[1][0], x_new = &outarray[1][0], x_tau = &m_gates_tau[0][0];
436  i < n; ++i, ++v, ++x, ++x_new, ++x_tau)
437  {
438  alpha = (*v == (-47.13)) ? 3.2 : (0.32*(*v+47.13))/(1.0-exp((-0.1)*(*v + 47.13)));
439  beta = 0.08*exp(-(*v)/11.0);
440  *x_tau = 1.0/(alpha + beta);
441  *x_new = alpha*(*x_tau);
442  }
443  // h
444  for (i = 0, v = &inarray[0][0], x = &inarray[2][0], x_new = &outarray[2][0], x_tau = &m_gates_tau[1][0];
445  i < n; ++i, ++v, ++x, ++x_new, ++x_tau)
446  {
447  alpha = (*v >= -40.0) ? 0.0 : 0.135*exp(-((*v)+80.0)/6.8);
448  beta = (*v >= -40.0) ? 1.0/(0.13*(1.0+exp(-(*v + 10.66)/11.1)))
449  : 3.56*exp(0.079*(*v))+310000.0*exp(0.35*(*v));
450  *x_tau = 1.0/(alpha + beta);
451  *x_new = alpha*(*x_tau);
452  }
453  // j
454  for (i = 0, v = &inarray[0][0], x = &inarray[3][0], x_new = &outarray[3][0], x_tau = &m_gates_tau[2][0];
455  i < n; ++i, ++v, ++x, ++x_new, ++x_tau)
456  {
457  alpha = (*v >= -40.0) ? 0.0
458  : (-127140.0*exp(0.2444*(*v))-3.474e-05*exp(-0.04391*(*v)))*(((*v)+37.78)/(1.0+exp(0.311*((*v)+79.23))));
459  beta = (*v >= -40.0) ? (0.3*exp(-2.535e-07*(*v))/(1.0+exp(-0.1*(*v+32.0))))
460  : 0.1212*exp(-0.01052*(*v))/(1.0+exp(-0.1378*(*v+40.14)));
461  *x_tau = 1.0/(alpha + beta);
462  *x_new = alpha*(*x_tau);
463  }
464  // oa
465  for (i = 0, v = &inarray[0][0], x = &inarray[4][0], x_new = &outarray[4][0], x_tau = &m_gates_tau[3][0];
466  i < n; ++i, ++v, ++x, ++x_new, ++x_tau)
467  {
468  alpha = 0.65/(exp(-(*v+10.0)/8.5) + exp(-(*v-30.0)/59.0));
469  beta = 0.65/(2.5 + exp((*v+82.0)/17.0));
470  *x_tau = 1.0/K_Q10/(alpha + beta);
471  *x_new = (1.0/(1.0+exp(-(*v+20.47)/17.54)));
472  }
473  // oi
474  for (i = 0, v = &inarray[0][0], x = &inarray[5][0], x_new = &outarray[5][0], x_tau = &m_gates_tau[4][0];
475  i < n; ++i, ++v, ++x, ++x_new, ++x_tau)
476  {
477  alpha = 1.0/(18.53 + exp((*v+113.7)/10.95));
478  beta = 1.0/(35.56 + exp(-(*v+1.26)/7.44));
479  *x_tau = 1.0/K_Q10/(alpha + beta);
480  *x_new = (1.0/(1.0+exp((*v+43.1)/5.3)));
481  }
482  // ua
483  for (i = 0, v = &inarray[0][0], x = &inarray[6][0], x_new = &outarray[6][0], x_tau = &m_gates_tau[5][0];
484  i < n; ++i, ++v, ++x, ++x_new, ++x_tau)
485  {
486  alpha = 0.65/(exp(-(*v+10.0)/8.5)+exp(-(*v-30.0)/59.0));
487  beta = 0.65/(2.5+exp((*v+82.0)/17.0));
488  *x_tau = 1.0/K_Q10/(alpha + beta);
489  *x_new = 1.0/(1.0+exp(-(*v+30.3)/9.6));
490  }
491  // ui
492  for (i = 0, v = &inarray[0][0], x = &inarray[7][0], x_new = &outarray[7][0], x_tau = &m_gates_tau[6][0];
493  i < n; ++i, ++v, ++x, ++x_new, ++x_tau)
494  {
495  alpha = 1.0/(21.0 + exp(-(*v-185.0)/28.0));
496  beta = exp((*v-158.0)/16.0);
497  *x_tau = 1.0/K_Q10/(alpha + beta);
498  *x_new = 1.0/(1.0+exp((*v-99.45)/27.48));
499  }
500  // xr
501  for (i = 0, v = &inarray[0][0], x = &inarray[8][0], x_new = &outarray[8][0], x_tau = &m_gates_tau[7][0];
502  i < n; ++i, ++v, ++x, ++x_new, ++x_tau)
503  {
504  alpha = 0.0003*(*v+14.1)/(1-exp(-(*v+14.1)/5.0));
505  beta = 7.3898e-5*(*v-3.3328)/(exp((*v-3.3328)/5.1237)-1.0);
506  *x_tau = 1.0/(alpha + beta);
507  *x_new = 1.0/(1+exp(-(*v+14.1)/6.5));
508  }
509  // xs
510  for (i = 0, v = &inarray[0][0], x = &inarray[9][0], x_new = &outarray[9][0], x_tau = &m_gates_tau[8][0];
511  i < n; ++i, ++v, ++x, ++x_new, ++x_tau)
512  {
513  alpha = 4e-5*(*v-19.9)/(1.0-exp(-(*v-19.9)/17.0));
514  beta = 3.5e-5*(*v-19.9)/(exp((*v-19.9)/9.0)-1.0);
515  *x_tau = 0.5/(alpha + beta);
516  *x_new = 1.0/sqrt(1.0+exp(-(*v-19.9)/12.7));
517  }
518  // d
519  for (i = 0, v = &inarray[0][0], x = &inarray[10][0], x_new = &outarray[10][0], x_tau = &m_gates_tau[9][0];
520  i < n; ++i, ++v, ++x, ++x_new, ++x_tau)
521  {
522  *x_tau = (1-exp(-(*v+10.0)/6.24))/(0.035*(*v+10.0)*(1+exp(-(*v+10.0)/6.24)));
523  *x_new = 1.0/(1.0 + exp(-(*v+10)/8.0));
524  }
525  // f
526  for (i = 0, v = &inarray[0][0], x = &inarray[11][0], x_new = &outarray[11][0], x_tau = &m_gates_tau[10][0];
527  i < n; ++i, ++v, ++x, ++x_new, ++x_tau)
528  {
529  //alpha = 1.0/(1.0 + exp((*v+28.0)/6.9));
530  *x_tau = 9.0/(0.0197*exp(-0.0337*0.0337*(*v+10.0)*(*v+10.0))+0.02);
531  *x_new = exp((-(*v + 28.0)) / 6.9) / (1.0 + exp((-(*v + 28.0)) / 6.9));
532  }
533  // f_Ca
534  for (i = 0, v = &inarray[0][0], x = &inarray[12][0], x_new = &outarray[12][0], x_tau = &m_gates_tau[11][0];
535  i < n; ++i, ++v, ++x, ++x_new, ++x_tau)
536  {
537  *x_tau = 2.0;
538  *x_new = 1.0/(1.0+inarray[17][i]/0.00035);
539  }
540 
541  Array<OneD, NekDouble> &tmp_Fn = outarray[15];
542  Vmath::Svtsvtp(n, 0.5*5e-13/F, tmp_I_Ca_L, 1, -0.2*5e-13/F, tmp_I_Na_Ca, 1, tmp_Fn, 1);
543  Vmath::Svtvm(n, 1e-12*JSR_V_rel, tmp_I_rel, 1, tmp_Fn, 1, tmp_Fn, 1);
544 
545  // u
546  for (i = 0, v = &tmp_Fn[0], x = &inarray[13][0], x_new = &outarray[13][0], x_tau = &m_gates_tau[12][0];
547  i < n; ++i, ++v, ++x, ++x_new, ++x_tau)
548  {
549  *x_tau = 8.0;
550  *x_new = 1.0/(1.0 + exp(-(*v - 3.4175e-13)/1.367e-15));
551  }
552  // v
553  for (i = 0, v = &tmp_Fn[0], x = &inarray[14][0], x_new = &outarray[14][0], x_tau = &m_gates_tau[13][0];
554  i < n; ++i, ++v, ++x, ++x_new, ++x_tau)
555  {
556  *x_tau = 1.91 + 2.09/(1.0+exp(-(*v - 3.4175e-13)/13.67e-16));
557  *x_new = 1.0 - 1.0/(1.0 + exp(-(*v - 6.835e-14)/13.67e-16));
558  }
559  // w
560  for (i = 0, v = &inarray[0][0], x = &inarray[15][0], x_new = &outarray[15][0], x_tau = &m_gates_tau[14][0];
561  i < n; ++i, ++v, ++x, ++x_new, ++x_tau)
562  {
563  *x_tau = 6.0*(1.0-exp(-(*v-7.9)/5.0))/(1.0+0.3*exp(-(*v-7.9)/5.0))/(*v-7.9);
564  *x_new = 1.0 - 1.0/(1.0 + exp(-(*v - 40.0)/17.0));
565  }
566 
567  }
568 
569 
570  /**
571  *
572  */
574  {
575  SolverUtils::AddSummaryItem(s, "Cell model","CourtemancheRamirezNattel98");
576  SolverUtils::AddSummaryItem(s, "Cell model var.", lookupIds[model_variant]);
577  }
578 
579 
581  {
582  Vmath::Fill(m_nq, -81.0, m_cellSol[0], 1);
583  Vmath::Fill(m_nq, 2.908e-03, m_cellSol[1], 1);
584  Vmath::Fill(m_nq, 9.649e-01, m_cellSol[2], 1);
585  Vmath::Fill(m_nq, 9.775e-01, m_cellSol[3], 1);
586  Vmath::Fill(m_nq, 3.043e-02, m_cellSol[4], 1);
587  Vmath::Fill(m_nq, 9.992e-01, m_cellSol[5], 1);
588  Vmath::Fill(m_nq, 4.966e-03, m_cellSol[6], 1);
589  Vmath::Fill(m_nq, 9.986e-01, m_cellSol[7], 1);
590  Vmath::Fill(m_nq, 3.296e-05, m_cellSol[8], 1);
591  Vmath::Fill(m_nq, 1.869e-02, m_cellSol[9], 1);
592  Vmath::Fill(m_nq, 1.367e-04, m_cellSol[10], 1);
593  Vmath::Fill(m_nq, 9.996e-01, m_cellSol[11], 1);
594  Vmath::Fill(m_nq, 7.755e-01, m_cellSol[12], 1);
595  Vmath::Fill(m_nq, 2.35e-112, m_cellSol[13], 1);
596  Vmath::Fill(m_nq, 1.0, m_cellSol[14], 1);
597  Vmath::Fill(m_nq, 0.9992, m_cellSol[15], 1);
598  Vmath::Fill(m_nq, 1.117e+01, m_cellSol[16], 1);
599  Vmath::Fill(m_nq, 1.013e-04, m_cellSol[17], 1);
600  Vmath::Fill(m_nq, 1.39e+02, m_cellSol[18], 1);
601  Vmath::Fill(m_nq, 1.488, m_cellSol[19], 1);
602  Vmath::Fill(m_nq, 1.488, m_cellSol[20], 1);
603  }
604 
605  std::string CourtemancheRamirezNattel98::v_GetCellVarName(unsigned int idx)
606  {
607  switch (idx)
608  {
609  case 0: return "u";
610  case 1: return "m";
611  case 2: return "h";
612  case 3: return "j";
613  case 4: return "o_a";
614  case 5: return "o_i";
615  case 6: return "u_a";
616  case 7: return "u_i";
617  case 8: return "x_r";
618  case 9: return "x_s";
619  case 10: return "d";
620  case 11: return "f";
621  case 12: return "f_Ca";
622  case 13: return "U";
623  case 14: return "V";
624  case 15: return "W";
625  case 16: return "Na_i";
626  case 17: return "Ca_i";
627  case 18: return "K_i";
628  case 19: return "Ca_rel";
629  case 20: return "Ca_up";
630  default: return "unknown";
631  }
632  }
633 
634 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:198
void Vpow(int n, const T *x, const int incx, const T f, T *y, const int incy)
Definition: Vmath.hpp:119
int m_nq
Number of physical points.
Definition: CellModel.h:117
std::vector< std::pair< std::string, std::string > > SummaryList
Definition: Misc.h:47
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
Definition: Vmath.cpp:46
void Svtvp(int n, const T alpha, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
svtvp (scalar times vector plus vector): z = alpha*x + y
Definition: Vmath.cpp:485
Cell model base class.
Definition: CellModel.h:65
STL namespace.
void Sdiv(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha/y.
Definition: Vmath.cpp:271
void Vdiv(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x/y.
Definition: Vmath.cpp:241
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
Definition: MeshPartition.h:51
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
Definition: Vmath.cpp:213
std::vector< int > m_concentrations
Indices of cell model variables which are concentrations.
Definition: CellModel.h:139
Array< OneD, Array< OneD, NekDouble > > m_gates_tau
Storage for gate tau values.
Definition: CellModel.h:143
virtual std::string v_GetCellVarName(unsigned int idx)
void AddSummaryItem(SummaryList &l, const std::string &name, const std::string &value)
Adds a summary item to the summary info list.
Definition: Misc.cpp:50
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
void Vexp(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.hpp:108
void Svtvm(int n, const T alpha, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
svtvp (scalar times vector plus vector): z = alpha*x - y
Definition: Vmath.cpp:518
Array< OneD, Array< OneD, NekDouble > > m_cellSol
Cell model solution variables.
Definition: CellModel.h:126
int m_nvar
Number of variables in cell model (inc. transmembrane voltage)
Definition: CellModel.h:119
std::vector< int > m_gates
Indices of cell model variables which are gates.
Definition: CellModel.h:141
double NekDouble
void Sadd(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Add vector y = alpha + x.
Definition: Vmath.cpp:315
virtual void v_GenerateSummary(SummaryList &s)
Prints a summary of the model parameters.
CellModelFactory & GetCellModelFactory()
Definition: CellModel.cpp:47
void Vsub(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Subtract vector z = x-y.
Definition: Vmath.cpp:343
void Vlog(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.hpp:96
void Svtsvtp(int n, const T alpha, const T *x, int incx, const T beta, const T *y, int incy, T *z, int incz)
vvtvvtp (scalar times vector plus scalar times vector):
Definition: Vmath.cpp:591
virtual void v_Update(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
Computes the reaction terms $f(u,v)$ and $g(u,v)$.
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.cpp:373
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
Definition: Vmath.cpp:299
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
Definition: Vmath.cpp:183
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.
Definition: NekFactory.hpp:215