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>>,
95  using swsh_derivative_tags = tmpl::list<
99  Tags::Dy<::Tags::Multiplies<Tags::BondiJ, Tags::BondiJbar>>,
100  Spectral::Swsh::Tags::Ethbar>,
102  Tags::Dy<::Tags::Multiplies<Tags::BondiJ, Tags::BondiJbar>>,
105  Spectral::Swsh::Tags::Ethbar>,
107  Spectral::Swsh::Tags::Ethbar>>;
108  // Currently, the `eth_ethbar_j` term is the single instance of a swsh
109  // derivative needing nested `Spectral::Swsh::Tags::Derivatives` steps to
110  // compute. The reason is that if we do not compute the derivative in two
111  // steps, there are intermediate terms in the Jacobian which depend on eth_j,
112  // which is a spin-weight 3 quantity and therefore cannot be computed with
113  // libsharp (the SWSH library being used). If `eth_ethbar_j` becomes not
114  // needed, the remaining `second_swsh_derivative_tags` can be merged to the
115  // end of `swsh_derivative_tags` and the corresponding computational steps
116  // from `SwshDerivatives.hpp` removed.
117  using second_swsh_derivative_tags =
118  tmpl::list<Spectral::Swsh::Tags::Derivative<Tags::BondiBeta,
121  Tags::BondiBeta, Spectral::Swsh::Tags::EthEthbar>,
124  Spectral::Swsh::Tags::EthEthbar>,
125 
130  Tags::BondiJ, Spectral::Swsh::Tags::Ethbar>,
131  Spectral::Swsh::Tags::Eth>>;
132 };
133 
134 template <>
135 struct TagsToComputeForImpl<Tags::BondiH> {
136  using pre_swsh_derivative_tags =
137  tmpl::list<::Tags::Multiplies<Tags::BondiJbar, Tags::BondiU>,
140  using swsh_derivative_tags = tmpl::list<
144  ::Tags::Multiplies<Tags::BondiUbar, Tags::Dy<Tags::BondiJ>>,
149  Spectral::Swsh::Tags::Derivative<Tags::JbarQMinus2EthBeta,
150  Spectral::Swsh::Tags::Ethbar>,
153  Spectral::Swsh::Tags::Ethbar>,
155  Spectral::Swsh::Tags::Ethbar>>;
156  using second_swsh_derivative_tags = tmpl::list<>;
157 };
158 } // namespace detail
159 
160 /*!
161  * \brief A typelist for the set of `BoundaryValue` tags needed as an input to
162  * any of the template specializations of `PrecomputeCceDependencies`.
163  *
164  * \details This is provided for easy and maintainable
165  * construction of a `Variables` or \ref DataBoxGroup with all of the quantities
166  * necessary for a CCE computation or portion thereof.
167  * A container of these tags should have size
168  * `Spectral::Swsh::number_of_swsh_collocation_points(l_max)`.
169  */
170 template <template <typename> class BoundaryPrefix>
172  tmpl::list<BoundaryPrefix<Tags::BondiR>,
173  BoundaryPrefix<Tags::DuRDividedByR>>;
174 
175 /*!
176  * \brief A typelist for the set of tags computed by the set of
177  * template specializations of `PrecomputeCceDepedencies`.
178  *
179  * \details This is provided for easy and maintainable construction of a
180  * `Variables` or \ref DataBoxGroup with all of the quantities needed for a CCE
181  * computation or component. The data structures represented by these tags
182  * should each have size `number_of_radial_points *
183  * Spectral::Swsh::number_of_swsh_collocation_points(l_max)`. All of these tags
184  * may be computed at once if using a \ref DataBoxGroup using the template
185  * `mutate_all_precompute_cce_dependencies` or individually using
186  * the template specializations `PrecomputeCceDependencies`.
187  */
188 using pre_computation_tags =
192 
193 // @{
194 /*!
195  * \brief A typelist for the set of tags computed by the set of
196  * template specializations of `ComputePreSwshDerivatives`.
197  *
198  * \details This is provided for easy and maintainable construction of a
199  * `Variables` or \ref DataBoxGroup with all of the quantities needed for a CCE
200  * computation or component. The data structures represented by these tags
201  * should each have size `number_of_radial_points *
202  * Spectral::Swsh::number_of_swsh_collocation_points(l_max)`. All of these tags
203  * (for a given integrated Bondi quantity) may be computed at once if using a
204  * \ref DataBoxGroup using the template
205  * `mutate_all_pre_swsh_derivatives_for_tag` or individually using the template
206  * specializations of `ComputePreSwshDerivatives`. The full set of integrated
207  * Bondi quantities is available from the typelist
208  * `bondi_hypersurface_step_tags`.
209  */
210 template <typename Tag>
212  using type =
213  typename detail::TagsToComputeForImpl<Tag>::pre_swsh_derivative_tags;
214 };
215 
216 template <typename Tag>
217 using pre_swsh_derivative_tags_to_compute_for_t =
218  typename pre_swsh_derivative_tags_to_compute_for<Tag>::type;
219 // @}
220 
221 // @{
222 /*!
223  * \brief A typelist for the set of tags computed by single spin-weighted
224  * differentiation using utilities from the `Swsh` namespace.
225  */
226 template <typename Tag>
228  using type = typename detail::TagsToComputeForImpl<Tag>::swsh_derivative_tags;
229 };
230 
231 template <typename Tag>
232 using single_swsh_derivative_tags_to_compute_for_t =
233  typename single_swsh_derivative_tags_to_compute_for<Tag>::type;
234 // @}
235 
236 // @{
237 /*!
238  * \brief A typelist for the set of tags computed by multiple spin-weighted
239  * differentiation using utilities from the `Swsh` namespace.
240  */
241 template <typename Tag>
243  using type =
244  typename detail::TagsToComputeForImpl<Tag>::second_swsh_derivative_tags;
245 };
246 
247 template <typename Tag>
248 using second_swsh_derivative_tags_to_compute_for_t =
249  typename single_swsh_derivative_tags_to_compute_for<Tag>::type;
250 // @}
251 
252 /*!
253  * \brief A typelist for the set of tags computed by spin-weighted
254  * differentiation using utilities from the `Swsh` namespace.
255  *
256  * \details This is provided for easy and maintainable construction of a
257  * `Variables` or \ref DataBoxGroup with all of the quantities needed for a CCE
258  * computation or component. The data structures represented by these tags
259  * should each have size `number_of_radial_points *
260  * Spectral::Swsh::number_of_swsh_collocation_points(l_max)`. All of these tags
261  * (for a given integrated Bondi quantity) may be computed at once if using a
262  * \ref DataBoxGroup using the template `mutate_all_swsh_derivatives_for_tag`.
263  * Individual tag computation is not provided in a convenient interface, as
264  * there is significant savings in aggregating spin-weighted differentiation
265  * steps. The full set of integrated Bondi quantities is available from the
266  * typelist `bondi_hypersurface_step_tags`.
267  */
269  tmpl::remove_duplicates<tmpl::flatten<tmpl::transform<
271  tmpl::bind<tmpl::list,
274 
275 /*!
276  * \brief A typelist for the full set of coefficient buffers needed to process
277  * all of the tags in `all_swsh_derivative_tags` using batch processing provided
278  * in `mutate_all_swsh_derivatives_for_tag`.
279  *
280  * \details This is provided for easy and maintainable construction of a
281  * `Variables` or \ref DataBoxGroup with all of the quantities needed for a CCE
282  * computation or component. The data structures represented by these tags
283  * should each have size `number_of_radial_points *
284  * Spectral::Swsh::size_of_libsharp_coefficient_vector(l_max)`. Providing
285  * buffers associated with these tags is necessary for the use of the aggregated
286  * computation `mutate_all_swsh_derivatives_for_tag`.
287  */
289  tmpl::remove_duplicates<tmpl::flatten<tmpl::transform<
292  tmpl::_1>>>>;
293 
294 /*!
295  * \brief A typelist for the full set of tags needed as direct or indirect
296  * input to any `ComputeBondiIntegrand` that are computed any specialization of
297  * `ComputePreSwshDerivatives`.
298  *
299  * \details This is provided for easy and maintainable construction of a
300  * `Variables` or \ref DataBoxGroup with all of the quantities needed for a CCE
301  * computation or component. The data structures represented by these tags
302  * should each have size `number_of_radial_points *
303  * Spectral::Swsh::number_of_swsh_collocation_points(l_max)`.
304  */
306  tmpl::remove_duplicates<tmpl::flatten<tmpl::transform<
308  tmpl::bind<tmpl::list,
310  tmpl::bind<Tags::Dy, tmpl::_1>>>>>;
311 } // namespace Cce
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:85
tmpl::list< Tags::DuRDividedByR, 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:191
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:173
Contains functionality for Cauchy Characteristic Extraction.
Definition: BoundaryData.cpp:21
The value , where is Bondi radius of the worldtube.
Definition: Tags.hpp:280
Struct for labeling the spin-weighted derivative in tags.
Definition: SwshTags.hpp:48
The value .
Definition: Tags.hpp:294
Bondi parameter .
Definition: Tags.hpp:38
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:238
The Bondi radius is of the worldtube.
Definition: Tags.hpp:300
Prefix tag representing the spin-weighted derivative of a spin-weighted scalar.
Definition: SwshTags.hpp:139
Computes one of the inputs for the integration of one of the Characteristic hypersurface equations...
Definition: Equations.hpp:124
tmpl::remove_duplicates< tmpl::flatten< 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
A typelist for the set of tags computed by spin-weighted differentiation using utilities from the Sws...
Definition: IntegrandInputSteps.hpp:273
Coordinate value , which will be cached and sent to the implementing functions.
Definition: Tags.hpp:240
typename ComputeBondiIntegrand< Tag >::temporary_tags integrand_temporary_tags
Definition: IntegrandInputSteps.hpp:31
The value , where is Bondi radius of the worldtube.
Definition: Tags.hpp:255
tmpl::remove_duplicates< tmpl::flatten< tmpl::transform< bondi_hypersurface_step_tags, tmpl::bind< tmpl::list, pre_swsh_derivative_tags_to_compute_for< tmpl::_1 >, tmpl::_1, tmpl::bind< Tags::Dy, tmpl::_1 > >> >> 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:310
Definition: Determinant.hpp:11
A typelist for the set of tags computed by single spin-weighted differentiation using utilities from ...
Definition: IntegrandInputSteps.hpp:227
A typelist for the set of tags computed by multiple spin-weighted differentiation using utilities fro...
Definition: IntegrandInputSteps.hpp:242
The value , where is Bondi radius of the worldtube.
Definition: Tags.hpp:262
The value , where is Bondi radius of the worldtube.
Definition: Tags.hpp:271
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:292
The derivative with respect to the numerical coordinate , where is Bondi radius of the worldtube...
Definition: Tags.hpp:94
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:29
Wraps the template metaprogramming library used (brigand)
Bondi parameter .
Definition: Tags.hpp:32
Struct for labeling the spin-weighted derivative in tags.
Definition: SwshTags.hpp:36
Struct for labeling the spin-weighted derivative in tags.
Definition: SwshTags.hpp:44
Struct for labeling the spin-weighted derivative in tags.
Definition: SwshTags.hpp:33
A typelist for the set of tags computed by the set of template specializations of ComputePreSwshDeriv...
Definition: IntegrandInputSteps.hpp:211
Bondi parameter .
Definition: Tags.hpp:50