Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #include "DataStructures/DataBox/DataBox.hpp" 7 : #include "Evolution/Systems/Cce/Actions/BoundaryComputeAndSendToEvolution.hpp" 8 : #include "Evolution/Systems/Cce/Actions/ReceiveGhWorldtubeData.hpp" 9 : #include "Evolution/Systems/Cce/Components/WorldtubeBoundary.hpp" 10 : #include "Evolution/Systems/GeneralizedHarmonic/Tags.hpp" 11 : #include "Parallel/GlobalCache.hpp" 12 : #include "Parallel/Invoke.hpp" 13 : #include "ParallelAlgorithms/Interpolation/Protocols/PostInterpolationCallback.hpp" 14 : #include "PointwiseFunctions/GeneralRelativity/Tags.hpp" 15 : #include "Utilities/ErrorHandling/Error.hpp" 16 : #include "Utilities/ProtocolHelpers.hpp" 17 : #include "Utilities/TMPL.hpp" 18 : 19 : namespace intrp { 20 : /// \cond 21 : namespace Tags { 22 : template <typename InterpolationTargetTag> 23 : struct Sphere; 24 : } 25 : /// \endcond 26 : 27 : namespace callbacks { 28 : 29 : /// \brief post_interpolation_callback that calls Cce::ReceiveGhWorldTubeData 30 : /// 31 : /// Uses: 32 : /// - DataBox: 33 : /// - `::gr::Tags::SpacetimeMetric<DataVector, 3, Frame::Inertial>` 34 : /// - `::gh::Tags::Pi<DataVector, 3>` 35 : /// - `::gh::Tags::Phi<DataVector, 3>` 36 : /// 37 : /// Conforms to the intrp::protocols::PostInterpolationCallback protocol 38 : /// 39 : /// For requirements on InterpolationTargetTag, see 40 : /// intrp::protocols::InterpolationTargetTag 41 : /// 42 : /// \note This callback requires the temporal ID in an InterpolationTargetTag be 43 : /// a TimeStepId. 44 : template <typename CceEvolutionComponent, typename InterpolationTargetTag, 45 : bool DuringSelfStart, bool LocalTimeStepping> 46 1 : struct SendGhWorldtubeData 47 : : tt::ConformsTo<intrp::protocols::PostInterpolationCallback> { 48 : template <typename DbTags, typename Metavariables, typename TemporalId> 49 0 : static void apply(const db::DataBox<DbTags>& box, 50 : Parallel::GlobalCache<Metavariables>& cache, 51 : const TemporalId& temporal_id) { 52 : // This is an ERROR and not an ASSERT because even in Release mode we want 53 : // to stop execution if there were wrong inputs. 54 : if (Parallel::get<Tags::Sphere<InterpolationTargetTag>>(cache) 55 : .radii.size() > 1) { 56 : ERROR("SendGhWorldtubeData expects a single worldtube radius, not " 57 : << Parallel::get<Tags::Sphere<InterpolationTargetTag>>(cache) 58 : .radii.size()); 59 : } 60 : 61 : auto& cce_gh_boundary_component = Parallel::get_parallel_component< 62 : Cce::GhWorldtubeBoundary<Metavariables>>(cache); 63 : if constexpr (DuringSelfStart or LocalTimeStepping) { 64 : Parallel::simple_action<typename Cce::Actions::ReceiveGhWorldtubeData< 65 : CceEvolutionComponent, DuringSelfStart>>( 66 : cce_gh_boundary_component, temporal_id, 67 : db::get<::gr::Tags::SpacetimeMetric<DataVector, 3>>(box), 68 : db::get<::gh::Tags::Phi<DataVector, 3>>(box), 69 : db::get<::gh::Tags::Pi<DataVector, 3>>(box)); 70 : } else { 71 : // We want to avoid interface manager for global time stepping 72 : Parallel::simple_action<Cce::Actions::SendToEvolution< 73 : Cce::GhWorldtubeBoundary<Metavariables>, CceEvolutionComponent>>( 74 : cce_gh_boundary_component, temporal_id, 75 : db::get<::gr::Tags::SpacetimeMetric<DataVector, 3>>(box), 76 : db::get<::gh::Tags::Phi<DataVector, 3>>(box), 77 : db::get<::gh::Tags::Pi<DataVector, 3>>(box)); 78 : } 79 : } 80 : }; 81 : } // namespace callbacks 82 : } // namespace intrp