52 const std::weak_ptr<EquationSystem> &pEquation)
53 : m_session(pSession), m_equ(pEquation)
60 const unsigned int& pNumForcingFields,
61 const TiXmlElement* pForce)
78 v_Apply(fields, inarray, outarray, time);
87 const std::weak_ptr<EquationSystem> &pEquation,
89 const unsigned int& pNumForcingFields)
91 vector<ForcingSharedPtr> vForceList;
93 if (!pSession->DefinesElement(
"Nektar/Forcing"))
98 TiXmlElement* vForcing = pSession->GetElement(
"Nektar/Forcing");
101 unsigned int vNumForcingFields = pNumForcingFields;
102 if (!pNumForcingFields)
104 vNumForcingFields = pFields.num_elements();
107 TiXmlElement* vForce = vForcing->FirstChildElement(
"FORCE");
110 string vType = vForce->Attribute(
"TYPE");
113 vType, pSession, pEquation, pFields,
114 vNumForcingFields, vForce));
115 vForce = vForce->NextSiblingElement(
"FORCE");
133 std::string pFieldName,
135 const std::string& pFunctionName,
138 ASSERTL0(pSession->DefinesFunction(pFunctionName),
139 "Function '" + pFunctionName +
"' does not exist.");
142 pSession->GetFunction(pFunctionName, pFieldName);
156 pEqn->Evaluate(x0, x0, x0, pTime, pArray);
174 pSession, pFields[0], pName, pCache);
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)
std::map< std::string, SolverUtils::SessionFunctionSharedPtr > m_sessionFunctions
Map of known SessionFunctions.
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 SessionFunctionSharedPtr GetFunction(const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const LibUtilities::SessionReaderSharedPtr &pSession, std::string pName, bool pCache=false)
Get a SessionFunction by name.
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.
SOLVER_UTILS_EXPORT Array< OneD, Array< OneD, NekDouble > > & UpdateForces()
ForcingFactory & GetForcingFactory()
Declaration of the forcing factory singleton.
static SOLVER_UTILS_EXPORT std::vector< ForcingSharedPtr > Load(const LibUtilities::SessionReaderSharedPtr &pSession, const std::weak_ptr< EquationSystem > &pEquation, const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const unsigned int &pNumForcingFields=0)
SOLVER_UTILS_EXPORT const Array< OneD, const Array< OneD, NekDouble > > & GetForces()
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
std::shared_ptr< Equation > EquationSharedPtr
virtual SOLVER_UTILS_EXPORT void v_InitObject(const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const unsigned int &pNumForcingFields, const TiXmlElement *pForce)=0
std::shared_ptr< SessionFunction > SessionFunctionSharedPtr
std::shared_ptr< SessionReader > SessionReaderSharedPtr
Provides a generic Factory class.
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)=0