UpdateU.hpp
Go to the documentation of this file.
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 /// \file
5 /// Defines action UpdateU
6 
7 #pragma once
8 
9 #include <tuple>
10 #include <utility> // IWYU pragma: keep // for std::move
11 
16 #include "Time/Tags.hpp"
17 // IWYU pragma: no_include "Time/Time.hpp" // for TimeDelta
18 #include "Utilities/Gsl.hpp"
19 #include "Utilities/TMPL.hpp"
21 
22 /// \cond
23 // IWYU pragma: no_forward_declare TimeDelta
24 // IWYU pragma: no_forward_declare db::DataBox
25 /// \endcond
26 
27 namespace Actions {
28 /// \ingroup ActionsGroup
29 /// \ingroup TimeGroup
30 /// \brief Perform variable updates for one substep
31 ///
32 /// With `dt_variables_tag = db::add_tag_prefix<Tags::dt, variables_tag>`:
33 ///
34 /// Uses:
35 /// - ConstGlobalCache: OptionTags::TimeStepper
36 /// - DataBox:
37 /// - variables_tag
38 /// - Tags::HistoryEvolvedVariables<variables_tag, dt_variables_tag>
39 /// - Tags::TimeStep
40 ///
41 /// DataBox changes:
42 /// - Adds: nothing
43 /// - Removes: nothing
44 /// - Modifies:
45 /// - variables_tag
46 /// - Tags::HistoryEvolvedVariables<variables_tag, dt_variables_tag>
47 struct UpdateU {
48  template <typename DbTags, typename... InboxTags, typename Metavariables,
49  typename ArrayIndex, typename ActionList,
50  typename ParallelComponent>
51  static std::tuple<db::DataBox<DbTags>&&> apply(
54  const ArrayIndex& /*array_index*/, const ActionList /*meta*/,
55  const ParallelComponent* const /*meta*/) noexcept {
56  using variables_tag = typename Metavariables::system::variables_tag;
57  using dt_variables_tag = db::add_tag_prefix<Tags::dt, variables_tag>;
58  using history_tag =
60 
61  db::mutate<variables_tag, history_tag>(
62  make_not_null(&box),
63  [&cache](const gsl::not_null<db::item_type<variables_tag>*> vars,
65  const db::item_type<Tags::TimeStep>& time_step) noexcept {
66  const auto& time_stepper =
67  Parallel::get<OptionTags::TimeStepper>(cache);
68  time_stepper.update_u(vars, history, time_step);
69  },
70  db::get<Tags::TimeStep>(box));
71 
72  return std::forward_as_tuple(std::move(box));
73  }
74 };
75 } // namespace Actions
Prefix< DataBox_detail::dispatch_add_tag_prefix_impl< Prefix, Tag, Args... >, Args... > add_tag_prefix
Wrap Tag in Prefix<_, Args...>, also wrapping variables tags if Tag is a Tags::Variables.
Definition: DataBoxTag.hpp:533
Defines class tuples::TaggedTuple.
Perform variable updates for one substep.
Definition: UpdateU.hpp:47
Define prefixes for DataBox tags.
Prefix for TimeStepper history.
Definition: Tags.hpp:75
An associative container that is indexed by structs.
Definition: TaggedTuple.hpp:272
Defines classes and functions used for manipulating DataBox&#39;s.
Definition: InterpolationTargetWedgeSectionTorus.hpp:24
A Charm++ chare that caches constant data once per Charm++ node.
Definition: ConstGlobalCache.hpp:76
Wraps the template metaprogramming library used (brigand)
typename DataBox_detail::item_type_impl< TagList, Tag >::type item_type
Get the type that is returned by the Tag. If it is a base tag then a TagList must be passed as a seco...
Definition: DataBoxTag.hpp:410
Defines functions and classes from the GSL.
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, but it may be necessary to perform the conversion explicitly when type deduction is desired.
Definition: Gsl.hpp:863
Definition: SolvePoissonProblem.hpp:38
Defines classes SimpleTag, PrefixTag, ComputeTag and several functions for retrieving tag info...
Defines class template ConstGlobalCache.
Defines tags related to Time quantities.
Definition: ComputeTimeDerivative.hpp:28
Require a pointer to not be a nullptr
Definition: ConservativeFromPrimitive.hpp:12