Tags.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 tags related to Time quantities
6 
7 #pragma once
8 
9 #include <cstddef>
10 #include <memory>
11 #include <string>
12 #include <vector>
13 
16 #include "Options/Options.hpp"
17 #include "Time/BoundaryHistory.hpp"
18 #include "Time/History.hpp"
19 #include "Time/StepChoosers/StepChooser.hpp" // IWYU pragma: keep
20 #include "Time/StepControllers/StepController.hpp" // IWYU pragma: keep
21 #include "Time/Time.hpp"
22 #include "Time/TimeId.hpp"
23 #include "Utilities/TMPL.hpp"
24 
25 /// \cond
26 // NOLINTNEXTLINE(misc-forward-declaration-namespace)
27 class TimeStepper;
28 /// \endcond
29 
30 namespace Tags {
31 
32 /// \ingroup DataBoxTagsGroup
33 /// \ingroup TimeGroup
34 /// \brief Tag for ::TimeId for the algorithm state
36  static std::string name() noexcept { return "TimeId"; }
37  using type = ::TimeId;
38  template <typename Tag>
39  using step_prefix = typename Tags::dt<Tag>;
40 };
41 
42 /// \ingroup DataBoxTagsGroup
43 /// \ingroup TimeGroup
44 /// \brief Tag for step size
46  static std::string name() noexcept { return "TimeStep"; }
47  using type = ::TimeDelta;
48 };
49 
50 /// \ingroup DataBoxTagsGroup
51 /// \ingroup TimeGroup
52 /// \brief Tag for compute item for current ::Time (from TimeId)
53 struct Time : db::ComputeTag {
54  static std::string name() noexcept { return "Time"; }
55  static auto function(const ::TimeId& id) noexcept { return id.time(); }
56  using argument_tags = tmpl::list<TimeId>;
57 };
58 
59 /// \ingroup DataBoxTagsGroup
60 /// \ingroup TimeGroup
61 /// \brief Tag for compute item for current time as a double
63  static std::string name() noexcept { return "TimeValue"; }
64  static auto function(const ::Time& t) noexcept { return t.value(); }
65  using argument_tags = tmpl::list<Time>;
66 };
67 
68 /// \ingroup DataBoxTags
69 /// \ingroup TimeGroup
70 /// \brief Prefix for TimeStepper history
71 ///
72 /// \tparam Tag tag for the variables
73 /// \tparam DtTag tag for the time derivative of the variables
74 template <typename Tag, typename DtTag>
76  static std::string name() noexcept { return "HistoryEvolvedVariables"; }
77  using tag = Tag;
79 };
80 
81 /// \ingroup DataBoxTagsGroup
82 /// \ingroup TimeGroup
83 /// Tag for TimeStepper boundary history
84 template <typename LocalVars, typename RemoteVars, typename CouplingResult>
86  static std::string name() noexcept { return "BoundaryHistory"; }
87  using type =
89 };
90 
91 } // namespace Tags
92 
93 namespace OptionTags {
94 
95 /// \ingroup OptionTagsGroup
96 /// \ingroup TimeGroup
97 /// \brief The final time
98 struct FinalTime {
99  using type = double;
100  static constexpr OptionString help{"The final time"};
101 };
102 
103 /// \ingroup OptionTagsGroup
104 /// \ingroup TimeGroup
105 /// \brief The ::TimeStepper
106 struct TimeStepper {};
107 
108 /// \ingroup OptionTagsGroup
109 /// \ingroup TimeGroup
110 /// \brief The ::TimeStepper, specifying a (base) type. Can be
111 /// retrieved through OptionTags::TimeStepper.
112 template <typename StepperType>
114  static std::string name() noexcept { return "TimeStepper"; }
115  static constexpr OptionString help{"The time stepper"};
117 };
118 
119 /// \ingroup OptionTagsGroup
120 /// \ingroup TimeGroup
121 template <typename Registrars>
122 struct StepChoosers {
123  static constexpr OptionString help{"Limits on LTS step size"};
125  static size_t lower_bound_on_size() noexcept { return 1; }
126 };
127 
128 /// \ingroup OptionTagsGroup
129 /// \ingroup TimeGroup
131  static constexpr OptionString help{"The LTS step controller"};
133 };
134 
135 } // namespace OptionTags
136 
137 namespace OptionTags {
138 
139 /// \ingroup OptionTagsGroup
140 /// \ingroup TimeGroup
141 /// \brief The time at which to start the simulation
142 struct InitialTime {
143  using type = double;
144  static constexpr OptionString help = {
145  "The time at which the evolution is started."};
146  static type default_value() noexcept { return 0.0; }
147 };
148 
149 /// \ingroup OptionTagsGroup
150 /// \ingroup TimeGroup
151 /// \brief The initial time step taken by the time stepper. This may be
152 /// overridden by an adaptive stepper
154  using type = double;
155  static constexpr OptionString help =
156  "The initial time step, before local stepping adjustment";
157 };
158 
159 /// \ingroup OptionTagsGroup
160 /// \ingroup TimeGroup
161 /// \brief The initial slab size
163  using type = double;
164  static constexpr OptionString help = "The initial slab size";
165  static type lower_bound() noexcept { return 0.; }
166 };
167 } // namespace OptionTags
The TimeStepper.
Definition: Tags.hpp:106
The final time.
Definition: Tags.hpp:98
Definition: Tags.hpp:130
Tag for step size.
Definition: Tags.hpp:45
The initial time step taken by the time stepper. This may be overridden by an adaptive stepper...
Definition: Tags.hpp:153
Marks a DataBoxTag as being a compute item that executes a function.
Definition: DataBoxTag.hpp:155
Defines base class StepController.
Abstract base class for TimeSteppers.
Definition: TimeStepper.hpp:44
Tag for compute item for current time as a double.
Definition: Tags.hpp:62
Defines classes and functions for making classes creatable from input files.
Define prefixes for DataBox tags.
Tags for the DataBox inherit from this type.
Definition: DataBoxTag.hpp:65
Tag for compute item for current Time (from TimeId)
Definition: Tags.hpp:53
Defines class TimeId.
Prefix indicating a time derivative.
Definition: Prefixes.hpp:28
History data used by a TimeStepper.
Definition: History.hpp:25
Defines Time and TimeDelta.
History data used by a TimeStepper for boundary integration.
Definition: BoundaryHistory.hpp:31
const char *const OptionString
The string used in option structs.
Definition: Options.hpp:27
Prefix for TimeStepper history.
Definition: Tags.hpp:75
Represents an interval of time within a single slab.
Definition: Time.hpp:108
Definition: Strahlkorper.hpp:167
Definition: DataBoxTag.hpp:29
The initial slab size.
Definition: Tags.hpp:162
The time at which to start the simulation.
Definition: Tags.hpp:142
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
The TimeStepper, specifying a (base) type. Can be retrieved through OptionTags::TimeStepper.
Definition: Tags.hpp:113
Marks an item as being a prefix to another tag.
Definition: DataBoxTag.hpp:112
Tag for TimeStepper boundary history.
Definition: Tags.hpp:85
Defines classes SimpleTag, PrefixTag, ComputeTag and several functions for retrieving tag info...
Tag for TimeId for the algorithm state.
Definition: Tags.hpp:35
Holds all the StepChoosers.
Definition: Cfl.hpp:25