SpECTRE Documentation Coverage Report
Current view: top level - PointwiseFunctions/Hydro/EquationsOfState - IdealFluid.hpp Hit Total Coverage
Commit: 2ae2b99409ac582030d56a4560a92a3e066a7e54 Lines: 6 23 26.1 %
Date: 2022-01-15 08:40:38
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             :  * \f[
      33             :  * p = \rho \epsilon(\gamma-1)
      34             :  * \f]
      35             :  * where \f$\rho\f$ is the rest mass density, \f$\epsilon\f$ is the specific
      36             :  * internal energy, and \f$\gamma\f$ is the adiabatic index.
      37             :  */
      38             : template <bool IsRelativistic>
      39           1 : class IdealFluid : public EquationOfState<IsRelativistic, 2> {
      40             :  public:
      41           0 :   static constexpr size_t thermodynamic_dim = 2;
      42           0 :   static constexpr bool is_relativistic = IsRelativistic;
      43             : 
      44           0 :   struct AdiabaticIndex {
      45           0 :     using type = double;
      46           0 :     static constexpr Options::String help = {"Adiabatic index gamma"};
      47             :   };
      48             : 
      49           0 :   static constexpr Options::String help = {
      50             :       "An ideal fluid equation of state.\n"
      51             :       "The pressure is related to the rest mass density by p = rho * epsilon * "
      52             :       "(gamma - 1), where p is the pressure, rho is the rest mass density, "
      53             :       "epsilon is the specific internal energy, and gamma is the adiabatic "
      54             :       "index."};
      55             : 
      56           0 :   using options = tmpl::list<AdiabaticIndex>;
      57             : 
      58           0 :   IdealFluid() = default;
      59           0 :   IdealFluid(const IdealFluid&) = default;
      60           0 :   IdealFluid& operator=(const IdealFluid&) = default;
      61           0 :   IdealFluid(IdealFluid&&) = default;
      62           0 :   IdealFluid& operator=(IdealFluid&&) = default;
      63           0 :   ~IdealFluid() override = default;
      64             : 
      65           0 :   explicit IdealFluid(double adiabatic_index);
      66             : 
      67             :   EQUATION_OF_STATE_FORWARD_DECLARE_MEMBERS(IdealFluid, 2)
      68             : 
      69           0 :   WRAPPED_PUPable_decl_base_template(  // NOLINT
      70             :       SINGLE_ARG(EquationOfState<IsRelativistic, 2>), IdealFluid);
      71             : 
      72             :   /// The lower bound of the rest mass density that is valid for this EOS
      73           1 :   double rest_mass_density_lower_bound() const override { return 0.0; }
      74             : 
      75             :   /// The upper bound of the rest mass density that is valid for this EOS
      76           1 :   double rest_mass_density_upper_bound() const override {
      77             :     return std::numeric_limits<double>::max();
      78             :   }
      79             : 
      80             :   /// The lower bound of the specific internal energy that is valid for this EOS
      81             :   /// at the given rest mass density \f$\rho\f$
      82           1 :   double specific_internal_energy_lower_bound(
      83             :       const double /* rest_mass_density */) const override {
      84             :     return 0.0;
      85             :   }
      86             : 
      87             :   /// The upper bound of the specific internal energy that is valid for this EOS
      88             :   /// at the given rest mass density \f$\rho\f$
      89           1 :   double specific_internal_energy_upper_bound(
      90             :       double rest_mass_density) const override;
      91             : 
      92             :   /// The lower bound of the specific enthalpy that is valid for this EOS
      93           1 :   double specific_enthalpy_lower_bound() const override {
      94             :     return IsRelativistic ? 1.0 : 0.0;
      95             :   }
      96             : 
      97             :  private:
      98             :   EQUATION_OF_STATE_FORWARD_DECLARE_MEMBER_IMPLS(2)
      99             : 
     100           0 :   double adiabatic_index_ = std::numeric_limits<double>::signaling_NaN();
     101             : };
     102             : 
     103             : /// \cond
     104             : template <bool IsRelativistic>
     105             : PUP::able::PUP_ID EquationsOfState::IdealFluid<IsRelativistic>::my_PUP_ID = 0;
     106             : /// \endcond
     107             : }  // namespace EquationsOfState

Generated by: LCOV version 1.14