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 <string> 8 : 9 : #include "ControlSystem/Measurements/NonFactoryCreatable.hpp" 10 : #include "ControlSystem/Protocols/Measurement.hpp" 11 : #include "ControlSystem/Protocols/Submeasurement.hpp" 12 : #include "ControlSystem/RunCallbacks.hpp" 13 : #include "DataStructures/Tensor/IndexType.hpp" 14 : #include "Domain/Structure/ObjectLabel.hpp" 15 : #include "Domain/TagsTimeDependent.hpp" 16 : #include "NumericalAlgorithms/LinearOperators/PartialDerivatives.hpp" 17 : #include "ParallelAlgorithms/ApparentHorizonFinder/Callbacks/FailedHorizonFind.hpp" 18 : #include "ParallelAlgorithms/ApparentHorizonFinder/Destination.hpp" 19 : #include "ParallelAlgorithms/ApparentHorizonFinder/Events/FindApparentHorizon.hpp" 20 : #include "ParallelAlgorithms/ApparentHorizonFinder/HorizonAliases.hpp" 21 : #include "ParallelAlgorithms/ApparentHorizonFinder/Protocols/HorizonMetavars.hpp" 22 : #include "ParallelAlgorithms/Interpolation/ComputeExcisionBoundaryVolumeQuantities.hpp" 23 : #include "ParallelAlgorithms/Interpolation/Events/InterpolateWithoutInterpComponent.hpp" 24 : #include "ParallelAlgorithms/Interpolation/Protocols/InterpolationTargetTag.hpp" 25 : #include "ParallelAlgorithms/Interpolation/Targets/Sphere.hpp" 26 : #include "PointwiseFunctions/GeneralRelativity/DetAndInverseSpatialMetric.hpp" 27 : #include "PointwiseFunctions/GeneralRelativity/Tags.hpp" 28 : #include "Time/Tags/TimeAndPrevious.hpp" 29 : #include "Utilities/ProtocolHelpers.hpp" 30 : #include "Utilities/TMPL.hpp" 31 : 32 : /// \cond 33 : class DataVector; 34 : template <size_t VolumeDim> 35 : class ElementId; 36 : template <size_t Dim> 37 : class Mesh; 38 : namespace Parallel { 39 : template <typename Metavariables> 40 : class GlobalCache; 41 : } // namespace Parallel 42 : namespace domain::Tags { 43 : template <size_t Dim> 44 : struct Mesh; 45 : template <size_t Dim, typename Frame> 46 : struct Coordinates; 47 : } // namespace domain::Tags 48 : /// \endcond 49 : 50 : namespace control_system::measurements { 51 : /*! 52 : * \brief A `control_system::protocols::Measurement` that relies on one 53 : * apparent horizon, the template parameter `Object`, and one excision surface. 54 : */ 55 : template <::domain::ObjectLabel Object> 56 1 : struct CharSpeed : tt::ConformsTo<protocols::Measurement> { 57 0 : static std::string name() { return "CharSpeed" + ::domain::name(Object); } 58 : 59 : /*! 60 : * \brief A `control_system::protocols::Submeasurement` that does an 61 : * interpolation to the excision boundary for this `Object` from the elements. 62 : * 63 : * This does not go through the interpolation framework. 64 : */ 65 1 : struct Excision : tt::ConformsTo<protocols::Submeasurement> { 66 0 : static std::string name() { return CharSpeed::name() + "::Excision"; } 67 : 68 : private: 69 : template <typename ControlSystems> 70 0 : struct InterpolationTarget 71 : : tt::ConformsTo<intrp::protocols::InterpolationTargetTag> { 72 0 : static std::string name() { 73 : return "ControlSystemCharSpeedExcision" + ::domain::name(Object); 74 : } 75 : 76 0 : static constexpr size_t index = 77 : Object == ::domain::ObjectLabel::A ? 1_st : 2_st; 78 : 79 0 : using temporal_id = ::Tags::TimeAndPrevious<index>; 80 : 81 0 : using vars_to_interpolate_to_target = tmpl::list< 82 : gr::Tags::Lapse<DataVector>, 83 : ::Tags::deriv<gr::Tags::Lapse<DataVector>, tmpl::size_t<3>, 84 : Frame::Distorted>, 85 : gr::Tags::Shift<DataVector, 3, Frame::Distorted>, 86 : ::Tags::deriv<gr::Tags::Shift<DataVector, 3, Frame::Distorted>, 87 : tmpl::size_t<3>, Frame::Distorted>, 88 : gr::Tags::ShiftyQuantity<DataVector, 3, Frame::Distorted>, 89 : gr::Tags::SpatialMetric<DataVector, 3, Frame::Distorted>, 90 : ::domain::Tags::InverseJacobian<3, Frame::Grid, Frame::Distorted>, 91 : gr::Tags::SpatialChristoffelSecondKind<DataVector, 3, 92 : Frame::Distorted>>; 93 0 : using compute_vars_to_interpolate = 94 : intrp::ComputeExcisionBoundaryVolumeQuantities; 95 0 : using compute_items_on_source = 96 : tmpl::list<::Tags::TimeAndPreviousCompute<index>>; 97 0 : using compute_items_on_target = 98 : tmpl::list<gr::Tags::DetAndInverseSpatialMetricCompute< 99 : DataVector, 3, Frame::Distorted>>; 100 0 : using compute_target_points = 101 : intrp::TargetPoints::Sphere<InterpolationTarget, ::Frame::Grid>; 102 0 : using post_interpolation_callbacks = 103 : tmpl::list<control_system::RunCallbacks<Excision, ControlSystems>>; 104 : 105 : template <typename Metavariables> 106 0 : using interpolating_component = 107 : typename Metavariables::gh_dg_element_array; 108 : }; 109 : 110 : public: 111 : template <typename ControlSystems> 112 0 : using interpolation_target_tag = InterpolationTarget<ControlSystems>; 113 : template <typename ControlSystems> 114 0 : using horizon_metavars = void; 115 : 116 : template <typename ControlSystems> 117 0 : using event = NonFactoryCreatableWrapper< 118 : intrp::Events::InterpolateWithoutInterpComponent< 119 : 3, InterpolationTarget<ControlSystems>, ::ah::source_vars<3>>>; 120 : }; 121 : 122 : /*! 123 : * \brief A `control_system::protocols::Submeasurement` that starts the 124 : * interpolation to the interpolation target in order to find the apparent 125 : * horizon. 126 : */ 127 1 : struct Horizon : tt::ConformsTo<protocols::Submeasurement> { 128 0 : static std::string name() { return CharSpeed::name() + "::Horizon"; } 129 : 130 : private: 131 : template <typename ControlSystems> 132 0 : struct HorizonMetavars : tt::ConformsTo<ah::protocols::HorizonMetavars> { 133 : private: 134 0 : static constexpr size_t index = 135 : Object == ::domain::ObjectLabel::A ? 1_st : 2_st; 136 : 137 : public: 138 0 : static std::string name() { 139 : return "ControlSystemCharSpeedAh" + ::domain::name(Object); 140 : } 141 : 142 : // Separate time tags for each object 143 0 : using time_tag = ::Tags::TimeAndPrevious<index>; 144 : 145 0 : using frame = ::Frame::Distorted; 146 : 147 0 : using horizon_find_callbacks = 148 : tmpl::list<control_system::RunCallbacks<Horizon, ControlSystems>>; 149 0 : using horizon_find_failure_callbacks = 150 : tmpl::list<ah::callbacks::FailedHorizonFind<HorizonMetavars, false>>; 151 : 152 0 : using compute_tags_on_element = 153 : tmpl::list<::Tags::TimeAndPreviousCompute<index>>; 154 : 155 0 : static constexpr ah::Destination destination = 156 : ah::Destination::ControlSystem; 157 : }; 158 : 159 : public: 160 : template <typename ControlSystems> 161 0 : using interpolation_target_tag = void; 162 : template <typename ControlSystems> 163 0 : using horizon_metavars = HorizonMetavars<ControlSystems>; 164 : 165 : template <typename ControlSystems> 166 0 : using event = NonFactoryCreatableWrapper< 167 : ah::Events::FindApparentHorizon<HorizonMetavars<ControlSystems>>>; 168 : }; 169 : 170 0 : using submeasurements = tmpl::list<Horizon, Excision>; 171 : }; 172 : } // namespace control_system::measurements