SmoothFlow.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <array>
7 #include <limits>
8 #include <pup.h>
9 
11 #include "Options/Options.hpp"
12 #include "PointwiseFunctions/AnalyticSolutions/AnalyticSolution.hpp"
13 #include "PointwiseFunctions/AnalyticSolutions/GeneralRelativity/Minkowski.hpp"
14 #include "PointwiseFunctions/AnalyticSolutions/RelativisticEuler/SmoothFlow.hpp"
15 #include "PointwiseFunctions/Hydro/EquationsOfState/EquationOfState.hpp"
16 #include "PointwiseFunctions/Hydro/Tags.hpp" // IWYU pragma: keep
17 #include "Utilities/MakeArray.hpp" // IWYU pragma: keep
18 #include "Utilities/TMPL.hpp"
20 
21 namespace grmhd {
22 namespace Solutions {
23 
24 /*!
25  * \brief Periodic GrMhd solution in Minkowski spacetime.
26  *
27  * An analytic solution to the 3-D GrMhd system. The user specifies the mean
28  * flow velocity of the fluid, the wavevector of the density profile, and the
29  * amplitude \f$A\f$ of the density profile. The magnetic field is taken to be
30  * zero everywhere. In Cartesian coordinates \f$(x, y, z)\f$, and using
31  * dimensionless units, the primitive quantities at a given time \f$t\f$ are
32  * then
33  *
34  * \f{align*}
35  * \rho(\vec{x},t) &= 1 + A \sin(\vec{k}\cdot(\vec{x} - \vec{v}t)) \\
36  * \vec{v}(\vec{x},t) &= [v_x, v_y, v_z]^{T},\\
37  * P(\vec{x},t) &= P, \\
38  * \epsilon(\vec{x}, t) &= \frac{P}{(\gamma - 1)\rho}\\
39  * \vec{B}(\vec{x},t) &= [0, 0, 0]^{T}
40  * \f}
41  */
42 class SmoothFlow : virtual public MarkAsAnalyticSolution,
45 
46  public:
47  using options = smooth_flow::options;
48 
49  static constexpr OptionString help = {
50  "Periodic smooth flow in Minkowski spacetime with zero magnetic field."};
51 
52  SmoothFlow() = default;
53  SmoothFlow(const SmoothFlow& /*rhs*/) = delete;
54  SmoothFlow& operator=(const SmoothFlow& /*rhs*/) = delete;
55  SmoothFlow(SmoothFlow&& /*rhs*/) noexcept = default;
56  SmoothFlow& operator=(SmoothFlow&& /*rhs*/) noexcept = default;
57  ~SmoothFlow() = default;
58 
59  SmoothFlow(MeanVelocity::type mean_velocity, WaveVector::type wavevector,
60  Pressure::type pressure, AdiabaticIndex::type adiabatic_index,
61  PerturbationSize::type perturbation_size) noexcept;
62 
63  using smooth_flow::equation_of_state;
65 
66  // Overload the variables function from the base class.
68 
69  // @{
70  /// Retrieve hydro variable at `(x, t)`
71  template <typename DataType>
72  auto variables(const tnsr::I<DataType, 3>& x, double /*t*/,
73  tmpl::list<hydro::Tags::MagneticField<
74  DataType, 3, Frame::Inertial>> /*meta*/) const noexcept
77 
78  template <typename DataType>
79  auto variables(
80  const tnsr::I<DataType, 3>& x, double /*t*/,
81  tmpl::list<hydro::Tags::DivergenceCleaningField<DataType>> /*meta*/) const
82  noexcept
84  // @}
85 
86  /// Retrieve a collection of hydro variables at `(x, t)`
87  template <typename DataType, typename... Tags>
88  tuples::TaggedTuple<Tags...> variables(const tnsr::I<DataType, 3>& x,
89  double t,
90  tmpl::list<Tags...> /*meta*/) const
91  noexcept {
92  static_assert(sizeof...(Tags) > 1,
93  "The generic template will recurse infinitely if only one "
94  "tag is being retrieved.");
95  return {get<Tags>(variables(x, t, tmpl::list<Tags>{}))...};
96  }
97 
98  // clang-tidy: no runtime references
99  void pup(PUP::er& /*p*/) noexcept; // NOLINT
100 
101  private:
102  friend bool operator==(const SmoothFlow& lhs, const SmoothFlow& rhs) noexcept;
103 };
104 
105 bool operator!=(const SmoothFlow& lhs, const SmoothFlow& rhs) noexcept;
106 } // namespace Solutions
107 } // namespace grmhd
Defines class tuples::TaggedTuple.
auto variables(const tnsr::I< DataType, 3 > &x, double, tmpl::list< hydro::Tags::MagneticField< DataType, 3, Frame::Inertial >>) const noexcept -> tuples::TaggedTuple< hydro::Tags::MagneticField< DataType, 3, Frame::Inertial >>
Retrieve hydro variable at (x, t)
Defines function make_array.
tuples::TaggedTuple< Tags... > variables(const tnsr::I< DataType, 3 > &x, double t, tmpl::list< Tags... >) const noexcept
Retrieve a collection of hydro variables at (x, t)
Definition: SmoothFlow.hpp:88
Defines classes and functions for making classes creatable from input files.
The magnetic field measured by an Eulerian observer, where is the normal to the spatial hypersurfac...
Definition: Tags.hpp:87
The divergence-cleaning field .
Definition: Tags.hpp:51
const char *const OptionString
The string used in option structs.
Definition: Options.hpp:29
An associative container that is indexed by structs.
Definition: TaggedTuple.hpp:273
Smooth wave propagating in Minkowski spacetime.
Definition: SmoothFlow.hpp:54
Definition: DataBoxTag.hpp:29
Defines a list of useful type aliases for tensors.
Wraps the template metaprogramming library used (brigand)
Definition: IndexType.hpp:44
Items related to general relativistic magnetohydrodynamics (GRMHD)
Definition: Characteristics.hpp:34
Periodic GrMhd solution in Minkowski spacetime.
Definition: SmoothFlow.hpp:42
auto variables(const tnsr::I< DataType, Dim > &x, double t, tmpl::list< hydro::Tags::RestMassDensity< DataType >>) const noexcept -> tuples::TaggedTuple< hydro::Tags::RestMassDensity< DataType >>
Retrieve hydro variable at (x, t)