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

Generated by: LCOV version 1.14