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

virtual ~StimulusRect ()
 
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

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

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()

virtual Nektar::StimulusRect::~StimulusRect ( )
inlinevirtual

Definition at line 67 of file StimulusRect.h.

References Initialise().

67 {}

◆ StimulusRect()

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

Stimulus base class constructor.

Definition at line 61 of file StimulusRect.cpp.

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.

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

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.

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

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

◆ Initialise()

void Nektar::StimulusRect::Initialise ( )

Initialise the stimulus storage and set initial conditions.

Initialise the stimulus. Allocate workspace and variable storage.

Definition at line 110 of file StimulusRect.cpp.

Referenced by ~StimulusRect().

111  {
112  }

◆ v_GenerateSummary()

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

Implements Nektar::Stimulus.

Definition at line 179 of file StimulusRect.cpp.

180  {
181  }

◆ v_Update()

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

Implements Nektar::Stimulus.

Definition at line 117 of file StimulusRect.cpp.

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.

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

Friends And Related Function Documentation

◆ MemoryManager< StimulusRect >

friend class MemoryManager< StimulusRect >
friend

Definition at line 65 of file StimulusRect.h.

Member Data Documentation

◆ className

std::string Nektar::StimulusRect::className
static
Initial value:
"StimulusRect",
"Rectangular stimulus.")

Name of class.

Definition at line 63 of file StimulusRect.h.

◆ m_chiCapMembrane

NekDouble Nektar::StimulusRect::m_chiCapMembrane
protected

Definition at line 81 of file StimulusRect.h.

Referenced by StimulusRect(), and v_Update().

◆ m_pis

NekDouble Nektar::StimulusRect::m_pis
protected

Definition at line 79 of file StimulusRect.h.

Referenced by StimulusRect(), and v_Update().

◆ m_px1

NekDouble Nektar::StimulusRect::m_px1
protected

Definition at line 73 of file StimulusRect.h.

Referenced by StimulusRect(), and v_Update().

◆ m_px2

NekDouble Nektar::StimulusRect::m_px2
protected

Definition at line 76 of file StimulusRect.h.

Referenced by StimulusRect(), and v_Update().

◆ m_py1

NekDouble Nektar::StimulusRect::m_py1
protected

Definition at line 74 of file StimulusRect.h.

Referenced by StimulusRect(), and v_Update().

◆ m_py2

NekDouble Nektar::StimulusRect::m_py2
protected

Definition at line 77 of file StimulusRect.h.

Referenced by StimulusRect(), and v_Update().

◆ m_pz1

NekDouble Nektar::StimulusRect::m_pz1
protected

Definition at line 75 of file StimulusRect.h.

Referenced by StimulusRect(), and v_Update().

◆ m_pz2

NekDouble Nektar::StimulusRect::m_pz2
protected

Definition at line 78 of file StimulusRect.h.

Referenced by StimulusRect(), and v_Update().

◆ m_strength

NekDouble Nektar::StimulusRect::m_strength
protected

Definition at line 80 of file StimulusRect.h.

Referenced by StimulusRect(), and v_Update().