SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Executables/GeneralizedHarmonic - EvolveGhSingleBlackHole.hpp Hit Total Coverage
Commit: c428a3e2e0ca78fe0364ec1b0e0493c627d428d4 Lines: 0 42 0.0 %
Date: 2026-04-26 20:20:36
Legend: Lines: hit not hit

          Line data    Source code
       1           0 : // Distributed under the MIT License.
       2             : // See LICENSE.txt for details.
       3             : 
       4             : #pragma once
       5             : 
       6             : #include <cstdint>
       7             : #include <string>
       8             : #include <vector>
       9             : 
      10             : #include "ControlSystem/Actions/InitializeMeasurements.hpp"
      11             : #include "ControlSystem/CleanFunctionsOfTime.hpp"
      12             : #include "ControlSystem/Component.hpp"
      13             : #include "ControlSystem/ControlErrors/Size/Factory.hpp"
      14             : #include "ControlSystem/ControlErrors/Size/State.hpp"
      15             : #include "ControlSystem/Measurements/SingleHorizon.hpp"
      16             : #include "ControlSystem/Metafunctions.hpp"
      17             : #include "ControlSystem/Systems/Shape.hpp"
      18             : #include "ControlSystem/Systems/Size.hpp"
      19             : #include "ControlSystem/Systems/Translation.hpp"
      20             : #include "ControlSystem/Trigger.hpp"
      21             : #include "DataStructures/Tensor/IndexType.hpp"
      22             : #include "Domain/Structure/ObjectLabel.hpp"
      23             : #include "Evolution/Actions/RunEventsAndTriggers.hpp"
      24             : #include "Evolution/Executables/GeneralizedHarmonic/Deadlock.hpp"
      25             : #include "Evolution/Executables/GeneralizedHarmonic/GeneralizedHarmonicBase.hpp"
      26             : #include "Evolution/Systems/Cce/Callbacks/DumpBondiSachsOnWorldtube.hpp"
      27             : #include "Evolution/Systems/GeneralizedHarmonic/Actions/SetInitialData.hpp"
      28             : #include "Options/FactoryHelpers.hpp"
      29             : #include "Options/Protocols/FactoryCreation.hpp"
      30             : #include "Options/String.hpp"
      31             : #include "Parallel/ArrayCollection/DgElementCollection.hpp"
      32             : #include "Parallel/GlobalCache.hpp"
      33             : #include "Parallel/Invoke.hpp"
      34             : #include "Parallel/MemoryMonitor/MemoryMonitor.hpp"
      35             : #include "Parallel/PhaseControl/ExecutePhaseChange.hpp"
      36             : #include "Parallel/Protocols/RegistrationMetavariables.hpp"
      37             : #include "ParallelAlgorithms/Actions/FunctionsOfTimeAreReady.hpp"
      38             : #include "ParallelAlgorithms/Actions/MutateApply.hpp"
      39             : #include "ParallelAlgorithms/Amr/Events/ObserveAmrCriteria.hpp"
      40             : #include "ParallelAlgorithms/Amr/Events/ObserveAmrStats.hpp"
      41             : #include "ParallelAlgorithms/Amr/Events/RefineMesh.hpp"
      42             : #include "ParallelAlgorithms/Amr/Projectors/CopyFromCreatorOrLeaveAsIs.hpp"
      43             : #include "ParallelAlgorithms/ApparentHorizonFinder/Callbacks/FailedHorizonFind.hpp"
      44             : #include "ParallelAlgorithms/ApparentHorizonFinder/Callbacks/ObserveFieldsOnHorizon.hpp"
      45             : #include "ParallelAlgorithms/ApparentHorizonFinder/Callbacks/ObserveTimeSeriesOnHorizon.hpp"
      46             : #include "ParallelAlgorithms/ApparentHorizonFinder/Component.hpp"
      47             : #include "ParallelAlgorithms/ApparentHorizonFinder/Criteria/Criterion.hpp"
      48             : #include "ParallelAlgorithms/ApparentHorizonFinder/Criteria/Factory.hpp"
      49             : #include "ParallelAlgorithms/ApparentHorizonFinder/Events/FindApparentHorizon.hpp"
      50             : #include "ParallelAlgorithms/ApparentHorizonFinder/HorizonAliases.hpp"
      51             : #include "ParallelAlgorithms/ApparentHorizonFinder/Protocols/HorizonMetavars.hpp"
      52             : #include "ParallelAlgorithms/EventsAndTriggers/Actions/RunEventsOnFailure.hpp"
      53             : #include "ParallelAlgorithms/Interpolation/Actions/ElementInitInterpPoints.hpp"
      54             : #include "ParallelAlgorithms/Interpolation/Actions/InitializeInterpolationTarget.hpp"
      55             : #include "ParallelAlgorithms/Interpolation/Callbacks/ObserveSurfaceData.hpp"
      56             : #include "ParallelAlgorithms/Interpolation/Callbacks/ObserveTimeSeriesOnSurface.hpp"
      57             : #include "ParallelAlgorithms/Interpolation/ComputeExcisionBoundaryVolumeQuantities.hpp"
      58             : #include "ParallelAlgorithms/Interpolation/ComputeExcisionBoundaryVolumeQuantities.tpp"
      59             : #include "ParallelAlgorithms/Interpolation/Events/InterpolateWithoutInterpComponent.hpp"
      60             : #include "ParallelAlgorithms/Interpolation/InterpolationTarget.hpp"
      61             : #include "ParallelAlgorithms/Interpolation/Protocols/InterpolationTargetTag.hpp"
      62             : #include "ParallelAlgorithms/Interpolation/Tags.hpp"
      63             : #include "ParallelAlgorithms/Interpolation/Targets/Sphere.hpp"
      64             : #include "PointwiseFunctions/GeneralRelativity/DetAndInverseSpatialMetric.hpp"
      65             : #include "PointwiseFunctions/GeneralRelativity/Surfaces/Tags.hpp"
      66             : #include "Time/Actions/SelfStartActions.hpp"
      67             : #include "Time/AdvanceTime.hpp"
      68             : #include "Time/ChangeSlabSize/Action.hpp"
      69             : #include "Time/ChangeSlabSize/Tags.hpp"
      70             : #include "Time/StepChoosers/Factory.hpp"
      71             : #include "Time/Tags/StepperErrors.hpp"
      72             : #include "Time/Tags/Time.hpp"
      73             : #include "Time/Tags/TimeAndPrevious.hpp"
      74             : #include "Utilities/Algorithm.hpp"
      75             : #include "Utilities/ErrorHandling/Error.hpp"
      76             : #include "Utilities/PrettyType.hpp"
      77             : #include "Utilities/ProtocolHelpers.hpp"
      78             : 
      79             : template <bool UseLts>
      80             : struct EvolutionMetavars : public GeneralizedHarmonicTemplateBase<3, UseLts> {
      81             :   static constexpr bool local_time_stepping = UseLts;
      82             :   static constexpr size_t volume_dim = 3;
      83           0 :   using gh_base = GeneralizedHarmonicTemplateBase<volume_dim, UseLts>;
      84             :   using typename gh_base::initialize_initial_data_dependent_quantities_actions;
      85             :   using typename gh_base::system;
      86             : 
      87             :   static constexpr Options::String help{
      88             :       "Evolve the Einstein field equations using the Generalized Harmonic "
      89             :       "formulation,\n"
      90             :       "on a domain with a single horizon and corresponding excised region"};
      91             : 
      92           0 :   struct ApparentHorizon : tt::ConformsTo<ah::protocols::HorizonMetavars> {
      93           0 :     using time_tag = ah::Tags::ObservationTime<0>;
      94             : 
      95           0 :     using frame = ::Frame::Inertial;
      96             : 
      97           0 :     using horizon_find_callbacks = tmpl::list<
      98             :         ah::callbacks::ObserveTimeSeriesOnHorizon<
      99             :             ::ah::tags_for_observing<Frame::Inertial>, ApparentHorizon>,
     100             :         ah::callbacks::ObserveFieldsOnHorizon<::ah::surface_tags_for_observing,
     101             :                                               ApparentHorizon>>;
     102           0 :     using horizon_find_failure_callbacks =
     103             :         tmpl::list<ah::callbacks::FailedHorizonFind<ApparentHorizon, false>>;
     104             : 
     105           0 :     using compute_tags_on_element =
     106             :         tmpl::list<ah::Tags::ObservationTimeCompute<0>>;
     107             : 
     108           0 :     static constexpr ah::Destination destination = ah::Destination::Observation;
     109             : 
     110           0 :     static std::string name() { return "ApparentHorizon"; }
     111             :   };
     112             : 
     113             :   struct ExcisionBoundary
     114             :       : tt::ConformsTo<intrp::protocols::InterpolationTargetTag> {
     115           0 :     using temporal_id = ::Tags::Time;
     116           0 :     using tags_to_observe =
     117             :         tmpl::list<gr::Tags::Lapse<DataVector>,
     118             :                    gr::Tags::Shift<DataVector, 3, Frame::Grid>>;
     119           0 :     using compute_vars_to_interpolate =
     120             :         intrp::ComputeExcisionBoundaryVolumeQuantities;
     121           0 :     using vars_to_interpolate_to_target = tags_to_observe;
     122           0 :     using compute_items_on_source = tmpl::list<>;
     123           0 :     using compute_items_on_target = tmpl::list<>;
     124           0 :     using compute_target_points =
     125             :         intrp::TargetPoints::Sphere<ExcisionBoundary, ::Frame::Grid>;
     126           0 :     using post_interpolation_callbacks =
     127             :         tmpl::list<intrp::callbacks::ObserveSurfaceData<
     128             :             tags_to_observe, ExcisionBoundary, ::Frame::Grid>>;
     129             :     // run_callbacks
     130             :     template <typename metavariables>
     131           0 :     using interpolating_component = typename metavariables::gh_dg_element_array;
     132             :   };
     133             : 
     134           0 :   using control_systems =
     135             :       tmpl::list<control_system::Systems::Shape<
     136             :                      ::domain::ObjectLabel::None, 2,
     137             :                      control_system::measurements::SingleHorizon<
     138             :                          ::domain::ObjectLabel::None>>,
     139             :                  control_system::Systems::Translation<
     140             :                      2,
     141             :                      control_system::measurements::SingleHorizon<
     142             :                          ::domain::ObjectLabel::None>,
     143             :                      1>,
     144             :                  control_system::Systems::Size<::domain::ObjectLabel::None, 2>>;
     145             : 
     146             :   static constexpr bool use_control_systems =
     147             :       tmpl::size<control_systems>::value > 0;
     148             : 
     149             :   struct BondiSachs;
     150             : 
     151           0 :   using interpolation_target_tags = tmpl::push_back<
     152             :       control_system::metafunctions::interpolation_target_tags<control_systems>,
     153             :       ExcisionBoundary, BondiSachs>;
     154           0 :   using source_vars_no_deriv =
     155             :       tmpl::list<gr::Tags::SpacetimeMetric<DataVector, volume_dim>,
     156             :                  gh::Tags::Pi<DataVector, volume_dim>,
     157             :                  gh::Tags::Phi<DataVector, volume_dim>>;
     158             : 
     159             :   struct BondiSachs : tt::ConformsTo<intrp::protocols::InterpolationTargetTag> {
     160           0 :     static std::string name() { return "BondiSachsInterpolation"; }
     161           0 :     using temporal_id = ::Tags::Time;
     162           0 :     using vars_to_interpolate_to_target = source_vars_no_deriv;
     163           0 :     using compute_target_points =
     164             :         intrp::TargetPoints::Sphere<BondiSachs, ::Frame::Inertial>;
     165           0 :     using post_interpolation_callbacks =
     166             :         tmpl::list<intrp::callbacks::DumpBondiSachsOnWorldtube<BondiSachs>>;
     167           0 :     using compute_items_on_target = tmpl::list<>;
     168             :     template <typename Metavariables>
     169           0 :     using interpolating_component = typename Metavariables::gh_dg_element_array;
     170             :   };
     171             : 
     172             :   // The interpolator_source_vars need to be the same in both the Interpolate
     173             :   // event and the InterpolateWithoutInterpComponent event.  The Interpolate
     174             :   // event interpolates to the horizon, and the
     175             :   // InterpolateWithoutInterpComponent event interpolates to the excision
     176             :   // boundary. Every Target gets the same interpolator_source_vars, so they need
     177             :   // to be made the same. Otherwise a static assert is triggered.
     178             :   struct factory_creation
     179             :       : tt::ConformsTo<Options::protocols::FactoryCreation> {
     180           0 :     using factory_classes = Options::add_factory_classes<
     181             :         // Restrict to monotonic time steppers in LTS to avoid control
     182             :         // systems deadlocking.
     183             :         tmpl::insert<
     184             :             tmpl::erase<typename gh_base::factory_creation::factory_classes,
     185             :                         LtsTimeStepper>,
     186             :             tmpl::pair<LtsTimeStepper,
     187             :                        TimeSteppers::monotonic_lts_time_steppers>>,
     188             :         tmpl::pair<ah::Criterion, ah::Criteria::standard_criteria>,
     189             :         tmpl::pair<Event,
     190             :                    tmpl::flatten<tmpl::list<
     191             :                        ah::Events::FindApparentHorizon<ApparentHorizon>,
     192             :                        control_system::metafunctions::control_system_events<
     193             :                            control_systems>,
     194             :                        control_system::CleanFunctionsOfTime,
     195             :                        intrp::Events::InterpolateWithoutInterpComponent<
     196             :                            3, BondiSachs, source_vars_no_deriv>,
     197             :                        intrp::Events::InterpolateWithoutInterpComponent<
     198             :                            3, ExcisionBoundary, ::ah::source_vars<volume_dim>>,
     199             :                        amr::Events::RefineMesh,
     200             :                        amr::Events::ObserveAmrStats<volume_dim>>>>,
     201             :         tmpl::pair<DenseTrigger,
     202             :                    control_system::control_system_triggers<control_systems>>,
     203             :         tmpl::pair<control_system::size::State,
     204             :                    control_system::size::States::factory_creatable_states>>;
     205             :   };
     206             : 
     207             :   using typename gh_base::const_global_cache_tags;
     208             : 
     209           0 :   using observed_reduction_data_tags =
     210             :       observers::collect_reduction_data_tags<tmpl::push_back<
     211             :           tmpl::at<typename factory_creation::factory_classes, Event>,
     212             :           typename ExcisionBoundary::post_interpolation_callbacks>>;
     213             : 
     214           0 :   using dg_registration_list = typename gh_base::dg_registration_list;
     215             : 
     216           0 :   using step_actions =
     217             :       typename gh_base::template step_actions<EvolutionMetavars,
     218             :                                               control_systems>;
     219             : 
     220           0 :   using initialization_actions = tmpl::push_back<
     221             :       tmpl::pop_back<typename gh_base::template initialization_actions<
     222             :           EvolutionMetavars, use_control_systems>>,
     223             :       control_system::Actions::InitializeMeasurements<control_systems>,
     224             :       intrp::Actions::ElementInitInterpPoints<volume_dim,
     225             :                                               interpolation_target_tags>,
     226             :       tmpl::back<typename gh_base::template initialization_actions<
     227             :           EvolutionMetavars, use_control_systems>>>;
     228             : 
     229           0 :   using gh_dg_element_array = DgElementArray<
     230             :       EvolutionMetavars,
     231             :       tmpl::flatten<tmpl::list<
     232             :           Parallel::PhaseActions<Parallel::Phase::Initialization,
     233             :                                  initialization_actions>,
     234             :           Parallel::PhaseActions<
     235             :               Parallel::Phase::RegisterWithElementDataReader,
     236             :               tmpl::list<importers::Actions::RegisterWithElementDataReader,
     237             :                          Parallel::Actions::TerminatePhase>>,
     238             :           Parallel::PhaseActions<
     239             :               Parallel::Phase::ImportInitialData,
     240             :               tmpl::list<gh::Actions::SetInitialData,
     241             :                          gh::Actions::ReceiveNumericInitialData,
     242             :                          Parallel::Actions::TerminatePhase>>,
     243             :           Parallel::PhaseActions<
     244             :               Parallel::Phase::InitializeInitialDataDependentQuantities,
     245             :               initialize_initial_data_dependent_quantities_actions>,
     246             :           Parallel::PhaseActions<
     247             :               Parallel::Phase::InitializeTimeStepperHistory,
     248             :               SelfStart::self_start_procedure<step_actions, system>>,
     249             :           Parallel::PhaseActions<Parallel::Phase::Register,
     250             :                                  tmpl::list<dg_registration_list,
     251             :                                             Parallel::Actions::TerminatePhase>>,
     252             :           Parallel::PhaseActions<Parallel::Phase::Restart,
     253             :                                  tmpl::list<dg_registration_list,
     254             :                                             Parallel::Actions::TerminatePhase>>,
     255             :           Parallel::PhaseActions<
     256             :               Parallel::Phase::WriteCheckpoint,
     257             :               tmpl::list<evolution::Actions::RunEventsAndTriggers<
     258             :                              Triggers::WhenToCheck::AtCheckpoints>,
     259             :                          Parallel::Actions::TerminatePhase>>,
     260             :           Parallel::PhaseActions<Parallel::Phase::CheckDomain,
     261             :                                  tmpl::list<::amr::Actions::SendAmrDiagnostics,
     262             :                                             Parallel::Actions::TerminatePhase>>,
     263             :           Parallel::PhaseActions<
     264             :               Parallel::Phase::Evolve,
     265             :               tmpl::flatten<tmpl::list<
     266             :                   ::domain::Actions::CheckFunctionsOfTimeAreReady<volume_dim>,
     267             :                   std::conditional_t<local_time_stepping,
     268             :                                      evolution::Actions::RunEventsAndTriggers<
     269             :                                          Triggers::WhenToCheck::AtSteps>,
     270             :                                      tmpl::list<>>,
     271             :                   evolution::Actions::RunEventsAndTriggers<
     272             :                       Triggers::WhenToCheck::AtSlabs>,
     273             :                   Actions::ChangeSlabSize, step_actions,
     274             :                   Actions::MutateApply<AdvanceTime<>>,
     275             :                   PhaseControl::Actions::ExecutePhaseChange>>>,
     276             :           Parallel::PhaseActions<
     277             :               Parallel::Phase::PostFailureCleanup,
     278             :               tmpl::list<Actions::RunEventsOnFailure<::Tags::Time>,
     279             :                          Parallel::Actions::TerminatePhase>>>>>;
     280             : 
     281             :   struct amr : tt::ConformsTo<::amr::protocols::AmrMetavariables> {
     282           0 :     using element_array = gh_dg_element_array;
     283           0 :     using projectors = tmpl::list<
     284             :         Initialization::ProjectTimeStepping<volume_dim>,
     285             :         evolution::dg::Initialization::ProjectDomain<volume_dim>,
     286             :         ::amr::projectors::ProjectVariables<volume_dim,
     287             :                                             typename system::variables_tag>,
     288             :         evolution::dg::Initialization::ProjectMortars<volume_dim,
     289             :                                                       local_time_stepping>,
     290             :         Initialization::ProjectTimeStepperHistory<EvolutionMetavars>,
     291             :         evolution::Actions::ProjectRunEventsAndDenseTriggers,
     292             :         ::amr::projectors::DefaultInitialize<
     293             :             Initialization::Tags::InitialTimeDelta,
     294             :             Initialization::Tags::InitialSlabSize<gh_base::local_time_stepping>,
     295             :             ::domain::Tags::InitialExtents<volume_dim>,
     296             :             ::domain::Tags::InitialRefinementLevels<volume_dim>,
     297             :             evolution::dg::Tags::Quadrature,
     298             :             Tags::StepperErrors<typename system::variables_tag>,
     299             :             SelfStart::Tags::InitialValue<typename system::variables_tag>,
     300             :             SelfStart::Tags::InitialValue<Tags::TimeStep>>,
     301             :         ::amr::projectors::CopyFromCreatorOrLeaveAsIs<tmpl::push_back<
     302             :             tmpl::append<
     303             :                 typename control_system::Actions::InitializeMeasurements<
     304             :                     control_systems>::simple_tags,
     305             :                 tmpl::transform<
     306             :                     intrp::InterpolationTarget_detail::
     307             :                         get_non_sequential_target_tags<
     308             :                             interpolation_target_tags>,
     309             :                     tmpl::bind<intrp::Tags::PointInfo, tmpl::_1,
     310             :                                tmpl::pin<tmpl::size_t<volume_dim>>>>>,
     311             :             Tags::ChangeSlabSize::NumberOfExpectedMessages,
     312             :             Tags::ChangeSlabSize::NewSlabSize>>>;
     313             :     static constexpr bool keep_coarse_grids = false;
     314             :     static constexpr bool p_refine_only_in_event = true;
     315             :   };
     316             : 
     317             :   struct registration
     318             :       : tt::ConformsTo<Parallel::protocols::RegistrationMetavariables> {
     319           0 :     using element_registrars =
     320             :         tmpl::map<tmpl::pair<gh_dg_element_array, dg_registration_list>>;
     321             :   };
     322             : 
     323           0 :   using control_system_horizon_metavars =
     324             :       control_system::metafunctions::horizon_metavars<control_systems>;
     325           0 :   using control_components =
     326             :       control_system::control_components<EvolutionMetavars, control_systems>;
     327             : 
     328           0 :   static void run_deadlock_analysis_simple_actions(
     329             :       Parallel::GlobalCache<EvolutionMetavars>& cache,
     330             :       const std::vector<std::string>& deadlocked_components) {
     331             :     gh::deadlock::run_deadlock_analysis_simple_actions<
     332             :         gh_dg_element_array, control_components, interpolation_target_tags,
     333             :         tmpl::list<ApparentHorizon>>(cache, deadlocked_components);
     334             :   }
     335             : 
     336           0 :   using component_list = tmpl::flatten<tmpl::list<
     337             :       ::amr::Component<EvolutionMetavars>,
     338             :       observers::Observer<EvolutionMetavars>,
     339             :       observers::ObserverWriter<EvolutionMetavars>,
     340             :       mem_monitor::MemoryMonitor<EvolutionMetavars>,
     341             :       importers::ElementDataReader<EvolutionMetavars>, gh_dg_element_array,
     342             :       ah::Component<EvolutionMetavars, ApparentHorizon>, control_components,
     343             :       tmpl::transform<
     344             :           control_system_horizon_metavars,
     345             :           tmpl::bind<ah::Component, tmpl::pin<EvolutionMetavars>, tmpl::_1>>,
     346             :       tmpl::transform<interpolation_target_tags,
     347             :                       tmpl::bind<intrp::InterpolationTarget,
     348             :                                  tmpl::pin<EvolutionMetavars>, tmpl::_1>>>>;
     349             : };

Generated by: LCOV version 1.14