SpECTRE
v2024.12.16
|
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... | |
void | comoving_char_speed_derivative (gsl::not_null< Scalar< DataVector > * > result, double lambda_00, double dt_lambda_00, double horizon_00, double dt_horizon_00, double grid_frame_excision_sphere_radius, const tnsr::i< DataVector, 3, Frame::Distorted > &excision_rhat, const tnsr::i< DataVector, 3, Frame::Distorted > &excision_normal_one_form, const Scalar< DataVector > &excision_normal_one_form_norm, const tnsr::I< DataVector, 3, Frame::Distorted > &distorted_components_of_grid_shift, const tnsr::II< DataVector, 3, Frame::Distorted > &inverse_spatial_metric_on_excision_boundary, const tnsr::Ijj< DataVector, 3, Frame::Distorted > &spatial_christoffel_second_kind, const tnsr::i< DataVector, 3, Frame::Distorted > &deriv_lapse, const tnsr::iJ< DataVector, 3, Frame::Distorted > &deriv_of_distorted_shift, const InverseJacobian< DataVector, 3, Frame::Grid, Frame::Distorted > &inverse_jacobian_grid_to_distorted) |
Computes the derivative of the comoving characteristic speed with respect to the size map parameter. 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.
void control_system::size::comoving_char_speed_derivative | ( | gsl::not_null< Scalar< DataVector > * > | result, |
double | lambda_00, | ||
double | dt_lambda_00, | ||
double | horizon_00, | ||
double | dt_horizon_00, | ||
double | grid_frame_excision_sphere_radius, | ||
const tnsr::i< DataVector, 3, Frame::Distorted > & | excision_rhat, | ||
const tnsr::i< DataVector, 3, Frame::Distorted > & | excision_normal_one_form, | ||
const Scalar< DataVector > & | excision_normal_one_form_norm, | ||
const tnsr::I< DataVector, 3, Frame::Distorted > & | distorted_components_of_grid_shift, | ||
const tnsr::II< DataVector, 3, Frame::Distorted > & | inverse_spatial_metric_on_excision_boundary, | ||
const tnsr::Ijj< DataVector, 3, Frame::Distorted > & | spatial_christoffel_second_kind, | ||
const tnsr::i< DataVector, 3, Frame::Distorted > & | deriv_lapse, | ||
const tnsr::iJ< DataVector, 3, Frame::Distorted > & | deriv_of_distorted_shift, | ||
const InverseJacobian< DataVector, 3, Frame::Grid, Frame::Distorted > & | inverse_jacobian_grid_to_distorted | ||
) |
Computes the derivative of the comoving characteristic speed with respect to the size map parameter.
result | the derivative of the comoving char speed |
lambda_00 | the map parameter |
dt_lambda_00 | the time derivative of the map parameter |
horizon_00 | the average coefficient of the horizon |
dt_horizon_00 | the time derivative of horizon_00 |
grid_frame_excision_sphere_radius | radius of the excision boundary in the grid frame, |
excision_rhat | the direction cosine |
excision_normal_one_form | the unnormalized one-form |
excision_normal_one_form_norm | the norm of the one-form |
distorted_components_of_grid_shift | the quantity |
inverse_spatial_metric_on_excision_boundary | metric in the distorted frame. |
spatial_christoffel_second_kind | the Christoffel symbols |
deriv_lapse | the spatial derivative of the lapse |
deriv_of_distorted_shift | the spatial derivative of the shift in the distorted frame |
inverse_jacobian_grid_to_distorted | the quantity |
The characteristic speed on the excision boundary is
where
The size/shape map at the excision boundary is given by Eq. 72 of [91] :
where
The comoving characteristic speed is given by rewriting Eq. 98 of [91] in terms of the distorted-frame shift:
where in the last line we have rewritten
This is not the shift in the distorted frame
If the comoving characteristic speed
This function computes
Here we derive an expression for
First, note that by differentiating Eq. (
where the last line follows from the definition of the direction cosines.
The Jacobian of the map is
where
But we want the derivative of the inverse Jacobian, not the forward Jacobian. By taking the derivative of the identity
and by using Eq. (
Note that the right-hand side of Eq. (
Assume we have an arbitrary function of space
This is how we will evaluate derivatives of metric functions like the lapse.
To differentiate the quantity defined by Eq. (
where
because there is no remaining
where we have used Eq. (
The normal to the surface is the most complicated expression in Eq. (
because the excision boundary is a sphere of fixed radius in the grid frame. Therefore
The normalized one-form
where
Here
Now
Here we have used Eq. (
Given the above, the derivative of the normalized normal one-form is
where we have eliminated
We can now differentiate Eq. (
where
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 |
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
where we have written many equivalent forms in terms of quantities defined in different frames.
Here
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
where
The quantity we pass as frame_components_of_grid_shift is
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 [91].
horizon_00 | The |
dt_horizon_00 | The |
lambda_00 | The |
dt_lambda_00 | The |
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.