Nektar++
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Nektar::detail::AverageSolverKernel< ExecSpace, EqnOfStParams, NDIM > Struct Template Reference

The average of the two states' fluxes through the trace normal, in Cartesian components (as the legacy AverageSolver). More...

#include <AverageSolverKernels.hpp>

Public Member Functions

template<typename TData >
NEK_HOSTDEVICE_INLINE void operator() (const EqnOfStParams &EoS, const size_t blksize, const TData *fwd, const TData *bwd, const TData *normal, TData *flux)
 

Detailed Description

template<typename ExecSpace, typename EqnOfStParams, unsigned int NDIM>
struct Nektar::detail::AverageSolverKernel< ExecSpace, EqnOfStParams, NDIM >

The average of the two states' fluxes through the trace normal, in Cartesian components (as the legacy AverageSolver).

Definition at line 51 of file AverageSolverKernels.hpp.

Member Function Documentation

◆ operator()()

template<typename ExecSpace , typename EqnOfStParams , unsigned int NDIM>
template<typename TData >
NEK_HOSTDEVICE_INLINE void Nektar::detail::AverageSolverKernel< ExecSpace, EqnOfStParams, NDIM >::operator() ( const EqnOfStParams &  EoS,
const size_t  blksize,
const TData *  fwd,
const TData *  bwd,
const TData *  normal,
TData *  flux 
)
inline
Parameters
blksizeComponent stride, in TData (a scalar or a SIMD vector of points): component c of the states, the normal and the flux lies at offset c * blksize.
normalThe unit trace normal, NDIM components.

Definition at line 60 of file AverageSolverKernels.hpp.

64 {
65 const TData oneHalf = 0.5;
66
67 // Layout: [rho | m0 | m1 | m2 | E] but only first (NDIM) moment exist.
68 const TData rhoL = fwd[0];
69 const TData rhoR = bwd[0];
70
71 TData n[NDIM], mL[NDIM], mR[NDIM];
72 TData unL = 0.0, unR = 0.0, qL2 = 0.0, qR2 = 0.0;
73#pragma unroll
74 for (unsigned int d = 0; d < NDIM; ++d)
75 {
76 n[d] = normal[d * blksize];
77 mL[d] = fwd[(1u + d) * blksize];
78 mR[d] = bwd[(1u + d) * blksize];
79 const TData uLd = mL[d] / rhoL;
80 const TData uRd = mR[d] / rhoR;
81 unL += uLd * n[d];
82 unR += uRd * n[d];
83 qL2 += mL[d] * uLd;
84 qR2 += mR[d] * uRd;
85 }
86
87 const TData EL = fwd[(1u + NDIM) * blksize];
88 const TData ER = bwd[(1u + NDIM) * blksize];
89 const TData eL = (EL - oneHalf * qL2) / rhoL;
90 const TData eR = (ER - oneHalf * qR2) / rhoR;
91 const TData pL = GetPressure(EoS, rhoL, eL);
92 const TData pR = GetPressure(EoS, rhoR, eR);
93
94 flux[0] = oneHalf * (rhoL * unL + rhoR * unR);
95#pragma unroll
96 for (unsigned int d = 0; d < NDIM; ++d)
97 {
98 flux[(1u + d) * blksize] =
99 oneHalf * (mL[d] * unL + mR[d] * unR + (pL + pR) * n[d]);
100 }
101 flux[(1u + NDIM) * blksize] =
102 oneHalf * (unL * (EL + pL) + unR * (ER + pR));
103 }
std::vector< double > d(NPUPPER *NPUPPER)
NEK_HOSTDEVICE_INLINE TData GetPressure(const IdealGasEoS< TScalar > &EoS, const TData &rho, const TData &e)
Ideal gas equation of state Helper function p = rho * R * T.

References Nektar::detail::GetPressure().