42 string AlternateSkewAdvection::className =
44 "AlternateSkew", AlternateSkewAdvection::create);
52 AlternateSkewAdvection::AlternateSkewAdvection()
65 pSession->MatchSolverInfo(
"ModeType",
"SingleMode",
m_SingleMode,
false);
66 pSession->MatchSolverInfo(
"ModeType",
"HalfMode",
m_HalfMode,
false);
70 const int nConvectiveFields,
80 int ndim = advVel.size();
81 int nPointsTot = fields[0]->GetNpoints();
83 for(
int i = 0; i < ndim; ++i)
88 fields[i]->HomogeneousBwdTrans(advVel[i],velocity[i]);
92 velocity[i] = advVel[i];
95 for(
int n = 0; n < nConvectiveFields; ++n)
109 fields[0]->PhysDeriv(inarray[n],gradV0);
110 Vmath::Vmul(nPointsTot,gradV0,1,velocity[0],1,outarray[n],1);
114 Vmath::Vmul(nPointsTot,inarray[n],1,velocity[0],1,gradV0,1);
115 fields[0]->PhysDeriv(gradV0,outarray[n]);
117 Vmath::Smul(nPointsTot,0.5,outarray[n],1,outarray[n],1);
123 fields[0]->PhysDeriv(inarray[n],gradV0,gradV1);
124 Vmath::Vmul (nPointsTot,gradV0,1,velocity[0],1,outarray[n],1);
125 Vmath::Vvtvp(nPointsTot,gradV1,1,velocity[1],1,outarray[n],1,outarray[n],1);
129 Vmath::Vmul(nPointsTot,inarray[n],1,velocity[0],1,gradV0,1);
130 Vmath::Vmul(nPointsTot,inarray[n],1,velocity[1],1,gradV1,1);
133 Vmath::Vadd(nPointsTot,tmp,1,outarray[n],1,outarray[n],1);
135 Vmath::Smul(nPointsTot,1.0,outarray[n],1,outarray[n],1);
143 if(fields[0]->GetWaveSpace() ==
true)
149 fields[0]->PhysDeriv(inarray[n],gradV0,gradV1,gradV2);
150 fields[0]->HomogeneousBwdTrans(gradV0,tmp);
151 Vmath::Vmul(nPointsTot,tmp,1,velocity[0],1,outarray[n],1);
152 fields[0]->HomogeneousBwdTrans(gradV1,tmp);
153 Vmath::Vvtvp(nPointsTot,tmp,1,velocity[1],1,outarray[n],1,outarray[n],1);
154 fields[0]->HomogeneousBwdTrans(gradV2,tmp);
155 Vmath::Vvtvp(nPointsTot,tmp,1,velocity[2],1,outarray[n],1,outarray[n],1);
160 fields[0]->HomogeneousBwdTrans(inarray[n],Up);
161 Vmath::Vmul(nPointsTot,Up,1,velocity[0],1,gradV0,1);
162 Vmath::Vmul(nPointsTot,Up,1,velocity[1],1,gradV1,1);
163 Vmath::Vmul(nPointsTot,Up,1,velocity[2],1,gradV2,1);
165 fields[0]->SetWaveSpace(
false);
168 Vmath::Vadd(nPointsTot,tmp,1,outarray[n],1,outarray[n],1);
170 Vmath::Vadd(nPointsTot,tmp,1,outarray[n],1,outarray[n],1);
171 fields[0]->SetWaveSpace(
true);
175 fields[0]->HomogeneousFwdTrans(tmp,outarray[n]);
181 fields[0]->PhysDeriv(inarray[n],gradV0,gradV1,gradV2);
182 Vmath::Vmul(nPointsTot,gradV0,1,velocity[0],1,outarray[n],1);
183 Vmath::Vvtvp(nPointsTot,gradV1,1,velocity[1],1,outarray[n],1,outarray[n],1);
184 Vmath::Vvtvp(nPointsTot,gradV2,1,velocity[2],1,outarray[n],1,outarray[n],1);
188 Vmath::Vmul(nPointsTot,inarray[n],1,velocity[0],1,gradV0,1);
189 Vmath::Vmul(nPointsTot,inarray[n],1,velocity[1],1,gradV1,1);
190 Vmath::Vmul(nPointsTot,inarray[n],1,velocity[2],1,gradV2,1);
193 Vmath::Vadd(nPointsTot,tmp,1,outarray[n],1,outarray[n],1);
195 Vmath::Vadd(nPointsTot,tmp,1,outarray[n],1,outarray[n],1);
197 Vmath::Smul(nPointsTot,1.0,outarray[n],1,outarray[n],1);
201 ASSERTL0(
false,
"dimension unknown");
#define ASSERTL0(condition, msg)
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 ~AlternateSkewAdvection()
virtual void v_InitObject(LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields)
Initialises the advection object.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
An abstract base class encapsulating the concept of advection of a vector field.
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 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.