42 string AdjointAdvection::className =
44 "Adjoint", AdjointAdvection::create);
58 const int nConvectiveFields,
66 boost::ignore_unused(pFwd, pBwd);
67 ASSERTL1(nConvectiveFields == inarray.size(),
68 "Number of convective fields and Inarray are not compatible");
70 int nPointsTot = fields[0]->GetNpoints();
71 int ndim = advVel.size();
76 int nScalar = nConvectiveFields - ndim;
79 for (
int i = 0; i < ndim; ++i)
84 fields[i]->HomogeneousBwdTrans(nPointsTot, advVel[i], velocity[i]);
88 velocity[i] = advVel[i];
93 for (
int jj = ndim; jj < nConvectiveFields; ++jj)
95 scalar[jj - ndim] = inarray[jj];
100 for (
int i = 0; i < nDerivs; ++i)
108 for (
int i = 0; i < ndim; ++i)
116 for (
int i = 0; i < nConvectiveFields; ++i)
123 fields[i]->PhysDeriv(inarray[i], grad[0]);
128 fields[i]->PhysDeriv(inarray[i], grad[0], grad[1]);
133 fields[i]->PhysDeriv(inarray[i], grad[0], grad[1], grad[2]);
137 fields[i]->HomogeneousBwdTrans(nPointsTot, grad[0],
139 fields[i]->HomogeneousBwdTrans(nPointsTot, grad[1],
141 fields[i]->HomogeneousBwdTrans(nPointsTot, grad[2],
154 for (
int j = 1; j < nDerivs; ++j)
157 outarray[i], 1, outarray[i], 1);
167 for (
int j = 0; j < lim; ++j)
170 velocity[j], 1, outarray[i], 1, outarray[i], 1);
173 if (nScalar > 0 && i < ndim)
175 for (
int s = 0; s < nScalar; ++s)
179 scalar[s], 1, outarray[i], 1, outarray[i], 1);
189 for (
int j = 1; j < nDerivs; ++j)
192 outarray[i], 1, outarray[i], 1);
199 fields[i]->HomogeneousFwdTrans(nPointsTot, outarray[i],
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
virtual void v_Advect(const int nConvectiveFields, const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble >> &advVel, const Array< OneD, Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray, const NekDouble &time, const Array< OneD, Array< OneD, NekDouble >> &pFwd=NullNekDoubleArrayOfArray, const Array< OneD, Array< OneD, NekDouble >> &pBwd=NullNekDoubleArrayOfArray) override
Advects a vector field.
virtual ~AdjointAdvection()
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
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
AdvectionFactory & GetAdvectionFactory()
Gets the factory for initialising advection objects.
The above copyright notice and this permission notice shall be included.
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