CalculateScriInputs.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cstddef>
7 #include <tuple>
8 #include <utility>
9 
11 #include "Evolution/Systems/Cce/IntegrandInputSteps.hpp"
12 #include "Evolution/Systems/Cce/OptionTags.hpp"
13 #include "Evolution/Systems/Cce/PreSwshDerivatives.hpp"
14 #include "Evolution/Systems/Cce/SwshDerivatives.hpp"
15 #include "NumericalAlgorithms/Spectral/SwshDerivatives.hpp"
16 #include "Parallel/GlobalCache.hpp"
17 #include "Utilities/Gsl.hpp"
18 #include "Utilities/TMPL.hpp"
19 
20 namespace Cce {
21 namespace Actions {
22 
23 /*!
24  * \ingroup ActionsGroup
25  * \brief Calculates the Bondi quantities that are required for any of the
26  * `CalculateScriPlusValue` mutators.
27  *
28  * \details Internally dispatches to the `PreSwshDerivatives` and
29  * `Spectral::Swsh::AngularDerivatives` utilities to perform the radial and
30  * angular differentiation that is required to prepare all of the Bondi
31  * quantities needed for evaluating the scri+ values. This relies on the
32  * typelists `Cce::all_pre_swsh_derivative_tags_for_scri`,
33  * `Cce::all_boundary_pre_swsh_derivative_tags_for_scri`,
34  * `Cce::all_swsh_derivative_tags_for_scri`, and
35  * `Cce::all_boundary_swsh_derivative_tags_for_scri` to determine which
36  * calculations to perform.
37  */
39  using const_global_cache_tags =
40  tmpl::list<Tags::LMax, Tags::NumberOfRadialPoints>;
41 
42  template <typename DbTags, typename... InboxTags, typename Metavariables,
43  typename ArrayIndex, typename ActionList,
44  typename ParallelComponent>
45  static std::tuple<db::DataBox<DbTags>&&> apply(
47  const tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
48  const Parallel::GlobalCache<Metavariables>& /*cache*/,
49  const ArrayIndex& /*array_index*/, const ActionList /*meta*/,
50  const ParallelComponent* const /*meta*/) noexcept {
51  tmpl::for_each<
54  auto pre_swsh_derivative_tag_v) noexcept {
55  using pre_swsh_derivative_tag =
56  typename decltype(pre_swsh_derivative_tag_v)::type;
57  db::mutate_apply<PreSwshDerivatives<pre_swsh_derivative_tag>>(
58  make_not_null(&box));
59  });
60 
63  make_not_null(&box));
64  boundary_derivative_impl(box, db::get<Tags::LMax>(box),
66 
67  tmpl::for_each<all_swsh_derivative_tags_for_scri>([&box](
68  auto derivative_tag_v) noexcept {
69  using derivative_tag = typename decltype(derivative_tag_v)::type;
70  ::Cce::detail::apply_swsh_jacobian_helper<derivative_tag>(
72  derivative_tag>::on_demand_argument_tags{});
73  });
74  return {std::move(box)};
75  }
76 
77  template <typename DbTags, typename... TagPack>
78  static void boundary_derivative_impl(
79  db::DataBox<DbTags>& box, const size_t l_max,
80  tmpl::list<TagPack...> /*meta*/) noexcept {
81  db::mutate<TagPack...>(
82  make_not_null(&box),
83  [&l_max](const gsl::not_null<typename TagPack::type*>... derivatives,
84  const typename TagPack::derivative_of::
85  type&... arguments) noexcept {
87  tmpl::list<typename TagPack::derivative_kind...>>(
88  l_max, 1, make_not_null(&get(*derivatives))...,
89  get(arguments)...);
90  },
91  db::get<typename TagPack::derivative_of>(box)...);
92  }
93 };
94 } // namespace Actions
95 } // namespace Cce
Spectral::Swsh::AngularDerivatives
detail::AngularDerivativesImpl< DerivativeTagList, typename detail::unique_derived_from_list< DerivativeTagList >::type, Representation > AngularDerivatives
A DataBox mutate-compatible computational struct for computing a set of spin-weighted spherical harmo...
Definition: SwshDerivatives.hpp:327
utility
get
constexpr Tag::type & get(Variables< TagList > &v) noexcept
Return Tag::type pointing into the contiguous array.
Definition: Variables.hpp:639
Parallel::GlobalCache
Definition: ElementReceiveInterpPoints.hpp:16
GlobalCache.hpp
Cce::ApplySwshJacobianInplace
Performs a mutation to a spin-weighted spherical harmonic derivative value from the numerical coordin...
Definition: SwshDerivatives.hpp:248
tuple
db::mutate
void mutate(const gsl::not_null< DataBox< TagList > * > box, Invokable &&invokable, Args &&... args) noexcept
Allows changing the state of one or more non-computed elements in the DataBox.
Definition: DataBox.hpp:1003
Cce::all_boundary_swsh_derivative_tags_for_scri
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
Cce::Actions::CalculateScriInputs
Calculates the Bondi quantities that are required for any of the CalculateScriPlusValue mutators.
Definition: CalculateScriInputs.hpp:38
DataBox.hpp
db::mutate_apply
constexpr auto mutate_apply(F &&f, const gsl::not_null< DataBox< BoxTags > * > box, Args &&... args) noexcept(DataBox_detail::check_mutate_apply_mutate_tags(BoxTags{}, MutateTags{}) and DataBox_detail::check_mutate_apply_argument_tags(BoxTags{}, ArgumentTags{}) and noexcept(DataBox_detail::mutate_apply(f, box, MutateTags{}, ArgumentTags{}, std::forward< Args >(args)...)))
Apply the invokable f mutating items MutateTags and taking as additional arguments ArgumentTags and a...
Definition: DataBox.hpp:1640
cstddef
tuples::TaggedTuple
An associative container that is indexed by structs.
Definition: TaggedTuple.hpp:271
Cce::all_pre_swsh_derivative_tags_for_scri
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
Cce::all_boundary_pre_swsh_derivative_tags_for_scri
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
Cce
The set of utilities for performing Cauchy characteristic evolution and Cauchy characteristic matchin...
Definition: BoundaryComputeAndSendToEvolution.hpp:28
Gsl.hpp
Spectral::Swsh::angular_derivatives
void angular_derivatives(const size_t l_max, const size_t number_of_radial_points, const ArgumentTypes &... arguments) noexcept
Evaluate all of the spin-weighted derivatives in DerivKindList on input SpinWeighted<ComplexDataVecto...
Definition: SwshDerivatives.hpp:457
make_not_null
gsl::not_null< T * > make_not_null(T *ptr) noexcept
Construct a not_null from a pointer. Often this will be done as an implicit conversion,...
Definition: Gsl.hpp:880
db::DataBox
Definition: InterpolationTargetWedgeSectionTorus.hpp:24
TMPL.hpp
gsl::not_null
Require a pointer to not be a nullptr
Definition: Gsl.hpp:183