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/CachedTempBuffer.hpp"
9 : #include "DataStructures/DataBox/Prefixes.hpp"
10 : #include "DataStructures/TaggedTuple.hpp"
11 : #include "DataStructures/Tensor/Tensor.hpp"
12 : #include "Elliptic/Systems/Punctures/Tags.hpp"
13 : #include "NumericalAlgorithms/LinearOperators/PartialDerivatives.hpp"
14 : #include "Options/String.hpp"
15 : #include "PointwiseFunctions/InitialDataUtilities/AnalyticSolution.hpp"
16 : #include "Utilities/Gsl.hpp"
17 : #include "Utilities/TMPL.hpp"
18 :
19 0 : namespace Punctures::Solutions {
20 :
21 : /// Flat spacetime. Useful as initial guess.
22 1 : class Flatness : public elliptic::analytic_data::AnalyticSolution {
23 : public:
24 0 : using options = tmpl::list<>;
25 0 : static constexpr Options::String help{
26 : "Flat spacetime, useful as initial guess."};
27 :
28 0 : Flatness() = default;
29 0 : Flatness(const Flatness&) = default;
30 0 : Flatness& operator=(const Flatness&) = default;
31 0 : Flatness(Flatness&&) = default;
32 0 : Flatness& operator=(Flatness&&) = default;
33 0 : ~Flatness() = default;
34 0 : std::unique_ptr<elliptic::analytic_data::AnalyticSolution> get_clone()
35 : const override {
36 : return std::make_unique<Flatness>(*this);
37 : }
38 :
39 : /// \cond
40 : explicit Flatness(CkMigrateMessage* m)
41 : : elliptic::analytic_data::AnalyticSolution(m) {}
42 : using PUP::able::register_constructor;
43 : WRAPPED_PUPable_decl_template(Flatness);
44 : /// \endcond
45 :
46 : template <typename... RequestedTags>
47 0 : tuples::TaggedTuple<RequestedTags...> variables(
48 : const tnsr::I<DataVector, 3, Frame::Inertial>& x,
49 : tmpl::list<RequestedTags...> /*meta*/) const {
50 : // These are all zero
51 : using supported_tags =
52 : tmpl::list<Tags::Field,
53 : ::Tags::deriv<Tags::Field, tmpl::size_t<3>, Frame::Inertial>,
54 : ::Tags::Flux<Tags::Field, tmpl::size_t<3>, Frame::Inertial>,
55 : Punctures::Tags::Alpha,
56 : Punctures::Tags::TracelessConformalExtrinsicCurvature,
57 : Punctures::Tags::Beta,
58 : ::Tags::FixedSource<Punctures::Tags::Field>>;
59 : static_assert(
60 : std::is_same_v<
61 : tmpl::list_difference<tmpl::list<RequestedTags...>, supported_tags>,
62 : tmpl::list<>>,
63 : "Not all requested tags are supported. The static_assert lists the "
64 : "unsupported tags.");
65 : const auto make_value = [&x](auto tag_v) {
66 : using tag = std::decay_t<decltype(tag_v)>;
67 : return make_with_value<typename tag::type>(x, 0.);
68 : };
69 : return {make_value(RequestedTags{})...};
70 : }
71 :
72 : template <typename... RequestedTags>
73 0 : tuples::TaggedTuple<RequestedTags...> variables(
74 : const tnsr::I<DataVector, 3, Frame::Inertial>& x, const Mesh<3>& /*mesh*/,
75 : const InverseJacobian<DataVector, 3, Frame::ElementLogical,
76 : Frame::Inertial>& /*inv_jacobian*/,
77 : tmpl::list<RequestedTags...> /*meta*/) const {
78 : return variables(x, tmpl::list<RequestedTags...>{});
79 : }
80 : };
81 :
82 0 : bool operator==(const Flatness& lhs, const Flatness& rhs);
83 :
84 0 : bool operator!=(const Flatness& lhs, const Flatness& rhs);
85 :
86 : } // namespace Punctures::Solutions
|