Nektar++
Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
Nektar::SolverUtils::Advection3DHomogeneous1D Class Reference

#include <Advection3DHomogeneous1D.h>

Inheritance diagram for Nektar::SolverUtils::Advection3DHomogeneous1D:
[legend]

Static Public Member Functions

static AdvectionSharedPtr create (std::string advType)
 

Static Public Attributes

static std::string type []
 

Protected Member Functions

 Advection3DHomogeneous1D (std::string advType)
 AdvectionFR uses the Flux Reconstruction (FR) approach to compute the advection term. The implementation is only for segments, quadrilaterals and hexahedra at the moment. More...
 
void v_InitObject (LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields) override
 Initiliase Advection3DHomogeneous1D objects and store them before starting the time-stepping. More...
 
void v_Advect (const int nConvField, 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
 Compute the advection operator for a given input inarray and put the result in outarray. More...
 
- Protected Member Functions inherited from Nektar::SolverUtils::Advection
virtual SOLVER_UTILS_EXPORT void v_InitObject (LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields)
 Initialises the advection object. More...
 
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. More...
 
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. More...
 

Protected Attributes

std::string m_advType
 
- Protected Attributes inherited from Nektar::SolverUtils::Advection
AdvectionFluxVecCB m_fluxVector
 Callback function to the flux vector (set when advection is in conservative form). More...
 
RiemannSolverSharedPtr m_riemann
 Riemann solver for DG-type schemes. More...
 
int m_spaceDim
 Storage for space dimension. Used for homogeneous extension. More...
 

Private Member Functions

void ModifiedFluxVector (const Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &flux)
 

Private Attributes

SolverUtils::AdvectionSharedPtr m_planeAdv
 
int m_numPoints
 
int m_numPointsPlane
 
int m_numPlanes
 
int m_planeCounter
 
Array< OneD, unsigned int > m_planes
 
Array< OneD, unsigned int > m_planePos
 
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_fluxVecStore
 
Array< OneD, Array< OneD, NekDouble > > m_inarrayPlane
 
Array< OneD, Array< OneD, NekDouble > > m_outarrayPlane
 
Array< OneD, MultiRegions::ExpListSharedPtrm_fieldsPlane
 
Array< OneD, Array< OneD, NekDouble > > m_advVelPlane
 
Array< OneD, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > > m_fluxVecPlane
 

Additional Inherited Members

- Public Member Functions inherited from Nektar::SolverUtils::Advection
virtual SOLVER_UTILS_EXPORT ~Advection ()
 
SOLVER_UTILS_EXPORT void InitObject (LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields)
 Interface function to initialise the advection object. More...
 
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. More...
 
template<typename FuncPointerT , typename ObjectPointerT >
void SetFluxVector (FuncPointerT func, ObjectPointerT obj)
 Set the flux vector callback function. More...
 
void SetRiemannSolver (RiemannSolverSharedPtr riemann)
 Set a Riemann solver object for this advection object. More...
 
void SetFluxVector (AdvectionFluxVecCB fluxVector)
 Set the flux vector callback function. More...
 
void SetBaseFlow (const Array< OneD, Array< OneD, NekDouble > > &inarray, const Array< OneD, MultiRegions::ExpListSharedPtr > &fields)
 Set the base flow used for linearised advection objects. More...
 
template<typename DataType , typename TypeNekBlkMatSharedPtr >
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)
 
template<typename DataType , typename TypeNekBlkMatSharedPtr >
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)
 
template<typename DataType , typename TypeNekBlkMatSharedPtr >
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)
 

Detailed Description

Definition at line 45 of file Advection3DHomogeneous1D.h.

Constructor & Destructor Documentation

◆ Advection3DHomogeneous1D()

Nektar::SolverUtils::Advection3DHomogeneous1D::Advection3DHomogeneous1D ( std::string  advType)
protected

AdvectionFR uses the Flux Reconstruction (FR) approach to compute the advection term. The implementation is only for segments, quadrilaterals and hexahedra at the moment.

Todo:
Extension to triangles, tetrahedra and other shapes. (Long term objective)

Definition at line 68 of file Advection3DHomogeneous1D.cpp.

69 : m_advType(advType)
70{
71 // Strip trailing string "3DHomogeneous1D" to determine 2D advection
72 // type, and create an advection object for the plane.
73 string advName = advType.substr(0, advType.length() - 15);
74 m_planeAdv = GetAdvectionFactory().CreateInstance(advName, advName);
75}
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
Definition: NekFactory.hpp:143
AdvectionFactory & GetAdvectionFactory()
Gets the factory for initialising advection objects.
Definition: Advection.cpp:43

References Nektar::LibUtilities::NekFactory< tKey, tBase, tParam >::CreateInstance(), Nektar::SolverUtils::GetAdvectionFactory(), and m_planeAdv.

Referenced by create().

Member Function Documentation

◆ create()

static AdvectionSharedPtr Nektar::SolverUtils::Advection3DHomogeneous1D::create ( std::string  advType)
inlinestatic

Definition at line 48 of file Advection3DHomogeneous1D.h.

49 {
51 }
Advection3DHomogeneous1D(std::string advType)
AdvectionFR uses the Flux Reconstruction (FR) approach to compute the advection term....
std::shared_ptr< Advection > AdvectionSharedPtr
A shared pointer to an Advection object.
Definition: Advection.h:54

References Advection3DHomogeneous1D().

◆ ModifiedFluxVector()

void Nektar::SolverUtils::Advection3DHomogeneous1D::ModifiedFluxVector ( const Array< OneD, Array< OneD, NekDouble > > &  physfield,
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &  flux 
)
private

Definition at line 239 of file Advection3DHomogeneous1D.cpp.

242{
243 // Return section of flux vector for this plane.
244 outarray = m_fluxVecPlane[m_planeCounter];
245
246 // Increment the plane counter.
248}
Array< OneD, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > > m_fluxVecPlane

References m_fluxVecPlane, m_numPlanes, and m_planeCounter.

Referenced by v_InitObject().

◆ v_Advect()

void Nektar::SolverUtils::Advection3DHomogeneous1D::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 
)
overrideprotectedvirtual

Compute the advection operator for a given input inarray and put the result in outarray.

Parameters
nConvectiveFieldsNumber of fields to advect.
fieldsPointer to fields.
advVelAdvection velocities.
inarrayInput which will be advected.
outarrayComputed advection.

Implements Nektar::SolverUtils::Advection.

Definition at line 183 of file Advection3DHomogeneous1D.cpp.

191{
192 Array<OneD, NekDouble> tmp(m_numPoints), tmp2;
193 int nVel = advVel.size();
194
195 // Call solver's flux vector function to compute the flux vector on
196 // the entire domain.
198
199 // Loop over each plane.
200 for (int i = 0; i < m_numPlanes; ++i)
201 {
202 // Set up memory references for fields, inarray and outarray for
203 // this plane.
204 for (int j = 0; j < nConvectiveFields; ++j)
205 {
206 m_fieldsPlane[j] = fields[j]->GetPlane(i);
207 m_inarrayPlane[j] = Array<OneD, NekDouble>(
208 m_numPointsPlane, tmp2 = inarray[j] + m_planePos[i]);
209 m_outarrayPlane[j] = Array<OneD, NekDouble>(
210 m_numPointsPlane, tmp2 = outarray[j] + m_planePos[i]);
211 }
212
213 for (int j = 0; j < nVel; ++j)
214 {
215 if (advVel[j].size() != 0)
216 {
217 m_advVelPlane[j] = Array<OneD, NekDouble>(
218 m_numPointsPlane, tmp2 = advVel[j] + m_planePos[i]);
219 }
220 }
221
222 // Compute advection term for this plane.
223 m_planeAdv->Advect(nConvectiveFields, m_fieldsPlane, m_advVelPlane,
225 }
226
227 // Calculate Fourier derivative and add to final result.
228 for (int i = 0; i < nConvectiveFields; ++i)
229 {
230 fields[0]->PhysDeriv(2, m_fluxVecStore[i][2], tmp);
231
232 Vmath::Vadd(m_numPoints, outarray[i], 1, tmp, 1, outarray[i], 1);
233 }
234}
Array< OneD, Array< OneD, NekDouble > > m_outarrayPlane
Array< OneD, Array< OneD, NekDouble > > m_advVelPlane
Array< OneD, Array< OneD, NekDouble > > m_inarrayPlane
Array< OneD, MultiRegions::ExpListSharedPtr > m_fieldsPlane
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_fluxVecStore
AdvectionFluxVecCB m_fluxVector
Callback function to the flux vector (set when advection is in conservative form).
Definition: Advection.h:168
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.
Definition: Vmath.hpp:180

References m_advVelPlane, m_fieldsPlane, m_fluxVecStore, Nektar::SolverUtils::Advection::m_fluxVector, m_inarrayPlane, m_numPlanes, m_numPoints, m_numPointsPlane, m_outarrayPlane, m_planeAdv, m_planePos, and Vmath::Vadd().

◆ v_InitObject()

void Nektar::SolverUtils::Advection3DHomogeneous1D::v_InitObject ( LibUtilities::SessionReaderSharedPtr  pSession,
Array< OneD, MultiRegions::ExpListSharedPtr pFields 
)
overrideprotectedvirtual

Initiliase Advection3DHomogeneous1D objects and store them before starting the time-stepping.

Parameters
pSessionPointer to session reader.
pFieldsPointer to fields.

Reimplemented from Nektar::SolverUtils::Advection.

Definition at line 84 of file Advection3DHomogeneous1D.cpp.

87{
88 int nConvectiveFields = pFields.size();
89
90 Array<OneD, MultiRegions::ExpListSharedPtr> pFields_plane0(
91 nConvectiveFields);
92
93 // Initialise the plane advection object.
94 for (int i = 0; i < nConvectiveFields; ++i)
95 {
96 pFields_plane0[i] = pFields[i]->GetPlane(0);
97 }
98 m_planeAdv->InitObject(pSession, pFields_plane0);
99
100 m_numPoints = pFields[0]->GetTotPoints();
101 m_planes = pFields[0]->GetZIDs();
102 m_numPlanes = m_planes.size();
104
105 // Set Riemann solver and flux vector callback for this plane.
106 m_planeAdv->SetRiemannSolver(m_riemann);
108 this);
109 m_planeCounter = 0;
110
111 // Override Riemann solver scalar and vector callbacks.
112 map<string, RSScalarFuncType> scalars = m_riemann->GetScalars();
113 map<string, RSVecFuncType> vectors = m_riemann->GetVectors();
114
115 for (auto &it1 : scalars)
116 {
117 std::shared_ptr<HomoRSScalar> tmp =
120 m_riemann->SetScalar(it1.first, &HomoRSScalar::Exec, tmp);
121 }
122
123 for (auto &it2 : vectors)
124 {
125 std::shared_ptr<HomoRSVector> tmp =
127 it2.second, m_numPlanes, it2.first);
128 m_riemann->SetVector(it2.first, &HomoRSVector::Exec, tmp);
129 }
130
132 Array<OneD, Array<OneD, Array<OneD, NekDouble>>>(nConvectiveFields);
133
134 // Set up storage for flux vector.
135 for (int i = 0; i < nConvectiveFields; ++i)
136 {
137 m_fluxVecStore[i] = Array<OneD, Array<OneD, NekDouble>>(3);
138 for (int j = 0; j < 3; ++j)
139 {
140 m_fluxVecStore[i][j] = Array<OneD, NekDouble>(m_numPoints);
141 }
142 }
143
145 Array<OneD, Array<OneD, Array<OneD, Array<OneD, NekDouble>>>>(
148 Array<OneD, MultiRegions::ExpListSharedPtr>(nConvectiveFields);
149 m_inarrayPlane = Array<OneD, Array<OneD, NekDouble>>(nConvectiveFields);
150 m_outarrayPlane = Array<OneD, Array<OneD, NekDouble>>(nConvectiveFields);
151 m_planePos = Array<OneD, unsigned int>(m_numPlanes);
152 m_advVelPlane = Array<OneD, Array<OneD, NekDouble>>(3);
153
154 // Set up memory reference which links fluxVecPlane to fluxVecStore.
155 for (int i = 0; i < m_numPlanes; ++i)
156 {
158 m_fluxVecPlane[i] =
159 Array<OneD, Array<OneD, Array<OneD, NekDouble>>>(nConvectiveFields);
160
161 for (int j = 0; j < nConvectiveFields; ++j)
162 {
163 m_fluxVecPlane[i][j] = Array<OneD, Array<OneD, NekDouble>>(3);
164 for (int k = 0; k < 3; ++k)
165 {
166 m_fluxVecPlane[i][j][k] = Array<OneD, NekDouble>(
168 }
169 }
170 }
171}
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
void ModifiedFluxVector(const Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &flux)
RiemannSolverSharedPtr m_riemann
Riemann solver for DG-type schemes.
Definition: Advection.h:170
const Array< OneD, const NekDouble > & Exec()
const Array< OneD, const Array< OneD, NekDouble > > & Exec()

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::SolverUtils::HomoRSScalar::Exec(), Nektar::SolverUtils::HomoRSVector::Exec(), m_advVelPlane, m_fieldsPlane, m_fluxVecPlane, m_fluxVecStore, m_inarrayPlane, m_numPlanes, m_numPoints, m_numPointsPlane, m_outarrayPlane, m_planeAdv, m_planeCounter, m_planePos, m_planes, Nektar::SolverUtils::Advection::m_riemann, and ModifiedFluxVector().

Member Data Documentation

◆ m_advType

std::string Nektar::SolverUtils::Advection3DHomogeneous1D::m_advType
protected

Definition at line 57 of file Advection3DHomogeneous1D.h.

◆ m_advVelPlane

Array<OneD, Array<OneD, NekDouble> > Nektar::SolverUtils::Advection3DHomogeneous1D::m_advVelPlane
private

Definition at line 86 of file Advection3DHomogeneous1D.h.

Referenced by v_Advect(), and v_InitObject().

◆ m_fieldsPlane

Array<OneD, MultiRegions::ExpListSharedPtr> Nektar::SolverUtils::Advection3DHomogeneous1D::m_fieldsPlane
private

Definition at line 85 of file Advection3DHomogeneous1D.h.

Referenced by v_Advect(), and v_InitObject().

◆ m_fluxVecPlane

Array<OneD, Array<OneD, Array<OneD, Array<OneD, NekDouble> > > > Nektar::SolverUtils::Advection3DHomogeneous1D::m_fluxVecPlane
private

Definition at line 88 of file Advection3DHomogeneous1D.h.

Referenced by ModifiedFluxVector(), and v_InitObject().

◆ m_fluxVecStore

Array<OneD, Array<OneD, Array<OneD, NekDouble> > > Nektar::SolverUtils::Advection3DHomogeneous1D::m_fluxVecStore
private

Definition at line 82 of file Advection3DHomogeneous1D.h.

Referenced by v_Advect(), and v_InitObject().

◆ m_inarrayPlane

Array<OneD, Array<OneD, NekDouble> > Nektar::SolverUtils::Advection3DHomogeneous1D::m_inarrayPlane
private

Definition at line 83 of file Advection3DHomogeneous1D.h.

Referenced by v_Advect(), and v_InitObject().

◆ m_numPlanes

int Nektar::SolverUtils::Advection3DHomogeneous1D::m_numPlanes
private

Definition at line 78 of file Advection3DHomogeneous1D.h.

Referenced by ModifiedFluxVector(), v_Advect(), and v_InitObject().

◆ m_numPoints

int Nektar::SolverUtils::Advection3DHomogeneous1D::m_numPoints
private

Definition at line 76 of file Advection3DHomogeneous1D.h.

Referenced by v_Advect(), and v_InitObject().

◆ m_numPointsPlane

int Nektar::SolverUtils::Advection3DHomogeneous1D::m_numPointsPlane
private

Definition at line 77 of file Advection3DHomogeneous1D.h.

Referenced by v_Advect(), and v_InitObject().

◆ m_outarrayPlane

Array<OneD, Array<OneD, NekDouble> > Nektar::SolverUtils::Advection3DHomogeneous1D::m_outarrayPlane
private

Definition at line 84 of file Advection3DHomogeneous1D.h.

Referenced by v_Advect(), and v_InitObject().

◆ m_planeAdv

SolverUtils::AdvectionSharedPtr Nektar::SolverUtils::Advection3DHomogeneous1D::m_planeAdv
private

Definition at line 75 of file Advection3DHomogeneous1D.h.

Referenced by Advection3DHomogeneous1D(), v_Advect(), and v_InitObject().

◆ m_planeCounter

int Nektar::SolverUtils::Advection3DHomogeneous1D::m_planeCounter
private

Definition at line 79 of file Advection3DHomogeneous1D.h.

Referenced by ModifiedFluxVector(), and v_InitObject().

◆ m_planePos

Array<OneD, unsigned int> Nektar::SolverUtils::Advection3DHomogeneous1D::m_planePos
private

Definition at line 81 of file Advection3DHomogeneous1D.h.

Referenced by v_Advect(), and v_InitObject().

◆ m_planes

Array<OneD, unsigned int> Nektar::SolverUtils::Advection3DHomogeneous1D::m_planes
private

Definition at line 80 of file Advection3DHomogeneous1D.h.

Referenced by v_InitObject().

◆ type

std::string Nektar::SolverUtils::Advection3DHomogeneous1D::type
static
Initial value:

Definition at line 52 of file Advection3DHomogeneous1D.h.