Nektar++
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Types | Private Attributes | Static Private Attributes | List of all members
Nektar::FentonKarma Class Reference

#include <FentonKarma.h>

Inheritance diagram for Nektar::FentonKarma:
Inheritance graph
[legend]
Collaboration diagram for Nektar::FentonKarma:
Collaboration graph
[legend]

Public Member Functions

 FentonKarma (const LibUtilities::SessionReaderSharedPtr &pSession, const MultiRegions::ExpListSharedPtr &pField)
 Constructor. More...
 
virtual ~FentonKarma ()
 Destructor. More...
 
- Public Member Functions inherited from Nektar::CellModel
 CellModel (const LibUtilities::SessionReaderSharedPtr &pSession, const MultiRegions::ExpListSharedPtr &pField)
 
virtual ~CellModel ()
 
void Initialise ()
 Initialise the cell model storage and set initial conditions. More...
 
void TimeIntegrate (const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
 Time integrate the cell model by one PDE timestep. More...
 
void Update (const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
 Compute the derivatives of cell model variables. More...
 
void GenerateSummary (SummaryList &s)
 Print a summary of the cell model. More...
 
unsigned int GetNumCellVariables ()
 
std::string GetCellVarName (unsigned int idx)
 
Array< OneD, NekDoubleGetCellSolutionCoeffs (unsigned int idx)
 
Array< OneD, NekDoubleGetCellSolution (unsigned int idx)
 

Static Public Member Functions

static CellModelSharedPtr create (const LibUtilities::SessionReaderSharedPtr &pSession, const MultiRegions::ExpListSharedPtr &pField)
 Creates an instance of this class. More...
 

Static Public Attributes

static std::string className
 Name of class. More...
 

Protected Member Functions

virtual void v_Update (const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
 Computes the reaction terms $f(u,v)$ and $g(u,v)$. More...
 
virtual void v_GenerateSummary (SummaryList &s)
 Prints a summary of the model parameters. More...
 
virtual void v_SetInitialConditions ()
 
virtual std::string v_GetCellVarName (unsigned int idx)
 
- Protected Member Functions inherited from Nektar::CellModel
void LoadCellModel ()
 

Private Types

enum  Variants {
  eBR, eMBR, eMLR1, eGP,
  eCF1, eCF2a, eCF2b, eCF2c,
  eCF3a, eCF3b
}
 

Private Attributes

NekDouble C_m
 
NekDouble V_0
 
NekDouble u_fi
 
NekDouble u_c
 
NekDouble u_v
 
NekDouble u_r
 
NekDouble g_fi_max
 
NekDouble tau_d
 
NekDouble tau_v1_minus
 
NekDouble tau_v2_minus
 
NekDouble tau_v_plus
 
NekDouble tau_0
 
NekDouble tau_r
 
NekDouble tau_si
 
NekDouble tau_y_plus
 
NekDouble tau_y_minus
 
NekDouble u_csi
 
NekDouble k1
 
NekDouble k2
 
NekDouble tau_w_minus
 
NekDouble tau_w_plus
 
bool isCF3
 
enum Variants model_variant
 

Static Private Attributes

static std::string lookupIds []
 
static std::string def
 

Additional Inherited Members

- Protected Attributes inherited from Nektar::CellModel
LibUtilities::SessionReaderSharedPtr m_session
 Session. More...
 
MultiRegions::ExpListSharedPtr m_field
 Transmembrane potential field from PDE system. More...
 
int m_nq
 Number of physical points. More...
 
int m_nvar
 Number of variables in cell model (inc. transmembrane voltage) More...
 
NekDouble m_lastTime
 Timestep for pde model. More...
 
int m_substeps
 Number of substeps to take. More...
 
Array< OneD, Array< OneD, NekDouble > > m_cellSol
 Cell model solution variables. More...
 
Array< OneD, Array< OneD, NekDouble > > m_wsp
 Cell model integration workspace. More...
 
bool m_useNodal
 Flag indicating whether nodal projection in use. More...
 
StdRegions::StdNodalTriExpSharedPtr m_nodalTri
 StdNodalTri for cell model calculations. More...
 
StdRegions::StdNodalTetExpSharedPtr m_nodalTet
 
Array< OneD, Array< OneD, NekDouble > > m_nodalTmp
 Temporary array for nodal projection. More...
 
std::vector< int > m_concentrations
 Indices of cell model variables which are concentrations. More...
 
std::vector< int > m_gates
 Indices of cell model variables which are gates. More...
 
Array< OneD, Array< OneD, NekDouble > > m_gates_tau
 Storage for gate tau values. More...
 

Detailed Description

Definition at line 43 of file FentonKarma.h.

Member Enumeration Documentation

Enumerator
eBR 
eMBR 
eMLR1 
eGP 
eCF1 
eCF2a 
eCF2b 
eCF2c 
eCF3a 
eCF3b 

Definition at line 105 of file FentonKarma.h.

Constructor & Destructor Documentation

Nektar::FentonKarma::FentonKarma ( const LibUtilities::SessionReaderSharedPtr pSession,
const MultiRegions::ExpListSharedPtr pField 
)

Constructor.

Initialise Fenton-Karma model parameters. k1 is k in the original model. k2 is an additional parameter introduced in Cherry&Fenton 2004. u_r and u_fi are introduced by Cherry&Fenton 2004 and is the same as u_c in the original model.

Definition at line 88 of file FentonKarma.cpp.

References ASSERTL0, C_m, eBR, eCF1, eCF2a, eCF2b, eCF2c, eCF3a, eCF3b, eGP, eMBR, eMLR1, g_fi_max, isCF3, k1, k2, Nektar::CellModel::m_gates, Nektar::CellModel::m_nvar, model_variant, tau_0, tau_d, tau_r, tau_si, tau_v1_minus, tau_v2_minus, tau_v_plus, tau_w_minus, tau_w_plus, tau_y_minus, tau_y_plus, u_c, u_csi, u_fi, u_r, u_v, and V_0.

91  : CellModel(pSession, pField)
92  {
93  model_variant = pSession->GetSolverInfoAsEnum<FentonKarma::Variants>(
94  "CellModelVariant");
95 
96  C_m = 1; // picoF
97  V_0 = -85;
98 
99  switch (model_variant) {
100  case eBR:
101  g_fi_max = 4;
102  tau_r = 33.33;
103  tau_si = 29;
104  tau_0 = 12.5;
105  tau_v_plus = 3.33;
106  tau_v1_minus = 1250;
107  tau_v2_minus = 19.6;
108  tau_w_plus = 870;
109  tau_w_minus = 41;
110  u_c = 0.13;
111  u_v = 0.04;
112  u_r = 0.13;
113  u_fi = 0.13;
114  u_csi = 0.85;
115  k1 = 10;
116  k2 = 0.0;
117  break;
118  case eMBR:
119  g_fi_max = 4;
120  tau_r = 50;
121  tau_si = 44.84;
122  tau_0 = 8.3;
123  tau_v_plus = 3.33;
124  tau_v1_minus = 1000;
125  tau_v2_minus = 19.2;
126  tau_w_plus = 667;
127  tau_w_minus = 11;
128  u_c = 0.13;
129  u_v = 0.04;
130  u_r = 0.13;
131  u_fi = 0.13;
132  u_csi = 0.85;
133  k1 = 10;
134  k2 = 0.0;
135  break;
136  case eMLR1:
137  g_fi_max = 5.8;
138  tau_r = 130;
139  tau_si = 127;
140  tau_0 = 12.5;
141  tau_v_plus = 10;
142  tau_v1_minus = 18.2;
143  tau_v2_minus = 18.2;
144  tau_w_plus = 1020;
145  tau_w_minus = 80;
146  u_c = 0.13;
147  u_v = 0.0;
148  u_r = 0.13;
149  u_fi = 0.13;
150  u_csi = 0.85;
151  k1 = 10;
152  k2 = 0.0;
153  break;
154  case eGP:
155  g_fi_max = 8.7;
156  tau_r = 25;
157  tau_si = 22.22;
158  tau_0 = 12.5;
159  tau_v_plus = 10;
160  tau_v1_minus = 333;
161  tau_v2_minus = 40;
162  tau_w_plus = 1000;
163  tau_w_minus = 65;
164  u_c = 0.13;
165  u_v = 0.025;
166  u_r = 0.13;
167  u_fi = 0.13;
168  u_csi = 0.85;
169  k1 = 10;
170  k2 = 0.0;
171  break;
172  case eCF1:
173  g_fi_max = 6.6666;
174  tau_r = 12.5;
175  tau_si = 10;
176  tau_0 = 1.5;
177  tau_v_plus = 10;
178  tau_v1_minus = 350;
179  tau_v2_minus = 80;
180  tau_w_plus = 562;
181  tau_w_minus = 48.5;
182  u_c = 0.25;
183  u_v = 0.001;
184  u_r = 0.25;
185  u_fi = 0.15;
186  u_csi = 0.2;
187  k1 = 15;
188  k2 = 0;
189  break;
190  case eCF2a:
191  g_fi_max = 6.6666;
192  tau_r = 31;
193  tau_si = 26.5;
194  tau_0 = 1.5;
195  tau_v_plus = 10;
196  tau_v1_minus = 20;
197  tau_v2_minus = 20;
198  tau_w_plus = 800;
199  tau_w_minus = 45;
200  u_c = 0.25;
201  u_v = 0.05;
202  u_r = 0.6;
203  u_fi = 0.11;
204  u_csi = 0.7;
205  k1 = 10;
206  k2 = 1;
207  break;
208  case eCF2b:
209  g_fi_max = 6.6666;
210  tau_r = 31;
211  tau_si = 26.5;
212  tau_0 = 1.5;
213  tau_v_plus = 10;
214  tau_v1_minus = 100;
215  tau_v2_minus = 20;
216  tau_w_plus = 800;
217  tau_w_minus = 45;
218  u_c = 0.25;
219  u_v = 0.05;
220  u_r = 0.6;
221  u_fi = 0.11;
222  u_csi = 0.7;
223  k1 = 10;
224  k2 = 1;
225  break;
226  case eCF2c:
227  g_fi_max = 6.6666;
228  tau_r = 31;
229  tau_si = 26.5;
230  tau_0 = 1.5;
231  tau_v_plus = 10;
232  tau_v1_minus = 150;
233  tau_v2_minus = 20;
234  tau_w_plus = 800;
235  tau_w_minus = 45;
236  u_c = 0.25;
237  u_v = 0.05;
238  u_r = 0.6;
239  u_fi = 0.11;
240  u_csi = 0.7;
241  k1 = 10;
242  k2 = 1;
243  break;
244  case eCF3a:
245  g_fi_max = 13.3333;
246  tau_r = 38;
247  tau_si = 127;
248  tau_0 = 8.3;
249  tau_v_plus = 3.33;
250  tau_v1_minus = 45;
251  tau_v2_minus = 300;
252  tau_w_plus = 600;
253  tau_w_minus = 40;
254  tau_y_plus = 1000;
255  tau_y_minus = 230;
256  u_c = 0.25;
257  u_v = 0.5;
258  u_r = 0.25;
259  u_fi = 0.25;
260  u_csi = 0.7;
261  k1 = 60;
262  k2 = 0;
263  break;
264  case eCF3b:
265  g_fi_max = 13.3333;
266  tau_r = 38;
267  tau_si = 127;
268  tau_0 = 8.3;
269  tau_v_plus = 3.33;
270  tau_v1_minus = 20;
271  tau_v2_minus = 300;
272  tau_w_plus = 600;
273  tau_w_minus = 40;
274  tau_y_plus = 1000;
275  tau_y_minus = 230;
276  u_c = 0.25;
277  u_v = 0.5;
278  u_r = 0.25;
279  u_fi = 0.25;
280  u_csi = 0.7;
281  k1 = 60;
282  k2 = 0;
283  break;
284  }
285 
286  tau_d = C_m/g_fi_max;
287 
289 
290  // List gates and concentrations
291  m_gates.push_back(1);
292  m_gates.push_back(2);
293  m_nvar = 3;
294 
295  // Cherry-Fenton 2004 Model 3 has extra gating variable
296  if (isCF3)
297  {
298  m_gates.push_back(3);
299  m_nvar = 4;
300  }
301 
302  ASSERTL0(!isCF3, "Cherry-Fenton model 3 not implemented yet.");
303  }
NekDouble tau_y_minus
Definition: FentonKarma.h:96
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
NekDouble tau_y_plus
Definition: FentonKarma.h:95
NekDouble tau_v1_minus
Definition: FentonKarma.h:89
CellModel(const LibUtilities::SessionReaderSharedPtr &pSession, const MultiRegions::ExpListSharedPtr &pField)
Definition: CellModel.cpp:67
int m_nvar
Number of variables in cell model (inc. transmembrane voltage)
Definition: CellModel.h:119
std::vector< int > m_gates
Indices of cell model variables which are gates.
Definition: CellModel.h:141
NekDouble tau_w_plus
Definition: FentonKarma.h:101
NekDouble tau_v2_minus
Definition: FentonKarma.h:90
enum Variants model_variant
Definition: FentonKarma.h:117
NekDouble g_fi_max
Definition: FentonKarma.h:87
NekDouble tau_w_minus
Definition: FentonKarma.h:100
NekDouble tau_v_plus
Definition: FentonKarma.h:91
Nektar::FentonKarma::~FentonKarma ( )
virtual

Destructor.

Definition at line 310 of file FentonKarma.cpp.

311  {
312 
313  }

Member Function Documentation

static CellModelSharedPtr Nektar::FentonKarma::create ( const LibUtilities::SessionReaderSharedPtr pSession,
const MultiRegions::ExpListSharedPtr pField 
)
inlinestatic

Creates an instance of this class.

Definition at line 47 of file FentonKarma.h.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr().

50  {
52  ::AllocateSharedPtr(pSession, pField);
53  }
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
void Nektar::FentonKarma::v_GenerateSummary ( SummaryList s)
protectedvirtual

Prints a summary of the model parameters.

Implements Nektar::CellModel.

Definition at line 392 of file FentonKarma.cpp.

References Nektar::SolverUtils::AddSummaryItem(), lookupIds, and model_variant.

393  {
394  SolverUtils::AddSummaryItem(s, "Cell model", "Fenton Karma");
395  SolverUtils::AddSummaryItem(s, "Cell model var.", lookupIds[model_variant]);
396  }
static std::string lookupIds[]
Definition: FentonKarma.h:119
void AddSummaryItem(SummaryList &l, const std::string &name, const std::string &value)
Adds a summary item to the summary info list.
Definition: Misc.cpp:50
enum Variants model_variant
Definition: FentonKarma.h:117
std::string Nektar::FentonKarma::v_GetCellVarName ( unsigned int  idx)
protectedvirtual

Reimplemented from Nektar::CellModel.

Definition at line 411 of file FentonKarma.cpp.

412  {
413  switch (idx)
414  {
415  case 0: return "u";
416  case 1: return "v";
417  case 2: return "w";
418  case 3: return "y";
419  default: return "unknown";
420  }
421  }
void Nektar::FentonKarma::v_SetInitialConditions ( )
protectedvirtual

Implements Nektar::CellModel.

Definition at line 399 of file FentonKarma.cpp.

References Vmath::Fill(), isCF3, Nektar::CellModel::m_cellSol, and Nektar::CellModel::m_nq.

400  {
401  Vmath::Fill(m_nq, 0.0, m_cellSol[0], 1);
402  Vmath::Fill(m_nq, 1.0, m_cellSol[1], 1);
403  Vmath::Fill(m_nq, 1.0, m_cellSol[2], 1);
404  if (isCF3)
405  {
406  Vmath::Fill(m_nq, 0.1, m_cellSol[2], 1);
407  }
408 
409  }
int m_nq
Number of physical points.
Definition: CellModel.h:117
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
Definition: Vmath.cpp:46
Array< OneD, Array< OneD, NekDouble > > m_cellSol
Cell model solution variables.
Definition: CellModel.h:126
void Nektar::FentonKarma::v_Update ( const Array< OneD, const Array< OneD, NekDouble > > &  inarray,
Array< OneD, Array< OneD, NekDouble > > &  outarray,
const NekDouble  time 
)
protectedvirtual

Computes the reaction terms $f(u,v)$ and $g(u,v)$.

Implements Nektar::CellModel.

Definition at line 317 of file FentonKarma.cpp.

References ASSERTL0, isCF3, k1, k2, Nektar::CellModel::m_gates_tau, Nektar::CellModel::m_nq, tau_0, tau_d, tau_r, tau_si, tau_v1_minus, tau_v2_minus, tau_v_plus, tau_w_minus, tau_w_plus, u_c, u_csi, u_fi, u_r, and u_v.

321  {
322  ASSERTL0(inarray.get() != outarray.get(),
323  "Must have different arrays for input and output.");
324 
325  // Variables
326  // 0 u membrane potential
327  // 1 v v gate
328  // 2 w w gate
329  int n = m_nq;
330  int i = 0;
331 
332  // Declare pointers
333  const NekDouble *u = &inarray[0][0];
334  const NekDouble *v = &inarray[1][0];
335  const NekDouble *w = &inarray[2][0];
336  const NekDouble *y = isCF3 ? &inarray[3][0] : 0;
337  NekDouble *u_new = &outarray[0][0];
338  NekDouble *v_new = &outarray[1][0];
339  NekDouble *w_new = &outarray[2][0];
340  //NekDouble *y_new = isCF3 ? &outarray[3][0] : 0;
341  NekDouble *v_tau = &m_gates_tau[0][0];
342  NekDouble *w_tau = &m_gates_tau[1][0];
343  //NekDouble *y_tau = isCF3 ? &m_gates_tau[2][0] : 0;
344 
345  // Temporary variables
346  NekDouble J_fi, J_so, J_si, h1, h2, h3, alpha, beta;
347 
348  // Compute rates for each point in domain
349  for (i = 0; i < n; ++i)
350  {
351  // Heavyside functions
352  h1 = (*u < u_c) ? 0.0 : 1.0;
353  h2 = (*u < u_v) ? 0.0 : 1.0;
354  h3 = (*u < u_r) ? 0.0 : 1.0;
355 
356  // w-gate
357  alpha = (1-h1)/tau_w_minus;
358  beta = h1/tau_w_plus;
359  *w_tau = 1.0 / (alpha + beta);
360  *w_new = alpha * (*w_tau);
361 
362  // v-gate
363  alpha = (1-h1)/(h2*tau_v1_minus + (1-h2)*tau_v2_minus);
364  beta = h1/tau_v_plus;
365  *v_tau = 1.0 / (alpha + beta);
366  *v_new = alpha * (*v_tau);
367 
368  // y-gate
369  if (isCF3)
370  {
371  // TODO: implementation for y_tau and y_new
372  }
373 
374  // J_fi
375  J_fi = -(*v)*h1*(1 - *u)*(*u - u_fi)/tau_d;
376 
377  // J_so
378  // added extra (1-k2*v) term from Cherry&Fenton 2004
379  J_so = (*u)*(1-h3)*(1-k2*(*v))/tau_0 +
380  (isCF3 ? h3*(*u)*(*y)/tau_r : h3/tau_r);
381 
382  // J_si
383  J_si = -(*w)*(1 + tanh(k1*(*u - u_csi)))/(2.0*tau_si);
384 
385  // u
386  *u_new = -J_fi - J_so - J_si;
387 
388  ++u, ++v, ++w, ++u_new, ++v_new, ++w_new, ++v_tau, ++w_tau;
389  }
390  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
int m_nq
Number of physical points.
Definition: CellModel.h:117
NekDouble tau_v1_minus
Definition: FentonKarma.h:89
Array< OneD, Array< OneD, NekDouble > > m_gates_tau
Storage for gate tau values.
Definition: CellModel.h:143
double NekDouble
NekDouble tau_w_plus
Definition: FentonKarma.h:101
NekDouble tau_v2_minus
Definition: FentonKarma.h:90
NekDouble tau_w_minus
Definition: FentonKarma.h:100
NekDouble tau_v_plus
Definition: FentonKarma.h:91

Member Data Documentation

NekDouble Nektar::FentonKarma::C_m
private

Definition at line 81 of file FentonKarma.h.

Referenced by FentonKarma().

std::string Nektar::FentonKarma::className
static
Initial value:
=
"FentonKarma",
"Phenomenological Model.")

Name of class.

Definition at line 56 of file FentonKarma.h.

std::string Nektar::FentonKarma::def
staticprivate
Initial value:

Definition at line 120 of file FentonKarma.h.

NekDouble Nektar::FentonKarma::g_fi_max
private

Definition at line 87 of file FentonKarma.h.

Referenced by FentonKarma().

bool Nektar::FentonKarma::isCF3
private

Definition at line 103 of file FentonKarma.h.

Referenced by FentonKarma(), v_SetInitialConditions(), and v_Update().

NekDouble Nektar::FentonKarma::k1
private

Definition at line 98 of file FentonKarma.h.

Referenced by FentonKarma(), and v_Update().

NekDouble Nektar::FentonKarma::k2
private

Definition at line 99 of file FentonKarma.h.

Referenced by FentonKarma(), and v_Update().

std::string Nektar::FentonKarma::lookupIds
staticprivate
enum Variants Nektar::FentonKarma::model_variant
private

Definition at line 117 of file FentonKarma.h.

Referenced by FentonKarma(), and v_GenerateSummary().

NekDouble Nektar::FentonKarma::tau_0
private

Definition at line 92 of file FentonKarma.h.

Referenced by FentonKarma(), and v_Update().

NekDouble Nektar::FentonKarma::tau_d
private

Definition at line 88 of file FentonKarma.h.

Referenced by FentonKarma(), and v_Update().

NekDouble Nektar::FentonKarma::tau_r
private

Definition at line 93 of file FentonKarma.h.

Referenced by FentonKarma(), and v_Update().

NekDouble Nektar::FentonKarma::tau_si
private

Definition at line 94 of file FentonKarma.h.

Referenced by FentonKarma(), and v_Update().

NekDouble Nektar::FentonKarma::tau_v1_minus
private

Definition at line 89 of file FentonKarma.h.

Referenced by FentonKarma(), and v_Update().

NekDouble Nektar::FentonKarma::tau_v2_minus
private

Definition at line 90 of file FentonKarma.h.

Referenced by FentonKarma(), and v_Update().

NekDouble Nektar::FentonKarma::tau_v_plus
private

Definition at line 91 of file FentonKarma.h.

Referenced by FentonKarma(), and v_Update().

NekDouble Nektar::FentonKarma::tau_w_minus
private

Definition at line 100 of file FentonKarma.h.

Referenced by FentonKarma(), and v_Update().

NekDouble Nektar::FentonKarma::tau_w_plus
private

Definition at line 101 of file FentonKarma.h.

Referenced by FentonKarma(), and v_Update().

NekDouble Nektar::FentonKarma::tau_y_minus
private

Definition at line 96 of file FentonKarma.h.

Referenced by FentonKarma().

NekDouble Nektar::FentonKarma::tau_y_plus
private

Definition at line 95 of file FentonKarma.h.

Referenced by FentonKarma().

NekDouble Nektar::FentonKarma::u_c
private

Definition at line 84 of file FentonKarma.h.

Referenced by FentonKarma(), and v_Update().

NekDouble Nektar::FentonKarma::u_csi
private

Definition at line 97 of file FentonKarma.h.

Referenced by FentonKarma(), and v_Update().

NekDouble Nektar::FentonKarma::u_fi
private

Definition at line 83 of file FentonKarma.h.

Referenced by FentonKarma(), and v_Update().

NekDouble Nektar::FentonKarma::u_r
private

Definition at line 86 of file FentonKarma.h.

Referenced by FentonKarma(), and v_Update().

NekDouble Nektar::FentonKarma::u_v
private

Definition at line 85 of file FentonKarma.h.

Referenced by FentonKarma(), and v_Update().

NekDouble Nektar::FentonKarma::V_0
private

Definition at line 82 of file FentonKarma.h.

Referenced by FentonKarma().