Branch data Line data Source code
1 : : // *****************************************************************************
2 : : /*!
3 : : \file src/PDE/CompFlow/Problem/SodShocktube.cpp
4 : : \copyright 2012-2015 J. Bakosi,
5 : : 2016-2018 Los Alamos National Security, LLC.,
6 : : 2019-2021 Triad National Security, LLC.
7 : : All rights reserved. See the LICENSE file for details.
8 : : \brief Problem configuration for the compressible flow equations
9 : : \details This file defines a Problem policy class for the compressible flow
10 : : equations, defined in PDE/CompFlow/CompFlow.h. See PDE/CompFlow/Problem.h
11 : : for general requirements on Problem policy classes for CompFlow.
12 : : */
13 : : // *****************************************************************************
14 : :
15 : : #include "SodShocktube.hpp"
16 : : #include "FieldOutput.hpp"
17 : :
18 : : using inciter::CompFlowProblemSodShocktube;
19 : :
20 : : tk::InitializeFn::result_type
21 : 816873 : CompFlowProblemSodShocktube::initialize( ncomp_t,
22 : : const std::vector< EOS >& mat_blk,
23 : : tk::real x,
24 : : tk::real,
25 : : tk::real,
26 : : tk::real )
27 : : // *****************************************************************************
28 : : //! Evaluate analytical solution at (x,y,z,t) for all components
29 : : //! \param[in] x X coordinate where to evaluate the solution
30 : : //! \return Values of all components evaluated at (x)
31 : : //! \note The function signature must follow tk::InitializeFn
32 : : //! \details This function only initializes the Sod shock tube problem, but does
33 : : //! not actually give the analytical solution at time greater than 0. The
34 : : //! analytical solution would require an exact Riemann solver, which has not
35 : : //! been implemented yet.
36 : : // *****************************************************************************
37 : : {
38 : : tk::real r, p, u, v, w, rE;
39 [ + + ]: 816873 : if (x<0.5) {
40 : : // density
41 : 406677 : r = 1.0;
42 : : // pressure
43 : 406677 : p = 1.0;
44 : : // velocity
45 : 406677 : u = 0.0;
46 : 406677 : v = 0.0;
47 : 406677 : w = 0.0;
48 : : }
49 : : else {
50 : : // density
51 : 410196 : r = 0.125;
52 : : // pressure
53 : 410196 : p = 0.1;
54 : : // velocity
55 : 410196 : u = 0.0;
56 : 410196 : v = 0.0;
57 : 410196 : w = 0.0;
58 : : }
59 : : // total specific energy
60 [ + - ]: 816873 : rE = mat_blk[0].compute< EOS::totalenergy >( r, u, v, w, p );
61 : :
62 : 816873 : return {{ r, r*u, r*v, r*w, rE }};
63 : : }
64 : :
65 : : tk::InitializeFn::result_type
66 : 0 : CompFlowProblemSodShocktube::analyticSolution(
67 : : ncomp_t,
68 : : const std::vector< EOS >& mat_blk,
69 : : tk::real x,
70 : : tk::real,
71 : : tk::real,
72 : : tk::real )
73 : : // *****************************************************************************
74 : : //! Evaluate analytical solution at (x,y,z,t) for all components
75 : : //! \param[in] x X coordinate where to evaluate the solution
76 : : //! \return Values of all components evaluated at (x)
77 : : //! \note The function signature must follow tk::InitializeFn
78 : : //! \warning This is NOT the analytic solution at all times, only at t=0
79 : : // *****************************************************************************
80 : : {
81 : 0 : return initialize( 0, mat_blk, x, 0, 0, 0 );
82 : : }
83 : :
84 : : std::vector< std::string >
85 [ - - ]: 0 : CompFlowProblemSodShocktube::analyticFieldNames( ncomp_t ) const
86 : : // *****************************************************************************
87 : : // Return analytic field names to be output to file
88 : : //! \return Vector of strings labelling analytic fields output in file
89 : : // *****************************************************************************
90 : : {
91 : : std::vector< std::string > n;
92 [ - - ]: 0 : n.push_back( "density_analytical" );
93 [ - - ]: 0 : n.push_back( "x-velocity_analytical" );
94 [ - - ]: 0 : n.push_back( "y-velocity_analytical" );
95 [ - - ]: 0 : n.push_back( "z-velocity_analytical" );
96 [ - - ]: 0 : n.push_back( "specific_total_energy_analytical" );
97 [ - - ]: 0 : n.push_back( "pressure_analytical" );
98 : :
99 : 0 : return n;
100 : : }
101 : :
102 : : std::vector< std::string >
103 : 15 : CompFlowProblemSodShocktube::names( ncomp_t ) const
104 : : // *****************************************************************************
105 : : // Return names of integral variables to be output to diagnostics file
106 : : //! \return Vector of strings labelling integral variables output
107 : : // *****************************************************************************
108 : : {
109 [ + - ][ + - ]: 90 : return { "r", "ru", "rv", "rw", "re" };
[ + - ][ + - ]
[ + - ][ - + ]
[ + + ][ - + ]
[ - - ][ - - ]
110 : : }
|