OrszagTangVortex.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
7 #include "Options/Options.hpp"
8 #include "PointwiseFunctions/AnalyticSolutions/GeneralRelativity/Minkowski.hpp"
9 // IWYU pragma: no_include "PointwiseFunctions/Hydro/EquationsOfState/EquationOfState.hpp" // for IdealFluid
10 #include "PointwiseFunctions/Hydro/EquationsOfState/IdealFluid.hpp" // IWYU pragma: keep
11 #include "PointwiseFunctions/Hydro/Tags.hpp"
12 #include "Utilities/Requires.hpp"
13 #include "Utilities/TMPL.hpp"
15 
16 /// \cond
17 namespace PUP {
18 class er;
19 } // namespace PUP
20 /// \endcond
21 
22 namespace grmhd {
23 namespace AnalyticData {
24 
25 /*!
26  * \brief Analytic initial data for the relativistic Orszag-Tang vortex.
27  *
28  * The relativistic version of the Orszag-Tang vortex is a
29  * 2-dimensional test case for relativistic MHD systems (see, e.g.,
30  * \cite Beckwith2011iy). It describes the flow of an ideal fluid with
31  * adiabatic index \f$5/3\f$. The initial conditions (and hence the
32  * states at later times) are periodic in both \f$x\f$ and \f$y\f$
33  * with period 1. The initial conditions are:
34  * \f{align*}
35  * \rho &= \frac{25}{36 \pi} \\
36  * p &= \frac{5}{12 \pi} \\
37  * v_x &= -\frac{1}{2} \sin(2 \pi y) \\
38  * v_y &= \frac{1}{2} \sin(2 \pi x) \\
39  * B_x &= -\frac{1}{\sqrt{4 \pi}} \sin(2 \pi y) \\
40  * B_y &= \frac{1}{\sqrt{4 \pi}} \sin(4 \pi x)
41  * \f}
42  * with \f$\rho\f$ the rest mass density, \f$p\f$ the pressure,
43  * \f$v_i\f$ the spatial velocity, and \f$B_i\f$ the magnetic field.
44  *
45  * \parblock
46  * \note We do not currently support 2-dimensional RMHD, so this class
47  * provides 3-dimensional data with no \f$z\f$-dependence.
48  * \endparblock
49  *
50  * \parblock
51  * \note There are multiple errors in the description of this test
52  * problem in the original SpECTRE paper \cite Kidder2016hev and there
53  * is a sign error in the velocity in \cite Beckwith2011iy. Despite these
54  * errors, the actual tests performed for those papers matched the standard
55  * problem as presented here.
56  * \endparblock
57  */
59  public:
61 
62  using options = tmpl::list<>;
63 
64  static constexpr OptionString help = {"The relativistic Orszag-Tang vortex"};
65 
67 
68  // @{
69  /// Retrieve hydro variable at `x`
70  template <typename DataType>
71  auto variables(
72  const tnsr::I<DataType, 3>& x,
73  tmpl::list<hydro::Tags::RestMassDensity<DataType>> /*meta*/) const
75 
76  template <typename DataType>
77  auto variables(
78  const tnsr::I<DataType, 3>& x,
79  tmpl::list<hydro::Tags::SpecificInternalEnergy<DataType>> /*meta*/) const
80  noexcept
82 
83  template <typename DataType>
84  auto variables(const tnsr::I<DataType, 3>& x,
85  tmpl::list<hydro::Tags::Pressure<DataType>> /*meta*/) const
87 
88  template <typename DataType>
89  auto variables(const tnsr::I<DataType, 3>& x,
91  DataType, 3, Frame::Inertial>> /*meta*/) const noexcept
94 
95  template <typename DataType>
96  auto variables(const tnsr::I<DataType, 3>& x,
97  tmpl::list<hydro::Tags::MagneticField<
98  DataType, 3, Frame::Inertial>> /*meta*/) const noexcept
101 
102  template <typename DataType>
103  auto variables(
104  const tnsr::I<DataType, 3>& x,
105  tmpl::list<hydro::Tags::DivergenceCleaningField<DataType>> /*meta*/) const
106  noexcept
108 
109  template <typename DataType>
110  auto variables(
111  const tnsr::I<DataType, 3>& x,
112  tmpl::list<hydro::Tags::LorentzFactor<DataType>> /*meta*/) const noexcept
114 
115  template <typename DataType>
116  auto variables(
117  const tnsr::I<DataType, 3>& x,
118  tmpl::list<hydro::Tags::SpecificEnthalpy<DataType>> /*meta*/) const
120  // @}
121 
122  /// Retrieve a collection of hydro variables at `x`
123  template <typename DataType, typename... Tags>
125  const tnsr::I<DataType, 3, Frame::Inertial>& x,
126  tmpl::list<Tags...> /*meta*/) const noexcept {
127  static_assert(sizeof...(Tags) > 1,
128  "The generic template will recurse infinitely if only one "
129  "tag is being retrieved.");
130  return {tuples::get<Tags>(variables(x, tmpl::list<Tags>{}))...};
131  }
132 
133  /// Retrieve the metric variables
134  template <typename DataType, typename Tag,
136  Tag>> = nullptr>
137  tuples::TaggedTuple<Tag> variables(const tnsr::I<DataType, 3>& x,
138  tmpl::list<Tag> /*meta*/) const noexcept {
139  constexpr double dummy_time = 0.;
140  return {std::move(get<Tag>(gr::Solutions::Minkowski<3>{}.variables(
141  x, dummy_time, tmpl::list<Tag>{})))};
142  }
143 
144  const equation_of_state_type& equation_of_state() const noexcept {
145  return equation_of_state_;
146  }
147 
148  void pup(PUP::er& /*p*/) noexcept; // NOLINT(google-runtime-references)
149 
150  private:
151  EquationsOfState::IdealFluid<true> equation_of_state_{5. / 3.};
152 };
153 
154 bool operator==(const OrszagTangVortex& lhs,
155  const OrszagTangVortex& rhs) noexcept;
156 
157 bool operator!=(const OrszagTangVortex& lhs,
158  const OrszagTangVortex& rhs) noexcept;
159 
160 } // namespace AnalyticData
161 } // namespace grmhd
tuples::TaggedTuple< Tags... > variables(const tnsr::I< DataType, 3, Frame::Inertial > &x, tmpl::list< Tags... >) const noexcept
Retrieve a collection of hydro variables at x
Definition: OrszagTangVortex.hpp:124
Definition: Strahlkorper.hpp:14
Analytic initial data for the relativistic Orszag-Tang vortex.
Definition: OrszagTangVortex.hpp:58
Defines class tuples::TaggedTuple.
The spatial velocity .
Definition: Tags.hpp:144
The fluid pressure .
Definition: Tags.hpp:123
The specific internal energy .
Definition: Tags.hpp:176
tuples::TaggedTuple< Tag > variables(const tnsr::I< DataType, 3 > &x, tmpl::list< Tag >) const noexcept
Retrieve the metric variables.
Definition: OrszagTangVortex.hpp:137
Defines classes and functions for making classes creatable from input files.
Defines the type alias Requires.
The magnetic field measured by an Eulerian observer, where is the normal to the spatial hypersurfac...
Definition: Tags.hpp:80
The divergence-cleaning field .
Definition: Tags.hpp:47
const char *const OptionString
The string used in option structs.
Definition: Options.hpp:27
An associative container that is indexed by structs.
Definition: TaggedTuple.hpp:272
The Lorentz factor .
Definition: Tags.hpp:64
Definition: DataBoxTag.hpp:29
Defines a list of useful type aliases for tensors.
Wraps the template metaprogramming library used (brigand)
The rest-mass density .
Definition: Tags.hpp:130
typename Requires_detail::requires_impl< B >::template_error_type_failed_to_meet_requirements_on_template_parameters Requires
Express requirements on the template parameters of a function or class, replaces std::enable_if_t ...
Definition: Requires.hpp:67
Definition: IndexType.hpp:44
The specific enthalpy .
Definition: Tags.hpp:169
Items related to general relativistic magnetohydrodynamics (GRMHD)
Definition: Characteristics.hpp:34