Nektar++
Loading...
Searching...
No Matches
Static Public Member Functions | Static Public Attributes | Protected Member Functions | Friends | List of all members
Nektar::NSAdvectionLevelSet Class Reference

#include <NSAdvectionLevelSet.h>

Inheritance diagram for Nektar::NSAdvectionLevelSet:
[legend]

Static Public Member Functions

static SolverUtils::AdvectionSharedPtr create (std::string)
 Creates an instance of this class.
 

Static Public Attributes

static std::string className
 Name of class.
 

Protected Member Functions

 NSAdvectionLevelSet ()
 
 ~NSAdvectionLevelSet () override=default
 
void v_InitObject (LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields) override
 Initialises the advection object.
 
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.
 
- Protected Member Functions inherited from Nektar::SolverUtils::Advection
virtual SOLVER_UTILS_EXPORT ~Advection ()=default
 
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.
 

Friends

class MemoryManager< NSAdvectionLevelSet >
 

Additional Inherited Members

- Public Member Functions inherited from Nektar::SolverUtils::Advection
SOLVER_UTILS_EXPORT void InitObject (LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields)
 Interface function to initialise the advection object.
 
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.
 
template<typename FuncPointerT , typename ObjectPointerT >
void SetFluxVector (FuncPointerT func, ObjectPointerT obj)
 Set the flux vector callback function.
 
void SetRiemannSolver (RiemannSolverSharedPtr riemann)
 Set a Riemann solver object for this advection object.
 
void SetFluxVector (AdvectionFluxVecCB fluxVector)
 Set the flux vector callback function.
 
void SetBaseFlow (const Array< OneD, Array< OneD, NekDouble > > &inarray, const Array< OneD, MultiRegions::ExpListSharedPtr > &fields)
 Set the base flow used for linearised advection objects.
 
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)
 
- Protected Attributes inherited from Nektar::SolverUtils::Advection
AdvectionFluxVecCB m_fluxVector
 Callback function to the flux vector (set when advection is in conservative form).
 
RiemannSolverSharedPtr m_riemann
 Riemann solver for DG-type schemes.
 
int m_spaceDim
 Storage for space dimension. Used for homogeneous extension.
 

Detailed Description

Definition at line 44 of file NSAdvectionLevelSet.h.

Constructor & Destructor Documentation

◆ NSAdvectionLevelSet()

Nektar::NSAdvectionLevelSet::NSAdvectionLevelSet ( )
protected

Definition at line 46 of file NSAdvectionLevelSet.cpp.

46 : Advection()
47
48{
49}

◆ ~NSAdvectionLevelSet()

Nektar::NSAdvectionLevelSet::~NSAdvectionLevelSet ( )
overrideprotecteddefault

Member Function Documentation

◆ create()

static SolverUtils::AdvectionSharedPtr Nektar::NSAdvectionLevelSet::create ( std::string  )
inlinestatic

Creates an instance of this class.

Definition at line 50 of file NSAdvectionLevelSet.h.

51 {
53 }
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr().

◆ v_Advect()

void Nektar::NSAdvectionLevelSet::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

Advects a vector field.

Implements Nektar::SolverUtils::Advection.

Definition at line 64 of file NSAdvectionLevelSet.cpp.

73{
74 int nqtot = fields[0]->GetTotPoints();
75 ASSERTL1(nConvectiveFields == inarray.size(),
76 "Number of convective fields and Inarray are not compatible");
77
78 // use dimension of Velocity vector to dictate dimension of operation
79 int ndim = advVel.size();
80 Array<OneD, Array<OneD, NekDouble>> AdvVel(advVel.size());
81
82 Array<OneD, Array<OneD, NekDouble>> velocity(ndim);
83
84 // LibUtilities::Timer timer;
85 for (int i = 0; i < ndim; ++i)
86 {
87 velocity[i] = advVel[i];
88 }
89
90 int nPointsTot = fields[0]->GetNpoints();
91 Array<OneD, NekDouble> grad0, grad1, grad2, wkSp;
92
93 for (int i = 0; i < ndim; ++i)
94 {
95 AdvVel[i] = velocity[i];
96 }
97
98 wkSp = Array<OneD, NekDouble>(nPointsTot);
99
100 switch (ndim)
101 {
102 case 1:
103 {
104 grad0 = Array<OneD, NekDouble>(fields[0]->GetNpoints());
105 for (int n = 0; n < nConvectiveFields; ++n)
106 {
107 fields[0]->PhysDeriv(inarray[n], grad0);
108 Vmath::Vmul(nPointsTot, grad0, 1, AdvVel[0], 1, outarray[n], 1);
109 }
110 Vmath::Zero(nqtot, outarray[ndim + 1], 1);
111 Vmath::Zero(nqtot, outarray[ndim + 2], 1);
112 break;
113 }
114 case 2:
115 {
116 grad0 = Array<OneD, NekDouble>(nqtot);
117 grad1 = Array<OneD, NekDouble>(nqtot);
118 for (int n = 0; n < nConvectiveFields; ++n)
119 {
120 fields[0]->PhysDeriv(inarray[n], grad0, grad1);
121 Vmath::Vmul(nPointsTot, grad0, 1, AdvVel[0], 1, outarray[n], 1);
122 Vmath::Vvtvp(nPointsTot, grad1, 1, AdvVel[1], 1, outarray[n], 1,
123 outarray[n], 1);
124 }
125 Vmath::Zero(nqtot, outarray[ndim + 1], 1);
126 Vmath::Zero(nqtot, outarray[ndim + 2], 1);
127 break;
128 }
129 case 3:
130 {
131 grad0 = Array<OneD, NekDouble>(nqtot);
132 grad1 = Array<OneD, NekDouble>(nqtot);
133 grad2 = Array<OneD, NekDouble>(nqtot);
134 Array<OneD, NekDouble> tmp = grad2;
135 for (int n = 0; n < nConvectiveFields; ++n)
136 {
137 fields[0]->PhysDeriv(inarray[n], grad0, grad1, grad2);
138 Vmath::Vmul(nPointsTot, grad0, 1, AdvVel[0], 1, outarray[n], 1);
139 Vmath::Vvtvp(nPointsTot, grad1, 1, AdvVel[1], 1, outarray[n], 1,
140 outarray[n], 1);
141 Vmath::Vvtvp(nPointsTot, grad2, 1, AdvVel[2], 1, outarray[n], 1,
142 outarray[n], 1);
143 }
144 Vmath::Zero(nqtot, outarray[ndim + 1], 1);
145 Vmath::Zero(nqtot, outarray[ndim + 2], 1);
146 break;
147 }
148 default:
149 ASSERTL0(false, "dimension unknown");
150 }
151
152 for (int n = 0; n < nConvectiveFields; ++n)
153 {
154 Vmath::Neg(nqtot, outarray[n], 1);
155 }
156}
#define ASSERTL0(condition, msg)
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
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.
Definition Vmath.hpp:74
void Neg(int n, T *x, const int incx)
Negate x = -x.
Definition Vmath.hpp:294
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
Definition Vmath.hpp:368
void Zero(int n, T *x, const int incx)
Zero vector.
Definition Vmath.hpp:275

References ASSERTL0, ASSERTL1, Vmath::Neg(), Vmath::Vmul(), Vmath::Vvtvp(), and Vmath::Zero().

◆ v_InitObject()

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

Initialises the advection object.

This function should be overridden in derived classes to initialise the specific advection data members. However, this base class function should be called as the first statement of the overridden function to ensure the base class is correctly initialised in order.

Parameters
pSessionSession information.
pFieldsExpansion lists for scalar fields.

Reimplemented from Nektar::SolverUtils::Advection.

Definition at line 54 of file NSAdvectionLevelSet.cpp.

57{
58 Advection::v_InitObject(pSession, pFields);
59}
virtual SOLVER_UTILS_EXPORT void v_InitObject(LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields)
Initialises the advection object.

References Nektar::SolverUtils::Advection::v_InitObject().

Friends And Related Symbol Documentation

◆ MemoryManager< NSAdvectionLevelSet >

friend class MemoryManager< NSAdvectionLevelSet >
friend

Definition at line 1 of file NSAdvectionLevelSet.h.

Member Data Documentation

◆ className

std::string Nektar::NSAdvectionLevelSet::className
static
Initial value:
=
"NSLevelSet", NSAdvectionLevelSet::create, "NSLevelSet")
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
static SolverUtils::AdvectionSharedPtr create(std::string)
Creates an instance of this class.
AdvectionFactory & GetAdvectionFactory()
Gets the factory for initialising advection objects.
Definition Advection.cpp:43

Name of class.

Definition at line 56 of file NSAdvectionLevelSet.h.