CEPS  24.01
Cardiac ElectroPhysiology Simulator
AP95.cpp
Go to the documentation of this file.
1 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2  This file is part of CEPS.
3 
4  CEPS is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  CEPS is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with CEPS (see file LICENSE at root of project).
16  If not, see <https://www.gnu.org/licenses/>.
17 
18 
19  Copyright 2019-2024 Inria, Universite de Bordeaux
20 
21  Authors, in alphabetical order:
22 
23  Pierre-Elliott BECUE, Florian CARO, Yves COUDIERE(*), Andjela DAVIDOVIC,
24  Charlie DOUANLA-LONTSI, Marc FUENTES, Mehdi JUHOOR, Michael LEGUEBE(*),
25  Pauline MIGERDITICHAN, Valentin PANNETIER(*), Nejib ZEMZEMI.
26  * : currently active authors
27 
28 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
30 #include "ode/ionicModels/AP95.hpp"
31 
33  Unknown* u,
34  const CepsSet<CepsAttribute>& attrs,
35  InputParameters* params
36 ):
37  AbstractIonicModel(u,attrs)
38 {
39 
40  m_name = "Aliev-Panfilov 2003";
41  m_nStateVars = 1;
42  m_stateVarNames = {"h [adim]"};
43 
44  // ================================================================================
45  // Default parameters
46 
47  m_vMin = -90;
48  m_vMax = 50;
49  m_cellSurface = 1.;
50 
51  m_constants = new CepsReal[5];
52  m_constants[_k ] = 8.0;
53  m_constants[_a ] = 0.15;
54  m_constants[_mu1 ] = 0.2;
55  m_constants[_mu2 ] = 0.3;
56  m_constants[_eps0 ] = 2E-3;
57 
58  m_paperCm = 1.;
59  m_paperStim = 0.2;
60 
61  // ================================================================================
62  // Parameters from text inputs, if any
63  if (ceps::isValidPtr(params))
64  setupWithParameters(params,nullptr);
65 
66 }
67 
68 void
70 {
71  *v = 0.0;
72  y[_h] = 0.0;
73 }
74 
75 void
77  CepsReal t,
78  CepsReal* y,
79  CepsReal* vm,
80  CepsReal* dtyLin,
81  CepsReal* dtyNLin,
82  CepsReal* dtv,
83  DegreeOfFreedom* dof
84 ) const
85 {
86 
87  CepsReal* c = m_constants;
88  CepsReal v = *vm;
89  CepsReal h = y[_h];
90 
91  CepsReal eps = c[_eps0] + c[_mu1] * h / (c[_mu2] + v);
92 
93  dtyLin [_h] = 0;
94  dtyNLin[_h] = eps * (-h - c[_k] * v * (v - c[_a] - 1));
95 
96  CepsReal cm = getCmInternal(t,dof);
97  CepsReal iStim = getStimulation(dof,t);
98 
99  *dtv = -c[_k] * v * (v - c[_a]) * (v - 1) - h * v + iStim;
100  *dtv /= cm;
101 }
102 
103 CepsReal
105 {
106  return m_vMin + v*(m_vMax-m_vMin);
107 }
108 
109 CepsReal
111 {
112  return (v-m_vMin)/(m_vMax-m_vMin);
113 }
114 
115 CepsReal
117 {
118  return i/(m_vMax-m_vMin);
119 }
120 
121 CepsReal
123 {
124  return dtv*(m_vMax-m_vMin);
125 }
126 
127 CepsReal
129 {
130  return cm;
131 }
132 
133 CepsReal
135 {
136  return cm;
137 }
138 
139 void
141 {
142 
143  m_constants[_k ] = params->getReal("AP95 k ",m_constants[_k ]);
144  m_constants[_a ] = params->getReal("AP95 a ",m_constants[_a ]);
145  m_constants[_mu1 ] = params->getReal("AP95 mu1 ",m_constants[_mu1 ]);
146  m_constants[_mu2 ] = params->getReal("AP95 mu2 ",m_constants[_mu2 ]);
147  m_constants[_eps0 ] = params->getReal("AP95 eps0 ",m_constants[_eps0 ]);
148 
149  m_vMin = params->getReal("AP95 vMin",m_vMin);
150  m_vMax = params->getReal("AP95 vMax",m_vMax);
151  m_cellSurface = params->getReal("AP95 cell surface",m_cellSurface);
152 
153  return;
154 }
std::set< _Type, _Compare, _Alloc > CepsSet
C++ set.
Definition: CepsTypes.hpp:209
float CepsReal
Need single precision floating point.
Definition: CepsTypes.hpp:100
CepsReal convertVoltageFromCepsUnit(const CepsReal &u) const override
Convert from mV to no unit.
Definition: AP95.cpp:110
void getInitialCondition(CepsReal *v, CepsReal *y) const final
Sets initial values of state variables and transmembrane voltage for a single point....
Definition: AP95.cpp:69
static constexpr const CepsInt _eps0
indexing alias
Definition: AP95.hpp:117
CepsReal convertCmToCepsUnit(const CepsReal &cm) const override
Convert capacitance from ionic model units to ceps units (uF/cm2).
Definition: AP95.cpp:134
static constexpr const CepsInt _mu2
indexing alias
Definition: AP95.hpp:116
CepsReal convertVoltageToCepsUnit(const CepsReal &u) const override
Convert from no unit to mV.
Definition: AP95.cpp:104
CepsReal convertCmFromCepsUnit(const CepsReal &cm) const override
Convert capacitance from ceps units (uF/cm2) to ionic model units.
Definition: AP95.cpp:128
CepsReal m_cellSurface
surface of a cell used for unit scaling. Default is surface of a cylinder (r=10um,...
Definition: AP95.hpp:107
AP95(Unknown *u, const CepsSet< CepsAttribute > &attrs={}, InputParameters *params=nullptr)
Constructor (sets constants)
Definition: AP95.cpp:32
void setupWithParameters(InputParameters *p, FunctionDictionary *dico)
Sets the constants and the space dependant parameters from text inputs.
Definition: AP95.cpp:140
CepsReal convertDtvToCepsUnit(const CepsReal &i) const override
Convert from s-1 to uA per cm2.
Definition: AP95.cpp:122
static constexpr const CepsInt _h
indexing alias
Definition: AP95.hpp:110
CepsReal m_vMax
upper bound of voltage normalization interval
Definition: AP95.hpp:106
static constexpr const CepsInt _a
indexing alias
Definition: AP95.hpp:114
CepsReal m_vMin
lower bound of voltage normalization interval
Definition: AP95.hpp:105
static constexpr const CepsInt _k
indexing alias
Definition: AP95.hpp:113
void computeRates(CepsReal t, CepsReal *y, CepsReal *v, CepsReal *dtyL, CepsReal *dtyNL, CepsReal *dtv, DegreeOfFreedom *dof) const final
Get the linear and non linear part of the evolution function f. Also computes the ionic current.
Definition: AP95.cpp:76
CepsReal convertCurrentFromCepsUnit(const CepsReal &i) const override
Convert from uA per cm2 to s-1.
Definition: AP95.cpp:116
static constexpr const CepsInt _mu1
indexing alias
Definition: AP95.hpp:115
Represents a ionic model for a group of cells, i.e. multiple systems of ODEs.
CepsReal m_paperStim
Original stim amplitude.
CepsUInt m_nStateVars
Dimensionality of the ODE system, -1 for vm.
CepsReal * m_constants
Constant parameters of the model, from inputs.
CepsReal getStimulation(DegreeOfFreedom *x, CepsReal t) const
Get the sum of all stimulations at time t and dof x.
CepsVector< CepsString > m_stateVarNames
Names of state variables.
CepsReal getCmInternal(CepsReal t, DegreeOfFreedom *dof) const
Get either the value of cm on dof, or the default value from the paper.
CepsReal m_paperCm
Original value of Cm.
CepsString m_name
A label for display.
A degree of freedom for any kind of problem The dof can be associated to a geometrical element or not...
FunctionDictionary that holds functions which can be used to define source terms, boundary conditions...
Reads and stores simulation configuration.
CepsReal getReal(const keyType &key) const
Reads a floating point value from configuration.
A class used to defined an unknown of a PDE problem The unknown can be defined on a specific region,...
Definition: Unknown.hpp:45
CepsBool isValidPtr(_Type *ptr)
Tells if pointer is not null.
Definition: CepsMemory.hpp:61