49 const std::weak_ptr<EquationSystem> &pEquation)
50 : m_session(pSession), m_equ(pEquation)
56 const unsigned int &pNumForcingFields,
const TiXmlElement *pForce)
71 v_Apply(fields, inarray, outarray, time);
88 if (&inarray != &outarray)
90 int nvar = std::min(inarray.size(), outarray.size());
91 for (
int i = 0; i < nvar; ++i)
93 if (&inarray[i] != &outarray[i])
95 int np = std::min(inarray[i].size(), outarray[i].size());
120 const std::weak_ptr<EquationSystem> &pEquation,
122 const unsigned int &pNumForcingFields)
124 vector<ForcingSharedPtr> vForceList;
126 if (!pSession->DefinesElement(
"Nektar/Forcing"))
131 TiXmlElement *vForcing = pSession->GetElement(
"Nektar/Forcing");
134 unsigned int vNumForcingFields = pNumForcingFields;
135 if (!pNumForcingFields)
137 vNumForcingFields = pFields.size();
140 TiXmlElement *vForce = vForcing->FirstChildElement(
"FORCE");
143 string vType = vForce->Attribute(
"TYPE");
145 TiXmlElement *vForceParam = vForce;
147 vForceParam, pSession->GetTimeLevel(),
false);
149 vType, pSession, pEquation, pFields, vNumForcingFields,
152 vForce = vForce->NextSiblingElement(
"FORCE");
173 ASSERTL0(pSession->DefinesFunction(pFunctionName),
174 "Function '" + pFunctionName +
"' does not exist.");
177 pSession->GetFunction(pFunctionName, pFieldName);
189 pEqn->Evaluate(x0, x0, x0, pTime, pArray);
205 pSession, pFields[0], pName, pCache);
223 ASSERTL0(
false,
"v_ApplyCoeff not defined");
#define ASSERTL0(condition, msg)
Provides a generic Factory class.
static void GetXMLElementTimeLevel(TiXmlElement *&element, const size_t timeLevel, const bool enableCheck=true)
Get XML elment time level (Parallel-in-Time)
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
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
virtual SOLVER_UTILS_EXPORT void v_PreApply(const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble &time)
Array< OneD, Array< OneD, NekDouble > > m_Forcing
Evaluated forcing function.
virtual SOLVER_UTILS_EXPORT void v_InitObject(const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const unsigned int &pNumForcingFields, const TiXmlElement *pForce)=0
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.
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 void InitObject(const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const unsigned int &pNumForcingFields, const TiXmlElement *pForce)
Initialise the forcing object.
SOLVER_UTILS_EXPORT Array< OneD, Array< OneD, NekDouble > > & UpdateForces()
SOLVER_UTILS_EXPORT void ApplyCoeff(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 const Array< OneD, const Array< OneD, NekDouble > > & GetForces()
std::map< std::string, SolverUtils::SessionFunctionSharedPtr > m_sessionFunctions
Map of known SessionFunctions.
SOLVER_UTILS_EXPORT void EvaluateTimeFunction(LibUtilities::SessionReaderSharedPtr pSession, std::string pFieldName, Array< OneD, NekDouble > &pArray, const std::string &pFunctionName, NekDouble pTime=NekDouble(0))
SOLVER_UTILS_EXPORT void PreApply(const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble &time)
Change the advection velocity before applying the forcing. For example, subtracting the frame velocit...
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 Forcing(const LibUtilities::SessionReaderSharedPtr &pSession, const std::weak_ptr< EquationSystem > &pEquation)
Constructor.
virtual SOLVER_UTILS_EXPORT void v_ApplyCoeff(const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble &time)
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< Equation > EquationSharedPtr
ForcingFactory & GetForcingFactory()
Declaration of the forcing factory singleton.
std::shared_ptr< SessionFunction > SessionFunctionSharedPtr
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)