Nektar++
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Nektar::CellModel Class Referenceabstract

Cell model base class. More...

#include <CellModel.h>

Inheritance diagram for Nektar::CellModel:
[legend]

Public Member Functions

 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)
 

Protected Member Functions

virtual void v_Update (const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)=0
 
virtual void v_GenerateSummary (SummaryList &s)=0
 
virtual std::string v_GetCellVarName (unsigned int idx)
 
virtual void v_SetInitialConditions ()=0
 
void LoadCellModel ()
 

Protected Attributes

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

Cell model base class.

The CellModel class and derived classes implement a range of cell model ODE systems. A cell model comprises a system of ion concentration variables and zero or more gating variables. Gating variables are time-integrated using the Rush-Larsen method and for each variable y, the corresponding y_inf and tau_y value is computed by Update(). The tau values are stored in separate storage to inarray/outarray, m_gates_tau.

Definition at line 64 of file CellModel.h.

Constructor & Destructor Documentation

◆ CellModel()

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

Cell model base class constructor.

Definition at line 66 of file CellModel.cpp.

68  {
69  m_session = pSession;
70  m_field = pField;
71  m_lastTime = 0.0;
72  m_substeps = pSession->GetParameter("Substeps");
73  m_nvar = 0;
74  m_useNodal = false;
75 
76  // Number of points in nodal space is the number of coefficients
77  // in modified basis
78  std::set<enum LibUtilities::ShapeType> s;
79  for (unsigned int i = 0; i < m_field->GetNumElmts(); ++i)
80  {
81  s.insert(m_field->GetExp(i)->DetShapeType());
82  }
83 
84  // Use nodal projection if only triangles
85  if (s.size() == 1 && (s.count(LibUtilities::eTriangle) == 1 ||
86  s.count(LibUtilities::eTetrahedron) == 1))
87  {
88  // This is disabled for now as it causes problems at high order.
89  // m_useNodal = true;
90  }
91 
92  // ---------------------------
93  // Move to nodal points
94  if (m_useNodal)
95  {
96  m_nq = pField->GetNcoeffs();
97  int order = m_field->GetExp(0)->GetBasis(0)->GetNumModes();
98 
99  // Set up a nodal tri
100  LibUtilities::BasisKey B0(
102  LibUtilities::PointsKey(order, LibUtilities::eGaussLobattoLegendre));
103  LibUtilities::BasisKey B1(
105  LibUtilities::PointsKey(order, LibUtilities::eGaussRadauMAlpha1Beta0));
106  LibUtilities::BasisKey B2(
108  LibUtilities::PointsKey(order, LibUtilities::eGaussRadauMAlpha2Beta0));
109 
114  }
115  else
116  {
117  m_nq = pField->GetTotPoints();
118  }
119  }
int m_nq
Number of physical points.
Definition: CellModel.h:116
int m_substeps
Number of substeps to take.
Definition: CellModel.h:122
bool m_useNodal
Flag indicating whether nodal projection in use.
Definition: CellModel.h:130
NekDouble m_lastTime
Timestep for pde model.
Definition: CellModel.h:120
StdRegions::StdNodalTetExpSharedPtr m_nodalTet
Definition: CellModel.h:133
MultiRegions::ExpListSharedPtr m_field
Transmembrane potential field from PDE system.
Definition: CellModel.h:114
StdRegions::StdNodalTriExpSharedPtr m_nodalTri
StdNodalTri for cell model calculations.
Definition: CellModel.h:132
LibUtilities::SessionReaderSharedPtr m_session
Session.
Definition: CellModel.h:112
int m_nvar
Number of variables in cell model (inc. transmembrane voltage)
Definition: CellModel.h:118
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
@ eNodalTriEvenlySpaced
2D Evenly-spaced points on a Triangle
Definition: PointsType.h:71
@ eGaussRadauMAlpha2Beta0
Gauss Radau pinned at x=-1, .
Definition: PointsType.h:59
@ eGaussLobattoLegendre
1D Gauss-Lobatto-Legendre quadrature points
Definition: PointsType.h:51
@ eNodalTetEvenlySpaced
3D Evenly-spaced points on a Tetrahedron
Definition: PointsType.h:72
@ eGaussRadauMAlpha1Beta0
Gauss Radau pinned at x=-1, .
Definition: PointsType.h:58
@ eModified_B
Principle Modified Functions .
Definition: BasisType.h:49
@ eModified_C
Principle Modified Functions .
Definition: BasisType.h:50
@ eModified_A
Principle Modified Functions .
Definition: BasisType.h:48

References Nektar::LibUtilities::eGaussLobattoLegendre, Nektar::LibUtilities::eGaussRadauMAlpha1Beta0, Nektar::LibUtilities::eGaussRadauMAlpha2Beta0, Nektar::LibUtilities::eModified_A, Nektar::LibUtilities::eModified_B, Nektar::LibUtilities::eModified_C, Nektar::LibUtilities::eNodalTetEvenlySpaced, Nektar::LibUtilities::eNodalTriEvenlySpaced, Nektar::LibUtilities::eTetrahedron, and Nektar::LibUtilities::eTriangle.

◆ ~CellModel()

virtual Nektar::CellModel::~CellModel ( )
inlinevirtual

Definition at line 70 of file CellModel.h.

70 {}

Member Function Documentation

◆ GenerateSummary()

void Nektar::CellModel::GenerateSummary ( SummaryList s)
inline

Print a summary of the cell model.

Definition at line 91 of file CellModel.h.

92  {
94  }
virtual void v_GenerateSummary(SummaryList &s)=0

References v_GenerateSummary().

◆ GetCellSolution()

Array< OneD, NekDouble > Nektar::CellModel::GetCellSolution ( unsigned int  idx)

Definition at line 319 of file CellModel.cpp.

320  {
321  return m_cellSol[idx];
322  }
Array< OneD, Array< OneD, NekDouble > > m_cellSol
Cell model solution variables.
Definition: CellModel.h:125

◆ GetCellSolutionCoeffs()

Array< OneD, NekDouble > Nektar::CellModel::GetCellSolutionCoeffs ( unsigned int  idx)

Definition at line 289 of file CellModel.cpp.

290  {
291  ASSERTL0(idx < m_nvar, "Index out of range for cell model.");
292 
293  Array<OneD, NekDouble> outarray(m_field->GetNcoeffs());
294  Array<OneD, NekDouble> tmp;
295 
296  if (m_useNodal)
297  {
298  for (unsigned int i = 0; i < m_field->GetNumElmts(); ++i)
299  {
300  int coef_offset = m_field->GetCoeff_Offset(i);
301  if (m_field->GetExp(0)->DetShapeType() == LibUtilities::eTriangle)
302  {
303  m_nodalTri->NodalToModal(m_cellSol[idx]+coef_offset, tmp=outarray+coef_offset);
304  }
305  else
306  {
307  m_nodalTet->NodalToModal(m_cellSol[idx]+coef_offset, tmp=outarray+coef_offset);
308  }
309  }
310  }
311  else
312  {
313  m_field->FwdTrans_IterPerExp(m_cellSol[idx], outarray);
314  }
315 
316  return outarray;
317  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216

References ASSERTL0, and Nektar::LibUtilities::eTriangle.

◆ GetCellVarName()

std::string Nektar::CellModel::GetCellVarName ( unsigned int  idx)
inline

Definition at line 101 of file CellModel.h.

102  {
103  return v_GetCellVarName(idx);
104  }
virtual std::string v_GetCellVarName(unsigned int idx)
Definition: CellModel.h:151

References v_GetCellVarName().

◆ GetNumCellVariables()

unsigned int Nektar::CellModel::GetNumCellVariables ( )
inline

Definition at line 96 of file CellModel.h.

97  {
98  return m_nvar;
99  }

References m_nvar.

◆ Initialise()

void Nektar::CellModel::Initialise ( )

Initialise the cell model storage and set initial conditions.

Initialise the cell model. Allocate workspace and variable storage.

Definition at line 125 of file CellModel.cpp.

126  {
127  ASSERTL1(m_nvar > 0, "Cell model must have at least 1 variable.");
128 
129  m_cellSol = Array<OneD, Array<OneD, NekDouble> >(m_nvar);
130  m_wsp = Array<OneD, Array<OneD, NekDouble> >(m_nvar);
131  for (unsigned int i = 0; i < m_nvar; ++i)
132  {
133  m_cellSol[i] = Array<OneD, NekDouble>(m_nq);
134  m_wsp[i] = Array<OneD, NekDouble>(m_nq);
135  }
136  m_gates_tau = Array<OneD, Array<OneD, NekDouble> >(m_gates.size());
137  for (unsigned int i = 0; i < m_gates.size(); ++i)
138  {
139  m_gates_tau[i] = Array<OneD, NekDouble>(m_nq);
140  }
141 
142  if (m_session->DefinesFunction("CellModelInitialConditions"))
143  {
144  LoadCellModel();
145  }
146  else
147  {
149  }
150  }
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
Definition: ErrorUtil.hpp:250
Array< OneD, Array< OneD, NekDouble > > m_wsp
Cell model integration workspace.
Definition: CellModel.h:127
std::vector< int > m_gates
Indices of cell model variables which are gates.
Definition: CellModel.h:140
virtual void v_SetInitialConditions()=0
Array< OneD, Array< OneD, NekDouble > > m_gates_tau
Storage for gate tau values.
Definition: CellModel.h:142

References ASSERTL1.

◆ LoadCellModel()

void Nektar::CellModel::LoadCellModel ( )
protected

Definition at line 324 of file CellModel.cpp.

325  {
326  const bool root = (m_session->GetComm()->GetRank() == 0);
327  const std::string fncName = "CellModelInitialConditions";
328  const int nvar = m_cellSol[0].size();
329  std::string varName;
330  Array<OneD, NekDouble> coeffs(m_field->GetNcoeffs());
331  Array<OneD, NekDouble> tmp;
332  int j = 0;
333 
334  SpatialDomains::MeshGraphSharedPtr vGraph = m_field->GetGraph();
335 
336  if (root)
337  {
338  cout << "Cell model initial conditions: " << endl;
339  }
340 
341  // First determine all the files we need to load
342  std::set<std::string> filelist;
343  for (j = 1; j < nvar; ++j)
344  {
345  // Get the name of the jth variable
346  varName = GetCellVarName(j);
347 
348  if (m_session->GetFunctionType(fncName, varName) ==
350  {
351  filelist.insert(m_session->GetFunctionFilename(fncName,
352  varName));
353  }
354  }
355 
356  // Read files
357  typedef std::vector<LibUtilities::FieldDefinitionsSharedPtr> FDef;
358  typedef std::vector<std::vector<NekDouble> > FData;
359  std::map<std::string, FDef> FieldDef;
360  std::map<std::string, FData> FieldData;
361  LibUtilities::FieldMetaDataMap fieldMetaDataMap;
362 
363  for (auto &setIt : filelist)
364  {
365  if (root)
366  {
367  cout << " - Reading file: " << setIt << endl;
368  }
369  FieldDef[setIt] = FDef(0);
370  FieldData[setIt] = FData(0);
373  fld->Import(setIt, FieldDef[setIt], FieldData[setIt],
374  fieldMetaDataMap);
375  }
376 
377  // Get time of checkpoint from file if available
378  auto iter = fieldMetaDataMap.find("Time");
379  if(iter != fieldMetaDataMap.end())
380  {
381  m_lastTime = boost::lexical_cast<NekDouble>(iter->second);
382  }
383 
384  // Load each cell model variable
385  // j=0 and j=1 are for transmembrane or intra/extra-cellular volt.
386  Vmath::Zero(m_nq, m_cellSol[0], 1);
387  for(j = 1; j < m_cellSol.size(); ++j)
388  {
389  // Get the name of the jth variable
390  varName = GetCellVarName(j);
391 
392  // Check if this variable is defined in a file or analytically
393  if (m_session->GetFunctionType(fncName, varName) ==
395  {
396  const std::string file =
397  m_session->GetFunctionFilename(fncName, varName);
398 
399  if (root)
400  {
401  cout << " - Field " << varName << ": from file "
402  << file << endl;
403  }
404 
405  // Extract the data into the modal coefficients
406  for(int i = 0; i < FieldDef[file].size(); ++i)
407  {
408  m_field->ExtractDataToCoeffs(FieldDef[file][i],
409  FieldData[file][i],
410  varName,
411  coeffs);
412  }
413 
414  // If using nodal cell model then we do a modal->nodal transform
415  // otherwise we do a backward transform onto physical points.
416  if (m_useNodal)
417  {
418  for (unsigned int i = 0; i < m_field->GetNumElmts(); ++i)
419  {
420  int coef_offset = m_field->GetCoeff_Offset(i);
421  if (m_field->GetExp(0)->DetShapeType() ==
423  {
424  m_nodalTri->ModalToNodal(coeffs+coef_offset,
425  tmp=m_cellSol[j]+coef_offset);
426  }
427  else
428  {
429  m_nodalTet->ModalToNodal(coeffs+coef_offset,
430  tmp=m_cellSol[j]+coef_offset);
431  }
432  }
433  }
434  else
435  {
436  m_field->BwdTrans(coeffs, m_cellSol[j]);
437  }
438  }
439  else if (m_session->GetFunctionType(fncName, varName) ==
441  {
443  m_session->GetFunction(fncName, varName);
444 
445  if (root)
446  {
447  cout << " - Field " << varName << ": "
448  << equ->GetExpression() << endl;
449  }
450 
451  const unsigned int nphys = m_field->GetNpoints();
452  Array<OneD, NekDouble> x0(nphys);
453  Array<OneD, NekDouble> x1(nphys);
454  Array<OneD, NekDouble> x2(nphys);
455  m_field->GetCoords(x0,x1,x2);
456 
457  if (m_useNodal)
458  {
459  Array<OneD, NekDouble> phys(nphys);
460  Array<OneD, NekDouble> tmpCoeffs(max(m_nodalTri->GetNcoeffs(), m_nodalTet->GetNcoeffs()));
461 
462  equ->Evaluate(x0, x1, x2, phys);
463  for (unsigned int i = 0; i < m_field->GetNumElmts(); ++i)
464  {
465  int phys_offset = m_field->GetPhys_Offset(i);
466  int coef_offset = m_field->GetCoeff_Offset(i);
467  if (m_field->GetExp(0)->DetShapeType() ==
469  {
470  m_field->GetExp(0)->FwdTrans(
471  phys + phys_offset, tmpCoeffs);
472  m_nodalTri->ModalToNodal(
473  tmpCoeffs,
474  tmp = m_cellSol[j] + coef_offset);
475  }
476  else
477  {
478  m_field->GetExp(0)->FwdTrans(
479  phys + phys_offset, tmpCoeffs);
480  m_nodalTet->ModalToNodal(
481  tmpCoeffs,
482  tmp = m_cellSol[j] + coef_offset);
483  }
484  }
485  }
486  else
487  {
488  equ->Evaluate(x0, x1, x2, m_cellSol[j]);
489  }
490  }
491  }
492  }
std::string GetCellVarName(unsigned int idx)
Definition: CellModel.h:101
static std::shared_ptr< FieldIO > CreateForFile(const LibUtilities::SessionReaderSharedPtr session, const std::string &filename)
Construct a FieldIO object for a given input filename.
Definition: FieldIO.cpp:226
std::shared_ptr< FieldIO > FieldIOSharedPtr
Definition: FieldIO.h:306
std::map< std::string, std::string > FieldMetaDataMap
Definition: FieldIO.h:52
std::shared_ptr< Equation > EquationSharedPtr
Definition: Equation.h:131
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:174
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.cpp:436

References Nektar::LibUtilities::eFunctionTypeExpression, Nektar::LibUtilities::eFunctionTypeFile, Nektar::LibUtilities::eTriangle, and Vmath::Zero().

◆ TimeIntegrate()

void Nektar::CellModel::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.

Integrates the cell model for one PDE time-step. Cell model is sub-stepped.

Ion concentrations and membrane potential are integrated using forward Euler, while gating variables are integrated using the Rush-Larsen scheme.

Definition at line 160 of file CellModel.cpp.

164  {
165  int phys_offset = 0;
166  int coef_offset = 0;
167  int nvar = inarray.size();
168  Array<OneD, NekDouble> tmp;
169 
170  // ---------------------------
171  // Check nodal temp array set up
172  if (m_useNodal)
173  {
174  if (!m_nodalTmp.size())
175  {
176  m_nodalTmp = Array<OneD, Array<OneD, NekDouble> >(nvar);
177  for (unsigned int k = 0; k < nvar; ++k)
178  {
179  m_nodalTmp[k] = Array<OneD, NekDouble>(m_nq);
180  }
181  }
182 
183  // Move to nodal points
184  Array<OneD, NekDouble> tmpCoeffs(max(m_nodalTri->GetNcoeffs(), m_nodalTet->GetNcoeffs()));
185 
186  for (unsigned int k = 0; k < nvar; ++k)
187  {
188  for (unsigned int i = 0; i < m_field->GetNumElmts(); ++i)
189  {
190  phys_offset = m_field->GetPhys_Offset(i);
191  coef_offset = m_field->GetCoeff_Offset(i);
192  if (m_field->GetExp(0)->DetShapeType() == LibUtilities::eTriangle)
193  {
194  m_field->GetExp(0)->FwdTrans(inarray[k] + phys_offset, tmpCoeffs);
195  m_nodalTri->ModalToNodal(tmpCoeffs, tmp=m_nodalTmp[k]+coef_offset);
196  }
197  else
198  {
199  m_field->GetExp(0)->FwdTrans(inarray[k] + phys_offset, tmpCoeffs);
200  m_nodalTet->ModalToNodal(tmpCoeffs, tmp=m_nodalTmp[k]+coef_offset);
201  }
202  }
203  }
204  // Copy new transmembrane potential into cell model
205  Vmath::Vcopy(m_nq, m_nodalTmp[0], 1, m_cellSol[0], 1);
206  }
207  else
208  {
209  // Copy new transmembrane potential into cell model
210  Vmath::Vcopy(m_nq, inarray[0], 1, m_cellSol[0], 1);
211  }
212  // -------------------------
213 
214  NekDouble delta_t = (time - m_lastTime)/m_substeps;
215 
216 
217  // Perform substepping
218  for (unsigned int i = 0; i < m_substeps - 1; ++i)
219  {
220  Update(m_cellSol, m_wsp, time);
221  // Voltage
222  Vmath::Svtvp(m_nq, delta_t, m_wsp[0], 1, m_cellSol[0], 1, m_cellSol[0], 1);
223  // Ion concentrations
224  for (unsigned int j = 0; j < m_concentrations.size(); ++j)
225  {
227  }
228  // Gating variables: Rush-Larsen scheme
229  for (unsigned int j = 0; j < m_gates.size(); ++j)
230  {
231  Vmath::Sdiv(m_nq, -delta_t, m_gates_tau[j], 1, m_gates_tau[j], 1);
232  Vmath::Vexp(m_nq, m_gates_tau[j], 1, m_gates_tau[j], 1);
233  Vmath::Vsub(m_nq, m_cellSol[m_gates[j]], 1, m_wsp[m_gates[j]], 1, m_cellSol[m_gates[j]], 1);
234  Vmath::Vvtvp(m_nq, m_cellSol[m_gates[j]], 1, m_gates_tau[j], 1, m_wsp[m_gates[j]], 1, m_cellSol[m_gates[j]], 1);
235  }
236  }
237 
238  // Perform final cell model step
239  Update(m_cellSol, m_wsp, time);
240 
241  // Output dV/dt from last step but integrate remaining cell model vars
242  // Transform cell model I_total from nodal to modal space
243  if (m_useNodal)
244  {
245  Array<OneD, NekDouble> tmpCoeffs(max(m_nodalTri->GetNcoeffs(), m_nodalTet->GetNcoeffs()));
246 
247  for (unsigned int k = 0; k < nvar; ++k)
248  {
249  for (unsigned int i = 0; i < m_field->GetNumElmts(); ++i)
250  {
251  int phys_offset = m_field->GetPhys_Offset(i);
252  int coef_offset = m_field->GetCoeff_Offset(i);
253  if (m_field->GetExp(0)->DetShapeType() == LibUtilities::eTriangle)
254  {
255  m_nodalTri->NodalToModal(m_wsp[k]+coef_offset, tmpCoeffs);
256  m_field->GetExp(0)->BwdTrans(tmpCoeffs, tmp=outarray[k] + phys_offset);
257  }
258  else
259  {
260  m_nodalTet->NodalToModal(m_wsp[k]+coef_offset, tmpCoeffs);
261  m_field->GetExp(0)->BwdTrans(tmpCoeffs, tmp=outarray[k] + phys_offset);
262  }
263  }
264  }
265  }
266  else
267  {
268  Vmath::Vcopy(m_nq, m_wsp[0], 1, outarray[0], 1);
269  }
270 
271  // Ion concentrations
272  for (unsigned int j = 0; j < m_concentrations.size(); ++j)
273  {
275  }
276 
277  // Gating variables: Rush-Larsen scheme
278  for (unsigned int j = 0; j < m_gates.size(); ++j)
279  {
280  Vmath::Sdiv(m_nq, -delta_t, m_gates_tau[j], 1, m_gates_tau[j], 1);
281  Vmath::Vexp(m_nq, m_gates_tau[j], 1, m_gates_tau[j], 1);
282  Vmath::Vsub(m_nq, m_cellSol[m_gates[j]], 1, m_wsp[m_gates[j]], 1, m_cellSol[m_gates[j]], 1);
283  Vmath::Vvtvp(m_nq, m_cellSol[m_gates[j]], 1, m_gates_tau[j], 1, m_wsp[m_gates[j]], 1, m_cellSol[m_gates[j]], 1);
284  }
285 
286  m_lastTime = time;
287  }
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.
Definition: CellModel.h:82
Array< OneD, Array< OneD, NekDouble > > m_nodalTmp
Temporary array for nodal projection.
Definition: CellModel.h:135
std::vector< int > m_concentrations
Indices of cell model variables which are concentrations.
Definition: CellModel.h:138
double NekDouble
void Vexp(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.hpp:116
void Svtvp(int n, const T alpha, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
svtvp (scalar times vector plus vector): z = alpha*x + y
Definition: Vmath.cpp:565
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
Definition: Vmath.cpp:513
void Sdiv(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha/y.
Definition: Vmath.cpp:291
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1199
void Vsub(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Subtract vector z = x-y.
Definition: Vmath.cpp:372

References Nektar::LibUtilities::eTriangle, Vmath::Sdiv(), Vmath::Svtvp(), Vmath::Vcopy(), Vmath::Vexp(), Vmath::Vsub(), and Vmath::Vvtvp().

◆ Update()

void Nektar::CellModel::Update ( const Array< OneD, const Array< OneD, NekDouble > > &  inarray,
Array< OneD, Array< OneD, NekDouble > > &  outarray,
const NekDouble  time 
)
inline

Compute the derivatives of cell model variables.

Definition at line 82 of file CellModel.h.

86  {
87  v_Update(inarray, outarray, time);
88  }
virtual void v_Update(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)=0

References v_Update().

◆ v_GenerateSummary()

virtual void Nektar::CellModel::v_GenerateSummary ( SummaryList s)
protectedpure virtual

◆ v_GetCellVarName()

virtual std::string Nektar::CellModel::v_GetCellVarName ( unsigned int  idx)
inlineprotectedvirtual

Reimplemented in Nektar::FentonKarma, and Nektar::CourtemancheRamirezNattel98.

Definition at line 151 of file CellModel.h.

152  {
153  return "Var" + boost::lexical_cast<std::string>(idx);
154  }

Referenced by GetCellVarName().

◆ v_SetInitialConditions()

virtual void Nektar::CellModel::v_SetInitialConditions ( )
protectedpure virtual

◆ v_Update()

virtual void Nektar::CellModel::v_Update ( const Array< OneD, const Array< OneD, NekDouble > > &  inarray,
Array< OneD, Array< OneD, NekDouble > > &  outarray,
const NekDouble  time 
)
protectedpure virtual

Member Data Documentation

◆ m_cellSol

Array<OneD, Array<OneD, NekDouble> > Nektar::CellModel::m_cellSol
protected

◆ m_concentrations

std::vector<int> Nektar::CellModel::m_concentrations
protected

◆ m_field

MultiRegions::ExpListSharedPtr Nektar::CellModel::m_field
protected

Transmembrane potential field from PDE system.

Definition at line 114 of file CellModel.h.

◆ m_gates

std::vector<int> Nektar::CellModel::m_gates
protected

◆ m_gates_tau

Array<OneD, Array<OneD, NekDouble> > Nektar::CellModel::m_gates_tau
protected

◆ m_lastTime

NekDouble Nektar::CellModel::m_lastTime
protected

Timestep for pde model.

Definition at line 120 of file CellModel.h.

◆ m_nodalTet

StdRegions::StdNodalTetExpSharedPtr Nektar::CellModel::m_nodalTet
protected

Definition at line 133 of file CellModel.h.

◆ m_nodalTmp

Array<OneD, Array<OneD, NekDouble> > Nektar::CellModel::m_nodalTmp
protected

Temporary array for nodal projection.

Definition at line 135 of file CellModel.h.

◆ m_nodalTri

StdRegions::StdNodalTriExpSharedPtr Nektar::CellModel::m_nodalTri
protected

StdNodalTri for cell model calculations.

Definition at line 132 of file CellModel.h.

◆ m_nq

int Nektar::CellModel::m_nq
protected

◆ m_nvar

int Nektar::CellModel::m_nvar
protected

◆ m_session

LibUtilities::SessionReaderSharedPtr Nektar::CellModel::m_session
protected

Session.

Definition at line 112 of file CellModel.h.

◆ m_substeps

int Nektar::CellModel::m_substeps
protected

Number of substeps to take.

Definition at line 122 of file CellModel.h.

◆ m_useNodal

bool Nektar::CellModel::m_useNodal
protected

Flag indicating whether nodal projection in use.

Definition at line 130 of file CellModel.h.

◆ m_wsp

Array<OneD, Array<OneD, NekDouble> > Nektar::CellModel::m_wsp
protected

Cell model integration workspace.

Definition at line 127 of file CellModel.h.