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