Branch data Line data Source code
1 : : // *****************************************************************************
2 : : /*!
3 : : \file src/PDE/EoS/JWL.hpp
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 Jones, Wilkins, and Lee (JWL) equation of state
9 : : \details This file declares functions for the JWL equation of
10 : : state for the compressible flow equations. These functions are
11 : : taken from 'JWL Equation of State', Menikoff, LA-UR-15-29536.
12 : : */
13 : : // *****************************************************************************
14 : : #ifndef JWL_h
15 : : #define JWL_h
16 : :
17 : : #include "Data.hpp"
18 : :
19 : : namespace inciter {
20 : :
21 : : class JWL {
22 : :
23 : : private:
24 : : tk::real m_w, m_cv, m_rho0, m_de, m_rhor, m_tr, m_pr, m_a, m_b, m_r1, m_r2;
25 : :
26 : : //! Calculate specific internal energy
27 : : tk::real intEnergy( tk::real rho, tk::real pr ) const;
28 : :
29 : : //! \brief Calculate density from known pressure and temperature using
30 : : //! bisection root finding method
31 : : tk::real bisection( tk::real a, tk::real b, tk::real p_known,
32 : : tk::real t_known ) const;
33 : :
34 : : //! Calculate pressure from density and temperature
35 : : tk::real PfromRT( tk::real rho, tk::real T) const;
36 : :
37 : : public:
38 : : //! Default constructor
39 : : JWL() = default;
40 : :
41 : : //! Constructor
42 : : JWL( tk::real w, tk::real cv, tk::real rho0, tk::real de, tk::real rhor,
43 : : tk::real tr, tk::real pr, tk::real A, tk::real B, tk::real R1,
44 : : tk::real R2 );
45 : :
46 : : //! Set rho0 EOS parameter. No-op since rho0 is set in JWL ctor
47 : 0 : void setRho0(tk::real) {}
48 : :
49 : : //! Calculate density from the material pressure and temperature
50 : : tk::real density( tk::real pr,
51 : : tk::real temp ) const;
52 : :
53 : : //! Calculate pressure from the material density, momentum and total energy
54 : : tk::real pressure( tk::real arho,
55 : : tk::real u,
56 : : tk::real v,
57 : : tk::real w,
58 : : tk::real arhoE,
59 : : tk::real alpha=1.0,
60 : : std::size_t imat=0,
61 : : const std::array< std::array< tk::real, 3 >, 3 >& defgrad={{}} ) const;
62 : :
63 : : //! Calculate cold-compression component of pressure (no-op)
64 : : tk::real pressure_coldcompr(
65 : : tk::real,
66 : : tk::real ) const
67 : : { return 0.0; }
68 : :
69 : : //! \brief Calculate the Cauchy stress tensor from the material density,
70 : : //! momentum, and total energy
71 : : std::array< std::array< tk::real, 3 >, 3 >
72 : : CauchyStress(
73 : : tk::real,
74 : : tk::real,
75 : : tk::real,
76 : : tk::real,
77 : : tk::real,
78 : : tk::real,
79 : : std::size_t,
80 : : const std::array< std::array< tk::real, 3 >, 3 >& adefgrad={{}} ) const;
81 : :
82 : : //! Calculate speed of sound from the material density and material pressure
83 : : tk::real soundspeed( tk::real arho,
84 : : tk::real apr,
85 : : tk::real alpha=1.0,
86 : : std::size_t imat=0,
87 : : const std::array< std::array< tk::real, 3 >, 3 >& adefgrad={{}} ) const;
88 : :
89 : : //! Calculate speed of shear waves
90 : 0 : tk::real shearspeed(
91 : : tk::real,
92 : : tk::real,
93 : 0 : std::size_t ) const { return 0.0; }
94 : :
95 : : //! \brief Calculate material specific total energy from the material
96 : : //! density, momentum and material pressure
97 : : tk::real totalenergy( tk::real rho,
98 : : tk::real u,
99 : : tk::real v,
100 : : tk::real w,
101 : : tk::real pr,
102 : : const std::array< std::array< tk::real, 3 >, 3 >& defgrad={{}} ) const;
103 : :
104 : : //! \brief Calculate material temperature from the material density, and
105 : : //! material specific total energy
106 : : tk::real temperature( tk::real arho,
107 : : tk::real u,
108 : : tk::real v,
109 : : tk::real w,
110 : : tk::real arhoE,
111 : : tk::real alpha=1.0,
112 : : const std::array< std::array< tk::real, 3 >, 3 >& defgrad={{}} ) const;
113 : :
114 : : //! Compute the minimum allowed pressure
115 : : tk::real min_eff_pressure(
116 : : tk::real min,
117 : : tk::real arho,
118 : : tk::real alpha ) const;
119 : :
120 : : //! Compute the reference density
121 : : //! \details Returns the reference density
122 : : tk::real refDensity() const { return m_rhor; }
123 : :
124 : : //! Compute the reference pressure
125 : : //! \details Returns the reference pressure
126 : : tk::real refPressure() const { return m_pr; }
127 : :
128 : : //! Return initial density
129 : 0 : tk::real rho0() const { return m_rho0; }
130 : :
131 : : /** @name Charm++ pack/unpack serializer member functions */
132 : : ///@{
133 : : //! \brief Pack/Unpack serialize member function
134 : : //! \param[in,out] p Charm++'s PUP::er serializer object reference
135 : : void pup( PUP::er &p ) /*override*/ {
136 : : p | m_w;
137 : : p | m_cv;
138 : : p | m_rho0;
139 : : p | m_de;
140 : : p | m_rhor;
141 : : p | m_pr;
142 : : p | m_a;
143 : : p | m_b;
144 : : p | m_r1;
145 : : p | m_r2;
146 : : p | m_tr;
147 : : }
148 : : //! \brief Pack/Unpack serialize operator|
149 : : //! \param[in,out] p Charm++'s PUP::er serializer object reference
150 : : //! \param[in,out] i JWL object reference
151 : : friend void operator|( PUP::er& p, JWL& i ) { i.pup(p); }
152 : : //@}
153 : : };
154 : :
155 : : } //inciter::
156 : :
157 : : #endif // JWL_h
|