Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <cstddef>
7 :
8 : #include "DataStructures/Tensor/TypeAliases.hpp"
9 : #include "Utilities/Gsl.hpp"
10 :
11 : namespace Ccz4 {
12 : /// @{
13 : /*!
14 : * \brief Computes the gradient of the spatial part of the Z4 constraint
15 : *
16 : * \details Computes the gradient as:
17 : *
18 : * \f{align}
19 : * \nabla_i Z_j &=
20 : * D_{ijl} \left(\hat{\Gamma}^l - \tilde{\Gamma}^l\right) +
21 : * \frac{1}{2} \tilde{\gamma}_{jl} \left(
22 : * \partial_i \hat{\Gamma}^l - \partial_i \tilde{\Gamma}^l\right) -
23 : * \Gamma^l_{ij} Z_l
24 : * \f}
25 : *
26 : * where \f$Z_i\f$ is the spatial Z4 constraint defined by
27 : * `Ccz4::Tags::SpatialZ4Constraint`, \f$\tilde{\gamma}_{ij}\f$ is the conformal
28 : * spatial metric defined by `Ccz4::Tags::ConformalMetric`, \f$\Gamma^k_{ij}\f$
29 : * is the spatial Christoffel symbols of the second kind defined by
30 : * `Ccz4::Tags::ChristoffelSecondKind`, \f$D_{ijk}\f$ is the CCZ4 auxiliary
31 : * variable defined by `Ccz4::Tags::FieldD`,
32 : * \f$\left(\hat{\Gamma}^i - \tilde{\Gamma}^i\right)\f$ is the CCZ4 temporary
33 : * expression defined by
34 : * `Ccz4::Tags::GammaHatMinusContractedConformalChristoffel`, and
35 : * \f$\left(\partial_i \hat{\Gamma}^j - \partial_i \tilde{\Gamma}^j\right)\f$ is
36 : * its spatial derivative.
37 : */
38 : template <typename DataType, size_t Dim, typename Frame>
39 1 : void grad_spatial_z4_constraint(
40 : const gsl::not_null<tnsr::ij<DataType, Dim, Frame>*> result,
41 : const tnsr::i<DataType, Dim, Frame>& spatial_z4_constraint,
42 : const tnsr::ii<DataType, Dim, Frame>& conformal_spatial_metric,
43 : const tnsr::Ijj<DataType, Dim, Frame>& christoffel_second_kind,
44 : const tnsr::ijj<DataType, Dim, Frame>& field_d,
45 : const tnsr::I<DataType, Dim, Frame>&
46 : gamma_hat_minus_contracted_conformal_christoffel,
47 : const tnsr::iJ<DataType, Dim, Frame>&
48 : d_gamma_hat_minus_contracted_conformal_christoffel);
49 :
50 : template <typename DataType, size_t Dim, typename Frame>
51 1 : tnsr::ij<DataType, Dim, Frame> grad_spatial_z4_constraint(
52 : const tnsr::i<DataType, Dim, Frame>& spatial_z4_constraint,
53 : const tnsr::ii<DataType, Dim, Frame>& conformal_spatial_metric,
54 : const tnsr::Ijj<DataType, Dim, Frame>& christoffel_second_kind,
55 : const tnsr::ijj<DataType, Dim, Frame>& field_d,
56 : const tnsr::I<DataType, Dim, Frame>&
57 : gamma_hat_minus_contracted_conformal_christoffel,
58 : const tnsr::iJ<DataType, Dim, Frame>&
59 : d_gamma_hat_minus_contracted_conformal_christoffel);
60 : /// @}
61 : } // namespace Ccz4
|