Namespaces | Functions
General Relativity

Contains functions used in General Relativistic simulations. More...

Namespaces

 gr
 Holds functions related to general relativity.
 

Functions

template<size_t SpatialDim, typename Frame , typename DataType >
tnsr::iaa< DataType, SpatialDim, Frame > GeneralizedHarmonic::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 \(\Phi_{iab}\) used by the generalized harmonic formulation of Einstein's equations. More...
 
template<size_t SpatialDim, typename Frame , typename DataType >
tnsr::aa< DataType, SpatialDim, Frame > GeneralizedHarmonic::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 \(\Pi_{ab}\) of the spacetime metric \( \psi_{ab} \). More...
 
template<size_t SpatialDim, typename Frame , typename DataType >
tnsr::a< DataType, SpatialDim, Frame > GeneralizedHarmonic::gauge_source (const Scalar< DataType > &lapse, const Scalar< DataType > &dt_lapse, const tnsr::i< DataType, SpatialDim, Frame > &deriv_lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::I< DataType, SpatialDim, Frame > &dt_shift, const tnsr::iJ< DataType, SpatialDim, Frame > &deriv_shift, const tnsr::ii< DataType, SpatialDim, Frame > &spatial_metric, const Scalar< DataType > &trace_extrinsic_curvature, const tnsr::i< DataType, SpatialDim, Frame > &trace_christoffel_last_indices) noexcept
 Computes generalized harmonic gauge source function. More...
 
template<size_t SpatialDim, typename Frame , typename DataType >
tnsr::ii< DataType, SpatialDim, Frame > GeneralizedHarmonic::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. More...
 
template<size_t SpatialDim, typename Frame , typename DataType >
tnsr::aa< DataType, SpatialDim, Frame > gr::spacetime_metric (const Scalar< DataType > &lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::ii< DataType, SpatialDim, Frame > &spatial_metric) noexcept
 Computes the spacetime metric from the spatial metric, lapse, and shift. More...
 
template<size_t SpatialDim, typename Frame , typename DataType >
tnsr::ii< DataType, SpatialDim, Frame > gr::spatial_metric (const tnsr::aa< DataType, SpatialDim, Frame > &spacetime_metric) noexcept
 Compute spatial metric from spacetime metric. More...
 
template<size_t SpatialDim, typename Frame , typename DataType >
tnsr::AA< DataType, SpatialDim, Frame > gr::inverse_spacetime_metric (const Scalar< DataType > &lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::II< DataType, SpatialDim, Frame > &inverse_spatial_metric) noexcept
 Compute inverse spacetime metric from inverse spatial metric, lapse and shift. More...
 
template<size_t SpatialDim, typename Frame , typename DataType >
tnsr::I< DataType, SpatialDim, Frame > gr::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. More...
 
template<size_t SpatialDim, typename Frame , typename DataType >
Scalar< DataType > gr::lapse (const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::aa< DataType, SpatialDim, Frame > &spacetime_metric) noexcept
 Compute lapse from shift and spacetime metric. More...
 
template<size_t SpatialDim, typename Frame , typename DataType >
tnsr::abb< DataType, SpatialDim, Frame > gr::derivatives_of_spacetime_metric (const Scalar< DataType > &lapse, const Scalar< DataType > &dt_lapse, const tnsr::i< DataType, SpatialDim, Frame > &deriv_lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::I< DataType, SpatialDim, Frame > &dt_shift, const tnsr::iJ< DataType, SpatialDim, Frame > &deriv_shift, const tnsr::ii< DataType, SpatialDim, Frame > &spatial_metric, const tnsr::ii< DataType, SpatialDim, Frame > &dt_spatial_metric, const tnsr::ijj< DataType, SpatialDim, Frame > &deriv_spatial_metric) noexcept
 Computes spacetime derivative of spacetime metric from spatial metric, lapse, shift, and their space and time derivatives. More...
 
template<size_t SpatialDim, typename Frame , typename DataType >
tnsr::A< DataType, SpatialDim, Frame > gr::spacetime_normal_vector (const Scalar< DataType > &lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift) noexcept
 Computes spacetime normal vector from lapse and shift. More...
 
template<size_t SpatialDim, typename Frame , typename DataType >
tnsr::ii< DataType, SpatialDim, Frame > gr::extrinsic_curvature (const Scalar< DataType > &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::ii< DataType, SpatialDim, Frame > &dt_spatial_metric, const tnsr::ijj< DataType, SpatialDim, Frame > &deriv_spatial_metric) noexcept
 Computes extrinsic curvature from metric and derivatives. More...
 
template<size_t SpatialDim, typename Frame , IndexType Index, typename DataType >
tnsr::aa< DataType, SpatialDim, Frame, Indexgr::ricci_tensor (const tnsr::Abb< DataType, SpatialDim, Frame, Index > &christoffel_2nd_kind, const tnsr::aBcc< DataType, SpatialDim, Frame, Index > &d_christoffel_2nd_kind) noexcept
 Computes Ricci tensor from the (spatial or spacetime) Christoffel symbol of the second kind and its derivative. More...
 
template<size_t SpatialDim, typename Frame , IndexType Index, typename DataType >
void gr::christoffel_first_kind (gsl::not_null< tnsr::abb< DataType, SpatialDim, Frame, Index > *> christoffel, const tnsr::abb< DataType, SpatialDim, Frame, Index > &d_metric) noexcept
 Computes Christoffel symbol of the first kind from derivative of metric. More...
 
template<size_t SpatialDim, typename Frame , IndexType Index, typename DataType >
tnsr::abb< DataType, SpatialDim, Frame, Indexgr::christoffel_first_kind (const tnsr::abb< DataType, SpatialDim, Frame, Index > &d_metric) noexcept
 Computes Christoffel symbol of the first kind from derivative of metric. More...
 
template<size_t SpatialDim, typename Frame , typename DataType >
void GeneralizedHarmonic::deriv_spatial_metric (gsl::not_null< tnsr::ijj< DataType, SpatialDim, Frame > *> d_spatial_metric, const tnsr::iaa< DataType, SpatialDim, Frame > &phi) noexcept
 Computes spatial derivatives of the spatial metric from the generalized harmonic spatial derivative variable. More...
 
template<size_t SpatialDim, typename Frame , typename DataType >
tnsr::ijj< DataType, SpatialDim, Frame > GeneralizedHarmonic::deriv_spatial_metric (const tnsr::iaa< DataType, SpatialDim, Frame > &phi) noexcept
 Computes spatial derivatives of the spatial metric from the generalized harmonic spatial derivative variable. More...
 
template<size_t SpatialDim, typename Frame , typename DataType >
void GeneralizedHarmonic::time_deriv_of_spatial_metric (gsl::not_null< tnsr::ii< DataType, SpatialDim, Frame > *> dt_spatial_metric, const Scalar< DataType > &lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::iaa< DataType, SpatialDim, Frame > &phi, const tnsr::aa< DataType, SpatialDim, Frame > &pi) noexcept
 Computes time derivative of the spatial metric. More...
 
template<size_t SpatialDim, typename Frame , typename DataType >
tnsr::ii< DataType, SpatialDim, Frame > GeneralizedHarmonic::time_deriv_of_spatial_metric (const Scalar< DataType > &lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::iaa< DataType, SpatialDim, Frame > &phi, const tnsr::aa< DataType, SpatialDim, Frame > &pi) noexcept
 Computes time derivative of the spatial metric. More...
 
template<size_t SpatialDim, typename Frame , typename DataType >
void GeneralizedHarmonic::spacetime_deriv_of_det_spatial_metric (gsl::not_null< tnsr::a< DataType, SpatialDim, Frame > *> d4_det_spatial_metric, const Scalar< DataType > &sqrt_det_spatial_metric, const tnsr::II< DataType, SpatialDim, Frame > &inverse_spatial_metric, const tnsr::ii< DataType, SpatialDim, Frame > &dt_spatial_metric, const tnsr::iaa< DataType, SpatialDim, Frame > &phi) noexcept
 Computes spacetime derivatives of the determinant of spatial metric, using the generalized harmonic variables, spatial metric, and its time derivative. More...
 
template<size_t SpatialDim, typename Frame , typename DataType >
tnsr::a< DataType, SpatialDim, Frame > GeneralizedHarmonic::spacetime_deriv_of_det_spatial_metric (const Scalar< DataType > &sqrt_det_spatial_metric, const tnsr::II< DataType, SpatialDim, Frame > &inverse_spatial_metric, const tnsr::ii< DataType, SpatialDim, Frame > &dt_spatial_metric, const tnsr::iaa< DataType, SpatialDim, Frame > &phi) noexcept
 Computes spacetime derivatives of the determinant of spatial metric, using the generalized harmonic variables, spatial metric, and its time derivative. More...
 
template<size_t SpatialDim, typename Frame , typename DataType >
void GeneralizedHarmonic::spatial_deriv_of_lapse (gsl::not_null< tnsr::i< DataType, SpatialDim, Frame > *> deriv_lapse, const Scalar< DataType > &lapse, const tnsr::A< DataType, SpatialDim, Frame > &spacetime_unit_normal, const tnsr::iaa< DataType, SpatialDim, Frame > &phi) noexcept
 Computes spatial derivatives of lapse (N) from the generalized harmonic variables and spacetime unit normal 1-form. More...
 
template<size_t SpatialDim, typename Frame , typename DataType >
tnsr::i< DataType, SpatialDim, Frame > GeneralizedHarmonic::spatial_deriv_of_lapse (const Scalar< DataType > &lapse, const tnsr::A< DataType, SpatialDim, Frame > &spacetime_unit_normal, const tnsr::iaa< DataType, SpatialDim, Frame > &phi) noexcept
 Computes spatial derivatives of lapse (N) from the generalized harmonic variables and spacetime unit normal 1-form. More...
 
template<size_t SpatialDim, typename Frame , typename DataType >
void GeneralizedHarmonic::time_deriv_of_lapse (gsl::not_null< Scalar< DataType > *> dt_lapse, const Scalar< DataType > &lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::A< DataType, SpatialDim, Frame > &spacetime_unit_normal, const tnsr::iaa< DataType, SpatialDim, Frame > &phi, const tnsr::aa< DataType, SpatialDim, Frame > &pi) noexcept
 Computes time derivative of lapse (N) from the generalized harmonic variables, lapse, shift and the spacetime unit normal 1-form. More...
 
template<size_t SpatialDim, typename Frame , typename DataType >
Scalar< DataType > GeneralizedHarmonic::time_deriv_of_lapse (const Scalar< DataType > &lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::A< DataType, SpatialDim, Frame > &spacetime_unit_normal, const tnsr::iaa< DataType, SpatialDim, Frame > &phi, const tnsr::aa< DataType, SpatialDim, Frame > &pi) noexcept
 Computes time derivative of lapse (N) from the generalized harmonic variables, lapse, shift and the spacetime unit normal 1-form. More...
 
template<size_t SpatialDim, typename Frame , typename DataType >
void GeneralizedHarmonic::spatial_deriv_of_shift (gsl::not_null< tnsr::iJ< DataType, SpatialDim, Frame > *> deriv_shift, const Scalar< DataType > &lapse, const tnsr::AA< DataType, SpatialDim, Frame > &inverse_spacetime_metric, const tnsr::A< DataType, SpatialDim, Frame > &spacetime_unit_normal, const tnsr::iaa< DataType, SpatialDim, Frame > &phi) noexcept
 Computes spatial derivatives of the shift vector from the generalized harmonic and geometric variables. More...
 
template<size_t SpatialDim, typename Frame , typename DataType >
tnsr::iJ< DataType, SpatialDim, Frame > GeneralizedHarmonic::spatial_deriv_of_shift (const Scalar< DataType > &lapse, const tnsr::AA< DataType, SpatialDim, Frame > &inverse_spacetime_metric, const tnsr::A< DataType, SpatialDim, Frame > &spacetime_unit_normal, const tnsr::iaa< DataType, SpatialDim, Frame > &phi) noexcept
 Computes spatial derivatives of the shift vector from the generalized harmonic and geometric variables. More...
 
template<size_t SpatialDim, typename Frame , typename DataType >
void GeneralizedHarmonic::time_deriv_of_shift (gsl::not_null< tnsr::I< DataType, SpatialDim, Frame > *> dt_shift, const Scalar< DataType > &lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::II< DataType, SpatialDim, Frame > &inverse_spatial_metric, const tnsr::A< DataType, SpatialDim, Frame > &spacetime_unit_normal, const tnsr::iaa< DataType, SpatialDim, Frame > &phi, const tnsr::aa< DataType, SpatialDim, Frame > &pi) noexcept
 Computes time derivative of the shift vector from the generalized harmonic and geometric variables. More...
 
template<size_t SpatialDim, typename Frame , typename DataType >
tnsr::I< DataType, SpatialDim, Frame > GeneralizedHarmonic::time_deriv_of_shift (const Scalar< DataType > &lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::II< DataType, SpatialDim, Frame > &inverse_spatial_metric, const tnsr::A< DataType, SpatialDim, Frame > &spacetime_unit_normal, const tnsr::iaa< DataType, SpatialDim, Frame > &phi, const tnsr::aa< DataType, SpatialDim, Frame > &pi) noexcept
 Computes time derivative of the shift vector from the generalized harmonic and geometric variables. More...
 
template<size_t SpatialDim, typename Frame , typename DataType >
void GeneralizedHarmonic::time_deriv_of_lower_shift (gsl::not_null< tnsr::i< DataType, SpatialDim, Frame > *> dt_lower_shift, const Scalar< DataType > &lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::ii< DataType, SpatialDim, Frame > &spatial_metric, const tnsr::A< DataType, SpatialDim, Frame > &spacetime_unit_normal, const tnsr::iaa< DataType, SpatialDim, Frame > &phi, const tnsr::aa< DataType, SpatialDim, Frame > &pi) noexcept
 Computes time derivative of index lowered shift from generalized harmonic variables, spatial metric and its time derivative. More...
 
template<size_t SpatialDim, typename Frame , typename DataType >
tnsr::i< DataType, SpatialDim, Frame > GeneralizedHarmonic::time_deriv_of_lower_shift (const Scalar< DataType > &lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::ii< DataType, SpatialDim, Frame > &spatial_metric, const tnsr::A< DataType, SpatialDim, Frame > &spacetime_unit_normal, const tnsr::iaa< DataType, SpatialDim, Frame > &phi, const tnsr::aa< DataType, SpatialDim, Frame > &pi) noexcept
 Computes time derivative of index lowered shift from generalized harmonic variables, spatial metric and its time derivative. More...
 
template<size_t SpatialDim, typename Frame , typename DataType >
void GeneralizedHarmonic::spacetime_deriv_of_norm_of_shift (gsl::not_null< tnsr::a< DataType, SpatialDim, Frame > *> d4_norm_of_shift, const Scalar< DataType > &lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::ii< DataType, SpatialDim, Frame > &spatial_metric, const tnsr::II< DataType, SpatialDim, Frame > &inverse_spatial_metric, const tnsr::AA< DataType, SpatialDim, Frame > &inverse_spacetime_metric, const tnsr::A< DataType, SpatialDim, Frame > &spacetime_unit_normal, const tnsr::iaa< DataType, SpatialDim, Frame > &phi, const tnsr::aa< DataType, SpatialDim, Frame > &pi) noexcept
 Computes spacetime derivatives of the norm of the shift vector. More...
 
template<size_t SpatialDim, typename Frame , typename DataType >
tnsr::a< DataType, SpatialDim, Frame > GeneralizedHarmonic::spacetime_deriv_of_norm_of_shift (const Scalar< DataType > &lapse, const tnsr::I< DataType, SpatialDim, Frame > &shift, const tnsr::ii< DataType, SpatialDim, Frame > &spatial_metric, const tnsr::II< DataType, SpatialDim, Frame > &inverse_spatial_metric, const tnsr::AA< DataType, SpatialDim, Frame > &inverse_spacetime_metric, const tnsr::A< DataType, SpatialDim, Frame > &spacetime_unit_normal, const tnsr::iaa< DataType, SpatialDim, Frame > &phi, const tnsr::aa< DataType, SpatialDim, Frame > &pi) noexcept
 Computes spacetime derivatives of the norm of the shift vector. More...
 
template<typename DataType , typename Index0 , typename Index1 >
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. More...
 
template<typename DataType , typename Index0 , typename Index1 >
Tensor< DataType, Symmetry< 2, 1, 1 >, index_list< change_index_up_lo< Index0 >, Index1, Index1 > > raise_or_lower_first_index (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. More...
 
template<typename DataType , typename Index0 >
void raise_or_lower_index (gsl::not_null< Tensor< DataType, Symmetry< 1 >, index_list< change_index_up_lo< Index0 >>> *> result, const Tensor< DataType, Symmetry< 1 >, index_list< Index0 >> &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 index of a rank 1 tensor. More...
 
template<typename DataType , typename Index0 >
Tensor< DataType, Symmetry< 1 >, index_list< change_index_up_lo< Index0 > > > raise_or_lower_index (const Tensor< DataType, Symmetry< 1 >, index_list< Index0 >> &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 index of a rank 1 tensor. More...
 
template<typename DataType , typename Index0 , typename Index1 >
void trace_last_indices (gsl::not_null< Tensor< DataType, Symmetry< 1 >, index_list< Index0 >> *> trace_of_tensor, 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< Index1 >, change_index_up_lo< Index1 >>> &metric) noexcept
 Computes trace of a rank 3 tensor, which is symmetric in its last two indices, tracing the symmetric indices. More...
 
template<typename DataType , typename Index0 , typename Index1 >
Tensor< DataType, Symmetry< 1 >, index_list< Index0 > > trace_last_indices (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< Index1 >, change_index_up_lo< Index1 >>> &metric) noexcept
 Computes trace of a rank 3 tensor, which is symmetric in its last two indices, tracing the symmetric indices. More...
 
template<typename DataType , typename Index0 >
void trace (gsl::not_null< Scalar< DataType > *> trace, const Tensor< DataType, Symmetry< 1, 1 >, index_list< Index0, Index0 >> &tensor, const Tensor< DataType, Symmetry< 1, 1 >, index_list< change_index_up_lo< Index0 >, change_index_up_lo< Index0 >>> &metric) noexcept
 Computes trace of a rank-2 symmetric tensor. More...
 
template<typename DataType , typename Index0 >
Scalar< DataType > trace (const Tensor< DataType, Symmetry< 1, 1 >, index_list< Index0, Index0 >> &tensor, const Tensor< DataType, Symmetry< 1, 1 >, index_list< change_index_up_lo< Index0 >, change_index_up_lo< Index0 >>> &metric) noexcept
 Computes trace of a rank-2 symmetric tensor. More...
 

Detailed Description

Contains functions used in General Relativistic simulations.

Function Documentation

◆ christoffel_first_kind() [1/2]

template<size_t SpatialDim, typename Frame , IndexType Index, typename DataType >
tnsr::abb< DataType, SpatialDim, Frame, Index > gr::christoffel_first_kind ( const tnsr::abb< DataType, SpatialDim, Frame, Index > &  d_metric)
noexcept

Computes Christoffel symbol of the first kind from derivative of metric.

Details

Computes Christoffel symbol \(\Gamma_{abc}\) as: \( \Gamma_{cab} = \frac{1}{2} ( \partial_a g_{bc} + \partial_b g_{ac} - \partial_c g_{ab}) \) where \(g_{bc}\) is either a spatial or spacetime metric

◆ christoffel_first_kind() [2/2]

template<size_t SpatialDim, typename Frame , IndexType Index, typename DataType >
void gr::christoffel_first_kind ( gsl::not_null< tnsr::abb< DataType, SpatialDim, Frame, Index > *>  christoffel,
const tnsr::abb< DataType, SpatialDim, Frame, Index > &  d_metric 
)
noexcept

Computes Christoffel symbol of the first kind from derivative of metric.

Details

Computes Christoffel symbol \(\Gamma_{abc}\) as: \( \Gamma_{cab} = \frac{1}{2} ( \partial_a g_{bc} + \partial_b g_{ac} - \partial_c g_{ab}) \) where \(g_{bc}\) is either a spatial or spacetime metric

◆ deriv_spatial_metric() [1/2]

template<size_t SpatialDim, typename Frame , typename DataType >
void GeneralizedHarmonic::deriv_spatial_metric ( gsl::not_null< tnsr::ijj< DataType, SpatialDim, Frame > *>  d_spatial_metric,
const tnsr::iaa< DataType, SpatialDim, Frame > &  phi 
)
noexcept

Computes spatial derivatives of the spatial metric from the generalized harmonic spatial derivative variable.

Details

If \( \Phi_{kab} \) is the generalized harmonic spatial derivative variable, then the derivatives of the spatial metric are

\[ \partial_k g_{ij} = \Phi_{kij} \]

This quantity is needed for computing spatial Christoffel symbols.

◆ deriv_spatial_metric() [2/2]

template<size_t SpatialDim, typename Frame , typename DataType >
tnsr::ijj< DataType, SpatialDim, Frame > GeneralizedHarmonic::deriv_spatial_metric ( const tnsr::iaa< DataType, SpatialDim, Frame > &  phi)
noexcept

Computes spatial derivatives of the spatial metric from the generalized harmonic spatial derivative variable.

Details

If \( \Phi_{kab} \) is the generalized harmonic spatial derivative variable, then the derivatives of the spatial metric are

\[ \partial_k g_{ij} = \Phi_{kij} \]

This quantity is needed for computing spatial Christoffel symbols.

◆ derivatives_of_spacetime_metric()

template<size_t SpatialDim, typename Frame , typename DataType >
tnsr::abb<DataType, SpatialDim, Frame> gr::derivatives_of_spacetime_metric ( const Scalar< DataType > &  lapse,
const Scalar< DataType > &  dt_lapse,
const tnsr::i< DataType, SpatialDim, Frame > &  deriv_lapse,
const tnsr::I< DataType, SpatialDim, Frame > &  shift,
const tnsr::I< DataType, SpatialDim, Frame > &  dt_shift,
const tnsr::iJ< DataType, SpatialDim, Frame > &  deriv_shift,
const tnsr::ii< DataType, SpatialDim, Frame > &  spatial_metric,
const tnsr::ii< DataType, SpatialDim, Frame > &  dt_spatial_metric,
const tnsr::ijj< DataType, SpatialDim, Frame > &  deriv_spatial_metric 
)
noexcept

Computes spacetime derivative of spacetime metric from spatial metric, lapse, shift, and their space and time derivatives.

Details

Computes the derivatives as:

\begin{align} \partial_\mu \psi_{tt} &= - 2 N \partial_\mu N + 2 g_{mn} N^m \partial_\mu N^n + N^m N^n \partial_\mu g_{mn} \\ \partial_\mu \psi_{ti} &= g_{mi} \partial_\mu N^m + N^m \partial_\mu g_{mi} \\ \partial_\mu \psi_{ij} &= \partial_\mu g_{ij} \end{align}

where \( N, N^i, g \) are the lapse, shift, and spatial metric respectively.

◆ extrinsic_curvature() [1/2]

template<size_t SpatialDim, typename Frame , typename DataType >
tnsr::ii< DataType, SpatialDim, Frame > GeneralizedHarmonic::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.

Details

If \( \Pi_{ab} \) and \( \Phi_{iab} \) are the generalized harmonic conjugate momentum and spatial derivative variables, and if \(t^a\) is the spacetime normal vector, then the extrinsic curvature is computed as

\begin{align} K_{ij} &= \frac{1}{2} \Pi_{ij} + \Phi_{(ij)a} t^a \end{align}

◆ extrinsic_curvature() [2/2]

template<size_t SpatialDim, typename Frame , typename DataType >
tnsr::ii< DataType, SpatialDim, Frame > gr::extrinsic_curvature ( const Scalar< DataType > &  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::ii< DataType, SpatialDim, Frame > &  dt_spatial_metric,
const tnsr::ijj< DataType, SpatialDim, Frame > &  deriv_spatial_metric 
)
noexcept

Computes extrinsic curvature from metric and derivatives.

Details

Uses the ADM evolution equation for the spatial metric,

\[ K_{ij} = \frac{1}{2N} \left ( -\partial_0 g_{ij} + N^k \partial_k g_{ij} + g_{ki} \partial_j N^k + g_{kj} \partial_i N^k \right ) \]

where \(K_{ij}\) is the extrinsic curvature, \(N\) is the lapse, \(N^i\) is the shift, and \(g_{ij}\) is the spatial metric. In terms of the Lie derivative of the spatial metric with respect to a unit timelike vector \(t^a\) normal to the spatial slice, this corresponds to the sign convention

\[ K_{ab} = - \frac{1}{2} \mathcal{L}_{\mathbf{t}} g_{ab} \]

◆ gauge_source()

template<size_t SpatialDim, typename Frame , typename DataType >
tnsr::a< DataType, SpatialDim, Frame > GeneralizedHarmonic::gauge_source ( const Scalar< DataType > &  lapse,
const Scalar< DataType > &  dt_lapse,
const tnsr::i< DataType, SpatialDim, Frame > &  deriv_lapse,
const tnsr::I< DataType, SpatialDim, Frame > &  shift,
const tnsr::I< DataType, SpatialDim, Frame > &  dt_shift,
const tnsr::iJ< DataType, SpatialDim, Frame > &  deriv_shift,
const tnsr::ii< DataType, SpatialDim, Frame > &  spatial_metric,
const Scalar< DataType > &  trace_extrinsic_curvature,
const tnsr::i< DataType, SpatialDim, Frame > &  trace_christoffel_last_indices 
)
noexcept

Computes generalized harmonic gauge source function.

Details

If \(N, N^i, g_{ij}, \Gamma_{ijk}, K\) are the lapse, shift, spatial metric, spatial Christoffel symbols, and trace of the extrinsic curvature, then we compute

\begin{align} H_l &= N^{-2} g_{il}(\partial_t N^i - N^k \partial_k N^i) + N^{-1} \partial_l N - g^{km}\Gamma_{lkm} \\ H_0 &= -N^{-1} \partial_t N + N^{-1} N^k\partial_k N + N^k H_k - N K \end{align}

See Eqs. 8 and 9 of [18]

◆ inverse_spacetime_metric()

template<size_t SpatialDim, typename Frame , typename DataType >
tnsr::AA<DataType, SpatialDim, Frame> gr::inverse_spacetime_metric ( const Scalar< DataType > &  lapse,
const tnsr::I< DataType, SpatialDim, Frame > &  shift,
const tnsr::II< DataType, SpatialDim, Frame > &  inverse_spatial_metric 
)
noexcept

Compute inverse spacetime metric from inverse spatial metric, lapse and shift.

Details

The inverse spacetime metric \( \psi^{ab} \) is calculated as

\begin{align} \psi^{tt} &= - 1/N^2 \\ \psi^{ti} &= N^i / N^2 \\ \psi^{ij} &= g^{ij} - N^i N^j / N^2 \end{align}

where \( N, N^i\) and \( g^{ij}\) are the lapse, shift and inverse spatial metric respectively

◆ lapse()

template<size_t SpatialDim, typename Frame , typename DataType >
Scalar< DataType > gr::lapse ( const tnsr::I< DataType, SpatialDim, Frame > &  shift,
const tnsr::aa< DataType, SpatialDim, Frame > &  spacetime_metric 
)
noexcept

Compute lapse from shift and spacetime metric.

Details

Computes

\begin{align} N &= \sqrt{N^i \psi_{it}-\psi_{tt}} \end{align}

where \( N \), \( N^i\), and \(\psi_{ab}\) are the lapse, shift, and spacetime metric. This can be derived, e.g., from Eqs. 2.121–2.122 of Baumgarte & Shapiro.

◆ phi()

template<size_t SpatialDim, typename Frame , typename DataType >
tnsr::iaa< DataType, SpatialDim, Frame > GeneralizedHarmonic::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 \(\Phi_{iab}\) used by the generalized harmonic formulation of Einstein's equations.

Details

If \( N, N^i\) and \( g_{ij} \) are the lapse, shift and spatial metric respectively, then \(\Phi_{iab} \) is computed as

\begin{align} \Phi_{ktt} &= - 2 N \partial_k N + 2 g_{mn} N^m \partial_k N^n + N^m N^n \partial_k g_{mn} \\ \Phi_{kti} &= g_{mi} \partial_k N^m + N^m \partial_k g_{mi} \\ \Phi_{kij} &= \partial_k g_{ij} \end{align}

◆ pi()

template<size_t SpatialDim, typename Frame , typename DataType >
tnsr::aa< DataType, SpatialDim, Frame > GeneralizedHarmonic::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 \(\Pi_{ab}\) of the spacetime metric \( \psi_{ab} \).

Details

If \( N, N^i\) are the lapse and shift respectively, and \( \Phi_{iab} = \partial_i \psi_{ab} \) then \(\Pi_{\mu\nu} = -\frac{1}{N} ( \partial_t \psi_{\mu\nu} - N^m \Phi_{m\mu\nu}) \) where \( \partial_t \psi_{ab} \) is computed as

\begin{align} \partial_t \psi_{tt} &= - 2 N \partial_t N + 2 g_{mn} N^m \partial_t N^n + N^m N^n \partial_t g_{mn} \\ \partial_t \psi_{ti} &= g_{mi} \partial_t N^m + N^m \partial_t g_{mi} \\ \partial_t \psi_{ij} &= \partial_t g_{ij} \end{align}

◆ raise_or_lower_first_index() [1/2]

template<typename DataType , typename Index0 , typename Index1 >
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.

Details

If \(T_{abc}\) is a tensor with \(T_{abc} = T_{acb}\) and the indices \(a,b,c,...\) can represent either spatial or spacetime indices, then the tensor \( T^a_{bc} = g^{ad} T_{abc} \) is computed, where \( g^{ab}\) is the inverse metric, which is either a spatial or spacetime metric. If a tensor \( S^a_{bc} \) is passed as an argument than the corresponding tensor \( S_{abc} \) is calculated with respect to the metric \(g_{ab}\). You may have to add a new instantiation of this template if you need a new use case.

◆ raise_or_lower_first_index() [2/2]

template<typename DataType , typename Index0 , typename Index1 >
Tensor<DataType, Symmetry<2, 1, 1>, index_list<change_index_up_lo<Index0>, Index1, Index1> > raise_or_lower_first_index ( 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.

Details

If \(T_{abc}\) is a tensor with \(T_{abc} = T_{acb}\) and the indices \(a,b,c,...\) can represent either spatial or spacetime indices, then the tensor \( T^a_{bc} = g^{ad} T_{abc} \) is computed, where \( g^{ab}\) is the inverse metric, which is either a spatial or spacetime metric. If a tensor \( S^a_{bc} \) is passed as an argument than the corresponding tensor \( S_{abc} \) is calculated with respect to the metric \(g_{ab}\). You may have to add a new instantiation of this template if you need a new use case.

◆ raise_or_lower_index() [1/2]

template<typename DataType , typename Index0 >
void raise_or_lower_index ( gsl::not_null< Tensor< DataType, Symmetry< 1 >, index_list< change_index_up_lo< Index0 >>> *>  result,
const Tensor< DataType, Symmetry< 1 >, index_list< Index0 >> &  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 index of a rank 1 tensor.

Details

If \(T_{a}\) is a tensor and the index \(a\) can represent either a spatial or spacetime index, then the tensor \( T^a = g^{ad} T_{d} \) is computed, where \( g^{ab}\) is the inverse metric, which is either a spatial or spacetime metric. If a tensor \( S^a \) is passed as an argument than the corresponding tensor \( S_{a} \) is calculated with respect to the metric \(g_{ab}\).

◆ raise_or_lower_index() [2/2]

template<typename DataType , typename Index0 >
Tensor<DataType, Symmetry<1>, index_list<change_index_up_lo<Index0> > > raise_or_lower_index ( const Tensor< DataType, Symmetry< 1 >, index_list< Index0 >> &  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 index of a rank 1 tensor.

Details

If \(T_{a}\) is a tensor and the index \(a\) can represent either a spatial or spacetime index, then the tensor \( T^a = g^{ad} T_{d} \) is computed, where \( g^{ab}\) is the inverse metric, which is either a spatial or spacetime metric. If a tensor \( S^a \) is passed as an argument than the corresponding tensor \( S_{a} \) is calculated with respect to the metric \(g_{ab}\).

◆ ricci_tensor()

template<size_t SpatialDim, typename Frame , IndexType Index, typename DataType >
tnsr::aa< DataType, SpatialDim, Frame, Index > gr::ricci_tensor ( const tnsr::Abb< DataType, SpatialDim, Frame, Index > &  christoffel_2nd_kind,
const tnsr::aBcc< DataType, SpatialDim, Frame, Index > &  d_christoffel_2nd_kind 
)
noexcept

Computes Ricci tensor from the (spatial or spacetime) Christoffel symbol of the second kind and its derivative.

Details

Computes Ricci tensor \(R_{ab}\) as: \( R_{ab} = \frac{1}{2} ( \partial_c \Gamma^{c}_{ab} - \partial_{(b} \Gamma^{c}_{a)c} + \Gamma^{d}_{ab}\Gamma^{c}_{cd} - \Gamma^{d}_{ac} \Gamma^{c}_{bd} ) \) where \(\Gamma^{a}_{bc}\) is the Christoffel symbol of the second kind.

◆ shift()

template<size_t SpatialDim, typename Frame , typename DataType >
tnsr::I< DataType, SpatialDim, Frame > gr::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.

Details

Computes

\begin{align} N^i &= g^{ij} \psi_{jt} \end{align}

where \( N^i\), \( g^{ij}\), and \(\psi_{ab}\) are the shift, inverse spatial metric, and spacetime metric. This can be derived, e.g., from Eqs. 2.121–2.122 of Baumgarte & Shapiro.

◆ spacetime_deriv_of_det_spatial_metric() [1/2]

template<size_t SpatialDim, typename Frame , typename DataType >
void GeneralizedHarmonic::spacetime_deriv_of_det_spatial_metric ( gsl::not_null< tnsr::a< DataType, SpatialDim, Frame > *>  d4_det_spatial_metric,
const Scalar< DataType > &  sqrt_det_spatial_metric,
const tnsr::II< DataType, SpatialDim, Frame > &  inverse_spatial_metric,
const tnsr::ii< DataType, SpatialDim, Frame > &  dt_spatial_metric,
const tnsr::iaa< DataType, SpatialDim, Frame > &  phi 
)
noexcept

Computes spacetime derivatives of the determinant of spatial metric, using the generalized harmonic variables, spatial metric, and its time derivative.

Details

Using the relation \( \partial_a g = g g^{jk} \partial_a g_{jk} \)

◆ spacetime_deriv_of_det_spatial_metric() [2/2]

template<size_t SpatialDim, typename Frame , typename DataType >
tnsr::a< DataType, SpatialDim, Frame > GeneralizedHarmonic::spacetime_deriv_of_det_spatial_metric ( const Scalar< DataType > &  sqrt_det_spatial_metric,
const tnsr::II< DataType, SpatialDim, Frame > &  inverse_spatial_metric,
const tnsr::ii< DataType, SpatialDim, Frame > &  dt_spatial_metric,
const tnsr::iaa< DataType, SpatialDim, Frame > &  phi 
)
noexcept

Computes spacetime derivatives of the determinant of spatial metric, using the generalized harmonic variables, spatial metric, and its time derivative.

Details

Using the relation \( \partial_a g = g g^{jk} \partial_a g_{jk} \)

◆ spacetime_deriv_of_norm_of_shift() [1/2]

template<size_t SpatialDim, typename Frame , typename DataType >
void GeneralizedHarmonic::spacetime_deriv_of_norm_of_shift ( gsl::not_null< tnsr::a< DataType, SpatialDim, Frame > *>  d4_norm_of_shift,
const Scalar< DataType > &  lapse,
const tnsr::I< DataType, SpatialDim, Frame > &  shift,
const tnsr::ii< DataType, SpatialDim, Frame > &  spatial_metric,
const tnsr::II< DataType, SpatialDim, Frame > &  inverse_spatial_metric,
const tnsr::AA< DataType, SpatialDim, Frame > &  inverse_spacetime_metric,
const tnsr::A< DataType, SpatialDim, Frame > &  spacetime_unit_normal,
const tnsr::iaa< DataType, SpatialDim, Frame > &  phi,
const tnsr::aa< DataType, SpatialDim, Frame > &  pi 
)
noexcept

Computes spacetime derivatives of the norm of the shift vector.

Details

The same is computed as:

\begin{align*} \partial_a (N^i N_i) = (N_i \partial_0 N^i + N^i \partial_0 N_i, N_i \partial_j N^i + N^i \partial_j N_i) \end{align*}

◆ spacetime_deriv_of_norm_of_shift() [2/2]

template<size_t SpatialDim, typename Frame , typename DataType >
tnsr::a< DataType, SpatialDim, Frame > GeneralizedHarmonic::spacetime_deriv_of_norm_of_shift ( const Scalar< DataType > &  lapse,
const tnsr::I< DataType, SpatialDim, Frame > &  shift,
const tnsr::ii< DataType, SpatialDim, Frame > &  spatial_metric,
const tnsr::II< DataType, SpatialDim, Frame > &  inverse_spatial_metric,
const tnsr::AA< DataType, SpatialDim, Frame > &  inverse_spacetime_metric,
const tnsr::A< DataType, SpatialDim, Frame > &  spacetime_unit_normal,
const tnsr::iaa< DataType, SpatialDim, Frame > &  phi,
const tnsr::aa< DataType, SpatialDim, Frame > &  pi 
)
noexcept

Computes spacetime derivatives of the norm of the shift vector.

Details

The same is computed as:

\begin{align*} \partial_a (N^i N_i) = (N_i \partial_0 N^i + N^i \partial_0 N_i, N_i \partial_j N^i + N^i \partial_j N_i) \end{align*}

◆ spacetime_metric()

template<size_t SpatialDim, typename Frame , typename DataType >
tnsr::aa<DataType, SpatialDim, Frame> gr::spacetime_metric ( const Scalar< DataType > &  lapse,
const tnsr::I< DataType, SpatialDim, Frame > &  shift,
const tnsr::ii< DataType, SpatialDim, Frame > &  spatial_metric 
)
noexcept

Computes the spacetime metric from the spatial metric, lapse, and shift.

Details

The spacetime metric \( \psi_{ab} \) is calculated as

\begin{align} \psi_{tt} &= - N^2 + N^m N^n g_{mn} \\ \psi_{ti} &= g_{mi} N^m \\ \psi_{ij} &= g_{ij} \end{align}

where \( N, N^i\) and \( g_{ij}\) are the lapse, shift and spatial metric respectively

◆ spacetime_normal_vector()

template<size_t SpatialDim, typename Frame , typename DataType >
tnsr::A< DataType, SpatialDim, Frame > gr::spacetime_normal_vector ( const Scalar< DataType > &  lapse,
const tnsr::I< DataType, SpatialDim, Frame > &  shift 
)
noexcept

Computes spacetime normal vector from lapse and shift.

Details

If \(N, N^i\) are the lapse and shift respectively, then

\begin{align} n^t &= 1/N \\ n^i &= -\frac{N^i}{N} \end{align}

is computed.

◆ spatial_deriv_of_lapse() [1/2]

template<size_t SpatialDim, typename Frame , typename DataType >
tnsr::i< DataType, SpatialDim, Frame > GeneralizedHarmonic::spatial_deriv_of_lapse ( const Scalar< DataType > &  lapse,
const tnsr::A< DataType, SpatialDim, Frame > &  spacetime_unit_normal,
const tnsr::iaa< DataType, SpatialDim, Frame > &  phi 
)
noexcept

Computes spatial derivatives of lapse (N) from the generalized harmonic variables and spacetime unit normal 1-form.

Details

If the generalized harmonic conjugate momentum and spatial derivative variables are \(\Pi_{ab} = -t^c \partial_c \psi_{ab} \) and \(\Phi_{iab} = \partial_i \psi_{ab} \), the spatial derivatives of N can be obtained from:

\begin{align*} t^a t^b \Phi_{iab} = -\frac{1}{2N} [\partial_i (-N^2 + N_jN^j)- 2 N^j \partial_i N_j + N^j N^k \partial_i g_{jk}] = -\frac{2}{N} \partial_i N, \end{align*}

since

\[ \partial_i (N_jN^j) = 2N^j \partial_i N_j - N^j N^k \partial_i g_{jk}. \]

\[ \Longrightarrow \partial_i N = -(N/2) t^a \Phi_{iab} t^b \]

◆ spatial_deriv_of_lapse() [2/2]

template<size_t SpatialDim, typename Frame , typename DataType >
void GeneralizedHarmonic::spatial_deriv_of_lapse ( gsl::not_null< tnsr::i< DataType, SpatialDim, Frame > *>  deriv_lapse,
const Scalar< DataType > &  lapse,
const tnsr::A< DataType, SpatialDim, Frame > &  spacetime_unit_normal,
const tnsr::iaa< DataType, SpatialDim, Frame > &  phi 
)
noexcept

Computes spatial derivatives of lapse (N) from the generalized harmonic variables and spacetime unit normal 1-form.

Details

If the generalized harmonic conjugate momentum and spatial derivative variables are \(\Pi_{ab} = -t^c \partial_c \psi_{ab} \) and \(\Phi_{iab} = \partial_i \psi_{ab} \), the spatial derivatives of N can be obtained from:

\begin{align*} t^a t^b \Phi_{iab} = -\frac{1}{2N} [\partial_i (-N^2 + N_jN^j)- 2 N^j \partial_i N_j + N^j N^k \partial_i g_{jk}] = -\frac{2}{N} \partial_i N, \end{align*}

since

\[ \partial_i (N_jN^j) = 2N^j \partial_i N_j - N^j N^k \partial_i g_{jk}. \]

\[ \Longrightarrow \partial_i N = -(N/2) t^a \Phi_{iab} t^b \]

◆ spatial_deriv_of_shift() [1/2]

template<size_t SpatialDim, typename Frame , typename DataType >
void GeneralizedHarmonic::spatial_deriv_of_shift ( gsl::not_null< tnsr::iJ< DataType, SpatialDim, Frame > *>  deriv_shift,
const Scalar< DataType > &  lapse,
const tnsr::AA< DataType, SpatialDim, Frame > &  inverse_spacetime_metric,
const tnsr::A< DataType, SpatialDim, Frame > &  spacetime_unit_normal,
const tnsr::iaa< DataType, SpatialDim, Frame > &  phi 
)
noexcept

Computes spatial derivatives of the shift vector from the generalized harmonic and geometric variables.

Details

Spatial derivatives of the shift vector \(N^i\) can be derived from the following steps:

\begin{align*} \partial_i N^j =& g^{jl} g_{kl} \partial_i N^k \\ =& g^{jl} (N^k \partial_i g_{lk} + g_{kl}\partial_i N^k - N^k \partial_i g_{kl}) \\ =& g^{jl} (\partial_i N_l - N^k \partial_i g_{lk}) (\because g^{j0} = 0) \\ =& g^{ja} (\partial_i \psi_{a0} - N^k \partial _i \psi_{ak}) \\ =& N g^{ja} t^b \partial_i \psi_{ab} \\ =& (g^{ja} - t^j t^a) N t^b \Phi_{iab} - 2 t^j \partial_i N \\ =& \psi^{ja} N t^b \Phi_{iab} - 2 t^j \partial_i N \\ =& N (\psi^{ja} + t^j t^a) t^b \Phi_{iab}. \end{align*}

where we used the equation from spatial_deriv_of_lapse() for \(\partial_i N\).

◆ spatial_deriv_of_shift() [2/2]

template<size_t SpatialDim, typename Frame , typename DataType >
tnsr::iJ< DataType, SpatialDim, Frame > GeneralizedHarmonic::spatial_deriv_of_shift ( const Scalar< DataType > &  lapse,
const tnsr::AA< DataType, SpatialDim, Frame > &  inverse_spacetime_metric,
const tnsr::A< DataType, SpatialDim, Frame > &  spacetime_unit_normal,
const tnsr::iaa< DataType, SpatialDim, Frame > &  phi 
)
noexcept

Computes spatial derivatives of the shift vector from the generalized harmonic and geometric variables.

Details

Spatial derivatives of the shift vector \(N^i\) can be derived from the following steps:

\begin{align*} \partial_i N^j =& g^{jl} g_{kl} \partial_i N^k \\ =& g^{jl} (N^k \partial_i g_{lk} + g_{kl}\partial_i N^k - N^k \partial_i g_{kl}) \\ =& g^{jl} (\partial_i N_l - N^k \partial_i g_{lk}) (\because g^{j0} = 0) \\ =& g^{ja} (\partial_i \psi_{a0} - N^k \partial _i \psi_{ak}) \\ =& N g^{ja} t^b \partial_i \psi_{ab} \\ =& (g^{ja} - t^j t^a) N t^b \Phi_{iab} - 2 t^j \partial_i N \\ =& \psi^{ja} N t^b \Phi_{iab} - 2 t^j \partial_i N \\ =& N (\psi^{ja} + t^j t^a) t^b \Phi_{iab}. \end{align*}

where we used the equation from spatial_deriv_of_lapse() for \(\partial_i N\).

◆ spatial_metric()

template<size_t SpatialDim, typename Frame , typename DataType >
tnsr::ii< DataType, SpatialDim, Frame > gr::spatial_metric ( const tnsr::aa< DataType, SpatialDim, Frame > &  spacetime_metric)
noexcept

Compute spatial metric from spacetime metric.

Details

Simply pull out the spatial components.

◆ time_deriv_of_lapse() [1/2]

template<size_t SpatialDim, typename Frame , typename DataType >
Scalar< DataType > GeneralizedHarmonic::time_deriv_of_lapse ( const Scalar< DataType > &  lapse,
const tnsr::I< DataType, SpatialDim, Frame > &  shift,
const tnsr::A< DataType, SpatialDim, Frame > &  spacetime_unit_normal,
const tnsr::iaa< DataType, SpatialDim, Frame > &  phi,
const tnsr::aa< DataType, SpatialDim, Frame > &  pi 
)
noexcept

Computes time derivative of lapse (N) from the generalized harmonic variables, lapse, shift and the spacetime unit normal 1-form.

Details

Let the generalized harmonic conjugate momentum and spatial derivative variables be \(\Pi_{ab} = -t^c \partial_c \psi_{ab} \) and \(\Phi_{iab} = \partial_i \psi_{ab} \), and the operator \(D := \partial_0 - N^k \partial_k \). The time derivative of N is then:

\begin{align*} \frac{1}{2} N^2 t^a t^b \Pi_{ab} - \frac{1}{2} N N^i t^a t^b \Phi_{iab} =& \frac{1}{2} N^2 t^a t^b t^c \partial_c \psi_{ab} - \frac{1}{2} N N^i (-(2/N) \partial_i N) \\ =& \frac{1}{2} N^2 [-(1/N^3) D[g_{jk} N^j N^k - N^2] \\ &- (N^j N^k / N^3)D[g_{jk}] \\ &+ 2 (N^j / N^3) D[g_{jk} N^k] + (2 / N^2)(N^i \partial_i N)] \\ =& \frac{1}{2N} [-D[g_{jk}N^jN^k - N^2] - N^jN^k D[g_{jk}] + 2N N^k\partial_k N + 2N^j D[g_{jk}N^k]] \\ =& D[N] + N^k\partial_k N \\ =& \partial_0 N \end{align*}

where the simplification done for \(\partial_i N\) is used to substitute for the second term ( \(\frac{1}{2} N N^i t^a t^b \Phi_{iab}\)).

Thus,

\[ \partial_0 N = (N/2)(N t^a t^b \Pi_{ab} - N^i t^a t^b \Phi_{iab}) \]

◆ time_deriv_of_lapse() [2/2]

template<size_t SpatialDim, typename Frame , typename DataType >
void GeneralizedHarmonic::time_deriv_of_lapse ( gsl::not_null< Scalar< DataType > *>  dt_lapse,
const Scalar< DataType > &  lapse,
const tnsr::I< DataType, SpatialDim, Frame > &  shift,
const tnsr::A< DataType, SpatialDim, Frame > &  spacetime_unit_normal,
const tnsr::iaa< DataType, SpatialDim, Frame > &  phi,
const tnsr::aa< DataType, SpatialDim, Frame > &  pi 
)
noexcept

Computes time derivative of lapse (N) from the generalized harmonic variables, lapse, shift and the spacetime unit normal 1-form.

Details

Let the generalized harmonic conjugate momentum and spatial derivative variables be \(\Pi_{ab} = -t^c \partial_c \psi_{ab} \) and \(\Phi_{iab} = \partial_i \psi_{ab} \), and the operator \(D := \partial_0 - N^k \partial_k \). The time derivative of N is then:

\begin{align*} \frac{1}{2} N^2 t^a t^b \Pi_{ab} - \frac{1}{2} N N^i t^a t^b \Phi_{iab} =& \frac{1}{2} N^2 t^a t^b t^c \partial_c \psi_{ab} - \frac{1}{2} N N^i (-(2/N) \partial_i N) \\ =& \frac{1}{2} N^2 [-(1/N^3) D[g_{jk} N^j N^k - N^2] \\ &- (N^j N^k / N^3)D[g_{jk}] \\ &+ 2 (N^j / N^3) D[g_{jk} N^k] + (2 / N^2)(N^i \partial_i N)] \\ =& \frac{1}{2N} [-D[g_{jk}N^jN^k - N^2] - N^jN^k D[g_{jk}] + 2N N^k\partial_k N + 2N^j D[g_{jk}N^k]] \\ =& D[N] + N^k\partial_k N \\ =& \partial_0 N \end{align*}

where the simplification done for \(\partial_i N\) is used to substitute for the second term ( \(\frac{1}{2} N N^i t^a t^b \Phi_{iab}\)).

Thus,

\[ \partial_0 N = (N/2)(N t^a t^b \Pi_{ab} - N^i t^a t^b \Phi_{iab}) \]

◆ time_deriv_of_lower_shift() [1/2]

template<size_t SpatialDim, typename Frame , typename DataType >
void GeneralizedHarmonic::time_deriv_of_lower_shift ( gsl::not_null< tnsr::i< DataType, SpatialDim, Frame > *>  dt_lower_shift,
const Scalar< DataType > &  lapse,
const tnsr::I< DataType, SpatialDim, Frame > &  shift,
const tnsr::ii< DataType, SpatialDim, Frame > &  spatial_metric,
const tnsr::A< DataType, SpatialDim, Frame > &  spacetime_unit_normal,
const tnsr::iaa< DataType, SpatialDim, Frame > &  phi,
const tnsr::aa< DataType, SpatialDim, Frame > &  pi 
)
noexcept

Computes time derivative of index lowered shift from generalized harmonic variables, spatial metric and its time derivative.

Details

The time derivative of \( N_i \) is given by:

\begin{align*} \partial_0 N_i = g_{ij} \partial_0 N^j + N^j \partial_0 g_{ij} \end{align*}

where the first term is obtained from time_deriv_of_shift(), and the latter is a user input.

◆ time_deriv_of_lower_shift() [2/2]

template<size_t SpatialDim, typename Frame , typename DataType >
tnsr::i< DataType, SpatialDim, Frame > GeneralizedHarmonic::time_deriv_of_lower_shift ( const Scalar< DataType > &  lapse,
const tnsr::I< DataType, SpatialDim, Frame > &  shift,
const tnsr::ii< DataType, SpatialDim, Frame > &  spatial_metric,
const tnsr::A< DataType, SpatialDim, Frame > &  spacetime_unit_normal,
const tnsr::iaa< DataType, SpatialDim, Frame > &  phi,
const tnsr::aa< DataType, SpatialDim, Frame > &  pi 
)
noexcept

Computes time derivative of index lowered shift from generalized harmonic variables, spatial metric and its time derivative.

Details

The time derivative of \( N_i \) is given by:

\begin{align*} \partial_0 N_i = g_{ij} \partial_0 N^j + N^j \partial_0 g_{ij} \end{align*}

where the first term is obtained from time_deriv_of_shift(), and the latter is a user input.

◆ time_deriv_of_shift() [1/2]

template<size_t SpatialDim, typename Frame , typename DataType >
void GeneralizedHarmonic::time_deriv_of_shift ( gsl::not_null< tnsr::I< DataType, SpatialDim, Frame > *>  dt_shift,
const Scalar< DataType > &  lapse,
const tnsr::I< DataType, SpatialDim, Frame > &  shift,
const tnsr::II< DataType, SpatialDim, Frame > &  inverse_spatial_metric,
const tnsr::A< DataType, SpatialDim, Frame > &  spacetime_unit_normal,
const tnsr::iaa< DataType, SpatialDim, Frame > &  phi,
const tnsr::aa< DataType, SpatialDim, Frame > &  pi 
)
noexcept

Computes time derivative of the shift vector from the generalized harmonic and geometric variables.

Details

The time derivative of \( N^i \) can be derived from the following steps:

\begin{align*} \partial_0 N^i =& g^{ik} \partial_0 (g_{kj} N^j) - N^j g^{ik} \partial_0 g_{kj} \\ =& N g^{ik} t^b \partial_0 \psi_{kb} \\ =& N g^{ik} t^b (\partial_0 - N^j\partial_j) \psi_{kb} + N g^{ik} t^b N^j\partial_j \psi_{kb} \\ =& -N^2 t^b\Pi_{kb} g^{ik} + N N^j t^b\Phi_{jkb} g^{ik} \\ =& -N g^{ik} t^b (N \Pi_{kb} - N^j \Phi_{jkb}) \\ \end{align*}

◆ time_deriv_of_shift() [2/2]

template<size_t SpatialDim, typename Frame , typename DataType >
tnsr::I< DataType, SpatialDim, Frame > GeneralizedHarmonic::time_deriv_of_shift ( const Scalar< DataType > &  lapse,
const tnsr::I< DataType, SpatialDim, Frame > &  shift,
const tnsr::II< DataType, SpatialDim, Frame > &  inverse_spatial_metric,
const tnsr::A< DataType, SpatialDim, Frame > &  spacetime_unit_normal,
const tnsr::iaa< DataType, SpatialDim, Frame > &  phi,
const tnsr::aa< DataType, SpatialDim, Frame > &  pi 
)
noexcept

Computes time derivative of the shift vector from the generalized harmonic and geometric variables.

Details

The time derivative of \( N^i \) can be derived from the following steps:

\begin{align*} \partial_0 N^i =& g^{ik} \partial_0 (g_{kj} N^j) - N^j g^{ik} \partial_0 g_{kj} \\ =& N g^{ik} t^b \partial_0 \psi_{kb} \\ =& N g^{ik} t^b (\partial_0 - N^j\partial_j) \psi_{kb} + N g^{ik} t^b N^j\partial_j \psi_{kb} \\ =& -N^2 t^b\Pi_{kb} g^{ik} + N N^j t^b\Phi_{jkb} g^{ik} \\ =& -N g^{ik} t^b (N \Pi_{kb} - N^j \Phi_{jkb}) \\ \end{align*}

◆ time_deriv_of_spatial_metric() [1/2]

template<size_t SpatialDim, typename Frame , typename DataType >
void GeneralizedHarmonic::time_deriv_of_spatial_metric ( gsl::not_null< tnsr::ii< DataType, SpatialDim, Frame > *>  dt_spatial_metric,
const Scalar< DataType > &  lapse,
const tnsr::I< DataType, SpatialDim, Frame > &  shift,
const tnsr::iaa< DataType, SpatialDim, Frame > &  phi,
const tnsr::aa< DataType, SpatialDim, Frame > &  pi 
)
noexcept

Computes time derivative of the spatial metric.

Details

Let the generalized harmonic conjugate momentum and spatial derivative variables be \(\Pi_{ab} = -t^c \partial_c \psi_{ab} \) and \(\Phi_{iab} = \partial_i \psi_{ab} \). As \( t_i \equiv 0 \). The time derivative of the spatial metric is given by the time derivative of the spatial sector of the spacetime metric, i.e. \( \partial_0 g_{ij} = \partial_0 \psi_{ij} \).

To compute the latter, we use the evolution equation for \( \psi_{ij} \), c.f. eq.(35) of [18] (with \(\gamma_1 = -1\)):

\[ \partial_0 \psi_{ab} = - N \Pi_{ab} + N^k \Phi_{kab} \]

◆ time_deriv_of_spatial_metric() [2/2]

template<size_t SpatialDim, typename Frame , typename DataType >
tnsr::ii< DataType, SpatialDim, Frame > GeneralizedHarmonic::time_deriv_of_spatial_metric ( const Scalar< DataType > &  lapse,
const tnsr::I< DataType, SpatialDim, Frame > &  shift,
const tnsr::iaa< DataType, SpatialDim, Frame > &  phi,
const tnsr::aa< DataType, SpatialDim, Frame > &  pi 
)
noexcept

Computes time derivative of the spatial metric.

Details

Let the generalized harmonic conjugate momentum and spatial derivative variables be \(\Pi_{ab} = -t^c \partial_c \psi_{ab} \) and \(\Phi_{iab} = \partial_i \psi_{ab} \). As \( t_i \equiv 0 \). The time derivative of the spatial metric is given by the time derivative of the spatial sector of the spacetime metric, i.e. \( \partial_0 g_{ij} = \partial_0 \psi_{ij} \).

To compute the latter, we use the evolution equation for \( \psi_{ij} \), c.f. eq.(35) of [18] (with \(\gamma_1 = -1\)):

\[ \partial_0 \psi_{ab} = - N \Pi_{ab} + N^k \Phi_{kab} \]

◆ trace() [1/2]

template<typename DataType , typename Index0 >
void trace ( gsl::not_null< Scalar< DataType > *>  trace,
const Tensor< DataType, Symmetry< 1, 1 >, index_list< Index0, Index0 >> &  tensor,
const Tensor< DataType, Symmetry< 1, 1 >, index_list< change_index_up_lo< Index0 >, change_index_up_lo< Index0 >>> &  metric 
)
noexcept

Computes trace of a rank-2 symmetric tensor.

Details

Computes \(g^{ab}T_{ab}\) or \(g_{ab}T^{ab}\) where \((a,b)\) can be spatial or spacetime indices.

◆ trace() [2/2]

template<typename DataType , typename Index0 >
Scalar<DataType> trace ( const Tensor< DataType, Symmetry< 1, 1 >, index_list< Index0, Index0 >> &  tensor,
const Tensor< DataType, Symmetry< 1, 1 >, index_list< change_index_up_lo< Index0 >, change_index_up_lo< Index0 >>> &  metric 
)
noexcept

Computes trace of a rank-2 symmetric tensor.

Details

Computes \(g^{ab}T_{ab}\) or \(g_{ab}T^{ab}\) where \((a,b)\) can be spatial or spacetime indices.

◆ trace_last_indices() [1/2]

template<typename DataType , typename Index0 , typename Index1 >
void trace_last_indices ( gsl::not_null< Tensor< DataType, Symmetry< 1 >, index_list< Index0 >> *>  trace_of_tensor,
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< Index1 >, change_index_up_lo< Index1 >>> &  metric 
)
noexcept

Computes trace of a rank 3 tensor, which is symmetric in its last two indices, tracing the symmetric indices.

Details

For example, if \( T_{abc} \) is a tensor such that \(T_{abc} = T_{acb} \) then \( T_a = g^{bc}T_{abc} \) is computed, where \( g^{bc} \) is the inverse metric. Note that indices \(a,b,c,...\) can represent either spatial or spacetime indices, and can have either valence. You may have to add a new instantiation of this template if you need a new use case.

◆ trace_last_indices() [2/2]

template<typename DataType , typename Index0 , typename Index1 >
Tensor<DataType, Symmetry<1>, index_list<Index0> > trace_last_indices ( 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< Index1 >, change_index_up_lo< Index1 >>> &  metric 
)
noexcept

Computes trace of a rank 3 tensor, which is symmetric in its last two indices, tracing the symmetric indices.

Details

For example, if \( T_{abc} \) is a tensor such that \(T_{abc} = T_{acb} \) then \( T_a = g^{bc}T_{abc} \) is computed, where \( g^{bc} \) is the inverse metric. Note that indices \(a,b,c,...\) can represent either spatial or spacetime indices, and can have either valence. You may have to add a new instantiation of this template if you need a new use case.