49 Loki::SingleThreaded> Type;
50 return Type::Instance();
61 const unsigned int& pNumForcingFields,
62 const TiXmlElement* pForce)
79 v_Apply(fields, inarray, outarray, time);
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, 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);
164 std::string pFieldName,
166 const std::string& pFunctionName,
169 ASSERTL0(pSession->DefinesFunction(pFunctionName),
170 "Function '" + pFunctionName +
"' does not exist.");
172 unsigned int nq = pFields[0]->GetNpoints();
173 if (pArray.num_elements() != nq)
179 vType = pSession->GetFunctionType(pFunctionName, pFieldName);
186 pFields[0]->GetCoords(x0, x1, x2);
188 pSession->GetFunction(pFunctionName, pFieldName);
190 ffunc->Evaluate(x0, x1, x2, pTime, pArray);
194 std::string filename = pSession->GetFunctionFilename(
198 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef;
199 std::vector<std::vector<NekDouble> > FieldData;
205 fld->Import(filename, FieldDef, FieldData);
208 for (
int i = 0; i < FieldDef.size(); ++i)
210 for (
int j = 0; j < FieldDef[i]->m_fields.size(); ++j)
212 if (FieldDef[i]->m_fields[j] == pFieldName)
220 pFields[0]->ExtractDataToCoeffs(
223 FieldDef[i]->m_fields[idx],
228 cout <<
"Field " + pFieldName +
" not found." << endl;
231 pFields[0]->BwdTrans_IterPerExp(vCoeffs, pArray);
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)
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 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.
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))
static SOLVER_UTILS_EXPORT std::vector< ForcingSharedPtr > Load(const LibUtilities::SessionReaderSharedPtr &pSession, const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const unsigned int &pNumForcingFields=0)
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
SOLVER_UTILS_EXPORT const Array< OneD, const Array< OneD, NekDouble > > & GetForces()
LibUtilities::NekFactory< std::string, Forcing, const LibUtilities::SessionReaderSharedPtr &, const Array< OneD, MultiRegions::ExpListSharedPtr > &, const unsigned int &, const TiXmlElement * > ForcingFactory
Declaration of the forcing factory.
boost::shared_ptr< FieldIO > FieldIOSharedPtr
LibUtilities::SessionReaderSharedPtr m_session
Session reader.
boost::shared_ptr< Equation > EquationSharedPtr
static boost::shared_ptr< FieldIO > CreateForFile(const LibUtilities::SessionReaderSharedPtr session, const std::string &filename)
Construct a FieldIO object for a given input filename.
virtual SOLVER_UTILS_EXPORT void v_InitObject(const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const unsigned int &pNumForcingFields, const TiXmlElement *pForce)=0
void Zero(int n, T *x, const int incx)
Zero vector.
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