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

The Roe flux through the trace normal, in Cartesian components (as the legacy RoeSolver). More...

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

The Roe flux through the trace normal, in Cartesian components (as the legacy RoeSolver).

The averages, wave strengths and eigenvectors of the Roe linearisation, written with the normal n alone: the normal components are dot products with n, and the shear waves, whose eigenvectors are the tangent directions, enter only through their sum, the tangential projection w - (n . w) n of w = [rho u] - u~ [rho]. In one dimension that projection vanishes.

Definition at line 60 of file RoeSolverKernels.hpp.

Member Function Documentation

◆ operator()()

template<typename ExecSpace , typename EqnOfStParams , unsigned int NDIM>
template<typename TData >
NEK_HOSTDEVICE_INLINE void Nektar::detail::RoeSolverKernel< 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, pointing from fwd to bwd, NDIM components.

Definition at line 70 of file RoeSolverKernels.hpp.

74 {
75 using std::abs;
76
77 const TData half = TData(0.5);
78
79 // Layout: [rho | m0 | m1 | m2 | E] but only first (NDIM) moment exist.
80 const auto l = fwd;
81 const auto r = bwd;
82
83 // The two sides' primitive quantities and the Roe averages.
84 RoeAverageState<NDIM, TData> s;
85 RoeAverages<NDIM>(EoS, l, r, blksize, s);
86 const TData rhoL = l[0], rhoR = r[0];
87 const TData EL = s.EL, ER = s.ER, pL = s.pL, pR = s.pR;
88 const auto &uL = s.uL, &uR = s.uR, &uRoe = s.uRoe;
89 const TData hRoe = s.hRoe, cRoe = s.cRoe, URoe2 = s.URoe2;
90
91 TData n[NDIM];
92 TData unL = TData(0.0), unR = TData(0.0), unRoe = TData(0.0);
93 for (unsigned int d = 0; d < NDIM; ++d)
94 {
95 n[d] = normal[d * blksize];
96 unL += n[d] * uL[d];
97 unR += n[d] * uR[d];
98 unRoe += n[d] * uRoe[d];
99 }
100 const TData invC = TData(1.0) / cRoe;
101
102 // Jumps: density, momentum (vector and normal), energy; and the shear
103 // vector w = [rho u] - u~ [rho] with its normal part removed.
104 const TData dRho = rhoR - rhoL;
105 TData dm[NDIM], w[NDIM];
106 TData dmn = TData(0.0), wn = TData(0.0), wDotU = TData(0.0);
107 for (unsigned int d = 0; d < NDIM; ++d)
108 {
109 dm[d] = r[(1u + d) * blksize] - l[(1u + d) * blksize];
110 w[d] = dm[d] - uRoe[d] * dRho;
111 dmn += n[d] * dm[d];
112 wn += n[d] * w[d];
113 wDotU += w[d] * uRoe[d];
114 }
115 // The energy jump less the tangential kinetic part: jumpbar = [E] -
116 // sum_t w_t u~_t.
117 const TData jumpbar = (ER - EL) - (wDotU - wn * unRoe);
118
119 const TData gamma = TData(EoS.gamma());
120 const TData alpha1 =
121 (gamma - TData(1.0)) *
122 (dRho * (hRoe - unRoe * unRoe) + unRoe * dmn - jumpbar) *
123 (invC * invC);
124 const TData alpha0 =
125 (dRho * (unRoe + cRoe) - dmn - cRoe * alpha1) * (half * invC);
126 const TData alpha4 = dRho - (alpha0 + alpha1);
127
128 const TData lam0 = abs(unRoe - cRoe), lam1 = abs(unRoe),
129 lam4 = abs(unRoe + cRoe);
130 const TData t0 = half * alpha0 * lam0, t1 = half * alpha1 * lam1,
131 t4 = half * alpha4 * lam4, ts = half * lam1;
132
133 // Central flux through n, then the dissipation of the wave groups.
134 flux[0] = half * (rhoL * unL + rhoR * unR) - (t0 + t1 + t4);
135 for (unsigned int d = 0; d < NDIM; ++d)
136 {
137 flux[(1u + d) * blksize] =
138 half * (l[(1u + d) * blksize] * unL +
139 r[(1u + d) * blksize] * unR + (pL + pR) * n[d]) -
140 (t0 * (uRoe[d] - cRoe * n[d]) + t1 * uRoe[d] +
141 t4 * (uRoe[d] + cRoe * n[d]) + ts * (w[d] - wn * n[d]));
142 }
143 flux[(1u + NDIM) * blksize] =
144 half * (unL * (EL + pL) + unR * (ER + pR)) -
145 (t0 * (hRoe - unRoe * cRoe) + t1 * half * URoe2 +
146 t4 * (hRoe + unRoe * cRoe) + ts * (wDotU - wn * unRoe));
147 }
detail::IdealGasEoS< double > EoS
std::vector< double > d(NPUPPER *NPUPPER)
scalarT< T > abs(scalarT< T > in)
Definition scalar.hpp:294

References tinysimd::abs(), Nektar::detail::RoeAverageState< NDIM, vec_t >::cRoe, Nektar::detail::RoeAverageState< NDIM, vec_t >::EL, Nektar::detail::RoeAverageState< NDIM, vec_t >::ER, Nektar::detail::RoeAverageState< NDIM, vec_t >::hRoe, Nektar::detail::RoeAverageState< NDIM, vec_t >::pL, Nektar::detail::RoeAverageState< NDIM, vec_t >::pR, Nektar::detail::RoeAverageState< NDIM, vec_t >::uL, Nektar::detail::RoeAverageState< NDIM, vec_t >::uR, Nektar::detail::RoeAverageState< NDIM, vec_t >::uRoe, and Nektar::detail::RoeAverageState< NDIM, vec_t >::URoe2.