Open nilsvu opened 5 years ago
discussion with @nilsdeppe
We think this just requires a tagged tuple info_for_determine_next_phase
in the Main component and a callback that will insert something into this tagged tuple after a reduction. Then determine_next_phase
can access this information
we might as well have a dedicated singleton component with a databox that receives reductions and determines the phase. Then we don't need a special implementation managing the tagged tuple
we discussed that possibility, but multiple components might suggest different things and there needs to be arbitration that makes sense only for Main
and the specific Metavariables::determine_next_phase
I was thinking a Metavariables::phase_chooser
alias to a singleton component. It is like any other component, i.e. it can receive reductions and has a databox, but is must expose a determine_next_phase
function or have a Tags::NextPhase
in its databox or something. So it's basically a state machine. This way, we don't have to implement the determine_next_phase
logic in the metavariables but have the component do it. We can have a simple LinearPhaseChooser<Phases...>
implementation that just moves through the phases linearly. And executables that need more logic can implement their own.
I don't want to add another component that steers the execution. This is the job of the Main component. I also don't really think we should always have the default solution to things be "Just add another component" There's a cost associated to doing that, and I don't think it's worth paying here.
Feature request:
determine_next_phase
currently only has the global cache to work with, which is constant. For switching between phases based on what's happening in a simulation, it'll need access to reduced data coming from the parallel components.A use case would be running an elliptic solve in each AMR step: We would do an AMR step in one phase, then switch to the solve phase that does some iterations, then switch back to the AMR step phase once the iterations have converged.
Component:
Desired feature:
Detailed discussion: