45 RegisterCreatorFunction(
"Body",
49 RegisterCreatorFunction(
"Field",
56 m_hasTimeFcnScaling(false)
62 const unsigned int& pNumForcingFields,
63 const TiXmlElement* pForce)
66 int nq = pFields[0]->GetTotPoints();
68 const TiXmlElement* funcNameElmt = pForce->FirstChildElement(
"BODYFORCE");
71 funcNameElmt = pForce->FirstChildElement(
"FIELDFORCE");
73 ASSERTL0(funcNameElmt,
"Requires BODYFORCE or FIELDFORCE tag "
74 "specifying function name which prescribes body force.");
77 string funcName = funcNameElmt->GetText();
79 "Function '" + funcName +
"' not defined.");
82 funcNameElmt = pForce->FirstChildElement(
"BODYFORCETIMEFCN");
85 funcNameElmt = pForce->FirstChildElement(
"FIELDFORCETIMEFCN");
91 std::string funcNameTime = funcNameElmt->GetText();
94 "Expression must be given in BODYFORCETIMEFCN or "
95 "FIELDFORCETIMEFCN.");
97 m_session->SubstituteExpressions(funcNameTime);
106 std::string s_FieldStr;
113 "Variable '" + s_FieldStr +
"' not defined.");
118 bool singleMode, halfMode;
119 m_session->MatchSolverInfo(
"ModeType",
"SingleMode",singleMode,
false);
120 m_session->MatchSolverInfo(
"ModeType",
"HalfMode", halfMode,
false);
126 if (singleMode || halfMode || homogeneous)
160 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 std::string classNameBody
Name of the class.
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
static std::string classNameField
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
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.
ForcingBody(const LibUtilities::SessionReaderSharedPtr &pSession)
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.