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
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&#39;s equations...
Implementations from the Guideline Support Library.
Definition: Gsl.hpp:79
Compute item to get the two-index constraint for the scalar-wave evolution system.
Definition: Constraints.hpp:94
Definition: Tags.hpp:31
Marks a DataBoxTag as being a compute item that executes a function.
Definition: Tag.hpp:109
void two_index_constraint(gsl::not_null< tnsr::ia< DataType, SpatialDim, Frame > *> constraint, const tnsr::ia< DataType, SpatialDim, Frame > &d_gauge_function, const tnsr::a< DataType, SpatialDim, Frame > &spacetime_normal_one_form, const tnsr::A< DataType, SpatialDim, Frame > &spacetime_normal_vector, const tnsr::II< DataType, SpatialDim, Frame > &inverse_spatial_metric, const tnsr::AA< DataType, SpatialDim, Frame > &inverse_spacetime_metric, const tnsr::aa< DataType, SpatialDim, Frame > &pi, const tnsr::iaa< DataType, SpatialDim, Frame > &phi, const tnsr::iaa< DataType, SpatialDim, Frame > &d_pi, const tnsr::ijaa< DataType, SpatialDim, Frame > &d_phi, const Scalar< DataType > &gamma2, const tnsr::iaa< DataType, SpatialDim, Frame > &three_index_constraint) noexcept
Computes the generalized-harmonic 2-index constraint.
Tag for the one-index constraint of the ScalarWave system.
Definition: Tags.hpp:49
Defines DataBox tags for scalar wave system.
Items related to evolving the scalar wave equation.
Definition: Characteristics.cpp:16
Defines functions computing partial derivatives.
Compute item to get the one-index constraint for the scalar-wave evolution system.
Definition: Constraints.hpp:72
Definition: DataBoxTag.hpp:27
Defines a list of useful type aliases for tensors.
Tag for the two-index constraint of the ScalarWave system.
Definition: Tags.hpp:59
Definition: IndexType.hpp:44
void one_index_constraint(gsl::not_null< tnsr::i< DataVector, SpatialDim, Frame::Inertial > *> constraint, const tnsr::i< DataVector, SpatialDim, Frame::Inertial > &d_psi, const tnsr::i< DataVector, SpatialDim, Frame::Inertial > &phi) noexcept
Computes the scalar-wave one-index constraint.
Require a pointer to not be a nullptr
Definition: Gsl.hpp:182