LifeV
IonicTenTusscher06.hpp
Go to the documentation of this file.
1 //@HEADER
2 /*
3 *******************************************************************************
4 
5  Copyright (C) 2004, 2005, 2007 EPFL, Politecnico di Milano, INRIA
6  Copyright (C) 2010 EPFL, Politecnico di Milano, Emory University
7 
8  This file is part of LifeV.
9 
10  LifeV is free software; you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  LifeV is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with LifeV. If not, see <http://www.gnu.org/licenses/>.
22 
23 *******************************************************************************
24 */
25 //@HEADER
26 
27 /*!
28  @file IonicTenTusscher06
29  @brief Ionic model of ten Tusscher-Panfilov 2006
30 
31  model as in
32  Ten Tusscher, K. H. W. J., and A. V. Panfilov.
33  "Alternans and spiral breakup in a human ventricular."
34  Am J Physiol Heart Circ Physiol 291 (2006): H1088-H1100.
35 
36 
37  Implementation derived from the original code of TenTusscher freely available at
38  http://www-binf.bio.uu.nl/khwjtuss/SourceCodes/
39 
40  @date 01-2013
41  @author Simone Rossi <simone.rossi@epfl.ch>
42 
43  Note that the model is not solved correctly using Rush-Larsen
44  with forward Euler. In the original code of Ten Tusscher
45  the solution of CaSS and CaSR is computed using a specific
46  algorithm (which I do not know).
47  Therefore I consider all the variables except for the
48  potential as gating variable and use the specific
49  method in their original code to make it work.
50  Therefore the number of gating variable is augmented.
51 
52  @contributors
53  @mantainer Simone Rossi <simone.rossi@epfl.ch>
54  @last update 01-2013
55  */
56 
57 
58 #ifndef _IONICTENTUSSCHER06_H_
59 #define _IONICTENTUSSCHER06_H_
60 
61 #include <lifev/electrophysiology/solver/IonicModels/ElectroIonicModel.hpp>
62 
63 #include <Teuchos_RCP.hpp>
64 #include <Teuchos_ParameterList.hpp>
65 #include "Teuchos_XMLParameterListHelpers.hpp"
66 
67 namespace LifeV
68 {
69 //! IonicModel - This class implements an ionic model.
70 
71 class IonicTenTusscher06 : public virtual ElectroIonicModel
72 {
73 
74 public:
75  //! @name Type definitions
76  //@{
77  typedef ElectroIonicModel super;
78  typedef std::shared_ptr<VectorEpetra> vectorPtr_Type;
79  typedef std::shared_ptr<VectorElemental> elvecPtr_Type;
80  typedef RegionMesh<LinearTetra> mesh_Type;
81  //@}
82 
83 
84 
85  //! @name Constructors & Destructor
86  //@{
87 
88  //! Constructor
89  IonicTenTusscher06();
90 
91  /*!
92  * @param Epetra communicator
93  * @param list of parameters in an xml file
94  */
95  IonicTenTusscher06 ( Teuchos::ParameterList& parameterList );
96 
97  /*!
98  * @param IonicTenTusscher06 object
99  */
100  IonicTenTusscher06 ( const IonicTenTusscher06& model );
101  //! Destructor
102  virtual ~IonicTenTusscher06() {}
103 
104  //@}
105 
106  //! @name Overloads
107  //@{
108 
109  IonicTenTusscher06& operator= ( const IonicTenTusscher06& model );
110 
111  //@}
112 
113  //! @name Setters and getters
114  //@{
115 
116  //parameters getters and setters
117  inline Real getknak() const
118  {
119  return knak;
120  }
121  inline Real getKmNa() const
122  {
123  return KmNa;
124  }
125  inline Real getKmK() const
126  {
127  return KmK;
128  }
129  inline Real getknaca() const
130  {
131  return knaca;
132  }
133  inline Real getKmNai() const
134  {
135  return KmNai;
136  }
137  inline Real getKmCa() const
138  {
139  return KmCa;
140  }
141  inline Real getksat() const
142  {
143  return ksat;
144  }
145  inline Real getn() const
146  {
147  return n;
148  }
149 
150 
151  inline Real getKo() const
152  {
153  return Ko;
154  }
155  inline Real getCao() const
156  {
157  return Cao;
158  }
159  inline Real getNao() const
160  {
161  return Nao;
162  }
163 
164 
165  inline Real getBufc() const
166  {
167  return Bufc;
168  }
169  inline Real getKbufc() const
170  {
171  return Kbufc;
172  }
173  inline Real getBufsr() const
174  {
175  return Bufsr;
176  }
177  inline Real getKbufsr() const
178  {
179  return Kbufsr;
180  }
181  inline Real getBufss() const
182  {
183  return Bufss;
184  }
185  inline Real getKbufss() const
186  {
187  return Kbufss;
188  }
189 
190  inline Real getVmaxup() const
191  {
192  return Vmaxup;
193  }
194  inline Real getKup() const
195  {
196  return Kup;
197  }
198  inline Real getVrel() const
199  {
200  return Vrel;
201  }
202  inline Real getk1_() const
203  {
204  return k1_;
205  }
206  inline Real getk2_() const
207  {
208  return k2_;
209  }
210  inline Real getk3() const
211  {
212  return k3;
213  }
214  inline Real getk4() const
215  {
216  return k4;
217  }
218  inline Real getEC() const
219  {
220  return EC;
221  }
222  inline Real getmaxsr() const
223  {
224  return maxsr;
225  }
226  inline Real getminsr() const
227  {
228  return minsr;
229  }
230  inline Real getVleak() const
231  {
232  return Vleak;
233  }
234  inline Real getVxfer() const
235  {
236  return Vxfer;
237  }
238 
239 
240  inline Real getpKNa() const
241  {
242  return pKNa;
243  }
244 
245 
246  inline Real getRTONF() const
247  {
248  return RTONF;
249  }
250  inline Real getF() const
251  {
252  return F;
253  }
254  inline Real getR() const
255  {
256  return R;
257  }
258  inline Real getT() const
259  {
260  return T;
261  }
262 
263 
264  inline Real getGkr() const
265  {
266  return Gkr;
267  }
268  inline Real getGks() const
269  {
270  return Gks;
271  }
272  inline Real getGK1() const
273  {
274  return GK1;
275  }
276  inline Real getGto() const
277  {
278  return Gto;
279  }
280  inline Real getGNa() const
281  {
282  return GNa;
283  }
284  inline Real getGbNa() const
285  {
286  return GbNa;
287  }
288  inline Real getGCaL() const
289  {
290  return GCaL;
291  }
292  inline Real getGbCa() const
293  {
294  return GbCa;
295  }
296  inline Real getGpCa() const
297  {
298  return GpCa;
299  }
300  inline Real getKpCa() const
301  {
302  return KpCa;
303  }
304  inline Real getGpK() const
305  {
306  return GpK;
307  }
308 
309 
310  inline Real getVc() const
311  {
312  return Vc;
313  }
314  inline Real getVsr() const
315  {
316  return Vsr;
317  }
318  inline Real getVss() const
319  {
320  return Vss;
321  }
322 
323  inline void setknak ( const Real p )
324  {
325  knak = p;
326  }
327  inline void setKmNa ( const Real p )
328  {
329  KmNa = p;
330  }
331  inline void setKmK ( const Real p )
332  {
333  KmK = p;
334  }
335  inline void setknaca ( const Real p )
336  {
337  knaca = p;
338  }
339  inline void setKmNai ( const Real p )
340  {
341  KmNai = p;
342  }
343  inline void setKmCa ( const Real p )
344  {
345  KmCa = p;
346  }
347  inline void setksat ( const Real p )
348  {
349  ksat = p;
350  }
351  inline void setn ( const Real p )
352  {
353  n = p;
354  }
355 
356 
357  inline void setKo ( const Real p )
358  {
359  Ko = p;
360  }
361  inline void setCao ( const Real p )
362  {
363  Cao = p;
364  }
365  inline void setNao ( const Real p )
366  {
367  Nao = p;
368  }
369 
370 
371  inline void setBufc ( const Real p )
372  {
373  Bufc = p;
374  }
375  inline void setKbufc ( const Real p )
376  {
377  Kbufc = p;
378  }
379  inline void setBufsr ( const Real p )
380  {
381  Bufsr = p;
382  }
383  inline void setKbufsr ( const Real p )
384  {
385  Kbufsr = p;
386  }
387  inline void setBufss ( const Real p )
388  {
389  Bufss = p;
390  }
391  inline void setKbufss ( const Real p )
392  {
393  Kbufss = p;
394  }
395 
396  inline void setVmaxup ( const Real p )
397  {
398  Vmaxup = p;
399  }
400  inline void setKup ( const Real p )
401  {
402  Kup = p;
403  }
404  inline void setVrel ( const Real p )
405  {
406  Vrel = p;
407  }
408  inline void setk1_ ( const Real p )
409  {
410  k1_ = p;
411  }
412  inline void setk2_ ( const Real p )
413  {
414  k2_ = p;
415  }
416  inline void setk3 ( const Real p )
417  {
418  k3 = p;
419  }
420  inline void setk4 ( const Real p )
421  {
422  k4 = p;
423  }
424  inline void setEC ( const Real p )
425  {
426  EC = p;
427  }
428  inline void setmaxsr ( const Real p )
429  {
430  maxsr = p;
431  }
432  inline void setminsr ( const Real p )
433  {
434  minsr = p;
435  }
436  inline void setVleak ( const Real p )
437  {
438  Vleak = p;
439  }
440  inline void setVxfer ( const Real p )
441  {
442  Vxfer = p;
443  }
444 
445 
446  inline void setpKNa ( const Real p )
447  {
448  pKNa = p;
449  }
450 
451 
452  inline void setF ( const Real p )
453  {
454  F = p;
455  computeRTONF();
456  }
457  inline void setR ( const Real p )
458  {
459  R = p;
460  computeRTONF();
461  }
462  inline void setT ( const Real p )
463  {
464  T = p;
465  computeRTONF();
466  }
467 
468  inline void computeRTONF()
469  {
470  RTONF = R * T / F;
471  }
472 
473  inline void setGkr ( const Real p )
474  {
475  Gkr = p;
476  }
477  inline void setGks ( const Real p )
478  {
479  Gks = p;
480  }
481  inline void setGK1 ( const Real p )
482  {
483  GK1 = p;
484  }
485  inline void setGto ( const Real p )
486  {
487  Gto = p;
488  }
489  inline void setGNa ( const Real p )
490  {
491  GNa = p;
492  }
493  inline void setGbNa ( const Real p )
494  {
495  GbNa = p;
496  }
497  inline void setGCaL ( const Real p )
498  {
499  GCaL = p;
500  }
501  inline void setGbCa ( const Real p )
502  {
503  GbCa = p;
504  }
505  inline void setGpCa ( const Real p )
506  {
507  GpCa = p;
508  }
509  inline void setKpCa ( const Real p )
510  {
511  KpCa = p;
512  }
513  inline void setGpK ( const Real p )
514  {
515  GpK = p;
516  }
517 
518 
519  inline void setVc ( const Real p )
520  {
521  Vc = p;
522  }
523  inline void setVsr ( const Real p )
524  {
525  Vsr = p;
526  }
527  inline void setVss ( const Real p )
528  {
529  Vss = p;
530  }
531 
532 
533  inline void computeinverseVcF2()
534  {
535  inverseVcF2 = 1. / ( 2. * Vc * F ) ;
536  }
537  inline void computeinverseVcF()
538  {
539  inverseVcF = 1. / ( Vc * F );
540  }
541  inline void computeinversevssF2()
542  {
543  inversevssF2 = 1. / ( 2. * Vss * F );
544  }
545 
546 
547  //inline const short int& Size() const { return M_numberOfEquations; }
548 
549  inline Real Ek ( Real Ki)
550  {
551  return RTONF * std::log ( ( Ko / Ki ) );
552  }
553  inline Real Ena (Real Nai)
554  {
555  return RTONF * std::log ( ( Nao / Nai ) );
556  }
557  inline Real Eks (Real Ki, Real Nai)
558  {
559  return RTONF * std::log ( ( Ko + pKNa * Nao ) / ( Ki + pKNa * Nai ) );
560  }
561  inline Real Eca (Real Cai)
562  {
563  return 0.5 * RTONF * std::log ( ( Cao / Cai ) );
564  }
565  inline Real Ak1 (Real V, Real Ki)
566  {
567  return 0.1 / ( 1. + std::exp ( 0.06 * ( V - Ek (Ki) - 200. ) ) );
568  }
569  inline Real Bk1 (Real V, Real Ki)
570  {
571  return ( 3. * std::exp ( 0.0002 * ( V - Ek (Ki) + 100. ) ) +
572  std::exp ( 0.1 * ( V - Ek (Ki) - 10. ) ) )
573  / ( 1. + std::exp ( -0.5 * ( V - Ek (Ki) ) ) );
574  }
575  inline Real rec_iK1 ( Real V, Real Ki )
576  {
577  return Ak1 (V, Ki) / ( Ak1 (V, Ki) + Bk1 (V, Ki) );
578  }
579  inline Real rec_iNaK (Real V)
580  {
581  return ( 1. / ( 1. + 0.1245 * std::exp ( -0.1 * V * F / ( R * T ) )
582  + 0.0353 * std::exp (- V * F / ( R * T ) ) ) );
583  }
584  inline Real rec_ipK (Real V)
585  {
586  return 1. / ( 1. + std::exp ( ( 25. - V ) / 5.98 ) );
587  }
588 
589  //@}
590 
591  //! @name Methods
592  //@{
593 
594 
595 
596  inline Real INa (Real V, Real m, Real h, Real j, Real Nai)
597  {
598  return GNa * m * m * m * h * j * ( V - Ena (Nai) );
599  }
600  inline Real ICaL (Real V, Real d, Real f, Real f2, Real fcass, Real CaSS)
601  {
602  return GCaL * d * f * f2 * fcass * 4. * ( V - 15. ) * ( F * F / ( R * T ) ) *
603  ( 0.25 * std::exp ( 2. * ( V - 15 ) * F / ( R * T ) ) * CaSS - Cao )
604  / ( std::exp ( 2. * ( V - 15. ) * F / ( R * T ) ) - 1.);
605 
606  }
607  inline Real Ito (Real V, Real r, Real s, Real Ki)
608  {
609  return Gto * r * s * ( V - Ek (Ki) );
610  }
611  inline Real IKr (Real V, Real xr1, Real xr2, Real Ki)
612  {
613  return Gkr * std::sqrt (Ko / 5.4) * xr1 * xr2 * ( V - Ek (Ki) );
614  }
615  inline Real IKs (Real V, Real xs, Real Ki, Real Nai)
616  {
617  return Gks * xs * xs * ( V - Eks (Ki, Nai) );
618 
619  std::cout << "\n**** Iks ******* ";
620  std::cout << "\nGks: " << Gks;
621  std::cout << "\nxs: " << xs;
622  std::cout << "\nV: " << V;
623  std::cout << "\nKi: " << Ki;
624  std::cout << "\nNai: " << Nai;
625  std::cout << "\nEks: " << Eks (Ki, Nai);
626  std::cout << "\n*********** ";
627 
628 
629  }
630  inline Real IK1 (Real V, Real Ki)
631  {
632  return GK1 * rec_iK1 (V, Ki) * ( V - Ek (Ki) );
633  }
634  inline Real INaCa (Real V, Real Nai, Real Cai)
635  {
636  return knaca * ( 1. / ( KmNai * KmNai * KmNai + Nao * Nao * Nao ) ) * ( 1. / ( KmCa + Cao ) ) *
637  ( 1. / ( 1. + ksat * std::exp ( ( n - 1. ) * V * F / ( R * T ) ) ) ) *
638  (std::exp ( n * V * F / ( R * T ) ) * Nai * Nai * Nai * Cao -
639  std::exp ( ( n - 1. ) * V * F / ( R * T ) ) * Nao * Nao * Nao * Cai * 2.5);
640  }
641  inline Real INaK (Real V, Real Nai)
642  {
643  return knak * ( Ko / ( Ko + KmK ) ) * ( Nai / ( Nai + KmNa ) ) * rec_iNaK (V);
644  }
645  inline Real IpCa (Real Cai)
646  {
647  return GpCa * Cai / ( KpCa + Cai );
648  }
649  inline Real IpK (Real V, Real Ki)
650  {
651  return GpK * rec_ipK (V) * ( V - Ek (Ki) );
652  }
653  inline Real IbNa (Real V, Real Nai)
654  {
655  return GbNa * ( V - Ena (Nai) );
656  }
657  inline Real IbCa (Real V, Real Cai)
658  {
659  return GbCa * ( V - Eca (Cai) );
660  }
661  inline Real Itot (Real V, Real m, Real h, Real j, Real d, Real f, Real f2, Real fcass,
662  Real r, Real s, Real xr1, Real xr2, Real xs, Real Nai, Real Ki,
663  Real Cai, Real CaSS)
664  {
665  return IKr (V, xr1, xr2, Ki) +
666  IKs (V, xs, Ki, Nai) +
667  IK1 (V, Ki) +
668  Ito (V, r, s, Ki) +
669  INa (V, m, h, j, Nai) +
670  IbNa (V, Nai) +
671  ICaL (V, d, f, f2, fcass, CaSS) +
672  IbCa (V, Cai) +
673  INaK (V, Nai) +
674  INaCa (V, Nai, Cai) +
675  IpCa (Cai) +
676  IpK (V, Ki);
677  }
678 
679  //update concentrations
680 
681  inline Real kCaSR (Real CaSR)
682  {
683  return maxsr - ( ( maxsr - minsr ) / ( 1. + ( EC / CaSR ) * ( EC / CaSR ) ) );
684  }
685  inline Real k1 (Real CaSR)
686  {
687  return k1_ / kCaSR (CaSR);
688  }
689  inline Real k2 (Real CaSR)
690  {
691  return k2_ * kCaSR (CaSR);
692  }
693  inline Real dRR (Real CaSR, Real CaSS, Real RR)
694  {
695  return k4 * ( 1 - RR ) - k2 (CaSR) * CaSS * RR;
696  }
697  inline Real solveRR (Real CaSR, Real CaSS, Real RR, Real HT)
698  {
699  return RR + HT * dRR (CaSR, CaSS, RR);
700  }
701  inline Real OO (Real CaSR, Real CaSS, Real RR)
702  {
703  return k1 (CaSR) * CaSS * CaSS * RR / ( k3 + k1 (CaSR) * CaSS * CaSS );
704  }
705 
706  inline Real Irel (Real CaSR, Real CaSS, Real RR)
707  {
708  return Vrel * OO (CaSR, CaSS, RR) * ( CaSR - CaSS );
709  }
710  inline Real Ileak (Real CaSR, Real Cai)
711  {
712  return Vleak * ( CaSR - Cai);
713  }
714  inline Real Iup (Real Cai)
715  {
716  return Vmaxup / ( 1. + ( ( Kup * Kup ) / ( Cai * Cai ) ) );
717  }
718  inline Real Ixfer (Real CaSS, Real Cai)
719  {
720  return Vxfer * ( CaSS - Cai);
721  }
722  inline Real CaCSQN (Real CaSR)
723  {
724  return Bufsr * CaSR / ( CaSR + Kbufsr );
725  }
726  inline Real dCaSR (Real Cai, Real CaSR, Real CaSS, Real RR, Real HT = 1.0)
727  {
728  return HT * ( Iup (Cai) - Irel (CaSR, CaSS, RR) - Ileak (CaSR, Cai) );
729  }
730  inline Real bjsr (Real Cai, Real CaSR, Real CaSS, Real RR, Real HT)
731  {
732  return Bufsr - CaCSQN (CaSR) - dCaSR (Cai, CaSR, CaSS, RR, HT) - CaSR + Kbufsr;
733  }
734  inline Real cjsr (Real Cai, Real CaSR, Real CaSS, Real RR, Real HT)
735  {
736  return Kbufsr * ( CaCSQN (CaSR) + dCaSR (Cai, CaSR, CaSS, RR, HT) + CaSR);
737  }
738  inline Real solveCaSR (Real Cai, Real CaSR, Real CaSS, Real RR, Real HT)
739  {
740  return ( std::sqrt ( bjsr (Cai, CaSR, CaSS, RR, HT) * bjsr (Cai, CaSR, CaSS, RR, HT)
741  + 4. * cjsr (Cai, CaSR, CaSS, RR, HT) )
742  - bjsr (Cai, CaSR, CaSS, RR, HT) ) / 2.;
743  }
744 
745  inline Real CaSSBuf (Real CaSS)
746  {
747  return Bufss * CaSS / ( CaSS + Kbufss);
748  }
749  inline Real dCaSS (Real Cai, Real CaSR, Real CaSS, Real RR, Real V, Real d, Real f, Real f2, Real fcass, Real HT = 1.0)
750  {
751  return HT * ( - Ixfer (CaSS, Cai) * ( Vc / Vss )
752  + Irel (CaSR, CaSS, RR) * ( Vsr / Vss )
753  + ( - ICaL (V, d, f, f2, fcass, CaSS) * inversevssF2 * M_cellularCapacitance ) );
754  };
755  inline Real bcss (Real Cai, Real CaSR, Real CaSS, Real RR, Real V, Real d, Real f, Real f2, Real fcass, Real HT)
756  {
757  return Bufss - CaSSBuf (CaSS) - dCaSS (Cai, CaSR, CaSS, RR, V, d, f, f2, fcass, HT) - CaSS + Kbufss;
758  }
759  inline Real ccss (Real Cai, Real CaSR, Real CaSS, Real RR, Real V, Real d, Real f, Real f2, Real fcass, Real HT)
760  {
761  return Kbufss * ( CaSSBuf (CaSS) + dCaSS (Cai, CaSR, CaSS, RR, V, d, f, f2, fcass, HT) + CaSS);
762  }
763  inline Real solveCaSS (Real Cai, Real CaSR, Real CaSS, Real RR, Real V, Real d, Real f, Real f2, Real fcass, Real HT)
764  {
765  return ( std::sqrt ( bcss (Cai, CaSR, CaSS, RR, V, d, f, f2, fcass, HT) * bcss (Cai, CaSR, CaSS, RR, V, d, f, f2, fcass, HT)
766  + 4. * ccss (Cai, CaSR, CaSS, RR, V, d, f, f2, fcass, HT) )
767  - bcss (Cai, CaSR, CaSS, RR, V, d, f, f2, fcass, HT) ) / 2.;
768  }
769 
770  inline Real CaBuf (Real Cai)
771  {
772  return Bufc * Cai / ( Cai + Kbufc);
773  }
774  inline Real dCai (Real V, Real Nai, Real Cai, Real CaSR, Real CaSS, Real HT = 1.0)
775  {
776  return HT * ( ( - ( IbCa (V, Cai) + IpCa (Cai) - 2. * INaCa (V, Nai, Cai) )
777  * inverseVcF2 * M_cellularCapacitance )
778  - ( Iup (Cai) - Ileak (CaSR, Cai) ) * ( Vsr / Vc )
779  + Ixfer (CaSS, Cai) );
780  }
781  inline Real bc (Real V, Real Nai, Real Cai, Real CaSR, Real CaSS, Real HT)
782  {
783  return Bufc - CaBuf (Cai) - dCai (V, Nai, Cai, CaSR, CaSS, HT) - Cai + Kbufc;
784  }
785  inline Real cc (Real V, Real Nai, Real Cai, Real CaSR, Real CaSS, Real HT)
786  {
787  return Kbufc * ( CaBuf (Cai) + dCai (V, Nai, Cai, CaSR, CaSS, HT) + Cai);
788  }
789  inline Real solveCai (Real V, Real Nai, Real Cai, Real CaSR, Real CaSS, Real HT)
790  {
791  return ( std::sqrt ( bc (V, Nai, Cai, CaSR, CaSS, HT) * bc (V, Nai, Cai, CaSR, CaSS, HT)
792  + 4. * cc (V, Nai, Cai, CaSR, CaSS, HT) )
793  - bc (V, Nai, Cai, CaSR, CaSS, HT) ) / 2.;
794  }
795 
796 
797  inline Real dNai (Real V, Real m, Real h, Real j, Real Nai, Real Cai)
798  {
799  return - ( INa (V, m, h, j, Nai)
800  + IbNa (V, Nai)
801  + 3. * INaK (V, Nai)
802  + 3. * INaCa (V, Nai, Cai) ) * inverseVcF * M_cellularCapacitance;
803  }
804  inline Real solveNai (Real V, Real m, Real h, Real j, Real Nai, Real Cai, Real HT)
805  {
806  return Nai + HT * dNai (V, m, h, j, Nai, Cai);
807  }
808 
809  inline Real dKi (Real V, Real r, Real s, Real xr1, Real xr2, Real xs, Real Nai, Real Ki)
810  {
811  return - (- M_appliedCurrent
812  + IK1 (V, Ki)
813  + Ito (V, r, s, Ki)
814  + IKr (V, xr1, xr2, Ki)
815  + IKs (V, xs, Ki, Nai)
816  - 2. * INaK (V, Nai)
817  + IpK (V, Ki) ) * inverseVcF * M_cellularCapacitance;
818  }
819  inline Real solveKi (Real V, Real r, Real s, Real xr1, Real xr2, Real xs, Real Nai, Real Ki, Real HT)
820  {
821  return Ki + HT * dKi (V, r, s, xr1, xr2, xs, Nai, Ki);
822  }
823 
824 
825  inline Real AM (Real V)
826  {
827  return 1. / ( 1. + std::exp ( ( -60. - V ) / 5. ) );
828  }
829  inline Real BM (Real V)
830  {
831  return 0.1 / ( 1. + std::exp ( ( V + 35. ) / 5. ) )
832  + 0.10 / ( 1. + std::exp ( ( V - 50. ) / 200. ) );
833  }
834  inline Real TAU_M (Real V)
835  {
836  return AM (V) * BM (V);
837  }
838  inline Real M_INF (Real V)
839  {
840  return 1. / ( ( 1. + std::exp ( ( -56.86 - V ) / 9.03 ) )
841  * ( 1. + std::exp ( ( - 56.86 - V ) / 9.03 ) ) );
842  }
843  inline Real AH (Real V)
844  {
845  if ( V >= - 40.)
846  {
847  return 0.0;
848  }
849  else
850  {
851  return ( 0.057 * std::exp ( - ( V + 80. ) / 6.8 ) );
852  }
853  }
854  inline Real BH (Real V)
855  {
856  if ( V >= - 40.)
857  {
858  return ( 0.77 / ( 0.13 * ( 1. + std::exp ( - ( V + 10.66 ) / 11.1 ) ) ) );
859  }
860  else
861  {
862  return ( 2.7 * std::exp ( 0.079 * V ) + ( 3.1e5 ) * std::exp ( 0.3485 * V ) );
863  }
864  }
865  inline Real TAU_H (Real V)
866  {
867  return 1.0 / (AH (V) + BH (V) );
868  }
869 
870  inline Real H_INF (Real V)
871  {
872  return 1. / ( ( 1. + std::exp ( ( V + 71.55 ) / 7.43 ) )
873  * ( 1. + std::exp ( ( V + 71.55 ) / 7.43 ) ) );
874  }
875 
876  inline Real AJ (Real V)
877  {
878  if ( V >= - 40.)
879  {
880  return 0.0;
881  }
882  else
883  return ( ( ( -2.5428e4 ) * std::exp ( 0.2444 * V ) - ( 6.948e-6 ) *
884  std::exp ( -0.04391 * V ) ) * ( V + 37.78 ) /
885  ( 1. + std::exp ( 0.311 * ( V + 79.23 ) ) ) );
886 
887  }
888  inline Real BJ (Real V)
889  {
890  if ( V >= - 40.)
891  {
892  return ( 0.6 * std::exp ( ( 0.057 ) * V ) / ( 1. + std::exp ( -0.1 * ( V + 32. ) ) ) );
893  }
894  else
895  return ( 0.02424 * std::exp ( -0.01052 * V )
896  / ( 1. + std::exp ( -0.1378 * ( V + 40.14 ) ) ) );
897  }
898  inline Real TAU_J (Real V)
899  {
900  return 1.0 / ( AJ (V) + BJ (V) );
901  }
902  inline Real J_INF (Real V)
903  {
904  return H_INF (V);
905  }
906 
907  inline Real Xr1_INF (Real V)
908  {
909  return 1. / ( 1. + std::exp ( ( -26. - V ) / 7. ) );
910  }
911  inline Real axr1 (Real V)
912  {
913  return 450. / ( 1. + std::exp ( ( -45. - V ) / 10. ) );
914  }
915  inline Real bxr1 (Real V)
916  {
917  return 6. / ( 1. + std::exp ( ( V - ( -30. ) ) / 11.5 ) );
918  }
919  inline Real TAU_Xr1 (Real V)
920  {
921  return axr1 (V) * bxr1 (V);
922  }
923  inline Real Xr2_INF (Real V)
924  {
925  return 1. / ( 1. + std::exp ( ( V - (-88.) ) / 24. ) );
926  }
927  inline Real axr2 (Real V)
928  {
929  return 3. / ( 1. + std::exp ( ( -60. - V ) / 20. ) );
930  }
931  inline Real bxr2 (Real V)
932  {
933  return 1.12 / ( 1. + std::exp ( ( V - 60. ) / 20. ) );
934  }
935  inline Real TAU_Xr2 (Real V)
936  {
937  return axr2 (V) * bxr2 (V);
938  }
939 
940  inline Real Xs_INF (Real V)
941  {
942  return 1. / ( 1. + std::exp ( ( -5. - V ) / 14. ) );
943  }
944  inline Real Axs (Real V)
945  {
946  return ( 1400. / (std::sqrt ( 1. + std::exp ( ( 5. - V ) / 6. ) ) ) );
947  }
948  inline Real Bxs (Real V)
949  {
950  return ( 1. / ( 1. + std::exp ( ( V - 35. ) / 15.) ) );
951  }
952  inline Real TAU_Xs (Real V)
953  {
954  return Axs (V) * Bxs (V) + 80.;
955  }
956 
957  inline Real R_INF (Real V)
958  {
959  return 1. / ( 1. + std::exp ( ( 20. - V ) / 6. ) );
960  }
961  inline Real S_INF (Real V)
962  {
963  if (flag == Epi)
964  {
965  return 1. / ( 1. + std::exp ( ( V + 20. ) / 5. ) );
966  }
967  else if (flag == Endo)
968  {
969  return 1. / ( 1. + std::exp ( ( V + 28. ) / 5. ) );
970  }
971  else
972  {
973  return 1. / ( 1. + std::exp ( ( V + 20. ) / 5. ) );
974  }
975  }
976  inline Real TAU_R (Real V)
977  {
978  return 9.5 * std::exp ( - ( V + 40. ) * ( V + 40. ) / 1800. ) + 0.8;
979  }
980  inline Real TAU_S (Real V)
981  {
982  if (flag == Epi)
983  return 85. * std::exp ( - ( V + 45. ) * ( V + 45. ) / 320. )
984  + 5. / ( 1. + std::exp ( ( V - 20. ) / 5. ) ) + 3.;
985  else if (flag == Endo)
986  {
987  return 1000. * std::exp ( - ( V + 67. ) * ( V + 67. ) / 1000. ) + 8.;
988  }
989  else
990  return 85. * std::exp ( - ( V + 45. ) * ( V + 45. ) / 320. )
991  + 5. / ( 1. + std::exp ( ( V - 20. ) / 5. ) ) + 3.;
992  }
993 
994 
995  inline Real D_INF (Real V)
996  {
997  return 1. / ( 1. + std::exp ( ( - 8. - V ) / 7.5 ) );
998  }
999  inline Real Ad (Real V)
1000  {
1001  return 1.4 / ( 1. + std::exp ( ( - 35. - V ) / 13. ) ) + 0.25;
1002  }
1003  inline Real Bd (Real V)
1004  {
1005  return 1.4 / ( 1. + std::exp ( ( V + 5. ) / 5. ) );
1006  }
1007  inline Real Cd (Real V)
1008  {
1009  return 1. / ( 1. + std::exp ( ( 50. - V ) / 20. ) );
1010  }
1011  inline Real TAU_D (Real V)
1012  {
1013  return Ad (V) * Bd (V) + Cd (V);
1014  }
1015  inline Real F_INF (Real V)
1016  {
1017  return 1. / ( 1. + std::exp ( ( V + 20. ) / 7. ) );
1018  }
1019  inline Real Af (Real V)
1020  {
1021  return 1102.5 * std::exp ( - ( V + 27. ) * ( V + 27. ) / 225. );
1022  }
1023  inline Real Bf (Real V)
1024  {
1025  return 200. / ( 1. + std::exp ( ( 13. - V ) / 10. ) );
1026  }
1027  inline Real Cf (Real V)
1028  {
1029  return ( 180. / ( 1. + std::exp ( ( V + 30. ) / 10. ) ) ) + 20.;
1030  }
1031  inline Real TAU_F (Real V)
1032  {
1033  return Af (V) + Bf (V) + Cf (V);
1034  }
1035  inline Real F2_INF (Real V)
1036  {
1037  return 0.67 / ( 1. + std::exp ( ( V + 35. ) / 7. ) ) + 0.33;
1038  }
1039  inline Real Af2 (Real V)
1040  {
1041  return 600. * std::exp ( - ( V + 25. ) * ( V + 25. ) / 170. );
1042  }
1043  inline Real Bf2 (Real V)
1044  {
1045  return 31. / ( 1. + std::exp ( ( 25. - V ) / 10. ) );
1046  }
1047  inline Real Cf2 (Real V)
1048  {
1049  return 16. / ( 1. + std::exp ( ( V + 30. ) / 10. ) );
1050  }
1051  inline Real TAU_F2 (Real V)
1052  {
1053  return Af2 (V) + Bf2 (V) + Cf2 (V);
1054  }
1055  inline Real FCaSS_INF (Real CaSS)
1056  {
1057  return 0.6 / ( 1. + ( CaSS / 0.05 ) * ( CaSS / 0.05 ) ) + 0.4;
1058  }
1059  inline Real TAU_FCaSS (Real CaSS)
1060  {
1061  return 80. / ( 1. + ( CaSS / 0.05 ) * ( CaSS / 0.05 ) ) + 2.;
1062  }
1063 
1064 
1065  inline Real solveM (Real V, Real m, Real HT)
1066  {
1067  return m + HT * (M_INF (V) - m) / TAU_M (V);
1068  }
1069  inline Real solveH (Real V, Real h, Real HT)
1070  {
1071  return h + HT * (H_INF (V) - h) / TAU_H (V);
1072  }
1073  inline Real solveJ (Real V, Real j, Real HT)
1074  {
1075  return j + HT * (J_INF (V) - j) / TAU_J (V);
1076  }
1077  inline Real solveXr1 (Real V, Real xr1, Real HT)
1078  {
1079  return xr1 + HT * ( Xr1_INF (V) - xr1) / TAU_Xr1 (V);
1080  }
1081  inline Real solveXr2 (Real V, Real xr2, Real HT)
1082  {
1083  return xr2 + HT * ( Xr2_INF (V) - xr2 ) / TAU_Xr2 (V);
1084  }
1085  inline Real solveXs (Real V, Real xs, Real HT)
1086  {
1087  return xs + HT * ( Xs_INF (V) - xs ) / TAU_Xs (V);
1088  }
1089  inline Real solveS (Real V, Real s, Real HT)
1090  {
1091  return s + HT * ( S_INF (V) - s ) / TAU_S (V) ;
1092  }
1093  inline Real solveR (Real V, Real r, Real HT)
1094  {
1095  return r + HT * ( R_INF (V) - r) / TAU_R (V);
1096  }
1097  inline Real solveD (Real V, Real d, Real HT)
1098  {
1099  return d + HT * ( D_INF (V) - d ) / TAU_D (V);
1100  }
1101  inline Real solveF (Real V, Real f, Real HT)
1102  {
1103  return f + HT * (F_INF (V) - f) / TAU_F (V);
1104  }
1105  inline Real solveF2 (Real V, Real f2, Real HT)
1106  {
1107  return f2 + HT * (F2_INF (V) - f2) / TAU_F2 (V);
1108  }
1109  inline Real solveFCaSS (Real CaSS, Real fcass, Real HT)
1110  {
1111  return fcass + HT * (FCaSS_INF (CaSS) - fcass) / TAU_FCaSS (CaSS);
1112  }
1113 
1114 
1115  inline Real dM (Real V, Real m)
1116  {
1117  return (M_INF (V) - m) / TAU_M (V);
1118  }
1119  inline Real dH (Real V, Real h)
1120  {
1121  return (H_INF (V) - h) / TAU_H (V);
1122  }
1123  inline Real dJ (Real V, Real j)
1124  {
1125  return (J_INF (V) - j) / TAU_J (V);
1126  }
1127  inline Real dXr1 (Real V, Real xr1)
1128  {
1129  return ( Xr1_INF (V) - xr1) / TAU_Xr1 (V);
1130  }
1131  inline Real dXr2 (Real V, Real xr2)
1132  {
1133  return ( Xr2_INF (V) - xr2 ) / TAU_Xr2 (V);
1134  }
1135  inline Real dXs (Real V, Real xs)
1136  {
1137  return ( Xs_INF (V) - xs ) / TAU_Xs (V);
1138  }
1139  inline Real dS (Real V, Real s)
1140  {
1141  return ( S_INF (V) - s ) / TAU_S (V) ;
1142  }
1143  inline Real dR (Real V, Real r)
1144  {
1145  return ( R_INF (V) - r) / TAU_R (V);
1146  }
1147  inline Real dD (Real V, Real d)
1148  {
1149  return ( D_INF (V) - d ) / TAU_D (V);
1150  }
1151  inline Real dF (Real V, Real f)
1152  {
1153  return (F_INF (V) - f) / TAU_F (V);
1154  }
1155  inline Real dF2 (Real V, Real f2)
1156  {
1157  return (F2_INF (V) - f2) / TAU_F2 (V);
1158  }
1159  inline Real dFCaSS (Real CaSS, Real fcass)
1160  {
1161  return (FCaSS_INF (CaSS) - fcass) / TAU_FCaSS (CaSS);
1162  }
1163 
1164 
1165  //update voltage
1166  inline Real solveV (Real V, Real m, Real h, Real j, Real d, Real f, Real f2, Real fcass,
1167  Real r, Real s, Real xr1, Real xr2, Real xs, Real Nai, Real Ki,
1168  Real Cai, Real CaSS , Real HT)
1169  {
1170  return V + HT * ( M_appliedCurrent / M_membraneCapacitance + (- Itot (V, m, h, j, d, f, f2, fcass, r, s, xr1, xr2, xs, Nai, Ki, Cai, CaSS ) ) );
1171  }
1172 
1173  //Compute the rhs on a single node or for the 0D case
1174  void computeGatingRhs ( const std::vector<Real>& v, std::vector<Real>& rhs);
1175 
1176  void computeNonGatingRhs ( const std::vector<Real>& v, std::vector<Real>& rhs );
1177 
1178  void computeRhs ( const std::vector<Real>& v, std::vector<Real>& rhs);
1179 
1180  // compute the rhs with state variable interpolation
1181  Real computeLocalPotentialRhs ( const std::vector<Real>& v );
1182 
1183  //
1184  void computeGatingVariablesWithRushLarsen ( std::vector<Real>& v, const Real dt );
1185 
1186 
1187  //! Display information about the model
1188  void showMe();
1189 
1190  void showCurrents (std::vector<Real>& v);
1191  void showCurrents (Real V, Real m, Real h, Real j, Real d, Real f, Real f2, Real fcass,
1192  Real r, Real s, Real xr1, Real xr2, Real xs, Real Nai, Real Ki,
1193  Real Cai, Real CaSS);
1194 
1195  void solveOneStep (std::vector<Real>& v, Real dt);
1196  //! Solves the ionic model
1197  //virtual void solveXbModel( const vector_Type& Calcium,
1198  // const Real timeStep )=0;
1199  //@}
1200 
1201  enum WallFlag
1202  {
1203  Endo, Epi, MCell
1204  };
1205 
1206  inline WallFlag getFlag()
1207  {
1208  return flag;
1209  }
1210 
1211 
1212 private:
1213  //! Model Parameters
1214 
1215  //Parameters
1216  Real knak;
1217  Real KmNa;
1218  Real KmK;
1219  Real knaca;
1220  Real KmNai;
1221  Real KmCa;
1222  Real ksat;
1223  Real n;
1224 
1225 
1226  Real Ko;
1227  Real Cao;
1228  Real Nao;
1229 
1230 
1231  Real Bufc;
1232  Real Kbufc;
1233  Real Bufsr;
1234  Real Kbufsr;
1235  Real Bufss;
1236  Real Kbufss;
1237 
1238  Real Vmaxup;
1239  Real Kup;
1240  Real Vrel;
1241  Real k1_;
1242  Real k2_;
1243  Real k3;
1244  Real k4;
1245  Real EC;
1246  Real maxsr;
1247  Real minsr;
1248  Real Vleak;
1249  Real Vxfer;
1250 
1251 
1252  Real pKNa;
1253 
1254  Real RTONF;
1255  Real F;
1256  Real R;
1257  Real T;
1258 
1259 
1260  Real Gkr;
1261  Real Gks;
1262  Real GK1;
1263  Real Gto;
1264  Real GNa;
1265  Real GbNa;
1266  Real GCaL;
1267  Real GbCa;
1268  Real GpCa;
1269  Real KpCa;
1270  Real GpK;
1271 
1272 
1273  Real Vc;
1274  Real Vsr;
1275  Real Vss;
1276 
1277  Real inverseVcF2;
1278  Real inverseVcF;
1279  Real inversevssF2;
1280 
1281  WallFlag flag;
1282 
1283  Real M_cellularCapacitance;
1284  //@}
1285 
1286 }; // class IonicTenTusscher06
1287 
1288 inline ElectroIonicModel* createIonicTenTusscher06()
1289 {
1290  return new IonicTenTusscher06();
1291 }
1292 
1293 namespace
1294 {
1296 }
1297 
1298 }
1299 
1300 #endif
void updateInverseJacobian(const UInt &iQuadPt)
double Real
Generic real data.
Definition: LifeV.hpp:175