SpECTRE  v2024.02.05
control_system::ControlErrors::Size< DerivOrder, Horizon > Struct Template Reference

Control error in the for the \(l=0\) component of the domain::CoordinateMaps::TimeDependent::Shape map. More...

#include <Size.hpp>

Classes

struct  DeltaRDriftOutwardOptions
 
struct  MaxNumTimesForZeroCrossingPredictor
 
struct  SmoothAvgTimescaleFraction
 
struct  SmootherTuner
 

Public Types

using object_centers = domain::object_list< Horizon >
 
using options = tmpl::list< MaxNumTimesForZeroCrossingPredictor, SmoothAvgTimescaleFraction, SmootherTuner, DeltaRDriftOutwardOptions >
 

Public Member Functions

 Size (const int max_times, const double smooth_avg_timescale_frac, TimescaleTuner< true > smoother_tuner, std::optional< DeltaRDriftOutwardOptions > delta_r_drift_outward_options)
 Initializes the intrp::ZeroCrossingPredictors 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 size_t expected_number_of_excisions = 1
 
static constexpr Options::String help
 

Detailed Description

template<size_t DerivOrder, ::domain::ObjectLabel Horizon>
struct control_system::ControlErrors::Size< DerivOrder, Horizon >

Control error in the for the \(l=0\) component of the domain::CoordinateMaps::TimeDependent::Shape map.

Details

The goal of this control error is

  1. Keep the excision sphere inside the horizon
  2. Maintain a fixed distance between the excision surface and the horizon surface.
  3. Prevent the characteristic field \( u^-_{ab} \) associated with the characteristic speed \( v_- \) in 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::ZeroCrossingPredictors 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::States using a control_system::size::StateHistory. This is useful for when a discontinuous change happens (switching control_system::size::States) 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 \(\ell = 0, m = 0\) coefficient of the horizon and its time derivative. However, because we will be finding the horizon fairly often, the value of the coefficient and its derivative won't change smoothly because of horizon finder noise (different number of iterations). But we expect these quantities to be smooth when making state decisions. So to account for this, we use an Averager and a TimescaleTuner to smooth out the horizon coefficient and get its derivative. Every measurement, we update this smoothing averager with the \(\ell = 0, m = 0\) coefficient of the horizon and the current smoothing timescale. Then, once we have enough measurements, we use 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):

  • Time
  • ControlError
  • StateNumber: Result of control_system::size::State::number()
  • DiscontinuousChangeHasOccurred: 1.0 for true, 0.0 for false.
  • FunctionOfTime
  • DtFunctionOfTime
  • HorizonCoef00
  • AveragedDtHorizonCoef00: The averaged 00 component of the horizon (averaging scheme detailed above.)
  • RawDtHorizonCoef00: The raw 00 component of the horizon passed in to the control error.
  • SmootherTimescale: Damping timescale for the averaging of DtHorizonCoef00.
  • MinDeltaR: The minimum of the gr::surfaces::radial_distance between the horizon and the excision surfaces.
  • MinRelativeDeltaR: MinDeltaR divided by the ylm::Strahlkorper::average_radius of the horizon
  • AvgDeltaR: Same as MinDeltaR except it's the average radii.
  • AvgRelativeDeltaR: AvgDeltaR divided by the average radius of the horizon
  • ControlErrorDeltaR: \( \dot{S}_{00} (\lambda_{00} - r_{\mathrm{excision}}^{\mathrm{grid}} / Y_{00}) / S_{00} - \dot{\lambda}_{00} \)
  • TargetCharSpeed
  • MinCharSpeed
  • MinComovingCharSpeed: Eq. 98 in [84]
  • CharSpeedCrossingTime: Time at which the min char speed is predicted to cross zero and become negative (or 0.0 if that time is in the past).
  • ComovingCharSpeedCrossingTime: Time at which the min comoving char speed is predicted to cross zero and become negative (or 0.0 if that time is in the past).
  • DeltaRCrossingTime: Time at which the distance between the excision and horizon surfaces is predicted to be zero (or 0.0 if that time is in the past).
  • SuggestedTimescale: A timescale for the TimescaleTuner suggested by one of the States (or 0.0 if no timescale was suggested)
  • DampingTime

Constructor & Destructor Documentation

◆ Size()

template<size_t DerivOrder, ::domain::ObjectLabel Horizon>
control_system::ControlErrors::Size< DerivOrder, Horizon >::Size ( const int  max_times,
const double  smooth_avg_timescale_frac,
TimescaleTuner< true >  smoother_tuner,
std::optional< DeltaRDriftOutwardOptions delta_r_drift_outward_options 
)

Initializes the intrp::ZeroCrossingPredictors and the horizon smoothing Averager and TimescaleTuner.

Details

All intrp::ZeroCrossingPredictors 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.

Member Function Documentation

◆ control_error_history()

template<size_t DerivOrder, ::domain::ObjectLabel Horizon>
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.

See also
control_system::size::StateHistory::state_history

◆ operator()()

template<size_t DerivOrder, ::domain::ObjectLabel Horizon>
template<typename Metavariables , typename... TupleTags>
DataVector control_system::ControlErrors::Size< DerivOrder, Horizon >::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 
)
inline

Member Data Documentation

◆ help

template<size_t DerivOrder, ::domain::ObjectLabel Horizon>
constexpr Options::String control_system::ControlErrors::Size< DerivOrder, Horizon >::help
staticconstexpr
Initial value:
{
"Computes the control error for size control. Will also write a "
"diagnostics file if the control systems are allowed to write data to "
"disk."}

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