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 intrp {
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 `ah::source_vars`, and the allowed and required tags
51 : /// in SrcTagList are given by the type aliases `allowed_src_tags` and
52 : /// `required_src_tags` below.
53 : ///
54 : /// DestTagList is usually `vars_to_interpolate_to_target` in the
55 : /// `InterpolationTarget` that uses `ComputeExcisionBoundaryVolumeQuantities`.
56 : /// The allowed and required tags in DestTagList are given by
57 : /// the type aliases `allowed_dest_tags` and `required_dest_tags` below.
58 1 : struct ComputeExcisionBoundaryVolumeQuantities
59 : : tt::ConformsTo<intrp::protocols::ComputeVarsToInterpolate> {
60 : /// Single-frame case
61 : template <typename SrcTagList, typename DestTagList>
62 1 : static void apply(gsl::not_null<Variables<DestTagList>*> target_vars,
63 : const Variables<SrcTagList>& src_vars, const Mesh<3>& mesh);
64 : /// Dual-frame case
65 : template <typename SrcTagList, typename DestTagList, typename TargetFrame>
66 1 : static void apply(
67 : gsl::not_null<Variables<DestTagList>*> target_vars,
68 : const Variables<SrcTagList>& src_vars, const Mesh<3>& mesh,
69 : const Jacobian<DataVector, 3, TargetFrame, Frame::Inertial>&
70 : jac_target_to_inertial,
71 : const InverseJacobian<DataVector, 3, TargetFrame, Frame::Inertial>&
72 : invjac_target_to_inertial,
73 : const Jacobian<DataVector, 3, Frame::ElementLogical, TargetFrame>&
74 : jac_logical_to_target,
75 : const InverseJacobian<DataVector, 3, Frame::ElementLogical, TargetFrame>&
76 : invjac_logical_to_target,
77 : const InverseJacobian<DataVector, 3, Frame::Grid, TargetFrame>&
78 : invjac_grid_to_target,
79 : const tnsr::I<DataVector, 3, Frame::Inertial>& inertial_mesh_velocity,
80 : const tnsr::I<DataVector, 3, TargetFrame>&
81 : grid_to_target_frame_mesh_velocity);
82 :
83 0 : using allowed_src_tags =
84 : tmpl::list<gr::Tags::SpacetimeMetric<DataVector, 3>,
85 : gh::Tags::Pi<DataVector, 3>, gh::Tags::Phi<DataVector, 3>,
86 : ::Tags::deriv<gh::Tags::Phi<DataVector, 3>, tmpl::size_t<3>,
87 : Frame::Inertial>>;
88 :
89 0 : using required_src_tags =
90 : tmpl::list<gr::Tags::SpacetimeMetric<DataVector, 3>>;
91 :
92 : template <typename TargetFrame>
93 0 : using allowed_dest_tags_target_frame = tmpl::list<
94 : gr::Tags::SpatialMetric<DataVector, 3, TargetFrame>,
95 : gr::Tags::SpacetimeMetric<DataVector, 3, TargetFrame>,
96 : gr::Tags::Lapse<DataVector>,
97 : ::Tags::deriv<gr::Tags::Lapse<DataVector>, tmpl::size_t<3>, TargetFrame>,
98 : gr::Tags::Shift<DataVector, 3, TargetFrame>,
99 : ::Tags::deriv<gr::Tags::Shift<DataVector, 3, TargetFrame>,
100 : tmpl::size_t<3>, TargetFrame>,
101 : gr::Tags::ShiftyQuantity<DataVector, 3, TargetFrame>,
102 : ::domain::Tags::InverseJacobian<3, Frame::Grid, TargetFrame>,
103 : gr::Tags::SpatialChristoffelSecondKind<DataVector, 3, TargetFrame>>;
104 :
105 : template <typename TargetFrame>
106 0 : using allowed_dest_tags = tmpl::remove_duplicates<
107 : tmpl::append<allowed_dest_tags_target_frame<TargetFrame>,
108 : allowed_dest_tags_target_frame<Frame::Inertial>>>;
109 :
110 : template <typename TargetFrame>
111 0 : using required_dest_tags = tmpl::list<>;
112 : };
113 :
114 : } // namespace intrp
|