svMultiPhysics
CepModTtp.h
1 /* Copyright (c) Stanford University, The Regents of the University of California, and others.
2  *
3  * All Rights Reserved.
4  *
5  * See Copyright-SimVascular.txt for additional details.
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining
8  * a copy of this software and associated documentation files (the
9  * "Software"), to deal in the Software without restriction, including
10  * without limitation the rights to use, copy, modify, merge, publish,
11  * distribute, sublicense, and/or sell copies of the Software, and to
12  * permit persons to whom the Software is furnished to do so, subject
13  * to the following conditions:
14  *
15  * The above copyright notice and this permission notice shall be included
16  * in all copies or substantial portions of the Software.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
19  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
21  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
22  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 #ifndef CEP_MOD_TTP_H
32 #define CEP_MOD_TTP_H
33 
34 #include "Array.h"
35 #include "Vector.h"
36 #include <array>
37 
38 #include <optional>
39 #include <functional>
40 
41 template <class T>
42 T& make_ref(T&& x) { return x; }
43 
44 /// @brief This module defines data structures for ten Tusscher-Panfilov
45 /// epicardial cellular activation model for cardiac electrophysiology
46 ///
47 /// The classes defined here duplicate the data structures in the Fortran TPPMOD module defined
48 /// in CEPMOD_TTP.f and PARAMS_TPP.f files.
49 class CepModTtp
50 {
51  public:
52  CepModTtp();
53  ~CepModTtp();
54 
55 
56 //--------------------------------------------------------------------
57 //
58 // Constants for TenTusscher-Panfilov Ventricular Myocyte Model.
59 //
60 //--------------------------------------------------------------------
61 
62 // Default model parameters
63  /// Gas constant [J/mol/K]
64  double Rc = 8314.472;
65 
66  /// Temperature [K]
67  double Tc = 310.0;
68 
69  /// Faraday constant [C/mmol]
70  double Fc = 96485.3415;
71 
72  /// Cell capacitance per unit surface area [uF/cm^{2}]
73  double Cm = 0.185;
74 
75  /// Surface to volume ratio [um^{-1}]
76  double sV = 0.2;
77 
78  /// Cellular resistivity [\f$\Omega\f$-cm]
79  double rho = 162.0;
80 
81  /// Cytoplasmic volume [um^{3}]
82  double V_c = 16.404E-3;
83 
84  /// Sacroplasmic reticulum volume [um^{3}]
85  double V_sr = 1.094E-3;
86 
87  /// Subspace volume [um^{3}]
88  double V_ss = 5.468E-5;
89 
90  /// Extracellular K concentration [mM]
91  double K_o = 5.4;
92 
93  /// Extracellular Na concentration [mM]
94  double Na_o = 140.0;
95 
96  /// Extracellular Ca concentration [mM]
97  double Ca_o = 2.0;
98 
99  /// Maximal I_Na conductance [nS/pF]
100  double G_Na = 14.838;
101 
102  /// Maximal I_K1 conductance [nS/pF]
103  double G_K1 = 5.405;
104 
105  /// Maximal epicardial I_to conductance [nS/pF]
106  Vector<double> G_to = {0.294, 0.073, 0.294};
107 
108  /// Maximal I_Kr conductance [nS/pF]
109  double G_Kr = 0.153;
110 
111 // G_Kr for spiral wave breakup
112 // double G_Kr = 0.172; // units: nS/pF
113 
114  /// Maximal epicardial I_Ks conductance [nS/pF]
115  Vector<double> G_Ks = {0.392, 0.392, 0.098};
116 
117 // G_Ks for spiral wave breakup (epi)
118 // double G_Ks(3) = (/0.441, 0.392_RKIND, 0.098_RKIND/)
119 
120  /// Relative I_Ks permeability to Na [-]
121  double p_KNa = 3.E-2;
122 
123  /// Maximal I_CaL conductance [cm^{3}/uF/ms]
124  double G_CaL = 3.98E-5;
125 
126  /// Maximal I_NaCa [pA/pF]
127  double K_NaCa = 1000.;
128 
129  /// Voltage dependent parameter of I_NaCa [-]
130  double gamma = 0.35;
131 
132  /// Ca_i half-saturation constant for I_NaCa [mM]
133  double K_mCa = 1.38;
134 
135  /// Na_i half-saturation constant for I_NaCa [mM]
136  double K_mNai = 87.5;
137 
138  /// Saturation factor for I_NaCa [-]
139  double K_sat = 0.1;
140 
141  /// Factor enhancing outward nature of I_NaCa [-]
142  double alpha = 2.5;
143 
144  /// Maximal I_NaK [pA/pF]
145  double p_NaK = 2.724;
146 
147  /// K_o half-saturation constant of I_NaK [mM]
148  double K_mK = 1.;
149 
150  /// Na_i half-saturation constant of I_NaK [mM]
151  double K_mNa = 40.;
152 
153  /// Maximal I_pK conductance [nS/pF]
154  double G_pK = 1.46E-2;
155 
156 // G_pK for spiral wave breakup
157 // double G_pK = 2.19E-3; // units: nS/pF
158 
159  /// Maximal I_pCa conductance [pA/pF]
160  double G_pCa = 0.1238;
161 
162 // G_pCa for spiral wave breakup
163 // double G_pCa = 0.8666; // units: pA/pF
164 
165  /// Half-saturation constant of I_pCa [mM]
166  double K_pCa = 5.E-4;
167 
168  /// Maximal I_bNa conductance [nS/pF]
169  double G_bNa = 2.9E-4;
170 
171  /// Maximal I_bCa conductance [nS/pF]
172  double G_bCa = 5.92E-4;
173 
174  /// Maximal I_up conductance [mM/ms]
175  double Vmax_up = 6.375E-3;
176 
177  /// Half-saturation constant of I_up [mM]
178  double K_up = 2.5E-4;
179 
180  /// Maximal I_rel conductance [mM/ms]
181  double V_rel = 0.102;
182 
183  /// R to O and RI to I, I_rel transition rate [mM^{-2}/ms]
184  double k1p = 0.15;
185 
186  /// O to I and R to RI, I_rel transition rate [mM^{-1}/ms]
187  double k2p = 4.5E-2;
188 
189  /// O to R and I to RI, I_rel transition rate [ms^{-1}]
190  double k3 = 6.E-2;
191 
192  /// I to O and Ri to I, I_rel transition rate [ms^{-1}]
193  double k4 = 5.E-3;
194 
195  /// Ca_sr half-saturation constant of k_casr [mM]
196  double EC = 1.5;
197 
198  /// Maximum value of k_casr [-]
199  double max_sr = 2.5;
200 
201  /// Minimum value of k_casr [-]
202  double min_sr = 1.;
203 
204  /// Maximal I_leak conductance [mM/ms]
205  double V_leak = 3.6E-4;
206 
207  /// Maximal I_xfer conductance [mM/ms]
208  double V_xfer = 3.8E-3;
209 
210  /// Total cytoplasmic buffer concentration [mM]
211  double Buf_c = 0.2;
212 
213  /// Ca_i half-saturation constant for cytplasmic buffer [mM]
214  double K_bufc = 1.E-3;
215 
216  /// Total sacroplasmic buffer concentration [mM]
217  double Buf_sr = 10.;
218 
219  /// Ca_sr half-saturation constant for subspace buffer [mM]
220  double K_bufsr = 0.3;
221 
222  /// Total subspace buffer concentration [mM]
223  double Buf_ss = 0.4;
224 
225  /// Ca_ss half-saturation constant for subspace buffer [mM]
226  double K_bufss = 2.5E-4;
227 
228  /// Resting potential [mV]
229  double Vrest = -85.23;
230 
231 // Electromechanics coupling parameters: active stress model
232  /// Resting Ca concentration [mM]
233  double Ca_rest = 5.E-5;
234 
235  /// Critical Ca concentration [mM]
236  double Ca_crit = 8.E-4;
237 
238  /// Saturation of concentration [MPa/mM]
239  double eta_T = 12.5;
240 
241  /// Minimum activation [ms^{-1}]
242  double eps_0 = 0.1;
243 
244  /// Maximum activation [ms^{-1}]
245  double eps_i = 1. ;
246 
247  /// Transition rate [mM^{-1}]
248  double xi_T = 4.E3;
249 
250 // Electromechanics coupling parameters: active strain model
251 //
252 
253  /// Active force of sacromere [-mM^{-2}]
254  double alFa = -4.E6;
255 
256  /// Resting Ca concentration [mM]
257  double c_Ca0 = 2.155E-4;
258 
259  /// Viscous-type constant [ms-mM^{-2}]
260  double mu_Ca = 5.E6;
261 
262 // Force-length relationship parameters
263  /// Initial length of sacromeres [um]
264  double SL0 = 1.95;
265 
266  /// Min. length of sacromeres [um]
267  double SLmin = 1.7;
268 
269  /// Max. length of sacromeres [um]
270  double SLmax = 2.6;
271 
272  /// Fourier coefficients
273  double f0 = -4333.618335582119;
274  double fc1 = 2570.395355352195;
275  double fs1 = -2051.827278991976;
276  double fc2 = 1329.53611689133;
277  double fs2 = 302.216784558222;
278  double fc3 = 104.943770305116;
279  double fs3 = 218.375174229422;
280 
281 //-----------------------------------------------------------------------
282 // Scaling factors
283  /// Voltage scaling
284  double Vscale = 1.;
285 
286  /// Time scaling
287  double Tscale = 1.;
288 
289  /// Voltage offset parameter
290  double Voffset = 0.;
291 
292 //-----------------------------------------------------------------------
293 // Variables
294  /// Reverse potentials for Na, K, Ca
295  double E_Na;
296  double E_K;
297  double E_Ca;
298  double E_Ks;
299 // Cellular transmembrane currents
300  /// Fast sodium current
301  double I_Na;
302 
303  /// inward rectifier outward current
304  double I_K1;
305 
306  /// transient outward current
307  double I_to;
308 
309  /// rapid delayed rectifier current
310  double I_Kr;
311 
312  /// slow delayed rectifier current
313  double I_Ks;
314 
315  /// L-type Ca current
316  double I_CaL;
317 
318  /// Na-Ca exchanger current
319  double I_NaCa;
320 
321  /// Na-K pump current
322  double I_NaK;
323 
324  /// plateau Ca current
325  double I_pCa;
326 
327  /// plateau K current
328  double I_pK;
329 
330  /// background Ca current
331  double I_bCa;
332 
333  /// background Na current
334  double I_bNa;
335 
336  /// sacroplasmic reticulum Ca leak current
337  double I_leak;
338 
339  /// sacroplasmic reticulum Ca pump current
340  double I_up;
341 
342  /// Ca induced Ca release current
343  double I_rel;
344 
345  /// diffusive Ca current
346  double I_xfer;
347 //-----------------------------------------------------------------------
348 // State variables
349  double V;
350  double K_i;
351  double Na_i;
352  double Ca_i;
353  double Ca_ss;
354  double Ca_sr;
355  double R_bar;
356 
357 // Gating variables (runtime, steady state)
358  double xr1, xr1i;
359  double xr2, xr2i;
360  double xs, xsi;
361  double m, mi;
362  double h, hi;
363  double j, ji;
364  double d, di;
365  double f, fi;
366  double f2, f2i;
367  double fcass, fcassi;
368  double s, si;
369  double r, ri;
370 
371 // Other variables
372  double k1;
373  double k2;
374  double k_casr;
375  double O;
376 
377 // Jacobian variables
378  double E_Na_Nai, E_K_Ki, E_Ca_Cai, E_Ks_Ki, E_Ks_Nai;
379  double I_Na_V, I_Na_Nai;
380  double I_to_V, I_to_Ki;
381  double I_K1_V, I_K1_Ki;
382  double I_Kr_V, I_Kr_Ki;
383  double I_Ks_V, I_Ks_Ki, I_Ks_Nai;
384  double I_CaL_V, I_CaL_Cass;
385  double I_NaCa_V, I_NaCa_Nai, I_NaCa_Cai;
386  double I_NaK_V, I_NaK_Nai;
387  double I_pCa_Cai;
388  double I_pK_V, I_pK_Ki;
389  double I_bCa_V, I_bCa_Cai;
390  double I_bNa_V, I_bNa_Nai;
391  double I_leak_Cai, I_leak_Casr;
392  double I_up_Cai;
393  double I_rel_Cass, I_rel_Casr, I_rel_Rbar;
394  double I_xfer_Cai, I_xfer_Cass;
395  double k_casr_sr, k1_casr, O_Casr, O_Cass, O_Rbar;
396 
397  void actv_strn(const double c_Ca, const double I4f, const double dt, double& gf);
398  void actv_strs(const double c_Ca, const double dt, double& Tact, double& epsX);
399 
400  void getf(const int i, const int nX, const int nG, const Vector<double>& X, const Vector<double>& Xg,
401  Vector<double>& dX, const double I_stim, const double K_sac, Vector<double>& RPAR);
402 
403  void getj(const int i, const int nX, const int nG, const Vector<double>& X, const Vector<double>& Xg,
404  Array<double>& JAC, const double Ksac);
405 
406  void init(const int imyo, const int nX, const int nG, Vector<double>& X, Vector<double>& Xg);
407 
408  void init(const int imyo, const int nX, const int nG, Vector<double>& X, Vector<double>& Xg,
409  Vector<double>& X0, Vector<double>& Xg0);
410 
411  void integ_cn2(const int imyo, const int nX, const int nG, Vector<double>& X, Vector<double>& Xg,
412  const double Ts, const double dt, const double Istim, const double Ksac,
413  Vector<int>& IPAR, Vector<double>& RPAR);
414 
415  void integ_fe(const int imyo, const int nX, const int nG, Vector<double>& X, Vector<double>& Xg,
416  const double Ts, const double dt, const double Istim, const double Ksac, Vector<double>& RPAR);
417 
418  void integ_rk(const int imyo, const int nX, const int nG, Vector<double>& X, Vector<double>& Xg,
419  const double Ts, const double dt, const double Istim, const double Ksac, Vector<double>& RPAR);
420 
421  void update_g(const int i, const double dt, const int n, const int nG, const Vector<double>& X,
422  Vector<double>& Xg);
423 
424 };
425 
426 #endif
427 
This module defines data structures for ten Tusscher-Panfilov epicardial cellular activation model fo...
Definition: CepModTtp.h:50
double I_NaK
Na-K pump current.
Definition: CepModTtp.h:322
double K_o
Extracellular K concentration [mM].
Definition: CepModTtp.h:91
double mu_Ca
Viscous-type constant [ms-mM^{-2}].
Definition: CepModTtp.h:260
double SL0
Initial length of sacromeres [um].
Definition: CepModTtp.h:264
double Cm
Cell capacitance per unit surface area [uF/cm^{2}].
Definition: CepModTtp.h:73
double K_bufsr
Ca_sr half-saturation constant for subspace buffer [mM].
Definition: CepModTtp.h:220
double alpha
Factor enhancing outward nature of I_NaCa [-].
Definition: CepModTtp.h:142
double eps_i
Maximum activation [ms^{-1}].
Definition: CepModTtp.h:245
double V_rel
Maximal I_rel conductance [mM/ms].
Definition: CepModTtp.h:181
void getf(const int i, const int nX, const int nG, const Vector< double > &X, const Vector< double > &Xg, Vector< double > &dX, const double I_stim, const double K_sac, Vector< double > &RPAR)
Compute currents and time derivatives of state variables.
Definition: CepModTtp.cpp:76
double SLmax
Max. length of sacromeres [um].
Definition: CepModTtp.h:270
double k1p
R to O and RI to I, I_rel transition rate [mM^{-2}/ms].
Definition: CepModTtp.h:184
double I_up
sacroplasmic reticulum Ca pump current
Definition: CepModTtp.h:340
double K_mCa
Ca_i half-saturation constant for I_NaCa [mM].
Definition: CepModTtp.h:133
double I_bNa
background Na current
Definition: CepModTtp.h:334
double K_NaCa
Maximal I_NaCa [pA/pF].
Definition: CepModTtp.h:127
double K_bufc
Ca_i half-saturation constant for cytplasmic buffer [mM].
Definition: CepModTtp.h:214
double c_Ca0
Resting Ca concentration [mM].
Definition: CepModTtp.h:257
double I_bCa
background Ca current
Definition: CepModTtp.h:331
double max_sr
Maximum value of k_casr [-].
Definition: CepModTtp.h:199
double Tscale
Time scaling.
Definition: CepModTtp.h:287
double I_to
transient outward current
Definition: CepModTtp.h:307
double eta_T
Saturation of concentration [MPa/mM].
Definition: CepModTtp.h:239
double alFa
Active force of sacromere [-mM^{-2}].
Definition: CepModTtp.h:254
double sV
Surface to volume ratio [um^{-1}].
Definition: CepModTtp.h:76
double V_leak
Maximal I_leak conductance [mM/ms].
Definition: CepModTtp.h:205
double V_xfer
Maximal I_xfer conductance [mM/ms].
Definition: CepModTtp.h:208
double Voffset
Voltage offset parameter.
Definition: CepModTtp.h:290
double K_mK
K_o half-saturation constant of I_NaK [mM].
Definition: CepModTtp.h:148
void integ_cn2(const int imyo, const int nX, const int nG, Vector< double > &X, Vector< double > &Xg, const double Ts, const double dt, const double Istim, const double Ksac, Vector< int > &IPAR, Vector< double > &RPAR)
Time integration performed using Crank-Nicholson method.
Definition: CepModTtp.cpp:574
double rho
Cellular resistivity [ -cm].
Definition: CepModTtp.h:79
double I_rel
Ca induced Ca release current.
Definition: CepModTtp.h:343
double G_pCa
Maximal I_pCa conductance [pA/pF].
Definition: CepModTtp.h:160
double V_sr
Sacroplasmic reticulum volume [um^{3}].
Definition: CepModTtp.h:85
double G_pK
Maximal I_pK conductance [nS/pF].
Definition: CepModTtp.h:154
double G_Na
Maximal I_Na conductance [nS/pF].
Definition: CepModTtp.h:100
double G_bCa
Maximal I_bCa conductance [nS/pF].
Definition: CepModTtp.h:172
Vector< double > G_to
Maximal epicardial I_to conductance [nS/pF].
Definition: CepModTtp.h:106
double xi_T
Transition rate [mM^{-1}].
Definition: CepModTtp.h:248
double K_mNai
Na_i half-saturation constant for I_NaCa [mM].
Definition: CepModTtp.h:136
double Buf_sr
Total sacroplasmic buffer concentration [mM].
Definition: CepModTtp.h:217
double Vscale
Voltage scaling.
Definition: CepModTtp.h:284
double k3
O to R and I to RI, I_rel transition rate [ms^{-1}].
Definition: CepModTtp.h:190
double I_Kr
rapid delayed rectifier current
Definition: CepModTtp.h:310
double I_NaCa
Na-Ca exchanger current.
Definition: CepModTtp.h:319
double p_NaK
Maximal I_NaK [pA/pF].
Definition: CepModTtp.h:145
double I_Na
Fast sodium current.
Definition: CepModTtp.h:301
double K_mNa
Na_i half-saturation constant of I_NaK [mM].
Definition: CepModTtp.h:151
double SLmin
Min. length of sacromeres [um].
Definition: CepModTtp.h:267
double V_ss
Subspace volume [um^{3}].
Definition: CepModTtp.h:88
double I_K1
inward rectifier outward current
Definition: CepModTtp.h:304
double p_KNa
Relative I_Ks permeability to Na [-].
Definition: CepModTtp.h:121
double Rc
Gas constant [J/mol/K].
Definition: CepModTtp.h:64
double min_sr
Minimum value of k_casr [-].
Definition: CepModTtp.h:202
double I_xfer
diffusive Ca current
Definition: CepModTtp.h:346
double G_bNa
Maximal I_bNa conductance [nS/pF].
Definition: CepModTtp.h:169
double Buf_ss
Total subspace buffer concentration [mM].
Definition: CepModTtp.h:223
double K_up
Half-saturation constant of I_up [mM].
Definition: CepModTtp.h:178
double Tc
Temperature [K].
Definition: CepModTtp.h:67
double Buf_c
Total cytoplasmic buffer concentration [mM].
Definition: CepModTtp.h:211
double Na_o
Extracellular Na concentration [mM].
Definition: CepModTtp.h:94
double I_pK
plateau K current
Definition: CepModTtp.h:328
double f0
Fourier coefficients.
Definition: CepModTtp.h:273
double Vrest
Resting potential [mV].
Definition: CepModTtp.h:229
double Ca_crit
Critical Ca concentration [mM].
Definition: CepModTtp.h:236
double E_Na
Reverse potentials for Na, K, Ca.
Definition: CepModTtp.h:295
void update_g(const int i, const double dt, const int n, const int nG, const Vector< double > &X, Vector< double > &Xg)
Update all the gating variables.
Definition: CepModTtp.cpp:690
double G_Kr
Maximal I_Kr conductance [nS/pF].
Definition: CepModTtp.h:109
double Ca_rest
Resting Ca concentration [mM].
Definition: CepModTtp.h:233
double Fc
Faraday constant [C/mmol].
Definition: CepModTtp.h:70
double k4
I to O and Ri to I, I_rel transition rate [ms^{-1}].
Definition: CepModTtp.h:193
double eps_0
Minimum activation [ms^{-1}].
Definition: CepModTtp.h:242
double V_c
Cytoplasmic volume [um^{3}].
Definition: CepModTtp.h:82
double k2p
O to I and R to RI, I_rel transition rate [mM^{-1}/ms].
Definition: CepModTtp.h:187
double I_Ks
slow delayed rectifier current
Definition: CepModTtp.h:313
double I_CaL
L-type Ca current.
Definition: CepModTtp.h:316
double G_CaL
Maximal I_CaL conductance [cm^{3}/uF/ms].
Definition: CepModTtp.h:124
double K_sat
Saturation factor for I_NaCa [-].
Definition: CepModTtp.h:139
double K_pCa
Half-saturation constant of I_pCa [mM].
Definition: CepModTtp.h:166
double gamma
Voltage dependent parameter of I_NaCa [-].
Definition: CepModTtp.h:130
Vector< double > G_Ks
Maximal epicardial I_Ks conductance [nS/pF].
Definition: CepModTtp.h:115
double EC
Ca_sr half-saturation constant of k_casr [mM].
Definition: CepModTtp.h:196
double Ca_o
Extracellular Ca concentration [mM].
Definition: CepModTtp.h:97
void actv_strn(const double c_Ca, const double I4f, const double dt, double &gf)
Compute macroscopic fiber strain based on sacromere force-length relationship and calcium concentrati...
Definition: CepModTtp.cpp:45
double I_pCa
plateau Ca current
Definition: CepModTtp.h:325
double K_bufss
Ca_ss half-saturation constant for subspace buffer [mM].
Definition: CepModTtp.h:226
double G_K1
Maximal I_K1 conductance [nS/pF].
Definition: CepModTtp.h:103
double Vmax_up
Maximal I_up conductance [mM/ms].
Definition: CepModTtp.h:175
double I_leak
sacroplasmic reticulum Ca leak current
Definition: CepModTtp.h:337