SpECTRE
v2024.12.16
|
Control error in the for the domain::CoordinateMaps::TimeDependent::Shape
map.
More...
#include <Size.hpp>
Classes | |
struct | DeltaRDriftOutwardOptions |
struct | InitialState |
struct | MaxNumTimesForZeroCrossingPredictor |
struct | SmoothAvgTimescaleFraction |
struct | SmootherTuner |
Public Types | |
using | object_centers = domain::object_list< Horizon > |
using | options = implementation defined |
Public Member Functions | |
Size (const int max_times, const double smooth_avg_timescale_frac, TimescaleTuner< true > smoother_tuner, std::unique_ptr< size::State > initial_state, std::optional< DeltaRDriftOutwardOptions > delta_r_drift_outward_options) | |
Initializes the intrp::ZeroCrossingPredictor s and the horizon smoothing Averager and TimescaleTuner . More... | |
const std::optional< double > & | get_suggested_timescale () const |
Returns the internal control_system::size::Info::suggested_time_scale . A std::nullopt means that no timescale is suggested. | |
bool | discontinuous_change_has_occurred () const |
Check if the control_system::size::control_error has decided to switch states. Returns the internal control_system::size::Info::discontinuous_change_has_occurred . | |
void | reset () |
Reset the internal control_system::size::Info using control_system::size::Info::reset . | |
std::deque< std::pair< double, double > > | control_error_history () const |
Get a history of the control errors for the past few measurements. More... | |
void | pup (PUP::er &p) |
template<typename Metavariables , typename... TupleTags> | |
DataVector | operator() (const ::TimescaleTuner< false > &tuner, const Parallel::GlobalCache< Metavariables > &cache, const double time, const std::string &function_of_time_name, const tuples::TaggedTuple< TupleTags... > &measurements) |
Actually computes the control error. More... | |
Static Public Attributes | |
static constexpr Options::String | help |
Control error in the for the domain::CoordinateMaps::TimeDependent::Shape
map.
The goal of this control error is
gh::characteristic_speeds
from coming into the domain.For a more detailed account of how this is accomplished, see control_system::size::State
and control_system::size::control_error
which this class calls.
This class holds a control_system::size::Info
and three different intrp::ZeroCrossingPredictor
s internally which are needed to calculate the control_system::size::control_error
. Additionally, this class stores a history of control errors for all control_system::size::State
s using a control_system::size::StateHistory
. This is useful for when a discontinuous change happens (switching control_system::size::State
s) and we need to repopulate the Averager
with a history of the control error. It also conforms to the control_system::protocols::ControlError
protocol.
In order to calculate the control error, we need the Averager
and a TimescaleTuner
to smooth out the horizon coefficient and get its derivative. Every measurement, we update this smoothing averager with the Averager::operator()
to get the averaged coefficient and its time derivative. Since Averagers
calculate the average at an "averaged time", we have to account for this small offset from the current time with a simple Taylor expansion. Then we use this newly averaged and corrected coefficient (and time derivative) in our calculation of the control error. The timescale in the smoothing TimescaleTuner
is then updated using the difference between the averaged and un-averaged coefficient (and its time derivative).
In addition to calculating the control error, if the control_system::Tags::WriteDataToDisk
tag inside the Parallel::GlobalCache
is true, then a diagnostic file named Diagnostics.dat
is also written to the same group that control_system::write_components_to_disk
would write the standard control system output (/ControlSystems/Size/
). The columns of this diagnostic file are as follows (with a small explanation if the name isn't clear):
control_system::size::State::number()
gr::surfaces::radial_distance
between the horizon and the excision surfaces.ylm::Strahlkorper::average_radius
of the horizonTimescaleTuner
suggested by one of the States (or 0.0 if no timescale was suggested)control_system::ControlErrors::Size< DerivOrder, Horizon >::Size | ( | const int | max_times, |
const double | smooth_avg_timescale_frac, | ||
TimescaleTuner< true > | smoother_tuner, | ||
std::unique_ptr< size::State > | initial_state, | ||
std::optional< DeltaRDriftOutwardOptions > | delta_r_drift_outward_options | ||
) |
Initializes the intrp::ZeroCrossingPredictor
s and the horizon smoothing Averager
and TimescaleTuner
.
All intrp::ZeroCrossingPredictor
s are initialized with a minimum number of times 3 and a maximum number of times max_times
. The internal control_system::size::Info::state
is initialized to control_system::size::States::Initial
. The smoothing Averager
uses the input average timescale fraction and always smooths the "0th" deriv (aka the horizon coefficients themselves). The input smoothing TimescaleTuner
is moved inside this class.
std::deque< std::pair< double, double > > control_system::ControlErrors::Size< DerivOrder, Horizon >::control_error_history | ( | ) | const |
Get a history of the control errors for the past few measurements.
Returns: std::deque<std::pair<double, double>> This returns up to DerivOrder
entries, not including the most recent time.
|
inline |
Actually computes the control error.
The internal control_system::size::Info::damping_time
is updated to the minimum of the TimescaleTuner::current_timescale()
that is passed in. Also expects these queue tags to be in the measurements
argument:
ylm::Tags::Strahlkorper<Frame::Distorted>
QueueTags::ExcisionSurface<Frame::Distorted>
Tags::dt<ylm::Tags::Strahlkorper<Frame::Distorted>>
QueueTags::LapseOnExcisionSurface
QueueTags::ShiftyQuantity<Frame::Distorted>
QueueTags::SpatialMetricOnExcisionSurface<Frame::Distorted>
QueueTags::InverseSpatialMetricOnExcisionSurface<Frame::Distorted>
Returns: DataVector should be of size 1
|
staticconstexpr |