Tensorium
Loading...
Searching...
No Matches
tensorium_RG Namespace Reference

Classes

class  BSSN
 Driver class to initialize and store BSSN variables from an input spacetime metric. More...
 
class  BSSNAtildeTensor
 Computes the trace-free conformal extrinsic curvature tensor \( \tilde{A}_{ij} \) in the BSSN formalism. More...
 
class  BSSNChristoffel
 Compute the conformal Christoffel symbols \( \tilde{\Gamma}^k_{ij} \). More...
 
class  BSSNContractedGamma
 
struct  BSSNGrid
 Storage structure for all evolved BSSN variables on a single grid point or patch. More...
 
struct  ChiContext
 
class  ChristoffelSym
 Stores and computes Christoffel symbols \( \Gamma^\lambda_{\mu\nu} \). More...
 
class  ConstraintSolver
 
class  ExtrinsicCurvature
 Computes the extrinsic curvature tensor \( K_{ij} \) from BSSN variables. More...
 
class  Metric
 A callable 4D metric class for general relativity (Minkowski, Schwarzschild, Kerr, etc.) More...
 
class  RicciConformalTensor
 Provides methods to compute the \( \chi \)-dependent part of the Ricci tensor in the BSSN formalism. More...
 
class  RicciPhysicalTensor
 Computes the physical 3-Ricci tensor \( R_{ij} \) as the sum of conformal and conformal-factor contributions. More...
 
class  RicciTensor
 Computes the Ricci tensor and Ricci scalar from a 4D Riemann tensor. More...
 
class  RicciTildeTensor
 Provides methods to compute the conformal Ricci tensor \( \tilde{R}_{ij} \) in the BSSN formulation. More...
 
class  RiemannTensor
 Computes the 4D Riemann curvature tensor \( R^\rho_{\ \sigma\mu\nu} \). More...
 
class  TildeGamma
 Computes the contracted conformal Christoffel vector \( \tilde{\Gamma}^i \). More...
 

Enumerations

enum class  DiffMode { PARTIAL , COV , COV2 , SPEC }
 

Functions

template<typename T , typename ScalarFunc >
tensorium::Vector< T > covariant_scalar (const tensorium::Vector< T > &X, T dx, T dy, T dz, ScalarFunc &&func, const tensorium::Tensor< T, 3 > &christoffel)
 
template<typename T , typename ScalarFunc >
tensorium::Tensor< T, 2 > autodiff_scalar_second (const tensorium::Vector< T > &X, T dx, T dy, T dz, ScalarFunc &&func, const tensorium::Tensor< T, 3 > &christoffel)
 
template<typename T , typename ScalarFunc >
tensorium::Vector< T > autodiff_rank0 (const tensorium::Vector< T > &X, T dx, T dy, T dz, ScalarFunc &&func, DiffMode mode, const tensorium::Tensor< T, 3 > &christoffel)
 
template<typename T , typename VectorFunc >
tensorium::Tensor< T, 2 > autodiff_rank1 (const tensorium::Vector< T > &X, T dx, T dy, T dz, VectorFunc &&func, DiffMode mode, const tensorium::Tensor< T, 3 > &christoffel)
 
template<typename T , typename TensorFunc >
tensorium::Tensor< T, 3 > autodiff_rank2_first (const tensorium::Vector< T > &X, T dx, T dy, T dz, TensorFunc &&func, DiffMode mode, const tensorium::Tensor< T, 3 > &christoffel)
 
template<typename T , typename FieldFunc >
auto autodiff (const tensorium::Vector< T > &X, T dx, T dy, T dz, FieldFunc &&func, DiffMode mode, const tensorium::Tensor< T, 3 > &christoffel={})
 
template<typename T >
void compute_partial_derivatives_3D (const tensorium::Tensor< T, 5 > &gamma_field, size_t i, size_t j, size_t k, T dx, T dy, T dz, tensorium::Tensor< T, 3 > &dgamma_out)
 Compute the 3D partial derivatives \( \partial_k \tilde{\gamma}_{ij} \) from a 5D field tensor.
 
template<typename T >
void spectral_derivative_1D (tensorium::Vector< T > &field, tensorium::Vector< T > &dfield, T dx)
 
template<typename T >
void spectral_partial_scalar_3D (const tensorium::Tensor< T, 3 > &scalar_field, T dx, T dy, T dz, tensorium::Tensor< T, 4 > &grad_out)
 
template<typename T , typename TensorFunc >
tensorium::Tensor< T, 3 > spectral_partial_tensor2 (const tensorium::Vector< T > &X, T dx, T dy, T dz, TensorFunc &&func, size_t NX, size_t NY, size_t NZ)
 
template<typename T , typename ScalarFunc >
tensorium::Vector< T > partial_scalar (const tensorium::Vector< T > &X, T dx, T dy, T dz, ScalarFunc &&func)
 
template<typename T , typename VectorFunc >
tensorium::Tensor< T, 2 > partial_vector (const tensorium::Vector< T > &X, T dx, T dy, T dz, VectorFunc &&func)
 
template<typename T , typename TensorFunc >
void compute_partial_derivatives_tensor2D (const tensorium::Vector< T > &X, T dx, T dy, T dz, TensorFunc &&func, tensorium::Tensor< T, 3 > &out)
 
template<typename T , typename TensorFunc >
void compute_second_derivatives_tensor2D (const tensorium::Vector< T > &X, T dx, T dy, T dz, TensorFunc &&func, tensorium::Tensor< T, 4 > &out)
 
template<typename T , typename VectorFunc >
void compute_partial_derivatives_vector (const tensorium::Vector< T > &X, T dx, T dy, T dz, VectorFunc &&func, tensorium::Tensor< T, 2 > &out)
 
template<typename T , typename ScalarFunc >
void compute_partial_derivatives_scalar (const tensorium::Vector< T > &X, T dx, T dy, T dz, ScalarFunc &&func, tensorium::Vector< T > &out)
 
template<typename T >
tensorium::Tensor< T, 2 > compute_dt_gamma_from_beta (const tensorium::Tensor< T, 2 > &gamma, const tensorium::Vector< T > &beta, const tensorium::Tensor< T, 2 > &partial_beta, const tensorium::Tensor< T, 3 > &christoffel)
 
template<typename T >
void compute_partial_derivatives_vector3D (const tensorium::Tensor< T, 4 > &vec_field, size_t i, size_t j, size_t k, T dx, T dy, T dz, tensorium::Tensor< T, 2 > &dvec_out)
 
template<typename T , typename ScalarFunc >
void compute_second_derivatives_scalar (const tensorium::Vector< T > &X, T dx, T dy, T dz, ScalarFunc &&func, tensorium::Tensor< T, 2 > &out)
 
template<typename T , typename ScalarFunc >
tensorium::Tensor< T, 2 > covariant_scalar_second (const tensorium::Vector< T > &X, T dx, T dy, T dz, ScalarFunc &&func, const tensorium::Tensor< T, 3 > &christoffel)
 
template<typename T >
void compute_second_derivatives_scalar3D (const tensorium::Tensor< T, 3 > &scalar_field, T dx, T dy, T dz, tensorium::Tensor< T, 5 > &hessian_out)
 
template<typename T >
tensorium::Tensor< T, 5 > covariant_scalar_second_3D (const tensorium::Tensor< T, 3 > &chi, const tensorium::Tensor< T, 5 > &christoffel, T dx, T dy, T dz)
 
template<typename T , typename VectorFunc >
tensorium::Tensor< T, 2 > covariant_vector (const tensorium::Vector< T > &X, T dx, T dy, T dz, VectorFunc &&func, const tensorium::Tensor< T, 3 > &Gamma)
 
template<typename T , typename TensorFunc >
tensorium::Tensor< T, 3 > covariant_tensor2 (const tensorium::Vector< T > &X, T dx, T dy, T dz, TensorFunc &&func, const tensorium::Tensor< T, 3 > &Gamma)
 
template<typename T , typename TensorFunc >
tensorium::Tensor< T, 3 > partial_tensor2 (const tensorium::Vector< T > &X, T dx, T dy, T dz, TensorFunc &&func)
 
template<typename T , typename TensorFunc >
tensorium::Tensor< T, 4 > covariant_tensor2_second (const tensorium::Vector< T > &X, T dx, T dy, T dz, TensorFunc &&func, const tensorium::Tensor< T, 3 > &Gamma)
 
template<typename T , typename TensorFunc >
tensorium::Tensor< T, 3 > populate_tensor3D_component (size_t i, size_t j, TensorFunc &&func, T dx, T dy, T dz, size_t NX, size_t NY, size_t NZ)
 
template<typename T >
tensorium::Tensor< T, 5 > generate_conformal_metric_field (const tensorium_RG::Metric< T > &metric, size_t Nx, size_t Ny, size_t Nz, T dx, T dy, T dz)
 Generate the conformal 3-metric field \( \tilde{\gamma}_{ij}(x^i) \) on a 3D grid.
 
template<typename T >
void print_tensor2 (const std::string &name, const tensorium::Tensor< T, 2 > &tensor)
 
template<typename T >
void print_tensor3 (const std::string &name, const tensorium::Tensor< T, 3 > &tensor)
 
template<typename T >
void print_vector (const std::string &name, const tensorium::Vector< T > &vec)
 
template<typename T >
 __attribute__ ((always_inline, hot, flatten)) inline tensorium
 Compute the inverse of a 2D metric tensor using local matrix inversion.
 

Enumeration Type Documentation

◆ DiffMode

enum class tensorium_RG::DiffMode
strong
Enumerator
PARTIAL 
COV 
COV2 
SPEC 

Function Documentation

◆ __attribute__()

template<typename T >
tensorium_RG::__attribute__ ( (always_inline, hot, flatten) )

Compute the inverse of a 2D metric tensor using local matrix inversion.

Compute Christoffel symbols at an offset position along one direction.

Converts the tensor to a matrix, computes the inverse, and converts back.

Template Parameters
TScalar type
Parameters
gMetric tensor \( g_{\mu\nu} \)
Returns
Inverse tensor \( g^{\mu\nu} \)

Used in numerical relativity to evaluate derivatives of Christoffel symbols.

Template Parameters
TScalar type
Parameters
XBase coordinate
directionAxis of offset
offsetValue to add (positive or negative)
hFinite difference step size
gOutput metric tensor
g_invOutput inverse metric
Gamma_outOutput Christoffel tensor
metricMetric object

References tensorium::Tensor< K, Rank >::dimensions.

◆ autodiff()

template<typename T , typename FieldFunc >
auto tensorium_RG::autodiff ( const tensorium::Vector< T > & X,
T dx,
T dy,
T dz,
FieldFunc && func,
DiffMode mode,
const tensorium::Tensor< T, 3 > & christoffel = {} )

Referenced by tensorium_RG::BSSN< T >::init_BSSN().

Here is the caller graph for this function:

◆ autodiff_rank0()

template<typename T , typename ScalarFunc >
tensorium::Vector< T > tensorium_RG::autodiff_rank0 ( const tensorium::Vector< T > & X,
T dx,
T dy,
T dz,
ScalarFunc && func,
DiffMode mode,
const tensorium::Tensor< T, 3 > & christoffel )

References COV, covariant_scalar(), PARTIAL, partial_scalar(), and X().

Here is the call graph for this function:

◆ autodiff_rank1()

template<typename T , typename VectorFunc >
tensorium::Tensor< T, 2 > tensorium_RG::autodiff_rank1 ( const tensorium::Vector< T > & X,
T dx,
T dy,
T dz,
VectorFunc && func,
DiffMode mode,
const tensorium::Tensor< T, 3 > & christoffel )

References COV, covariant_vector(), PARTIAL, partial_vector(), and X().

Here is the call graph for this function:

◆ autodiff_rank2_first()

template<typename T , typename TensorFunc >
tensorium::Tensor< T, 3 > tensorium_RG::autodiff_rank2_first ( const tensorium::Vector< T > & X,
T dx,
T dy,
T dz,
TensorFunc && func,
DiffMode mode,
const tensorium::Tensor< T, 3 > & christoffel )

References COV, covariant_tensor2(), PARTIAL, partial_tensor2(), SPEC, and X().

Here is the call graph for this function:

◆ autodiff_scalar_second()

template<typename T , typename ScalarFunc >
tensorium::Tensor< T, 2 > tensorium_RG::autodiff_scalar_second ( const tensorium::Vector< T > & X,
T dx,
T dy,
T dz,
ScalarFunc && func,
const tensorium::Tensor< T, 3 > & christoffel )

References covariant_scalar_second(), and X().

Here is the call graph for this function:

◆ compute_dt_gamma_from_beta()

template<typename T >
tensorium::Tensor< T, 2 > tensorium_RG::compute_dt_gamma_from_beta ( const tensorium::Tensor< T, 2 > & gamma,
const tensorium::Vector< T > & beta,
const tensorium::Tensor< T, 2 > & partial_beta,
const tensorium::Tensor< T, 3 > & christoffel )

References beta.

◆ compute_partial_derivatives_3D()

template<typename T >
void tensorium_RG::compute_partial_derivatives_3D ( const tensorium::Tensor< T, 5 > & gamma_field,
size_t i,
size_t j,
size_t k,
T dx,
T dy,
T dz,
tensorium::Tensor< T, 3 > & dgamma_out )
inline

Compute the 3D partial derivatives \( \partial_k \tilde{\gamma}_{ij} \) from a 5D field tensor.

Uses centered 4th-order or 2nd-order finite differences for inner and boundary points.

\[ \partial_k \tilde{\gamma}_{ij} = \begin{cases} \frac{-f(x+2h) + 8f(x+h) - 8f(x-h) + f(x-2h)}{12h} & \text{if inner} \\ \frac{f(x+h) - f(x-h)}{2h} & \text{if near boundary} \\ 0 & \text{otherwise} \end{cases} \]

Parameters
gamma_fieldField of type Tensor<T, 5> with dimensions [Nx, Ny, Nz, 3, 3]
i,j,kGrid position
dx,dy,dzGrid spacings
dgamma_outOutput tensor \( \partial_k \tilde{\gamma}_{ij} \)

References tensorium::Tensor< K, Rank >::resize(), and tensorium::Tensor< K, Rank >::shape().

Here is the call graph for this function:

◆ compute_partial_derivatives_scalar()

template<typename T , typename ScalarFunc >
void tensorium_RG::compute_partial_derivatives_scalar ( const tensorium::Vector< T > & X,
T dx,
T dy,
T dz,
ScalarFunc && func,
tensorium::Vector< T > & out )

References tensorium::Tensor< K, Rank >::resize(), and X().

Referenced by covariant_scalar_second(), and covariant_scalar_second_3D().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ compute_partial_derivatives_tensor2D()

template<typename T , typename TensorFunc >
void tensorium_RG::compute_partial_derivatives_tensor2D ( const tensorium::Vector< T > & X,
T dx,
T dy,
T dz,
TensorFunc && func,
tensorium::Tensor< T, 3 > & out )

References tensorium::Tensor< K, Rank >::resize(), and X().

Here is the call graph for this function:

◆ compute_partial_derivatives_vector()

template<typename T , typename VectorFunc >
void tensorium_RG::compute_partial_derivatives_vector ( const tensorium::Vector< T > & X,
T dx,
T dy,
T dz,
VectorFunc && func,
tensorium::Tensor< T, 2 > & out )

References tensorium::Tensor< K, Rank >::resize(), and X().

Here is the call graph for this function:

◆ compute_partial_derivatives_vector3D()

template<typename T >
void tensorium_RG::compute_partial_derivatives_vector3D ( const tensorium::Tensor< T, 4 > & vec_field,
size_t i,
size_t j,
size_t k,
T dx,
T dy,
T dz,
tensorium::Tensor< T, 2 > & dvec_out )
inline

References tensorium::Tensor< K, Rank >::resize(), and tensorium::Tensor< K, Rank >::shape().

Here is the call graph for this function:

◆ compute_second_derivatives_scalar()

template<typename T , typename ScalarFunc >
void tensorium_RG::compute_second_derivatives_scalar ( const tensorium::Vector< T > & X,
T dx,
T dy,
T dz,
ScalarFunc && func,
tensorium::Tensor< T, 2 > & out )
inline

References tensorium::Tensor< K, Rank >::resize(), and X().

Referenced by tensorium_RG::ChiContext< T >::compute(), covariant_scalar_second(), and covariant_scalar_second_3D().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ compute_second_derivatives_scalar3D()

template<typename T >
void tensorium_RG::compute_second_derivatives_scalar3D ( const tensorium::Tensor< T, 3 > & scalar_field,
T dx,
T dy,
T dz,
tensorium::Tensor< T, 5 > & hessian_out )

References tensorium::Tensor< K, Rank >::resize(), and tensorium::Tensor< K, Rank >::shape().

Here is the call graph for this function:

◆ compute_second_derivatives_tensor2D()

template<typename T , typename TensorFunc >
void tensorium_RG::compute_second_derivatives_tensor2D ( const tensorium::Vector< T > & X,
T dx,
T dy,
T dz,
TensorFunc && func,
tensorium::Tensor< T, 4 > & out )

References X().

Here is the call graph for this function:

◆ covariant_scalar()

template<typename T , typename ScalarFunc >
tensorium::Vector< T > tensorium_RG::covariant_scalar ( const tensorium::Vector< T > & X,
T dx,
T dy,
T dz,
ScalarFunc && func,
const tensorium::Tensor< T, 3 > & christoffel )

References partial_scalar(), and X().

Referenced by autodiff_rank0().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ covariant_scalar_second()

template<typename T , typename ScalarFunc >
tensorium::Tensor< T, 2 > tensorium_RG::covariant_scalar_second ( const tensorium::Vector< T > & X,
T dx,
T dy,
T dz,
ScalarFunc && func,
const tensorium::Tensor< T, 3 > & christoffel )

References compute_partial_derivatives_scalar(), compute_second_derivatives_scalar(), and X().

Referenced by autodiff_scalar_second().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ covariant_scalar_second_3D()

template<typename T >
tensorium::Tensor< T, 5 > tensorium_RG::covariant_scalar_second_3D ( const tensorium::Tensor< T, 3 > & chi,
const tensorium::Tensor< T, 5 > & christoffel,
T dx,
T dy,
T dz )

References chi, compute_partial_derivatives_scalar(), compute_second_derivatives_scalar(), tensorium::Tensor< K, Rank >::shape(), and X().

Here is the call graph for this function:

◆ covariant_tensor2()

template<typename T , typename TensorFunc >
tensorium::Tensor< T, 3 > tensorium_RG::covariant_tensor2 ( const tensorium::Vector< T > & X,
T dx,
T dy,
T dz,
TensorFunc && func,
const tensorium::Tensor< T, 3 > & Gamma )

References Gamma, partial_tensor2(), and X().

Referenced by autodiff_rank2_first().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ covariant_tensor2_second()

template<typename T , typename TensorFunc >
tensorium::Tensor< T, 4 > tensorium_RG::covariant_tensor2_second ( const tensorium::Vector< T > & X,
T dx,
T dy,
T dz,
TensorFunc && func,
const tensorium::Tensor< T, 3 > & Gamma )

References Gamma, and X().

Here is the call graph for this function:

◆ covariant_vector()

template<typename T , typename VectorFunc >
tensorium::Tensor< T, 2 > tensorium_RG::covariant_vector ( const tensorium::Vector< T > & X,
T dx,
T dy,
T dz,
VectorFunc && func,
const tensorium::Tensor< T, 3 > & Gamma )

References Gamma, partial_vector(), and X().

Referenced by autodiff_rank1().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ generate_conformal_metric_field()

template<typename T >
tensorium::Tensor< T, 5 > tensorium_RG::generate_conformal_metric_field ( const tensorium_RG::Metric< T > & metric,
size_t Nx,
size_t Ny,
size_t Nz,
T dx,
T dy,
T dz )

Generate the conformal 3-metric field \( \tilde{\gamma}_{ij}(x^i) \) on a 3D grid.

For each spatial grid point \( (x, y, z) \), the spatial metric \( \gamma_{ij} \) is extracted from the given metric, the conformal factor \( \chi \) is computed, and the conformal metric is defined as:

\[ \tilde{\gamma}_{ij} = \chi \, \gamma_{ij} \]

Template Parameters
TScalar type (typically double)
Parameters
metricA metric object providing BSSN(X, α, β, γ) and compute_conformal_factor(γ)
Nx,Ny,NzGrid resolution in x, y, z directions
dx,dy,dzGrid spacings in x, y, z directions
Returns
A 5D tensor with shape \( (N_x, N_y, N_z, 3, 3) \) containing \( \tilde{\gamma}_{ij} \) at each grid point

< Coordinates X^μ = (t, x, y, z)

< Time is fixed at t = 0

References alpha, beta, tensorium_RG::Metric< T >::BSSN(), chi, tensorium_RG::Metric< T >::compute_conformal_factor(), tensorium_RG::Metric< T >::compute_conformal_metric(), gamma, and X().

Here is the call graph for this function:

◆ partial_scalar()

template<typename T , typename ScalarFunc >
tensorium::Vector< T > tensorium_RG::partial_scalar ( const tensorium::Vector< T > & X,
T dx,
T dy,
T dz,
ScalarFunc && func )

References X().

Referenced by autodiff_rank0(), tensorium_RG::ChiContext< T >::compute(), tensorium_RG::RicciTildeTensor< T >::compute_dGamma_term(), and covariant_scalar().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ partial_tensor2()

template<typename T , typename TensorFunc >
tensorium::Tensor< T, 3 > tensorium_RG::partial_tensor2 ( const tensorium::Vector< T > & X,
T dx,
T dy,
T dz,
TensorFunc && func )

References X().

Referenced by autodiff_rank2_first(), and covariant_tensor2().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ partial_vector()

template<typename T , typename VectorFunc >
tensorium::Tensor< T, 2 > tensorium_RG::partial_vector ( const tensorium::Vector< T > & X,
T dx,
T dy,
T dz,
VectorFunc && func )

References X().

Referenced by autodiff_rank1(), and covariant_vector().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ populate_tensor3D_component()

template<typename T , typename TensorFunc >
tensorium::Tensor< T, 3 > tensorium_RG::populate_tensor3D_component ( size_t i,
size_t j,
TensorFunc && func,
T dx,
T dy,
T dz,
size_t NX,
size_t NY,
size_t NZ )

References gamma, and X().

Here is the call graph for this function:

◆ print_tensor2()

template<typename T >
void tensorium_RG::print_tensor2 ( const std::string & name,
const tensorium::Tensor< T, 2 > & tensor )
inline

Referenced by tensorium_RG::BSSN< T >::init_BSSN().

Here is the caller graph for this function:

◆ print_tensor3()

template<typename T >
void tensorium_RG::print_tensor3 ( const std::string & name,
const tensorium::Tensor< T, 3 > & tensor )
inline

Referenced by tensorium_RG::BSSN< T >::init_BSSN().

Here is the caller graph for this function:

◆ print_vector()

template<typename T >
void tensorium_RG::print_vector ( const std::string & name,
const tensorium::Vector< T > & vec )
inline

Referenced by tensorium_RG::BSSN< T >::init_BSSN().

Here is the caller graph for this function:

◆ spectral_derivative_1D()

template<typename T >
void tensorium_RG::spectral_derivative_1D ( tensorium::Vector< T > & field,
tensorium::Vector< T > & dfield,
T dx )

◆ spectral_partial_scalar_3D()

template<typename T >
void tensorium_RG::spectral_partial_scalar_3D ( const tensorium::Tensor< T, 3 > & scalar_field,
T dx,
T dy,
T dz,
tensorium::Tensor< T, 4 > & grad_out )

References real, tensorium::Tensor< K, Rank >::resize(), and tensorium::Tensor< K, Rank >::shape().

Referenced by spectral_partial_tensor2().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ spectral_partial_tensor2()

template<typename T , typename TensorFunc >
tensorium::Tensor< T, 3 > tensorium_RG::spectral_partial_tensor2 ( const tensorium::Vector< T > & X,
T dx,
T dy,
T dz,
TensorFunc && func,
size_t NX,
size_t NY,
size_t NZ )

References gamma, spectral_partial_scalar_3D(), and X().

Here is the call graph for this function: