SpECTRE Documentation Coverage Report
Current view: top level - PointwiseFunctions/Hydro/EquationsOfState - IdealFluid.hpp Hit Total Coverage
Commit: cd74d65bdc718fd7e344eaec61dc6334dd4d366b Lines: 6 23 26.1 %
Date: 2022-08-12 23:56:47
Legend: Lines: hit not hit

          Line data    Source code
       1           0 : // Distributed under the MIT License.
       2             : // See LICENSE.txt for details.
       3             : 
       4             : #pragma once
       5             : 
       6             : #include <boost/preprocessor/arithmetic/dec.hpp>
       7             : #include <boost/preprocessor/arithmetic/inc.hpp>
       8             : #include <boost/preprocessor/control/expr_iif.hpp>
       9             : #include <boost/preprocessor/list/adt.hpp>
      10             : #include <boost/preprocessor/repetition/for.hpp>
      11             : #include <boost/preprocessor/repetition/repeat.hpp>
      12             : #include <boost/preprocessor/tuple/to_list.hpp>
      13             : #include <limits>
      14             : #include <pup.h>
      15             : 
      16             : #include "DataStructures/Tensor/TypeAliases.hpp"
      17             : #include "Options/Options.hpp"
      18             : #include "Parallel/CharmPupable.hpp"
      19             : #include "PointwiseFunctions/Hydro/EquationsOfState/EquationOfState.hpp"  // IWYU pragma: keep
      20             : #include "Utilities/TMPL.hpp"
      21             : 
      22             : /// \cond
      23             : class DataVector;
      24             : /// \endcond
      25             : 
      26             : namespace EquationsOfState {
      27             : /*!
      28             :  * \ingroup EquationsOfStateGroup
      29             :  * \brief Equation of state for an ideal fluid
      30             :  *
      31             :  * An ideal fluid equation of state:
      32             :  *
      33             :  * \f[
      34             :  * p = \rho \epsilon(\gamma-1)
      35             :  * \f]
      36             :  *
      37             :  * where \f$\rho\f$ is the rest mass density, \f$\epsilon\f$ is the specific
      38             :  * internal energy, and \f$\gamma\f$ is the adiabatic index.
      39             :  *
      40             :  * The temperature \f$T\f$ is defined as
      41             :  *
      42             :  * \f[
      43             :  * T = (\gamma - 1) \epsilon
      44             :  * \f]
      45             :  */
      46             : template <bool IsRelativistic>
      47           1 : class IdealFluid : public EquationOfState<IsRelativistic, 2> {
      48             :  public:
      49           0 :   static constexpr size_t thermodynamic_dim = 2;
      50           0 :   static constexpr bool is_relativistic = IsRelativistic;
      51             : 
      52           0 :   struct AdiabaticIndex {
      53           0 :     using type = double;
      54           0 :     static constexpr Options::String help = {"Adiabatic index gamma"};
      55             :   };
      56             : 
      57           0 :   static constexpr Options::String help = {
      58             :       "An ideal fluid equation of state.\n"
      59             :       "The pressure is related to the rest mass density by p = rho * epsilon * "
      60             :       "(gamma - 1), where p is the pressure, rho is the rest mass density, "
      61             :       "epsilon is the specific internal energy, and gamma is the adiabatic "
      62             :       "index.\n"
      63             :       "The temperature T is defined as T=epsilon."};
      64             : 
      65           0 :   using options = tmpl::list<AdiabaticIndex>;
      66             : 
      67           0 :   IdealFluid() = default;
      68           0 :   IdealFluid(const IdealFluid&) = default;
      69           0 :   IdealFluid& operator=(const IdealFluid&) = default;
      70           0 :   IdealFluid(IdealFluid&&) = default;
      71           0 :   IdealFluid& operator=(IdealFluid&&) = default;
      72           0 :   ~IdealFluid() override = default;
      73             : 
      74           0 :   explicit IdealFluid(double adiabatic_index);
      75             : 
      76             :   EQUATION_OF_STATE_FORWARD_DECLARE_MEMBERS(IdealFluid, 2)
      77             : 
      78           0 :   WRAPPED_PUPable_decl_base_template(  // NOLINT
      79             :       SINGLE_ARG(EquationOfState<IsRelativistic, 2>), IdealFluid);
      80             : 
      81             :   /// The lower bound of the rest mass density that is valid for this EOS
      82           1 :   double rest_mass_density_lower_bound() const override { return 0.0; }
      83             : 
      84             :   /// The upper bound of the rest mass density that is valid for this EOS
      85           1 :   double rest_mass_density_upper_bound() const override {
      86             :     return std::numeric_limits<double>::max();
      87             :   }
      88             : 
      89             :   /// The lower bound of the specific internal energy that is valid for this EOS
      90             :   /// at the given rest mass density \f$\rho\f$
      91           1 :   double specific_internal_energy_lower_bound(
      92             :       const double /* rest_mass_density */) const override {
      93             :     return 0.0;
      94             :   }
      95             : 
      96             :   /// The upper bound of the specific internal energy that is valid for this EOS
      97             :   /// at the given rest mass density \f$\rho\f$
      98           1 :   double specific_internal_energy_upper_bound(
      99             :       double rest_mass_density) const override;
     100             : 
     101             :   /// The lower bound of the specific enthalpy that is valid for this EOS
     102           1 :   double specific_enthalpy_lower_bound() const override {
     103             :     return IsRelativistic ? 1.0 : 0.0;
     104             :   }
     105             : 
     106             :  private:
     107             :   EQUATION_OF_STATE_FORWARD_DECLARE_MEMBER_IMPLS(2)
     108             : 
     109           0 :   double adiabatic_index_ = std::numeric_limits<double>::signaling_NaN();
     110             : };
     111             : 
     112             : /// \cond
     113             : template <bool IsRelativistic>
     114             : PUP::able::PUP_ID EquationsOfState::IdealFluid<IsRelativistic>::my_PUP_ID = 0;
     115             : /// \endcond
     116             : }  // namespace EquationsOfState

Generated by: LCOV version 1.14