10 #include "IO/Observer/Actions/RegisterSingleton.hpp"
11 #include "Informer/Tags.hpp"
12 #include "NumericalAlgorithms/Convergence/Tags.hpp"
13 #include "Parallel/Actions/SetupDataBox.hpp"
16 #include "ParallelAlgorithms/Initialization/MutateAssign.hpp"
18 #include "ParallelAlgorithms/NonlinearSolver/Observe.hpp"
23 template <
typename...>
26 namespace NonlinearSolver::newton_raphson::detail {
27 template <
typename Metavariables,
typename FieldsTag>
28 struct InitializeResidualMonitor;
32 namespace NonlinearSolver::newton_raphson::detail {
34 template <
typename Metavariables,
typename FieldsTag,
typename OptionsGroup>
35 struct ResidualMonitor {
37 using const_global_cache_tags =
38 tmpl::list<logging::Tags::Verbosity<OptionsGroup>,
42 using metavariables = Metavariables;
43 using phase_dependent_action_list = tmpl::list<
45 typename Metavariables::Phase, Metavariables::Phase::Initialization,
47 InitializeResidualMonitor<FieldsTag, OptionsGroup>>>,
49 typename Metavariables::Phase,
50 Metavariables::Phase::RegisterWithObserver,
52 NonlinearSolver::observe_detail::Registration<OptionsGroup>>>>>;
57 static void initialize(
58 Parallel::CProxy_GlobalCache<Metavariables>& ) noexcept {}
60 static void execute_next_phase(
61 const typename Metavariables::Phase next_phase,
62 Parallel::CProxy_GlobalCache<Metavariables>& global_cache) noexcept {
63 auto& local_cache = *(global_cache.ckLocalBranch());
64 Parallel::get_parallel_component<ResidualMonitor>(local_cache)
65 .start_phase(next_phase);
69 template <
typename FieldsTag,
typename OptionsGroup>
70 struct InitializeResidualMonitor {
72 using fields_tag = FieldsTag;
75 using residual_magnitude_square_tag =
77 using initial_residual_magnitude_tag =
79 using prev_residual_magnitude_square_tag =
85 initial_residual_magnitude_tag,
87 prev_residual_magnitude_square_tag>;
88 using compute_tags = tmpl::list<>;
90 template <
typename DbTagsList,
typename... InboxTags,
typename Metavariables,
91 typename ArrayIndex,
typename ActionList,
92 typename ParallelComponent>
93 static auto apply(db::DataBox<DbTagsList>& box,
98 const ParallelComponent*
const ) noexcept {
99 Initialization::mutate_assign<simple_tags>(
104 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
tmpl::flatten< tmpl::list< Tags... > > AddSimpleTags
List of Tags to add to the DataBox.
Definition: DataBox.hpp:802
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