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