SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/Cce/AnalyticSolutions - BouncingBlackHole.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 15.0 % 40 6
Test Date: 2026-10-22 17:29:42
Legend: Lines:     hit not hit

            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 <memory>
       8              : 
       9              : #include "DataStructures/SpinWeighted.hpp"
      10              : #include "DataStructures/Tensor/Tensor.hpp"
      11              : #include "Evolution/Systems/Cce/AnalyticSolutions/WorldtubeData.hpp"
      12              : #include "Evolution/Systems/Cce/Tags.hpp"
      13              : #include "Evolution/Systems/GeneralizedHarmonic/Tags.hpp"
      14              : #include "Options/String.hpp"
      15              : #include "PointwiseFunctions/GeneralRelativity/Tags.hpp"
      16              : #include "Utilities/Gsl.hpp"
      17              : #include "Utilities/Literals.hpp"
      18              : #include "Utilities/Serialization/CharmPupable.hpp"
      19              : #include "Utilities/TMPL.hpp"
      20              : 
      21              : /// \cond
      22              : class DataVector;
      23              : /// \endcond
      24              : 
      25            1 : namespace Cce::Solutions {
      26              : 
      27              : /*!
      28              :  * \brief Analytic solution representing a coordinate oscillation about a
      29              :  * stationary Schwarzschild black hole.
      30              :  *
      31              :  * \details As the oscillation in the metric data at the worldtube is a pure
      32              :  * coordinate effect, the system evolved using this worldtube data should
      33              :  * produce zero news. The solution is a coordinate transform applied to the
      34              :  * Schwarzschild solution in Kerr-Schild coordinates.
      35              :  */
      36            1 : struct BouncingBlackHole : public WorldtubeData {
      37            0 :   struct Amplitude {
      38            0 :     using type = double;
      39            0 :     static constexpr Options::String help{
      40              :         "The coordinate distance of the gauge oscillation"};
      41            0 :     static type lower_bound() { return 0.0; }
      42            0 :     static type suggested_value() { return 2.0; }
      43              :   };
      44            0 :   struct ExtractionRadius {
      45            0 :     using type = double;
      46            0 :     static constexpr Options::String help{
      47              :         "The extraction radius of the spherical solution"};
      48            0 :     static type lower_bound() { return 0.0; }
      49            0 :     static type suggested_value() { return 20.0; }
      50              :   };
      51            0 :   struct Mass {
      52            0 :     using type = double;
      53            0 :     static constexpr Options::String help{
      54              :         "The mass of the Schwarzschild black hole"};
      55            0 :     static type lower_bound() { return 0.0; }
      56            0 :     static type suggested_value() { return 1.0; }
      57              :   };
      58            0 :   struct Period {
      59            0 :     using type = double;
      60            0 :     static constexpr Options::String help{
      61              :         "The period of the coordinate oscillation"};
      62            0 :     static type lower_bound() { return 0.0; }
      63            0 :     static type suggested_value() { return 40.0; }
      64              :   };
      65              : 
      66            0 :   static constexpr Options::String help{
      67              :       "Analytic solution in which a static black hole is placed in an "
      68              :       "oscillating coordinate system"};
      69              : 
      70            0 :   using options = tmpl::list<Amplitude, ExtractionRadius, Mass, Period>;
      71              : 
      72            0 :   WRAPPED_PUPable_decl_template(BouncingBlackHole);  // NOLINT
      73              : 
      74            0 :   explicit BouncingBlackHole(CkMigrateMessage* msg) : WorldtubeData(msg) {}
      75              : 
      76              :   // clang doesn't manage to use = default correctly in this case
      77              :   // NOLINTNEXTLINE(modernize-use-equals-default)
      78            0 :   BouncingBlackHole() {}
      79              : 
      80            0 :   BouncingBlackHole(double amplitude, double extraction_radius, double mass,
      81              :                     double period);
      82              : 
      83            0 :   std::unique_ptr<WorldtubeData> get_clone() const override;
      84              : 
      85            0 :   void pup(PUP::er& p) override;
      86              : 
      87              :  protected:
      88              :   // The bouncing black hole solution is easily computed directly, so requires
      89              :   // no additional preparation.
      90            0 :   void prepare_solution(const size_t /*l_max*/,
      91              :                         const double /*time*/) const override{};
      92              : 
      93            0 :   using WorldtubeData::variables_impl;
      94              : 
      95              :   /*!
      96              :    * \brief The implementation function that computes the spacetime metric on
      97              :    * the extraction sphere at collocation points associated with angular
      98              :    * resolution `l_max`.
      99              :    *
     100              :    * \details The spacetime metric \f$g_{a b}\f$ is determined by evaluating the
     101              :    * Kerr-Schild metric at a set of transformed coordinates \f$t^\prime = t,
     102              :    * y^\prime = y, z^\prime = z\f$, and
     103              :    *
     104              :    * \f{align*}{
     105              :    * x = x^\prime + A \left(\sin\left(\frac{2 \pi t}{T}\right)\right)^4,
     106              :    * \f}
     107              :    *
     108              :    * where the amplitude \f$A\f$ is set by the option `Amplitude` and the period
     109              :    * \f$T\f$ is set by the option `Period`. In this notation we take
     110              :    * the primed coordinates to be the coordinates for which the black hole has
     111              :    * time-dependent coordinate position.
     112              :    */
     113            1 :   void variables_impl(
     114              :       gsl::not_null<tnsr::aa<DataVector, 3>*> spacetime_metric, size_t l_max,
     115              :       double time,
     116              :       tmpl::type_<gr::Tags::SpacetimeMetric<DataVector, 3>> /*meta*/)
     117              :       const override;
     118              : 
     119              :   /*!
     120              :    * \brief The implementation function that computes the first time derivative
     121              :    * of the spacetime metric on the extraction sphere.
     122              :    *
     123              :    * \details The time derivative of the spacetime metric
     124              :    * \f$\partial_t g_{a b}\f$ comes entirely from the Jacobian factor:
     125              :    *
     126              :    * \f{align*}{
     127              :    * \partial_t x = \frac{8 \pi A}{T} \cos\left(\frac{2 \pi t}{T}\right)
     128              :    * \left(\sin\left(\frac{2 \pi t}{T}\right)\right)^3,
     129              :    * \f}
     130              :    *
     131              :    * so the transformed metric derivative is,
     132              :    *
     133              :    * \f{align*}{
     134              :    * \partial_t g_{a^\prime b^\prime} = 2 \partial_{(a^\prime} \partial_t x
     135              :    * \partial_{b^\prime)} x^a g_{x a}.
     136              :    * \f}
     137              :    *
     138              :    * In this notation we take the primed coordinates to be the coordinates for
     139              :    * which the black hole has time-dependent coordinate position.
     140              :    */
     141            1 :   void variables_impl(
     142              :       gsl::not_null<tnsr::aa<DataVector, 3>*> dt_spacetime_metric, size_t l_max,
     143              :       double time,
     144              :       tmpl::type_<
     145              :           ::Tags::dt<gr::Tags::SpacetimeMetric<DataVector, 3>>> /*meta*/)
     146              :       const override;
     147              : 
     148              :   /*!
     149              :    * \brief The implementation function that computes the first spatial
     150              :    * derivative of the spacetime metric on the extraction sphere.
     151              :    *
     152              :    * \details The calculation proceeds by standard coordinate transform
     153              :    * techniques for the transformation given by \f$t^\prime = t,
     154              :    * y^\prime = y, z^\prime = z\f$, and
     155              :    *
     156              :    * \f{align*}{
     157              :    * x = x^\prime + A \left(\sin\left(\frac{2 \pi t}{T}\right)\right)^4,
     158              :    * \f}
     159              :    *
     160              :    * The general coordinate transformation formula that gives the metric
     161              :    * is then
     162              :    * \f{align*}{
     163              :    * \partial_a g_{b c} =
     164              :    * \partial_a \partial_b x^{\prime a^\prime} \partial_c x^{\prime b^\prime}
     165              :    * g_{a^\prime b^\prime}
     166              :    * + \partial_b x^{\prime a^\prime} \partial_a \partial_c x^{\prime b^\prime}
     167              :    * g_{a^\prime b^\prime}
     168              :    * + \partial_a x^{\prime a^\prime} \partial_b x^{\prime b^\prime}
     169              :    * \partial_c x^{\prime c^\prime} \partial_a g_{b c}
     170              :    * \f}
     171              :    */
     172            1 :   void variables_impl(
     173              :       gsl::not_null<tnsr::iaa<DataVector, 3>*> d_spacetime_metric, size_t l_max,
     174              :       double time,
     175              :       tmpl::type_<gh::Tags::Phi<DataVector, 3>> /*meta*/) const override;
     176              : 
     177              :   /// The News in the bouncing black hole solution vanishes, as the oscillation
     178              :   /// comes entirely from a coordinate transform.
     179            1 :   void variables_impl(
     180              :       gsl::not_null<Scalar<SpinWeighted<ComplexDataVector, -2>>*> news,
     181              :       size_t output_l_max, double time,
     182              :       tmpl::type_<Tags::News> /*meta*/) const override;
     183              : 
     184            0 :   double amplitude_ = std::numeric_limits<double>::signaling_NaN();
     185            0 :   double mass_ = std::numeric_limits<double>::signaling_NaN();
     186            0 :   double frequency_ = std::numeric_limits<double>::signaling_NaN();
     187              : };
     188              : }  // namespace Cce::Solutions
        

Generated by: LCOV version 2.0-1