1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// *****************************************************************************
/*!
  \file      src/PDE/MultiSpecies/Mixture.hpp
  \copyright 2012-2015 J. Bakosi,
             2016-2018 Los Alamos National Security, LLC.,
             2019-2021 Triad National Security, LLC.
             All rights reserved. See the LICENSE file for details.
  \brief     Multispecies mixture function
  \details   This file declares functions for computing mixture flow quantities
*/
// *****************************************************************************
#ifndef Mixture_h
#define Mixture_h

#include <vector>

#include "Types.hpp"
#include "EoS/EOS.hpp"

namespace inciter {

class Mixture {

  private:
    std::size_t m_nspec;
    tk::real m_mix_density;
    tk::real m_mix_R;
    std::vector< tk::real > m_Ys;

  public:
    //! Constructor based on state vector
    Mixture(const std::size_t nspec,
            const std::vector< tk::real >& ugp,
            const std::vector< EOS >& mat_blk);

    //! Constructor based on mixture thermodynamics, mass fractions
    Mixture(const std::size_t nspec,
            const std::vector< tk::real >& Ys,
            tk::real mix_pressure,
            tk::real temperature,
            const std::vector< EOS >& mat_blk);

    //! Return mixture density
    tk::real get_mix_density() { return m_mix_density; }

    //! Compute mixture frozen speed of sound.
    tk::real frozen_soundspeed(tk::real mix_density,
                               tk::real mix_pressure,
                               const std::vector< EOS >& mat_blk) const;

    //! Compute mixture total energy
    tk::real totalenergy(tk::real mix_density,
                         tk::real u,
                         tk::real v,
                         tk::real w,
                         tk::real mix_pressure,
                         const std::vector< EOS >& mat_blk) const;

    //! Compute mixture pressure
    tk::real pressure(tk::real mix_density,
                      tk::real u,
                      tk::real v,
                      tk::real w,
                      tk::real rhoE,
                      const std::vector< EOS >& mat_blk) const;

    //! Compute mixture temperature
    tk::real temperature(tk::real mix_density,
                         tk::real u,
                         tk::real v,
                         tk::real w,
                         tk::real rhoE,
                         const std::vector< EOS >& mat_blk) const;

    /** @name Charm++ pack/unpack serializer member functions */
    ///@{
    //! \brief Pack/Unpack serialize member function
    //! \param[in,out] p Charm++'s PUP::er serializer object reference
    void pup( PUP::er &p ) /*override*/ {<--- Parameter 'p' can be declared with const
      p | m_nspec;
      p | m_mix_density;
      p | m_mix_R;
      p | m_Ys;
    }
    //! \brief Pack/Unpack serialize operator|
    //! \param[in,out] p Charm++'s PUP::er serializer object reference
    //! \param[in,out] i Mixture object reference
    friend void operator|( PUP::er& p, Mixture& i ) { i.pup(p); }
    //@}

};

} //inciter::

#endif // Mixture_h