Branch data Line data Source code
1 : : // *****************************************************************************
2 : : /*!
3 : : \file src/PDE/EoS/EOS.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 Polymorphic variant-style implementation for equations of state,
9 : : where children implement specific EOS functions.
10 : : */
11 : : // *****************************************************************************
12 : :
13 : : #include "EoS/EOS.hpp"
14 : : #include "Exception.hpp"
15 : : #include "EoS/GetMatProp.hpp"
16 : :
17 : : using inciter::EOS;
18 : :
19 : : //! Constructor
20 : : //! \param[in] mattype Material type
21 : : //! \param[in] eq Type of PDE being solved
22 : : //! \param[in] k Material index
23 : : //! \details Based on the input enum we assign the correct material eos
24 : 786 : EOS::EOS( ctr::MaterialType mattype, EqType eq, std::size_t k )
25 : : {
26 [ + + ]: 786 : if (mattype == ctr::MaterialType::STIFFENEDGAS) {
27 : : // query input deck to get gamma, p_c, cv
28 [ + - ]: 750 : auto g = getmatprop< tag::gamma >(k);
29 [ + - ]: 750 : auto ps = getmatprop< tag::pstiff >(k);
30 [ + - ]: 750 : auto c_v = getmatprop< tag::cv >(k);
31 [ + - ]: 750 : m_material = StiffenedGas(g, ps, c_v);
32 : : }
33 [ - + ]: 36 : else if (mattype == ctr::MaterialType::JWL) {
34 [ - - ][ - - ]: 0 : if (eq == EqType::compflow) Throw("JWL not set up for PDE type");
[ - - ][ - - ]
35 : : // query input deck to get jwl parameters
36 [ - - ]: 0 : auto w = getmatprop< tag::w_gru >(k);
37 [ - - ]: 0 : auto c_v = getmatprop< tag::cv >(k);
38 [ - - ]: 0 : auto A_jwl = getmatprop< tag::A_jwl >(k);
39 [ - - ]: 0 : auto B_jwl = getmatprop< tag::B_jwl >(k);
40 : : //[[maybe_unused]] auto C_jwl =
41 : : // getmatprop< tag::multimat, tag::C_jwl >(k);
42 [ - - ]: 0 : auto R1_jwl = getmatprop< tag::R1_jwl >(k);
43 [ - - ]: 0 : auto R2_jwl = getmatprop< tag::R2_jwl >(k);
44 [ - - ]: 0 : auto rho0_jwl = getmatprop< tag::rho0_jwl >(k);
45 [ - - ]: 0 : auto de_jwl = getmatprop< tag::de_jwl >(k);
46 [ - - ]: 0 : auto rhor_jwl = getmatprop< tag::rhor_jwl >(k);
47 [ - - ]: 0 : auto Tr_jwl = getmatprop< tag::Tr_jwl >(k);
48 [ - - ]: 0 : auto Pr_jwl = getmatprop< tag::Pr_jwl >(k);
49 [ - - ]: 0 : m_material = JWL(w, c_v, rho0_jwl, de_jwl, rhor_jwl, Tr_jwl, Pr_jwl, A_jwl,
50 : 0 : B_jwl, R1_jwl, R2_jwl);
51 : : }
52 [ - + ]: 36 : else if (mattype == ctr::MaterialType::SMALLSHEARSOLID) {
53 [ - - ]: 0 : if (eq == EqType::compflow)
54 [ - - ][ - - ]: 0 : Throw("SmallShearSolid not set up for PDE type");
[ - - ]
55 : : // query input deck for SmallShearSolid parameters
56 [ - - ]: 0 : auto g = getmatprop< tag::gamma >(k);
57 [ - - ]: 0 : auto ps = getmatprop< tag::pstiff >(k);
58 [ - - ]: 0 : auto c_v = getmatprop< tag::cv >(k);
59 [ - - ]: 0 : auto mu = getmatprop< tag::mu >(k);
60 [ - - ]: 0 : m_material = SmallShearSolid(g, ps, c_v, mu);
61 : : }
62 [ - + ]: 36 : else if (mattype == ctr::MaterialType::WILKINSALUMINUM) {
63 [ - - ]: 0 : if (eq == EqType::compflow)
64 [ - - ][ - - ]: 0 : Throw("WilkinsAluminum not set up for PDE type");
[ - - ]
65 : : // query input deck for Wilkins parameters
66 [ - - ]: 0 : auto g = getmatprop< tag::gamma >(k);
67 [ - - ]: 0 : auto c_v = getmatprop< tag::cv >(k);
68 [ - - ]: 0 : auto mu = getmatprop< tag::mu >(k);
69 [ - - ]: 0 : m_material = WilkinsAluminum(g, c_v, mu);
70 : : }
71 [ - + ]: 36 : else if (mattype == ctr::MaterialType::GODUNOVROMENSKI) {
72 [ - - ]: 0 : if (eq == EqType::compflow)
73 [ - - ][ - - ]: 0 : Throw("GodunovRomenski not set up for PDE type");
[ - - ]
74 : : // query input deck for Wilkins parameters
75 [ - - ]: 0 : auto g = getmatprop< tag::gamma >(k);
76 [ - - ]: 0 : auto mu = getmatprop< tag::mu >(k);
77 [ - - ]: 0 : auto rho0_gr = getmatprop< tag::rho0_jwl >(k);
78 [ - - ]: 0 : auto alpha = getmatprop< tag::alpha >(k);
79 [ - - ]: 0 : auto K0 = getmatprop< tag::K0 >(k);
80 [ - - ]: 0 : m_material = GodunovRomenski(g, mu, rho0_gr, alpha, K0);
81 : : }
82 [ + - ]: 36 : else if (mattype == ctr::MaterialType::THERMALLYPERFECTGAS) {
83 : : // query input deck for ThermallyPerfectGas parameters
84 [ + - ]: 36 : auto g = getspecprop< tag::gamma >(k);
85 [ + - ]: 36 : auto R = getspecprop< tag::R >(k);
86 : : // assume only one type of species
87 : : auto cp_coeff =
88 [ + - ]: 72 : g_inputdeck.get< tag::species >()[0].get< tag::cp_coeff >()[k];
89 : : auto t_range =
90 [ + - ]: 36 : g_inputdeck.get< tag::species >()[0].get< tag::t_range >()[k];
91 [ + - ]: 36 : auto dH_ref = getspecprop< tag::dH_ref >(k);
92 [ + - ][ + - ]: 36 : m_material = ThermallyPerfectGas(g, R, cp_coeff, t_range, dH_ref);
[ + - ]
93 : : }
94 [ - - ][ - - ]: 0 : else Throw( "Unknown EOS for material " + std::to_string(k+1) );
[ - - ][ - - ]
95 : 786 : }
|