IntegrandInputSteps.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cmath>
7 
9 #include "DataStructures/Tags.hpp"
10 #include "Evolution/Systems/Cce/Equations.hpp"
11 #include "Evolution/Systems/Cce/Tags.hpp"
12 #include "NumericalAlgorithms/Spectral/SwshTags.hpp"
13 #include "Utilities/TMPL.hpp"
14 
15 namespace Cce {
16 
17 /*!
18  * The set of Bondi quantities computed by hypersurface step, in the required
19  * order of computation
20  */
22  tmpl::list<Tags::BondiBeta, Tags::BondiQ, Tags::BondiU, Tags::BondiW,
24 
25 /*!
26  * Metafunction that is a `tmpl::list` of the temporary tags taken by the
27  * `ComputeBondiIntegrand` computational struct.
28  */
29 template <typename Tag>
32 
33 namespace detail {
34 // structs containing typelists for organizing the set of tags needed at each
35 // step of the CCE hypersurface evaluation steps. These are not directly the
36 // tags that are inputs in the `Equations.hpp`, as those would contain
37 // redundancy, and not necessarily obtain the derivatives during the most ideal
38 // steps. So, the ordering in these structs has been slightly 'designed' in ways
39 // that are not trivial to automate with tmpl list manipulation
40 template <typename Tag>
41 struct TagsToComputeForImpl;
42 
43 template <>
44 struct TagsToComputeForImpl<Tags::BondiBeta> {
45  using pre_swsh_derivative_tags =
46  tmpl::list<Tags::Dy<Tags::BondiJ>, Tags::Dy<Tags::Dy<Tags::BondiJ>>>;
47  using second_swsh_derivative_tags = tmpl::list<>;
48  using swsh_derivative_tags = tmpl::list<>;
49 };
50 
51 // Note: Due to the order in which Jacobians for the conversion between
52 // numerical and Bondi spin-weighted derivatives are evaluated, all of the
53 // higher (second) spin-weighted derivatives must be computed AFTER the
54 // eth(dy(bondi)) values (which act as inputs to the second derivative
55 // conversions to fixed Bondi radius), so must appear later in the
56 // `swsh_derivative_tags` typelists.
57 template <>
58 struct TagsToComputeForImpl<Tags::BondiQ> {
59  using pre_swsh_derivative_tags =
60  tmpl::list<Tags::Dy<Tags::BondiBeta>, Tags::Dy<Tags::Dy<Tags::BondiBeta>>,
63  using swsh_derivative_tags = tmpl::list<
64  Spectral::Swsh::Tags::Derivative<Tags::BondiBeta,
67  Spectral::Swsh::Tags::Eth>,
69  ::Tags::Multiplies<Tags::BondiJ, Tags::BondiJbar>,
70  Spectral::Swsh::Tags::Eth>,
72  ::Tags::Multiplies<Tags::BondiJbar, Tags::Dy<Tags::BondiJ>>,
73  Spectral::Swsh::Tags::Eth>,
77  Spectral::Swsh::Tags::Ethbar>>;
78  using second_swsh_derivative_tags = tmpl::list<>;
79 };
80 
81 template <>
82 struct TagsToComputeForImpl<Tags::BondiU> {
83  using pre_swsh_derivative_tags =
84  tmpl::list<Tags::Exp2Beta, Tags::Dy<Tags::BondiQ>,
86  using second_swsh_derivative_tags = tmpl::list<>;
87  using swsh_derivative_tags = tmpl::list<>;
88 };
89 
90 template <>
91 struct TagsToComputeForImpl<Tags::BondiW> {
92  using pre_swsh_derivative_tags =
93  tmpl::list<Tags::Dy<Tags::BondiU>, Tags::Dy<Tags::Dy<Tags::BondiU>>,
97  using swsh_derivative_tags = tmpl::list<
99  Spectral::Swsh::Tags::Ethbar>,
101  Tags::Dy<::Tags::Multiplies<Tags::BondiJ, Tags::BondiJbar>>,
102  Spectral::Swsh::Tags::Ethbar>,
104  Tags::Dy<::Tags::Multiplies<Tags::BondiJ, Tags::BondiJbar>>,
107  Spectral::Swsh::Tags::Ethbar>,
109  Spectral::Swsh::Tags::Ethbar>>;
110  // Currently, the `eth_ethbar_j` term is the single instance of a swsh
111  // derivative needing nested `Spectral::Swsh::Tags::Derivatives` steps to
112  // compute. The reason is that if we do not compute the derivative in two
113  // steps, there are intermediate terms in the Jacobian which depend on eth_j,
114  // which is a spin-weight 3 quantity and therefore cannot be computed with
115  // libsharp (the SWSH library being used). If `eth_ethbar_j` becomes not
116  // needed, the remaining `second_swsh_derivative_tags` can be merged to the
117  // end of `swsh_derivative_tags` and the corresponding computational steps
118  // from `SwshDerivatives.hpp` removed.
119  using second_swsh_derivative_tags =
120  tmpl::list<Spectral::Swsh::Tags::Derivative<Tags::BondiBeta,
123  Tags::BondiBeta, Spectral::Swsh::Tags::EthEthbar>,
126  Spectral::Swsh::Tags::EthEthbar>,
128  Tags::BondiJ, Spectral::Swsh::Tags::EthbarEthbar>,
131  Tags::BondiJ, Spectral::Swsh::Tags::Ethbar>,
132  Spectral::Swsh::Tags::Eth>>;
133 };
134 
135 template <>
136 struct TagsToComputeForImpl<Tags::BondiH> {
137  using pre_swsh_derivative_tags =
138  tmpl::list<::Tags::Multiplies<Tags::BondiJbar, Tags::BondiU>,
141  using swsh_derivative_tags = tmpl::list<
145  ::Tags::Multiplies<Tags::BondiUbar, Tags::Dy<Tags::BondiJ>>,
150  Spectral::Swsh::Tags::Derivative<Tags::JbarQMinus2EthBeta,
151  Spectral::Swsh::Tags::Ethbar>,
154  Spectral::Swsh::Tags::Ethbar>,
156  Spectral::Swsh::Tags::Ethbar>>;
157  using second_swsh_derivative_tags = tmpl::list<>;
158 };
159 } // namespace detail
160 
161 /*!
162  * \brief A typelist for the set of `BoundaryValue` tags needed as an input to
163  * any of the template specializations of `PrecomputeCceDependencies`.
164  *
165  * \details This is provided for easy and maintainable
166  * construction of a `Variables` or \ref DataBoxGroup with all of the quantities
167  * necessary for a CCE computation or portion thereof.
168  * A container of these tags should have size
169  * `Spectral::Swsh::number_of_swsh_collocation_points(l_max)`.
170  */
171 template <template <typename> class BoundaryPrefix>
173  tmpl::list<BoundaryPrefix<Tags::BondiR>,
174  BoundaryPrefix<Tags::DuRDividedByR>>;
175 
176 /*!
177  * \brief A typelist for the set of tags computed by the set of
178  * template specializations of `PrecomputeCceDepedencies`.
179  *
180  * \details This is provided for easy and maintainable construction of a
181  * `Variables` or \ref DataBoxGroup with all of the quantities needed for a CCE
182  * computation or component. The data structures represented by these tags
183  * should each have size `number_of_radial_points *
184  * Spectral::Swsh::number_of_swsh_collocation_points(l_max)`. All of these tags
185  * may be computed at once if using a \ref DataBoxGroup using the template
186  * `mutate_all_precompute_cce_dependencies` or individually using
187  * the template specializations `PrecomputeCceDependencies`.
188  *
189  * \note the tag `Tags::DuRDividedByR` is omitted from this list because in the
190  * case where a gauge transformation must be applied, the time derivative
191  * quantities must wait until later in the computation.
192  */
193 using pre_computation_tags =
197 
198 // @{
199 /*!
200  * \brief A typelist for the set of tags computed by the set of
201  * template specializations of `ComputePreSwshDerivatives`.
202  *
203  * \details This is provided for easy and maintainable construction of a
204  * `Variables` or \ref DataBoxGroup with all of the quantities needed for a CCE
205  * computation or component. The data structures represented by these tags
206  * should each have size `number_of_radial_points *
207  * Spectral::Swsh::number_of_swsh_collocation_points(l_max)`. All of these tags
208  * (for a given integrated Bondi quantity) may be computed at once if using a
209  * \ref DataBoxGroup using the template
210  * `mutate_all_pre_swsh_derivatives_for_tag` or individually using the template
211  * specializations of `ComputePreSwshDerivatives`. The full set of integrated
212  * Bondi quantities is available from the typelist
213  * `bondi_hypersurface_step_tags`.
214  */
215 template <typename Tag>
217  using type =
218  typename detail::TagsToComputeForImpl<Tag>::pre_swsh_derivative_tags;
219 };
220 
221 template <typename Tag>
222 using pre_swsh_derivative_tags_to_compute_for_t =
223  typename pre_swsh_derivative_tags_to_compute_for<Tag>::type;
224 // @}
225 
226 // @{
227 /*!
228  * \brief A typelist for the set of tags computed by single spin-weighted
229  * differentiation using utilities from the `Swsh` namespace.
230  */
231 template <typename Tag>
233  using type = typename detail::TagsToComputeForImpl<Tag>::swsh_derivative_tags;
234 };
235 
236 template <typename Tag>
237 using single_swsh_derivative_tags_to_compute_for_t =
238  typename single_swsh_derivative_tags_to_compute_for<Tag>::type;
239 // @}
240 
241 // @{
242 /*!
243  * \brief A typelist for the set of tags computed by multiple spin-weighted
244  * differentiation using utilities from the `Swsh` namespace.
245  */
246 template <typename Tag>
248  using type =
249  typename detail::TagsToComputeForImpl<Tag>::second_swsh_derivative_tags;
250 };
251 
252 template <typename Tag>
253 using second_swsh_derivative_tags_to_compute_for_t =
254  typename second_swsh_derivative_tags_to_compute_for<Tag>::type;
255 // @}
256 
257 /// Typelist of steps for `SwshDerivatives` mutations called on volume
258 /// quantities needed for scri+ computations
259 using all_swsh_derivative_tags_for_scri = tmpl::list<
263  Spectral::Swsh::Tags::Derivative<Tags::BondiBeta,
267  Spectral::Swsh::Tags::Ethbar>,
269  Spectral::Swsh::Tags::Ethbar>,
271  Spectral::Swsh::Tags::Ethbar>,
273  Spectral::Swsh::Tags::Eth>>;
274 
275 /// Typelist of steps for `PreSwshDerivatives` mutations called on boundary
276 /// (angular grid only) quantities needed for scri+ computations
278  tmpl::list<Tags::ComplexInertialRetardedTime>;
279 
280 /// Typelist of steps for `SwshDerivatives` mutations called on boundary
281 /// (angular grid only) quantities needed for scri+ computations
285 
286 /*!
287  * \brief A typelist for the set of tags computed by spin-weighted
288  * differentiation using utilities from the `Swsh` namespace.
289  *
290  * \details This is provided for easy and maintainable construction of a
291  * `Variables` or \ref DataBoxGroup with all of the quantities needed for a CCE
292  * computation or component. The data structures represented by these tags
293  * should each have size `number_of_radial_points *
294  * Spectral::Swsh::number_of_swsh_collocation_points(l_max)`. All of these tags
295  * (for a given integrated Bondi quantity) may be computed at once if using a
296  * \ref DataBoxGroup using the template `mutate_all_swsh_derivatives_for_tag`.
297  * Individual tag computation is not provided in a convenient interface, as
298  * there is significant savings in aggregating spin-weighted differentiation
299  * steps. The full set of integrated Bondi quantities is available from the
300  * typelist `bondi_hypersurface_step_tags`.
301  */
303  tmpl::remove_duplicates<tmpl::flatten<tmpl::list<
304  tmpl::transform<
306  tmpl::bind<tmpl::list,
310 
311 /*!
312  * \brief A typelist for the full set of coefficient buffers needed to process
313  * all of the tags in `all_swsh_derivative_tags` using batch processing provided
314  * in `mutate_all_swsh_derivatives_for_tag`.
315  *
316  * \details This is provided for easy and maintainable construction of a
317  * `Variables` or \ref DataBoxGroup with all of the quantities needed for a CCE
318  * computation or component. The data structures represented by these tags
319  * should each have size `number_of_radial_points *
320  * Spectral::Swsh::size_of_libsharp_coefficient_vector(l_max)`. Providing
321  * buffers associated with these tags is necessary for the use of the aggregated
322  * computation `mutate_all_swsh_derivatives_for_tag`.
323  */
325  tmpl::remove_duplicates<tmpl::flatten<tmpl::transform<
328  tmpl::_1>>>>;
329 
330 namespace detail {
331 template <typename Tag>
332 struct additional_pre_swsh_derivative_tags_for {
333  using type = tmpl::conditional_t<cpp17::is_same_v<Tag, Tags::BondiH>,
334  tmpl::list<Tags::Dy<Tag>>,
335  tmpl::list<Tag, Tags::Dy<Tag>>>;
336 };
337 } // namespace detail
338 
339 /// Typelist of steps for `PreSwshDerivatives` mutations needed for scri+
340 /// computations
342  tmpl::list<Tags::Du<Tags::BondiJ>, Tags::Dy<Tags::Du<Tags::BondiJ>>,
351  Tags::BondiBeta, Spectral::Swsh::Tags::EthEthbar>>>;
352 
353 /*!
354  * \brief A typelist for the full set of tags needed as direct or indirect
355  * input to any `ComputeBondiIntegrand` that are computed any specialization of
356  * `ComputePreSwshDerivatives`.
357  *
358  * \details This is provided for easy and maintainable construction of a
359  * `Variables` or \ref DataBoxGroup with all of the quantities needed for a CCE
360  * computation or component. The data structures represented by these tags
361  * should each have size `number_of_radial_points *
362  * Spectral::Swsh::number_of_swsh_collocation_points(l_max)`.
363  */
365  tmpl::remove_duplicates<tmpl::flatten<tmpl::list<
366  tmpl::transform<
368  tmpl::bind<
370  detail::additional_pre_swsh_derivative_tags_for<tmpl::_1>>>,
372 
373 
374 } // namespace Cce
tmpl::list< Tags::Du< Tags::BondiJ >, Tags::Dy< Tags::Du< Tags::BondiJ > >, Tags::Dy< Tags::Dy< Tags::Du< Tags::BondiJ > >>, Tags::Dy< Tags::Dy< Tags::BondiW > >, Tags::Dy< Tags::Dy< Tags::BondiQ > >, Tags::Dy< Tags::Dy< Tags::BondiU > >, Tags::Dy< Tags::Dy< Tags::Dy< Tags::BondiJ > >>, Tags::Dy< Tags::Dy< Tags::Dy< Tags::BondiU > >>, Tags::Dy< Tags::Dy< Tags::Dy< Tags::BondiBeta > >>, Tags::Dy< Spectral::Swsh::Tags::Derivative< Tags::BondiBeta, Spectral::Swsh::Tags::EthEthbar > >> all_pre_swsh_derivative_tags_for_scri
Typelist of steps for PreSwshDerivatives mutations needed for scri+ computations. ...
Definition: IntegrandInputSteps.hpp:351
Defines class Matrix.
A prefix tag representing the product of two other tags. Note that if non-spin-weighted types are nee...
Definition: Tags.hpp:86
tmpl::list< BoundaryPrefix< Tags::BondiR >, BoundaryPrefix< Tags::DuRDividedByR > > pre_computation_boundary_tags
A typelist for the set of BoundaryValue tags needed as an input to any of the template specialization...
Definition: IntegrandInputSteps.hpp:174
The set of utilities for performing Cauchy characteristic evolution and Cauchy characteristic matchin...
Definition: BoundaryComputeAndSendToEvolution.hpp:28
The value , where is Bondi radius of the worldtube.
Definition: Tags.hpp:312
Struct for labeling the spin-weighted derivative in tags.
Definition: SwshTags.hpp:49
tmpl::list< Tags::EthRDividedByR, Tags::EthEthRDividedByR, Tags::EthEthbarRDividedByR, Tags::BondiK, Tags::OneMinusY, Tags::BondiR > pre_computation_tags
A typelist for the set of tags computed by the set of template specializations of PrecomputeCceDepede...
Definition: IntegrandInputSteps.hpp:196
tmpl::list< Spectral::Swsh::Tags::Derivative< Tags::Dy< Tags::BondiU >, Spectral::Swsh::Tags::Eth >, Spectral::Swsh::Tags::Derivative< Spectral::Swsh::Tags::Derivative< Tags::BondiBeta, Spectral::Swsh::Tags::EthEthbar >, Spectral::Swsh::Tags::Ethbar >, Spectral::Swsh::Tags::Derivative< Tags::Dy< Tags::Du< Tags::BondiJ > >, Spectral::Swsh::Tags::Ethbar >, Spectral::Swsh::Tags::Derivative< Tags::Dy< Tags::Dy< Tags::BondiU > >, Spectral::Swsh::Tags::Ethbar >, Spectral::Swsh::Tags::Derivative< Tags::Dy< Tags::BondiQ >, Spectral::Swsh::Tags::Ethbar >, Spectral::Swsh::Tags::Derivative< Tags::Dy< Tags::Dy< Tags::BondiBeta > >, Spectral::Swsh::Tags::Eth > > all_swsh_derivative_tags_for_scri
Typelist of steps for SwshDerivatives mutations called on volume quantities needed for scri+ computat...
Definition: IntegrandInputSteps.hpp:273
The value .
Definition: Tags.hpp:324
Bondi parameter .
Definition: Tags.hpp:34
tmpl::list< Spectral::Swsh::Tags::SwshTransform< typename DerivativeTag::derivative_of >, Spectral::Swsh::Tags::SwshTransform< DerivativeTag > > coefficient_buffer_tags_for_derivative_tag
A metafunction for determining the coefficient buffers needed by angular_derivatives() to avoid repea...
Definition: SwshTags.hpp:259
The Bondi radius is of the worldtube.
Definition: Tags.hpp:329
Prefix tag representing the spin-weighted derivative of a spin-weighted scalar.
Definition: SwshTags.hpp:152
Computes one of the inputs for the integration of one of the Characteristic hypersurface equations...
Definition: Equations.hpp:123
Complex storage form for the asymptotically inertial retarded time, for taking spin-weighted derivati...
Definition: Tags.hpp:183
Coordinate value , which will be cached and sent to the implementing functions.
Definition: Tags.hpp:277
Prefix indicating a time derivative.
Definition: Prefixes.hpp:32
typename ComputeBondiIntegrand< Tag >::temporary_tags integrand_temporary_tags
Definition: IntegrandInputSteps.hpp:31
Definition: Determinant.hpp:11
A typelist for the set of tags computed by single spin-weighted differentiation using utilities from ...
Definition: IntegrandInputSteps.hpp:232
A typelist for the set of tags computed by multiple spin-weighted differentiation using utilities fro...
Definition: IntegrandInputSteps.hpp:247
The value , where is Bondi radius of the worldtube.
Definition: Tags.hpp:296
The value , where is Bondi radius of the worldtube.
Definition: Tags.hpp:304
tmpl::remove_duplicates< tmpl::flatten< tmpl::transform< all_swsh_derivative_tags, tmpl::bind< Spectral::Swsh::coefficient_buffer_tags_for_derivative_tag, tmpl::_1 > >> > all_transform_buffer_tags
A typelist for the full set of coefficient buffers needed to process all of the tags in all_swsh_deri...
Definition: IntegrandInputSteps.hpp:328
The derivative with respect to the numerical coordinate , where is Bondi radius of the worldtube...
Definition: Tags.hpp:115
tmpl::list< Tags::ComplexInertialRetardedTime > all_boundary_pre_swsh_derivative_tags_for_scri
Typelist of steps for PreSwshDerivatives mutations called on boundary (angular grid only) quantities ...
Definition: IntegrandInputSteps.hpp:278
tmpl::list< Tags::BondiBeta, Tags::BondiQ, Tags::BondiU, Tags::BondiW, Tags::BondiH > bondi_hypersurface_step_tags
Definition: IntegrandInputSteps.hpp:23
Struct for labeling the spin-weighted derivative in tags.
Definition: SwshTags.hpp:30
Wraps the template metaprogramming library used (brigand)
Struct for labeling the spin-weighted derivative in tags.
Definition: SwshTags.hpp:37
tmpl::list< Spectral::Swsh::Tags::Derivative< Tags::ComplexInertialRetardedTime, Spectral::Swsh::Tags::EthEth > > all_boundary_swsh_derivative_tags_for_scri
Typelist of steps for SwshDerivatives mutations called on boundary (angular grid only) quantities nee...
Definition: IntegrandInputSteps.hpp:284
tmpl::remove_duplicates< tmpl::flatten< tmpl::list< tmpl::transform< bondi_hypersurface_step_tags, tmpl::bind< tmpl::list, single_swsh_derivative_tags_to_compute_for< tmpl::_1 >, second_swsh_derivative_tags_to_compute_for< tmpl::_1 > >>, all_swsh_derivative_tags_for_scri > >> all_swsh_derivative_tags
A typelist for the set of tags computed by spin-weighted differentiation using utilities from the Sws...
Definition: IntegrandInputSteps.hpp:309
Struct for labeling the spin-weighted derivative in tags.
Definition: SwshTags.hpp:45
Struct for labeling the spin-weighted derivative in tags.
Definition: SwshTags.hpp:34
A typelist for the set of tags computed by the set of template specializations of ComputePreSwshDeriv...
Definition: IntegrandInputSteps.hpp:216
tmpl::remove_duplicates< tmpl::flatten< tmpl::list< tmpl::transform< bondi_hypersurface_step_tags, tmpl::bind< tmpl::list, pre_swsh_derivative_tags_to_compute_for< tmpl::_1 >, detail::additional_pre_swsh_derivative_tags_for< tmpl::_1 > >>, all_pre_swsh_derivative_tags_for_scri > >> all_pre_swsh_derivative_tags
A typelist for the full set of tags needed as direct or indirect input to any ComputeBondiIntegrand t...
Definition: IntegrandInputSteps.hpp:371
Bondi parameter .
Definition: Tags.hpp:71