Constraints.hpp
Go to the documentation of this file.
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 ///\file
5 /// Defines functions to calculate the scalar wave constraints in
6 /// curved spacetime
7 
8 #pragma once
9 
10 #include <cstddef>
11 
12 #include "DataStructures/DataBox/Tag.hpp"
16 #include "Utilities/Gsl.hpp"
17 #include "Utilities/TMPL.hpp"
18 
19 namespace CurvedScalarWave {
20 // @{
21 /*!
22  * \brief Computes 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 Computes the scalar-wave 2-index constraint.
43  *
44  * \details Computes the scalar-wave 2-index FOSH constraint
45  * [Eq. (20) of \cite Holst2004wt],
46  *
47  * \f{eqnarray}{
48  * C_{ij} &\equiv& \partial_i \Phi_j - \partial_j \Phi_i
49  * \f}
50  *
51  * where \f$\Phi_{i} = \partial_i\psi\f$; and \f$\psi\f$ is the scalar field.
52  */
53 template <size_t SpatialDim>
54 tnsr::ij<DataVector, SpatialDim, Frame::Inertial> two_index_constraint(
55  const tnsr::ij<DataVector, SpatialDim, Frame::Inertial>& d_phi) noexcept;
56 
57 template <size_t SpatialDim>
59  gsl::not_null<tnsr::ij<DataVector, SpatialDim, Frame::Inertial>*>
60  constraint,
61  const tnsr::ij<DataVector, SpatialDim, Frame::Inertial>& d_phi) noexcept;
62 // @}
63 
64 namespace Tags {
65 /*!
66  * \brief Compute item to get the one-index constraint for the scalar-wave
67  * evolution system.
68  *
69  * \details See `one_index_constraint()`. Can be retrieved using
70  * `CurvedScalarWave::Tags::OneIndexConstraint`.
71  */
72 template <size_t SpatialDim>
75  using argument_tags =
76  tmpl::list<::Tags::deriv<Psi, tmpl::size_t<SpatialDim>, Frame::Inertial>,
78  using return_type = tnsr::i<DataVector, SpatialDim, Frame::Inertial>;
79  static constexpr void (*function)(
80  const gsl::not_null<return_type*> result,
81  const tnsr::i<DataVector, SpatialDim, Frame::Inertial>&,
82  const tnsr::i<DataVector, SpatialDim, Frame::Inertial>&) =
83  &one_index_constraint<SpatialDim>;
85 };
86 
87 /*!
88  * \brief Compute item to get the two-index constraint for the scalar-wave
89  * evolution system.
90  *
91  * \details See `two_index_constraint()`. Can be retrieved using
92  * `CurvedScalarWave::Tags::TwoIndexConstraint`.
93  */
94 template <size_t SpatialDim>
97  using argument_tags =
98  tmpl::list<::Tags::deriv<Phi<SpatialDim>, tmpl::size_t<SpatialDim>,
100  using return_type = tnsr::ij<DataVector, SpatialDim, Frame::Inertial>;
101  static constexpr void (*function)(
102  const gsl::not_null<return_type*> result,
103  const tnsr::ij<DataVector, SpatialDim, Frame::Inertial>&) =
104  &two_index_constraint<SpatialDim>;
106 };
107 } // namespace Tags
108 } // namespace CurvedScalarWave
db::ComputeTag
Marks a DataBoxTag as being a compute item that executes a function.
Definition: Tag.hpp:109
Frame::Inertial
Definition: IndexType.hpp:44
Tags.hpp
CurvedScalarWave::Phi
Definition: Tags.hpp:32
CurvedScalarWave::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
Computes the scalar-wave one-index constraint.
Definition: Constraints.cpp:16
CurvedScalarWave::Tags::TwoIndexConstraintCompute
Compute item to get the two-index constraint for the scalar-wave evolution system.
Definition: Constraints.hpp:95
cstddef
CurvedScalarWave::Tags::OneIndexConstraintCompute
Compute item to get the one-index constraint for the scalar-wave evolution system.
Definition: Constraints.hpp:73
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...
CurvedScalarWave::Tags::TwoIndexConstraint
Tag for the two-index constraint of the scalar wave system in curved spacetime.
Definition: Tags.hpp:64
Gsl.hpp
Tensor.hpp
CurvedScalarWave::Tags::OneIndexConstraint
Tag for the one-index constraint of the scalar wave system in curved spacetime.
Definition: Tags.hpp:53
PartialDerivatives.hpp
TMPL.hpp
CurvedScalarWave::two_index_constraint
tnsr::ij< DataVector, SpatialDim, Frame::Inertial > two_index_constraint(const tnsr::ij< DataVector, SpatialDim, Frame::Inertial > &d_phi) noexcept
Computes the scalar-wave 2-index constraint.
Definition: Constraints.cpp:47
CurvedScalarWave
Items related to evolving a scalar wave on a curved background.
Definition: Characteristics.cpp:18
gsl::not_null
Require a pointer to not be a nullptr
Definition: Gsl.hpp:183