Advects a vector field.
81 int ndim = advVel.num_elements();
82 int nPointsTot = fields[0]->GetNpoints();
83 Array<OneD, Array<OneD, NekDouble> > velocity(ndim);
84 for(
int i = 0; i < ndim; ++i)
88 velocity[i] = Array<OneD, NekDouble>(nPointsTot,0.0);
89 fields[i]->HomogeneousBwdTrans(advVel[i],velocity[i]);
93 velocity[i] = advVel[i];
96 for(
int n = 0; n < nConvectiveFields; ++n)
99 Array<OneD, NekDouble> gradV0,gradV1,gradV2, tmp, Up;
101 gradV0 = Array<OneD, NekDouble> (nPointsTot);
102 tmp = Array<OneD, NekDouble> (nPointsTot);
110 fields[0]->PhysDeriv(inarray[n],gradV0);
111 Vmath::Vmul(nPointsTot,gradV0,1,velocity[0],1,outarray[n],1);
115 Vmath::Vmul(nPointsTot,inarray[n],1,velocity[0],1,gradV0,1);
116 fields[0]->PhysDeriv(gradV0,outarray[n]);
118 Vmath::Smul(nPointsTot,0.5,outarray[n],1,outarray[n],1);
121 gradV1 = Array<OneD, NekDouble> (nPointsTot);
124 fields[0]->PhysDeriv(inarray[n],gradV0,gradV1);
125 Vmath::Vmul (nPointsTot,gradV0,1,velocity[0],1,outarray[n],1);
126 Vmath::Vvtvp(nPointsTot,gradV1,1,velocity[1],1,outarray[n],1,outarray[n],1);
130 Vmath::Vmul(nPointsTot,inarray[n],1,velocity[0],1,gradV0,1);
131 Vmath::Vmul(nPointsTot,inarray[n],1,velocity[1],1,gradV1,1);
134 Vmath::Vadd(nPointsTot,tmp,1,outarray[n],1,outarray[n],1);
136 Vmath::Smul(nPointsTot,1.0,outarray[n],1,outarray[n],1);
139 gradV1 = Array<OneD, NekDouble> (nPointsTot);
140 gradV2 = Array<OneD, NekDouble> (nPointsTot);
144 if(fields[0]->GetWaveSpace() ==
true)
150 fields[0]->PhysDeriv(inarray[n],gradV0,gradV1,gradV2);
151 fields[0]->HomogeneousBwdTrans(gradV0,tmp);
152 Vmath::Vmul(nPointsTot,tmp,1,velocity[0],1,outarray[n],1);
153 fields[0]->HomogeneousBwdTrans(gradV1,tmp);
154 Vmath::Vvtvp(nPointsTot,tmp,1,velocity[1],1,outarray[n],1,outarray[n],1);
155 fields[0]->HomogeneousBwdTrans(gradV2,tmp);
156 Vmath::Vvtvp(nPointsTot,tmp,1,velocity[2],1,outarray[n],1,outarray[n],1);
160 Up = Array<OneD, NekDouble> (nPointsTot);
161 fields[0]->HomogeneousBwdTrans(inarray[n],Up);
162 Vmath::Vmul(nPointsTot,Up,1,velocity[0],1,gradV0,1);
163 Vmath::Vmul(nPointsTot,Up,1,velocity[1],1,gradV1,1);
164 Vmath::Vmul(nPointsTot,Up,1,velocity[2],1,gradV2,1);
166 fields[0]->SetWaveSpace(
false);
169 Vmath::Vadd(nPointsTot,tmp,1,outarray[n],1,outarray[n],1);
171 Vmath::Vadd(nPointsTot,tmp,1,outarray[n],1,outarray[n],1);
172 fields[0]->SetWaveSpace(
true);
176 fields[0]->HomogeneousFwdTrans(tmp,outarray[n]);
182 fields[0]->PhysDeriv(inarray[n],gradV0,gradV1,gradV2);
183 Vmath::Vmul(nPointsTot,gradV0,1,velocity[0],1,outarray[n],1);
184 Vmath::Vvtvp(nPointsTot,gradV1,1,velocity[1],1,outarray[n],1,outarray[n],1);
185 Vmath::Vvtvp(nPointsTot,gradV2,1,velocity[2],1,outarray[n],1,outarray[n],1);
189 Vmath::Vmul(nPointsTot,inarray[n],1,velocity[0],1,gradV0,1);
190 Vmath::Vmul(nPointsTot,inarray[n],1,velocity[1],1,gradV1,1);
191 Vmath::Vmul(nPointsTot,inarray[n],1,velocity[2],1,gradV2,1);
194 Vmath::Vadd(nPointsTot,tmp,1,outarray[n],1,outarray[n],1);
196 Vmath::Vadd(nPointsTot,tmp,1,outarray[n],1,outarray[n],1);
198 Vmath::Smul(nPointsTot,1.0,outarray[n],1,outarray[n],1);
202 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.