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

The HLL flux through the trace normal, in Cartesian components (as the legacy HLLSolver), with the Einfeldt wave speeds from the Roe average. More...

#include <HLLSolverKernels.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)
 normal: the unit trace normal, NDIM components at the states' stride blksize, in TData (a scalar or a SIMD vector of points).
 

Detailed Description

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

The HLL flux through the trace normal, in Cartesian components (as the legacy HLLSolver), with the Einfeldt wave speeds from the Roe average.

Definition at line 55 of file HLLSolverKernels.hpp.

Member Function Documentation

◆ operator()()

template<typename ExecSpace , typename EqnOfStParams , unsigned int NDIM>
template<typename TData >
NEK_HOSTDEVICE_INLINE void Nektar::detail::HLLSolverKernel< ExecSpace, EqnOfStParams, NDIM >::operator() ( const EqnOfStParams &  EoS,
const size_t  blksize,
const TData *  fwd,
const TData *  bwd,
const TData *  normal,
TData *  flux 
)
inline

normal: the unit trace normal, NDIM components at the states' stride blksize, in TData (a scalar or a SIMD vector of points).

Definition at line 60 of file HLLSolverKernels.hpp.

64 {
65 using std::max;
66 using std::min;
67
68 // Layout: [rho | m0 | m1 | m2 | E] but only first (NDIM) moment exist.
69 const auto l = fwd;
70 const auto r = bwd;
71
72 // The two sides' primitive quantities and the Roe averages.
73 RoeAverageState<NDIM, TData> s;
74 RoeAverages<NDIM>(EoS, l, r, blksize, s);
75 const TData rhoL = l[0], rhoR = r[0];
76 const TData EL = s.EL, ER = s.ER, pL = s.pL, pR = s.pR;
77 const auto &uL = s.uL, &uR = s.uR, &uRoe = s.uRoe;
78 const TData cRoe = s.cRoe;
79 const TData cL = GetSoundSpeed(EoS, rhoL, s.eL);
80 const TData cR = GetSoundSpeed(EoS, rhoR, s.eR);
81
82 TData n[NDIM];
83 TData unL = TData(0.0), unR = TData(0.0), unRoe = TData(0.0);
84 for (unsigned int d = 0; d < NDIM; ++d)
85 {
86 n[d] = normal[d * blksize];
87 unL += n[d] * uL[d];
88 unR += n[d] * uR[d];
89 unRoe += n[d] * uRoe[d];
90 }
91
92 // The largest wave speeds, clamped at zero: SL- = min(SL, 0) and
93 // SR+ = max(SR, 0). With them the three cases of HLL - the left
94 // state's flux where SL >= 0, the right's where SR <= 0, and the HLL
95 // flux between - are the one expression
96 // F = (SR+ FL - SL- FR + SR+ SL- (UR - UL)) / (SR+ - SL-),
97 // so every lane takes it without a branch. SR+ - SL- is zero only
98 // when both speeds are, where the flux is taken as zero.
99 const TData SLm = min(min(unL - cL, unRoe - cRoe), TData(0.0));
100 const TData SRp = max(max(unR + cR, unRoe + cRoe), TData(0.0));
101 const TData invS = SafeDivide(TData(1.0), SRp - SLm);
102 const TData SLR = SRp * SLm;
103
104 // Jumps: density and momentum.
105 const TData dRho = rhoR - rhoL;
106
107 flux[0] = (SRp * rhoL * unL - SLm * rhoR * unR + SLR * dRho) * invS;
108 for (unsigned int d = 0; d < NDIM; ++d)
109 {
110 const TData rhouL = l[(1u + d) * blksize],
111 rhouR = r[(1u + d) * blksize];
112 const TData dm = rhouR - rhouL;
113 flux[(1u + d) * blksize] =
114 (SRp * (rhouL * unL + pL * n[d]) -
115 SLm * (rhouR * unR + pR * n[d]) + SLR * dm) *
116 invS;
117 }
118 flux[(1u + NDIM) * blksize] =
119 (SRp * unL * (EL + pL) - SLm * unR * (ER + pR) + SLR * (ER - EL)) *
120 invS;
121 }
std::vector< double > d(NPUPPER *NPUPPER)
NEK_HOSTDEVICE_INLINE TData GetSoundSpeed(const IdealGasEoS< TScalar > &EoS, const TData &rho, const TData &e)
NEK_HOSTDEVICE_INLINE TData SafeDivide(const TData &num, const TData &den)
num / den, and zero where den is zero.
scalarT< T > max(scalarT< T > lhs, scalarT< T > rhs)
Definition scalar.hpp:304
scalarT< T > min(scalarT< T > lhs, scalarT< T > rhs)
Definition scalar.hpp:299

References Nektar::detail::RoeAverageState< NDIM, vec_t >::cRoe, Nektar::detail::RoeAverageState< NDIM, vec_t >::EL, Nektar::detail::RoeAverageState< NDIM, vec_t >::eL, Nektar::detail::RoeAverageState< NDIM, vec_t >::ER, Nektar::detail::RoeAverageState< NDIM, vec_t >::eR, Nektar::detail::GetSoundSpeed(), tinysimd::max(), tinysimd::min(), Nektar::detail::RoeAverageState< NDIM, vec_t >::pL, Nektar::detail::RoeAverageState< NDIM, vec_t >::pR, Nektar::SafeDivide(), Nektar::detail::RoeAverageState< NDIM, vec_t >::uL, Nektar::detail::RoeAverageState< NDIM, vec_t >::uR, and Nektar::detail::RoeAverageState< NDIM, vec_t >::uRoe.