InitializeJ.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cstddef>
7 #include <memory>
8 #include <string>
9 
10 #include "DataStructures/SpinWeighted.hpp"
12 #include "Evolution/Systems/Cce/Tags.hpp"
13 #include "NumericalAlgorithms/Spectral/SwshCollocation.hpp"
14 #include "NumericalAlgorithms/Spectral/SwshInterpolation.hpp"
15 #include "Options/Options.hpp"
17 #include "Utilities/Gsl.hpp"
18 #include "Utilities/TMPL.hpp"
19 
20 /// \cond
21 class ComplexDataVector;
22 /// \endcond
23 
24 namespace Cce {
25 namespace Tags {
26 /// \cond
27 struct LMax;
28 struct NumberOfRadialPoints;
29 /// \endcond
30 } // namespace Tags
31 
32 /// Contains utilities and \ref DataBoxGroup mutators for generating data for
33 /// \f$J\f$ on the initial CCE hypersurface.
34 namespace InitializeJ {
35 
36 namespace detail {
37 double adjust_angular_coordinates_for_j(
39  gsl::not_null<tnsr::i<DataVector, 3>*> cartesian_cauchy_coordinates,
42  angular_cauchy_coordinates,
43  const SpinWeighted<ComplexDataVector, 2>& surface_j, size_t l_max,
44  double tolerance, size_t max_steps, bool adjust_volume_gauge) noexcept;
45 } // namespace detail
46 
47 /*!
48  * \brief Apply a radius-independent angular gauge transformation to a volume
49  * \f$J\f$, for use with initial data generation.
50  *
51  * \details Performs the gauge transformation to \f$\hat J\f$,
52  *
53  * \f{align*}{
54  * \hat J = \frac{1}{4 \hat{\omega}^2} \left( \bar{\hat d}^2 J(\hat x^{\hat A})
55  * + \hat c^2 \bar J(\hat x^{\hat A})
56  * + 2 \hat c \bar{\hat d} K(\hat x^{\hat A}) \right).
57  * \f}
58  *
59  * Where \f$\hat c\f$ and \f$\hat d\f$ are the spin-weighted angular Jacobian
60  * factors computed by `GaugeUpdateJacobianFromCoords`, and \f$\hat \omega\f$ is
61  * the conformal factor associated with the angular coordinate transformation.
62  * Note that the right-hand sides with explicit \f$\hat x^{\hat A}\f$ dependence
63  * must be interpolated and that \f$K = \sqrt{1 + J \bar J}\f$.
64  */
66  using boundary_tags =
69  using return_tags = tmpl::list<Tags::BondiJ>;
70  using argument_tags = tmpl::append<boundary_tags>;
71 
72  static void apply(
76  const Scalar<SpinWeighted<ComplexDataVector, 0>>& gauge_omega,
78  cauchy_angular_coordinates,
79  size_t l_max) noexcept;
80 };
81 
82 /// \cond
83 struct NoIncomingRadiation;
84 struct ZeroNonSmooth;
85 struct InverseCubic;
86 /// \endcond
87 
88 /*!
89  * \brief Abstract base class for an initial hypersurface data generator for
90  * Cce.
91  *
92  * \details The functions that are required to be overriden in the derived
93  * classes are:
94  * - `InitializeJ::get_clone()`: should return a
95  * `std::unique_ptr<InitializeJ>` with cloned state.
96  * - `InitializeJ::operator() const`: should take as arguments, first a set of
97  * `gsl::not_null` pointers represented by `mutate_tags`, followed by a set of
98  * `const` references to quantities represented by `argument_tags`.
99  * \note The `InitializeJ::operator()` should be const, and therefore not alter
100  * the internal state of the generator. This is compatible with all known
101  * use-cases and permits the `InitializeJ` generator to be placed in the
102  * `ConstGlobalCache`.
103  */
104 struct InitializeJ : public PUP::able {
105  using boundary_tags = tmpl::list<Tags::BoundaryValue<Tags::BondiJ>,
108 
109  using mutate_tags = tmpl::list<Tags::BondiJ, Tags::CauchyCartesianCoords,
111  using argument_tags =
112  tmpl::push_back<boundary_tags, Tags::LMax, Tags::NumberOfRadialPoints>;
113 
114  using creatable_classes =
115  tmpl::list<InverseCubic, NoIncomingRadiation, ZeroNonSmooth>;
116 
117  WRAPPED_PUPable_abstract(InitializeJ); // NOLINT
118 
119  virtual std::unique_ptr<InitializeJ> get_clone() const noexcept = 0;
120 
121  virtual void operator()(
123  gsl::not_null<tnsr::i<DataVector, 3>*> cartesian_cauchy_coordinates,
126  angular_cauchy_coordinates,
127  const Scalar<SpinWeighted<ComplexDataVector, 2>>& boundary_j,
128  const Scalar<SpinWeighted<ComplexDataVector, 2>>& boundary_dr_j,
129  const Scalar<SpinWeighted<ComplexDataVector, 0>>& r, size_t l_max,
130  size_t number_of_radial_points) const noexcept = 0;
131 };
132 } // namespace InitializeJ
133 } // namespace Cce
Cce::InitializeJ::InverseCubic
Initialize on the first hypersurface from provided boundary values of , , and .
Definition: InverseCubic.hpp:42
CharmPupable.hpp
Options.hpp
Cce::Tags::CauchyAngularCoords
Definition: Tags.hpp:165
Cce::InitializeJ::GaugeAdjustInitialJ
Apply a radius-independent angular gauge transformation to a volume , for use with initial data gener...
Definition: InitializeJ.hpp:65
SpinWeighted
Make a spin-weighted type T with spin-weight Spin. Mathematical operators are restricted to addition,...
Definition: SpinWeighted.hpp:24
Cce::Tags::BondiJ
Bondi parameter .
Definition: Tags.hpp:34
cstddef
Cce::Tags::BoundaryValue
A prefix tag representing the boundary data for a quantity on the extraction surface.
Definition: Tags.hpp:204
Cce::InitializeJ::ZeroNonSmooth
Initialize on the first hypersurface to be vanishing, finding the appropriate angular coordinates to...
Definition: ZeroNonSmooth.hpp:37
DataVector
Stores a collection of function values.
Definition: DataVector.hpp:42
memory
Spectral::Swsh::Tags::LMax
Tag for the maximum spin-weighted spherical harmonic l; sets angular resolution.
Definition: SwshTags.hpp:205
Frame::Spherical
Represents a spherical-coordinate frame that is associated with a Cartesian frame,...
Definition: IndexType.hpp:54
Cce::InitializeJ::InitializeJ
Abstract base class for an initial hypersurface data generator for Cce.
Definition: InitializeJ.hpp:104
Scalar
Tensor< T, Symmetry<>, index_list<> > Scalar
Definition: TypeAliases.hpp:21
Cce
The set of utilities for performing Cauchy characteristic evolution and Cauchy characteristic matchin...
Definition: BoundaryComputeAndSendToEvolution.hpp:28
Cce::Tags::GaugeD
The spin-weight 0 angular Jacobian factor.
Definition: Tags.hpp:150
Gsl.hpp
TypeAliases.hpp
ComplexDataVector
Stores a collection of complex function values.
Definition: ComplexDataVector.hpp:47
std::unique_ptr
Cce::Tags::GaugeC
The spin-weight 2 angular Jacobian factor.
Definition: Tags.hpp:145
TMPL.hpp
Cce::InitializeJ::NoIncomingRadiation
Initialize on the first hypersurface by constraining .
Definition: NoIncomingRadiation.hpp:35
Cce::Tags::CauchyCartesianCoords
Definition: Tags.hpp:171
gsl::not_null
Require a pointer to not be a nullptr
Definition: Gsl.hpp:182
Cce::Tags::GaugeOmega
The conformal factor associated with an angular transformation.
Definition: Tags.hpp:155
string