36 #include <boost/core/ignore_unused.hpp> 50 RegisterCreatorFunction(
"MovingReferenceFrame",
51 ForcingMovingReferenceFrame::create,
54 RegisterCreatorFunction(
"Field",
55 ForcingMovingReferenceFrame::create,
63 ForcingMovingReferenceFrame::ForcingMovingReferenceFrame(
65 const std::weak_ptr<EquationSystem> &pEquation)
79 const unsigned int &pNumForcingFields,
80 const TiXmlElement *pForce)
82 boost::ignore_unused(pNumForcingFields);
84 int npoints = pFields[0]->GetNpoints();
85 int expdim = pFields[0]->GetGraph()->GetMeshDimension();
88 m_session->MatchSolverInfo(
"Homogeneous",
"1D", isH1d,
false);
89 m_session->MatchSolverInfo(
"Homogeneous",
"2D", isH2d,
false);
90 m_spacedim = expdim + (isH1d ? 1 : 0) + (isH2d ? 2 : 0);
93 const TiXmlElement *funcNameElmt = pForce->FirstChildElement(
95 ASSERTL0(funcNameElmt,
"Requires FRAMEVELOCITY tag specifying function " 96 "name which prescribes velocity of the moving " 101 "Function '" +
m_funcName +
"' not defined.");
117 std::string s_FieldStr =
m_session->GetVariable(i);
120 "Variable '" + s_FieldStr +
"' not defined.");
122 m_frameVelocity[i] = ep->Evaluate();
126 for (
int i = 0; i < m_spacedim *
m_spacedim; ++i)
142 int npoints = pFields[0]->GetNpoints();
150 pFields[0]->PhysDeriv(pFields[0]->GetPhys(),
m_grad[0]);
154 pFields[0]->PhysDeriv(pFields[0]->GetPhys(),
m_grad[0],
157 pFields[1]->PhysDeriv(pFields[1]->GetPhys(),
m_grad[2],
161 if (pFields[0]->GetWaveSpace() ==
true &&
165 pFields[0]->PhysDeriv(pFields[0]->GetPhys(),
167 pFields[1]->PhysDeriv(pFields[1]->GetPhys(),
170 pFields[0]->HomogeneousBwdTrans(pFields[2]->GetPhys(),
172 pFields[0]->PhysDeriv(tmp,
m_grad[6],
177 pFields[0]->GetPhys(), tmp);
178 pFields[0]->HomogeneousBwdTrans(tmp,
m_grad[2]);
180 pFields[1]->GetPhys(), tmp);
181 pFields[0]->HomogeneousBwdTrans(tmp,
m_grad[5]);
183 pFields[2]->GetPhys(), tmp);
184 pFields[0]->HomogeneousBwdTrans(tmp,
m_grad[8]);
186 else if (pFields[0]->GetWaveSpace() ==
true &&
190 pFields[0]->PhysDeriv(pFields[0]->GetPhys(),
192 pFields[1]->PhysDeriv(pFields[1]->GetPhys(),
195 pFields[0]->HomogeneousBwdTrans(pFields[2]->GetPhys(),
197 pFields[0]->PhysDeriv(tmp,
m_grad[6]);
201 pFields[0]->GetPhys(), tmp);
202 pFields[0]->HomogeneousBwdTrans(tmp,
m_grad[1]);
204 pFields[1]->GetPhys(), tmp);
205 pFields[0]->HomogeneousBwdTrans(tmp,
m_grad[4]);
207 pFields[2]->GetPhys(), tmp);
208 pFields[0]->HomogeneousBwdTrans(tmp,
m_grad[7]);
212 pFields[0]->GetPhys(), tmp);
213 pFields[0]->HomogeneousBwdTrans(tmp,
m_grad[2]);
215 pFields[1]->GetPhys(), tmp);
216 pFields[0]->HomogeneousBwdTrans(tmp,
m_grad[5]);
218 pFields[2]->GetPhys(), tmp);
219 pFields[0]->HomogeneousBwdTrans(tmp,
m_grad[8]);
223 pFields[0]->PhysDeriv(pFields[0]->GetPhys(),
226 pFields[1]->PhysDeriv(pFields[1]->GetPhys(),
229 pFields[2]->PhysDeriv(pFields[2]->GetPhys(),
235 ASSERTL0(
false,
"dimension unknown");
250 boost::ignore_unused(time);
252 int npoints = pFields[0]->GetNpoints();
317 ASSERTL0(
false,
"dimension unknown");
346 boost::ignore_unused(inarray);
352 Vmath::Vadd(outarray[i].num_elements(), outarray[i], 1,
void CalculateGradient(const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields)
Calculates the gradient of the velocity fields.
Array< OneD, Array< OneD, NekDouble > > m_Forcing
Evaluated forcing function.
#define ASSERTL0(condition, msg)
void Update(const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
Updates the forcing array with the current required forcing.
virtual SOLVER_UTILS_EXPORT void v_InitObject(const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const unsigned int &pNumForcingFields, const TiXmlElement *pForce)
Initialise the forcing module.
ForcingFactory & GetForcingFactory()
Declaration of the forcing factory singleton.
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
Array< OneD, Array< OneD, NekDouble > > m_grad
LibUtilities::SessionReaderSharedPtr m_session
Session reader.
MultiRegions::Direction const DirCartesianMap[]
int m_NumVariable
Number of variables.
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)
Apply the forcing term.
bool m_homogen_dealiasing
Array< OneD, NekDouble > m_frameVelocity
Defines a forcing term to be explicitly applied.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
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.