Advects a vector field.
59{
60 ASSERTL1(nConvectiveFields == inarray.size(),
61 "Number of convective fields and Inarray are not compatible");
62
63 int nPointsTot = fields[0]->GetNpoints();
64 int ndim = advVel.size();
67
68 Array<OneD, Array<OneD, NekDouble>> velocity(ndim);
69 int nScalar = nConvectiveFields - ndim;
70 Array<OneD, Array<OneD, NekDouble>> scalar(nScalar);
71
72 for (int i = 0; i < ndim; ++i)
73 {
75 {
76 velocity[i] = Array<OneD, NekDouble>(nPointsTot, 0.0);
77 fields[i]->HomogeneousBwdTrans(nPointsTot, advVel[i], velocity[i]);
78 }
79 else
80 {
81 velocity[i] = advVel[i];
82 }
83 }
84 if (nScalar > 0)
85 {
86 for (int jj = ndim; jj < nConvectiveFields; ++jj)
87 {
88 scalar[jj - ndim] = inarray[jj];
89 }
90 }
91
92 Array<OneD, Array<OneD, NekDouble>> grad(nDerivs);
93 for (int i = 0; i < nDerivs; ++i)
94 {
95 grad[i] = Array<OneD, NekDouble>(nPointsTot);
96 }
97
98
100 {
101 for (int i = 0; i < ndim; ++i)
102 {
105 }
106 }
107
108
109 for (int i = 0; i < nConvectiveFields; ++i)
110 {
111
112 switch (nDerivs)
113 {
114 case 1:
115 {
116 fields[i]->PhysDeriv(inarray[i], grad[0]);
117 }
118 break;
119 case 2:
120 {
121 fields[i]->PhysDeriv(inarray[i], grad[0], grad[1]);
122 }
123 break;
124 case 3:
125 {
126 fields[i]->PhysDeriv(inarray[i], grad[0], grad[1], grad[2]);
128 {
129
130 fields[i]->HomogeneousBwdTrans(nPointsTot, grad[0],
131 grad[0]);
132 fields[i]->HomogeneousBwdTrans(nPointsTot, grad[1],
133 grad[1]);
134 fields[i]->HomogeneousBwdTrans(nPointsTot, grad[2],
135 grad[2]);
136 }
137 }
138 break;
139 }
140
141
142 if (i < ndim)
143 {
144
146 1);
147 for (int j = 1; j < nDerivs; ++j)
148 {
150 outarray[i], 1, outarray[i], 1);
151 }
153
154
157 {
158 lim = 0;
159 }
160 for (int j = 0; j < lim; ++j)
161 {
163 velocity[j], 1, outarray[i], 1, outarray[i], 1);
164 }
165
166 if (nScalar > 0 && i < ndim)
167 {
168 for (int s = 0; s < nScalar; ++s)
169 {
172 scalar[s], 1, outarray[i], 1, outarray[i], 1);
173 }
174 }
175 }
176
177 else
178 {
179
181 1);
182 for (int j = 1; j < nDerivs; ++j)
183 {
185 outarray[i], 1, outarray[i], 1);
186 }
188 }
189
191 {
192 fields[i]->HomogeneousFwdTrans(nPointsTot, outarray[i],
193 outarray[i]);
194 }
196 }
197}
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
void UpdateBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const NekDouble time)
NekDouble m_period
period length
void UpdateGradBase(const int var, const MultiRegions::ExpListSharedPtr &field)
bool m_singleMode
flag to determine if use single mode or not
Array< OneD, Array< OneD, NekDouble > > m_baseflow
Storage for base flow.
Array< OneD, Array< OneD, NekDouble > > m_gradBase
bool m_multipleModes
flag to determine if use multiple mode or not
bool m_halfMode
flag to determine if use half mode or not
Array< OneD, Array< OneD, NekDouble > > m_interp
interpolation vector
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.
void Neg(int n, T *x, const int incx)
Negate x = -x.
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