SpECTRE
v2023.10.11
|
Classes and functions used in implementation of size control. More...
Classes | |
struct | ControlErrorArgs |
Packages some of the inputs to the State::control_error, so that State::control_error doesn't need a large number of arguments. More... | |
struct | CrossingTimeInfo |
Holds information about crossing times, as computed by ZeroCrossingPredictors. More... | |
struct | ErrorDiagnostics |
A simple struct to hold diagnostic information about computing the size control error. More... | |
struct | Info |
Holds information that is saved between calls of SizeControl. More... | |
struct | is_size |
struct | is_size< Systems::Size< Label, DerivOrder > > |
class | State |
Represents a 'state' of the size control system. More... | |
struct | StateHistory |
A struct for holding a history of control errors for each state in the control_system::Systems::Size control system. More... | |
struct | StateUpdateArgs |
Packages some of the inputs to the State::update, so that State::update doesn't need a large number of arguments. More... | |
Functions | |
double | control_error_delta_r (const double horizon_00, const double dt_horizon_00, const double lambda_00, const double dt_lambda_00, const double grid_frame_excision_sphere_radius) |
Function that computes the control error for control_system::size::States::DeltaR . More... | |
template<typename Frame > | |
ErrorDiagnostics | control_error (const gsl::not_null< Info * > info, const gsl::not_null< intrp::ZeroCrossingPredictor * > predictor_char_speed, const gsl::not_null< intrp::ZeroCrossingPredictor * > predictor_comoving_char_speed, const gsl::not_null< intrp::ZeroCrossingPredictor * > predictor_delta_radius, double time, double control_error_delta_r, std::optional< double > control_error_delta_r_outward, std::optional< double > max_allowed_radial_distance, double dt_lambda_00, const ylm::Strahlkorper< Frame > &apparent_horizon, const ylm::Strahlkorper< Frame > &excision_boundary, const Scalar< DataVector > &lapse_on_excision_boundary, const tnsr::I< DataVector, 3, Frame > &frame_components_of_grid_shift, const tnsr::ii< DataVector, 3, Frame > &spatial_metric_on_excision_boundary, const tnsr::II< DataVector, 3, Frame > &inverse_spatial_metric_on_excision_boundary) |
Computes the size control error, updating the stored info. More... | |
void | register_derived_with_charm () |
template<size_t DerivOrder, ::domain::ObjectLabel Horizon, typename Metavariables > | |
void | update_averager (const gsl::not_null< Averager< DerivOrder - 1 > * > averager, const gsl::not_null< ControlErrors::Size< DerivOrder, Horizon > * > control_error, const Parallel::GlobalCache< Metavariables > &cache, const double time, const DataVector ¤t_timescale, const std::string &function_of_time_name, const int current_measurement) |
Updates the Averager with information from the Size control error . More... | |
template<size_t DerivOrder, ::domain::ObjectLabel Horizon, typename Metavariables > | |
void | update_tuner (const gsl::not_null< TimescaleTuner< false > * > tuner, const gsl::not_null< ControlErrors::Size< DerivOrder, Horizon > * > control_error, const Parallel::GlobalCache< Metavariables > &cache, const double time, const std::string &function_of_time_name) |
Updates the TimescaleTuner with information from the Size control error . More... | |
Variables | |
template<typename T > | |
constexpr bool | is_size_v = is_size<T>::value |
Check whether a control system is the control_system::Systems::Size system or not. | |
Classes and functions used in implementation of size control.
ErrorDiagnostics control_system::size::control_error | ( | const gsl::not_null< Info * > | info, |
const gsl::not_null< intrp::ZeroCrossingPredictor * > | predictor_char_speed, | ||
const gsl::not_null< intrp::ZeroCrossingPredictor * > | predictor_comoving_char_speed, | ||
const gsl::not_null< intrp::ZeroCrossingPredictor * > | predictor_delta_radius, | ||
double | time, | ||
double | control_error_delta_r, | ||
std::optional< double > | control_error_delta_r_outward, | ||
std::optional< double > | max_allowed_radial_distance, | ||
double | dt_lambda_00, | ||
const ylm::Strahlkorper< Frame > & | apparent_horizon, | ||
const ylm::Strahlkorper< Frame > & | excision_boundary, | ||
const Scalar< DataVector > & | lapse_on_excision_boundary, | ||
const tnsr::I< DataVector, 3, Frame > & | frame_components_of_grid_shift, | ||
const tnsr::ii< DataVector, 3, Frame > & | spatial_metric_on_excision_boundary, | ||
const tnsr::II< DataVector, 3, Frame > & | inverse_spatial_metric_on_excision_boundary | ||
) |
Computes the size control error, updating the stored info.
Frame | should be Frame::Distorted if Frame::Distorted exists. |
info | struct containing parameters that will be used/filled. Some of the fields in info will guide the behavior of other control system components like the averager and (possibly) the time step. |
predictor_char_speed | ZeroCrossingPredictor for the characteristic speed. |
predictor_comoving_char_speed | ZeroCrossingPredictor for the comoving characteristic speed. |
predictor_delta_radius | ZeroCrossingPredictor for the difference in radius between the horizon and the excision boundary. |
time | the current time. |
control_error_delta_r | the control error for the DeltaR state. This is used in other states as well. |
control_error_delta_r_outward | the control error for the DeltaRDriftOutward state. If std::nullopt, then DeltaRDriftOutward will not be used. |
max_allowed_radial_distance | the maximum average radial distance between the horizon and the excision boundary that is allowed without triggering the DeltaRDriftOutward state. If std::nullopt, then DeltaRDriftOutward will not be used. |
dt_lambda_00 | the time derivative of the map parameter lambda_00 |
apparent_horizon | the current horizon in frame Frame. |
excision_boundary | a Strahlkorper representing the excision boundary in frame Frame. Note that the excision boundary is assumed to be a sphere in the grid frame. |
lapse_on_excision_boundary | Lapse on the excision boundary. |
frame_components_of_grid_shift | The quantity \(\beta^i \frac{\partial x^\hat{i}}{\partial x_i}\) (see below) evaluated on the excision boundary. This is a tensor in frame Frame. |
spatial_metric_on_excision_boundary | metric in frame Frame. |
inverse_spatial_metric_on_excision_boundary | metric in frame Frame. |
Returns: Returns an ErrorDiagnostics
object which, in addition to the actual control error, holds a lot of diagnostic information about how the control error was calculated. This information could be used to print to a file if desired.
The characteristic speed that is needed here is
\begin{align} v &= -\alpha -n_i\beta^i \\ v &= -\alpha -n_\hat{i}\hat{\beta}^\hat{i} - n_\hat{i}\frac{\partial x^\hat{i}}{\partial t} \\ v &= -\alpha -n_\bar{i}\bar{\beta}^\bar{i} - n_\bar{i}\frac{\partial x^\bar{i}}{\partial t} \\ v &= -\alpha - n_\hat{i} \frac{\partial x^\hat{i}}{\partial x^i} \beta^i, \end{align}
where we have written many equivalent forms in terms of quantities defined in different frames.
Here \(\alpha\) is the lapse, which is invariant under frame transformations, \(n_i\), \(n_\hat{i}\), and \(n_\bar{i}\) are the metric-normalized normal one-form to the Strahlkorper in the grid, distorted, and inertial frames, and \(\beta^i\), \(\hat{\beta}^\hat{i}\), and \(\bar{\beta}^\bar{i}\) are the shift in the grid, distorted, and inertial frames.
Note that we decorate the shift with hats and bars in addition to decorating its index, because the shift transforms in a non-obvious way under frame transformations so it is easy to make mistakes. To be clear, these different shifts are defined by
\begin{align} \beta^i &= \alpha^2 g^{0i},\\ \hat{\beta}^\hat{i} &= \alpha^2 g^{\hat{0}\hat{i}},\\ \bar{\beta}^\bar{i} &= \alpha^2 g^{\bar{0}\bar{i}}, \end{align}
where \(g^{ab}\) is the spacetime metric, and they transform like
\begin{align} \hat{\beta}^\hat{i} &= \beta^i \frac{\partial x^\hat{i}}{\partial x^i}- \frac{\partial x^\hat{i}}{\partial t}. \end{align}
The quantity we pass as frame_components_of_grid_shift is
\begin{align} \beta^i \frac{\partial x^\hat{i}}{\partial x^i} &= \hat{\beta}^\hat{i} + \frac{\partial x^\hat{i}}{\partial t} \\ &= \bar{\beta}^\bar{j}\frac{\partial x^\hat{i}}{\partial x^i} \frac{\partial x^i}{\partial x^\bar{j}} + \frac{\partial x^\hat{i}}{\partial x^\bar{j}} \frac{\partial x^\bar{j}}{\partial t}, \end{align}
where we have listed several equivalent formulas that involve quantities in different frames.
double control_system::size::control_error_delta_r | ( | const double | horizon_00, |
const double | dt_horizon_00, | ||
const double | lambda_00, | ||
const double | dt_lambda_00, | ||
const double | grid_frame_excision_sphere_radius | ||
) |
Function that computes the control error for control_system::size::States::DeltaR
.
This is helpful to have calculated separately because other control errors may make use of this quantity. The equation for the control error is given in Eq. 96 in [84].
horizon_00 | The \(l=0,m=0\) coefficient of the apparent horizon in the distorted frame. |
dt_horizon_00 | The \(l=0,m=0\) coefficient of the time derivative of the apparent horizon in the distorted frame, where the derivative is taken in the distorted frame as well. |
lambda_00 | The \(l=0,m=0\) component of the function of time for the time dependent map |
dt_lambda_00 | The \(l=0,m=0\) component of the time derivative of the function of time for the time dependent map |
grid_frame_excision_sphere_radius | Radius of the excision sphere in the grid frame |
void control_system::size::update_averager | ( | const gsl::not_null< Averager< DerivOrder - 1 > * > | averager, |
const gsl::not_null< ControlErrors::Size< DerivOrder, Horizon > * > | control_error, | ||
const Parallel::GlobalCache< Metavariables > & | cache, | ||
const double | time, | ||
const DataVector & | current_timescale, | ||
const std::string & | function_of_time_name, | ||
const int | current_measurement | ||
) |
Updates the Averager with information from the Size control error .
After we calculate the control error, we check if a discontinuous change has occurred (the internal control_system::size::State
changed). If no discontinuous change has occurred, then we do nothing. If one did occur, we get a history of control errors from the Size control error and use that to repopulate the Averager history.
control_system::Tags::Averager
for why the Averager is templated on DerivOrder - 1
. void control_system::size::update_tuner | ( | const gsl::not_null< TimescaleTuner< false > * > | tuner, |
const gsl::not_null< ControlErrors::Size< DerivOrder, Horizon > * > | control_error, | ||
const Parallel::GlobalCache< Metavariables > & | cache, | ||
const double | time, | ||
const std::string & | function_of_time_name | ||
) |
Updates the TimescaleTuner with information from the Size control error .
We check for a suggested timescale from the Size control error . If one is suggested and it is smaller than the current damping timescale, we set the timescale in the TimescaleTuner to this suggested value. Otherwise, we let the TimescaleTuner adjust the timescale. Regardless of whether a timescale was suggested or not, we always reset the size control error.