Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <memory>
7 :
8 : #include "Evolution/Systems/ForceFree/Tags.hpp"
9 : #include "Options/String.hpp"
10 : #include "PointwiseFunctions/AnalyticData/AnalyticData.hpp"
11 : #include "PointwiseFunctions/AnalyticSolutions/GeneralRelativity/Minkowski.hpp"
12 : #include "PointwiseFunctions/InitialDataUtilities/InitialData.hpp"
13 : #include "Utilities/TMPL.hpp"
14 :
15 : /// \cond
16 : class DataVector;
17 :
18 : namespace PUP {
19 : class er;
20 : } // namespace PUP
21 : /// \endcond
22 :
23 : namespace ForceFree::AnalyticData {
24 : /*!
25 : * \brief A test problem designed to show that the system initially satisfying
26 : * the force-free conditions may violate those in a later time.
27 : *
28 : * This test was originally performed by \cite Komissarov2002. We use the
29 : * initial data with a linear transition layer as \cite Etienne2017.
30 : *
31 : * \f{align*}{
32 : * B^x & = 1.0 , \\
33 : * B^y & = B^z = \left\{\begin{array}{ll}
34 : * 1.0 & \text{if } x < -0.1 \\
35 : * -10x & \text{if } -0.1 \leq x \leq 0.1 \\
36 : * -1.0 & \text{if } x > 0.1 \\
37 : * \end{array}\right\}, \\
38 : * E^x & = 0.0 , \\
39 : * E^y & = 0.5 , \\
40 : * E^z & = -0.5 .
41 : * \f}
42 : *
43 : * As time progresses, $B^2-E^2$ approaches to zero.
44 : *
45 : */
46 1 : class FfeBreakdown : public evolution::initial_data::InitialData,
47 : public MarkAsAnalyticData {
48 : public:
49 0 : using options = tmpl::list<>;
50 0 : static constexpr Options::String help{"A FFE breakdown problem"};
51 :
52 0 : FfeBreakdown() = default;
53 0 : FfeBreakdown(const FfeBreakdown&) = default;
54 0 : FfeBreakdown& operator=(const FfeBreakdown&) = default;
55 0 : FfeBreakdown(FfeBreakdown&&) = default;
56 0 : FfeBreakdown& operator=(FfeBreakdown&&) = default;
57 0 : ~FfeBreakdown() override = default;
58 :
59 0 : auto get_clone() const
60 : -> std::unique_ptr<evolution::initial_data::InitialData> override;
61 :
62 : /// \cond
63 : explicit FfeBreakdown(CkMigrateMessage* msg);
64 : using PUP::able::register_constructor;
65 : WRAPPED_PUPable_decl_template(FfeBreakdown);
66 : /// \endcond
67 :
68 : // NOLINTNEXTLINE(google-runtime-references)
69 0 : void pup(PUP::er& p) override;
70 :
71 : /// @{
72 : /// Retrieve the EM variables at (x,t).
73 1 : static auto variables(const tnsr::I<DataVector, 3>& coords,
74 : tmpl::list<Tags::TildeE> /*meta*/)
75 : -> tuples::TaggedTuple<Tags::TildeE>;
76 :
77 1 : static auto variables(const tnsr::I<DataVector, 3>& coords,
78 : tmpl::list<Tags::TildeB> /*meta*/)
79 : -> tuples::TaggedTuple<Tags::TildeB>;
80 :
81 1 : static auto variables(const tnsr::I<DataVector, 3>& coords,
82 : tmpl::list<Tags::TildePsi> /*meta*/)
83 : -> tuples::TaggedTuple<Tags::TildePsi>;
84 :
85 1 : static auto variables(const tnsr::I<DataVector, 3>& coords,
86 : tmpl::list<Tags::TildePhi> /*meta*/)
87 : -> tuples::TaggedTuple<Tags::TildePhi>;
88 :
89 1 : static auto variables(const tnsr::I<DataVector, 3>& coords,
90 : tmpl::list<Tags::TildeQ> /*meta*/)
91 : -> tuples::TaggedTuple<Tags::TildeQ>;
92 : /// @}
93 :
94 : /// Retrieve a collection of EM variables at position x
95 : template <typename... Tags>
96 1 : tuples::TaggedTuple<Tags...> variables(const tnsr::I<DataVector, 3>& x,
97 : tmpl::list<Tags...> /*meta*/) const {
98 : static_assert(sizeof...(Tags) > 1,
99 : "The generic template will recurse infinitely if only one "
100 : "tag is being retrieved.");
101 : return {get<Tags>(variables(x, tmpl::list<Tags>{}))...};
102 : }
103 :
104 : /// Retrieve the metric variables
105 : template <typename Tag>
106 1 : tuples::TaggedTuple<Tag> variables(const tnsr::I<DataVector, 3>& x,
107 : tmpl::list<Tag> /*meta*/) const {
108 : constexpr double dummy_time = 0.0;
109 : return background_spacetime_.variables(x, dummy_time, tmpl::list<Tag>{});
110 : }
111 :
112 : private:
113 0 : gr::Solutions::Minkowski<3> background_spacetime_{};
114 :
115 0 : friend bool operator==(const FfeBreakdown& lhs, const FfeBreakdown& rhs);
116 0 : friend bool operator!=(const FfeBreakdown& lhs, const FfeBreakdown& rhs);
117 : };
118 :
119 : } // namespace ForceFree::AnalyticData
|