SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Executables/ScalarTensor - EvolveScalarTensorSingleBlackHole.hpp Hit Total Coverage
Commit: c428a3e2e0ca78fe0364ec1b0e0493c627d428d4 Lines: 0 46 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 <vector>
       8             : 
       9             : #include "ControlSystem/Actions/InitializeMeasurements.hpp"
      10             : #include "ControlSystem/CleanFunctionsOfTime.hpp"
      11             : #include "ControlSystem/Component.hpp"
      12             : #include "ControlSystem/ControlErrors/Size/Factory.hpp"
      13             : #include "ControlSystem/ControlErrors/Size/State.hpp"
      14             : #include "ControlSystem/Measurements/SingleHorizon.hpp"
      15             : #include "ControlSystem/Metafunctions.hpp"
      16             : #include "ControlSystem/Systems/Shape.hpp"
      17             : #include "ControlSystem/Systems/Size.hpp"
      18             : #include "ControlSystem/Systems/Translation.hpp"
      19             : #include "ControlSystem/Trigger.hpp"
      20             : #include "Domain/Structure/ObjectLabel.hpp"
      21             : #include "Evolution/Actions/RunEventsAndTriggers.hpp"
      22             : #include "Evolution/Executables/ScalarTensor/ScalarTensorBase.hpp"
      23             : #include "Evolution/Systems/Cce/Callbacks/DumpBondiSachsOnWorldtube.hpp"
      24             : #include "Evolution/Systems/ScalarTensor/Actions/SetInitialData.hpp"
      25             : #include "Options/FactoryHelpers.hpp"
      26             : #include "Options/Protocols/FactoryCreation.hpp"
      27             : #include "Options/String.hpp"
      28             : #include "Parallel/MemoryMonitor/MemoryMonitor.hpp"
      29             : #include "Parallel/PhaseControl/ExecutePhaseChange.hpp"
      30             : #include "ParallelAlgorithms/Actions/FunctionsOfTimeAreReady.hpp"
      31             : #include "ParallelAlgorithms/Actions/MutateApply.hpp"
      32             : #include "ParallelAlgorithms/ApparentHorizonFinder/Callbacks/FailedHorizonFind.hpp"
      33             : #include "ParallelAlgorithms/ApparentHorizonFinder/Callbacks/ObserveCenters.hpp"
      34             : #include "ParallelAlgorithms/ApparentHorizonFinder/Callbacks/ObserveFieldsOnHorizon.hpp"
      35             : #include "ParallelAlgorithms/ApparentHorizonFinder/Callbacks/ObserveTimeSeriesOnHorizon.hpp"
      36             : #include "ParallelAlgorithms/ApparentHorizonFinder/Component.hpp"
      37             : #include "ParallelAlgorithms/ApparentHorizonFinder/Criteria/Criterion.hpp"
      38             : #include "ParallelAlgorithms/ApparentHorizonFinder/Criteria/Factory.hpp"
      39             : #include "ParallelAlgorithms/ApparentHorizonFinder/Events/FindApparentHorizon.hpp"
      40             : #include "ParallelAlgorithms/ApparentHorizonFinder/HorizonAliases.hpp"
      41             : #include "ParallelAlgorithms/ApparentHorizonFinder/Protocols/HorizonMetavars.hpp"
      42             : #include "ParallelAlgorithms/EventsAndTriggers/Actions/RunEventsOnFailure.hpp"
      43             : #include "ParallelAlgorithms/Interpolation/Actions/ElementInitInterpPoints.hpp"
      44             : #include "ParallelAlgorithms/Interpolation/Actions/InitializeInterpolationTarget.hpp"
      45             : #include "ParallelAlgorithms/Interpolation/Callbacks/ObserveSurfaceData.hpp"
      46             : #include "ParallelAlgorithms/Interpolation/Callbacks/ObserveTimeSeriesOnSurface.hpp"
      47             : #include "ParallelAlgorithms/Interpolation/ComputeExcisionBoundaryVolumeQuantities.hpp"
      48             : #include "ParallelAlgorithms/Interpolation/ComputeExcisionBoundaryVolumeQuantities.tpp"
      49             : #include "ParallelAlgorithms/Interpolation/Events/InterpolateWithoutInterpComponent.hpp"
      50             : #include "ParallelAlgorithms/Interpolation/InterpolationTarget.hpp"
      51             : #include "ParallelAlgorithms/Interpolation/Protocols/InterpolationTargetTag.hpp"
      52             : #include "ParallelAlgorithms/Interpolation/Tags.hpp"
      53             : #include "ParallelAlgorithms/Interpolation/Targets/Sphere.hpp"
      54             : #include "PointwiseFunctions/GeneralRelativity/DetAndInverseSpatialMetric.hpp"
      55             : #include "PointwiseFunctions/GeneralRelativity/Surfaces/Tags.hpp"
      56             : #include "Time/Actions/SelfStartActions.hpp"
      57             : #include "Time/AdvanceTime.hpp"
      58             : #include "Time/ChangeSlabSize/Action.hpp"
      59             : #include "Time/ChangeSlabSize/Tags.hpp"
      60             : #include "Time/StepChoosers/Factory.hpp"
      61             : #include "Time/Tags/StepperErrors.hpp"
      62             : #include "Time/Tags/Time.hpp"
      63             : #include "Utilities/Algorithm.hpp"
      64             : #include "Utilities/ErrorHandling/Error.hpp"
      65             : #include "Utilities/PrettyType.hpp"
      66             : #include "Utilities/ProtocolHelpers.hpp"
      67             : 
      68             : struct EvolutionMetavars : public ScalarTensorTemplateBase<EvolutionMetavars> {
      69           0 :   using st_base = ScalarTensorTemplateBase<EvolutionMetavars>;
      70             :   using typename st_base::initialize_initial_data_dependent_quantities_actions;
      71             :   using typename st_base::system;
      72             : 
      73             :   static constexpr size_t volume_dim = 3_st;
      74             : 
      75             :   static constexpr Options::String help{
      76             :       "Evolve the Einstein field equations in GH gauge coupled to a scalar "
      77             :       "field \n"
      78             :       "on a domain with a single horizon and corresponding excised region"};
      79             : 
      80             :   struct ApparentHorizon : tt::ConformsTo<ah::protocols::HorizonMetavars> {
      81           0 :     using time_tag = ah::Tags::ObservationTime<0>;
      82             : 
      83           0 :     using frame = ::Frame::Distorted;
      84             : 
      85           0 :     using horizon_find_callbacks = tmpl::list<
      86             :         ah::callbacks::ObserveTimeSeriesOnHorizon<
      87             :             ::ah::tags_for_observing<Frame::Distorted>, ApparentHorizon>,
      88             :         ah::callbacks::ObserveFieldsOnHorizon<::ah::surface_tags_for_observing,
      89             :                                               ApparentHorizon>>;
      90           0 :     using horizon_find_failure_callbacks =
      91             :         tmpl::list<ah::callbacks::FailedHorizonFind<ApparentHorizon, false>>;
      92             : 
      93           0 :     using compute_tags_on_element =
      94             :         tmpl::list<ah::Tags::ObservationTimeCompute<0>>;
      95             : 
      96             :     static constexpr ah::Destination destination = ah::Destination::Observation;
      97             : 
      98           0 :     static std::string name() { return "ApparentHorizon"; }
      99             :   };
     100             : 
     101           0 :   struct ExcisionBoundaryA
     102             :       : tt::ConformsTo<intrp::protocols::InterpolationTargetTag> {
     103           0 :     using temporal_id = ::Tags::Time;
     104           0 :     using tags_to_observe =
     105             :         tmpl::list<gr::Tags::Lapse<DataVector>,
     106             :                    gr::Tags::Shift<DataVector, 3, Frame::Grid>>;
     107           0 :     using compute_vars_to_interpolate =
     108             :         intrp::ComputeExcisionBoundaryVolumeQuantities;
     109           0 :     using vars_to_interpolate_to_target = tags_to_observe;
     110           0 :     using compute_items_on_source = tmpl::list<>;
     111           0 :     using compute_items_on_target = tmpl::list<>;
     112           0 :     using compute_target_points =
     113             :         intrp::TargetPoints::Sphere<ExcisionBoundaryA, ::Frame::Grid>;
     114           0 :     using post_interpolation_callbacks =
     115             :         tmpl::list<intrp::callbacks::ObserveSurfaceData<
     116             :             tags_to_observe, ExcisionBoundaryA, ::Frame::Grid>>;
     117             :     // run_callbacks
     118             :     template <typename metavariables>
     119           0 :     using interpolating_component = typename metavariables::st_dg_element_array;
     120             :   };
     121             : 
     122             :   struct SphericalSurface
     123             :       : tt::ConformsTo<intrp::protocols::InterpolationTargetTag> {
     124           0 :     using temporal_id = ::Tags::Time;
     125             : 
     126           0 :     using vars_to_interpolate_to_target =
     127             :         detail::ObserverTags::scalar_charge_vars_to_interpolate_to_target;
     128           0 :     using compute_items_on_target =
     129             :         detail::ObserverTags::scalar_charge_compute_items_on_target;
     130           0 :     using compute_target_points =
     131             :         intrp::TargetPoints::Sphere<SphericalSurface, ::Frame::Inertial>;
     132           0 :     using post_interpolation_callbacks =
     133             :         tmpl::list<intrp::callbacks::ObserveTimeSeriesOnSurface<
     134             :             detail::ObserverTags::scalar_charge_surface_obs_tags,
     135             :             SphericalSurface>>;
     136             :     template <typename metavariables>
     137           0 :     using interpolating_component = typename metavariables::st_dg_element_array;
     138             :   };
     139             : 
     140           0 :   using control_systems =
     141             :       tmpl::list<control_system::Systems::Shape<
     142             :                      ::domain::ObjectLabel::None, 2,
     143             :                      control_system::measurements::SingleHorizon<
     144             :                          ::domain::ObjectLabel::None>>,
     145             :                  control_system::Systems::Translation<
     146             :                      2,
     147             :                      control_system::measurements::SingleHorizon<
     148             :                          ::domain::ObjectLabel::None>,
     149             :                      1>,
     150             :                  control_system::Systems::Size<::domain::ObjectLabel::None, 2>>;
     151             : 
     152             :   static constexpr bool use_control_systems =
     153             :       tmpl::size<control_systems>::value > 0;
     154             : 
     155             :   struct BondiSachs;
     156             : 
     157           0 :   using interpolation_target_tags = tmpl::push_back<
     158             :       control_system::metafunctions::interpolation_target_tags<control_systems>,
     159             :       ExcisionBoundaryA, SphericalSurface, BondiSachs>;
     160             : 
     161           0 :   using scalar_charge_interpolator_source_vars =
     162             :       detail::ObserverTags::scalar_charge_vars_to_interpolate_to_target;
     163           0 :   using source_vars_no_deriv = tmpl::list<
     164             :       gr::Tags::SpacetimeMetric<DataVector, volume_dim>,
     165             :       gh::Tags::Pi<DataVector, volume_dim>,
     166             :       gh::Tags::Phi<DataVector, volume_dim>, CurvedScalarWave::Tags::Psi,
     167             :       CurvedScalarWave::Tags::Pi, CurvedScalarWave::Tags::Phi<volume_dim>,
     168             :       gr::Tags::Lapse<DataVector>, gr::Tags::Shift<DataVector, volume_dim>>;
     169             : 
     170             :   struct BondiSachs : tt::ConformsTo<intrp::protocols::InterpolationTargetTag> {
     171           0 :     static std::string name() { return "BondiSachsInterpolation"; }
     172           0 :     using temporal_id = ::Tags::Time;
     173           0 :     using vars_to_interpolate_to_target = source_vars_no_deriv;
     174           0 :     using compute_target_points =
     175             :         intrp::TargetPoints::Sphere<BondiSachs, ::Frame::Inertial>;
     176           0 :     using post_interpolation_callbacks = tmpl::list<
     177             :         intrp::callbacks::DumpBondiSachsOnWorldtube<BondiSachs, true>>;
     178           0 :     using compute_items_on_target = tmpl::list<>;
     179             :     template <typename Metavariables>
     180           0 :     using interpolating_component = typename Metavariables::st_dg_element_array;
     181             :   };
     182             :   // The interpolator_source_vars need to be the same in both the
     183             :   // Interpolate event and the InterpolateWithoutInterpComponent event.  The
     184             :   // Interpolate event interpolates to the horizon, and the
     185             :   // InterpolateWithoutInterpComponent event interpolates to the excision
     186             :   // boundary. Every Target gets the same interpolator_source_vars, so they need
     187             :   // to be made the same. Otherwise a static assert is triggered.
     188             :   struct factory_creation
     189             :       : tt::ConformsTo<Options::protocols::FactoryCreation> {
     190           0 :     using factory_classes = Options::add_factory_classes<
     191             :         // Restrict to monotonic time steppers in LTS to avoid control
     192             :         // systems deadlocking.
     193             :         tmpl::insert<
     194             :             tmpl::erase<typename st_base::factory_creation::factory_classes,
     195             :                         LtsTimeStepper>,
     196             :             tmpl::pair<LtsTimeStepper,
     197             :                        TimeSteppers::monotonic_lts_time_steppers>>,
     198             :         tmpl::pair<ah::Criterion, ah::Criteria::standard_criteria>,
     199             :         tmpl::pair<
     200             :             Event,
     201             :             tmpl::flatten<tmpl::list<
     202             :                 ah::Events::FindApparentHorizon<ApparentHorizon>,
     203             :                 intrp::Events::InterpolateWithoutInterpComponent<
     204             :                     3, BondiSachs, source_vars_no_deriv>,
     205             :                 control_system::metafunctions::control_system_events<
     206             :                     control_systems>,
     207             :                 control_system::CleanFunctionsOfTime,
     208             :                 intrp::Events::InterpolateWithoutInterpComponent<
     209             :                     volume_dim, ExcisionBoundaryA, ah::source_vars<volume_dim>>,
     210             :                 intrp::Events::InterpolateWithoutInterpComponent<
     211             :                     volume_dim, SphericalSurface,
     212             :                     scalar_charge_interpolator_source_vars>>>>,
     213             :         tmpl::pair<DenseTrigger,
     214             :                    control_system::control_system_triggers<control_systems>>,
     215             :         tmpl::pair<control_system::size::State,
     216             :                    control_system::size::States::factory_creatable_states>>;
     217             :   };
     218             : 
     219             :   using typename st_base::const_global_cache_tags;
     220             : 
     221           0 :   using observed_reduction_data_tags = observers::collect_reduction_data_tags<
     222             :       tmpl::at<typename factory_creation::factory_classes, Event>>;
     223             : 
     224           0 :   using dg_registration_list = typename st_base::dg_registration_list;
     225             : 
     226           0 :   using step_actions = typename st_base::template step_actions<control_systems>;
     227             : 
     228           0 :   using initialization_actions = tmpl::push_back<
     229             :       tmpl::pop_back<typename st_base::template initialization_actions<
     230             :           use_control_systems>>,
     231             :       control_system::Actions::InitializeMeasurements<control_systems>,
     232             :       intrp::Actions::ElementInitInterpPoints<volume_dim,
     233             :                                               interpolation_target_tags>,
     234             :       tmpl::back<typename st_base::template initialization_actions<
     235             :           use_control_systems>>>;
     236             : 
     237           0 :   using st_dg_element_array = DgElementArray<
     238             :       EvolutionMetavars,
     239             :       tmpl::flatten<tmpl::list<
     240             :           Parallel::PhaseActions<Parallel::Phase::Initialization,
     241             :                                  initialization_actions>,
     242             :           Parallel::PhaseActions<
     243             :               Parallel::Phase::RegisterWithElementDataReader,
     244             :               tmpl::list<importers::Actions::RegisterWithElementDataReader,
     245             :                          Parallel::Actions::TerminatePhase>>,
     246             :           Parallel::PhaseActions<
     247             :               Parallel::Phase::ImportInitialData,
     248             :               tmpl::list<ScalarTensor::Actions::SetInitialData,
     249             :                          ScalarTensor::Actions::ReceiveNumericInitialData,
     250             :                          Parallel::Actions::TerminatePhase>>,
     251             :           Parallel::PhaseActions<
     252             :               Parallel::Phase::InitializeInitialDataDependentQuantities,
     253             :               initialize_initial_data_dependent_quantities_actions>,
     254             :           Parallel::PhaseActions<
     255             :               Parallel::Phase::InitializeTimeStepperHistory,
     256             :               SelfStart::self_start_procedure<step_actions, system>>,
     257             :           Parallel::PhaseActions<Parallel::Phase::Register,
     258             :                                  tmpl::list<dg_registration_list,
     259             :                                             Parallel::Actions::TerminatePhase>>,
     260             :           Parallel::PhaseActions<Parallel::Phase::Restart,
     261             :                                  tmpl::list<dg_registration_list,
     262             :                                             Parallel::Actions::TerminatePhase>>,
     263             :           Parallel::PhaseActions<
     264             :               Parallel::Phase::WriteCheckpoint,
     265             :               tmpl::list<evolution::Actions::RunEventsAndTriggers<
     266             :                              Triggers::WhenToCheck::AtCheckpoints>,
     267             :                          Parallel::Actions::TerminatePhase>>,
     268             :           Parallel::PhaseActions<
     269             :               Parallel::Phase::Evolve,
     270             :               tmpl::flatten<tmpl::list<
     271             :                   ::domain::Actions::CheckFunctionsOfTimeAreReady<volume_dim>,
     272             :                   std::conditional_t<local_time_stepping,
     273             :                                      evolution::Actions::RunEventsAndTriggers<
     274             :                                          Triggers::WhenToCheck::AtSteps>,
     275             :                                      tmpl::list<>>,
     276             :                   evolution::Actions::RunEventsAndTriggers<
     277             :                       Triggers::WhenToCheck::AtSlabs>,
     278             :                   Actions::ChangeSlabSize, step_actions,
     279             :                   Actions::MutateApply<AdvanceTime<>>,
     280             :                   PhaseControl::Actions::ExecutePhaseChange>>>,
     281             :           Parallel::PhaseActions<
     282             :               Parallel::Phase::PostFailureCleanup,
     283             :               tmpl::list<Actions::RunEventsOnFailure<::Tags::Time>,
     284             :                          Parallel::Actions::TerminatePhase>>>>>;
     285             : 
     286             :   // ControlSystem/Measurements/CharSpeed.hpp assumes gh_dg_element_array
     287           0 :   using gh_dg_element_array = st_dg_element_array;
     288             : 
     289             :   template <typename ParallelComponent>
     290           0 :   struct registration_list {
     291           0 :     using type = std::conditional_t<
     292             :         std::is_same_v<ParallelComponent, st_dg_element_array>,
     293             :         dg_registration_list, tmpl::list<>>;
     294             :   };
     295             : 
     296           0 :   using control_system_horizon_metavars =
     297             :       control_system::metafunctions::horizon_metavars<control_systems>;
     298             : 
     299           0 :   using component_list = tmpl::flatten<tmpl::list<
     300             :       observers::Observer<EvolutionMetavars>,
     301             :       observers::ObserverWriter<EvolutionMetavars>,
     302             :       mem_monitor::MemoryMonitor<EvolutionMetavars>,
     303             :       importers::ElementDataReader<EvolutionMetavars>, st_dg_element_array,
     304             :       ah::Component<EvolutionMetavars, ApparentHorizon>,
     305             :       tmpl::transform<
     306             :           control_system_horizon_metavars,
     307             :           tmpl::bind<ah::Component, tmpl::pin<EvolutionMetavars>, tmpl::_1>>,
     308             :       control_system::control_components<EvolutionMetavars, control_systems>,
     309             :       tmpl::transform<interpolation_target_tags,
     310             :                       tmpl::bind<intrp::InterpolationTarget,
     311             :                                  tmpl::pin<EvolutionMetavars>, tmpl::_1>>>>;
     312             : };

Generated by: LCOV version 1.14