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

FitzHugh-Nagumo model. More...

#include <FitzhughNagumo.h>

Inheritance diagram for Nektar::CellModelFitzHughNagumo:
[legend]

Public Member Functions

 CellModelFitzHughNagumo (const LibUtilities::SessionReaderSharedPtr &pSession, const MultiRegions::ExpListSharedPtr &pField)
 
 ~CellModelFitzHughNagumo () override
 
- 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...
 
size_t GetNumCellVariables ()
 
std::string GetCellVarName (size_t idx)
 
Array< OneD, NekDoubleGetCellSolutionCoeffs (size_t idx)
 
Array< OneD, NekDoubleGetCellSolution (size_t 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

void v_Update (const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time) override
 
void v_GenerateSummary (SummaryList &s) override
 
void v_SetInitialConditions () override
 
- Protected Member Functions inherited from Nektar::CellModel
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 (size_t idx)
 
virtual void v_SetInitialConditions ()=0
 
void LoadCellModel ()
 

Private Attributes

NekDouble m_beta
 
NekDouble m_epsilon
 
Array< OneD, NekDoublem_uuu
 Temporary space for storing \(u^3\) when computing reaction term. More...
 

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...
 
size_t m_nq
 Number of physical points. More...
 
size_t m_nvar
 Number of variables in cell model (inc. transmembrane voltage) More...
 
NekDouble m_lastTime
 Timestep for pde model. More...
 
size_t 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

FitzHugh-Nagumo model.

Definition at line 43 of file FitzhughNagumo.h.

Constructor & Destructor Documentation

◆ CellModelFitzHughNagumo()

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

Definition at line 51 of file FitzhughNagumo.cpp.

54 : CellModel(pSession, pField)
55{
56 pSession->LoadParameter("beta", m_beta, 0.0);
57 pSession->LoadParameter("epsilon", m_epsilon, 1.0);
58
59 m_uuu = Array<OneD, NekDouble>(m_nq, 0.0);
60
61 m_nvar = 2;
62 m_concentrations.push_back(1);
63}
Array< OneD, NekDouble > m_uuu
Temporary space for storing when computing reaction term.
std::vector< int > m_concentrations
Indices of cell model variables which are concentrations.
Definition: CellModel.h:139
size_t m_nq
Number of physical points.
Definition: CellModel.h:117
size_t m_nvar
Number of variables in cell model (inc. transmembrane voltage)
Definition: CellModel.h:119
CellModel(const LibUtilities::SessionReaderSharedPtr &pSession, const MultiRegions::ExpListSharedPtr &pField)
Definition: CellModel.cpp:66

References m_beta, Nektar::CellModel::m_concentrations, m_epsilon, Nektar::CellModel::m_nq, Nektar::CellModel::m_nvar, and m_uuu.

◆ ~CellModelFitzHughNagumo()

Nektar::CellModelFitzHughNagumo::~CellModelFitzHughNagumo ( )
inlineoverride

Definition at line 62 of file FitzhughNagumo.h.

63 {
64 }

Member Function Documentation

◆ create()

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

Creates an instance of this class.

Definition at line 47 of file FitzhughNagumo.h.

50 {
52 pSession, pField);
53 }
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.

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

◆ v_GenerateSummary()

void Nektar::CellModelFitzHughNagumo::v_GenerateSummary ( SummaryList s)
overrideprotectedvirtual

Implements Nektar::CellModel.

Definition at line 97 of file FitzhughNagumo.cpp.

98{
99 SolverUtils::AddSummaryItem(s, "Cell model", "FitzHugh-Nagumo");
100 SolverUtils::AddSummaryItem(s, "Cell model beta", m_beta);
101}
void AddSummaryItem(SummaryList &l, const std::string &name, const std::string &value)
Adds a summary item to the summary info list.
Definition: Misc.cpp:47

References Nektar::SolverUtils::AddSummaryItem(), and m_beta.

◆ v_SetInitialConditions()

void Nektar::CellModelFitzHughNagumo::v_SetInitialConditions ( )
overrideprotectedvirtual

Implements Nektar::CellModel.

Definition at line 106 of file FitzhughNagumo.cpp.

107{
108 Vmath::Fill(m_nq, 0.0, m_cellSol[0], 1);
109 Vmath::Fill(m_nq, 0.0, m_cellSol[1], 1);
110}
Array< OneD, Array< OneD, NekDouble > > m_cellSol
Cell model solution variables.
Definition: CellModel.h:126
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
Definition: Vmath.hpp:54

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

◆ v_Update()

void Nektar::CellModelFitzHughNagumo::v_Update ( const Array< OneD, const Array< OneD, NekDouble > > &  inarray,
Array< OneD, Array< OneD, NekDouble > > &  outarray,
const NekDouble  time 
)
overrideprotectedvirtual

Implements Nektar::CellModel.

Definition at line 65 of file FitzhughNagumo.cpp.

69{
70 NekDouble m_gamma = 0.5;
71
72 // compute u^2: m_u = u*u
73 Vmath::Vmul(m_nq, &inarray[0][0], 1, &inarray[0][0], 1, &m_uuu[0], 1);
74
75 // compute u^3: m_u = u*u*u
76 Vmath::Vmul(m_nq, &inarray[0][0], 1, &m_uuu[0], 1, &m_uuu[0], 1);
77
78 // For u: (1/m_epsilon)*( u*-u*u*u/3 - v )
79 // physfield = u - (1.0/3.0)*u*u*u
80 Vmath::Svtvp(m_nq, (-1.0 / 3.0), &m_uuu[0], 1, &inarray[0][0], 1,
81 &outarray[0][0], 1);
82
83 Vmath::Vsub(m_nq, &inarray[1][0], 1, &outarray[0][0], 1, &outarray[0][0],
84 1);
85 Vmath::Smul(m_nq, -1.0 / m_epsilon, &outarray[0][0], 1, &outarray[0][0], 1);
86
87 // For v: m_epsilon*( u + m_beta - m_gamma*v )
88 Vmath::Svtvp(m_nq, -1.0 * m_gamma, &inarray[1][0], 1, &inarray[0][0], 1,
89 &outarray[1][0], 1);
90 Vmath::Sadd(m_nq, m_beta, &outarray[1][0], 1, &outarray[1][0], 1);
91 Vmath::Smul(m_nq, m_epsilon, &outarray[1][0], 1, &outarray[1][0], 1);
92}
double NekDouble
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
Definition: Vmath.hpp:72
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.hpp:396
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*x.
Definition: Vmath.hpp:100
void Sadd(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Add vector y = alpha + x.
Definition: Vmath.hpp:194
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.hpp:220

References m_beta, m_epsilon, Nektar::CellModel::m_nq, m_uuu, Vmath::Sadd(), Vmath::Smul(), Vmath::Svtvp(), Vmath::Vmul(), and Vmath::Vsub().

Member Data Documentation

◆ className

std::string Nektar::CellModelFitzHughNagumo::className
static
Initial value:
=
"Phenomological model of squid nerve cell.")
static CellModelSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const MultiRegions::ExpListSharedPtr &pField)
Creates an instance of this class.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
Definition: NekFactory.hpp:197
CellModelFactory & GetCellModelFactory()
Definition: CellModel.cpp:46

Name of class.

Registers the class with the Factory.

Definition at line 56 of file FitzhughNagumo.h.

◆ m_beta

NekDouble Nektar::CellModelFitzHughNagumo::m_beta
private

Definition at line 76 of file FitzhughNagumo.h.

Referenced by CellModelFitzHughNagumo(), v_GenerateSummary(), and v_Update().

◆ m_epsilon

NekDouble Nektar::CellModelFitzHughNagumo::m_epsilon
private

Definition at line 77 of file FitzhughNagumo.h.

Referenced by CellModelFitzHughNagumo(), and v_Update().

◆ m_uuu

Array<OneD, NekDouble> Nektar::CellModelFitzHughNagumo::m_uuu
private

Temporary space for storing \(u^3\) when computing reaction term.

Definition at line 80 of file FitzhughNagumo.h.

Referenced by CellModelFitzHughNagumo(), and v_Update().