Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <cstddef>
7 :
8 : #include "DataStructures/Tensor/Tensor.hpp"
9 : #include "NumericalAlgorithms/LinearOperators/PartialDerivatives.hpp" // for tags
10 : #include "Options/Options.hpp"
11 : #include "PointwiseFunctions/AnalyticSolutions/AnalyticSolution.hpp"
12 : #include "PointwiseFunctions/GeneralRelativity/Tags.hpp"
13 : #include "Utilities/TMPL.hpp"
14 : #include "Utilities/TaggedTuple.hpp"
15 :
16 : // IWYU pragma: no_forward_declare Tags::deriv
17 :
18 : /// \cond
19 : namespace PUP {
20 : class er;
21 : } // namespace PUP
22 : namespace Tags {
23 : template <typename Tag>
24 : struct dt;
25 : } // namespace Tags
26 : /// \endcond
27 :
28 : namespace gr {
29 : namespace Solutions {
30 :
31 : /*!
32 : * \brief The Minkowski solution for flat space in Dim spatial dimensions.
33 : *
34 : * \details The solution has lapse \f$N(x,t)= 1 \f$, shift \f$N^i(x,t) = 0 \f$
35 : * and the identity as the spatial metric: \f$g_{ii} = 1 \f$
36 : */
37 : template <size_t Dim>
38 1 : class Minkowski : public MarkAsAnalyticSolution {
39 : public:
40 0 : using options = tmpl::list<>;
41 0 : static constexpr Options::String help{
42 : "Minkowski solution to Einstein's Equations"};
43 0 : static constexpr size_t volume_dim = Dim;
44 :
45 0 : Minkowski() = default;
46 0 : Minkowski(const Minkowski& /*rhs*/) noexcept = default;
47 0 : Minkowski& operator=(const Minkowski& /*rhs*/) noexcept = default;
48 0 : Minkowski(Minkowski&& /*rhs*/) noexcept = default;
49 0 : Minkowski& operator=(Minkowski&& /*rhs*/) noexcept = default;
50 0 : ~Minkowski() = default;
51 :
52 : template <typename DataType>
53 0 : using DerivLapse = ::Tags::deriv<gr::Tags::Lapse<DataType>, tmpl::size_t<Dim>,
54 : Frame::Inertial>;
55 : template <typename DataType>
56 0 : using DerivShift =
57 : ::Tags::deriv<gr::Tags::Shift<Dim, Frame::Inertial, DataType>,
58 : tmpl::size_t<Dim>, Frame::Inertial>;
59 : template <typename DataType>
60 0 : using DerivSpatialMetric =
61 : ::Tags::deriv<gr::Tags::SpatialMetric<Dim, Frame::Inertial, DataType>,
62 : tmpl::size_t<Dim>, Frame::Inertial>;
63 : template <typename DataType>
64 0 : using tags = tmpl::list<
65 : gr::Tags::Lapse<DataType>, ::Tags::dt<gr::Tags::Lapse<DataType>>,
66 : DerivLapse<DataType>, gr::Tags::Shift<Dim, Frame::Inertial, DataType>,
67 : ::Tags::dt<gr::Tags::Shift<Dim, Frame::Inertial, DataType>>,
68 : DerivShift<DataType>,
69 : gr::Tags::SpatialMetric<Dim, Frame::Inertial, DataType>,
70 : ::Tags::dt<gr::Tags::SpatialMetric<Dim, Frame::Inertial, DataType>>,
71 : DerivSpatialMetric<DataType>, gr::Tags::SqrtDetSpatialMetric<DataType>,
72 : gr::Tags::ExtrinsicCurvature<Dim, Frame::Inertial, DataType>,
73 : gr::Tags::InverseSpatialMetric<Dim, Frame::Inertial, DataType>>;
74 : template <typename DataType, typename... Tags>
75 0 : tuples::TaggedTuple<Tags...> variables(const tnsr::I<DataType, Dim>& x,
76 : double t,
77 : tmpl::list<Tags...> /*meta*/) const
78 : noexcept {
79 : static_assert(sizeof...(Tags) > 1,
80 : "Unrecognized tag requested. See the function parameters "
81 : "for the tag.");
82 : return {get<Tags>(variables(x, t, tmpl::list<Tags>{}))...};
83 : }
84 :
85 : template <typename DataType>
86 0 : tuples::TaggedTuple<gr::Tags::Lapse<DataType>> variables(
87 : const tnsr::I<DataType, Dim>& x, double t,
88 : tmpl::list<gr::Tags::Lapse<DataType>> /*meta*/) const noexcept;
89 :
90 : template <typename DataType>
91 0 : tuples::TaggedTuple<::Tags::dt<gr::Tags::Lapse<DataType>>> variables(
92 : const tnsr::I<DataType, Dim>& x, double t,
93 : tmpl::list<::Tags::dt<gr::Tags::Lapse<DataType>>> /*meta*/) const
94 : noexcept;
95 :
96 : template <typename DataType>
97 : tuples::TaggedTuple<::Tags::deriv<gr::Tags::Lapse<DataType>,
98 : tmpl::size_t<Dim>, Frame::Inertial>>
99 0 : variables(
100 : const tnsr::I<DataType, Dim>& x, double t,
101 : tmpl::list<::Tags::deriv<gr::Tags::Lapse<DataType>, tmpl::size_t<Dim>,
102 : Frame::Inertial>> /*meta*/) const noexcept;
103 :
104 : template <typename DataType>
105 : tuples::TaggedTuple<gr::Tags::Shift<Dim, Frame::Inertial, DataType>>
106 0 : variables(
107 : const tnsr::I<DataType, Dim>& x, double /*t*/,
108 : tmpl::list<gr::Tags::Shift<Dim, Frame::Inertial, DataType>> /*meta*/)
109 : const noexcept;
110 :
111 : template <typename DataType>
112 : tuples::TaggedTuple<
113 : ::Tags::dt<gr::Tags::Shift<Dim, Frame::Inertial, DataType>>>
114 0 : variables(
115 : const tnsr::I<DataType, Dim>& x, double /*t*/,
116 : tmpl::list<
117 : ::Tags::dt<gr::Tags::Shift<Dim, Frame::Inertial, DataType>>> /*meta*/)
118 : const noexcept;
119 :
120 : template <typename DataType>
121 : tuples::TaggedTuple<
122 : ::Tags::deriv<gr::Tags::Shift<Dim, Frame::Inertial, DataType>,
123 : tmpl::size_t<Dim>, Frame::Inertial>>
124 0 : variables(
125 : const tnsr::I<DataType, Dim>& x, double /*t*/,
126 : tmpl::list<::Tags::deriv<gr::Tags::Shift<Dim, Frame::Inertial, DataType>,
127 : tmpl::size_t<Dim>, Frame::Inertial>> /*meta*/)
128 : const noexcept;
129 :
130 : template <typename DataType>
131 : tuples::TaggedTuple<gr::Tags::SpatialMetric<Dim, Frame::Inertial, DataType>>
132 0 : variables(const tnsr::I<DataType, Dim>& x, double /*t*/,
133 : tmpl::list<gr::Tags::SpatialMetric<Dim, Frame::Inertial,
134 : DataType>> /*meta*/) const
135 : noexcept;
136 :
137 : template <typename DataType>
138 : tuples::TaggedTuple<
139 : ::Tags::dt<gr::Tags::SpatialMetric<Dim, Frame::Inertial, DataType>>>
140 0 : variables(const tnsr::I<DataType, Dim>& x, double /*t*/,
141 : tmpl::list<::Tags::dt<gr::Tags::SpatialMetric<
142 : Dim, Frame::Inertial, DataType>>> /*meta*/) const noexcept;
143 :
144 : template <typename DataType>
145 : tuples::TaggedTuple<
146 : ::Tags::deriv<gr::Tags::SpatialMetric<Dim, Frame::Inertial, DataType>,
147 : tmpl::size_t<Dim>, Frame::Inertial>>
148 0 : variables(
149 : const tnsr::I<DataType, Dim>& x, double /*t*/,
150 : tmpl::list<
151 : ::Tags::deriv<gr::Tags::SpatialMetric<Dim, Frame::Inertial, DataType>,
152 : tmpl::size_t<Dim>, Frame::Inertial>> /*meta*/) const
153 : noexcept;
154 :
155 : template <typename DataType>
156 : tuples::TaggedTuple<
157 : gr::Tags::InverseSpatialMetric<Dim, Frame::Inertial, DataType>>
158 0 : variables(const tnsr::I<DataType, Dim>& x, double /*t*/,
159 : tmpl::list<gr::Tags::InverseSpatialMetric<Dim, Frame::Inertial,
160 : DataType>> /*meta*/) const
161 : noexcept;
162 :
163 : template <typename DataType>
164 : tuples::TaggedTuple<
165 : gr::Tags::ExtrinsicCurvature<Dim, Frame::Inertial, DataType>>
166 0 : variables(const tnsr::I<DataType, Dim>& x, double /*t*/,
167 : tmpl::list<gr::Tags::ExtrinsicCurvature<Dim, Frame::Inertial,
168 : DataType>> /*meta*/) const
169 : noexcept;
170 :
171 : template <typename DataType>
172 0 : tuples::TaggedTuple<gr::Tags::SqrtDetSpatialMetric<DataType>> variables(
173 : const tnsr::I<DataType, Dim>& x, double /*t*/,
174 : tmpl::list<gr::Tags::SqrtDetSpatialMetric<DataType>> /*meta*/) const
175 : noexcept;
176 :
177 : template <typename DataType>
178 : tuples::TaggedTuple<::Tags::dt<gr::Tags::SqrtDetSpatialMetric<DataType>>>
179 0 : variables(
180 : const tnsr::I<DataType, Dim>& x, double /*t*/,
181 : tmpl::list<::Tags::dt<gr::Tags::SqrtDetSpatialMetric<DataType>>> /*meta*/)
182 : const noexcept;
183 :
184 : // clang-tidy: google-runtime-references
185 0 : void pup(PUP::er& /*p*/) noexcept {} // NOLINT
186 : };
187 :
188 : template <size_t Dim>
189 0 : inline constexpr bool operator==(const Minkowski<Dim>& /*lhs*/,
190 : const Minkowski<Dim>& /*rhs*/) noexcept {
191 : return true;
192 : }
193 :
194 : template <size_t Dim>
195 0 : inline constexpr bool operator!=(const Minkowski<Dim>& /*lhs*/,
196 : const Minkowski<Dim>& /*rhs*/) noexcept {
197 : return false;
198 : }
199 : } // namespace Solutions
200 : } // namespace gr
|