2 // See LICENSE.txt for details.
3
4 #pragma once
5
6 #include <cstddef>
7 #include <limits>
8
10 #include "Options/Options.hpp"
11 #include "Utilities/Gsl.hpp"
12 #include "Utilities/TMPL.hpp"
13
14 // IWYU pragma: no_forward_declare Tensor
15
16 /// \cond
17 namespace PUP {
18 class er;
19 } // namespace PUP
20 class DataVector;
21 namespace Tags {
22 template <size_t Dim, typename Frame>
23 struct Coordinates;
24 } // namespace Tags
25 namespace hydro {
26 namespace Tags {
27 template <typename DataType>
28 struct Pressure;
29 template <typename DataType>
30 struct RestMassDensity;
31 } // namespace Tags
32 } // namespace hydro
33 /// \endcond
34
35 /// Contains all variable fixers.
36 namespace VariableFixing {
37
38 /// \ingroup VariableFixingGroup
39 /// \brief Applies a pressure and density floor dependent on the distance
40 /// to the origin.
41 ///
42 /// Applies the floors:
43 /// \f$\rho(r) \geq \rho_{\mathrm{fl}}(r) = C_\rho r^{k_\rho}\f$
44 /// and \f$P(r) \geq P_{\mathrm{fl}}(r) = C_p r^{k_p}\f$
45 /// when \f$r > r_{min}\f$, where \f$C_\rho\f$ is given by the option
46 /// ScaleDensityFloor, \f$k_\rho\f$ is given by the option
47 /// PowerDensityFloor, \f$C_p\f$ is given by the option
48 /// ScalePressureFloor, \f$k_p\f$ is given by the option
49 /// PowerPressureFloor, and \f$r_{min}\f$ is given by the option
50 /// MinimumRadius.
51 ///
52 /// \note In \cite Porth2016rfi, the following floors are applied:
53 /// \f$\rho(r) \geq \rho_{\mathrm{fl}}(r) = 10^{-5}r^{-3/2}\f$
54 /// and \f$P(r) \geq P_{\mathrm{fl}}(r) = \frac{1}{3} \times 10^{-7}r^{-5/2}\f$
55 template <size_t Dim>
57  public:
58  /// \brief The minimum radius at which to begin applying the floors on the
59  /// density and pressure.
61  static constexpr OptionString help =
62  "The radius at which to begin applying the lower bound.";
63  using type = double;
64  static double lower_bound() noexcept { return 0.0; }
65  };
66
67  /// \brief The scale of the floor of the rest mass density.
69  static constexpr OptionString help =
70  "The rest mass density floor at r = 1.";
71  using type = double;
72  static double lower_bound() noexcept { return 0.0; }
73  };
74
75  /// \brief The power of the radius of the floor of the rest mass density.
77  static constexpr OptionString help =
78  "Radial power for the floor of the rest mass density.";
79  using type = double;
80  };
81
82  /// \brief The scale of the floor of the pressure.
84  static constexpr OptionString help = "The pressure floor at r = 1.";
85  using type = double;
86  static double lower_bound() noexcept { return 0.0; }
87  };
88
89  /// \brief The power of the radius of the floor of the pressure.
91  static constexpr OptionString help =
92  "The radial power for the floor of the pressure.";
93  using type = double;
94  };
95
96  using options =
99  static constexpr OptionString help = {
100  "Applies a pressure and density floor dependent on the distance to the "
101  "origin."};
102
104  double rest_mass_density_scale,
105  double rest_mass_density_power, double pressure_scale,
106  double pressure_power) noexcept;
107
111  default;
114  default;
116
118  void pup(PUP::er& p) noexcept;
119
120  using return_tags = tmpl::list<hydro::Tags::RestMassDensity<DataVector>,
122  using argument_tags = tmpl::list<::Tags::Coordinates<Dim, Frame::Inertial>>;
123
124  void operator()(gsl::not_null<Scalar<DataVector>*> density,
126  const tnsr::I<DataVector, Dim, Frame::Inertial>& coords) const
127  noexcept;
128
129  private:
130  template <size_t LocalDim>
132  friend bool operator==(const RadiallyFallingFloor<LocalDim>& lhs,
134
137  double rest_mass_density_scale_{std::numeric_limits<double>::signaling_NaN()};
138  double rest_mass_density_power_{std::numeric_limits<double>::signaling_NaN()};
139  double pressure_scale_{std::numeric_limits<double>::signaling_NaN()};
140  double pressure_power_{std::numeric_limits<double>::signaling_NaN()};
141 };
142
143 template <size_t Dim>
146
147 } // namespace VariableFixing
Definition: Strahlkorper.hpp:14
The fluid pressure .
Definition: Tags.hpp:123
T signaling_NaN(T... args)
Applies a pressure and density floor dependent on the distance to the origin.
Defines classes and functions for making classes creatable from input files.
const char *const OptionString
The string used in option structs.
Definition: Options.hpp:26
Contains all variable fixers.
Definition: FixConservatives.cpp:55
The minimum radius at which to begin applying the floors on the density and pressure.
Definition: DataBoxTag.hpp:29
Defines a list of useful type aliases for tensors.
Stores a collection of function values.
Definition: DataVector.hpp:46
Wraps the template metaprogramming library used (brigand)
Items related to hydrodynamic systems.
Definition: LorentzFactor.hpp:13
Defines functions and classes from the GSL.
The power of the radius of the floor of the rest mass density.