Advects a vector field.
80 int ndim = advVel.num_elements();
81 int nPointsTot = fields[0]->GetNpoints();
82 Array<OneD, Array<OneD, NekDouble> > velocity(ndim);
83 for(
int i = 0; i < ndim; ++i)
87 velocity[i] = Array<OneD, NekDouble>(nPointsTot,0.0);
88 fields[i]->HomogeneousBwdTrans(advVel[i],velocity[i]);
92 velocity[i] = advVel[i];
95 for(
int n = 0; n < nConvectiveFields; ++n)
98 Array<OneD, NekDouble> gradV0,gradV1,gradV2, tmp, Up;
100 gradV0 = Array<OneD, NekDouble> (nPointsTot);
101 tmp = Array<OneD, NekDouble> (nPointsTot);
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);
120 gradV1 = Array<OneD, NekDouble> (nPointsTot);
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);
138 gradV1 = Array<OneD, NekDouble> (nPointsTot);
139 gradV2 = Array<OneD, NekDouble> (nPointsTot);
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);
159 Up = Array<OneD, NekDouble> (nPointsTot);
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)
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 Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
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.