Advects a vector field.
76 for(
int n = 0; n < nConvectiveFields; ++n)
79 int ndim = advVel.num_elements();
83 int nPointsTot = fields[0]->GetNpoints();
84 Array<OneD, NekDouble> gradV0,gradV1,gradV2, tmp, Up;
86 gradV0 = Array<OneD, NekDouble> (nPointsTot);
87 tmp = Array<OneD, NekDouble> (nPointsTot);
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);
106 gradV1 = Array<OneD, NekDouble> (nPointsTot);
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);
124 gradV1 = Array<OneD, NekDouble> (nPointsTot);
125 gradV2 = Array<OneD, NekDouble> (nPointsTot);
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);
145 Up = Array<OneD, NekDouble> (nPointsTot);
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");
#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.