70 pSession->MatchSolverInfo(
"ModeType",
"SingleMode",
m_SingleMode,
false);
71 pSession->MatchSolverInfo(
"ModeType",
"HalfMode",
m_HalfMode,
false);
78 const int nConvectiveFields,
88 int ndim = advVel.size();
89 int nqtot = fields[0]->GetTotPoints();
90 ASSERTL1(nConvectiveFields == inarray.size(),
91 "Number of convective fields and Inarray are not compatible");
94 for (
int i = 0; i < ndim; ++i)
99 fields[i]->HomogeneousBwdTrans(nqtot, advVel[i], velocity[i]);
103 velocity[i] = advVel[i];
107 for (
int n = 0; n < nConvectiveFields; ++n)
111 int nPointsTot = fields[0]->GetNpoints();
121 fields[0]->PhysDeriv(inarray[n], gradV0);
122 Vmath::Vmul(nPointsTot, gradV0, 1, velocity[0], 1, outarray[n],
124 Vmath::Vmul(nPointsTot, inarray[n], 1, velocity[0], 1, gradV0,
126 fields[0]->PhysDeriv(gradV0, tmp);
127 Vmath::Vadd(nPointsTot, tmp, 1, outarray[n], 1, outarray[n], 1);
128 Vmath::Smul(nPointsTot, 0.5, outarray[n], 1, outarray[n], 1);
132 fields[0]->PhysDeriv(inarray[n], gradV0, gradV1);
133 Vmath::Vmul(nPointsTot, gradV0, 1, velocity[0], 1, outarray[n],
135 Vmath::Vvtvp(nPointsTot, gradV1, 1, velocity[1], 1, outarray[n],
137 Vmath::Vmul(nPointsTot, inarray[n], 1, velocity[0], 1, gradV0,
139 Vmath::Vmul(nPointsTot, inarray[n], 1, velocity[1], 1, gradV1,
143 Vmath::Vadd(nPointsTot, tmp, 1, outarray[n], 1, outarray[n], 1);
146 Vmath::Vadd(nPointsTot, tmp, 1, outarray[n], 1, outarray[n], 1);
147 Vmath::Smul(nPointsTot, 0.5, outarray[n], 1, outarray[n], 1);
153 fields[0]->PhysDeriv(inarray[n], gradV0, gradV1, gradV2);
159 fields[0]->GetWaveSpace() ==
false)
161 fields[0]->DealiasedProd(nPointsTot, velocity[0], gradV0,
163 fields[0]->DealiasedProd(nPointsTot, velocity[1], gradV1,
165 fields[0]->DealiasedProd(nPointsTot, velocity[2], gradV2,
167 Vmath::Vadd(nPointsTot, gradV0, 1, gradV1, 1, outarray[n],
171 fields[0]->DealiasedProd(nPointsTot, inarray[n],
172 velocity[0], gradV0);
173 fields[0]->DealiasedProd(nPointsTot, inarray[n],
174 velocity[1], gradV1);
175 fields[0]->DealiasedProd(nPointsTot, inarray[n],
176 velocity[2], gradV2);
179 Vmath::Vadd(nPointsTot, tmp, 1, outarray[n], 1, outarray[n],
183 Vmath::Vadd(nPointsTot, tmp, 1, outarray[n], 1, outarray[n],
187 Vmath::Vadd(nPointsTot, tmp, 1, outarray[n], 1, outarray[n],
189 Vmath::Smul(nPointsTot, 0.5, outarray[n], 1, outarray[n],
192 else if (fields[0]->GetWaveSpace() ==
true &&
198 fields[0]->HomogeneousBwdTrans(nPointsTot, gradV0, tmp);
199 Vmath::Vmul(nPointsTot, tmp, 1, velocity[0], 1, outarray[n],
201 fields[0]->HomogeneousBwdTrans(nPointsTot, gradV1, tmp);
203 outarray[n], 1, outarray[n], 1);
204 fields[0]->HomogeneousBwdTrans(nPointsTot, gradV2, tmp);
206 outarray[n], 1, outarray[n], 1);
208 fields[0]->HomogeneousBwdTrans(nPointsTot, inarray[n], Up);
209 Vmath::Vmul(nPointsTot, Up, 1, velocity[0], 1, gradV0, 1);
210 Vmath::Vmul(nPointsTot, Up, 1, velocity[1], 1, gradV1, 1);
211 Vmath::Vmul(nPointsTot, Up, 1, velocity[2], 1, gradV2, 1);
213 fields[0]->SetWaveSpace(
false);
216 Vmath::Vadd(nPointsTot, tmp, 1, outarray[n], 1, outarray[n],
220 Vmath::Vadd(nPointsTot, tmp, 1, outarray[n], 1, outarray[n],
224 Vmath::Vadd(nPointsTot, tmp, 1, outarray[n], 1, outarray[n],
226 fields[0]->SetWaveSpace(
true);
228 Vmath::Smul(nPointsTot, 0.5, outarray[n], 1, tmp, 1);
229 fields[0]->HomogeneousFwdTrans(nPointsTot, tmp,
232 else if (fields[0]->GetWaveSpace() ==
false &&
238 outarray[n], 1, outarray[n], 1);
240 outarray[n], 1, outarray[n], 1);
241 Vmath::Vmul(nPointsTot, inarray[n], 1, velocity[0], 1,
243 Vmath::Vmul(nPointsTot, inarray[n], 1, velocity[1], 1,
245 Vmath::Vmul(nPointsTot, inarray[n], 1, velocity[2], 1,
249 Vmath::Vadd(nPointsTot, tmp, 1, outarray[n], 1, outarray[n],
253 Vmath::Vadd(nPointsTot, tmp, 1, outarray[n], 1, outarray[n],
257 Vmath::Vadd(nPointsTot, tmp, 1, outarray[n], 1, outarray[n],
259 Vmath::Smul(nPointsTot, 0.5, outarray[n], 1, outarray[n],
265 "Dealiasing is not allowed in combination "
266 "with the Skew-Symmetric advection form for "
267 "efficiency reasons.");
271 ASSERTL0(
false,
"dimension unknown");
#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.
static SolverUtils::AdvectionSharedPtr create(std::string)
Creates an instance of this class.
static std::string className
Name of class.
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) override
Advects a vector field.
~SkewSymmetricAdvection() override
bool m_homogen_dealiasing
void v_InitObject(LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields) override
Initialises the advection object.
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.
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
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 Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*x.