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 :
8 : #include "DataStructures/Tensor/IndexType.hpp"
9 : #include "DataStructures/Tensor/TypeAliases.hpp"
10 : #include "Domain/Tags.hpp"
11 : #include "Evolution/Systems/GeneralizedHarmonic/Tags.hpp"
12 : #include "ParallelAlgorithms/Interpolation/Protocols/ComputeVarsToInterpolate.hpp"
13 : #include "PointwiseFunctions/GeneralRelativity/GeneralizedHarmonic/ConstraintDampingTags.hpp"
14 : #include "PointwiseFunctions/GeneralRelativity/Tags.hpp"
15 : #include "Utilities/ProtocolHelpers.hpp"
16 : #include "Utilities/TMPL.hpp"
17 :
18 : /// \cond
19 : class DataVector;
20 : template <size_t Dim>
21 : class Mesh;
22 : template <typename VariablesTags>
23 : class Variables;
24 : namespace gsl {
25 : template <typename T>
26 : class not_null;
27 : } // namespace gsl
28 : /// \endcond
29 :
30 : namespace ah {
31 :
32 : /// Given the generalized harmonic variables in the volume, computes
33 : /// the quantities that will be interpolated onto an excision boundary.
34 : ///
35 : /// This is meant to be the primary `compute_vars_to_interpolate`
36 : /// for the computation of the characteristic speeds on the
37 : /// excision boundary.
38 : ///
39 : /// SrcTagList and DestTagList have limited flexibility, and their
40 : /// restrictions are static_asserted inside the apply functions. The
41 : /// lack of complete flexibility is intentional, because most
42 : /// computations (e.g. for observers) should be done only on the
43 : /// horizon surface (i.e. after interpolation) as opposed to in the
44 : /// volume; only those computations that require data in the volume
45 : /// (e.g. volume numerical derivatives) should be done here.
46 : ///
47 : /// For the dual-frame case, numerical derivatives of Jacobians are
48 : /// taken in order to avoid Hessians.
49 : ///
50 : /// SrcTagList is usually `interpolator_source_vars` in the
51 : /// Metavariables, and the allowed and required tags in SrcTagList are
52 : /// given by the type aliases `allowed_src_tags` and `required_src_tags`
53 : /// below.
54 : ///
55 : /// DestTagList is usually `vars_to_interpolate_to_target` in the
56 : /// `InterpolationTarget` that uses `ComputeExcisionBoundaryVolumeQuantities`.
57 : /// The allowed and required tags in DestTagList are given by
58 : /// the type aliases `allowed_dest_tags` and `required_dest_tags` below.
59 1 : struct ComputeExcisionBoundaryVolumeQuantities
60 : : tt::ConformsTo<intrp::protocols::ComputeVarsToInterpolate> {
61 : /// Single-frame case
62 : template <typename SrcTagList, typename DestTagList>
63 1 : static void apply(const gsl::not_null<Variables<DestTagList>*> target_vars,
64 : const Variables<SrcTagList>& src_vars, const Mesh<3>& mesh);
65 : /// Dual-frame case
66 : template <typename SrcTagList, typename DestTagList, typename TargetFrame>
67 1 : static void apply(
68 : const gsl::not_null<Variables<DestTagList>*> target_vars,
69 : const Variables<SrcTagList>& src_vars, const Mesh<3>& mesh,
70 : const Jacobian<DataVector, 3, TargetFrame, Frame::Inertial>&
71 : jac_target_to_inertial,
72 : const InverseJacobian<DataVector, 3, TargetFrame, Frame::Inertial>&
73 : invjac_target_to_inertial,
74 : const Jacobian<DataVector, 3, Frame::ElementLogical, TargetFrame>&
75 : jac_logical_to_target,
76 : const InverseJacobian<DataVector, 3, Frame::ElementLogical, TargetFrame>&
77 : invjac_logical_to_target,
78 : const InverseJacobian<DataVector, 3, Frame::Grid, TargetFrame>&
79 : invjac_grid_to_target,
80 : const tnsr::I<DataVector, 3, Frame::Inertial>& inertial_mesh_velocity,
81 : const tnsr::I<DataVector, 3, TargetFrame>&
82 : grid_to_target_frame_mesh_velocity);
83 :
84 0 : using allowed_src_tags =
85 : tmpl::list<gr::Tags::SpacetimeMetric<DataVector, 3>,
86 : gh::Tags::Pi<DataVector, 3>, gh::Tags::Phi<DataVector, 3>,
87 : ::Tags::deriv<gh::Tags::Phi<DataVector, 3>, tmpl::size_t<3>,
88 : Frame::Inertial>>;
89 :
90 0 : using required_src_tags =
91 : tmpl::list<gr::Tags::SpacetimeMetric<DataVector, 3>>;
92 :
93 : template <typename TargetFrame>
94 0 : using allowed_dest_tags_target_frame = tmpl::list<
95 : gr::Tags::SpatialMetric<DataVector, 3, TargetFrame>,
96 : gr::Tags::SpacetimeMetric<DataVector, 3, TargetFrame>,
97 : gr::Tags::Lapse<DataVector>,
98 : ::Tags::deriv<gr::Tags::Lapse<DataVector>, tmpl::size_t<3>, TargetFrame>,
99 : gr::Tags::Shift<DataVector, 3, TargetFrame>,
100 : ::Tags::deriv<gr::Tags::Shift<DataVector, 3, TargetFrame>,
101 : tmpl::size_t<3>, TargetFrame>,
102 : gr::Tags::ShiftyQuantity<DataVector, 3, TargetFrame>,
103 : ::domain::Tags::InverseJacobian<3, Frame::Grid, TargetFrame>,
104 : gr::Tags::SpatialChristoffelSecondKind<DataVector, 3, TargetFrame>>;
105 :
106 : template <typename TargetFrame>
107 0 : using allowed_dest_tags = tmpl::remove_duplicates<
108 : tmpl::append<allowed_dest_tags_target_frame<TargetFrame>,
109 : allowed_dest_tags_target_frame<Frame::Inertial>>>;
110 :
111 : template <typename TargetFrame>
112 0 : using required_dest_tags = tmpl::list<>;
113 : };
114 :
115 : } // namespace ah
|