65 const std::weak_ptr<EquationSystem> &pEquation)
82 [[maybe_unused]]
const unsigned int &pNumForcingFields,
83 [[maybe_unused]]
const TiXmlElement *pForce)
87 bool singleMode, halfMode;
88 m_session->MatchSolverInfo(
"ModeType",
"SingleMode", singleMode,
false);
89 m_session->MatchSolverInfo(
"ModeType",
"HalfMode", halfMode,
false);
90 if (singleMode || halfMode)
94 int expdim =
m_isH2d ? 1 : pFields[0]->GetGraph()->GetMeshDimension();
120 int npoints = fields[0]->GetNpoints();
121 addRotation(npoints, outarray, -1., inarray, outarray);
134 ASSERTL0(&inarray1 != &outarray,
"inarray1 and outarray "
135 "should not be the same.");
142 if (&inarray0 != &outarray)
144 ASSERTL0(inarray0.size() == outarray.size(),
145 "inarray0 and outarray must have same dimentions");
146 for (
int i = 0; i < inarray0.size(); ++i)
157 Vmath::Svtvp(nPnts, cm, inarray1[1], 1, outarray[0], 1, outarray[0], 1);
158 Vmath::Svtvp(nPnts, cp, inarray1[0], 1, outarray[1], 1, outarray[1], 1);
166 Vmath::Svtvp(nPnts, cp, inarray1[1], 1, outarray[2], 1, outarray[2], 1);
167 Vmath::Svtvp(nPnts, cm, inarray1[2], 1, outarray[1], 1, outarray[1], 1);
175 Vmath::Svtvp(nPnts, cp, inarray1[2], 1, outarray[0], 1, outarray[0], 1);
176 Vmath::Svtvp(nPnts, cm, inarray1[0], 1, outarray[2], 1, outarray[2], 1);
190 int npoints = fields[0]->GetNpoints();
191 if (
m_isH2d && fields[0]->GetWaveSpace())
199 fields[0]->HomogeneousFwdTrans(npoints, tmpphys, tmpcoef);
200 Vmath::Vadd(npoints, tmpcoef, 1, inarray[i], 1, outarray[i], 1);
202 else if (&inarray != &outarray)
210 int npoints0 = npoints;
211 if (
m_isH1d && fields[0]->GetWaveSpace())
213 npoints0 =
m_hasPlane0 ? fields[0]->GetPlane(0)->GetNpoints() : 0;
221 if (&inarray != &outarray && npoints != npoints0)
224 Vmath::Vcopy(npoints - npoints0, inarray[i] + npoints0, 1,
228 else if (&inarray != &outarray)
254 auto equ =
m_equ.lock();
255 ASSERTL0(equ,
"Weak pointer to the equation system is expired");
256 m_FluidEq = std::dynamic_pointer_cast<FluidInterface>(equ);
258 std::set<int> moveDoFs;
260 for (
int i = 0; i < 3; ++i)
262 if (moveDoFs.find(i) != moveDoFs.end())
266 if (moveDoFs.find(i + 3) != moveDoFs.end())
276 for (
int i = 0; i < 3; ++i)
288 int npoints = field->GetNpoints();
304 m_FluidEq->GetMovingFrameVelocities(vel);
#define ASSERTL0(condition, msg)
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
Defines a forcing term to be explicitly applied.
const std::weak_ptr< EquationSystem > m_equ
Weak pointer to equation system using this forcing.
LibUtilities::SessionReaderSharedPtr m_session
Session reader.
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) override
Compute the moving frame velocity at given time.
void UpdateMRFStatus(MultiRegions::ExpListSharedPtr field)
Array< OneD, NekDouble > m_velxyz
static std::string classNameBody
Name of the class.
Array< OneD, bool > m_hasVel
std::shared_ptr< Nektar::SolverUtils::FluidInterface > m_FluidEq
~ForcingMovingReferenceFrame(void) override
void addRotation(int npoints, const Array< OneD, Array< OneD, NekDouble > > &inarray0, NekDouble angVelScale, const Array< OneD, Array< OneD, NekDouble > > &inarray1, Array< OneD, Array< OneD, NekDouble > > &outarray)
outarray = inarray0 + angVelScale Omega x inarray1
ForcingMovingReferenceFrame(const LibUtilities::SessionReaderSharedPtr &pSession, const std::weak_ptr< EquationSystem > &pEquation)
Array< OneD, NekDouble > m_omegaxyz
Array< OneD, NekDouble > m_pivotPoint
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) override
Adds the body force, -Omega X u.
SOLVER_UTILS_EXPORT void v_InitObject(const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const unsigned int &pNumForcingFields, const TiXmlElement *pForce) override
Initialise the forcing module.
static SOLVER_UTILS_EXPORT ForcingSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const std::weak_ptr< EquationSystem > &pEquation, const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const unsigned int &pNumForcingFields, const TiXmlElement *pForce)
Creates an instance of this class.
Array< OneD, bool > m_hasOmega
Array< OneD, Array< OneD, NekDouble > > m_coords
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
ForcingFactory & GetForcingFactory()
Declaration of the forcing factory singleton.
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.
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.
void Sadd(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Add vector y = alpha + x.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)