Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | 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

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

Static Public Member Functions

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

Static Public Attributes

static std::string className
 Name of class.

Protected Member Functions

virtual void v_Update (Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
virtual void v_GenerateSummary (SolverUtils::SummaryList &s)

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
- Protected Attributes inherited from Nektar::Stimulus
LibUtilities::SessionReaderSharedPtr m_session
 Session.
MultiRegions::ExpListSharedPtr m_field
 Transmembrane potential field from PDE system.
int m_nq
 Number of physical points.
ProtocolSharedPtr m_Protocol

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

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

Stimulus base class constructor.

Definition at line 62 of file StimulusRect.cpp.

References 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.

: Stimulus(pSession, pField, pXml)
{
m_session = pSession;
m_field = pField;
m_nq = pField->GetTotPoints();
if (!pXml)
{
return;
}
const TiXmlElement *pXmlparameter;
pXmlparameter = pXml->FirstChildElement("p_x1");
m_px1 = atof(pXmlparameter->GetText());
pXmlparameter = pXml->FirstChildElement("p_y1");
m_py1 = atof(pXmlparameter->GetText());
pXmlparameter = pXml->FirstChildElement("p_z1");
m_pz1 = atof(pXmlparameter->GetText());
pXmlparameter = pXml->FirstChildElement("p_x2");
m_px2 = atof(pXmlparameter->GetText());
pXmlparameter = pXml->FirstChildElement("p_y2");
m_py2 = atof(pXmlparameter->GetText());
pXmlparameter = pXml->FirstChildElement("p_z2");
m_pz2 = atof(pXmlparameter->GetText());
pXmlparameter = pXml->FirstChildElement("p_is");
m_pis = atof(pXmlparameter->GetText());
pXmlparameter = pXml->FirstChildElement("p_strength");
m_strength = atof(pXmlparameter->GetText());
}
virtual Nektar::StimulusRect::~StimulusRect ( )
inlinevirtual

Definition at line 70 of file StimulusRect.h.

{}

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.

{
::AllocateSharedPtr(pSession, pField, pXml);
}
void Nektar::StimulusRect::Initialise ( )

Initialise the stimulus storage and set initial conditions.

Initialise the stimulus. Allocate workspace and variable storage.

Reimplemented from Nektar::Stimulus.

Definition at line 109 of file StimulusRect.cpp.

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

Implements Nektar::Stimulus.

Definition at line 179 of file StimulusRect.cpp.

{
}
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 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.

{
if (m_field->GetNumElmts() == 0)
{
return;
}
// Get the dimension of the expansion
int dim = m_field->GetCoordim(0);
// Retrieve coordinates of quadrature points
int nq = m_field->GetNpoints();
Array<OneD,NekDouble> x0(nq);
Array<OneD,NekDouble> x1(nq);
Array<OneD,NekDouble> x2(nq);
m_field->GetCoords(x0,x1,x2);
// Get the protocol amplitude
NekDouble v_amp = m_Protocol->GetAmplitude(time) * m_strength;
switch (dim)
{
case 1:
for(int j=0; j<nq; j++)
{
outarray[0][j] += v_amp * ( ( tanh(m_pis*(x0[j] - m_px1))
- tanh(m_pis*(x0[j] - m_px2))
) / 2.0 );
}
break;
case 2:
for(int j=0; j<nq; j++)
{
outarray[0][j] += v_amp * ( ( (tanh(m_pis*(x0[j] - m_px1))
- tanh(m_pis*(x0[j] - m_px2)))
* (tanh(m_pis*(x1[j] - m_py1))
- tanh(m_pis*(x1[j] - m_py2)))
) / 2.0 );
}
break;
case 3:
for(int j=0; j<nq; j++)
{
outarray[0][j] += v_amp * ( ( (tanh(m_pis*(x0[j] - m_px1))
- tanh(m_pis*(x0[j] - m_px2)))
* (tanh(m_pis*(x1[j] - m_py1))
- tanh(m_pis*(x1[j] - m_py2)))
* (tanh(m_pis*(x2[j] - m_pz1))
- tanh(m_pis*(x2[j] - m_pz2)))
) / 2.0 );
}
break;
}
}

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_pis
protected

Definition at line 82 of file StimulusRect.h.

Referenced by StimulusRect(), and v_Update().

NekDouble Nektar::StimulusRect::m_px1
protected

Definition at line 76 of file StimulusRect.h.

Referenced by StimulusRect(), and v_Update().

NekDouble Nektar::StimulusRect::m_px2
protected

Definition at line 79 of file StimulusRect.h.

Referenced by StimulusRect(), and v_Update().

NekDouble Nektar::StimulusRect::m_py1
protected

Definition at line 77 of file StimulusRect.h.

Referenced by StimulusRect(), and v_Update().

NekDouble Nektar::StimulusRect::m_py2
protected

Definition at line 80 of file StimulusRect.h.

Referenced by StimulusRect(), and v_Update().

NekDouble Nektar::StimulusRect::m_pz1
protected

Definition at line 78 of file StimulusRect.h.

Referenced by StimulusRect(), and v_Update().

NekDouble Nektar::StimulusRect::m_pz2
protected

Definition at line 81 of file StimulusRect.h.

Referenced by StimulusRect(), and v_Update().

NekDouble Nektar::StimulusRect::m_strength
protected

Definition at line 83 of file StimulusRect.h.

Referenced by StimulusRect(), and v_Update().