InitializeFirstHypersurface.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/Initialize/InitializeJ.hpp"
12 #include "Evolution/Systems/Cce/OptionTags.hpp"
13 #include "Evolution/Systems/Cce/ScriPlusValues.hpp"
14 #include "Parallel/GlobalCache.hpp"
15 #include "Utilities/Gsl.hpp"
16 #include "Utilities/TMPL.hpp"
17 
18 namespace Cce {
19 namespace Actions {
20 
21 /*!
22  * \ingroup ActionsGroup
23  * \brief Given initial boundary data for \f$J\f$ and \f$\partial_r J\f$,
24  * computes the initial hypersurface quantities \f$J\f$ and gauge values.
25  *
26  * \details This action is to be called after boundary data has been received,
27  * but before the time-stepping evolution loop. So, it should be either late in
28  * an initialization phase or early (before a `Actions::Goto` loop or similar)
29  * in the `Evolve` phase.
30  *
31  * Internally, this dispatches to the call function of
32  * `Tags::InitializeJ`, which designates a hypersurface initial data generator
33  * chosen by input file options, `InitializeGauge`, and
34  * `InitializeScriPlusValue<Tags::InertialRetardedTime>` to perform the
35  * computations. Refer to the documentation for those mutators for mathematical
36  * details.
37  *
38  * \note This action accesses the base tag `Cce::Tags::InitializeJBase`,
39  * trusting that a tag that inherits from that base tag is present in the box or
40  * the global cache. Typically, this tag should be added by the worldtube
41  * boundary component, as the type of initial data is decided by the type of the
42  * worldtube boundary data.
43  */
45  using const_global_cache_tags =
46  tmpl::list<Tags::LMax, Tags::NumberOfRadialPoints>;
47 
48  template <typename DbTags, typename... InboxTags, typename Metavariables,
49  typename ArrayIndex, typename ActionList,
50  typename ParallelComponent>
51  static std::tuple<db::DataBox<DbTags>&&> apply(
52  db::DataBox<DbTags>& box,
53  const tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
54  const Parallel::GlobalCache<Metavariables>& /*cache*/,
55  const ArrayIndex& /*array_index*/, const ActionList /*meta*/,
56  const ParallelComponent* const /*meta*/) noexcept {
57  // In some contexts, this action may get re-run (e.g. self-start procedure)
58  // In those cases, we do not want to alter the existing hypersurface data,
59  // so we just exit. However, we do want to re-run the action each time
60  // the self start 'reset's from the beginning
61  if (db::get<::Tags::TimeStepId>(box).slab_number() > 0 or
62  db::get<::Tags::TimeStepId>(box).substep_time().fraction() != 0) {
63  return {std::move(box)};
64  }
65  db::mutate_apply<InitializeJ::InitializeJ::mutate_tags,
66  InitializeJ::InitializeJ::argument_tags>(
67  db::get<Tags::InitializeJBase>(box), make_not_null(&box));
68  db::mutate_apply<InitializeScriPlusValue<Tags::InertialRetardedTime>>(
69  make_not_null(&box),
70  db::get<::Tags::TimeStepId>(box).substep_time().value());
71  return {std::move(box)};
72  }
73 };
74 } // namespace Actions
75 } // namespace Cce
utility
Parallel::GlobalCache
Definition: ElementReceiveInterpPoints.hpp:15
GlobalCache.hpp
tuple
DataBox.hpp
Cce::Actions::InitializeFirstHypersurface
Given initial boundary data for and , computes the initial hypersurface quantities and gauge values...
Definition: InitializeFirstHypersurface.hpp:44
cstddef
tuples::TaggedTuple
An associative container that is indexed by structs.
Definition: TaggedTuple.hpp:271
Cce
The set of utilities for performing Cauchy characteristic evolution and Cauchy characteristic matchin...
Definition: CharacteristicExtractFwd.hpp:6
Gsl.hpp
db::mutate_apply
constexpr decltype(auto) mutate_apply(F &&f, const gsl::not_null< DataBox< BoxTags > * > box, Args &&... args) noexcept
Apply the invokable f mutating items MutateTags and taking as additional arguments ArgumentTags and a...
Definition: DataBox.hpp:1257
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
TMPL.hpp