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/DataBox/Prefixes.hpp"
9 : #include "DataStructures/DataBox/Tag.hpp"
10 : #include "DataStructures/DataVector.hpp"
11 : #include "DataStructures/Tensor/EagerMath/DotProduct.hpp"
12 : #include "DataStructures/Tensor/Tensor.hpp"
13 : #include "Domain/FunctionsOfTime/Tags.hpp"
14 : #include "Evolution/Systems/GeneralizedHarmonic/ConstraintDamping/Tags.hpp"
15 : #include "Evolution/Systems/GeneralizedHarmonic/Tags.hpp"
16 : #include "PointwiseFunctions/GeneralRelativity/Tags.hpp"
17 : #include "Utilities/ContainerHelpers.hpp"
18 : #include "Utilities/Gsl.hpp"
19 : #include "Utilities/TMPL.hpp"
20 :
21 : // IWYU pragma: no_forward_declare Tags::deriv
22 :
23 : /// \cond
24 : namespace Tags {
25 : struct Time;
26 : } // namespace Tags
27 : namespace domain {
28 : namespace Tags {
29 : template <size_t Dim, typename Frame>
30 : struct Coordinates;
31 : } // namespace Tags
32 : } // namespace domain
33 : class DataVector;
34 : template <typename X, typename Symm, typename IndexList>
35 : class Tensor;
36 : /// \endcond
37 :
38 : namespace gh::ConstraintDamping::Tags {
39 : /*!
40 : * \brief Computes the constraint damping parameter \f$\gamma_0\f$ from the
41 : * coordinates and a DampingFunction.
42 : *
43 : * \details Can be retrieved using
44 : * `gh::ConstraintDamping::Tags::ConstraintGamma0`.
45 : */
46 : template <size_t SpatialDim, typename Frame>
47 1 : struct ConstraintGamma0Compute : ConstraintGamma0, db::ComputeTag {
48 0 : using argument_tags =
49 : tmpl::list<DampingFunctionGamma0<SpatialDim, Frame>,
50 : domain::Tags::Coordinates<SpatialDim, Frame>, ::Tags::Time,
51 : ::domain::Tags::FunctionsOfTime>;
52 0 : using return_type = Scalar<DataVector>;
53 :
54 0 : static constexpr void function(
55 : const gsl::not_null<Scalar<DataVector>*> gamma,
56 : const ::gh::ConstraintDamping::DampingFunction<SpatialDim, Frame>&
57 : damping_function,
58 : const tnsr::I<DataVector, SpatialDim, Frame>& coords, const double time,
59 : const std::unordered_map<
60 : std::string,
61 : std::unique_ptr<domain::FunctionsOfTime::FunctionOfTime>>&
62 : functions_of_time) {
63 : damping_function(gamma, coords, time, functions_of_time);
64 : }
65 :
66 0 : using base = ConstraintGamma0;
67 : };
68 :
69 : /*!
70 : * \brief Computes the constraint damping parameter \f$\gamma_1\f$ from the
71 : * coordinates and a DampingFunction.
72 : *
73 : * \details Can be retrieved using
74 : * `gh::ConstraintDamping::Tags::ConstraintGamma1`.
75 : */
76 : template <size_t SpatialDim, typename Frame>
77 1 : struct ConstraintGamma1Compute : ConstraintGamma1, db::ComputeTag {
78 0 : using argument_tags =
79 : tmpl::list<DampingFunctionGamma1<SpatialDim, Frame>,
80 : domain::Tags::Coordinates<SpatialDim, Frame>, ::Tags::Time,
81 : ::domain::Tags::FunctionsOfTime>;
82 0 : using return_type = Scalar<DataVector>;
83 :
84 0 : static constexpr void function(
85 : const gsl::not_null<Scalar<DataVector>*> gamma1,
86 : const ::gh::ConstraintDamping::DampingFunction<SpatialDim, Frame>&
87 : damping_function,
88 : const tnsr::I<DataVector, SpatialDim, Frame>& coords, const double time,
89 : const std::unordered_map<
90 : std::string,
91 : std::unique_ptr<domain::FunctionsOfTime::FunctionOfTime>>&
92 : functions_of_time) {
93 : damping_function(gamma1, coords, time, functions_of_time);
94 : }
95 :
96 0 : using base = ConstraintGamma1;
97 : };
98 :
99 : /*!
100 : * \brief Computes the constraint damping parameter \f$\gamma_2\f$ from the
101 : * coordinates and a DampingFunction.
102 : *
103 : * \details Can be retrieved using
104 : * `gh::ConstraintDamping::Tags::ConstraintGamma2`.
105 : */
106 : template <size_t SpatialDim, typename Frame>
107 1 : struct ConstraintGamma2Compute : ConstraintGamma2, db::ComputeTag {
108 0 : using argument_tags =
109 : tmpl::list<DampingFunctionGamma2<SpatialDim, Frame>,
110 : domain::Tags::Coordinates<SpatialDim, Frame>, ::Tags::Time,
111 : ::domain::Tags::FunctionsOfTime>;
112 0 : using return_type = Scalar<DataVector>;
113 :
114 0 : static constexpr void function(
115 : const gsl::not_null<Scalar<DataVector>*> gamma,
116 : const ::gh::ConstraintDamping::DampingFunction<SpatialDim, Frame>&
117 : damping_function,
118 : const tnsr::I<DataVector, SpatialDim, Frame>& coords, const double time,
119 : const std::unordered_map<
120 : std::string,
121 : std::unique_ptr<domain::FunctionsOfTime::FunctionOfTime>>&
122 : functions_of_time) {
123 : damping_function(gamma, coords, time, functions_of_time);
124 : }
125 :
126 0 : using base = ConstraintGamma2;
127 : };
128 : } // namespace gh::ConstraintDamping::Tags
|