43 std::string NavierStokesAdvection::navierStokesAdvectionTypeLookupIds[2] = {
44 LibUtilities::SessionReader::RegisterEnumValue(
"SPECTRALHPDEALIASING",
46 LibUtilities::SessionReader::RegisterEnumValue(
"SPECTRALHPDEALIASING",
49 string NavierStokesAdvection::className =
51 "Convective", NavierStokesAdvection::create,
"Convective");
52 string NavierStokesAdvection::className2 =
54 "NonConservative", NavierStokesAdvection::create,
"NonConserviative");
63 NavierStokesAdvection::NavierStokesAdvection() :
Advection()
78 pSession->MatchSolverInfo(
"SPECTRALHPDEALIASING",
"True",
80 pSession->MatchSolverInfo(
"ModeType",
"SingleMode",
m_SingleMode,
false);
81 pSession->MatchSolverInfo(
"ModeType",
"HalfMode",
m_HalfMode,
false);
87 const int nConvectiveFields,
95 int nqtot = fields[0]->GetTotPoints();
96 ASSERTL1(nConvectiveFields == inarray.size(),
97 "Number of convective fields and Inarray are not compatible");
100 int ndim = advVel.size();
107 for (
int i = 0; i < ndim; ++i)
113 fields[i]->HomogeneousBwdTrans(advVel[i], velocity[i]);
117 velocity[i] = advVel[i];
121 int nPointsTot = fields[0]->GetNpoints();
129 nPointsTot = fields[0]->Get1DScaledTotPoints(OneDptscale);
135 for (
int i = 0; i < ndim; ++i)
140 fields[0]->PhysInterp1DScaled(OneDptscale, velocity[i], AdvVel[i]);
147 for (
int i = 0; i < ndim; ++i)
149 AdvVel[i] = velocity[i];
160 for (
int n = 0; n < nConvectiveFields; ++n)
162 fields[0]->PhysDeriv(inarray[n], grad0);
166 fields[0]->PhysInterp1DScaled(OneDptscale, grad0, wkSp);
167 Vmath::Vmul(nPointsTot, wkSp, 1, AdvVel[0], 1, Outarray, 1);
170 fields[0]->PhysGalerkinProjection1DScaled(
171 OneDptscale, Outarray, outarray[n]);
177 Vmath::Vmul(nPointsTot, grad0, 1, AdvVel[0], 1, outarray[n],
185 for (
int n = 0; n < nConvectiveFields; ++n)
187 fields[0]->PhysDeriv(inarray[n], grad0, grad1);
192 fields[0]->PhysInterp1DScaled(OneDptscale, grad0, wkSp);
193 Vmath::Vmul(nPointsTot, wkSp, 1, AdvVel[0], 1, Outarray, 1);
195 fields[0]->PhysInterp1DScaled(OneDptscale, grad1, wkSp);
198 Vmath::Vvtvp(nPointsTot, wkSp, 1, AdvVel[1], 1, Outarray, 1,
202 fields[0]->PhysGalerkinProjection1DScaled(
203 OneDptscale, Outarray, outarray[n]);
209 Vmath::Vmul(nPointsTot, grad0, 1, AdvVel[0], 1, outarray[n],
212 outarray[n], 1, outarray[n], 1);
221 ndim * nConvectiveFields);
223 for (
int i = 0; i < ndim; i++)
227 for (
int i = 0; i < ndim * nConvectiveFields; i++)
231 for (
int i = 0; i < nConvectiveFields; i++)
236 for (
int n = 0; n < nConvectiveFields; n++)
238 fields[0]->PhysDeriv(inarray[n], grad[0], grad[1], grad[2]);
239 for (
int i = 0; i < ndim; i++)
242 fields[0]->PhysInterp1DScaled(OneDptscale, grad[i],
243 gradScaled[n * ndim + i]);
249 fields[0]->DealiasedDotProd(AdvVel, gradScaled, Outarray);
252 for (
int n = 0; n < nConvectiveFields; n++)
254 fields[0]->PhysGalerkinProjection1DScaled(
255 OneDptscale, Outarray[n], outarray[n]);
266 for (
int i = 0; i < ndim * nConvectiveFields; i++)
270 for (
int i = 0; i < nConvectiveFields; i++)
275 for (
int n = 0; n < nConvectiveFields; n++)
277 fields[0]->PhysDeriv(inarray[n], grad[n * ndim + 0],
282 fields[0]->DealiasedDotProd(AdvVel, grad, outarray);
290 for (
int n = 0; n < nConvectiveFields; ++n)
292 if (fields[0]->GetWaveSpace() ==
true &&
295 fields[0]->HomogeneousBwdTrans(inarray[n], tmp);
296 fields[0]->PhysDeriv(tmp, grad0, grad1);
299 inarray[n], outarray[n]);
300 fields[0]->HomogeneousBwdTrans(outarray[n], grad2);
302 else if (fields[0]->GetWaveSpace() ==
true &&
305 fields[0]->HomogeneousBwdTrans(inarray[n], tmp);
306 fields[0]->PhysDeriv(tmp, grad0);
309 inarray[n], outarray[n]);
310 fields[0]->HomogeneousBwdTrans(outarray[n], grad1);
313 inarray[n], outarray[n]);
314 fields[0]->HomogeneousBwdTrans(outarray[n], grad2);
318 fields[0]->PhysDeriv(inarray[n], grad0, grad1, grad2);
325 fields[0]->PhysInterp1DScaled(OneDptscale, grad0, wkSp);
328 Vmath::Vmul(nPointsTot, wkSp, 1, AdvVel[0], 1, Outarray,
332 fields[0]->PhysInterp1DScaled(OneDptscale, grad1, wkSp);
336 Outarray, 1, Outarray, 1);
339 fields[0]->PhysInterp1DScaled(OneDptscale, grad2, wkSp);
343 Outarray, 1, Outarray, 1);
345 fields[0]->PhysGalerkinProjection1DScaled(
346 OneDptscale, Outarray, outarray[n]);
355 outarray[n], 1, outarray[n], 1);
357 outarray[n], 1, outarray[n], 1);
360 if (fields[0]->GetWaveSpace() ==
true)
362 fields[0]->HomogeneousFwdTrans(outarray[n],
369 ASSERTL0(
false,
"dimension unknown");
372 for (
int n = 0; n < nConvectiveFields; ++n)
#define ASSERTL0(condition, msg)
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
void AccumulateRegion(std::string, int iolevel=0)
Accumulate elapsed time for a region.
virtual void v_Advect(const int nConvectiveFields, const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble >> &advVel, const Array< OneD, Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray, const NekDouble &time, const Array< OneD, Array< OneD, NekDouble >> &pFwd=NullNekDoubleArrayOfArray, const Array< OneD, Array< OneD, NekDouble >> &pBwd=NullNekDoubleArrayOfArray)
Advects a vector field.
virtual void v_InitObject(LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields)
Initialises the advection object.
bool m_homogen_dealiasing
virtual ~NavierStokesAdvection()
An abstract base class encapsulating the concept of advection of a vector field.
virtual SOLVER_UTILS_EXPORT void v_InitObject(LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields)
Initialises the advection object.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
MultiRegions::Direction const DirCartesianMap[]
AdvectionFactory & GetAdvectionFactory()
Gets the factory for initialising advection objects.
The above copyright notice and this permission notice shall be included.
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
void Neg(int n, T *x, const int incx)
Negate x = -x.
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y