LinearSolve.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include "DataStructures/SpinWeighted.hpp"
8 #include "Evolution/Systems/Cce/Tags.hpp"
9 #include "NumericalAlgorithms/Spectral/SwshTags.hpp"
10 
11 /// \cond
12 class ComplexDataVector;
13 class Matrix;
14 /// \endcond
15 
16 namespace Cce {
17 
18 /*!
19  * \brief Provides access to a lazily cached integration matrix for the \f$Q\f$
20  * and \f$W\f$ equations in CCE hypersurface evaluation.
21  *
22  * \details The provided matrix acts on the integrand collocation points and
23  * solves the equation,
24  *
25  * \f[
26  * (1 - y) \partial_y f + 2 f = g,
27  * \f]
28  *
29  * for \f$f\f$ given integrand \f$g\f$.
30  */
32  size_t number_of_radial_grid_points) noexcept;
33 
34 /*!
35  * \brief A utility function for evaluating the \f$Q\f$ and \f$W\f$ hypersurface
36  * integrals during CCE evolution.
37  *
38  * \details Computes and returns by `not_null` pointer the solution to the
39  * equation
40  *
41  * \f[
42  * (1 - y) \partial_y f + 2 f = A + (1 - y) B,
43  * \f]
44  *
45  * where \f$A\f$ is provided as `pole_of_integrand` and \f$B\f$ is provided as
46  * `regular_integrand`. The value `one_minus_y` is required for determining the
47  * integrand and `l_max` is required to determine the shape of the spin-weighted
48  * spherical harmonic mesh.
49  */
50 void radial_integrate_cce_pole_equations(
51  gsl::not_null<ComplexDataVector*> integral_result,
52  const ComplexDataVector& pole_of_integrand,
53  const ComplexDataVector& regular_integrand,
54  const ComplexDataVector& boundary, const ComplexDataVector& one_minus_y,
55  size_t l_max, size_t number_of_radial_points) noexcept;
56 
57 namespace detail {
58 // needed because the standard transpose utility cannot create an arbitrary
59 // ordering of blocks of data. This returns by pointer the configuration useful
60 // for the linear solve step for H integration
61 void transpose_to_reals_then_imags_radial_stripes(
62  gsl::not_null<DataVector*> result, const ComplexDataVector& input,
63  size_t number_of_radial_points, size_t number_of_angular_points) noexcept;
64 } // namespace detail
65 
66 // @{
67 /*!
68  * \brief Computational structs for evaluating the hypersurface integrals during
69  * CCE evolution. These are compatible with use in `db::mutate_apply`.
70  *
71  * \details
72  * The integral evaluated and the corresponding inputs required depend on the
73  * CCE quantity being computed. In any of these, the only mutated tag is `Tag`,
74  * where the result of the integration is placed. The supported `Tag`s act in
75  * the following ways:
76  * - If the `Tag` is `Tags::BondiBeta` or `Tags::BondiU`, the integral to be
77  * evaluated is simply \f[ \partial_y f = A, \f] where \f$A\f$ is retrieved with
78  * `Tags::Integrand<Tag>`.
79  * - If the `Tag` is `Tags::BondiQ` or `Tags::BondiW`, the integral to be
80  * evaluated is \f[ (1 - y) \partial_y f + 2 f = A + (1 - y) B, \f] where
81  * \f$A\f$ is retrieved with `Tags::PoleOfIntegrand<Tag>` and \f$B\f$ is
82  * retrieved with `Tags::RegularIntegrand<Tag>`.
83  * - If `Tag` is `Tags::BondiH`, the integral to be evaluated is:
84  *
85  * \f[
86  * (1 - y) \partial_y f + L f + L^\prime \bar{f} = A + (1 - y) B,
87  * \f]
88  *
89  * for \f$f\f$, where \f$A\f$ is retrieved with `Tags::PoleOfIntegrand<Tag>`,
90  * \f$B\f$ is retrieved with `Tags::RegularIntegrand<Tag>`, \f$L\f$ is retrieved
91  * with `Tags::LinearFactor<Tag>`, and \f$L^\prime\f$ is retrieved with
92  * `Tags::LinearFactorForConjugate<Tag>`. The presence of \f$L\f$ and
93  * \f$L^\prime\f$ ensure that the only current method we have for evaluating the
94  * \f$H\f$ hypersurface equation is a direct linear solve, rather than the
95  * spectral matrix multiplications which are available for the other integrals.
96  *
97  * In each case, the boundary value at the world tube for the integration is
98  * retrieved from `Tags::BoundaryValue<Tag>`.
99  *
100  * Additional type aliases `boundary_tags` and `integrand_tags` are provided for
101  * template processing of the required input tags necessary for these functions.
102  * These type aliases are `tmpl::list`s with the subsets of `argument_tags` from
103  * specific other parts of the CCE computation. Because they play different
104  * roles, and have different extents, it is better for tag management to give
105  * separated lists for the dependencies.
106  */
107 template <typename Tag>
109  using boundary_tags = tmpl::list<Tags::BoundaryValue<Tag>>;
110  using integrand_tags = tmpl::list<Tags::Integrand<Tag>>;
111 
112  using return_tags = tmpl::list<Tag>;
113  using argument_tags =
114  tmpl::append<integrand_tags, boundary_tags,
115  tmpl::list<Spectral::Swsh::Tags::LMax,
117  static void apply(
120  integral_result,
122  db::item_type<Tag>::type::spin>>& integrand,
124  db::item_type<Tag>::type::spin>>& boundary,
125  size_t l_max, size_t number_of_radial_points) noexcept;
126 };
127 
128 template <>
129 struct RadialIntegrateBondi<Tags::BondiQ> {
130  using boundary_tags = tmpl::list<Tags::BoundaryValue<Tags::BondiQ>>;
131  using integrand_tags = tmpl::list<Tags::PoleOfIntegrand<Tags::BondiQ>,
133  using integration_independent_tags = tmpl::list<Tags::OneMinusY>;
134 
135  using return_tags = tmpl::list<Tags::BondiQ>;
136  using argument_tags =
137  tmpl::append<integrand_tags, boundary_tags, integration_independent_tags,
138  tmpl::list<Spectral::Swsh::Tags::LMax,
140  static void apply(
142  integral_result,
143  const Scalar<SpinWeighted<ComplexDataVector, 1>>& pole_of_integrand,
144  const Scalar<SpinWeighted<ComplexDataVector, 1>>& regular_integrand,
146  const Scalar<SpinWeighted<ComplexDataVector, 0>>& one_minus_y,
147  size_t l_max, size_t number_of_radial_points) noexcept;
148 };
149 
150 template <>
151 struct RadialIntegrateBondi<Tags::BondiW> {
152  using boundary_tags = tmpl::list<Tags::BoundaryValue<Tags::BondiW>>;
153  using integrand_tags = tmpl::list<Tags::PoleOfIntegrand<Tags::BondiW>,
155  using integration_independent_tags = tmpl::list<Tags::OneMinusY>;
156 
157  using return_tags = tmpl::list<Tags::BondiW>;
158  using argument_tags =
159  tmpl::append<integrand_tags, boundary_tags, integration_independent_tags,
160  tmpl::list<Spectral::Swsh::Tags::LMax,
162  static void apply(
164  integral_result,
165  const Scalar<SpinWeighted<ComplexDataVector, 0>>& pole_of_integrand,
166  const Scalar<SpinWeighted<ComplexDataVector, 0>>& regular_integrand,
168  const Scalar<SpinWeighted<ComplexDataVector, 0>>& one_minus_y,
169  size_t l_max, size_t number_of_radial_points) noexcept;
170 };
171 
172 template <>
173 struct RadialIntegrateBondi<Tags::BondiH> {
174  using boundary_tags = tmpl::list<Tags::BoundaryValue<Tags::BondiH>>;
175  using integrand_tags =
176  tmpl::list<Tags::PoleOfIntegrand<Tags::BondiH>,
180  using integration_independent_tags = tmpl::list<Tags::OneMinusY>;
181 
182  using return_tags = tmpl::list<Tags::BondiH>;
183  using argument_tags =
184  tmpl::append<integrand_tags, boundary_tags, integration_independent_tags,
185  tmpl::list<Spectral::Swsh::Tags::LMax,
187  static void apply(
189  integral_result,
190  const Scalar<SpinWeighted<ComplexDataVector, 2>>& pole_of_integrand,
191  const Scalar<SpinWeighted<ComplexDataVector, 2>>& regular_integrand,
192  const Scalar<SpinWeighted<ComplexDataVector, 0>>& linear_factor,
194  linear_factor_of_conjugate,
196  const Scalar<SpinWeighted<ComplexDataVector, 0>>& one_minus_y,
197  size_t l_max, size_t number_of_radial_points) noexcept;
198 };
199 // @}
200 } // namespace Cce
const Matrix & precomputed_cce_q_integrator(const size_t number_of_radial_grid_points) noexcept
Provides access to a lazily cached integration matrix for the and equations in CCE hypersurface eva...
Definition: LinearSolve.cpp:89
Contains functionality for Cauchy Characteristic Extraction.
Definition: Equations.cpp:25
A prefix tag representing the regular part of the right-hand side of a regular differential equation...
Definition: Tags.hpp:142
A prefix tag representing a linear factor that acts on Tag. To determine the spin weight...
Definition: Tags.hpp:155
Definition: Determinant.hpp:11
Tag for the number of radial grid points in the three-dimensional representation of radially concentr...
Definition: SwshTags.hpp:186
Make a spin-weighted type T with spin-weight Spin. Mathematical operators are restricted to addition...
Definition: SpinWeighted.hpp:25
Stores a collection of complex function values.
Definition: ComplexDataVector.hpp:47
A dynamically sized matrix of doubles with column-major storage.
Definition: Matrix.hpp:19
Definition: DataBoxTag.hpp:29
Defines a list of useful type aliases for tensors.
constexpr auto apply(F &&f, const DataBox< BoxTags > &box, Args &&... args) noexcept
Apply the invokable f with argument Tags TagsList from DataBox box
Definition: DataBox.hpp:1623
Tag for the maximum spin-weighted spherical harmonic l; sets angular resolution.
Definition: SwshTags.hpp:178
typename DataBox_detail::item_type_impl< TagList, Tag >::type item_type
Get the type that can be written to the Tag. If it is a base tag then a TagList must be passed as a s...
Definition: DataBoxTag.hpp:461
A prefix tag representing a linear factor that acts on Tag. To determine the spin weight...
Definition: Tags.hpp:168
Tensor< T, Symmetry<>, index_list<> > Scalar
Scalar type.
Definition: TypeAliases.hpp:21
Computational structs for evaluating the hypersurface integrals during CCE evolution. These are compatible with use in db::mutate_apply.
Definition: LinearSolve.hpp:108
Require a pointer to not be a nullptr
Definition: ConservativeFromPrimitive.hpp:12