Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions | Friends | List of all members
Nektar::SolverUtils::ForcingBody Class Reference

#include <ForcingBody.h>

Inheritance diagram for Nektar::SolverUtils::ForcingBody:
Inheritance graph
[legend]
Collaboration diagram for Nektar::SolverUtils::ForcingBody:
Collaboration graph
[legend]

Static Public Member Functions

static SOLVER_UTILS_EXPORT
ForcingSharedPtr 
create (const LibUtilities::SessionReaderSharedPtr &pSession, const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const unsigned int &pNumForcingFields, const TiXmlElement *pForce)
 Creates an instance of this class.
- Static Public Member Functions inherited from Nektar::SolverUtils::Forcing
static SOLVER_UTILS_EXPORT
std::vector< ForcingSharedPtr
Load (const LibUtilities::SessionReaderSharedPtr &pSession, const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const unsigned int &pNumForcingFields=0)

Static Public Attributes

static std::string className
 Name of the class.

Protected Member Functions

virtual SOLVER_UTILS_EXPORT void v_InitObject (const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const unsigned int &pNumForcingFields, const TiXmlElement *pForce)
virtual SOLVER_UTILS_EXPORT void v_Apply (const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble &time)
- Protected Member Functions inherited from Nektar::SolverUtils::Forcing
SOLVER_UTILS_EXPORT Forcing (const LibUtilities::SessionReaderSharedPtr &)
 Constructor.
void EvaluateFunction (Array< OneD, MultiRegions::ExpListSharedPtr > pFields, LibUtilities::SessionReaderSharedPtr pSession, std::string pFieldName, Array< OneD, NekDouble > &pArray, const std::string &pFunctionName, NekDouble pTime=NekDouble(0))
void EvaluateTimeFunction (LibUtilities::SessionReaderSharedPtr pSession, std::string pFieldName, Array< OneD, NekDouble > &pArray, const std::string &pFunctionName, NekDouble pTime=NekDouble(0))

Private Member Functions

 ForcingBody (const LibUtilities::SessionReaderSharedPtr &pSession)

Friends

class MemoryManager< ForcingBody >

Additional Inherited Members

- Public Member Functions inherited from Nektar::SolverUtils::Forcing
SOLVER_UTILS_EXPORT void InitObject (const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const unsigned int &pNumForcingFields, const TiXmlElement *pForce)
 Initialise the forcing object.
SOLVER_UTILS_EXPORT void Apply (const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble &time)
 Apply the forcing.
- Protected Attributes inherited from Nektar::SolverUtils::Forcing
LibUtilities::SessionReaderSharedPtr m_session
 Session reader.
Array< OneD, Array< OneD,
NekDouble > > 
m_Forcing
 Evaluated forcing function.
int m_NumVariable
 Number of variables.

Detailed Description

Definition at line 51 of file ForcingBody.h.

Constructor & Destructor Documentation

Nektar::SolverUtils::ForcingBody::ForcingBody ( const LibUtilities::SessionReaderSharedPtr pSession)
private

Definition at line 49 of file ForcingBody.cpp.

: Forcing(pSession)
{
}

Member Function Documentation

static SOLVER_UTILS_EXPORT ForcingSharedPtr Nektar::SolverUtils::ForcingBody::create ( const LibUtilities::SessionReaderSharedPtr pSession,
const Array< OneD, MultiRegions::ExpListSharedPtr > &  pFields,
const unsigned int &  pNumForcingFields,
const TiXmlElement *  pForce 
)
inlinestatic

Creates an instance of this class.

Definition at line 58 of file ForcingBody.h.

References Nektar::SolverUtils::ForcingSharedPtr.

{
p->InitObject(pFields, pNumForcingFields, pForce);
return p;
}
void Nektar::SolverUtils::ForcingBody::v_Apply ( const Array< OneD, MultiRegions::ExpListSharedPtr > &  fields,
const Array< OneD, Array< OneD, NekDouble > > &  inarray,
Array< OneD, Array< OneD, NekDouble > > &  outarray,
const NekDouble time 
)
protectedvirtual

Implements Nektar::SolverUtils::Forcing.

Definition at line 110 of file ForcingBody.cpp.

References Nektar::SolverUtils::Forcing::m_Forcing, Nektar::SolverUtils::Forcing::m_NumVariable, and Vmath::Vadd().

{
for (int i = 0; i < m_NumVariable; i++)
{
Vmath::Vadd(outarray[i].num_elements(), outarray[i], 1,
m_Forcing[i], 1, outarray[i], 1);
}
}
void Nektar::SolverUtils::ForcingBody::v_InitObject ( const Array< OneD, MultiRegions::ExpListSharedPtr > &  pFields,
const unsigned int &  pNumForcingFields,
const TiXmlElement *  pForce 
)
protectedvirtual

Implements Nektar::SolverUtils::Forcing.

Definition at line 55 of file ForcingBody.cpp.

References ASSERTL0, Nektar::SolverUtils::Forcing::EvaluateFunction(), Nektar::SolverUtils::Forcing::m_Forcing, Nektar::SolverUtils::Forcing::m_NumVariable, and Nektar::SolverUtils::Forcing::m_session.

{
m_NumVariable = pNumForcingFields;
int nq = pFields[0]->GetTotPoints();
const TiXmlElement* funcNameElmt = pForce->FirstChildElement("BODYFORCE");
ASSERTL0(funcNameElmt, "Requires BODYFORCE tag specifying function "
"name which prescribes body force.");
string funcName = funcNameElmt->GetText();
ASSERTL0(m_session->DefinesFunction(funcName),
"Function '" + funcName + "' not defined.");
bool singleMode, halfMode;
m_session->MatchSolverInfo("ModeType", "SingleMode", singleMode, false);
m_session->MatchSolverInfo("ModeType", "HalfMode", halfMode, false);
m_Forcing = Array<OneD, Array<OneD, NekDouble> > (m_NumVariable);
std::string s_FieldStr;
for (int i = 0; i < m_NumVariable; ++i)
{
m_Forcing[i] = Array<OneD, NekDouble> (nq, 0.0);
s_FieldStr = m_session->GetVariable(i);
ASSERTL0(m_session->DefinesFunction(funcName, s_FieldStr),
"Variable '" + s_FieldStr + "' not defined.");
EvaluateFunction(pFields, m_session, s_FieldStr,
m_Forcing[i], funcName);
}
// If singleMode or halfMode, transform the forcing term to be in
// physical space in the plane, but Fourier space in the homogeneous
// direction
if (singleMode || halfMode)
{
// Temporary array
Array<OneD, NekDouble> forcingCoeff(pFields[0]->GetNcoeffs(), 0.0);
bool w = pFields[0]->GetWaveSpace();
for (int i = 0; i < m_NumVariable; ++i)
{
// FwdTrans in SEM and Fourier
pFields[0]->SetWaveSpace(false);
pFields[0]->FwdTrans_IterPerExp(m_Forcing[i], forcingCoeff);
// BwdTrans in SEM only
pFields[0]->SetWaveSpace(true);
pFields[0]->BwdTrans(forcingCoeff, m_Forcing[i]);
}
pFields[0]->SetWaveSpace(w);
}
}

Friends And Related Function Documentation

friend class MemoryManager< ForcingBody >
friend

Definition at line 55 of file ForcingBody.h.

Member Data Documentation

std::string Nektar::SolverUtils::ForcingBody::className
static
Initial value:
RegisterCreatorFunction("Body",
"Body Forcing")

Name of the class.

Definition at line 71 of file ForcingBody.h.