Tensorium
|
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. | |
|
strong |
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.
T | Scalar type |
g | Metric tensor \( g_{\mu\nu} \) |
Used in numerical relativity to evaluate derivatives of Christoffel symbols.
T | Scalar type |
X | Base coordinate |
direction | Axis of offset |
offset | Value to add (positive or negative) |
h | Finite difference step size |
g | Output metric tensor |
g_inv | Output inverse metric |
Gamma_out | Output Christoffel tensor |
metric | Metric object |
References tensorium::Tensor< K, Rank >::dimensions.
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 = {} ) |
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().
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().
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().
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 ) |
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.
|
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} \]
gamma_field | Field of type Tensor<T, 5> with dimensions [Nx, Ny, Nz, 3, 3] |
i,j,k | Grid position |
dx,dy,dz | Grid spacings |
dgamma_out | Output tensor \( \partial_k \tilde{\gamma}_{ij} \) |
References tensorium::Tensor< K, Rank >::resize(), and tensorium::Tensor< K, Rank >::shape().
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().
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().
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().
|
inline |
References tensorium::Tensor< K, Rank >::resize(), and tensorium::Tensor< K, Rank >::shape().
|
inline |
References tensorium::Tensor< K, Rank >::resize(), and X().
Referenced by tensorium_RG::ChiContext< T >::compute(), covariant_scalar_second(), and covariant_scalar_second_3D().
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().
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 ) |
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().
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().
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().
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().
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 ) |
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().
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} \]
T | Scalar type (typically double ) |
metric | A metric object providing BSSN(X, α, β, γ) and compute_conformal_factor(γ) |
Nx,Ny,Nz | Grid resolution in x, y, z directions |
dx,dy,dz | Grid spacings in x, y, z directions |
< 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().
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().
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().
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().
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 ) |
|
inline |
|
inline |
|
inline |
void tensorium_RG::spectral_derivative_1D | ( | tensorium::Vector< T > & | field, |
tensorium::Vector< T > & | dfield, | ||
T | dx ) |
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().
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 ) |