Constraints.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cstddef>
7 
11 
12 /// \cond
13 namespace gsl {
14 template <typename T>
15 class not_null;
16 } // namespace gsl
17 /// \endcond
18 
19 namespace ScalarWave {
20 // @{
21 /*!
22  * \brief Compute the scalar-wave one-index constraint.
23  *
24  * \details Computes the scalar-wave one-index constraint,
25  * \f$C_{i} = \partial_i\psi - \Phi_{i},\f$ which is
26  * given by Eq. (19) of \cite Holst2004wt
27  */
28 template <size_t SpatialDim>
29 tnsr::i<DataVector, SpatialDim, Frame::Inertial> one_index_constraint(
30  const tnsr::i<DataVector, SpatialDim, Frame::Inertial>& d_psi,
31  const tnsr::i<DataVector, SpatialDim, Frame::Inertial>& phi) noexcept;
32 
33 template <size_t SpatialDim>
35  gsl::not_null<tnsr::i<DataVector, SpatialDim, Frame::Inertial>*> constraint,
36  const tnsr::i<DataVector, SpatialDim, Frame::Inertial>& d_psi,
37  const tnsr::i<DataVector, SpatialDim, Frame::Inertial>& phi) noexcept;
38 // @}
39 
40 // @{
41 /*!
42  * \brief Compute the scalar-wave 2-index constraint.
43  *
44  * \details Computes the scalar-wave 2-index constraint
45  * \f$C_{ij} = \partial_i\Phi_j - \partial_j\Phi_i,\f$
46  * where \f$\Phi_{i} = \partial_i\psi\f$, that is given by
47  * Eq. (20) of \cite Holst2004wt
48  *
49  * \note We do not support custom storage for antisymmetric tensors yet.
50  */
51 template <size_t SpatialDim>
52 tnsr::ij<DataVector, SpatialDim, Frame::Inertial> two_index_constraint(
53  const tnsr::ij<DataVector, SpatialDim, Frame::Inertial>& d_phi) noexcept;
54 
55 template <size_t SpatialDim>
57  gsl::not_null<tnsr::ij<DataVector, SpatialDim, Frame::Inertial>*>
58  constraint,
59  const tnsr::ij<DataVector, SpatialDim, Frame::Inertial>& d_phi) noexcept;
60 // @}
61 
62 namespace Tags {
63 /*!
64  * \brief Compute item to get the one-index constraint for the scalar-wave
65  * evolution system.
66  *
67  * \details See `one_index_constraint()`. Can be retrieved using
68  * `ScalarWave::Tags::OneIndexConstraint`.
69  */
70 template <size_t SpatialDim>
73  using argument_tags =
74  tmpl::list<::Tags::deriv<Psi, tmpl::size_t<SpatialDim>, Frame::Inertial>,
76  using return_type = tnsr::i<DataVector, SpatialDim, Frame::Inertial>;
77  static constexpr void (*function)(
78  const gsl::not_null<return_type*> result,
79  const tnsr::i<DataVector, SpatialDim, Frame::Inertial>&,
80  const tnsr::i<DataVector, SpatialDim, Frame::Inertial>&) =
81  &one_index_constraint<SpatialDim>;
83 };
84 
85 /*!
86  * \brief Compute item to get the two-index constraint for the scalar-wave
87  * evolution system.
88  *
89  * \details See `two_index_constraint()`. Can be retrieved using
90  * `ScalarWave::Tags::TwoIndexConstraint`.
91  */
92 template <size_t SpatialDim>
95  using argument_tags =
96  tmpl::list<::Tags::deriv<Phi<SpatialDim>, tmpl::size_t<SpatialDim>,
98  using return_type = tnsr::ij<DataVector, SpatialDim, Frame::Inertial>;
99  static constexpr void (*function)(
100  const gsl::not_null<return_type*> result,
101  const tnsr::ij<DataVector, SpatialDim, Frame::Inertial>&) =
102  &two_index_constraint<SpatialDim>;
104 };
105 
106 } // namespace Tags
107 } // namespace ScalarWave
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:93
Definition: Tags.hpp:31
Marks a DataBoxTag as being a compute item that executes a function.
Definition: DataBoxTag.hpp:154
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
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...
Definition: ComputeGhQuantities.cpp:59
Defines functions computing partial derivatives.
Compute item to get the one-index constraint for the scalar-wave evolution system.
Definition: Constraints.hpp:71
Definition: DataBoxTag.hpp:29
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