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:
Inheritance graph
[legend]
Collaboration diagram for Nektar::StimulusRect:
Collaboration graph
[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 50 of file StimulusRect.h.

Constructor & Destructor Documentation

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

Definition at line 68 of file StimulusRect.h.

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

Stimulus base class constructor.

Definition at line 62 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.

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

Member Function Documentation

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 54 of file StimulusRect.h.

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

58  {
60  ::AllocateSharedPtr(pSession, pField, pXml);
61  }
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
void Nektar::StimulusRect::Initialise ( )

Initialise the stimulus storage and set initial conditions.

Initialise the stimulus. Allocate workspace and variable storage.

Definition at line 111 of file StimulusRect.cpp.

112  {
113  }
void Nektar::StimulusRect::v_GenerateSummary ( SolverUtils::SummaryList s)
protectedvirtual

Implements Nektar::Stimulus.

Definition at line 180 of file StimulusRect.cpp.

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

Implements Nektar::Stimulus.

Definition at line 118 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.

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

Friends And Related Function Documentation

friend class MemoryManager< StimulusRect >
friend

Definition at line 66 of file StimulusRect.h.

Member Data Documentation

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

Name of class.

Definition at line 64 of file StimulusRect.h.

NekDouble Nektar::StimulusRect::m_chiCapMembrane
protected

Definition at line 82 of file StimulusRect.h.

Referenced by StimulusRect(), and v_Update().

NekDouble Nektar::StimulusRect::m_pis
protected

Definition at line 80 of file StimulusRect.h.

Referenced by StimulusRect(), and v_Update().

NekDouble Nektar::StimulusRect::m_px1
protected

Definition at line 74 of file StimulusRect.h.

Referenced by StimulusRect(), and v_Update().

NekDouble Nektar::StimulusRect::m_px2
protected

Definition at line 77 of file StimulusRect.h.

Referenced by StimulusRect(), and v_Update().

NekDouble Nektar::StimulusRect::m_py1
protected

Definition at line 75 of file StimulusRect.h.

Referenced by StimulusRect(), and v_Update().

NekDouble Nektar::StimulusRect::m_py2
protected

Definition at line 78 of file StimulusRect.h.

Referenced by StimulusRect(), and v_Update().

NekDouble Nektar::StimulusRect::m_pz1
protected

Definition at line 76 of file StimulusRect.h.

Referenced by StimulusRect(), and v_Update().

NekDouble Nektar::StimulusRect::m_pz2
protected

Definition at line 79 of file StimulusRect.h.

Referenced by StimulusRect(), and v_Update().

NekDouble Nektar::StimulusRect::m_strength
protected

Definition at line 81 of file StimulusRect.h.

Referenced by StimulusRect(), and v_Update().