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 : #include <limits>
8 : #include <pup.h>
9 : #include <utility>
10 :
11 : #include "DataStructures/TaggedTuple.hpp"
12 : #include "DataStructures/Tensor/Tensor.hpp"
13 : #include "Evolution/Systems/CurvedScalarWave/Tags.hpp"
14 : #include "Options/Context.hpp"
15 : #include "Options/String.hpp"
16 : #include "PointwiseFunctions/AnalyticData/AnalyticData.hpp"
17 : #include "PointwiseFunctions/InitialDataUtilities/InitialData.hpp"
18 : #include "Utilities/TMPL.hpp"
19 :
20 : namespace CurvedScalarWave::AnalyticData {
21 :
22 : /*!
23 : * \brief Analytic initial data for a pure spherical harmonic in three
24 : * dimensions.
25 : *
26 : * \details The initial data is taken from \cite Scheel2003vs , Eqs. 4.1--4.3,
27 : * and sets the evolved variables of the scalar wave as follows:
28 : *
29 : * \f{align}
30 : * \Psi &= 0 \\
31 : * \Phi_i &= 0 \\
32 : * \Pi &= \Pi_0(r, \theta, \phi) = e^{- (r - r_0)^2 / w^2} Y_{lm}(\theta,
33 : * \phi), \f}
34 : *
35 : * where \f$r_0\f$ is the radius of the profile and \f$w\f$ is its width. This
36 : * describes a pure spherical harmonic mode \f$Y_{lm}(\theta, \phi)\f$ truncated
37 : * by a circular Gaussian window function.
38 : *
39 : * When evolved, the scalar field \f$\Phi\f$ will briefly build up around the
40 : * radius \f$r_0\f$ and then disperse. This can be used to study the ringdown
41 : * behavior and late-time tails in different background spacetimes.
42 : */
43 :
44 1 : class PureSphericalHarmonic : public evolution::initial_data::InitialData,
45 : public MarkAsAnalyticData {
46 : public:
47 0 : struct Radius {
48 0 : using type = double;
49 0 : static constexpr Options::String help = {
50 : "The radius of the spherical harmonic profile"};
51 0 : static type lower_bound() { return 0.0; }
52 : };
53 :
54 0 : struct Width {
55 0 : using type = double;
56 0 : static constexpr Options::String help = {
57 : "The width of the spherical harmonic profile."};
58 0 : static type lower_bound() { return 0.0; }
59 : };
60 :
61 0 : struct Mode {
62 0 : using type = std::pair<size_t, int>;
63 0 : static constexpr Options::String help = {
64 : "The l-mode and m-mode of the spherical harmonic Ylm"};
65 : };
66 :
67 0 : using options = tmpl::list<Radius, Width, Mode>;
68 :
69 0 : static constexpr Options::String help = {
70 : "Initial data for a pure spherical harmonic mode truncated by a circular "
71 : "Gaussian window funtion. The expression is taken from Scheel(2003), "
72 : "equations 4.1-4.3."};
73 :
74 0 : PureSphericalHarmonic() = default;
75 :
76 0 : PureSphericalHarmonic(double radius, double width,
77 : std::pair<size_t, int> mode,
78 : const Options::Context& context = {});
79 0 : PureSphericalHarmonic(const PureSphericalHarmonic&) = default;
80 0 : PureSphericalHarmonic& operator=(const PureSphericalHarmonic&) = default;
81 0 : PureSphericalHarmonic(PureSphericalHarmonic&&) = default;
82 0 : PureSphericalHarmonic& operator=(PureSphericalHarmonic&&) = default;
83 0 : ~PureSphericalHarmonic() override = default;
84 :
85 0 : auto get_clone() const
86 : -> std::unique_ptr<evolution::initial_data::InitialData> override;
87 :
88 : /// \cond
89 : explicit PureSphericalHarmonic(CkMigrateMessage* msg);
90 : using PUP::able::register_constructor;
91 : WRAPPED_PUPable_decl_template(PureSphericalHarmonic);
92 : /// \endcond
93 :
94 0 : static constexpr size_t volume_dim = 3;
95 0 : using tags =
96 : tmpl::list<CurvedScalarWave::Tags::Psi, CurvedScalarWave::Tags::Pi,
97 : CurvedScalarWave::Tags::Phi<3>>;
98 :
99 : /// Retrieve the evolution variables at spatial coordinates `x`
100 : tuples::TaggedTuple<CurvedScalarWave::Tags::Psi, CurvedScalarWave::Tags::Pi,
101 : CurvedScalarWave::Tags::Phi<3>>
102 1 : variables(const tnsr::I<DataVector, 3>& x, tags /*meta*/) const;
103 :
104 : // NOLINTNEXTLINE(google-runtime-references)
105 0 : void pup(PUP::er& /*p*/) override;
106 :
107 : private:
108 0 : double radius_{std::numeric_limits<double>::signaling_NaN()};
109 0 : double width_sq_{std::numeric_limits<double>::signaling_NaN()};
110 0 : std::pair<size_t, int> mode_{std::numeric_limits<size_t>::signaling_NaN(),
111 : std::numeric_limits<int>::signaling_NaN()};
112 :
113 0 : friend bool operator==(const PureSphericalHarmonic& lhs,
114 : const PureSphericalHarmonic& rhs);
115 :
116 0 : friend bool operator!=(const PureSphericalHarmonic& lhs,
117 : const PureSphericalHarmonic& rhs);
118 : };
119 :
120 : } // namespace CurvedScalarWave::AnalyticData
|