47 RegisterCreatorFunction(
"Body",
51 RegisterCreatorFunction(
"Field",
55 ForcingBody::ForcingBody(
58 m_hasTimeFcnScaling(false)
64 const unsigned int& pNumForcingFields,
65 const TiXmlElement* pForce)
69 const TiXmlElement* funcNameElmt = pForce->FirstChildElement(
"BODYFORCE");
72 funcNameElmt = pForce->FirstChildElement(
"FIELDFORCE");
74 ASSERTL0(funcNameElmt,
"Requires BODYFORCE or FIELDFORCE tag "
75 "specifying function name which prescribes body force.");
82 bool singleMode, halfMode;
83 m_session->MatchSolverInfo(
"ModeType",
"SingleMode",singleMode,
false);
84 m_session->MatchSolverInfo(
"ModeType",
"HalfMode", halfMode,
false);
87 m_transform = (singleMode || halfMode || homogeneous);
90 funcNameElmt = pForce->FirstChildElement(
"BODYFORCETIMEFCN");
93 funcNameElmt = pForce->FirstChildElement(
"FIELDFORCETIMEFCN");
99 std::string funcNameTime = funcNameElmt->GetText();
102 "Expression must be given in BODYFORCETIMEFCN or "
103 "FIELDFORCETIMEFCN.");
105 m_session->SubstituteExpressions(funcNameTime);
129 std::string s_FieldStr =
m_session->GetVariable(i);
131 "Variable '" + s_FieldStr +
"' not defined.");
175 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 Update(const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
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.