68 const int nConvectiveFields,
76 v_Advect(nConvectiveFields, pFields, pAdvVel, pInarray, pOutarray, pTime,
80template <
typename DataType,
typename TypeNekBlkMatSharedPtr>
82 const int nConvectiveFields,
const int nSpaceDim,
90 std::shared_ptr<LocalRegions::ExpansionVector> traceExp =
92 int ntotTrac = (*traceExp).size();
93 int nTracePnts = tracelist->GetTotPoints();
94 int nTracPnt, nTracCoef;
104 for (
int nelmt = 0; nelmt < ntotTrac; nelmt++)
106 nTracCoef = (*traceExp)[nelmt]->GetNcoeffs();
107 nTracPnt = (*traceExp)[nelmt]->GetTotPoints();
114 std::shared_ptr<LocalRegions::ExpansionVector> fieldExp =
115 pFields[0]->GetExp();
116 int nTotElmt = (*fieldExp).size();
117 int nElmtPnt, nElmtCoef;
124 for (
int nelmt = 0; nelmt < nTotElmt; nelmt++)
126 nElmtCoef = (*fieldExp)[nelmt]->GetNcoeffs();
127 nElmtPnt = (*fieldExp)[nelmt]->GetTotPoints();
132 nElmtCoef, nElmtCoef, 0.0);
135 bool TracePntJacGradflag =
true;
138 for (
int i = 0; i < 2; i++)
143 if (0 == TracePntJacGrad.size())
145 TracePntJacGradflag =
false;
148 for (
int m = 0; m < nConvectiveFields; m++)
150 for (
int n = 0; n < nConvectiveFields; n++)
153 for (
int nelmt = 0; nelmt < nTotElmt; nelmt++)
155 (*ElmtJacCoef[nelmt]) = 0.0;
156 (*ElmtJacQuad[nelmt]) = 0.0;
159 if (TracePntJacGradflag)
162 for (
int ndir = 0; ndir < nSpaceDim; ndir++)
165 for (
int nelmt = 0; nelmt < nTotElmt; nelmt++)
167 (*ElmtJacQuad[nelmt]) = 0.0;
169 int ngrad = n * nSpaceDim + ndir;
172 TracePntJacGradSign, TraceJacFwd,
174 pFields[0]->AddTraceJacToElmtJac(TraceJacFwd, TraceJacBwd,
177 pFields[0]->AddRightIPTPhysDerivBase(ndir, ElmtJacQuad,
180 for (
int nelmt = 0; nelmt < nTotElmt; nelmt++)
182 nElmtCoef = (*fieldExp)[nelmt]->GetNcoeffs();
183 if (SymmMatData.size() < nElmtCoef)
188 MatData1 = ElmtJacCoef[nelmt]->GetPtr();
189 for (
int i = 0; i < nElmtCoef; i++)
192 &SymmMatData[i], nElmtCoef);
194 Vmath::Vadd(nElmtCoef * nElmtCoef, SymmMatData, 1, MatData1,
200 TraceJacConsSign, TraceJacFwd, TraceJacBwd);
202 pFields[0]->AddTraceJacToElmtJac(TraceJacFwd, TraceJacBwd,
205 pFields[0]->AddRightIPTBaseMatrix(ElmtJacQuad, ElmtJacCoef);
208 for (
int nelmt = 0; nelmt < nTotElmt; nelmt++)
210 tmp2Add = ElmtJacCoef[nelmt];
211 MatData0 = gmtxarray[m][n]->GetBlock(nelmt, nelmt)->GetPtr();
212 MatData1 = tmp2Add->GetPtr();
213 for (
int i = 0; i < MatData0.
size(); i++)
215 MatData0[i] += DataType(MatData1[i]);
223 const int nConvectiveFields,
const int nSpaceDim,
230 const int nConvectiveFields,
const int nSpaceDim,
240template <
typename DataType,
typename TypeNekBlkMatSharedPtr>
249 std::shared_ptr<LocalRegions::ExpansionVector> traceExp =
251 int ntotTrac = (*traceExp).size();
252 int nTracPnt, noffset, pntoffset;
258 for (
int nelmt = 0; nelmt < ntotTrac; nelmt++)
260 nTracPnt = (*traceExp)[nelmt]->GetTotPoints();
261 tracepnts[nelmt] = nTracPnt;
268 for (
int nelmt = 0; nelmt < ntotTrac; nelmt++)
270 nTracPnt = tracepnts[nelmt];
271 noffset = tracelist->GetPhys_Offset(nelmt);
272 for (
int npnt = 0; npnt < nTracPnt; npnt++)
274 pntoffset = noffset + npnt;
275 ftmp = (*PntJac[0]->GetBlock(pntoffset, pntoffset))(m, n);
276 JacFwd[nelmt][npnt] =
NekDouble(PntJacSign[0][pntoffset] * ftmp);
278 btmp = (*PntJac[1]->GetBlock(pntoffset, pntoffset))(m, n);
279 JacBwd[nelmt][npnt] =
NekDouble(PntJacSign[1][pntoffset] * btmp);
282 tracelist->GetDiagMatIpwrtBase(JacFwd, TraceJacFwd);
283 tracelist->GetDiagMatIpwrtBase(JacBwd, TraceJacBwd);
301 if (pSession->DefinesSolverInfo(
"HOMOGENEOUS"))
303 std::string HomoStr = pSession->GetSolverInfo(
"HOMOGENEOUS");
304 if (HomoStr ==
"HOMOGENEOUS1D" || HomoStr ==
"Homogeneous1D" ||
305 HomoStr ==
"1D" || HomoStr ==
"Homo1D" ||
306 HomoStr ==
"HOMOGENEOUS2D" || HomoStr ==
"Homogeneous2D" ||
307 HomoStr ==
"2D" || HomoStr ==
"Homo2D")
314 "Only 1D homogeneous dimension supported.");
327 "A baseflow is not appropriate for this advection type.");
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
#define SOLVER_UTILS_EXPORT
size_type size() const
Returns the array's size.
Provides a generic Factory class.
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
int m_spaceDim
Storage for space dimension. Used for homogeneous extension.
virtual SOLVER_UTILS_EXPORT void v_InitObject(LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields)
Initialises the advection object.
void CalcJacobTraceInteg(const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const int m, const int n, const Array< OneD, const TypeNekBlkMatSharedPtr > &PntJac, const Array< OneD, const Array< OneD, DataType > > &PntJacSign, Array< OneD, DNekMatSharedPtr > &TraceJacFwd, Array< OneD, DNekMatSharedPtr > &TraceJacBwd)
virtual SOLVER_UTILS_EXPORT 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)=0
Advects a vector field.
SOLVER_UTILS_EXPORT void InitObject(LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields)
Interface function to initialise the advection object.
virtual SOLVER_UTILS_EXPORT void v_SetBaseFlow(const Array< OneD, Array< OneD, NekDouble > > &inarray, const Array< OneD, MultiRegions::ExpListSharedPtr > &fields)
Overrides the base flow used during linearised advection.
SOLVER_UTILS_EXPORT void AddTraceJacToMat(const int nConvectiveFields, const int nSpaceDim, const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const Array< OneD, TypeNekBlkMatSharedPtr > &TracePntJacCons, Array< OneD, Array< OneD, TypeNekBlkMatSharedPtr > > &gmtxarray, const Array< OneD, TypeNekBlkMatSharedPtr > &TracePntJacGrad, const Array< OneD, Array< OneD, DataType > > &TracePntJacGradSign)
SOLVER_UTILS_EXPORT void 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)
Interface function to advect the vector field.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
AdvectionFactory & GetAdvectionFactory()
Gets the factory for initialising advection objects.
std::shared_ptr< DNekMat > DNekMatSharedPtr
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 Vcopy(int n, const T *x, const int incx, T *y, const int incy)