ConstraintGammas.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cstddef>
7 
9 #include "DataStructures/DataBox/Tag.hpp"
10 #include "DataStructures/DataVector.hpp"
13 #include "Evolution/Systems/GeneralizedHarmonic/Tags.hpp"
14 #include "PointwiseFunctions/GeneralRelativity/Tags.hpp"
15 #include "Utilities/ContainerHelpers.hpp"
16 #include "Utilities/Gsl.hpp"
17 #include "Utilities/TMPL.hpp"
18 
19 // IWYU pragma: no_forward_declare Tags::deriv
20 
21 /// \cond
22 namespace domain {
23 namespace Tags {
24 template <size_t Dim, typename Frame>
25 struct Coordinates;
26 } // namespace Tags
27 } // namespace domain
28 class DataVector;
29 template <typename X, typename Symm, typename IndexList>
30 class Tensor;
31 /// \endcond
32 
33 namespace GeneralizedHarmonic {
34 namespace Tags {
35 /*!
36  * \brief Compute items to compute constraint-damping parameters for a
37  * single-BH evolution.
38  *
39  * \details Can be retrieved using
40  * `GeneralizedHarmonic::Tags::ConstraintGamma0`,
41  * `GeneralizedHarmonic::Tags::ConstraintGamma1`, and
42  * `GeneralizedHarmonic::Tags::ConstraintGamma2`.
43  */
44 template <size_t SpatialDim, typename Frame>
46  using argument_tags =
47  tmpl::list<domain::Tags::Coordinates<SpatialDim, Frame>>;
48 
49  using return_type = Scalar<DataVector>;
50 
51  static constexpr void function(
53  const tnsr::I<DataVector, SpatialDim, Frame>& coords) noexcept {
54  destructive_resize_components(gamma, get<0>(coords).size());
55  get(*gamma) =
56  3. * exp(-0.0078125 * get(dot_product(coords, coords))) + 0.001;
57  }
58 
59  using base = ConstraintGamma0;
60 };
61 /// \copydoc ConstraintGamma0Compute
62 template <size_t SpatialDim, typename Frame>
64  using argument_tags =
65  tmpl::list<domain::Tags::Coordinates<SpatialDim, Frame>>;
66 
67  using return_type = Scalar<DataVector>;
68 
69  static constexpr void function(
70  const gsl::not_null<Scalar<DataVector>*> gamma1,
71  const tnsr::I<DataVector, SpatialDim, Frame>& coords) noexcept {
72  destructive_resize_components(gamma1, get<0>(coords).size());
73  get(*gamma1) = -1.;
74  }
75 
76  using base = ConstraintGamma1;
77 };
78 /// \copydoc ConstraintGamma0Compute
79 template <size_t SpatialDim, typename Frame>
81  using argument_tags =
82  tmpl::list<domain::Tags::Coordinates<SpatialDim, Frame>>;
83 
84  using return_type = Scalar<DataVector>;
85 
86  static constexpr void function(
88  const tnsr::I<DataVector, SpatialDim, Frame>& coords) noexcept {
89  destructive_resize_components(gamma, get<0>(coords).size());
90  get(*gamma) = exp(-0.0078125 * get(dot_product(coords, coords))) + 0.001;
91  }
92 
93  using base = ConstraintGamma2;
94 };
95 } // namespace Tags
96 } // namespace GeneralizedHarmonic
GeneralizedHarmonic::Tags::ConstraintGamma0Compute
Compute items to compute constraint-damping parameters for a single-BH evolution.
Definition: ConstraintGammas.hpp:45
db::ComputeTag
Marks a DataBoxTag as being a compute item that executes a function.
Definition: Tag.hpp:109
GeneralizedHarmonic::Tags::ConstraintGamma2Compute
Compute items to compute constraint-damping parameters for a single-BH evolution.
Definition: ConstraintGammas.hpp:80
get
constexpr Tag::type & get(Variables< TagList > &v) noexcept
Return Tag::type pointing into the contiguous array.
Definition: Variables.hpp:689
GeneralizedHarmonic
Items related to evolving the first-order generalized harmonic system.
Definition: Characteristics.cpp:21
dot_product
void dot_product(const gsl::not_null< Scalar< DataType > * > dot_product, const Tensor< DataType, Symmetry< 1 >, index_list< Index >> &vector_a, const Tensor< DataType, Symmetry< 1 >, index_list< Index >> &vector_b) noexcept
Compute the Euclidean dot product of two vectors or one forms.
Definition: DotProduct.hpp:24
GeneralizedHarmonic::Tags::ConstraintGamma0
Definition: Tags.hpp:44
DotProduct.hpp
GeneralizedHarmonic::Tags::ConstraintGamma1Compute
Compute items to compute constraint-damping parameters for a single-BH evolution.
Definition: ConstraintGammas.hpp:63
cstddef
GeneralizedHarmonic::Tags::ConstraintGamma1
Definition: Tags.hpp:47
DataVector
Stores a collection of function values.
Definition: DataVector.hpp:42
Scalar
Tensor< T, Symmetry<>, index_list<> > Scalar
Definition: TypeAliases.hpp:21
Gsl.hpp
Tensor.hpp
GeneralizedHarmonic::Tags::ConstraintGamma2
Definition: Tags.hpp:50
Prefixes.hpp
TMPL.hpp
gsl::not_null
Require a pointer to not be a nullptr
Definition: Gsl.hpp:183
destructive_resize_components
void destructive_resize_components(const gsl::not_null< Container * > container, const size_t new_size, DestructiveResizeFunction destructive_resize=ContainerDestructiveResize{}) noexcept
Checks the size of each component of the container, and resizes if necessary.
Definition: ContainerHelpers.hpp:177