SpECTRE  v2023.05.16
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.


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).
  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. Update the damping timescales in the TimescaleTuner and compute the control signal using the control error and its derivatives.
  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. Update the MaxDeriv of the functions of time with the control signal and update the measurement timescales with the new measurement timescale (both of these are Parallel::mutate calls).

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