SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/Cce/Actions - InitializeWorldtubeBoundary.hpp Hit Total Coverage
Commit: 1f2210958b4f38fdc0400907ee7c6d5af5111418 Lines: 5 16 31.2 %
Date: 2025-12-05 05:03:31
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 <cstddef>
       7             : #include <optional>
       8             : #include <tuple>
       9             : #include <utility>
      10             : 
      11             : #include "DataStructures/DataBox/DataBox.hpp"
      12             : #include "DataStructures/VariablesTag.hpp"
      13             : #include "Evolution/Systems/Cce/AnalyticBoundaryDataManager.hpp"
      14             : #include "Evolution/Systems/Cce/AnalyticSolutions/RobinsonTrautman.hpp"
      15             : #include "Evolution/Systems/Cce/BoundaryData.hpp"
      16             : #include "Evolution/Systems/Cce/InterfaceManagers/GhInterfaceManager.hpp"
      17             : #include "Evolution/Systems/Cce/InterfaceManagers/GhLocalTimeStepping.hpp"
      18             : #include "Evolution/Systems/Cce/InterfaceManagers/GhLockstep.hpp"
      19             : #include "Evolution/Systems/Cce/OptionTags.hpp"
      20             : #include "Evolution/Systems/Cce/Tags.hpp"
      21             : #include "NumericalAlgorithms/Interpolation/SpanInterpolator.hpp"
      22             : #include "NumericalAlgorithms/SpinWeightedSphericalHarmonics/SwshCollocation.hpp"
      23             : #include "Parallel/AlgorithmExecution.hpp"
      24             : #include "Parallel/Invoke.hpp"
      25             : #include "ParallelAlgorithms/Initialization/MutateAssign.hpp"
      26             : #include "Time/Tags/TimeStepper.hpp"
      27             : #include "Time/TimeSteppers/LtsTimeStepper.hpp"
      28             : #include "Time/TimeSteppers/TimeStepper.hpp"
      29             : #include "Utilities/Gsl.hpp"
      30             : #include "Utilities/MakeString.hpp"
      31             : #include "Utilities/Requires.hpp"
      32             : #include "Utilities/TMPL.hpp"
      33             : #include "Utilities/TaggedTuple.hpp"
      34             : 
      35             : namespace Cce {
      36             : /// \cond
      37             : template <typename Metavariables>
      38             : struct H5WorldtubeBoundary;
      39             : template <typename Metavariables>
      40             : struct AnalyticWorldtubeBoundary;
      41             : template <typename Metavariables>
      42             : struct KleinGordonH5WorldtubeBoundary;
      43             : template <typename Metavariables>
      44             : struct GhWorldtubeBoundary;
      45             : /// \endcond
      46             : namespace Actions {
      47             : 
      48             : namespace detail {
      49             : template <typename Initializer, typename ManagerTags,
      50             :           typename... BoundaryCommunicationTagsList>
      51             : struct InitializeWorldtubeBoundaryBase {
      52             :   using simple_tags_from_options = ManagerTags;
      53             :   using const_global_cache_tags = tmpl::list<Tags::LMax>;
      54             : 
      55             :   using simple_tags =
      56             :       tmpl::list<::Tags::Variables<BoundaryCommunicationTagsList>...>;
      57             : 
      58             :   template <typename DataBoxTagsList, typename... InboxTags,
      59             :             typename ArrayIndex, typename Metavariables, typename ActionList,
      60             :             typename ParallelComponent>
      61             :   static Parallel::iterable_action_return_t apply(
      62             :       db::DataBox<DataBoxTagsList>& box,
      63             :       const tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
      64             :       const Parallel::GlobalCache<Metavariables>& /*cache*/,
      65             :       const ArrayIndex& /*array_index*/, const ActionList /*meta*/,
      66             :       const ParallelComponent* const /*meta*/) {
      67             :     if constexpr (std::is_same_v<Tags::AnalyticBoundaryDataManager,
      68             :                                  tmpl::front<ManagerTags>>) {
      69             :       if (dynamic_cast<const Solutions::RobinsonTrautman*>(
      70             :               &(db::get<Tags::AnalyticBoundaryDataManager>(box)
      71             :                     .get_generator())) != nullptr) {
      72             :         if (db::get<::Tags::TimeStepper<TimeStepper>>(box)
      73             :                 .number_of_substeps() != 1) {
      74             :           ERROR(
      75             :               "Do not use RobinsonTrautman analytic solution with a "
      76             :               "substep-based timestepper. This is to prevent severe slowdowns "
      77             :               "in the current RobinsonTrautman implementation. See the "
      78             :               "documentation for the RobinsonTrautman solution for details.");
      79             :         }
      80             :       }
      81             :     }
      82             :     const size_t l_max = db::get<Tags::LMax>(box);
      83             : 
      84             :     Initialization::mutate_assign<simple_tags>(
      85             :         make_not_null(&box),
      86             :         Variables<BoundaryCommunicationTagsList>{
      87             :             Spectral::Swsh::number_of_swsh_collocation_points(l_max)}...);
      88             :     return {Parallel::AlgorithmExecution::Continue, std::nullopt};
      89             :   }
      90             : };
      91             : }  // namespace detail
      92             : 
      93             : /*!
      94             :  * \ingroup ActionsGroup
      95             :  * \brief Generic action for initializing various worldtube boundary components.
      96             :  *
      97             :  * \details See specializations of this class for initialization details for
      98             :  * individual worldtube components.
      99             :  */
     100             : template <typename WorldtubeComponent>
     101           1 : struct InitializeWorldtubeBoundary;
     102             : 
     103             : /*!
     104             :  * \ingroup ActionsGroup
     105             :  * \brief Initializes a H5WorldtubeBoundary
     106             :  *
     107             :  * \details Uses:
     108             :  * - simple tags from options
     109             :  * `Cce::Tags::H5WorldtubeBoundaryDataManager`,
     110             :  * - const global cache tag `Cce::Tags::LMax`, `Tags::ExtractionRadiusFromH5`.
     111             :  *
     112             :  * Databox changes:
     113             :  * - Adds:
     114             :  *   - `Cce::Tags::H5WorldtubeBoundaryDataManager`
     115             :  *   - `Tags::Variables<typename
     116             :  * Metavariables::cce_boundary_communication_tags>`
     117             :  * - Removes: nothing
     118             :  * - Modifies: nothing
     119             :  */
     120             : template <typename Metavariables>
     121           1 : struct InitializeWorldtubeBoundary<H5WorldtubeBoundary<Metavariables>>
     122             :     : public detail::InitializeWorldtubeBoundaryBase<
     123             :           InitializeWorldtubeBoundary<H5WorldtubeBoundary<Metavariables>>,
     124             :           tmpl::list<Tags::H5WorldtubeBoundaryDataManager>,
     125             :           typename Metavariables::cce_boundary_communication_tags> {
     126           0 :   using base_type = detail::InitializeWorldtubeBoundaryBase<
     127             :       InitializeWorldtubeBoundary<H5WorldtubeBoundary<Metavariables>>,
     128             :       tmpl::list<Tags::H5WorldtubeBoundaryDataManager>,
     129             :       typename Metavariables::cce_boundary_communication_tags>;
     130             :   using base_type::apply;
     131             :   using typename base_type::simple_tags;
     132           0 :   using const_global_cache_tags =
     133             :       tmpl::list<Tags::LMax, Tags::ExtractionRadiusFromH5,
     134             :                  Tags::EndTimeFromFile, Tags::StartTimeFromFile>;
     135             :   using typename base_type::simple_tags_from_options;
     136             : };
     137             : 
     138             : /*!
     139             :  * \ingroup ActionsGroup
     140             :  * \brief Initializes a KleinGordonH5WorldtubeBoundary
     141             :  *
     142             :  * \details Uses:
     143             :  * - simple tags from options
     144             :  * `Cce::Tags::H5WorldtubeBoundaryDataManager`,
     145             :  * `Cce::Tags::KleinGordonH5WorldtubeBoundaryDataManager`.
     146             :  * - const global cache tag `Cce::Tags::LMax`, `Tags::ExtractionRadiusFromH5`.
     147             :  *
     148             :  * Databox changes:
     149             :  * - Adds:
     150             :  *   - `Cce::Tags::H5WorldtubeBoundaryDataManager`
     151             :  *   - `Cce::Tags::KleinGordonH5WorldtubeBoundaryDataManager`
     152             :  *   - `Tags::Variables<typename
     153             :  * Metavariables::cce_boundary_communication_tags>`
     154             :  *   - `Tags::Variables<typename
     155             :  * Metavariables::klein_gordon_boundary_communication_tags>`
     156             :  * - Removes: nothing
     157             :  * - Modifies: nothing
     158             :  */
     159             : template <typename Metavariables>
     160           1 : struct InitializeWorldtubeBoundary<
     161             :     KleinGordonH5WorldtubeBoundary<Metavariables>>
     162             :     : public detail::InitializeWorldtubeBoundaryBase<
     163             :           InitializeWorldtubeBoundary<
     164             :               KleinGordonH5WorldtubeBoundary<Metavariables>>,
     165             :           tmpl::list<Tags::H5WorldtubeBoundaryDataManager,
     166             :                      Tags::KleinGordonH5WorldtubeBoundaryDataManager>,
     167             :           typename Metavariables::cce_boundary_communication_tags,
     168             :           typename Metavariables::klein_gordon_boundary_communication_tags> {
     169           0 :   using base_type = detail::InitializeWorldtubeBoundaryBase<
     170             :       InitializeWorldtubeBoundary<
     171             :           KleinGordonH5WorldtubeBoundary<Metavariables>>,
     172             :       tmpl::list<Tags::H5WorldtubeBoundaryDataManager,
     173             :                  Tags::KleinGordonH5WorldtubeBoundaryDataManager>,
     174             :       typename Metavariables::cce_boundary_communication_tags,
     175             :       typename Metavariables::klein_gordon_boundary_communication_tags>;
     176             :   using base_type::apply;
     177             :   using typename base_type::simple_tags;
     178           0 :   using const_global_cache_tags =
     179             :       tmpl::list<Tags::LMax, Tags::ExtractionRadiusFromH5,
     180             :                  Tags::EndTimeFromFile, Tags::StartTimeFromFile>;
     181             :   using typename base_type::simple_tags_from_options;
     182             : };
     183             : 
     184             : /*!
     185             :  * \ingroup ActionsGroup
     186             :  * \brief Initializes a GhWorldtubeBoundary
     187             :  *
     188             :  * \details Uses:
     189             :  * - simple tags from options
     190             :  * `Cce::Tags::GhWorldtubeBoundaryDataManager`, `Tags::GhInterfaceManager`
     191             :  * - const global cache tags `Tags::LMax`, `Tags::ExtractionRadiusSimple`.
     192             :  *
     193             :  * Databox changes:
     194             :  * - Adds:
     195             :  *   - `Tags::Variables<typename
     196             :  * Metavariables::cce_boundary_communication_tags>`
     197             :  * - Removes: nothing
     198             :  * - Modifies: nothing
     199             :  */
     200             : template <typename Metavariables>
     201           1 : struct InitializeWorldtubeBoundary<GhWorldtubeBoundary<Metavariables>>
     202             :     : public detail::InitializeWorldtubeBoundaryBase<
     203             :           InitializeWorldtubeBoundary<GhWorldtubeBoundary<Metavariables>>,
     204             :           tmpl::list<Tags::GhInterfaceManager,
     205             :                      Tags::SelfStartGhInterfaceManager>,
     206             :           typename Metavariables::cce_boundary_communication_tags> {
     207           0 :   using base_type = detail::InitializeWorldtubeBoundaryBase<
     208             :       InitializeWorldtubeBoundary<GhWorldtubeBoundary<Metavariables>>,
     209             :       tmpl::list<Tags::GhInterfaceManager, Tags::SelfStartGhInterfaceManager>,
     210             :       typename Metavariables::cce_boundary_communication_tags>;
     211             :   using base_type::apply;
     212             :   using typename base_type::simple_tags;
     213             : 
     214           0 :   using const_global_cache_tags =
     215             :       tmpl::list<Tags::LMax, Tags::ExtractionRadiusSimple, Tags::NoEndTime,
     216             :                  Tags::SpecifiedStartTime>;
     217             :   using typename base_type::simple_tags_from_options;
     218             : };
     219             : 
     220             : /*!
     221             :  * \ingroup ActionsGroup
     222             :  * \brief Initializes an AnalyticWorldtubeBoundary
     223             :  *
     224             :  * \details Uses:
     225             :  * - simple tags from options
     226             :  * `Cce::Tags::AnalyticBoundaryDataManager`,
     227             :  * - const global cache tags `Tags::LMax`,
     228             :  * `Tags::ExtractionRadiusSimple`.
     229             :  *
     230             :  * Databox changes:
     231             :  * - Adds:
     232             :  *   - `Tags::Variables<typename
     233             :  *     Metavariables::cce_boundary_communication_tags>`
     234             :  * - Removes: nothing
     235             :  * - Modifies: nothing
     236             :  */
     237             : template <typename Metavariables>
     238           1 : struct InitializeWorldtubeBoundary<AnalyticWorldtubeBoundary<Metavariables>>
     239             :     : public detail::InitializeWorldtubeBoundaryBase<
     240             :           InitializeWorldtubeBoundary<AnalyticWorldtubeBoundary<Metavariables>>,
     241             :           tmpl::list<Tags::AnalyticBoundaryDataManager,
     242             :                      Tags::CceEvolutionPrefix<::Tags::ConcreteTimeStepper<
     243             :                          tmpl::conditional_t<Metavariables::local_time_stepping,
     244             :                                              LtsTimeStepper, TimeStepper>>>>,
     245             :           typename Metavariables::cce_boundary_communication_tags> {
     246           0 :   using TimeStepperType =
     247             :       tmpl::conditional_t<Metavariables::local_time_stepping, LtsTimeStepper,
     248             :                           TimeStepper>;
     249           0 :   using base_type = detail::InitializeWorldtubeBoundaryBase<
     250             :       InitializeWorldtubeBoundary<AnalyticWorldtubeBoundary<Metavariables>>,
     251             :       tmpl::list<Tags::AnalyticBoundaryDataManager,
     252             :                  Tags::CceEvolutionPrefix<
     253             :                      ::Tags::ConcreteTimeStepper<TimeStepperType>>>,
     254             :       typename Metavariables::cce_boundary_communication_tags>;
     255             :   using base_type::apply;
     256             :   using typename base_type::simple_tags;
     257           0 :   using compute_tags = time_stepper_ref_tags<TimeStepperType>;
     258           0 :   using const_global_cache_tags =
     259             :       tmpl::list<Tags::LMax, Tags::ExtractionRadiusSimple,
     260             :                  Tags::SpecifiedEndTime, Tags::SpecifiedStartTime>;
     261             :   using typename base_type::simple_tags_from_options;
     262             : };
     263             : }  // namespace Actions
     264             : }  // namespace Cce

Generated by: LCOV version 1.14