SpECTRE  v2024.04.12
control_system::UpdateControlSystem< ControlSystem > Struct Template Reference

Functor for updating control systems when they are ready. More...

#include <UpdateControlSystem.hpp>

Static Public Member Functions

template<typename DbTags , typename Metavariables , typename ArrayIndex , typename... TupleTags>
static void apply (const gsl::not_null< db::DataBox< DbTags > * > box, Parallel::GlobalCache< Metavariables > &cache, const ArrayIndex &, const double time, tuples::TaggedTuple< TupleTags... > data)
 

Static Public Attributes

static constexpr size_t deriv_order = ControlSystem::deriv_order
 

Detailed Description

template<typename ControlSystem>
struct control_system::UpdateControlSystem< ControlSystem >

Functor for updating control systems when they are ready.

Details

The apply operator of this struct is meant to be called by the UpdateMessageQueue action once an entire measurement has been made.

Requires a few tags to be in the DataBox of the ControlComponent that this is running on:

And the control_system::Tags::MeasurementsPerUpdate must be in the GlobalCache. If these tags are not present, a build error will occur.

The algorithm to determine whether or not to update the functions of time is as follows:

  1. Ensure this control system is active. If it isn't, end here and don't process the measurements.
  2. Increment the current measurement stored by control_system::Tags::CurrentNumberOfMeasurements. This keeps track of which measurement we are on out of control_system::Tags::MeasurementsPerUpdate.
  3. Calculate the control error and update the averager (store the current measurement). If the averager doesn't have enough information to determine the derivatives of the control error, exit now (this usually only happens for the first couple measurements of a simulation). If this is size control, an extra step happens after we calculate the control error, but before we update the averager. See control_system::size::update_averager for this step.
  4. If the control_system::Tags::WriteDataToDisk tag is set to true, write the time, function of time values, and the control error and its derivative to disk.
  5. Determine if we need to update. We only want to update when the current measurement is equal to the number of measurements per update. If it's not time to update, exit now. Once we determine that it is time to update, set the current measurement back to 0.
  6. Compute the control signal using the control error and its derivatives and update the damping timescales in the TimescaleTuner. If this is size control, there is an extra step after we update the damping timescale. See control_system::size::update_tuner for this step.
  7. Calculate the new measurement timescale based off the updated damping timescales and the number of measurements per update.
  8. Determine the new expiration times for the domain::Tags::FunctionsOfTime and control_system::Tags::MeasurementTimescales. Call the control_system::AggregateUpdate simple action on the first control system in the component_list of the metavariables. This simple action will mutate the global cache tags when it has enough data.

The documentation for this struct was generated from the following file: