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 _BIDOMAINMODEL_HPP |
16 |
|
|
#define _BIDOMAINMODEL_HPP |
17 |
|
|
|
18 |
|
|
// System includes |
19 |
|
|
|
20 |
|
|
// External includes |
21 |
|
|
#include "Core/NoThirdPartyWarning/Petsc/vec.hpp" |
22 |
|
|
|
23 |
|
|
// Project includes |
24 |
|
|
#include "Model/model.hpp" |
25 |
|
|
#include "Solver/linearProblemBidomain.hpp" |
26 |
|
|
#include "Solver/schafSolver.hpp" |
27 |
|
|
#include "Solver/schafRevisedSolver.hpp" |
28 |
|
|
#include "Solver/FhNSolver.hpp" |
29 |
|
|
#include "Solver/courtemancheSolver.hpp" |
30 |
|
|
#include "Solver/MVSolver.hpp" |
31 |
|
|
#include "Solver/PaciSolver.hpp" |
32 |
|
|
#include "Solver/BCLSolver.hpp" |
33 |
|
|
#include "Solver/bdf.hpp" |
34 |
|
|
#include "Solver/cardiacFunction.hpp" |
35 |
|
|
#include "PETScInterface/romPETSC.hpp" |
36 |
|
|
|
37 |
|
|
namespace felisce { |
38 |
|
|
class BidomainModel: |
39 |
|
|
public Model { |
40 |
|
|
public: |
41 |
|
|
///Construtor. |
42 |
|
|
BidomainModel(); |
43 |
|
|
///Destructor. |
44 |
|
|
~BidomainModel() override; |
45 |
|
|
void initializeDerivedModel() override; |
46 |
|
✗ |
virtual void userDefinedIonicModel() {} |
47 |
|
|
void initializeDerivedLinearProblem() override; |
48 |
|
|
void preAssemblingMatrixRHS(std::size_t iProblem=0) override; |
49 |
|
|
void postAssemblingMatrixRHS(std::size_t iProblem=0) override; |
50 |
|
|
void updateTime(const FlagMatrixRHS flagMatrixRHS=FlagMatrixRHS::matrix_and_rhs) override; |
51 |
|
|
void writeSolution(); |
52 |
|
|
void userDefinedInitialConditions(std::size_t iProblem=0) override; |
53 |
|
|
/// Manage time iteration. |
54 |
|
|
void forward() override; |
55 |
|
|
|
56 |
|
|
void forwardROM(); |
57 |
|
|
/// Initialize the SchafSolver and evaluate heterogeneous parameters of SchafSolver. |
58 |
|
|
void initializeSchafParameter(); |
59 |
|
|
/// Initialize the MinimalVentricular and evaluate heterogeneous parameters of SchafSolver. |
60 |
|
|
void initializeMVParameter(); |
61 |
|
|
/// Initialize the BCL and evaluate heterogeneous parameters of SchafSolver. |
62 |
|
|
void initializeBCLParameter(); |
63 |
|
|
/// Initialize the FithughNagumo and evaluate heterogeneous parameters of SchafSolver. |
64 |
|
|
void initializeFhNParameter(); |
65 |
|
|
/// Initialize the CourtemancheSolver and evaluate heterogeneous parameters of CourtemancheSolver. |
66 |
|
|
void initializeCourtParameter(); |
67 |
|
|
// void initializeMVParameter(); |
68 |
|
|
virtual void finalizeRHSDP(int iProblem=0); |
69 |
|
|
virtual void initializeAppCurrent(); |
70 |
|
|
virtual void initializeAppCurrentExt(); |
71 |
|
|
void evalIapp(); |
72 |
|
|
void evalIappExt(); |
73 |
|
|
|
74 |
|
|
MVSolver* getMVSolver();//For assimilation method----> get and std::set values |
75 |
|
|
std::vector<LinearProblemBidomain*> vecLPB() { |
76 |
|
|
return m_linearProblemBidomain; |
77 |
|
|
} |
78 |
|
|
|
79 |
|
|
#ifdef FELISCE_WITH_CVGRAPH |
80 |
|
|
void forwardLight(); |
81 |
|
|
void startIterationCVG() override; |
82 |
|
|
felInt m_kount; |
83 |
|
|
#endif |
84 |
|
|
|
85 |
|
|
protected: |
86 |
|
|
RomPETSC* m_rom; |
87 |
|
|
int m_verbose; |
88 |
|
|
bool m_buildIonic; |
89 |
|
|
bool m_buildCourt; |
90 |
|
|
///EDO solvers. |
91 |
|
|
IonicSolver* m_ionic; |
92 |
|
|
SchafSolver* m_schaf; |
93 |
|
|
FhNSolver* m_fhn; |
94 |
|
|
CourtemancheSolver* m_court; |
95 |
|
|
MVSolver* m_mv; |
96 |
|
|
PaciSolver* m_paci; |
97 |
|
|
BCLSolver* m_bcl; |
98 |
|
|
|
99 |
|
|
///EDP time scheme. |
100 |
|
|
Bdf m_bdfEdp; |
101 |
|
|
///Initialization vectors. |
102 |
|
|
std::vector<PetscVector> m_W_0; |
103 |
|
|
|
104 |
|
|
//For courtemanche model: |
105 |
|
|
//Gate conditions |
106 |
|
|
// INa |
107 |
|
|
PetscVector m_m; |
108 |
|
|
PetscVector m_h; |
109 |
|
|
PetscVector m_j; |
110 |
|
|
// ITo |
111 |
|
|
PetscVector m_ao; |
112 |
|
|
PetscVector m_io; |
113 |
|
|
// IKur |
114 |
|
|
PetscVector m_ua; |
115 |
|
|
PetscVector m_ui; |
116 |
|
|
// IKr |
117 |
|
|
PetscVector m_xr; |
118 |
|
|
// IKs |
119 |
|
|
PetscVector m_xs; |
120 |
|
|
// ICaL |
121 |
|
|
PetscVector m_d; |
122 |
|
|
PetscVector m_f; |
123 |
|
|
PetscVector m_fca; |
124 |
|
|
// Irel |
125 |
|
|
PetscVector m_urel; |
126 |
|
|
PetscVector m_vrel; |
127 |
|
|
PetscVector m_wrel; |
128 |
|
|
// Ion concentrations |
129 |
|
|
PetscVector m_nai; |
130 |
|
|
PetscVector m_nao; |
131 |
|
|
PetscVector m_cao; |
132 |
|
|
PetscVector m_ki; |
133 |
|
|
PetscVector m_ko; |
134 |
|
|
PetscVector m_cai; |
135 |
|
|
//Currents |
136 |
|
|
PetscVector m_naiont; |
137 |
|
|
PetscVector m_kiont; |
138 |
|
|
PetscVector m_caiont; |
139 |
|
|
PetscVector m_ileak; |
140 |
|
|
PetscVector m_iup; |
141 |
|
|
PetscVector m_itr; |
142 |
|
|
PetscVector m_irel; |
143 |
|
|
// Ca: |
144 |
|
|
PetscVector m_cmdn; /* Calmodulin Buffered Ca Concentration (mM) */ |
145 |
|
|
PetscVector m_trpn; /* Troponin Buffered Ca Concentration (mM) */ |
146 |
|
|
PetscVector m_nsr; /* NSR Ca Concentration (mM) */ |
147 |
|
|
PetscVector m_jsr; /* JSR Ca Concentration (mM) */ |
148 |
|
|
PetscVector m_csqn; /* Calsequestrin Buffered Ca Concentration (mM) */ |
149 |
|
|
|
150 |
|
|
AppCurrent* m_iApp; |
151 |
|
|
std::vector <double> m_iAppValue; |
152 |
|
|
AppCurrent* m_iAppExt; |
153 |
|
|
std::vector <double> m_iAppValueExt; |
154 |
|
|
/// Matrix of the luenberger filter |
155 |
|
|
PetscMatrix m_luenbFlter; |
156 |
|
|
std::vector<LinearProblemBidomain*> m_linearProblemBidomain; |
157 |
|
|
///Data for schaf solver from EDP solution. |
158 |
|
|
PetscVector m_extrapolate; |
159 |
|
|
|
160 |
|
|
private: |
161 |
|
|
/// Case of the observation |
162 |
|
|
EnsightCase * m_observations; |
163 |
|
|
/// Vector to store Observations |
164 |
|
|
PetscVector m_Observ; |
165 |
|
|
bool m_extrapolateIsCreated; |
166 |
|
|
// Restart vectors |
167 |
|
|
PetscVector m_bdf_sol_n; |
168 |
|
|
PetscVector m_bdf_sol_n_1; |
169 |
|
|
PetscVector m_bdf_sol_n_2; |
170 |
|
|
std::vector<PetscVector> m_ionic_sol_n; |
171 |
|
|
std::vector<PetscVector> m_ionic_sol_n_1; |
172 |
|
|
std::vector<PetscVector> m_ionic_sol_n_2; |
173 |
|
|
std::vector<PetscVector> m_courtVarInit; |
174 |
|
|
}; |
175 |
|
|
} |
176 |
|
|
|
177 |
|
|
|
178 |
|
|
#endif |
179 |
|
|
|