Constraints.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cstddef>
7 
8 #include "DataStructures/DataBox/Tag.hpp"
12 
13 /// \cond
14 namespace gsl {
15 template <typename T>
16 class not_null;
17 } // namespace gsl
18 /// \endcond
19 
20 namespace ScalarWave {
21 // @{
22 /*!
23  * \brief Compute the scalar-wave one-index constraint.
24  *
25  * \details Computes the scalar-wave one-index constraint,
26  * \f$C_{i} = \partial_i\psi - \Phi_{i},\f$ which is
27  * given by Eq. (19) of \cite Holst2004wt
28  */
29 template <size_t SpatialDim>
30 tnsr::i<DataVector, SpatialDim, Frame::Inertial> one_index_constraint(
31  const tnsr::i<DataVector, SpatialDim, Frame::Inertial>& d_psi,
32  const tnsr::i<DataVector, SpatialDim, Frame::Inertial>& phi) noexcept;
33 
34 template <size_t SpatialDim>
36  gsl::not_null<tnsr::i<DataVector, SpatialDim, Frame::Inertial>*> constraint,
37  const tnsr::i<DataVector, SpatialDim, Frame::Inertial>& d_psi,
38  const tnsr::i<DataVector, SpatialDim, Frame::Inertial>& phi) noexcept;
39 // @}
40 
41 // @{
42 /*!
43  * \brief Compute the scalar-wave 2-index constraint.
44  *
45  * \details Computes the scalar-wave 2-index constraint
46  * \f$C_{ij} = \partial_i\Phi_j - \partial_j\Phi_i,\f$
47  * where \f$\Phi_{i} = \partial_i\psi\f$, that is given by
48  * Eq. (20) of \cite Holst2004wt
49  *
50  * \note We do not support custom storage for antisymmetric tensors yet.
51  */
52 template <size_t SpatialDim>
53 tnsr::ij<DataVector, SpatialDim, Frame::Inertial> two_index_constraint(
54  const tnsr::ij<DataVector, SpatialDim, Frame::Inertial>& d_phi) noexcept;
55 
56 template <size_t SpatialDim>
58  gsl::not_null<tnsr::ij<DataVector, SpatialDim, Frame::Inertial>*>
59  constraint,
60  const tnsr::ij<DataVector, SpatialDim, Frame::Inertial>& d_phi) noexcept;
61 // @}
62 
63 namespace Tags {
64 /*!
65  * \brief Compute item to get the one-index constraint for the scalar-wave
66  * evolution system.
67  *
68  * \details See `one_index_constraint()`. Can be retrieved using
69  * `ScalarWave::Tags::OneIndexConstraint`.
70  */
71 template <size_t SpatialDim>
74  using argument_tags =
75  tmpl::list<::Tags::deriv<Psi, tmpl::size_t<SpatialDim>, Frame::Inertial>,
77  using return_type = tnsr::i<DataVector, SpatialDim, Frame::Inertial>;
78  static constexpr void (*function)(
79  const gsl::not_null<return_type*> result,
80  const tnsr::i<DataVector, SpatialDim, Frame::Inertial>&,
81  const tnsr::i<DataVector, SpatialDim, Frame::Inertial>&) =
82  &one_index_constraint<SpatialDim>;
84 };
85 
86 /*!
87  * \brief Compute item to get the two-index constraint for the scalar-wave
88  * evolution system.
89  *
90  * \details See `two_index_constraint()`. Can be retrieved using
91  * `ScalarWave::Tags::TwoIndexConstraint`.
92  */
93 template <size_t SpatialDim>
96  using argument_tags =
97  tmpl::list<::Tags::deriv<Phi<SpatialDim>, tmpl::size_t<SpatialDim>,
99  using return_type = tnsr::ij<DataVector, SpatialDim, Frame::Inertial>;
100  static constexpr void (*function)(
101  const gsl::not_null<return_type*> result,
102  const tnsr::ij<DataVector, SpatialDim, Frame::Inertial>&) =
103  &two_index_constraint<SpatialDim>;
105 };
106 
107 } // namespace Tags
108 } // namespace ScalarWave
db::ComputeTag
Marks a DataBoxTag as being a compute item that executes a function.
Definition: Tag.hpp:109
Frame::Inertial
Definition: IndexType.hpp:44
ScalarWave::Phi
Definition: Tags.hpp:31
Tags.hpp
ScalarWave::Tags::TwoIndexConstraint
Tag for the two-index constraint of the ScalarWave system.
Definition: Tags.hpp:59
cstddef
ScalarWave::one_index_constraint
tnsr::i< DataVector, SpatialDim, Frame::Inertial > one_index_constraint(const tnsr::i< DataVector, SpatialDim, Frame::Inertial > &d_psi, const tnsr::i< DataVector, SpatialDim, Frame::Inertial > &phi) noexcept
Compute the scalar-wave one-index constraint.
Definition: Constraints.cpp:17
GeneralizedHarmonic::phi
void phi(gsl::not_null< tnsr::iaa< DataType, SpatialDim, Frame > * > phi, const Scalar< DataType > &lapse, const tnsr::i< DataType, SpatialDim, Frame > &deriv_lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::iJ< DataType, SpatialDim, Frame > &deriv_shift, const tnsr::ii< DataType, SpatialDim, Frame > &spatial_metric, const tnsr::ijj< DataType, SpatialDim, Frame > &deriv_spatial_metric) noexcept
Computes the auxiliary variable used by the generalized harmonic formulation of Einstein's equations...
ScalarWave::Tags::OneIndexConstraint
Tag for the one-index constraint of the ScalarWave system.
Definition: Tags.hpp:49
TypeAliases.hpp
ScalarWave::Tags::TwoIndexConstraintCompute
Compute item to get the two-index constraint for the scalar-wave evolution system.
Definition: Constraints.hpp:94
ScalarWave
Items related to evolving the scalar wave equation.
Definition: Characteristics.cpp:16
ScalarWave::two_index_constraint
tnsr::ij< DataVector, SpatialDim, Frame::Inertial > two_index_constraint(const tnsr::ij< DataVector, SpatialDim, Frame::Inertial > &d_phi) noexcept
Compute the scalar-wave 2-index constraint.
Definition: Constraints.cpp:45
ScalarWave::Tags::OneIndexConstraintCompute
Compute item to get the one-index constraint for the scalar-wave evolution system.
Definition: Constraints.hpp:72
PartialDerivatives.hpp
gsl
Implementations from the Guideline Support Library.
Definition: Gsl.hpp:80
gsl::not_null
Require a pointer to not be a nullptr
Definition: Gsl.hpp:183