11 #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::gmres::detail {
32 template <
typename FieldsTag,
typename OptionsGroup>
33 struct InitializeResidualMonitor;
37 namespace LinearSolver::gmres::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;
49 using phase_dependent_action_list = tmpl::list<
51 typename Metavariables::Phase, Metavariables::Phase::Initialization,
53 InitializeResidualMonitor<FieldsTag, OptionsGroup>>>,
55 typename Metavariables::Phase,
56 Metavariables::Phase::RegisterWithObserver,
58 LinearSolver::observe_detail::Registration<OptionsGroup>>>>>;
62 static void execute_next_phase(
63 const typename Metavariables::Phase next_phase,
64 Parallel::CProxy_GlobalCache<Metavariables>& global_cache) noexcept {
65 auto& local_cache = *(global_cache.ckLocalBranch());
66 Parallel::get_parallel_component<ResidualMonitor>(local_cache)
67 .start_phase(next_phase);
71 template <
typename FieldsTag,
typename OptionsGroup>
72 struct InitializeResidualMonitor {
74 using fields_tag = FieldsTag;
75 using initial_residual_magnitude_tag =
78 using orthogonalization_history_tag =
83 tmpl::list<initial_residual_magnitude_tag, orthogonalization_history_tag>;
84 using compute_tags = tmpl::list<>;
86 template <
typename DbTagsList,
typename... InboxTags,
typename ArrayIndex,
87 typename Metavariables,
typename ActionList,
88 typename ParallelComponent>
89 static auto apply(db::DataBox<DbTagsList>& box,
94 const ParallelComponent*
const ) noexcept {
97 Initialization::mutate_assign<tmpl::list<initial_residual_magnitude_tag>>(
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:81
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:252
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:216
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
T signaling_NaN(T... args)
Registers a singleton with the ObserverWriter.
Definition: RegisterSingleton.hpp:29
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
A Hessenberg matrix built up during an orthogonalization procedure.
Definition: Tags.hpp:140