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

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

#include <HLLCSolverKernels.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::HLLCSolverKernel< ExecSpace, EqnOfStParams, NDIM >

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

Definition at line 55 of file HLLCSolverKernels.hpp.

Member Function Documentation

◆ operator()()

template<typename ExecSpace , typename EqnOfStParams , unsigned int NDIM>
template<typename TData >
NEK_HOSTDEVICE_INLINE void Nektar::detail::HLLCSolverKernel< 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 HLLCSolverKernels.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 // Mass flux through the normal from each side, and the largest wave
93 // speeds.
94 const TData mnL = rhoL * unL;
95 const TData mnR = rhoR * unR;
96 const TData SL = min(unL - cL, unRoe - cRoe);
97 const TData SR = max(unR + cR, unRoe + cRoe);
98
99 // HLLC: the star state on the side the contact wave SM leaves
100 // behind. Only the normal velocity changes there, to SM; the
101 // tangential velocity is advected unaltered, which in Cartesian
102 // components is u + (SM - u.n) n.
103 //
104 // Every point, or lane of a vector, forms the one-sided fluxes and the
105 // star flux, and takes the one its wave speeds select: the left flux
106 // where SL >= 0, the right where SR <= 0, the star flux otherwise. A
107 // flux not taken may hold any value.
108 const TData SM = (pR - pL + mnL * (SL - unL) - mnR * (SR - unR)) /
109 (rhoL * (SL - unL) - rhoR * (SR - unR));
110 const auto left = SL >= TData(0.0);
111 const auto right = SR <= TData(0.0);
112 const auto side = SM >= TData(0.0);
113 const TData rho = Select(side, rhoL, rhoR);
114 const TData un = Select(side, unL, unR);
115 const TData p = Select(side, pL, pR);
116 const TData E = Select(side, EL, ER);
117 const TData S = Select(side, SL, SR);
118 const TData mn = rho * un;
119 const TData rhoM = rho * (S - un) / (S - SM);
120 const TData EM =
121 rhoM * (E / rho + (SM - un) * (SM + p / (rho * (S - un))));
122
123 flux[0] = Select(left, mnL, Select(right, mnR, mn + S * (rhoM - rho)));
124 for (unsigned int d = 0; d < NDIM; ++d)
125 {
126 const TData rhouL = l[(1u + d) * blksize],
127 rhouR = r[(1u + d) * blksize];
128 const TData u = Select(side, uL[d], uR[d]);
129 const TData rhou = Select(side, rhouL, rhouR);
130 const TData mM = rhoM * (u + (SM - un) * n[d]);
131 flux[(1u + d) * blksize] =
132 Select(left, rhouL * unL + pL * n[d],
133 Select(right, rhouR * unR + pR * n[d],
134 rhou * un + p * n[d] + S * (mM - rhou)));
135 }
136 flux[(1u + NDIM) * blksize] =
137 Select(left, unL * (EL + pL),
138 Select(right, unR * (ER + pR), un * (E + p) + S * (EM - E)));
139 }
std::vector< double > p(NPUPPER)
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 Select(const TMask &m, const TData &a, const TData &b)
a where m holds, and b elsewhere.
Definition Backends.hpp:353
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::Select(), Nektar::detail::RoeAverageState< NDIM, vec_t >::uL, Nektar::detail::RoeAverageState< NDIM, vec_t >::uR, and Nektar::detail::RoeAverageState< NDIM, vec_t >::uRoe.