Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #include <pup.h> 7 : 8 : #include "DataStructures/Tensor/TypeAliases.hpp" 9 : #include "Options/String.hpp" 10 : #include "PointwiseFunctions/AnalyticSolutions/AnalyticSolution.hpp" 11 : #include "PointwiseFunctions/AnalyticSolutions/GeneralRelativity/Minkowski.hpp" 12 : #include "PointwiseFunctions/AnalyticSolutions/GrMhd/Solutions.hpp" 13 : #include "PointwiseFunctions/AnalyticSolutions/RelativisticEuler/SmoothFlow.hpp" 14 : #include "PointwiseFunctions/Hydro/TagsDeclarations.hpp" // IWYU pragma: keep 15 : #include "Utilities/Serialization/CharmPupable.hpp" 16 : #include "Utilities/TMPL.hpp" 17 : #include "Utilities/TaggedTuple.hpp" 18 : 19 : namespace grmhd::Solutions { 20 : 21 : /*! 22 : * \brief Periodic GrMhd solution in Minkowski spacetime. 23 : * 24 : * An analytic solution to the 3-D GrMhd system. The user specifies the mean 25 : * flow velocity of the fluid, the wavevector of the density profile, and the 26 : * amplitude \f$A\f$ of the density profile. The magnetic field is taken to be 27 : * zero everywhere. In Cartesian coordinates \f$(x, y, z)\f$, and using 28 : * dimensionless units, the primitive quantities at a given time \f$t\f$ are 29 : * then 30 : * 31 : * \f{align*} 32 : * \rho(\vec{x},t) &= 1 + A \sin(\vec{k}\cdot(\vec{x} - \vec{v}t)) \\ 33 : * \vec{v}(\vec{x},t) &= [v_x, v_y, v_z]^{T},\\ 34 : * P(\vec{x},t) &= P, \\ 35 : * \epsilon(\vec{x}, t) &= \frac{P}{(\gamma - 1)\rho}\\ 36 : * \vec{B}(\vec{x},t) &= [0, 0, 0]^{T} 37 : * \f} 38 : */ 39 1 : class SmoothFlow : virtual public MarkAsAnalyticSolution, 40 : public RelativisticEuler::Solutions::SmoothFlow<3> { 41 0 : using smooth_flow = RelativisticEuler::Solutions::SmoothFlow<3>; 42 : 43 : public: 44 0 : using options = smooth_flow::options; 45 : 46 0 : static constexpr Options::String help = { 47 : "Periodic smooth flow in Minkowski spacetime with zero magnetic field."}; 48 : 49 0 : SmoothFlow() = default; 50 0 : SmoothFlow(const SmoothFlow& /*rhs*/) = default; 51 0 : SmoothFlow& operator=(const SmoothFlow& /*rhs*/) = default; 52 0 : SmoothFlow(SmoothFlow&& /*rhs*/) = default; 53 0 : SmoothFlow& operator=(SmoothFlow&& /*rhs*/) = default; 54 0 : ~SmoothFlow() override = default; 55 : 56 0 : SmoothFlow(const std::array<double, 3>& mean_velocity, 57 : const std::array<double, 3>& wavevector, double pressure, 58 : double adiabatic_index, double perturbation_size); 59 : 60 0 : auto get_clone() const 61 : -> std::unique_ptr<evolution::initial_data::InitialData> override; 62 : 63 : /// \cond 64 : explicit SmoothFlow(CkMigrateMessage* msg); 65 : using PUP::able::register_constructor; 66 : WRAPPED_PUPable_decl_template(SmoothFlow); 67 : /// \endcond 68 : 69 : using smooth_flow::equation_of_state; 70 : using smooth_flow::equation_of_state_type; 71 : 72 : // Overload the variables function from the base class. 73 : using smooth_flow::variables; 74 : 75 : /// @{ 76 : /// Retrieve hydro variable at `(x, t)` 77 : template <typename DataType> 78 1 : auto variables(const tnsr::I<DataType, 3>& x, double /*t*/, 79 : tmpl::list<hydro::Tags::MagneticField<DataType, 3>> /*meta*/) 80 : const -> tuples::TaggedTuple<hydro::Tags::MagneticField<DataType, 3>>; 81 : 82 : template <typename DataType> 83 1 : auto variables( 84 : const tnsr::I<DataType, 3>& x, double /*t*/, 85 : tmpl::list<hydro::Tags::DivergenceCleaningField<DataType>> /*meta*/) const 86 : -> tuples::TaggedTuple<hydro::Tags::DivergenceCleaningField<DataType>>; 87 : /// @} 88 : 89 : /// Retrieve a collection of hydro variables at `(x, t)` 90 : template <typename DataType, typename... Tags> 91 1 : tuples::TaggedTuple<Tags...> variables(const tnsr::I<DataType, 3>& x, 92 : double t, 93 : tmpl::list<Tags...> /*meta*/) const { 94 : static_assert(sizeof...(Tags) > 1, 95 : "The generic template will recurse infinitely if only one " 96 : "tag is being retrieved."); 97 : return {get<Tags>(variables(x, t, tmpl::list<Tags>{}))...}; 98 : } 99 : 100 : // NOLINTNEXTLINE(google-runtime-references) 101 0 : void pup(PUP::er& /*p*/) override; 102 : 103 : protected: 104 0 : friend bool operator==(const SmoothFlow& lhs, const SmoothFlow& rhs); 105 : }; 106 : 107 0 : bool operator!=(const SmoothFlow& lhs, const SmoothFlow& rhs); 108 : } // namespace grmhd::Solutions