SpECTRE Documentation Coverage Report
Current view: top level - PointwiseFunctions/Hydro/EquationsOfState - DarkEnergyFluid.hpp Hit Total Coverage
Commit: cd74d65bdc718fd7e344eaec61dc6334dd4d366b Lines: 7 26 26.9 %
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           1 : namespace EquationsOfState {
      27             : /*!
      28             :  * \ingroup EquationsOfStateGroup
      29             :  * \brief Equation of state for a dark energy fluid
      30             :  *
      31             :  * A dark energy fluid equation of state:
      32             :  *
      33             :  * \f[
      34             :  * p = w(z) \rho ( 1.0 + \epsilon)
      35             :  * \f]
      36             :  *
      37             :  * where \f$\rho\f$ is the rest mass density, \f$\epsilon\f$ is the specific
      38             :  * internal energy, and \f$w(z) > 0\f$ is a parameter depending on the redshift
      39             :  * \f$z\f$.
      40             :  *
      41             :  * The temperature \f$T\f$ is defined as
      42             :  *
      43             :  * \f[
      44             :  * T = w(z) \epsilon
      45             :  * \f]
      46             :  */
      47             : template <bool IsRelativistic>
      48           1 : class DarkEnergyFluid : public EquationOfState<IsRelativistic, 2> {
      49             :  public:
      50           0 :   static constexpr size_t thermodynamic_dim = 2;
      51           0 :   static constexpr bool is_relativistic = IsRelativistic;
      52             :   static_assert(IsRelativistic,
      53             :                 "Dark energy fluid equation of state only makes sense in a "
      54             :                 "relativistic setting.");
      55             : 
      56           0 :   struct ParameterW {
      57           0 :     using type = double;
      58           0 :     static constexpr Options::String help = {"Parameter w(z)"};
      59           0 :     static double lower_bound() { return 0.0; }
      60           0 :     static double upper_bound() { return 1.0; }
      61             :   };
      62             : 
      63           0 :   static constexpr Options::String help = {
      64             :       "A dark energy fluid equation of state.\n"
      65             :       "The pressure is related to the rest mass density by "
      66             :       "p = w(z) * rho * (1 + epsilon), where p is the pressure, rho is the "
      67             :       "rest mass density, epsilon is the specific internal energy, and w(z) is "
      68             :       "a parameter.\n"
      69             :       "The temperature T is defined as T=w(z) epsilon."};
      70             : 
      71           0 :   using options = tmpl::list<ParameterW>;
      72             : 
      73           0 :   DarkEnergyFluid() = default;
      74           0 :   DarkEnergyFluid(const DarkEnergyFluid&) = default;
      75           0 :   DarkEnergyFluid& operator=(const DarkEnergyFluid&) = default;
      76           0 :   DarkEnergyFluid(DarkEnergyFluid&&) = default;
      77           0 :   DarkEnergyFluid& operator=(DarkEnergyFluid&&) = default;
      78           0 :   ~DarkEnergyFluid() override = default;
      79             : 
      80           0 :   explicit DarkEnergyFluid(double parameter_w);
      81             : 
      82             :   EQUATION_OF_STATE_FORWARD_DECLARE_MEMBERS(DarkEnergyFluid, 2)
      83             : 
      84           0 :   WRAPPED_PUPable_decl_base_template(  // NOLINT
      85             :       SINGLE_ARG(EquationOfState<IsRelativistic, 2>), DarkEnergyFluid);
      86             : 
      87             :   /// The lower bound of the rest mass density that is valid for this EOS
      88           1 :   double rest_mass_density_lower_bound() const override { return 0.0; }
      89             : 
      90             :   /// The upper bound of the rest mass density that is valid for this EOS
      91           1 :   double rest_mass_density_upper_bound() const override {
      92             :     return std::numeric_limits<double>::max();
      93             :   }
      94             : 
      95             :   /// The lower bound of the specific internal energy that is valid for this EOS
      96             :   /// at the given rest mass density \f$\rho\f$
      97           1 :   double specific_internal_energy_lower_bound(
      98             :       const double /* rest_mass_density */) const override {
      99             :     return -1.0;
     100             :   }
     101             : 
     102             :   /// The upper bound of the specific internal energy that is valid for this EOS
     103             :   /// at the given rest mass density \f$\rho\f$
     104           1 :   double specific_internal_energy_upper_bound(
     105             :       const double /* rest_mass_density */) const override {
     106             :     return std::numeric_limits<double>::max();
     107             :   }
     108             : 
     109             :   /// The lower bound of the specific enthalpy that is valid for this EOS
     110           1 :   double specific_enthalpy_lower_bound() const override { return 0.0; }
     111             : 
     112             :  private:
     113             :   EQUATION_OF_STATE_FORWARD_DECLARE_MEMBER_IMPLS(2)
     114             : 
     115           0 :   double parameter_w_ = std::numeric_limits<double>::signaling_NaN();
     116             : };
     117             : 
     118             : /// \cond
     119             : template <bool IsRelativistic>
     120             : PUP::able::PUP_ID EquationsOfState::DarkEnergyFluid<IsRelativistic>::my_PUP_ID =
     121             :     0;
     122             : /// \endcond
     123             : }  // namespace EquationsOfState

Generated by: LCOV version 1.14