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

#include <AdvectionWeakDG.h>

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

Static Public Member Functions

static AdvectionSharedPtr create (std::string advType)
 

Static Public Attributes

static std::string type
 

Protected Member Functions

 AdvectionWeakDG ()
 
virtual void v_InitObject (LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields)
 Initialise AdvectionWeakDG objects and store them before starting the time-stepping. More...
 
virtual void v_Advect (const int nConvective, 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)
 Compute the advection term at each time-step using the Discontinuous Galerkin approach (DG). More...
 
- Protected Member Functions inherited from Nektar::SolverUtils::Advection
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...
 

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...
 
- 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...
 

Detailed Description

Definition at line 46 of file AdvectionWeakDG.h.

Constructor & Destructor Documentation

◆ AdvectionWeakDG()

Nektar::SolverUtils::AdvectionWeakDG::AdvectionWeakDG ( )
protected

Definition at line 48 of file AdvectionWeakDG.cpp.

Referenced by create().

49  {
50  }

Member Function Documentation

◆ create()

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

Definition at line 49 of file AdvectionWeakDG.h.

References AdvectionWeakDG().

50  {
51  boost::ignore_unused(advType);
52  return AdvectionSharedPtr(new AdvectionWeakDG());
53  }
std::shared_ptr< Advection > AdvectionSharedPtr
A shared pointer to an Advection object.
Definition: Advection.h:170

◆ v_Advect()

void Nektar::SolverUtils::AdvectionWeakDG::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 
)
protectedvirtual

Compute the advection term at each time-step using the Discontinuous Galerkin approach (DG).

Parameters
nConvectiveFieldsNumber of fields.
fieldsPointer to fields.
advVelAdvection velocities.
inarraySolution at the previous time-step.
outarrayAdvection term to be passed at the time integration class.

Implements Nektar::SolverUtils::Advection.

Definition at line 77 of file AdvectionWeakDG.cpp.

References ASSERTL1, Nektar::SolverUtils::Advection::m_fluxVector, Nektar::SolverUtils::Advection::m_riemann, Nektar::SolverUtils::Advection::m_spaceDim, Vmath::Neg(), and Nektar::NullNekDoubleArrayofArray.

86  {
87  boost::ignore_unused(advVel, time);
88 
89  int nPointsTot = fields[0]->GetTotPoints();
90  int nCoeffs = fields[0]->GetNcoeffs();
91  int nTracePointsTot = fields[0]->GetTrace()->GetTotPoints();
92  int i, j;
93 
94  Array<OneD, Array<OneD, NekDouble> > tmp(nConvectiveFields);
95  Array<OneD, Array<OneD, Array<OneD, NekDouble> > > fluxvector(
96  nConvectiveFields);
97 
98  // Allocate storage for flux vector F(u).
99  for (i = 0; i < nConvectiveFields; ++i)
100  {
101  fluxvector[i] =
102  Array<OneD, Array<OneD, NekDouble> >(m_spaceDim);
103  for (j = 0; j < m_spaceDim; ++j)
104  {
105  fluxvector[i][j] = Array<OneD, NekDouble>(nPointsTot);
106  }
107  }
108 
110  "Riemann solver must be provided for AdvectionWeakDG.");
111 
112  m_fluxVector(inarray, fluxvector);
113 
114  // Get the advection part (without numerical flux)
115  for(i = 0; i < nConvectiveFields; ++i)
116  {
117  tmp[i] = Array<OneD, NekDouble>(nCoeffs, 0.0);
118 
119  fields[i]->IProductWRTDerivBase(fluxvector[i],tmp[i]);
120  }
121 
122  // Store forwards/backwards space along trace space
123  Array<OneD, Array<OneD, NekDouble> > Fwd (nConvectiveFields);
124  Array<OneD, Array<OneD, NekDouble> > Bwd (nConvectiveFields);
125  Array<OneD, Array<OneD, NekDouble> > numflux(nConvectiveFields);
126 
127  if (pFwd == NullNekDoubleArrayofArray ||
129  {
130  for(i = 0; i < nConvectiveFields; ++i)
131  {
132  Fwd[i] = Array<OneD, NekDouble>(nTracePointsTot, 0.0);
133  Bwd[i] = Array<OneD, NekDouble>(nTracePointsTot, 0.0);
134  numflux[i] = Array<OneD, NekDouble>(nTracePointsTot, 0.0);
135  fields[i]->GetFwdBwdTracePhys(inarray[i], Fwd[i], Bwd[i]);
136  }
137  }
138  else
139  {
140  for(i = 0; i < nConvectiveFields; ++i)
141  {
142  Fwd[i] = pFwd[i];
143  Bwd[i] = pBwd[i];
144  numflux[i] = Array<OneD, NekDouble>(nTracePointsTot, 0.0);
145  }
146  }
147 
148  m_riemann->Solve(m_spaceDim, Fwd, Bwd, numflux);
149 
150  // Evaulate <\phi, \hat{F}\cdot n> - OutField[i]
151  for(i = 0; i < nConvectiveFields; ++i)
152  {
153  Vmath::Neg (nCoeffs, tmp[i], 1);
154  fields[i]->AddTraceIntegral (numflux[i], tmp[i]);
155  fields[i]->MultiplyByElmtInvMass(tmp[i], tmp[i]);
156  fields[i]->BwdTrans (tmp[i], outarray[i]);
157  }
158  }
RiemannSolverSharedPtr m_riemann
Riemann solver for DG-type schemes.
Definition: Advection.h:143
void Neg(int n, T *x, const int incx)
Negate x = -x.
Definition: Vmath.cpp:399
AdvectionFluxVecCB m_fluxVector
Callback function to the flux vector (set when advection is in conservative form).
Definition: Advection.h:141
static Array< OneD, Array< OneD, NekDouble > > NullNekDoubleArrayofArray
int m_spaceDim
Storage for space dimension. Used for homogeneous extension.
Definition: Advection.h:145
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:250

◆ v_InitObject()

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

Initialise AdvectionWeakDG 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 59 of file AdvectionWeakDG.cpp.

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

62  {
63  Advection::v_InitObject(pSession, pFields);
64  }
virtual SOLVER_UTILS_EXPORT void v_InitObject(LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields)
Initialises the advection object.
Definition: Advection.cpp:98

Member Data Documentation

◆ type

std::string Nektar::SolverUtils::AdvectionWeakDG::type
static
Initial value:
RegisterCreatorFunction("WeakDG", AdvectionWeakDG::create)

Definition at line 55 of file AdvectionWeakDG.h.