SpECTRE  v2026.04.01
Loading...
Searching...
No Matches
control_system::protocols::ControlError Struct Reference

Definition of a control error. More...

#include <ControlError.hpp>

Classes

struct  test

Detailed Description

Definition of a control error.

A control error is used within a control system to compute how far off the the value you are controlling is from its expected value.

A conforming type must specify:

  • a call operator that returns a DataVector with a signature the same as in the example shown here:
  • a type alias object_centers to a domain::object_list of domain::ObjectLabels. These are the objects that will require the domain::Tags::ObjectCenters tags to be in the GlobalCache for this control system to work.
  • a function with signature std::optional<double> get_suggested_timescale() const; which returns a potential suggested timescale. To use the timescale from the timescale tuner, return std::nullopt.
  • a function with signature void reset(); which will reset the control error after get_suggested_timescale() is called.
Note
The TimescaleTuner can have it's template parameter be either true or false.
: tt::ConformsTo<control_system::protocols::ControlError> {
using object_centers = domain::object_list<domain::ObjectLabel::A>;
std::optional<double> get_suggested_timescale() const {
return suggested_timescale_;
}
void reset() { suggested_timescale_ = std::nullopt; }
void pup(PUP::er& /*p*/) {}
template <typename Metavariables, typename... QueueTags>
DataVector operator()(const ::TimescaleTuner<true>& tuner,
const Parallel::GlobalCache<Metavariables>& cache,
const double time,
const std::string& function_of_time_name,
const tuples::TaggedTuple<QueueTags...>& measurements) {
const auto& functions_of_time =
const double current_map_value =
functions_of_time.at(function_of_time_name)->func(time)[0][0];
const double measured_value = 0.0;
suggested_timescale_ = 1.0;
// Would do something like get<QueueTag>(measurements) here
(void)measurements;
// Size control needs the timescale tuner
(void)tuner;
return {current_map_value - measured_value};
}
private:
std::optional<double> suggested_timescale_;
};

The documentation for this struct was generated from the following file:
  • src/ControlSystem/Protocols/ControlError.hpp