|
Tensorium
|
A callable 4D metric class for general relativity (Minkowski, Schwarzschild, Kerr, etc.). More...
#include <Metric.hpp>
Public Member Functions | |
| Metric (const std::string &metric_type="minkowski", T mass=T(1.0), T spin=T(0.0)) | |
| Constructor. | |
| void | operator() (const tensorium::Vector< T > &X, tensorium::Tensor< T, 2 > &g) const |
| Evaluate the metric tensor \( g_{\mu\nu}(X^\lambda) \). | |
| void | BSSN (const tensorium::Vector< T > &X, T &alpha, tensorium::Vector< T > &beta, tensorium::Tensor< T, 2 > &gamma) const |
| Extract BSSN 3+1 variables (lapse, shift, and spatial metric). | |
| T | compute_conformal_factor (const tensorium::Tensor< T, 2 > &gamma) const |
| void | compute_conformal_metric (const tensorium::Tensor< T, 2 > &gamma, T chi, tensorium::Tensor< T, 2 > &gamma_tilde) const |
Public Attributes | |
| std::string | type |
| T | M = T(1.0) |
| T | a = T(0.935) |
Private Member Functions | |
| void | set_custom (std::function< void(const tensorium::Vector< T > &, tensorium::Tensor< T, 2 > &)> fn) |
| Set a custom metric callable function. | |
| void | compute_minkowski (tensorium::Tensor< T, 2 > &g) const |
| Minkowski metric in Cartesian coordinates. | |
| void | compute_schwarzschild (const tensorium::Vector< T > &X, tensorium::Tensor< T, 2 > &g) const |
| Schwarzschild metric in spherical coordinates. | |
| void | compute_kerr (const tensorium::Vector< T > &X, tensorium::Tensor< T, 2 > &g) const |
| Kerr metric in Boyer–Lindquist coordinates. | |
| void | compute_flrw (const tensorium::Vector< T > &X, tensorium::Tensor< T, 2 > &g) const |
| Flat FLRW metric in comoving spherical coordinates. | |
| T | kerr_schild_radius (T x, T y, T z) const |
| Kerr–Schild radius extraction helper. | |
| void | compute_kerr_schild (const tensorium::Vector< T > &X, tensorium::Tensor< T, 2 > &g) const |
| Kerr–Schild metric in Cartesian coordinates. | |
| tensorium::Vector< T > | convert_to_metric_coordinates (const tensorium::Vector< T > &X) const |
| tensorium::Tensor< T, 2 > | invert_metric_tensor (const tensorium::Tensor< T, 2 > &g) const |
| tensorium::Tensor< T, 2 > | invert_spatial_metric (const tensorium::Tensor< T, 2 > &gamma) const |
| void | validate_adm_split (const tensorium::Tensor< T, 2 > &g, const tensorium::Tensor< T, 2 > &gamma, const tensorium::Vector< T > &beta, T alpha) const |
Private Attributes | |
| std::function< void(const tensorium::Vector< T > &, tensorium::Tensor< T, 2 > &)> | custom_metric_fn |
| Optional user-defined metric function (must accept X and fill g). | |
A callable 4D metric class for general relativity (Minkowski, Schwarzschild, Kerr, etc.).
This class provides access to several pre-implemented metrics (Minkowski, Schwarzschild, Kerr, Kerr–Schild, FLRW), and supports user-defined metrics via a custom callable.
It supports:
The class is callable via operator() and adapts to the type of metric selected by type.
| T | Scalar type (e.g., float or double) |
|
inline |
|
inline |
Extract BSSN 3+1 variables (lapse, shift, and spatial metric).
Decomposes the 4D metric at point X into ADM form:
\[ds^2 = -\alpha^2 dt^2 + \gamma_{ij} (dx^i + \beta^i dt)(dx^j + \beta^j dt) \]
| X | 4D coordinate vector \( X^\mu \) |
| alpha | Output scalar lapse function \( \alpha \) |
| beta | Output shift vector \( \beta^i \) |
| gamma | Output 3x3 spatial metric \( \gamma_{ij} \) |
References convert_to_metric_coordinates(), invert_metric_tensor(), invert_spatial_metric(), tensorium::Tensor< K, Rank >::resize(), tensorium::Vector< K >::resize(), validate_adm_split(), and X().
Referenced by tensorium_RG::BSSNContractedGamma< T >::compute(), tensorium_RG::ChiContext< T >::compute(), tensorium_RG::BSSNContractedGamma< T >::compute_contracted_christoffel(), tensorium_RG::compute_dt_gamma_from_metric(), tensorium_RG::RicciTildeTensor< T >::compute_laplacian_term(), tensorium_RG::generate_conformal_metric_field(), tensorium_RG::BSSN< T >::init_BSSN(), and tensorium_RG::bssn::split_3p1().
|
inline |
References tensorium::Tensor< K, Rank >::dimensions.
Referenced by tensorium::compute_conformal_factor(), tensorium_RG::generate_conformal_metric_field(), and tensorium_RG::BSSN< T >::init_BSSN().
|
inline |
References tensorium::Tensor< K, Rank >::resize().
Referenced by tensorium::compute_conformal_metric(), and tensorium_RG::generate_conformal_metric_field().
|
inlineprivate |
Flat FLRW metric in comoving spherical coordinates.
References tensorium::Tensor< K, Rank >::fill(), tensorium::Tensor< K, Rank >::resize(), and X().
Referenced by operator()().
|
inlineprivate |
Kerr metric in Boyer–Lindquist coordinates.
References a, tensorium::Tensor< K, Rank >::fill(), M, tensorium::Tensor< K, Rank >::resize(), and X().
Referenced by operator()().
|
inlineprivate |
Kerr–Schild metric in Cartesian coordinates.
References a, tensorium::Tensor< K, Rank >::fill(), kerr_schild_radius(), M, tensorium::Tensor< K, Rank >::resize(), and X().
Referenced by operator()().
|
inlineprivate |
Minkowski metric in Cartesian coordinates.
References tensorium::Tensor< K, Rank >::fill(), and tensorium::Tensor< K, Rank >::resize().
Referenced by operator()().
|
inlineprivate |
Schwarzschild metric in spherical coordinates.
References tensorium::Tensor< K, Rank >::fill(), M, tensorium::Tensor< K, Rank >::resize(), and X().
Referenced by operator()().
|
inlineprivate |
|
inlineprivate |
References tensorium::Tensor< K, Rank >::dimensions, and tensorium::Matrix< K, RowMajor >::inverse().
Referenced by BSSN().
|
inlineprivate |
References tensorium::Matrix< K, RowMajor >::inverse().
Referenced by BSSN().
|
inlineprivate |
Kerr–Schild radius extraction helper.
References a.
Referenced by compute_kerr_schild().
|
inline |
Evaluate the metric tensor \( g_{\mu\nu}(X^\lambda) \).
Dispatches to the appropriate metric implementation based on type. Throws an exception if the type is unknown and no custom function is set.
| X | 4D coordinate vector \( (t, r, \theta, \phi) \) or Cartesian if Kerr–Schild |
| g | Output tensor to be filled with \( g_{\mu\nu} \) |
References compute_flrw(), compute_kerr(), compute_kerr_schild(), compute_minkowski(), compute_schwarzschild(), custom_metric_fn, type, and X().
|
inlineprivate |
Set a custom metric callable function.
References custom_metric_fn, and type.
|
inlineprivate |
References tensorium::Tensor< K, Rank >::fill().
Referenced by BSSN().
| T tensorium_RG::Metric< T >::a = T(0.935) |
Referenced by compute_kerr(), compute_kerr_schild(), kerr_schild_radius(), and Metric().
|
private |
Optional user-defined metric function (must accept X and fill g).
Referenced by operator()(), and set_custom().
| T tensorium_RG::Metric< T >::M = T(1.0) |
Referenced by compute_kerr(), compute_kerr_schild(), compute_schwarzschild(), and Metric().
| std::string tensorium_RG::Metric< T >::type |
Referenced by convert_to_metric_coordinates(), Metric(), operator()(), and set_custom().