|
SpECTRE
v2025.08.19
|
Contains utilities for working with apparent horizons. More...
Namespaces | |
| namespace | callbacks |
| Callbacks used by the apparent horizon finder. | |
| namespace | Criteria |
| Criteria for deciding how resolution of an apparent horizon should be adapted. | |
| namespace | Tags |
| Tags for the apparent horizon finder. | |
Classes | |
| struct | Component |
| The singleton parallel component responsible for finding horizons. More... | |
| struct | ComputeExcisionBoundaryVolumeQuantities |
| Given the generalized harmonic variables in the volume, computes the quantities that will be interpolated onto an excision boundary. More... | |
| struct | ComputeHorizonVolumeQuantities |
| Given the generalized harmonic variables in the volume, computes the quantities that will be interpolated onto an apparent horizon. More... | |
| class | Criterion |
| Base class for criteria that determine how the resolution of an apparent horizon should be changed. More... | |
| struct | FindApparentHorizon |
| Simple action run on the horizon finder by the Elements which receives volume data, finds the apparent horizon, and calls the callbacks after the horizon is found. More... | |
| struct | HorizonOptions |
| Options for finding an apparent horizon. More... | |
| struct | Initialize |
| Initialize items related to the horizon finder. More... | |
Enumerations | |
| enum class | Destination { Observation , ControlSystem } |
| Label for what a horizon find will be used for. | |
Functions | |
| template<typename HorizonMetavars , typename DbTags , typename Metavariables > | |
| void | invoke_callbacks (const gsl::not_null< db::DataBox< DbTags > * > box, Parallel::GlobalCache< Metavariables > &cache, const std::optional< std::string > &dependency, const FastFlow::Status status) |
Invoke the callbacks specified in the horizon_find_callbacks alias of the HorizonMetavars. More... | |
| template<typename Fr > | |
| void | clean_up_horizon_finder (gsl::not_null< std::optional< LinkedMessageId< double > > * > current_time_optional, gsl::not_null< std::unordered_map< LinkedMessageId< double >, ah::Storage::SingleTimeStorage< Fr > > * > all_storage, gsl::not_null< std::set< LinkedMessageId< double > > * > completed_times, gsl::not_null< FastFlow * > fast_flow) |
| Cleans up the horizon finder after a horizon find has finished. More... | |
| template<typename Fr > | |
| bool | set_current_iteration_coords (gsl::not_null< ah::Storage::Iteration< Fr > * > current_iteration, gsl::not_null< std::vector< size_t > * > block_order, const LinkedMessageId< double > &time, const FastFlow &fast_flow, const ylm::Strahlkorper< Fr > &initial_guess, const ylm::Strahlkorper< Fr > &previous_iteration_surface, const std::deque< ah::Storage::PreviousSurface< Fr > > &previous_surfaces, size_t max_compute_coords_retries, const Domain< 3 > &domain, const domain::FunctionsOfTimeMap &functions_of_time, const std::optional< size_t > ¤t_resolution_l=std::nullopt, bool rerunning_with_higher_resolution=false) |
| Compute the target points for the current iteration. More... | |
| template<typename Fr > | |
| void | compute_vars_to_interpolate_to_target (gsl::not_null< Variables< ah::vars_to_interpolate_to_target< 3, Fr > > * > target_vars, const tnsr::aa< DataVector, 3 > &spacetime_metric, const tnsr::aa< DataVector, 3 > &pi, const tnsr::iaa< DataVector, 3 > &phi, const tnsr::ijaa< DataVector, 3 > &deriv_phi, const LinkedMessageId< double > &time, const Domain< 3 > &domain, const Mesh< 3 > &mesh, const ElementId< 3 > &element_id, const domain::FunctionsOfTimeMap &functions_of_time) |
Compute the ah::vars_to_interpolate_to_target for a given element_id from the ah::source_vars in that element. | |
| template<typename Fr > | |
| void | set_current_time (gsl::not_null< std::optional< LinkedMessageId< double > > * > current_time, gsl::not_null< std::set< LinkedMessageId< double > > * > pending_times, const std::set< LinkedMessageId< double > > &completed_times, const std::unordered_map< LinkedMessageId< double >, ah::Storage::SingleTimeStorage< Fr > > &all_storage, const ::Verbosity &verbosity, const std::string &name) |
| Determines what the current time should be. More... | |
| template<typename HorizonMetavars , typename Metavariables > | |
| bool | check_if_current_time_is_ready (const LinkedMessageId< double > ¤t_time, Parallel::GlobalCache< Metavariables > &cache, const LinkedMessageId< double > &incoming_time, const ElementId< 3 > &incoming_element_id, const ::Mesh< 3 > &incoming_mesh, const std::optional< std::string > &dependency) |
| Checks if the current time is ready. More... | |
| std::ostream & | operator<< (std::ostream &os, Destination destination) |
| template<typename Fr > | |
| bool | interpolate_volume_data (gsl::not_null< ah::Storage::Iteration< Fr > * > current_iteration_storage, const ah::Storage::VolumeVariables< Fr > &volume_vars_storage, const ElementId< 3 > &element_id) |
| Interpolate volume data from any new elements received by the horizon finder to the target points. More... | |
| template<typename Fr > | |
| bool | operator== (const HorizonOptions< Fr > &lhs, const HorizonOptions< Fr > &rhs) |
| template<typename Fr > | |
| bool | operator!= (const HorizonOptions< Fr > &lhs, const HorizonOptions< Fr > &rhs) |
Contains utilities for working with apparent horizons.
| bool ah::check_if_current_time_is_ready | ( | const LinkedMessageId< double > & | current_time, |
| Parallel::GlobalCache< Metavariables > & | cache, | ||
| const LinkedMessageId< double > & | incoming_time, | ||
| const ElementId< 3 > & | incoming_element_id, | ||
| const ::Mesh< 3 > & | incoming_mesh, | ||
| const std::optional< std::string > & | dependency | ||
| ) |
Checks if the current time is ready.
If the current time is after any expiration time, registers a callback for the ah::FindApparentHorizon action (but doesn't send the volume variables again because we already did that). Returns if the current time is ready or not.
| void ah::clean_up_horizon_finder | ( | gsl::not_null< std::optional< LinkedMessageId< double > > * > | current_time_optional, |
| gsl::not_null< std::unordered_map< LinkedMessageId< double >, ah::Storage::SingleTimeStorage< Fr > > * > | all_storage, | ||
| gsl::not_null< std::set< LinkedMessageId< double > > * > | completed_times, | ||
| gsl::not_null< FastFlow * > | fast_flow | ||
| ) |
Cleans up the horizon finder after a horizon find has finished.
Removes the current time from the storage map, adds the current time to the completed times, and then resets the current time. If the completed times have more than 1000 entries, this will limit the size to 1000.
| bool ah::interpolate_volume_data | ( | gsl::not_null< ah::Storage::Iteration< Fr > * > | current_iteration_storage, |
| const ah::Storage::VolumeVariables< Fr > & | volume_vars_storage, | ||
| const ElementId< 3 > & | element_id | ||
| ) |
Interpolate volume data from any new elements received by the horizon finder to the target points.
For each new element, the vars_to_interpolate_to_target in all_volume_variables are interpolated to the target points and stored in current_iteration_storage.
| void ah::invoke_callbacks | ( | const gsl::not_null< db::DataBox< DbTags > * > | box, |
| Parallel::GlobalCache< Metavariables > & | cache, | ||
| const std::optional< std::string > & | dependency, | ||
| const FastFlow::Status | status | ||
| ) |
Invoke the callbacks specified in the horizon_find_callbacks alias of the HorizonMetavars.
Before invoking the callbacks, this function
ah::Tags::PreviousSurfaces.dependency into the box. Also possibly computes the Inertial coordinates of the final Strahlkorper and stores them in the box if the frame of the HorizonMetavars isn't the Inertial frame. | bool ah::set_current_iteration_coords | ( | gsl::not_null< ah::Storage::Iteration< Fr > * > | current_iteration, |
| gsl::not_null< std::vector< size_t > * > | block_order, | ||
| const LinkedMessageId< double > & | time, | ||
| const FastFlow & | fast_flow, | ||
| const ylm::Strahlkorper< Fr > & | initial_guess, | ||
| const ylm::Strahlkorper< Fr > & | previous_iteration_surface, | ||
| const std::deque< ah::Storage::PreviousSurface< Fr > > & | previous_surfaces, | ||
| size_t | max_compute_coords_retries, | ||
| const Domain< 3 > & | domain, | ||
| const domain::FunctionsOfTimeMap & | functions_of_time, | ||
| const std::optional< size_t > & | current_resolution_l = std::nullopt, |
||
| bool | rerunning_with_higher_resolution = false |
||
| ) |
Compute the target points for the current iteration.
Returns whether the computation of the target points was successful or if there are some points outside the domain. If computation fails, one of two attempts to recover will happen:
\begin{equation} S^{\mathrm{new}}_{lm} = \frac{1}{2}\left(S^{\mathrm{previous}}_{lm} + S^{\mathrm{failed}}_{lm}\right) \end{equation}
where \(S^{\mathrm{failed}}_{lm}\) are the coefficients of the failed computation and \(S^{\mathrm{previous}}_{lm}\) are the coefficients from the previous successful iteration.This function will try recomputing the coords using the above two rules max_compute_coords_retries times before returning false.
| current_iteration | The returned pointer to the current Iteration object |
| block_order | Priority order to search blocks for containing points (see block_logical_coordinates for details) |
| time | The current time |
| fast_flow | The FastFlow object for the current horizon find |
| initial_guess | If the current iteration number is zero and rerunning_with_higher_resolution == false, current_iteration is set to this Strahlkorper |
| previous_iteration_surface | If empty, current_iteration is set to initial_guess; if one previous iteration, current_iteration is set to that previous iteration; if two previous iterations, current_iteration is set by linearly extrapolating in time the two pervious iterations; if three or more previous iterations, current_iteration is set by quadratic extrpolation of the three most recent iterations |
| previous_surfaces | Previously successful iteratios used to attempt to recover when some points are outside the domain. |
| max_compute_coords_retries | Retry up to this many times before returning false |
| domain | The spatial domain in which the horizon is being found |
| functions_of_time | The functions of time for the current domain |
| current_resolution_l | Optional; if specified, current_iteration is prolonged or restricted to this resolution |
| rerunning_with_higher_resolution | Must be false unless current_resolution_l is set; if true, then on iteration zero, set the initial guess to the previous iteration surface |
Returns: Whether or not set_current_iteration_coords succeeded
| void ah::set_current_time | ( | gsl::not_null< std::optional< LinkedMessageId< double > > * > | current_time, |
| gsl::not_null< std::set< LinkedMessageId< double > > * > | pending_times, | ||
| const std::set< LinkedMessageId< double > > & | completed_times, | ||
| const std::unordered_map< LinkedMessageId< double >, ah::Storage::SingleTimeStorage< Fr > > & | all_storage, | ||
| const ::Verbosity & | verbosity, | ||
| const std::string & | name | ||
| ) |
Determines what the current time should be.
If there's already a current time, or there are no pending times available, then there's nothing to do. Otherwise, checks if the first pending time is the next to use. If so, sets it as the current time and removes it from pending.