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

Protocol base class. More...

#include <StimulusRect.h>

Inheritance diagram for Nektar::StimulusRect:
[legend]

Public Member Functions

 ~StimulusRect () override
 
void Initialise ()
 Initialise the stimulus storage and set initial conditions. More...
 
- Public Member Functions inherited from Nektar::Stimulus
virtual ~Stimulus ()
 
void Initialise ()
 Initialise the stimulus storage and set initial conditions. More...
 
void Update (Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
 Updates RHS of outarray by adding a stimulus to it. More...
 
void GenerateSummary (SolverUtils::SummaryList &s)
 Print a summary of the outarray. More...
 

Static Public Member Functions

static StimulusSharedPtr create (const LibUtilities::SessionReaderSharedPtr &pSession, const MultiRegions::ExpListSharedPtr &pField, const TiXmlElement *pXml)
 Creates an instance of this class. More...
 
- Static Public Member Functions inherited from Nektar::Stimulus
static std::vector< StimulusSharedPtrLoadStimuli (const LibUtilities::SessionReaderSharedPtr &pSession, const MultiRegions::ExpListSharedPtr &pField)
 

Static Public Attributes

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

Protected Member Functions

void v_Update (Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time) override
 
void v_GenerateSummary (SolverUtils::SummaryList &s) override
 
- Protected Member Functions inherited from Nektar::Stimulus
 Stimulus (const LibUtilities::SessionReaderSharedPtr &pSession, const MultiRegions::ExpListSharedPtr &pField, const TiXmlElement *pXml)
 
virtual void v_Update (Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)=0
 
virtual void v_GenerateSummary (SolverUtils::SummaryList &s)=0
 

Protected Attributes

NekDouble m_px1
 
NekDouble m_py1
 
NekDouble m_pz1
 
NekDouble m_px2
 
NekDouble m_py2
 
NekDouble m_pz2
 
NekDouble m_pis
 
NekDouble m_strength
 
NekDouble m_chiCapMembrane
 
- Protected Attributes inherited from Nektar::Stimulus
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...
 
ProtocolSharedPtr m_Protocol
 Stimulus protocol to apply. More...
 

Private Member Functions

 StimulusRect (const LibUtilities::SessionReaderSharedPtr &pSession, const MultiRegions::ExpListSharedPtr &pField, const TiXmlElement *pXml)
 

Friends

class MemoryManager< StimulusRect >
 

Detailed Description

Protocol base class.

The Stimulus class and derived classes implement a range of stimuli. The stimulus contains input stimuli that can be applied throughout the domain, on specified regions determined by the derived classes of Stimulus, at specified frequencies determined by the derived classes of Protocol.

Definition at line 49 of file StimulusRect.h.

Constructor & Destructor Documentation

◆ ~StimulusRect()

Nektar::StimulusRect::~StimulusRect ( )
inlineoverride

Definition at line 66 of file StimulusRect.h.

67 {
68 }

◆ StimulusRect()

Nektar::StimulusRect::StimulusRect ( const LibUtilities::SessionReaderSharedPtr pSession,
const MultiRegions::ExpListSharedPtr pField,
const TiXmlElement *  pXml 
)
private

Stimulus base class constructor.

Definition at line 59 of file StimulusRect.cpp.

62 : Stimulus(pSession, pField, pXml)
63{
64 m_session = pSession;
65 m_field = pField;
66 m_nq = pField->GetTotPoints();
68 m_session->GetParameter("chi") * m_session->GetParameter("Cm");
69
70 if (!pXml)
71 {
72 return;
73 }
74
75 const TiXmlElement *pXmlparameter;
76
77 pXmlparameter = pXml->FirstChildElement("p_x1");
78 m_px1 = atof(pXmlparameter->GetText());
79
80 pXmlparameter = pXml->FirstChildElement("p_y1");
81 m_py1 = atof(pXmlparameter->GetText());
82
83 pXmlparameter = pXml->FirstChildElement("p_z1");
84 m_pz1 = atof(pXmlparameter->GetText());
85
86 pXmlparameter = pXml->FirstChildElement("p_x2");
87 m_px2 = atof(pXmlparameter->GetText());
88
89 pXmlparameter = pXml->FirstChildElement("p_y2");
90 m_py2 = atof(pXmlparameter->GetText());
91
92 pXmlparameter = pXml->FirstChildElement("p_z2");
93 m_pz2 = atof(pXmlparameter->GetText());
94
95 pXmlparameter = pXml->FirstChildElement("p_is");
96 m_pis = atof(pXmlparameter->GetText());
97
98 pXmlparameter = pXml->FirstChildElement("p_strength");
99 m_strength = atof(pXmlparameter->GetText());
100}
Stimulus(const LibUtilities::SessionReaderSharedPtr &pSession, const MultiRegions::ExpListSharedPtr &pField, const TiXmlElement *pXml)
Definition: Stimulus.cpp:64
MultiRegions::ExpListSharedPtr m_field
Transmembrane potential field from PDE system.
Definition: Stimulus.h:95
int m_nq
Number of physical points.
Definition: Stimulus.h:97
LibUtilities::SessionReaderSharedPtr m_session
Session.
Definition: Stimulus.h:93
NekDouble m_chiCapMembrane
Definition: StimulusRect.h:82

References m_chiCapMembrane, Nektar::Stimulus::m_field, Nektar::Stimulus::m_nq, m_pis, m_px1, m_px2, m_py1, m_py2, m_pz1, m_pz2, Nektar::Stimulus::m_session, and m_strength.

Member Function Documentation

◆ create()

static StimulusSharedPtr Nektar::StimulusRect::create ( const LibUtilities::SessionReaderSharedPtr pSession,
const MultiRegions::ExpListSharedPtr pField,
const TiXmlElement *  pXml 
)
inlinestatic

Creates an instance of this class.

Definition at line 53 of file StimulusRect.h.

56 {
58 pXml);
59 }
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.

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

◆ Initialise()

void Nektar::StimulusRect::Initialise ( )

Initialise the stimulus storage and set initial conditions.

Initialise the stimulus. Allocate workspace and variable storage.

Definition at line 105 of file StimulusRect.cpp.

106{
107}

◆ v_GenerateSummary()

void Nektar::StimulusRect::v_GenerateSummary ( SolverUtils::SummaryList s)
overrideprotectedvirtual

Implements Nektar::Stimulus.

Definition at line 172 of file StimulusRect.cpp.

174{
175}

◆ v_Update()

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

Implements Nektar::Stimulus.

Definition at line 112 of file StimulusRect.cpp.

114{
115 if (m_field->GetNumElmts() == 0)
116 {
117 return;
118 }
119
120 // Get the dimension of the expansion
121 int dim = m_field->GetCoordim(0);
122
123 // Retrieve coordinates of quadrature points
124 int nq = m_field->GetNpoints();
125 Array<OneD, NekDouble> x0(nq);
126 Array<OneD, NekDouble> x1(nq);
127 Array<OneD, NekDouble> x2(nq);
128 m_field->GetCoords(x0, x1, x2);
129
130 // Get the protocol amplitude
131 NekDouble v_amp =
132 m_Protocol->GetAmplitude(time) * m_strength / m_chiCapMembrane;
133
134 switch (dim)
135 {
136 case 1:
137 for (int j = 0; j < nq; j++)
138 {
139 outarray[0][j] += v_amp * ((tanh(m_pis * (x0[j] - m_px1)) -
140 tanh(m_pis * (x0[j] - m_px2))) /
141 2.0);
142 }
143 break;
144 case 2:
145 for (int j = 0; j < nq; j++)
146 {
147 outarray[0][j] += v_amp * (((tanh(m_pis * (x0[j] - m_px1)) -
148 tanh(m_pis * (x0[j] - m_px2))) *
149 (tanh(m_pis * (x1[j] - m_py1)) -
150 tanh(m_pis * (x1[j] - m_py2)))) /
151 2.0);
152 }
153 break;
154 case 3:
155 for (int j = 0; j < nq; j++)
156 {
157 outarray[0][j] += v_amp * (((tanh(m_pis * (x0[j] - m_px1)) -
158 tanh(m_pis * (x0[j] - m_px2))) *
159 (tanh(m_pis * (x1[j] - m_py1)) -
160 tanh(m_pis * (x1[j] - m_py2))) *
161 (tanh(m_pis * (x2[j] - m_pz1)) -
162 tanh(m_pis * (x2[j] - m_pz2)))) /
163 2.0);
164 }
165 break;
166 }
167}
ProtocolSharedPtr m_Protocol
Stimulus protocol to apply.
Definition: Stimulus.h:99
double NekDouble

References m_chiCapMembrane, Nektar::Stimulus::m_field, m_pis, Nektar::Stimulus::m_Protocol, m_px1, m_px2, m_py1, m_py2, m_pz1, m_pz2, and m_strength.

Friends And Related Function Documentation

◆ MemoryManager< StimulusRect >

friend class MemoryManager< StimulusRect >
friend

Definition at line 62 of file StimulusRect.h.

Member Data Documentation

◆ className

std::string Nektar::StimulusRect::className
static
Initial value:
=
"StimulusRect", StimulusRect::create, "Rectangular stimulus.")
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
Definition: NekFactory.hpp:197
static StimulusSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const MultiRegions::ExpListSharedPtr &pField, const TiXmlElement *pXml)
Creates an instance of this class.
Definition: StimulusRect.h:53
StimulusFactory & GetStimulusFactory()
Definition: Stimulus.cpp:44

Name of class.

Definition at line 62 of file StimulusRect.h.

◆ m_chiCapMembrane

NekDouble Nektar::StimulusRect::m_chiCapMembrane
protected

Definition at line 82 of file StimulusRect.h.

Referenced by StimulusRect(), and v_Update().

◆ m_pis

NekDouble Nektar::StimulusRect::m_pis
protected

Definition at line 80 of file StimulusRect.h.

Referenced by StimulusRect(), and v_Update().

◆ m_px1

NekDouble Nektar::StimulusRect::m_px1
protected

Definition at line 74 of file StimulusRect.h.

Referenced by StimulusRect(), and v_Update().

◆ m_px2

NekDouble Nektar::StimulusRect::m_px2
protected

Definition at line 77 of file StimulusRect.h.

Referenced by StimulusRect(), and v_Update().

◆ m_py1

NekDouble Nektar::StimulusRect::m_py1
protected

Definition at line 75 of file StimulusRect.h.

Referenced by StimulusRect(), and v_Update().

◆ m_py2

NekDouble Nektar::StimulusRect::m_py2
protected

Definition at line 78 of file StimulusRect.h.

Referenced by StimulusRect(), and v_Update().

◆ m_pz1

NekDouble Nektar::StimulusRect::m_pz1
protected

Definition at line 76 of file StimulusRect.h.

Referenced by StimulusRect(), and v_Update().

◆ m_pz2

NekDouble Nektar::StimulusRect::m_pz2
protected

Definition at line 79 of file StimulusRect.h.

Referenced by StimulusRect(), and v_Update().

◆ m_strength

NekDouble Nektar::StimulusRect::m_strength
protected

Definition at line 81 of file StimulusRect.h.

Referenced by StimulusRect(), and v_Update().