45 RegisterCreatorFunction(
"Body",
57 const unsigned int& pNumForcingFields,
58 const TiXmlElement* pForce)
61 int nq = pFields[0]->GetTotPoints();
63 const TiXmlElement* funcNameElmt = pForce->FirstChildElement(
"BODYFORCE");
64 ASSERTL0(funcNameElmt,
"Requires BODYFORCE tag specifying function "
65 "name which prescribes body force.");
67 string funcName = funcNameElmt->GetText();
69 "Function '" + funcName +
"' not defined.");
71 bool singleMode, halfMode;
72 m_session->MatchSolverInfo(
"ModeType",
"SingleMode", singleMode,
false);
73 m_session->MatchSolverInfo(
"ModeType",
"HalfMode", halfMode,
false);
76 std::string s_FieldStr;
82 "Variable '" + s_FieldStr +
"' not defined.");
92 if (singleMode || halfMode || homogeneous)
97 bool w = pFields[0]->GetWaveSpace();
101 pFields[0]->SetWaveSpace(
false);
102 pFields[0]->FwdTrans_IterPerExp(
m_Forcing[i], forcingCoeff);
104 pFields[0]->SetWaveSpace(
true);
105 pFields[0]->BwdTrans(forcingCoeff,
m_Forcing[i]);
107 pFields[0]->SetWaveSpace(w);
120 Vmath::Vadd(outarray[i].num_elements(), outarray[i], 1,
Array< OneD, Array< OneD, NekDouble > > m_Forcing
Evaluated forcing function.
#define ASSERTL0(condition, msg)
ForcingFactory & GetForcingFactory()
Declaration of the forcing factory singleton.
SOLVER_UTILS_EXPORT 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))
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
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 std::string className
Name of the class.
ForcingBody(const LibUtilities::SessionReaderSharedPtr &pSession)
LibUtilities::SessionReaderSharedPtr m_session
Session reader.
int m_NumVariable
Number of variables.
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)
virtual SOLVER_UTILS_EXPORT void v_InitObject(const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const unsigned int &pNumForcingFields, const TiXmlElement *pForce)
Defines a forcing term to be explicitly applied.
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.