47 RegisterCreatorFunction(
"Body",
51 RegisterCreatorFunction(
"Field",
55 ForcingBody::ForcingBody(
58 m_hasTimeFcnScaling(false)
64 const unsigned int& pNumForcingFields,
65 const TiXmlElement* pForce)
68 int nq = pFields[0]->GetTotPoints();
70 const TiXmlElement* funcNameElmt = pForce->FirstChildElement(
"BODYFORCE");
73 funcNameElmt = pForce->FirstChildElement(
"FIELDFORCE");
75 ASSERTL0(funcNameElmt,
"Requires BODYFORCE or FIELDFORCE tag "
76 "specifying function name which prescribes body force.");
79 string funcName = funcNameElmt->GetText();
81 "Function '" + funcName +
"' not defined.");
84 funcNameElmt = pForce->FirstChildElement(
"BODYFORCETIMEFCN");
87 funcNameElmt = pForce->FirstChildElement(
"FIELDFORCETIMEFCN");
93 std::string funcNameTime = funcNameElmt->GetText();
96 "Expression must be given in BODYFORCETIMEFCN or "
97 "FIELDFORCETIMEFCN.");
99 m_session->SubstituteExpressions(funcNameTime);
108 std::string s_FieldStr;
115 "Variable '" + s_FieldStr +
"' not defined.");
120 bool singleMode, halfMode;
121 m_session->MatchSolverInfo(
"ModeType",
"SingleMode",singleMode,
false);
122 m_session->MatchSolverInfo(
"ModeType",
"HalfMode", halfMode,
false);
128 if (singleMode || halfMode || homogeneous)
162 Vmath::Vadd(outarray[i].num_elements(), outarray[i], 1,
SOLVER_UTILS_EXPORT void EvaluateTimeFunction(LibUtilities::SessionReaderSharedPtr pSession, std::string pFieldName, Array< OneD, NekDouble > &pArray, const std::string &pFunctionName, NekDouble pTime=NekDouble(0))
Array< OneD, Array< OneD, NekDouble > > m_Forcing
Evaluated forcing function.
#define ASSERTL0(condition, msg)
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
void Svtvp(int n, const T alpha, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
svtvp (scalar times vector plus vector): z = alpha*x + y
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
LibUtilities::SessionReaderSharedPtr m_session
Session reader.
int m_NumVariable
Number of variables.
LibUtilities::EquationSharedPtr m_timeFcnEqn
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.