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 : : //! density, momentum, total energy, and inverse deformation gradient
79 : : //! tensor using the GodunovRomenski equation of state
80 : : std::array< std::array< tk::real, 3 >, 3 >
81 : : CauchyStress(
82 : : tk::real arho,
83 : : tk::real,
84 : : tk::real,
85 : : tk::real,
86 : : tk::real,
87 : : tk::real alpha,
88 : : std::size_t /*imat*/,
89 : : const std::array< std::array< tk::real, 3 >, 3 >& adefgrad ) const;
90 : :
91 : : //! Calculate speed of sound from the material density and material pressure
92 : : tk::real soundspeed(
93 : : tk::real arho,
94 : : tk::real apr,
95 : : tk::real alpha=1.0,
96 : : std::size_t imat=0,
97 : : const std::array< std::array< tk::real, 3 >, 3 >& adefgrad={{}} ) const;
98 : :
99 : : //! Calculate speed of shear waves
100 : : tk::real shearspeed(
101 : : tk::real arho,
102 : : tk::real alpha=1.0,
103 : : std::size_t imat=0 ) const;
104 : :
105 : : //! \brief Calculate material specific total energy from the material
106 : : //! density, momentum and material pressure
107 : : tk::real totalenergy(
108 : : tk::real rho,
109 : : tk::real u,
110 : : tk::real v,
111 : : tk::real w,
112 : : tk::real pr,
113 : : const std::array< std::array< tk::real, 3 >, 3 >& defgrad={{}} ) const;
114 : :
115 : : //! \brief Calculate material temperature from the material density, and
116 : : //! material specific total energy
117 : : tk::real temperature(
118 : : tk::real arho,
119 : : tk::real u,
120 : : tk::real v,
121 : : tk::real w,
122 : : tk::real arhoE,
123 : : tk::real alpha=1.0,
124 : : const std::array< std::array< tk::real, 3 >, 3 >& defgrad={{}} ) const;
125 : :
126 : : //! Compute the minimum allowed pressure
127 : : tk::real min_eff_pressure(
128 : : tk::real min,
129 : : tk::real arho,
130 : : tk::real alpha=1.0 ) const;
131 : :
132 : : //! Compute the reference density
133 : : tk::real refDensity() const { return density(refPressure(), 300.0); }
134 : :
135 : : //! Compute the reference pressure
136 : : tk::real refPressure() const { return 1.0e5; }
137 : :
138 : : //! Return initial density
139 : 0 : tk::real rho0() const { return m_rho0; }
140 : :
141 : : /** @name Charm++ pack/unpack serializer member functions */
142 : : ///@{
143 : : //! \brief Pack/Unpack serialize member function
144 : : //! \param[in,out] p Charm++'s PUP::er serializer object reference
145 : : void pup( PUP::er &p ) /*override*/ {
146 : : p | m_gamma;
147 : : p | m_mu;
148 : : p | m_rho0;
149 : : p | m_alpha;
150 : : p | m_K0;
151 : : }
152 : : //! \brief Pack/Unpack serialize operator|
153 : : //! \param[in,out] p Charm++'s PUP::er serializer object reference
154 : : //! \param[in,out] i GodunovRomenski object reference
155 : : friend void operator|( PUP::er& p, GodunovRomenski& i ) { i.pup(p); }
156 : : //@}
157 : : };
158 : :
159 : : } //inciter::
160 : :
161 : : #endif // GodunovRomenski_h
|