SpECTRE
v2025.03.17
|
PhaseChange
objects determine the storage types and logic for moving between phases based on runtime data.
More...
#include <PhaseChange.hpp>
Public Member Functions | |
PhaseChange (CkMigrateMessage *msg) | |
WRAPPED_PUPable_abstract (PhaseChange) | |
template<typename ParallelComponent , typename DbTags , typename Metavariables , typename ArrayIndex > | |
void | contribute_phase_data (const gsl::not_null< db::DataBox< DbTags > * > box, Parallel::GlobalCache< Metavariables > &cache, const ArrayIndex &array_index) const |
Send data from all participating_components to the Main chare for determining the next phase. | |
template<typename... DecisionTags, typename Metavariables > | |
std::optional< std::pair< Parallel::Phase, PhaseControl::ArbitrationStrategy > > | arbitrate_phase_change (const gsl::not_null< tuples::TaggedTuple< DecisionTags... > * > phase_change_decision_data, const Parallel::Phase current_phase, const Parallel::GlobalCache< Metavariables > &cache) const |
Determine a phase request and PhaseControl::ArbitrationStrategy based on aggregated phase_change_decision_data on the Main Chare. | |
template<typename Metavariables , typename... Tags> | |
void | initialize_phase_data (const gsl::not_null< tuples::TaggedTuple< Tags... > * > phase_change_decision_data) const |
Initialize the phase_change_decision_data on the main chare to starting values. | |
PhaseChange
objects determine the storage types and logic for moving between phases based on runtime data.
The phase control flow must have the cooperation of each parallel component, but make phase decisions centrally so that at any point, all components are in the same phase. The operations needed by the parallel components and by the Main chare, are:
PhaseChange
object. For instance, selecting a common slab will usually represent a globally well-behaved state for a DgElementArray
.PhaseChange
objects must use the collected reduction data, or other persistent data stored in phase_change_decision_data
to decide on a phase to request and an PhaseControl::ArbitrationStrategy
to determine how to resolve multiple simultaneous requests. Additionally, the PhaseChange
objects must specify initialization functions to set the starting state of the tags in phase_change_decision_data
for which they are responsible.In addition to the options
type alias and static constexpr Options::String help
variable needed to be option-creatable, a derived class of PhaseChange
must specify the type aliases:
argument_tags
: A tmpl::list
of tags from the DataBox to be passed to contribute_phase_data_impl
as const references.return_tags
: A tmpl::list
of mutable tags from the DataBox to be passed to contribute_phase_data_impl
as gsl::not_null
pointers. This should be used only for tags that may be altered during the contribute_phase_data_impl
function.phase_change_tags_and_combines
: A tmpl::list
of tags for populating the phase_change_decision_data
in the Main chare. Each tag in this list must also define a combine_method
and a main_combine_method
for performing the aggregation during reduction.participating_components
(templated on Metavariables
): A tmpl::list
of components that contribute data during this reduction. This can be used to screen out components that will not have the necessary information to contribute to the reduction. If all components should participate, this type alias can be set to simply typename Metavariables::component_list
.And member functions with signatures:
phase_change_tags_and_combines
to useful initial states in the phase_change_decision_data
.arbitrate_phase_change_impl
to the Main chare via function Parallel::contribute_to_phase_change_reduction
.phase_change_decision_data
and optionally return a std::pair
with the desired Parallel::Phase
and an PhaseControl::ArbitrationStrategy
indicating a method for arbitrating multiple simultaneous requests. Alternatively, it may return std::nullopt
to abstain from the phase decision. The arbitrate_phase_change_impl
may (and often will) mutate the phase_change_decision_data
. For instance, it may be desirable to 'reset' the data to allow for future jumps associated with the same PhaseChange
, or the PhaseChange
will describe multiple changes in sequence, and the state of that sequential process can be recorded in phase_change_decision_data
.