Line |
Branch |
Exec |
Source |
1 |
|
|
// ______ ______ _ _ _____ ______ |
2 |
|
|
// | ____| ____| | (_)/ ____| | ____| |
3 |
|
|
// | |__ | |__ | | _| (___ ___| |__ |
4 |
|
|
// | __| | __| | | | |\___ \ / __| __| |
5 |
|
|
// | | | |____| |____| |____) | (__| |____ |
6 |
|
|
// |_| |______|______|_|_____/ \___|______| |
7 |
|
|
// Finite Elements for Life Sciences and Engineering |
8 |
|
|
// |
9 |
|
|
// License: LGL2.1 License |
10 |
|
|
// FELiScE default license: LICENSE in root folder |
11 |
|
|
// |
12 |
|
|
// Main authors: A. Collin |
13 |
|
|
// |
14 |
|
|
|
15 |
|
|
#ifndef _COURTEMANCHESOLVER_HPP |
16 |
|
|
#define _COURTEMANCHESOLVER_HPP |
17 |
|
|
|
18 |
|
|
// System includes |
19 |
|
|
|
20 |
|
|
// External includes |
21 |
|
|
#include "Core/NoThirdPartyWarning/Petsc/vec.hpp" |
22 |
|
|
#include "Core/NoThirdPartyWarning/Petsc/ao.hpp" |
23 |
|
|
|
24 |
|
|
// Project includes |
25 |
|
|
#include "Model/model.hpp" |
26 |
|
|
#include "Core/felisce.hpp" |
27 |
|
|
#include "Solver/bdf.hpp" |
28 |
|
|
#include "Core/felisceParam.hpp" |
29 |
|
|
#include "Core/felisceTransient.hpp" |
30 |
|
|
#include "Solver/cardiacFunction.hpp" |
31 |
|
|
|
32 |
|
|
namespace felisce |
33 |
|
|
{ |
34 |
|
|
class CourtemancheSolver { |
35 |
|
|
public: |
36 |
|
|
/// Constructor. |
37 |
|
|
CourtemancheSolver(FelisceTransient::Pointer fstransient); |
38 |
|
|
/// Destructor. |
39 |
|
|
~CourtemancheSolver(); |
40 |
|
|
|
41 |
|
|
void defineSizeAndMappingOfIonicProblem(felInt size, ISLocalToGlobalMapping& mapping, AO ao=FELISCE_PETSC_NULLPTR); |
42 |
|
|
|
43 |
|
|
void initializeExtrap(PetscVector& V_0); |
44 |
|
|
void updateExtrap(PetscVector& V_1); |
45 |
|
|
|
46 |
|
|
/// Compute Iion with value_uExtrap. |
47 |
|
|
double iIonTotal(double v, felInt pos); |
48 |
|
|
/// Update ion concentrations. |
49 |
|
|
void updateConcentrations(); |
50 |
|
|
void initializeConcentrationsAndGateConditions(PetscVector& m,PetscVector& h, PetscVector& j, PetscVector& ao, PetscVector& io, PetscVector& ua, PetscVector& ui, PetscVector& xr, PetscVector& xs, PetscVector& d, PetscVector& f, PetscVector& fca, PetscVector& urel, PetscVector& vrel, PetscVector& wrel, PetscVector& nai, PetscVector& nao, PetscVector& cao, PetscVector& ki, PetscVector& ko, PetscVector& cai, PetscVector& naiont, PetscVector& kiont, PetscVector& caiont, PetscVector& ileak, PetscVector& iup, PetscVector& itr, PetscVector& irel, PetscVector& cmdn, PetscVector& trpn, PetscVector& nsr, PetscVector& jsr, PetscVector& csqn); |
51 |
|
|
|
52 |
|
|
PetscVector& ionicVariable(int iVar); |
53 |
|
|
|
54 |
|
|
void computeIon(); |
55 |
|
|
|
56 |
|
|
/// Access function. |
57 |
|
|
inline const PetscVector& ion() const { |
58 |
|
|
return m_ion; |
59 |
|
|
} |
60 |
|
✗ |
inline PetscVector& ion() { |
61 |
|
✗ |
return m_ion; |
62 |
|
|
} |
63 |
|
|
|
64 |
|
|
inline const HeteroCourtModelIto& fctCourtCondIto() const { |
65 |
|
|
return m_heteroCourtModelIto; |
66 |
|
|
} |
67 |
|
✗ |
inline HeteroCourtModelIto& fctCourtCondIto() { |
68 |
|
✗ |
return m_heteroCourtModelIto; |
69 |
|
|
} |
70 |
|
|
|
71 |
|
|
inline const std::vector<double>& courtCondIto() const { |
72 |
|
|
return m_courtCondIto; |
73 |
|
|
} |
74 |
|
✗ |
inline std::vector<double>& courtCondIto() { |
75 |
|
✗ |
return m_courtCondIto; |
76 |
|
|
} |
77 |
|
|
|
78 |
|
|
inline const HeteroCourtModelICaL& fctCourtCondICaL() const { |
79 |
|
|
return m_heteroCourtModelICaL; |
80 |
|
|
} |
81 |
|
✗ |
inline HeteroCourtModelICaL& fctCourtCondICaL() { |
82 |
|
✗ |
return m_heteroCourtModelICaL; |
83 |
|
|
} |
84 |
|
|
|
85 |
|
|
inline const std::vector<double>& courtCondICaL() const { |
86 |
|
|
return m_courtCondICaL; |
87 |
|
|
} |
88 |
|
✗ |
inline std::vector<double>& courtCondICaL() { |
89 |
|
✗ |
return m_courtCondICaL; |
90 |
|
|
} |
91 |
|
|
|
92 |
|
|
inline const HeteroCourtModelMultCoeff& fctCourtCondMultCoeff() const { |
93 |
|
|
return m_heteroCourtModelMultCoeff; |
94 |
|
|
} |
95 |
|
✗ |
inline HeteroCourtModelMultCoeff& fctCourtCondMultCoeff() { |
96 |
|
✗ |
return m_heteroCourtModelMultCoeff; |
97 |
|
|
} |
98 |
|
|
|
99 |
|
|
inline const std::vector<double>& courtCondMultCoeff() const { |
100 |
|
|
return m_courtCondMultCoeff; |
101 |
|
|
} |
102 |
|
✗ |
inline std::vector<double>& courtCondMultCoeff() { |
103 |
|
✗ |
return m_courtCondMultCoeff; |
104 |
|
|
} |
105 |
|
|
|
106 |
|
|
protected: |
107 |
|
|
/// User data file of Felisce (only transient parameters). |
108 |
|
|
FelisceTransient::Pointer m_fstransient; |
109 |
|
|
/// Number of Dof for the trans membrane potential. |
110 |
|
|
felInt m_size; |
111 |
|
|
|
112 |
|
|
ISLocalToGlobalMapping m_localDofToGlobalDof; |
113 |
|
|
|
114 |
|
|
private: |
115 |
|
|
//Gate conditions |
116 |
|
|
// INa |
117 |
|
|
PetscVector m_m; |
118 |
|
|
PetscVector m_h; |
119 |
|
|
PetscVector m_j; |
120 |
|
|
// ITo |
121 |
|
|
PetscVector m_ao; |
122 |
|
|
PetscVector m_io; |
123 |
|
|
// IKur |
124 |
|
|
PetscVector m_ua; |
125 |
|
|
PetscVector m_ui; |
126 |
|
|
// IKr |
127 |
|
|
PetscVector m_xr; |
128 |
|
|
// IKs |
129 |
|
|
PetscVector m_xs; |
130 |
|
|
// ICaL |
131 |
|
|
PetscVector m_d; |
132 |
|
|
PetscVector m_f; |
133 |
|
|
PetscVector m_fca; |
134 |
|
|
// Irel |
135 |
|
|
PetscVector m_urel; |
136 |
|
|
PetscVector m_vrel; |
137 |
|
|
PetscVector m_wrel; |
138 |
|
|
|
139 |
|
|
// Ion concentrations |
140 |
|
|
PetscVector m_nai; |
141 |
|
|
PetscVector m_nao; |
142 |
|
|
PetscVector m_cao; |
143 |
|
|
PetscVector m_ki; |
144 |
|
|
PetscVector m_ko; |
145 |
|
|
PetscVector m_cai; |
146 |
|
|
//Currents |
147 |
|
|
PetscVector m_naiont; |
148 |
|
|
PetscVector m_kiont; |
149 |
|
|
PetscVector m_caiont; |
150 |
|
|
PetscVector m_ileak; |
151 |
|
|
PetscVector m_iup; |
152 |
|
|
PetscVector m_itr; |
153 |
|
|
PetscVector m_irel; |
154 |
|
|
// Ca: |
155 |
|
|
PetscVector m_cmdn; /* Calmodulin Buffered Ca Concentration (mM) */ |
156 |
|
|
PetscVector m_trpn; /* Troponin Buffered Ca Concentration (mM) */ |
157 |
|
|
PetscVector m_nsr; /* NSR Ca Concentration (mM) */ |
158 |
|
|
PetscVector m_jsr; /* JSR Ca Concentration (mM) */ |
159 |
|
|
PetscVector m_csqn; /* Calsequestrin Buffered Ca Concentration (mM) */ |
160 |
|
|
|
161 |
|
|
//Gate conditions |
162 |
|
|
// INa |
163 |
|
|
double m_value_m; |
164 |
|
|
double m_value_h; |
165 |
|
|
double m_value_j; |
166 |
|
|
// ITo |
167 |
|
|
double m_valuem_ao; |
168 |
|
|
double m_value_io; |
169 |
|
|
// IKur |
170 |
|
|
double m_value_ua; |
171 |
|
|
double m_value_ui; |
172 |
|
|
// IKr |
173 |
|
|
double m_value_xr; |
174 |
|
|
// IKs |
175 |
|
|
double m_value_xs; |
176 |
|
|
// ICaL |
177 |
|
|
double m_value_d; |
178 |
|
|
double m_value_f; |
179 |
|
|
double m_value_fca; |
180 |
|
|
// Irel |
181 |
|
|
double m_value_urel; |
182 |
|
|
double m_value_vrel; |
183 |
|
|
double m_value_wrel; |
184 |
|
|
|
185 |
|
|
// Ion concentrations |
186 |
|
|
double m_value_nai; |
187 |
|
|
double m_value_nao; |
188 |
|
|
double m_value_cao; |
189 |
|
|
double m_value_ki; |
190 |
|
|
double m_value_ko; |
191 |
|
|
double m_value_cai; |
192 |
|
|
//Currents |
193 |
|
|
double m_value_naiont; |
194 |
|
|
double m_value_kiont; |
195 |
|
|
double m_value_caiont; |
196 |
|
|
double m_value_ileak; |
197 |
|
|
double m_value_iup; |
198 |
|
|
double m_value_itr; |
199 |
|
|
double m_value_irel; |
200 |
|
|
// Ca: |
201 |
|
|
double m_value_cmdn; /* Calmodulin Buffered Ca Concentration (mM) */ |
202 |
|
|
double m_value_trpn; /* Troponin Buffered Ca Concentration (mM) */ |
203 |
|
|
double m_value_nsr; /* NSR Ca Concentration (mM) */ |
204 |
|
|
double m_value_jsr; /* JSR Ca Concentration (mM) */ |
205 |
|
|
double m_value_csqn; /* Calsequestrin Buffered Ca Concentration (mM) */ |
206 |
|
|
|
207 |
|
|
|
208 |
|
|
// Ionic current |
209 |
|
|
PetscVector m_ion; |
210 |
|
|
/// Extrapolate vector. |
211 |
|
|
PetscVector m_uExtrap; |
212 |
|
|
|
213 |
|
|
HeteroCourtModelIto m_heteroCourtModelIto; |
214 |
|
|
std::vector<double> m_courtCondIto; |
215 |
|
|
|
216 |
|
|
HeteroCourtModelICaL m_heteroCourtModelICaL; |
217 |
|
|
std::vector<double> m_courtCondICaL; |
218 |
|
|
|
219 |
|
|
HeteroCourtModelMultCoeff m_heteroCourtModelMultCoeff; |
220 |
|
|
std::vector<double> m_courtCondMultCoeff; |
221 |
|
|
|
222 |
|
|
AO m_aoPetsc; |
223 |
|
|
|
224 |
|
|
}; |
225 |
|
|
} |
226 |
|
|
|
227 |
|
|
#endif |
228 |
|
|
|