SpECTRE Documentation Coverage Report
Current view: top level - PointwiseFunctions/Hydro/EquationsOfState - PolytropicFluid.hpp Hit Total Coverage
Commit: cd74d65bdc718fd7e344eaec61dc6334dd4d366b Lines: 6 29 20.7 %
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             : // IWYU pragma: no_forward_declare Tensor
      27             : 
      28             : namespace EquationsOfState {
      29             : /*!
      30             :  * \ingroup EquationsOfStateGroup
      31             :  * \brief Equation of state for a polytropic fluid
      32             :  *
      33             :  * A polytropic equation of state \f$p=K\rho^{\Gamma}\f$ where \f$K\f$ is the
      34             :  * polytropic constant and \f$\Gamma\f$ is the polytropic exponent. The
      35             :  * polytropic exponent is related to the polytropic index \f$N_p\f$ by
      36             :  * \f$N_p=1/(\Gamma-1)\f$.
      37             :  */
      38             : template <bool IsRelativistic>
      39           1 : class PolytropicFluid : public EquationOfState<IsRelativistic, 1> {
      40             :  public:
      41           0 :   static constexpr size_t thermodynamic_dim = 1;
      42           0 :   static constexpr bool is_relativistic = IsRelativistic;
      43             : 
      44           0 :   struct PolytropicConstant {
      45           0 :     using type = double;
      46           0 :     static constexpr Options::String help = {"Polytropic constant K"};
      47           0 :     static double lower_bound() { return 0.0; }
      48             :   };
      49             : 
      50           0 :   struct PolytropicExponent {
      51           0 :     using type = double;
      52           0 :     static constexpr Options::String help = {"Polytropic exponent Gamma"};
      53           0 :     static double lower_bound() { return 1.0; }
      54             :   };
      55             : 
      56           0 :   static constexpr Options::String help = {
      57             :       "A polytropic fluid equation of state.\n"
      58             :       "The pressure is related to the rest mass density by p = K rho ^ Gamma, "
      59             :       "where p is the pressure, rho is the rest mass density, K is the "
      60             :       "polytropic constant, and Gamma is the polytropic exponent. The "
      61             :       "polytropic index N is defined as Gamma = 1 + 1 / N."};
      62             : 
      63           0 :   using options = tmpl::list<PolytropicConstant, PolytropicExponent>;
      64             : 
      65           0 :   PolytropicFluid() = default;
      66           0 :   PolytropicFluid(const PolytropicFluid&) = default;
      67           0 :   PolytropicFluid& operator=(const PolytropicFluid&) = default;
      68           0 :   PolytropicFluid(PolytropicFluid&&) = default;
      69           0 :   PolytropicFluid& operator=(PolytropicFluid&&) = default;
      70           0 :   ~PolytropicFluid() override = default;
      71             : 
      72           0 :   PolytropicFluid(double polytropic_constant, double polytropic_exponent);
      73             : 
      74             :   EQUATION_OF_STATE_FORWARD_DECLARE_MEMBERS(PolytropicFluid, 1)
      75             : 
      76           0 :   WRAPPED_PUPable_decl_base_template(  // NOLINT
      77             :       SINGLE_ARG(EquationOfState<IsRelativistic, 1>), PolytropicFluid);
      78             : 
      79             :   /// The lower bound of the rest mass density that is valid for this EOS
      80           1 :   double rest_mass_density_lower_bound() const override { return 0.0; }
      81             : 
      82             :   /// The upper bound of the rest mass density that is valid for this EOS
      83           1 :   double rest_mass_density_upper_bound() const override;
      84             : 
      85             :   /// The lower bound of the specific internal energy that is valid for this EOS
      86             :   /// at the given rest mass density \f$\rho\f$
      87           1 :   double specific_internal_energy_lower_bound(
      88             :       const double /* rest_mass_density */) const override {
      89             :     return 0.0;
      90             :   }
      91             : 
      92             :   /// The upper bound of the specific internal energy that is valid for this EOS
      93             :   /// at the given rest mass density \f$\rho\f$
      94           1 :   double specific_internal_energy_upper_bound(
      95             :       const double /* rest_mass_density */) const override {
      96             :     return std::numeric_limits<double>::max();
      97             :   }
      98             : 
      99             :   /// The lower bound of the specific enthalpy that is valid for this EOS
     100           1 :   double specific_enthalpy_lower_bound() const override {
     101             :     return IsRelativistic ? 1.0 : 0.0;
     102             :   }
     103             : 
     104             :  private:
     105             :   EQUATION_OF_STATE_FORWARD_DECLARE_MEMBER_IMPLS(1)
     106             : 
     107           0 :   double polytropic_constant_ = std::numeric_limits<double>::signaling_NaN();
     108           0 :   double polytropic_exponent_ = std::numeric_limits<double>::signaling_NaN();
     109             : };
     110             : 
     111             : /// \cond
     112             : template <bool IsRelativistic>
     113             : PUP::able::PUP_ID EquationsOfState::PolytropicFluid<IsRelativistic>::my_PUP_ID =
     114             :     0;
     115             : /// \endcond
     116             : }  // namespace EquationsOfState

Generated by: LCOV version 1.14