12 #include "DataStructures/DataBox/PrefixHelpers.hpp"
13 #include "IO/Observer/Actions/RegisterSingleton.hpp"
14 #include "Informer/Tags.hpp"
15 #include "NumericalAlgorithms/Convergence/Tags.hpp"
16 #include "Parallel/Actions/SetupDataBox.hpp"
19 #include "Parallel/ParallelComponentHelpers.hpp"
20 #include "Parallel/PhaseDependentActionList.hpp"
21 #include "ParallelAlgorithms/Initialization/MutateAssign.hpp"
22 #include "ParallelAlgorithms/LinearSolver/Observe.hpp"
28 template <
typename...>
31 namespace LinearSolver::cg::detail {
32 template <
typename FieldsTag,
typename OptionsGroup>
33 struct InitializeResidualMonitor;
37 namespace LinearSolver::cg::detail {
39 template <
typename Metavariables,
typename FieldsTag,
typename OptionsGroup>
40 struct ResidualMonitor {
42 using const_global_cache_tags =
43 tmpl::list<logging::Tags::Verbosity<OptionsGroup>,
45 using metavariables = Metavariables;
50 using phase_dependent_action_list = tmpl::list<
52 typename Metavariables::Phase, Metavariables::Phase::Initialization,
54 InitializeResidualMonitor<FieldsTag, OptionsGroup>>>,
56 typename Metavariables::Phase,
57 Metavariables::Phase::RegisterWithObserver,
59 LinearSolver::observe_detail::Registration<OptionsGroup>>>>>;
63 static void execute_next_phase(
64 const typename Metavariables::Phase next_phase,
65 Parallel::CProxy_GlobalCache<Metavariables>& global_cache) noexcept {
66 auto& local_cache = *(global_cache.ckLocalBranch());
67 Parallel::get_parallel_component<ResidualMonitor>(local_cache)
68 .start_phase(next_phase);
72 template <
typename FieldsTag,
typename OptionsGroup>
73 struct InitializeResidualMonitor {
75 using fields_tag = FieldsTag;
78 using initial_residual_magnitude_tag =
84 tmpl::list<residual_square_tag, initial_residual_magnitude_tag>;
85 using compute_tags = tmpl::list<>;
86 template <
typename DbTagsList,
typename... InboxTags,
typename Metavariables,
87 typename ArrayIndex,
typename ActionList,
88 typename ParallelComponent>
89 static auto apply(db::DataBox<DbTagsList>& box,
94 const ParallelComponent*
const ) noexcept {
96 Initialization::mutate_assign<simple_tags>(
99 return std::make_tuple(std::move(box),
true);
Add into the DataBox default constructed items for the collection of tags requested by any of the act...
Definition: SetupDataBox.hpp:102
Definition: ElementReceiveInterpPoints.hpp:15
tmpl::remove_duplicates< tmpl::flatten< tmpl::list< AllocationTagsList, tmpl::transform< InitializationActionsList, detail::get_initialization_tags_from_action< tmpl::_1 > >> >> get_initialization_tags
Given a list of initialization actions, and possibly a list of tags needed for allocation of an array...
Definition: ParallelComponentHelpers.hpp:254
tmpl::flatten< tmpl::transform< PhaseDepActionList, detail::get_initialization_actions_list< tmpl::_1 > >> get_initialization_actions_list
Given the phase dependent action list, return the list of actions in the Initialization phase (or an ...
Definition: ParallelComponentHelpers.hpp:218
List of all the actions to be executed in the specified phase.
Definition: PhaseDependentActionList.hpp:16
An associative container that is indexed by structs.
Definition: TaggedTuple.hpp:271
Registers a singleton with the ObserverWriter.
Definition: RegisterSingleton.hpp:30
A struct that stores the charm++ types relevant for a particular singleton component.
Definition: AlgorithmSingletonDeclarations.hpp:29
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