Advects a vector field.
91 int nqtot = fields[0]->GetTotPoints();
92 ASSERTL1(nConvectiveFields == inarray.num_elements(),
"Number of convective fields and Inarray are not compatible");
94 Array<OneD, NekDouble > Deriv(nqtot*nConvectiveFields);
96 for(
int n = 0; n < nConvectiveFields; ++n)
99 int ndim = advVel.num_elements();
100 Array<OneD, Array<OneD, NekDouble> > AdvVel (advVel.num_elements());
101 Array<OneD, NekDouble> Outarray;
104 int nPointsTot = fields[0]->GetNpoints();
105 Array<OneD, NekDouble> grad0,grad1,grad2,wkSp;
112 nPointsTot = fields[0]->Get1DScaledTotPoints(OneDptscale);
115 grad0 = Array<OneD, NekDouble> (nPointsTot);
118 int nadv = advVel.num_elements();
121 AdvVel[0] = Array<OneD, NekDouble> (nPointsTot*(nadv+1));
122 for(
int i = 0; i < nadv; ++i)
126 AdvVel[i] = AdvVel[i-1]+nPointsTot;
129 fields[0]->PhysInterp1DScaled(OneDptscale,advVel[i],AdvVel[i]);
132 Outarray = AdvVel[nadv-1] + nPointsTot;
136 for(
int i = 0; i < nadv; ++i)
138 AdvVel[i] = advVel[i];
141 Outarray = outarray[n];
144 wkSp = Array<OneD, NekDouble> (nPointsTot);
151 fields[0]->PhysDeriv(inarray[n],grad0);
152 Vmath::Vmul(nPointsTot,grad0,1,advVel[0],1,outarray[n],1);
156 grad1 = Array<OneD, NekDouble> (nPointsTot);
157 fields[0]->PhysDeriv(inarray[n],grad0,grad1);
161 fields[0]->PhysInterp1DScaled(OneDptscale,grad0,wkSp);
163 fields[0]->PhysInterp1DScaled(OneDptscale,grad1,wkSp);
167 Vmath::Vmul (nPointsTot,grad0,1,AdvVel[0],1,Outarray,1);
168 Vmath::Vvtvp(nPointsTot,grad1,1,AdvVel[1],1,Outarray,1,Outarray,1);
172 fields[0]->PhysGalerkinProjection1DScaled(OneDptscale,Outarray,outarray[n]);
178 grad1 = Array<OneD, NekDouble> (fields[0]->GetNpoints());
179 grad2 = Array<OneD, NekDouble> (fields[0]->GetNpoints());
185 fields[0]->PhysDeriv(inarray[n],grad0,grad1,grad2);
187 fields[0]->DealiasedProd(advVel[0],grad0,grad0,
m_CoeffState);
188 fields[0]->DealiasedProd(advVel[1],grad1,grad1,
m_CoeffState);
189 fields[0]->DealiasedProd(advVel[2],grad2,grad2,
m_CoeffState);
190 Vmath::Vadd(nPointsTot,grad0,1,grad1,1,outarray[n],1);
191 Vmath::Vadd(nPointsTot,grad2,1,outarray[n],1,outarray[n],1);
196 fields[0]->PhysDeriv(advVel[n],grad0,grad1);
201 fields[0]->HomogeneousBwdTrans(outarray[n],grad2);
205 fields[0]->PhysInterp1DScaled(OneDptscale,grad0,wkSp);
206 Vmath::Vmul(nPointsTot,wkSp,1,AdvVel[0],1,Outarray,1);
210 Vmath::Vmul(nPointsTot,grad0,1,AdvVel[0],1,Outarray,1);
215 fields[0]->PhysInterp1DScaled(OneDptscale,grad1,wkSp);
227 fields[0]->PhysInterp1DScaled(OneDptscale,grad2,wkSp);
228 Vmath::Vvtvp(nPointsTot,wkSp,1,AdvVel[2],1,Outarray,1,Outarray,1);
229 fields[0]->PhysGalerkinProjection1DScaled(OneDptscale,Outarray,grad2);
230 fields[0]->HomogeneousFwdTrans(grad2,outarray[n]);
234 Vmath::Vvtvp(nPointsTot,grad2,1,AdvVel[2],1,Outarray,1,grad0,1);
235 fields[0]->HomogeneousFwdTrans(grad0,outarray[n]);
241 fields[0]->PhysDeriv(inarray[n],grad0,grad1,grad2);
245 fields[0]->PhysInterp1DScaled(OneDptscale,grad0,wkSp);
246 Vmath::Vmul(nPointsTot,wkSp,1,AdvVel[0],1,Outarray,1);
250 Vmath::Vmul(nPointsTot,grad0,1,AdvVel[0],1,Outarray,1);
256 fields[0]->PhysInterp1DScaled(OneDptscale,grad1,wkSp);
268 fields[0]->PhysInterp1DScaled(OneDptscale,grad2,wkSp);
269 Vmath::Vvtvp(nPointsTot,wkSp,1,AdvVel[2],1,Outarray,1,Outarray,1);
270 fields[0]->PhysGalerkinProjection1DScaled(OneDptscale,Outarray,outarray[n]);
274 Vmath::Vvtvp(nPointsTot,grad2,1,AdvVel[2],1,Outarray,1,outarray[n],1);
281 fields[0]->PhysDeriv(inarray[n],grad0,grad1,grad2);
283 fields[0]->HomogeneousBwdTrans(grad0, outarray[n]);
284 fields[0]->DealiasedProd(advVel[0], outarray[n], grad0,
287 fields[0]->HomogeneousBwdTrans(grad1,outarray[n]);
288 fields[0]->DealiasedProd(advVel[1], outarray[n], grad1,
291 fields[0]->HomogeneousBwdTrans(grad2,outarray[n]);
292 fields[0]->DealiasedProd(advVel[2], outarray[n], grad2,
295 Vmath::Vadd(nPointsTot, grad0, 1, grad1, 1, grad0, 1);
296 Vmath::Vadd(nPointsTot, grad0, 1, grad2, 1, grad0, 1);
298 fields[0]->HomogeneousFwdTrans(grad0,outarray[n]);
302 ASSERTL0(
false,
"Advection term calculation not implented or "
303 "possible with the current problem set up");
307 ASSERTL0(
false,
"dimension unknown");
bool m_homogen_dealiasing
#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
void Neg(int n, T *x, const int incx)
Negate x = -x.
MultiRegions::CoeffState m_CoeffState
MultiRegions::Direction const DirCartesianMap[]
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
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.