Skip to content

Commit

Permalink
Fix missing spherepack factors in size control
Browse files Browse the repository at this point in the history
  • Loading branch information
knelli2 committed Feb 15, 2024
1 parent a3c51e3 commit 79ee9ef
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/ControlSystem/ControlErrors/Size.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ double control_error_delta_r(const double horizon_00,
const double Y00 = 0.25 * M_2_SQRTPI;

// This corresponds to 'DeltaRPolicy=Relative' in SpEC.
// Notice that both horizon_00 and dt_horizon_00 are actually spherepack
// coefs, not spherical harmonic coefs. However, they only show up in this
// expression as a ratio, so the spherepack factor cancels out, thus we don't
// add it in here.
return dt_horizon_00 * (lambda_00 - grid_frame_excision_sphere_radius / Y00) /
horizon_00 -
dt_lambda_00;
Expand Down
13 changes: 10 additions & 3 deletions src/ControlSystem/ControlErrors/Size.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,10 @@ struct Size : tt::ConformsTo<protocols::ControlError> {
DataVector{time_deriv_apparent_horizon.coefficients()[0]}});
}

// This is needed because the horizon_00 (and dt) are spherepack coefs, not
// spherical harmonic coefs.
const double spherepack_factor = sqrt(0.5 * M_PI);

// This is needed for every state
const double control_error_delta_r = size::control_error_delta_r(
horizon_00, dt_horizon_00, lambda_00, dt_lambda_00,
Expand All @@ -404,7 +408,8 @@ struct Size : tt::ConformsTo<protocols::ControlError> {
? std::optional<double>(control_error_delta_r -
delta_r_drift_outward_options_.value()
.outward_drift_velocity -
(lambda_00 + horizon_00 -
(lambda_00 +
spherepack_factor * horizon_00 -
grid_frame_excision_sphere_radius / Y00) /
delta_r_drift_outward_options_.value()
.outward_drift_timescale)
Expand Down Expand Up @@ -436,8 +441,10 @@ struct Size : tt::ConformsTo<protocols::ControlError> {
// < R_ex > = R_ex^grid - \lambda_00 * Y_00
// < \Delta R > = \Delta R / < R_ah >
const double avg_delta_r =
(horizon_00 + lambda_00) * Y00 - grid_frame_excision_sphere_radius;
const double avg_relative_delta_r = avg_delta_r / (horizon_00 * Y00);
(spherepack_factor * horizon_00 + lambda_00) * Y00 -
grid_frame_excision_sphere_radius;
const double avg_relative_delta_r =
avg_delta_r / (spherepack_factor * horizon_00 * Y00);

Parallel::threaded_action<
observers::ThreadedActions::WriteReductionDataRow>(
Expand Down

0 comments on commit 79ee9ef

Please sign in to comment.