SpECTRE Documentation Coverage Report
Current view: top level - PointwiseFunctions/AnalyticData/GrMhd - OrszagTangVortex.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 44.8 % 29 13
Test Date: 2026-10-22 17:29:42
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 "DataStructures/TaggedTuple.hpp"
       7              : #include "DataStructures/Tensor/TypeAliases.hpp"
       8              : #include "Options/String.hpp"
       9              : #include "PointwiseFunctions/AnalyticData/AnalyticData.hpp"
      10              : #include "PointwiseFunctions/AnalyticData/GrMhd/AnalyticData.hpp"
      11              : #include "PointwiseFunctions/AnalyticSolutions/GeneralRelativity/Minkowski.hpp"
      12              : #include "PointwiseFunctions/Hydro/EquationsOfState/IdealFluid.hpp"
      13              : #include "PointwiseFunctions/Hydro/Tags.hpp"
      14              : #include "PointwiseFunctions/Hydro/TagsDeclarations.hpp"
      15              : #include "PointwiseFunctions/InitialDataUtilities/InitialData.hpp"
      16              : #include "Utilities/Requires.hpp"
      17              : #include "Utilities/Serialization/CharmPupable.hpp"
      18              : #include "Utilities/TMPL.hpp"
      19              : 
      20              : // for IdealFluid
      21              : 
      22              : /// \cond
      23              : namespace PUP {
      24              : class er;
      25              : }  // namespace PUP
      26              : /// \endcond
      27              : 
      28              : namespace grmhd::AnalyticData {
      29              : 
      30              : /*!
      31              :  * \brief Analytic initial data for the relativistic Orszag-Tang vortex.
      32              :  *
      33              :  * The relativistic version of the Orszag-Tang vortex is a
      34              :  * 2-dimensional test case for relativistic MHD systems (see, e.g.,
      35              :  * \cite Beckwith2011iy).  It describes the flow of an ideal fluid with
      36              :  * adiabatic index \f$5/3\f$.  The initial conditions (and hence the
      37              :  * states at later times) are periodic in both \f$x\f$ and \f$y\f$
      38              :  * with period 1.  The initial conditions are:
      39              :  * \f{align*}
      40              :  * \rho &= \frac{25}{36 \pi} \\
      41              :  * p &= \frac{5}{12 \pi} \\
      42              :  * v_x &= -\frac{1}{2} \sin(2 \pi y) \\
      43              :  * v_y &= \frac{1}{2} \sin(2 \pi x) \\
      44              :  * B_x &= -\frac{1}{\sqrt{4 \pi}} \sin(2 \pi y) \\
      45              :  * B_y &= \frac{1}{\sqrt{4 \pi}} \sin(4 \pi x)
      46              :  * \f}
      47              :  * with \f$\rho\f$ the rest mass density, \f$p\f$ the pressure,
      48              :  * \f$v_i\f$ the spatial velocity, and \f$B_i\f$ the magnetic field.
      49              :  *
      50              :  * \parblock
      51              :  * \note We do not currently support 2-dimensional RMHD, so this class
      52              :  * provides 3-dimensional data with no \f$z\f$-dependence.
      53              :  * \endparblock
      54              :  *
      55              :  * \parblock
      56              :  * \note There are multiple errors in the description of this test
      57              :  * problem in the original SpECTRE paper \cite Kidder2016hev and there
      58              :  * is a sign error in the velocity in \cite Beckwith2011iy.  Despite these
      59              :  * errors, the actual tests performed for those papers matched the standard
      60              :  * problem as presented here.
      61              :  * \endparblock
      62              :  */
      63            1 : class OrszagTangVortex
      64              :     : public evolution::initial_data::InitialData,
      65              :       public AnalyticDataBase,
      66              :       public hydro::TemperatureInitialization<OrszagTangVortex>,
      67              :       public MarkAsAnalyticData {
      68              :  public:
      69            0 :   using equation_of_state_type = EquationsOfState::IdealFluid<true>;
      70              : 
      71            0 :   using options = tmpl::list<>;
      72              : 
      73            0 :   static constexpr Options::String help = {
      74              :       "The relativistic Orszag-Tang vortex"};
      75              : 
      76            0 :   OrszagTangVortex();
      77            0 :   OrszagTangVortex(const OrszagTangVortex& /*rhs*/) = default;
      78            0 :   OrszagTangVortex& operator=(const OrszagTangVortex& /*rhs*/) = default;
      79            0 :   OrszagTangVortex(OrszagTangVortex&& /*rhs*/) = default;
      80            0 :   OrszagTangVortex& operator=(OrszagTangVortex&& /*rhs*/) = default;
      81            0 :   ~OrszagTangVortex() override = default;
      82              : 
      83            0 :   auto get_clone() const
      84              :       -> std::unique_ptr<evolution::initial_data::InitialData> override;
      85              : 
      86              :   /// \cond
      87              :   explicit OrszagTangVortex(CkMigrateMessage* msg);
      88              :   using PUP::able::register_constructor;
      89              :   WRAPPED_PUPable_decl_template(OrszagTangVortex);
      90              :   /// \endcond
      91              : 
      92              :   /// @{
      93              :   /// Retrieve hydro variable at `x`
      94              :   template <typename DataType>
      95            1 :   auto variables(const tnsr::I<DataType, 3>& x,
      96              :                  tmpl::list<hydro::Tags::RestMassDensity<DataType>> /*meta*/)
      97              :       const -> tuples::TaggedTuple<hydro::Tags::RestMassDensity<DataType>>;
      98              : 
      99              :   template <typename DataType>
     100            1 :   auto variables(const tnsr::I<DataType, 3>& x,
     101              :                  tmpl::list<hydro::Tags::ElectronFraction<DataType>> /*meta*/)
     102              :       const -> tuples::TaggedTuple<hydro::Tags::ElectronFraction<DataType>>;
     103              : 
     104              :   template <typename DataType>
     105            1 :   auto variables(
     106              :       const tnsr::I<DataType, 3>& x,
     107              :       tmpl::list<hydro::Tags::SpecificInternalEnergy<DataType>> /*meta*/) const
     108              :       -> tuples::TaggedTuple<hydro::Tags::SpecificInternalEnergy<DataType>>;
     109              : 
     110              :   template <typename DataType>
     111            1 :   auto variables(const tnsr::I<DataType, 3>& x,
     112              :                  tmpl::list<hydro::Tags::Pressure<DataType>> /*meta*/) const
     113              :       -> tuples::TaggedTuple<hydro::Tags::Pressure<DataType>>;
     114              : 
     115              :   template <typename DataType>
     116            1 :   auto variables(const tnsr::I<DataType, 3>& x,
     117              :                  tmpl::list<hydro::Tags::SpatialVelocity<DataType, 3>> /*meta*/)
     118              :       const -> tuples::TaggedTuple<hydro::Tags::SpatialVelocity<DataType, 3>>;
     119              : 
     120              :   template <typename DataType>
     121            1 :   auto variables(const tnsr::I<DataType, 3>& x,
     122              :                  tmpl::list<hydro::Tags::MagneticField<DataType, 3>> /*meta*/)
     123              :       const -> tuples::TaggedTuple<hydro::Tags::MagneticField<DataType, 3>>;
     124              : 
     125              :   template <typename DataType>
     126            1 :   auto variables(
     127              :       const tnsr::I<DataType, 3>& x,
     128              :       tmpl::list<hydro::Tags::DivergenceCleaningField<DataType>> /*meta*/) const
     129              :       -> tuples::TaggedTuple<hydro::Tags::DivergenceCleaningField<DataType>>;
     130              : 
     131              :   template <typename DataType>
     132            1 :   auto variables(const tnsr::I<DataType, 3>& x,
     133              :                  tmpl::list<hydro::Tags::LorentzFactor<DataType>> /*meta*/)
     134              :       const -> tuples::TaggedTuple<hydro::Tags::LorentzFactor<DataType>>;
     135              : 
     136              :   template <typename DataType>
     137            1 :   auto variables(const tnsr::I<DataType, 3>& x,
     138              :                  tmpl::list<hydro::Tags::SpecificEnthalpy<DataType>> /*meta*/)
     139              :       const -> tuples::TaggedTuple<hydro::Tags::SpecificEnthalpy<DataType>>;
     140              : 
     141              :   template <typename DataType>
     142            1 :   auto variables(const tnsr::I<DataType, 3>& x,
     143              :                  tmpl::list<hydro::Tags::Temperature<DataType>> /*meta*/) const
     144              :       -> tuples::TaggedTuple<hydro::Tags::Temperature<DataType>> {
     145              :     return TemperatureInitialization::variables(
     146              :         x, tmpl::list<hydro::Tags::Temperature<DataType>>{});
     147              :   }
     148              :   /// @}
     149              : 
     150              :   /// Retrieve a collection of hydrodynamic variables at position x
     151              :   template <typename DataType, typename Tag1, typename Tag2, typename... Tags>
     152            1 :   tuples::TaggedTuple<Tag1, Tag2, Tags...> variables(
     153              :       const tnsr::I<DataType, 3>& x,
     154              :       tmpl::list<Tag1, Tag2, Tags...> /*meta*/) const {
     155              :     return {tuples::get<Tag1>(variables(x, tmpl::list<Tag1>{})),
     156              :             tuples::get<Tag2>(variables(x, tmpl::list<Tag2>{})),
     157              :             tuples::get<Tags>(variables(x, tmpl::list<Tags>{}))...};
     158              :   }
     159              : 
     160              :   /// Retrieve the metric variables
     161              :   template <typename DataType, typename Tag,
     162              :             Requires<not tmpl::list_contains_v<
     163              :                 tmpl::push_back<hydro::grmhd_tags<DataType>,
     164              :                                 hydro::Tags::SpecificEnthalpy<DataType>>,
     165              :                 Tag>> = nullptr>
     166            1 :   tuples::TaggedTuple<Tag> variables(const tnsr::I<DataType, 3>& x,
     167              :                                      tmpl::list<Tag> /*meta*/) const {
     168              :     constexpr double dummy_time = 0.;
     169              :     return {std::move(get<Tag>(gr::Solutions::Minkowski<3>{}.variables(
     170              :         x, dummy_time, tmpl::list<Tag>{})))};
     171              :   }
     172              : 
     173            0 :   const equation_of_state_type& equation_of_state() const {
     174              :     return equation_of_state_;
     175              :   }
     176              : 
     177              :   // NOLINTNEXTLINE(google-runtime-references)
     178            0 :   void pup(PUP::er& /*p*/) override;
     179              : 
     180              :  private:
     181            0 :   EquationsOfState::IdealFluid<true> equation_of_state_{5. / 3.};
     182              : };
     183              : 
     184            0 : bool operator==(const OrszagTangVortex& lhs, const OrszagTangVortex& rhs);
     185              : 
     186            0 : bool operator!=(const OrszagTangVortex& lhs, const OrszagTangVortex& rhs);
     187              : 
     188              : }  // namespace grmhd::AnalyticData
        

Generated by: LCOV version 2.0-1