35#include <boost/test/tools/floating_point_comparison.hpp>
36#include <boost/test/unit_test.hpp>
39#include "../RoeSolver.h"
40#include "../RoeSolverSIMD.h"
55 riemannSolver.SetParam(
"gamma",
56 [&gamma]() ->
NekDouble & {
return gamma; });
64 for (
size_t i = 0; i < spaceDim; ++i)
66 vecLocs[0][i] = 1 + i;
68 riemannSolver.SetAuxVec(
76 for (
size_t i = 0; i < spaceDim; ++i)
80 riemannSolver.SetVector(
85 size_t nFields = spaceDim + 2;
87 flx(nFields), flxRef(nFields);
88 for (
size_t i = 0; i < nFields; ++i)
99 for (
size_t i = 0; i < npts; ++i)
121 rhoe + 0.5 * (rhou * rhou + rhov * rhov + rhow * rhow) / rho;
122 fwd[nFields - 1][i] = E;
123 bwd[nFields - 1][i] = E;
128 flxRef[1][i] = rhou * rhou / rho +
p;
129 flxRef[2][i] = rhou * rhov / rho;
130 flxRef[3][i] = rhou * rhow / rho;
131 flxRef[nFields - 1][i] = (E +
p) * rhou / rho;
134 riemannSolver.Solve(spaceDim, fwd, bwd, flx);
137 for (
size_t i = 0; i < npts; ++i)
139 BOOST_CHECK_CLOSE(flxRef[0][i], flx[0][i], 1e-10);
140 BOOST_CHECK_CLOSE(flxRef[1][i], flx[1][i], 1e-10);
141 BOOST_CHECK_CLOSE(flxRef[2][i], flx[2][i], 1e-10);
142 BOOST_CHECK_CLOSE(flxRef[3][i], flx[3][i], 1e-10);
143 BOOST_CHECK_CLOSE(flxRef[4][i], flx[4][i], 1e-10);
158 riemannSolver.SetParam(
"gamma",
159 [&gamma]() ->
NekDouble & {
return gamma; });
167 for (
size_t i = 0; i < spaceDim; ++i)
169 vecLocs[0][i] = 1 + i;
171 riemannSolver.SetAuxVec(
179 for (
size_t i = 0; i < spaceDim; ++i)
183 riemannSolver.SetVector(
188 size_t nFields = spaceDim + 2;
190 flx(nFields), flxRef(nFields);
191 for (
size_t i = 0; i < nFields; ++i)
221 NekDouble E = rhoe + 0.5 * (rhou * rhou + rhov * rhov + rhow * rhow) / rho;
222 fwd[nFields - 1][0] = E;
223 bwd[nFields - 1][0] = E;
228 flxRef[1][0] = rhov * rhou / rho;
229 flxRef[2][0] = rhov * rhov / rho +
p;
230 flxRef[3][0] = rhov * rhow / rho;
231 flxRef[nFields - 1][0] = (E +
p) * rhov / rho;
233 riemannSolver.Solve(spaceDim, fwd, bwd, flx);
236 BOOST_CHECK_CLOSE(flxRef[0][0], flx[0][0], 1e-10);
237 BOOST_CHECK_CLOSE(flxRef[1][0], flx[1][0], 1e-10);
238 BOOST_CHECK_CLOSE(flxRef[2][0], flx[2][0], 1e-10);
239 BOOST_CHECK_CLOSE(flxRef[3][0], flx[3][0], 1e-10);
240 BOOST_CHECK_CLOSE(flxRef[4][0], flx[4][0], 1e-10);
254 riemannSolver.SetParam(
"gamma",
255 [&gamma]() ->
NekDouble & {
return gamma; });
263 for (
size_t i = 0; i < spaceDim; ++i)
265 vecLocs[0][i] = 1 + i;
267 riemannSolver.SetAuxVec(
275 for (
size_t i = 0; i < spaceDim; ++i)
279 riemannSolver.SetVector(
284 size_t nFields = spaceDim + 2;
286 flx(nFields), flxRef(nFields);
287 for (
size_t i = 0; i < nFields; ++i)
317 NekDouble E = rhoe + 0.5 * (rhou * rhou + rhov * rhov + rhow * rhow) / rho;
318 fwd[nFields - 1][0] = E;
319 bwd[nFields - 1][0] = E;
324 flxRef[1][0] = rhow * rhou / rho;
325 flxRef[2][0] = rhow * rhov / rho;
326 flxRef[3][0] = rhow * rhow / rho +
p;
327 flxRef[nFields - 1][0] = (E +
p) * rhow / rho;
329 riemannSolver.Solve(spaceDim, fwd, bwd, flx);
332 BOOST_CHECK_CLOSE(flxRef[0][0], flx[0][0], 1e-10);
333 BOOST_CHECK_CLOSE(flxRef[1][0], flx[1][0], 1e-10);
334 BOOST_CHECK_CLOSE(flxRef[2][0], flx[2][0], 1e-10);
335 BOOST_CHECK_CLOSE(flxRef[3][0], flx[3][0], 1e-10);
336 BOOST_CHECK_CLOSE(flxRef[4][0], flx[4][0], 1e-10);
350 riemannSolver.SetParam(
"gamma",
351 [&gamma]() ->
NekDouble & {
return gamma; });
359 for (
size_t i = 0; i < spaceDim; ++i)
361 vecLocs[0][i] = 1 + i;
363 riemannSolver.SetAuxVec(
371 for (
size_t i = 0; i < spaceDim; ++i)
375 riemannSolver.SetVector(
380 size_t nFields = spaceDim + 2;
382 flx(nFields), flxRef(nFields);
383 for (
size_t i = 0; i < nFields; ++i)
394 for (
size_t i = 0; i < npts; ++i)
417 rhoe + 0.5 * (rhou * rhou + rhov * rhov + rhow * rhow) / rhoL;
419 rhoe + 0.5 * (rhou * rhou + rhov * rhov + rhow * rhow) / rhoR;
420 fwd[nFields - 1][i] = EL;
421 bwd[nFields - 1][i] = ER;
425 flxRef[0][i] = 0.87858599768171342;
426 flxRef[1][i] = 2.0449028304431223;
427 flxRef[2][i] = 1.8282946712594808;
428 flxRef[3][i] = 2.7424420068892208;
429 flxRef[nFields - 1][i] = 9.8154698039903128;
432 riemannSolver.Solve(spaceDim, fwd, bwd, flx);
435 for (
size_t i = 0; i < npts; ++i)
437 BOOST_CHECK_CLOSE(flxRef[0][i], flx[0][i], 1e-10);
438 BOOST_CHECK_CLOSE(flxRef[1][i], flx[1][i], 1e-10);
439 BOOST_CHECK_CLOSE(flxRef[2][i], flx[2][i], 1e-10);
440 BOOST_CHECK_CLOSE(flxRef[3][i], flx[3][i], 1e-10);
441 BOOST_CHECK_CLOSE(flxRef[4][i], flx[4][i], 1e-10);
The above copyright notice and this permission notice shall be included.
BOOST_AUTO_TEST_CASE(RoeAlongXconstSolution)