15 #include "IO/Observer/ArrayComponentId.hpp"
16 #include "IO/Observer/Helpers.hpp"
17 #include "IO/Observer/ObservationId.hpp"
18 #include "IO/Observer/ObserverComponent.hpp"
19 #include "IO/Observer/ReductionActions.hpp"
20 #include "IO/Observer/TypeOfObservation.hpp"
22 #include "Parallel/ArrayIndex.hpp"
25 #include "Parallel/Invoke.hpp"
26 #include "Parallel/Reduction.hpp"
27 #include "ParallelAlgorithms/EventsAndTriggers/Event.hpp"
30 #include "Utilities/Functional.hpp"
31 #include "Utilities/Registration.hpp"
43 template <
typename Metavariables,
typename EventRegistrars>
44 class ObserveTimeStep;
47 namespace Registrars {
48 template <
typename Metavariables>
79 template <
typename Metavariables,
80 typename EventRegistrars =
81 tmpl::list<Registrars::ObserveTimeStep<Metavariables>>>
84 using ReductionData = Parallel::ReductionData<
100 "The name of the subfile inside the HDF5 file without an extension and "
101 "without a preceding '/'."};
106 using PUP::able::register_constructor;
110 using options = tmpl::list<SubfileName>;
112 "Observe the size of the time steps.\n"
114 "Writes reduction quantities:\n"
118 "- Minimum time step\n"
119 "- Maximum time step\n"
120 "- Effective time step\n"
122 "The effective time step is the step size of a global-time-stepping\n"
123 "method that would perform a similar amount of work.\n"
125 "All values are reported as positive numbers, even for backwards\n"
131 using observed_reduction_data_tags =
132 observers::make_reduction_data_tags<tmpl::list<ReductionData>>;
136 using argument_tags =
138 typename Metavariables::system::variables_tag>;
140 template <
typename ArrayIndex,
typename ParallelComponent>
142 const double& time,
const TimeDelta& time_step,
143 const typename Metavariables::system::variables_tag::type& variables,
145 const ArrayIndex& array_index,
146 const ParallelComponent*
const )
const noexcept {
147 const size_t number_of_grid_points = variables.number_of_grid_points();
148 const double slab_size = time_step.slab().duration().value();
149 const double step_size = abs(time_step.value());
151 auto& local_observer =
152 *Parallel::get_parallel_component<observers::Observer<Metavariables>>(
155 Parallel::simple_action<observers::Actions::ContributeReductionData>(
162 "Minimum time step",
"Maximum time step",
163 "Effective time step"},
164 ReductionData{
time, number_of_grid_points, slab_size, step_size,
165 step_size, number_of_grid_points / step_size});
168 using observation_registration_tags = tmpl::list<>;
170 get_observation_type_and_key_for_registration() const noexcept {
176 void pup(PUP::er& p)
override {
185 template <
typename Metavariables,
typename EventRegistrars>
186 ObserveTimeStep<Metavariables, EventRegistrars>::ObserveTimeStep(
188 : subfile_path_(
"/" + subfile_name) {}
191 template <
typename Metavariables,
typename EventRegistrars>
192 PUP::able::PUP_ID ObserveTimeStep<Metavariables, EventRegistrars>::my_PUP_ID =
A unique identifier for an observation representing the type of observation and the instance (e....
Definition: ObservationId.hpp:71
Functional for computing / of two objects.
Definition: Functional.hpp:235
Definition: ElementReceiveInterpPoints.hpp:15
The data to be reduced, and invokables to be called whenever two reduction messages are combined and ...
Definition: Reduction.hpp:63
Used as a key in maps to keep track of how many elements have registered.
Definition: ObservationId.hpp:28
The name of the subfile inside the HDF5 file.
Definition: ObserveTimeStep.hpp:97
A template for defining a registrar.
Definition: Registration.hpp:42
#define WRAPPED_PUPable_decl_template(className)
Mark derived classes as serializable.
Definition: CharmPupable.hpp:22
Functional for computing + of two objects.
Definition: Functional.hpp:238
Parallel::GlobalCache< Metavariables > & cache(MockRuntimeSystem< Metavariables > &runner, const ArrayIndex &array_index) noexcept
Returns the GlobalCache of Component with index array_index.
Definition: MockRuntimeSystemFreeFunctions.hpp:362
const char *const String
The string used in option structs.
Definition: Options.hpp:32
@ Reduction
The sender will only perform reduction observations.
An ID type that identifies both the parallel component and the index in the parallel component.
Definition: ArrayComponentId.hpp:27
Observe the size of the time steps.
Definition: ObserveTimeStep.hpp:82
The array index used for indexing Chare Arrays, mostly an implementation detail.
Definition: ArrayIndex.hpp:28