SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/Cce/Actions - InitializeWorldtubeBoundary.hpp Hit Total Coverage
Commit: d0fc80462417e83e5cddfa1b9901bb4a9b6af4d6 Lines: 5 16 31.2 %
Date: 2024-03-29 00:33: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/Spectral/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`.
     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::EndTimeFromFile, Tags::StartTimeFromFile>;
     134             :   using typename base_type::simple_tags_from_options;
     135             : };
     136             : 
     137             : /*!
     138             :  * \ingroup ActionsGroup
     139             :  * \brief Initializes a KleinGordonH5WorldtubeBoundary
     140             :  *
     141             :  * \details Uses:
     142             :  * - simple tags from options
     143             :  * `Cce::Tags::H5WorldtubeBoundaryDataManager`,
     144             :  * `Cce::Tags::KleinGordonH5WorldtubeBoundaryDataManager`.
     145             :  * - const global cache tag `Cce::Tags::LMax`.
     146             :  *
     147             :  * Databox changes:
     148             :  * - Adds:
     149             :  *   - `Cce::Tags::H5WorldtubeBoundaryDataManager`
     150             :  *   - `Cce::Tags::KleinGordonH5WorldtubeBoundaryDataManager`
     151             :  *   - `Tags::Variables<typename
     152             :  * Metavariables::cce_boundary_communication_tags>`
     153             :  *   - `Tags::Variables<typename
     154             :  * Metavariables::klein_gordon_boundary_communication_tags>`
     155             :  * - Removes: nothing
     156             :  * - Modifies: nothing
     157             :  */
     158             : template <typename Metavariables>
     159           1 : struct InitializeWorldtubeBoundary<
     160             :     KleinGordonH5WorldtubeBoundary<Metavariables>>
     161             :     : public detail::InitializeWorldtubeBoundaryBase<
     162             :           InitializeWorldtubeBoundary<
     163             :               KleinGordonH5WorldtubeBoundary<Metavariables>>,
     164             :           tmpl::list<Tags::H5WorldtubeBoundaryDataManager,
     165             :                      Tags::KleinGordonH5WorldtubeBoundaryDataManager>,
     166             :           typename Metavariables::cce_boundary_communication_tags,
     167             :           typename Metavariables::klein_gordon_boundary_communication_tags> {
     168           0 :   using base_type = detail::InitializeWorldtubeBoundaryBase<
     169             :       InitializeWorldtubeBoundary<
     170             :           KleinGordonH5WorldtubeBoundary<Metavariables>>,
     171             :       tmpl::list<Tags::H5WorldtubeBoundaryDataManager,
     172             :                  Tags::KleinGordonH5WorldtubeBoundaryDataManager>,
     173             :       typename Metavariables::cce_boundary_communication_tags,
     174             :       typename Metavariables::klein_gordon_boundary_communication_tags>;
     175             :   using base_type::apply;
     176             :   using typename base_type::simple_tags;
     177           0 :   using const_global_cache_tags =
     178             :       tmpl::list<Tags::LMax, Tags::EndTimeFromFile, Tags::StartTimeFromFile>;
     179             :   using typename base_type::simple_tags_from_options;
     180             : };
     181             : 
     182             : /*!
     183             :  * \ingroup ActionsGroup
     184             :  * \brief Initializes a GhWorldtubeBoundary
     185             :  *
     186             :  * \details Uses:
     187             :  * - simple tags from options
     188             :  * `Cce::Tags::GhWorldtubeBoundaryDataManager`, `Tags::GhInterfaceManager`
     189             :  * - const global cache tags `Tags::LMax`, `Tags::ExtractionRadius`.
     190             :  *
     191             :  * Databox changes:
     192             :  * - Adds:
     193             :  *   - `Tags::Variables<typename
     194             :  * Metavariables::cce_boundary_communication_tags>`
     195             :  * - Removes: nothing
     196             :  * - Modifies: nothing
     197             :  */
     198             : template <typename Metavariables>
     199           1 : struct InitializeWorldtubeBoundary<GhWorldtubeBoundary<Metavariables>>
     200             :     : public detail::InitializeWorldtubeBoundaryBase<
     201             :           InitializeWorldtubeBoundary<GhWorldtubeBoundary<Metavariables>>,
     202             :           tmpl::list<Tags::GhInterfaceManager,
     203             :                      Tags::SelfStartGhInterfaceManager>,
     204             :           typename Metavariables::cce_boundary_communication_tags> {
     205           0 :   using base_type = detail::InitializeWorldtubeBoundaryBase<
     206             :       InitializeWorldtubeBoundary<GhWorldtubeBoundary<Metavariables>>,
     207             :       tmpl::list<Tags::GhInterfaceManager, Tags::SelfStartGhInterfaceManager>,
     208             :       typename Metavariables::cce_boundary_communication_tags>;
     209             :   using base_type::apply;
     210             :   using typename base_type::simple_tags;
     211             : 
     212           0 :   using const_global_cache_tags =
     213             :       tmpl::list<Tags::LMax, InitializationTags::ExtractionRadius,
     214             :                  Tags::NoEndTime, Tags::SpecifiedStartTime>;
     215             :   using typename base_type::simple_tags_from_options;
     216             : };
     217             : 
     218             : /*!
     219             :  * \ingroup ActionsGroup
     220             :  * \brief Initializes an AnalyticWorldtubeBoundary
     221             :  *
     222             :  * \details Uses:
     223             :  * - simple tags from options
     224             :  * `Cce::Tags::AnalyticBoundaryDataManager`,
     225             :  * - const global cache tags `Tags::LMax`,
     226             :  * `Tags::ExtractionRadius`.
     227             :  *
     228             :  * Databox changes:
     229             :  * - Adds:
     230             :  *   - `Tags::Variables<typename
     231             :  *     Metavariables::cce_boundary_communication_tags>`
     232             :  * - Removes: nothing
     233             :  * - Modifies: nothing
     234             :  */
     235             : template <typename Metavariables>
     236           1 : struct InitializeWorldtubeBoundary<AnalyticWorldtubeBoundary<Metavariables>>
     237             :     : public detail::InitializeWorldtubeBoundaryBase<
     238             :           InitializeWorldtubeBoundary<AnalyticWorldtubeBoundary<Metavariables>>,
     239             :           tmpl::list<Tags::AnalyticBoundaryDataManager,
     240             :                      Tags::CceEvolutionPrefix<::Tags::ConcreteTimeStepper<
     241             :                          tmpl::conditional_t<Metavariables::local_time_stepping,
     242             :                                              LtsTimeStepper, TimeStepper>>>>,
     243             :           typename Metavariables::cce_boundary_communication_tags> {
     244           0 :   using TimeStepperType =
     245             :       tmpl::conditional_t<Metavariables::local_time_stepping, LtsTimeStepper,
     246             :                           TimeStepper>;
     247           0 :   using base_type = detail::InitializeWorldtubeBoundaryBase<
     248             :       InitializeWorldtubeBoundary<AnalyticWorldtubeBoundary<Metavariables>>,
     249             :       tmpl::list<Tags::AnalyticBoundaryDataManager,
     250             :                  Tags::CceEvolutionPrefix<
     251             :                      ::Tags::ConcreteTimeStepper<TimeStepperType>>>,
     252             :       typename Metavariables::cce_boundary_communication_tags>;
     253             :   using base_type::apply;
     254             :   using typename base_type::simple_tags;
     255           0 :   using compute_tags = time_stepper_ref_tags<TimeStepperType>;
     256           0 :   using const_global_cache_tags =
     257             :       tmpl::list<Tags::LMax, Tags::SpecifiedEndTime, Tags::SpecifiedStartTime>;
     258             :   using typename base_type::simple_tags_from_options;
     259             : };
     260             : }  // namespace Actions
     261             : }  // namespace Cce

Generated by: LCOV version 1.14