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

The AUSM flux through the trace normal, in Cartesian components (as the legacy AUSM solvers): the interface Mach number and pressure from the normal Mach numbers by AUSMUpwinding, the upwind state advected through the normal and the pressure acting along it. More...

#include <AUSMSolverKernels.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, typename AUSMUpwinding>
struct Nektar::detail::AUSMSolverKernel< ExecSpace, EqnOfStParams, NDIM, AUSMUpwinding >

The AUSM flux through the trace normal, in Cartesian components (as the legacy AUSM solvers): the interface Mach number and pressure from the normal Mach numbers by AUSMUpwinding, the upwind state advected through the normal and the pressure acting along it.

Definition at line 194 of file AUSMSolverKernels.hpp.

Member Function Documentation

◆ operator()()

template<typename ExecSpace , typename EqnOfStParams , unsigned int NDIM, typename AUSMUpwinding >
template<typename TData >
NEK_HOSTDEVICE_INLINE void Nektar::detail::AUSMSolverKernel< ExecSpace, EqnOfStParams, NDIM, AUSMUpwinding >::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 199 of file AUSMSolverKernels.hpp.

203 {
204 const TData half = TData(0.5);
205
206 // Layout: [rho | m0 | m1 | m2 | E] but only first (NDIM) moment exist.
207 const auto l = fwd;
208 const auto r = bwd;
209
210 // Velocities, normal velocities and kinetic energy terms, with one
211 // reciprocal per density in place of a division at every use.
212 const TData rhoL = l[0], rhoR = r[0];
213 const TData invRhoL = TData(1.0) / rhoL;
214 const TData invRhoR = TData(1.0) / rhoR;
215 TData n[NDIM], uL[NDIM], uR[NDIM];
216 TData unL = TData(0.0), unR = TData(0.0);
217 TData qL2 = TData(0.0), qR2 = TData(0.0);
218 for (unsigned int d = 0; d < NDIM; ++d)
219 {
220 n[d] = normal[d * blksize];
221 const TData rhouL = l[(1u + d) * blksize];
222 const TData rhouR = r[(1u + d) * blksize];
223 uL[d] = rhouL * invRhoL;
224 uR[d] = rhouR * invRhoR;
225 unL += n[d] * uL[d];
226 unR += n[d] * uR[d];
227 qL2 += rhouL * uL[d];
228 qR2 += rhouR * uR[d];
229 }
230
231 // Internal energy per unit mass, pressure and sound speed.
232 const TData EL = l[(1u + NDIM) * blksize];
233 const TData ER = r[(1u + NDIM) * blksize];
234 const TData eL = (EL - half * qL2) * invRhoL;
235 const TData eR = (ER - half * qR2) * invRhoR;
236 const TData pL = GetPressure(EoS, rhoL, eL);
237 const TData pR = GetPressure(EoS, rhoR, eR);
238 const TData cL = GetSoundSpeed(EoS, rhoL, eL);
239 const TData cR = GetSoundSpeed(EoS, rhoR, eR);
240
241 // Average speed of sound and the normal Mach numbers.
242 const TData cA = half * (cL + cR);
243 const TData invC = TData(1.0) / cA;
244 const TData ML = unL * invC;
245 const TData MR = unR * invC;
246
247 // Interface Mach number and pressure, and the mass flux they carry.
248 TData pbar, Mbar;
249 AUSMUpwinding()(cA, rhoL, rhoR, pL, pR, ML, MR, pbar, Mbar);
250 const TData mn = cA * Mbar;
251
252 // The upwind state, lane by lane for a vector.
253 const auto cond = Mbar >= TData(0.0);
254 const TData rhoUp = Select(cond, rhoL, rhoR);
255 const TData pUp = Select(cond, pL, pR);
256 const TData EUp = Select(cond, EL, ER);
257
258 flux[0] = mn * rhoUp;
259 for (unsigned int d = 0; d < NDIM; ++d)
260 {
261 flux[(1u + d) * blksize] =
262 mn * rhoUp * Select(cond, uL[d], uR[d]) + pbar * n[d];
263 }
264 flux[(1u + NDIM) * blksize] = mn * (EUp + pUp);
265 }
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 GetPressure(const IdealGasEoS< TScalar > &EoS, const TData &rho, const TData &e)
Ideal gas equation of state Helper function p = rho * R * T.
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

References Nektar::detail::GetPressure(), Nektar::detail::GetSoundSpeed(), and Nektar::Select().