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/DataBox/Prefixes.hpp"
9 : #include "DataStructures/DataBox/Tag.hpp"
10 : #include "DataStructures/Tensor/TypeAliases.hpp"
11 : #include "PointwiseFunctions/GeneralRelativity/Tags.hpp"
12 : #include "Utilities/Gsl.hpp"
13 : #include "Utilities/TMPL.hpp"
14 :
15 : namespace gr {
16 : /// @{
17 : /*!
18 : * \ingroup GeneralRelativityGroup
19 : * \brief Computes the spatial derivative of the inverse spatial metric from the
20 : * inverse spatial metric and the spatial derivative of the spatial metric.
21 : *
22 : * \details Computes the derivative as:
23 : * \f{align}
24 : * \partial_k \gamma^{ij} &= -\gamma^{in} \gamma^{mj}
25 : * \partial_k \gamma_{nm}
26 : * \f}
27 : * where \f$\gamma^{ij}\f$ and \f$\partial_k \gamma_{ij}\f$ are the inverse
28 : * spatial metric and spatial derivative of the spatial metric, respectively.
29 : */
30 : template <typename DataType, size_t Dim, typename Frame>
31 1 : void deriv_inverse_spatial_metric(
32 : gsl::not_null<tnsr::iJJ<DataType, Dim, Frame>*> result,
33 : const tnsr::II<DataType, Dim, Frame>& inverse_spatial_metric,
34 : const tnsr::ijj<DataType, Dim, Frame>& d_spatial_metric);
35 :
36 : template <typename DataType, size_t Dim, typename Frame>
37 1 : tnsr::iJJ<DataType, Dim, Frame> deriv_inverse_spatial_metric(
38 : const tnsr::II<DataType, Dim, Frame>& inverse_spatial_metric,
39 : const tnsr::ijj<DataType, Dim, Frame>& d_spatial_metric);
40 : /// @}
41 :
42 : namespace Tags {
43 :
44 : /// \brief Compute item for the spatial derivative of the inverse spatial
45 : /// metric.
46 : /// \see deriv_inverse_spatial_metric
47 : template <size_t Dim, typename Frame>
48 1 : struct DerivInverseSpatialMetricCompute
49 : : ::Tags::deriv<InverseSpatialMetric<DataVector, Dim, Frame>,
50 : tmpl::size_t<Dim>, Frame>,
51 : db::ComputeTag {
52 0 : using base = ::Tags::deriv<InverseSpatialMetric<DataVector, Dim, Frame>,
53 : tmpl::size_t<Dim>, Frame>;
54 0 : using argument_tags =
55 : tmpl::list<InverseSpatialMetric<DataVector, Dim, Frame>,
56 : ::Tags::deriv<SpatialMetric<DataVector, Dim, Frame>,
57 : tmpl::size_t<Dim>, Frame>>;
58 0 : using return_type = tnsr::iJJ<DataVector, Dim, Frame>;
59 0 : static constexpr auto function =
60 : static_cast<void (*)(gsl::not_null<tnsr::iJJ<DataVector, Dim, Frame>*>,
61 : const tnsr::II<DataVector, Dim, Frame>&,
62 : const tnsr::ijj<DataVector, Dim, Frame>&)>(
63 : &gr::deriv_inverse_spatial_metric<DataVector, Dim, Frame>);
64 : };
65 :
66 : } // namespace Tags
67 :
68 : } // namespace gr
|