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::StimulusCirc Class Reference

Protocol base class. More...

#include <StimulusCircle.h>

Inheritance diagram for Nektar::StimulusCirc:
[legend]

Public Member Functions

 ~StimulusCirc () override
 
void Initialise ()
 Initialise the protocol 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_pr1
 
NekDouble m_pis
 
NekDouble m_strength
 
NekDouble v_amp
 
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

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

Friends

class MemoryManager< StimulusCirc >
 

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 52 of file StimulusCircle.h.

Constructor & Destructor Documentation

◆ ~StimulusCirc()

Nektar::StimulusCirc::~StimulusCirc ( )
inlineoverride

Definition at line 69 of file StimulusCircle.h.

70 {
71 }

◆ StimulusCirc()

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

Stimulus base class constructor.

Definition at line 58 of file StimulusCircle.cpp.

61 : Stimulus(pSession, pField, pXml)
62{
63 m_session = pSession;
64 m_field = pField;
65 m_nq = pField->GetTotPoints();
67 m_session->GetParameter("chi") * m_session->GetParameter("Cm");
68
69 if (!pXml)
70 {
71 return;
72 }
73
74 const TiXmlElement *pXmlparameter;
75
76 pXmlparameter = pXml->FirstChildElement("p_x1");
77 m_px1 = atof(pXmlparameter->GetText());
78
79 pXmlparameter = pXml->FirstChildElement("p_y1");
80 m_py1 = atof(pXmlparameter->GetText());
81
82 pXmlparameter = pXml->FirstChildElement("p_z1");
83 m_pz1 = atof(pXmlparameter->GetText());
84
85 pXmlparameter = pXml->FirstChildElement("p_r1");
86 m_pr1 = atof(pXmlparameter->GetText());
87
88 pXmlparameter = pXml->FirstChildElement("p_is");
89 m_pis = atof(pXmlparameter->GetText());
90
91 pXmlparameter = pXml->FirstChildElement("p_strength");
92 m_strength = atof(pXmlparameter->GetText());
93}
NekDouble m_chiCapMembrane
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

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

Member Function Documentation

◆ create()

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

Creates an instance of this class.

Definition at line 56 of file StimulusCircle.h.

59 {
61 pXml);
62 }
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::StimulusCirc::Initialise ( )

Initialise the protocol storage and set initial conditions.

Initialise the stimulus. Allocate workspace and variable storage.

Definition at line 98 of file StimulusCircle.cpp.

99{
100}

◆ v_GenerateSummary()

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

Implements Nektar::Stimulus.

Definition at line 167 of file StimulusCircle.cpp.

169{
170}

◆ v_Update()

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

Implements Nektar::Stimulus.

Definition at line 105 of file StimulusCircle.cpp.

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

References Nektar::Stimulus::m_field, m_pis, m_pr1, Nektar::Stimulus::m_Protocol, m_px1, m_py1, m_pz1, m_strength, and v_amp.

Friends And Related Function Documentation

◆ MemoryManager< StimulusCirc >

friend class MemoryManager< StimulusCirc >
friend

Definition at line 65 of file StimulusCircle.h.

Member Data Documentation

◆ className

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

Name of class.

Definition at line 65 of file StimulusCircle.h.

◆ m_chiCapMembrane

NekDouble Nektar::StimulusCirc::m_chiCapMembrane
protected

Definition at line 84 of file StimulusCircle.h.

Referenced by StimulusCirc().

◆ m_pis

NekDouble Nektar::StimulusCirc::m_pis
protected

Definition at line 81 of file StimulusCircle.h.

Referenced by StimulusCirc(), and v_Update().

◆ m_pr1

NekDouble Nektar::StimulusCirc::m_pr1
protected

Definition at line 80 of file StimulusCircle.h.

Referenced by StimulusCirc(), and v_Update().

◆ m_px1

NekDouble Nektar::StimulusCirc::m_px1
protected

Definition at line 77 of file StimulusCircle.h.

Referenced by StimulusCirc(), and v_Update().

◆ m_py1

NekDouble Nektar::StimulusCirc::m_py1
protected

Definition at line 78 of file StimulusCircle.h.

Referenced by StimulusCirc(), and v_Update().

◆ m_pz1

NekDouble Nektar::StimulusCirc::m_pz1
protected

Definition at line 79 of file StimulusCircle.h.

Referenced by StimulusCirc(), and v_Update().

◆ m_strength

NekDouble Nektar::StimulusCirc::m_strength
protected

Definition at line 82 of file StimulusCircle.h.

Referenced by StimulusCirc(), and v_Update().

◆ v_amp

NekDouble Nektar::StimulusCirc::v_amp
protected

Definition at line 83 of file StimulusCircle.h.

Referenced by v_Update().