ComputeItems.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cstddef>
7 
8 /// \cond
9 class DataVector;
10 /// \endcond
11 
15 #include "Evolution/Systems/GeneralizedHarmonic/Tags.hpp"
19 #include "PointwiseFunctions/GeneralRelativity/IndexManipulation.hpp"
20 #include "PointwiseFunctions/GeneralRelativity/Tags.hpp"
21 #include "Utilities/TMPL.hpp"
22 
23 namespace ah {
24 namespace Tags {
25 // @{
26 /// These ComputeItems are different from those used in
27 /// GeneralizedHarmonic evolution because these live only on the
28 /// intrp::Actions::ApparentHorizon DataBox, not in the volume
29 /// DataBox. And these ComputeItems can do fewer allocations than the
30 /// volume ones, because (for example) Lapse, SpaceTimeNormalVector,
31 /// etc. can be inlined instead of being allocated as a separate
32 /// ComputeItem.
33 template <size_t Dim, typename Frame>
36  static tnsr::II<DataVector, Dim, Frame> function(
37  const tnsr::aa<DataVector, Dim, Frame>& psi) noexcept {
38  return determinant_and_inverse(gr::spatial_metric(psi)).second;
39  };
40  using argument_tags = tmpl::list<gr::Tags::SpacetimeMetric<Dim, Frame>>;
41 };
42 template <size_t Dim, typename Frame>
45  static tnsr::ii<DataVector, Dim, Frame> function(
46  const tnsr::aa<DataVector, Dim, Frame>& psi,
47  const tnsr::aa<DataVector, Dim, Frame>& pi,
48  const tnsr::iaa<DataVector, Dim, Frame>& phi,
49  const tnsr::II<DataVector, Dim, Frame>& inv_g) noexcept {
50  const auto shift = gr::shift(psi, inv_g);
53  }
54  using argument_tags = tmpl::list<gr::Tags::SpacetimeMetric<Dim, Frame>,
58 };
59 template <size_t Dim, typename Frame>
63  static tnsr::Ijj<DataVector, Dim, Frame> function(
64  const tnsr::iaa<DataVector, Dim, Frame>& phi,
65  const tnsr::II<DataVector, Dim, Frame>& inv_g) noexcept {
67  gr::christoffel_first_kind(
68  GeneralizedHarmonic::deriv_spatial_metric(phi)),
69  inv_g);
70  }
71  using argument_tags = tmpl::list<GeneralizedHarmonic::Tags::Phi<Dim, Frame>,
73 };
74 // }@
75 } // namespace Tags
76 } // namespace ah
Auxiliary variable which is analytically the spatial derivative of the spacetime metric.
Definition: Tags.hpp:39
Defines function computing the determinant and inverse of a tensor.
Conjugate momentum to the spacetime metric.
Definition: Tags.hpp:27
Definition: ComputeItems.hpp:43
Definition: ComputeItems.hpp:60
Marks a DataBoxTag as being a compute item that executes a function.
Definition: DataBoxTag.hpp:155
tnsr::A< DataType, SpatialDim, Frame > spacetime_normal_vector(const Scalar< DataType > &lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift) noexcept
Computes spacetime normal vector from lapse and shift.
Definition: ComputeSpacetimeQuantities.cpp:185
Definition: Tags.hpp:31
Defines Functions for calculating spacetime tensors from 3+1 quantities.
tnsr::ii< DataType, SpatialDim, Frame > spatial_metric(const tnsr::aa< DataType, SpatialDim, Frame > &spacetime_metric) noexcept
Compute spatial metric from spacetime metric.
Definition: ComputeSpacetimeQuantities.cpp:43
tnsr::aa< DataType, SpatialDim, Frame > pi(const Scalar< DataType > &lapse, const Scalar< DataType > &dt_lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::I< DataType, SpatialDim, Frame > &dt_shift, const tnsr::ii< DataType, SpatialDim, Frame > &spatial_metric, const tnsr::ii< DataType, SpatialDim, Frame > &dt_spatial_metric, const tnsr::iaa< DataType, SpatialDim, Frame > &phi) noexcept
Computes the conjugate momentum of the spacetime metric .
Definition: ComputeGhQuantities.cpp:58
auto determinant_and_inverse(const Tensor< T, Symm, tmpl::list< Index0, Index1 >> &tensor) noexcept -> std::pair< Scalar< T >, Tensor< T, Symm, tmpl::list< change_index_up_lo< Index1 >, change_index_up_lo< Index0 >>>>
Computes the determinant and inverse of a rank-2 Tensor.
Definition: DeterminantAndInverse.hpp:356
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:22
Definition: DataBoxTag.hpp:29
Scalar< DataType > lapse(const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::aa< DataType, SpatialDim, Frame > &spacetime_metric) noexcept
Compute lapse from shift and spacetime metric.
Definition: ComputeSpacetimeQuantities.cpp:98
Defines a list of useful type aliases for tensors.
void raise_or_lower_first_index(gsl::not_null< Tensor< DataType, Symmetry< 2, 1, 1 >, index_list< change_index_up_lo< Index0 >, Index1, Index1 >> *> result, const Tensor< DataType, Symmetry< 2, 1, 1 >, index_list< Index0, Index1, Index1 >> &tensor, const Tensor< DataType, Symmetry< 1, 1 >, index_list< change_index_up_lo< Index0 >, change_index_up_lo< Index0 >>> &metric) noexcept
Raises or lowers the first index of a rank 3 tensor which is symmetric in the last two indices...
tnsr::I< DataType, SpatialDim, Frame > shift(const tnsr::aa< DataType, SpatialDim, Frame > &spacetime_metric, const tnsr::II< DataType, SpatialDim, Frame > &inverse_spatial_metric) noexcept
Compute shift from spacetime metric and inverse spatial metric.
Definition: ComputeSpacetimeQuantities.cpp:82
Definition: ComputeItems.hpp:23
Stores a collection of function values.
Definition: DataVector.hpp:42
Wraps the template metaprogramming library used (brigand)
Defines classes SimpleTag, PrefixTag, ComputeTag and several functions for retrieving tag info...
Defines Functions for calculating spacetime tensors from 3+1 quantities.
tnsr::ii< DataType, SpatialDim, Frame > extrinsic_curvature(const tnsr::A< DataType, SpatialDim, Frame > &spacetime_normal_vector, const tnsr::aa< DataType, SpatialDim, Frame > &pi, const tnsr::iaa< DataType, SpatialDim, Frame > &phi) noexcept
Computes extrinsic curvature from generalized harmonic variables and the spacetime normal vector...
Definition: ComputeGhQuantities.cpp:145
Defines functions to calculate Christoffel symbols.
These ComputeItems are different from those used in GeneralizedHarmonic evolution because these live ...
Definition: ComputeItems.hpp:34
Definition: Tags.hpp:96