43 string AlternateSkewAdvection::className =
45 "AlternateSkew", AlternateSkewAdvection::create);
53 AlternateSkewAdvection::AlternateSkewAdvection()
69 const int nConvectiveFields,
76 for(
int n = 0; n < nConvectiveFields; ++n)
79 int ndim = advVel.num_elements();
83 int nPointsTot = fields[0]->GetNpoints();
95 fields[0]->PhysDeriv(inarray[n],gradV0);
96 Vmath::Vmul(nPointsTot,gradV0,1,advVel[0],1,outarray[n],1);
100 Vmath::Vmul(nPointsTot,inarray[n],1,advVel[0],1,gradV0,1);
101 fields[0]->PhysDeriv(gradV0,outarray[n]);
103 Vmath::Smul(nPointsTot,0.5,outarray[n],1,outarray[n],1);
109 fields[0]->PhysDeriv(inarray[n],gradV0,gradV1);
110 Vmath::Vmul (nPointsTot,gradV0,1,advVel[0],1,outarray[n],1);
111 Vmath::Vvtvp(nPointsTot,gradV1,1,advVel[1],1,outarray[n],1,outarray[n],1);
115 Vmath::Vmul(nPointsTot,inarray[n],1,advVel[0],1,gradV0,1);
116 Vmath::Vmul(nPointsTot,inarray[n],1,advVel[1],1,gradV1,1);
119 Vmath::Vadd(nPointsTot,tmp,1,outarray[n],1,outarray[n],1);
121 Vmath::Smul(nPointsTot,1.0,outarray[n],1,outarray[n],1);
129 if(fields[0]->GetWaveSpace() ==
true)
135 fields[0]->PhysDeriv(inarray[n],gradV0,gradV1,gradV2);
136 fields[0]->HomogeneousBwdTrans(gradV0,tmp);
137 Vmath::Vmul(nPointsTot,tmp,1,advVel[0],1,outarray[n],1);
138 fields[0]->HomogeneousBwdTrans(gradV1,tmp);
139 Vmath::Vvtvp(nPointsTot,tmp,1,advVel[1],1,outarray[n],1,outarray[n],1);
140 fields[0]->HomogeneousBwdTrans(gradV2,tmp);
141 Vmath::Vvtvp(nPointsTot,tmp,1,advVel[2],1,outarray[n],1,outarray[n],1);
146 fields[0]->HomogeneousBwdTrans(inarray[n],Up);
151 fields[0]->SetWaveSpace(
false);
154 Vmath::Vadd(nPointsTot,tmp,1,outarray[n],1,outarray[n],1);
156 Vmath::Vadd(nPointsTot,tmp,1,outarray[n],1,outarray[n],1);
157 fields[0]->SetWaveSpace(
true);
161 fields[0]->HomogeneousFwdTrans(tmp,outarray[n]);
167 fields[0]->PhysDeriv(inarray[n],gradV0,gradV1,gradV2);
168 Vmath::Vmul(nPointsTot,gradV0,1,advVel[0],1,outarray[n],1);
169 Vmath::Vvtvp(nPointsTot,gradV1,1,advVel[1],1,outarray[n],1,outarray[n],1);
170 Vmath::Vvtvp(nPointsTot,gradV2,1,advVel[2],1,outarray[n],1,outarray[n],1);
174 Vmath::Vmul(nPointsTot,inarray[n],1,advVel[0],1,gradV0,1);
175 Vmath::Vmul(nPointsTot,inarray[n],1,advVel[1],1,gradV1,1);
176 Vmath::Vmul(nPointsTot,inarray[n],1,advVel[2],1,gradV2,1);
179 Vmath::Vadd(nPointsTot,tmp,1,outarray[n],1,outarray[n],1);
181 Vmath::Vadd(nPointsTot,tmp,1,outarray[n],1,outarray[n],1);
183 Vmath::Smul(nPointsTot,1.0,outarray[n],1,outarray[n],1);
187 ASSERTL0(
false,
"dimension unknown");
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)
Advects a vector field.
#define ASSERTL0(condition, msg)
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
virtual void v_InitObject(LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields)
Initialises the advection object.
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
AdvectionFactory & GetAdvectionFactory()
Gets the factory for initialising advection objects.
virtual ~AlternateSkewAdvection()
MultiRegions::Direction const DirCartesianMap[]
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 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.
Defines a callback function which evaluates the flux vector.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.