svMultiPhysics
Loading...
Searching...
No Matches
CepMod.h
1// SPDX-FileCopyrightText: Copyright (c) Stanford University, The Regents of the University of California, and others.
2// SPDX-License-Identifier: BSD-3-Clause
3
4// The classes defined here duplicate the data structures in the Fortran CEPMOD module
5// defined in CEPMOD.f.
6
7// This module defines data structures for cardiac electrophysiology
8// model equation. It also interfaces with individual modules for
9// the cellular activation model.
10
11
12#ifndef CEP_MOD_H
13#define CEP_MOD_H
14
15#include "CepModAp.h"
16#include "CepModBo.h"
17#include "CepModFn.h"
18#include "CepModTtp.h"
19#include "consts.h"
20
21#include "Array.h"
22#include "Vector.h"
23#include <map>
24
25/// @brief Type of cardiac electrophysiology models.
26enum class ElectrophysiologyModelType {
27 NA = 100,
28 AP = 101,
29 BO = 102,
30 FN = 103,
31 TTP = 104
32};
33
34extern const std::map<std::string,ElectrophysiologyModelType> cep_model_name_to_type;
35
36/// @brief Print ElectrophysiologyModelType as a string.
37static std::ostream &operator << ( std::ostream& strm, ElectrophysiologyModelType type)
38{
39 const std::map<ElectrophysiologyModelType, std::string> names = {
40 {ElectrophysiologyModelType::NA, "NA"},
41 {ElectrophysiologyModelType::AP,"AP"},
42 {ElectrophysiologyModelType::BO, "BO"},
43 {ElectrophysiologyModelType::FN, "FN"},
44 {ElectrophysiologyModelType::TTP, "TTP"},
45 };
46 return strm << names.at(type);
47}
48
49/// @brief Time integration scheme.
50enum class TimeIntegratioType {
51 NA = 200,
52 FE = 201,
53 RK4 = 202,
54 CN2 = 203
55};
56
57extern const std::map<std::string,TimeIntegratioType> cep_time_int_to_type;
58
59static std::ostream &operator << ( std::ostream& strm, TimeIntegratioType type)
60{
61 const std::map<TimeIntegratioType, std::string> names = {
62 {TimeIntegratioType::NA, "NA"},
63 {TimeIntegratioType::FE, "FE"},
64 {TimeIntegratioType::RK4, "RK4"},
65 {TimeIntegratioType::CN2, "CN2"},
66 };
67 return strm << names.at(type);
68}
69
70/// @brief Time integration scheme and related parameters
71class odeType {
72 public:
73 odeType() {};
74
75 /// @brief Time integration method type
76 TimeIntegratioType tIntType = TimeIntegratioType::NA;
77 //int tIntType = tIntType_NA;
78
79 /// @brief Max. iterations for Newton-Raphson method
80 int maxItr = 5;
81
82 /// @brief Absolute tolerance
83 double absTol = 1.E-8;
84
85 /// @brief Relative tolerance
86 double relTol = 1.E-4;
87};
88
89/// @brief External stimulus type
91{
92 public:
93 /// @brief start time
94 double Ts = 0.0;
95
96 /// @brief duration of stimulus
97 double Td = 0.0;
98
99 /// @brief cycle length
100 double CL = 0.0;
101
102 /// @brief stimulus amplitude
103 double A = 0.0;
104};
105
106/// @brief ECG leads type
108{
109 public:
110 /// @brief Number of leads
111 int num_leads = 0;
112
113 /// @brief x coordinates
115
116 /// @brief y coordinates
118
119 /// @brief z coordinates
121
122 /// @brief Pseudo ECG over each lead
124
125 /// @brief Output files
126 std::vector<std::string> out_files;
127};
128
129/// @brief Cardiac electrophysiology model type
131{
132 public:
133 cepModelType();
135
136 /// @brief Type of cardiac electrophysiology model
137 ElectrophysiologyModelType cepType = ElectrophysiologyModelType::NA;
138
139 /// @brief Number of state variables
140 int nX = 0;
141
142 /// @brief Number of gating variables
143 int nG = 0;
144
145 /// @brief Number of fiber directions
146 int nFn = 0;
147
148 /// @brief Myocardium zone id, default to epicardium.
149 int imyo = 1;
150
151 /// @brief Time step for integration
152 double dt = 0.0;
153
154 /// @brief Constant for stretch-activated-currents
155 double Ksac = 0.0;
156
157 /// @brief Isotropic conductivity
158 double Diso = 0.0;
159
160 /// @brief Anisotropic conductivity
162
163 /// @brief External stimulus
165
166 /// @brief Time integration options
168};
169
170/// @brief Cardiac electromechanics model type
172{
173 public:
174 /// @brief Whether electrophysiology and mechanics are coupled
175 bool cpld = false;
176 //bool cpld = .FALSE.
177
178 /// @brief Whether active stress formulation is employed
179 bool aStress = false;
180 //bool aStress = .FALSE.
181
182 /// @brief Whether active strain formulation is employed
183 bool aStrain = false;
184 //bool aStrain = .FALSE.
185
186 /// @brief Local variable integrated in time
187 /// := activation force for active stress model
188 /// := fiber stretch for active strain model
190};
191
192class CepMod
193{
194 public:
195
196 /// @brief Whether cardiac electrophysiology is solved
197 bool cepEq;
198
199 /// @brief Max. dof in cellular activation model
200 int nXion = 0;
201
202 /// @brief Unknowns stored at all nodes
203 Array<double> Xion;
204
205 /// @brief Cardiac electromechanics type
207
208 /// @brief Interface for Aliev-Panfilov cellular activation model.
210
211 /// @brief Interface for ABueno-Orovio cellular activation model.
213
214 /// @brief Interface for Fitzhugh-Nagumo cellular activation model.
216
217 /// @brief Interface for Tusscher-Panfilov cellular activation model.
219
220 /// @brief ECG leads
222};
223
224#endif
225
This module defines data structures for Aliev-Panfilov cellular activation model for cardiac electrop...
Definition CepModAp.h:16
This module defines data structures for Bueno-Orovio cellular activation model for cardiac electrophy...
Definition CepModBo.h:19
This module defines data structures for Fitzhugh-Nagumo cellular activation model for cardiac electro...
Definition CepModFn.h:16
Definition CepMod.h:193
int nXion
Max. dof in cellular activation model.
Definition CepMod.h:200
CepModBo bo
Interface for ABueno-Orovio cellular activation model.
Definition CepMod.h:212
bool cepEq
Whether cardiac electrophysiology is solved.
Definition CepMod.h:197
CepModAp ap
Interface for Aliev-Panfilov cellular activation model.
Definition CepMod.h:209
CepModFn fn
Interface for Fitzhugh-Nagumo cellular activation model.
Definition CepMod.h:215
cemModelType cem
Cardiac electromechanics type.
Definition CepMod.h:206
CepModTtp ttp
Interface for Tusscher-Panfilov cellular activation model.
Definition CepMod.h:218
Array< double > Xion
Unknowns stored at all nodes.
Definition CepMod.h:203
ecgLeadsType ecgleads
ECG leads.
Definition CepMod.h:221
This module defines data structures for ten Tusscher-Panfilov epicardial cellular activation model fo...
Definition CepModTtp.h:23
The Vector template class is used for storing int and double data.
Definition Vector.h:23
Cardiac electromechanics model type.
Definition CepMod.h:172
bool aStress
Whether active stress formulation is employed.
Definition CepMod.h:179
bool cpld
Whether electrophysiology and mechanics are coupled.
Definition CepMod.h:175
bool aStrain
Whether active strain formulation is employed.
Definition CepMod.h:183
Vector< double > Ya
Local variable integrated in time := activation force for active stress model := fiber stretch for ac...
Definition CepMod.h:189
Cardiac electrophysiology model type.
Definition CepMod.h:131
double Diso
Isotropic conductivity.
Definition CepMod.h:158
int nFn
Number of fiber directions.
Definition CepMod.h:146
double Ksac
Constant for stretch-activated-currents.
Definition CepMod.h:155
odeType odes
Time integration options.
Definition CepMod.h:167
ElectrophysiologyModelType cepType
Type of cardiac electrophysiology model.
Definition CepMod.h:137
int nX
Number of state variables.
Definition CepMod.h:140
Vector< double > Dani
Anisotropic conductivity.
Definition CepMod.h:161
int nG
Number of gating variables.
Definition CepMod.h:143
double dt
Time step for integration.
Definition CepMod.h:152
stimType Istim
External stimulus.
Definition CepMod.h:164
int imyo
Myocardium zone id, default to epicardium.
Definition CepMod.h:149
ECG leads type.
Definition CepMod.h:108
Vector< double > pseudo_ECG
Pseudo ECG over each lead.
Definition CepMod.h:123
Vector< double > x_coords
x coordinates
Definition CepMod.h:114
int num_leads
Number of leads.
Definition CepMod.h:111
Vector< double > y_coords
y coordinates
Definition CepMod.h:117
Vector< double > z_coords
z coordinates
Definition CepMod.h:120
std::vector< std::string > out_files
Output files.
Definition CepMod.h:126
Time integration scheme and related parameters.
Definition CepMod.h:71
double absTol
Absolute tolerance.
Definition CepMod.h:83
double relTol
Relative tolerance.
Definition CepMod.h:86
TimeIntegratioType tIntType
Time integration method type.
Definition CepMod.h:76
int maxItr
Max. iterations for Newton-Raphson method.
Definition CepMod.h:80
External stimulus type.
Definition CepMod.h:91
double Ts
start time
Definition CepMod.h:94
double A
stimulus amplitude
Definition CepMod.h:103
double CL
cycle length
Definition CepMod.h:100
double Td
duration of stimulus
Definition CepMod.h:97