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