Branch data Line data Source code
1 : : // *****************************************************************************
2 : : /*!
3 : : \file src/PDE/EoS/GodunovRomenski.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 Godunov-Romenski equation of state for solids
9 : : \details This file declares functions for the Godunov-Romenski equation of
10 : : state for solids and a hydro EoS for aluminum. These functions were
11 : : taken from Example 1 of Barton, Philip T. "An interface-capturing
12 : : Godunov method for the simulation of compressible solid-fluid
13 : : problems." Journal of Computational Physics 390 (2019): 25-50.
14 : : */
15 : : // *****************************************************************************
16 : : #ifndef GodunovRomenski_h
17 : : #define GodunovRomenski_h
18 : :
19 : : #include "Data.hpp"
20 : :
21 : : namespace inciter {
22 : :
23 : : class GodunovRomenski {
24 : :
25 : : private:
26 : : tk::real m_gamma, m_mu, m_rho0, m_alpha, m_K0;
27 : :
28 : : //! \brief Calculate elastic contribution to material energy from the
29 : : //! material density, and deformation gradient tensor
30 : : tk::real elasticEnergy(
31 : : const std::array< std::array< tk::real, 3 >, 3 >& defgrad,
32 : : std::array< std::array< tk::real, 3 >, 3 >& devH ) const;
33 : :
34 : : //! \brief Calculate cold-compression contribution to material energy from
35 : : //! the material density
36 : : tk::real coldcomprEnergy( tk::real rho ) const;
37 : :
38 : : //! Calculate the derivative of the cold compression pressure wrt. density
39 : : tk::real DpccDrho( tk::real rho ) const;
40 : :
41 : : public:
42 : : //! Default constructor
43 : : GodunovRomenski() = default;
44 : :
45 : : //! Constructor
46 : : GodunovRomenski(
47 : : tk::real gamma,
48 : : tk::real mu,
49 : : tk::real rho0,
50 : : tk::real alpha,
51 : : tk::real K0 );
52 : :
53 : : //! Set rho0 EOS parameter; no-op since provided by user
54 : 0 : void setRho0(tk::real) {}
55 : :
56 : : //! Calculate density from the material pressure and temperature
57 : : tk::real density( tk::real pr,
58 : : tk::real temp ) const;
59 : :
60 : : //! Calculate pressure from the material density, momentum and total energy
61 : : tk::real pressure(
62 : : tk::real arho,
63 : : tk::real u,
64 : : tk::real v,
65 : : tk::real w,
66 : : tk::real arhoE,
67 : : tk::real alpha=1.0,
68 : : std::size_t imat=0,
69 : : const std::array< std::array< tk::real, 3 >, 3 >& defgrad={{}} ) const;
70 : :
71 : : //! \brief Calculate cold-compression contribution to material pressure from
72 : : //! the material density
73 : : tk::real pressure_coldcompr(
74 : : tk::real arho,
75 : : tk::real alpha=1.0 ) const;
76 : :
77 : : //! \brief Calculate the elastic Cauchy stress tensor from the material
78 : : //! inverse deformation gradient tensor using the GodunovRomenski EOS
79 : : std::array< std::array< tk::real, 3 >, 3 >
80 : : CauchyStress(
81 : : tk::real alpha,
82 : : std::size_t /*imat*/,
83 : : const std::array< std::array< tk::real, 3 >, 3 >& adefgrad ) const;
84 : :
85 : : //! Calculate speed of sound from the material density and material pressure
86 : : tk::real soundspeed(
87 : : tk::real arho,
88 : : tk::real apr,
89 : : tk::real alpha=1.0,
90 : : std::size_t imat=0,
91 : : const std::array< std::array< tk::real, 3 >, 3 >& adefgrad={{}} ) const;
92 : :
93 : : //! Calculate speed of shear waves
94 : : tk::real shearspeed(
95 : : tk::real arho,
96 : : tk::real alpha=1.0,
97 : : std::size_t imat=0 ) const;
98 : :
99 : : //! \brief Calculate material specific total energy from the material
100 : : //! density, momentum and material pressure
101 : : tk::real totalenergy(
102 : : tk::real arho,
103 : : tk::real u,
104 : : tk::real v,
105 : : tk::real w,
106 : : tk::real apr,
107 : : tk::real alpha=1.0,
108 : : const std::array< std::array< tk::real, 3 >, 3 >& defgrad={{}} ) const;
109 : :
110 : : //! \brief Calculate material temperature from the material density, and
111 : : //! material specific total energy
112 : : tk::real temperature(
113 : : tk::real arho,
114 : : tk::real u,
115 : : tk::real v,
116 : : tk::real w,
117 : : tk::real arhoE,
118 : : tk::real alpha=1.0,
119 : : const std::array< std::array< tk::real, 3 >, 3 >& defgrad={{}} ) const;
120 : :
121 : : //! Compute the minimum allowed pressure
122 : : tk::real min_eff_pressure(
123 : : tk::real min,
124 : : tk::real /*arho*/,
125 : : tk::real /*alpha=1.0*/ ) const;
126 : :
127 : : //! Compute the reference density
128 : : tk::real refDensity() const { return density(refPressure(), 300.0); }
129 : :
130 : : //! Compute the reference pressure
131 : : tk::real refPressure() const { return 1.0e5; }
132 : :
133 : : //! Return initial density
134 : 0 : tk::real rho0() const { return m_rho0; }
135 : :
136 : : //! Return gas constant (no-op)
137 : 0 : tk::real gas_constant() const { return 0.0; }
138 : :
139 : : //! Return internal energy (no-op)
140 : 0 : tk::real internalenergy( [[maybe_unused]] tk::real temp) const { return 0.0; }
141 : :
142 : : //! Return specific heat (no-op)
143 : 0 : tk::real cv( [[maybe_unused]] tk::real temp) const { return 0.0; }
144 : :
145 : : /** @name Charm++ pack/unpack serializer member functions */
146 : : ///@{
147 : : //! \brief Pack/Unpack serialize member function
148 : : //! \param[in,out] p Charm++'s PUP::er serializer object reference
149 : : void pup( PUP::er &p ) /*override*/ {
150 : : p | m_gamma;
151 : : p | m_mu;
152 : : p | m_rho0;
153 : : p | m_alpha;
154 : : p | m_K0;
155 : : }
156 : : //! \brief Pack/Unpack serialize operator|
157 : : //! \param[in,out] p Charm++'s PUP::er serializer object reference
158 : : //! \param[in,out] i GodunovRomenski object reference
159 : : friend void operator|( PUP::er& p, GodunovRomenski& i ) { i.pup(p); }
160 : : //@}
161 : : };
162 : :
163 : : } //inciter::
164 : :
165 : : #endif // GodunovRomenski_h
|