|
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. | |
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 |
Constructor.
| metric_type | Name of the metric ("minkowski", "schwarzschild", "kerr", etc.) |
| mass | Central mass (default = 1.0) |
| spin | Spin parameter (only relevant for Kerr/Kerr–Schild) |
|
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 alpha, beta, gamma, and X().
Referenced by tensorium_RG::BSSNContractedGamma< T >::compute(), tensorium_RG::BSSNContractedGamma< T >::compute_contracted_christoffel(), tensorium_RG::RicciTildeTensor< T >::compute_laplacian_term(), tensorium_RG::generate_conformal_metric_field(), and tensorium_RG::BSSN< T >::init_BSSN().
|
inline |
References gamma.
Referenced by tensorium::compute_conformal_factor(), tensorium_RG::generate_conformal_metric_field(), and tensorium_RG::BSSN< T >::init_BSSN().
|
inline |
References chi, gamma, and 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(), theta, and X().
Referenced by tensorium_RG::Metric< T >::operator()().
|
inlineprivate |
Kerr metric in Boyer–Lindquist coordinates.
References tensorium_RG::Metric< T >::a, Delta, tensorium::Tensor< K, Rank >::fill(), tensorium_RG::Metric< T >::M, tensorium::Tensor< K, Rank >::resize(), Sigma, theta, and X().
Referenced by tensorium_RG::Metric< T >::operator()().
|
inlineprivate |
Kerr–Schild metric in Cartesian coordinates.
References tensorium_RG::Metric< T >::a, tensorium::Tensor< K, Rank >::fill(), tensorium_RG::Metric< T >::kerr_schild_radius(), tensorium_RG::Metric< T >::M, mu, nu, tensorium::Tensor< K, Rank >::resize(), and X().
Referenced by tensorium_RG::Metric< T >::operator()().
|
inlineprivate |
Minkowski metric in Cartesian coordinates.
References tensorium::Tensor< K, Rank >::fill(), and tensorium::Tensor< K, Rank >::resize().
Referenced by tensorium_RG::Metric< T >::operator()().
|
inlineprivate |
Schwarzschild metric in spherical coordinates.
References tensorium::Tensor< K, Rank >::fill(), tensorium_RG::Metric< T >::M, tensorium::Tensor< K, Rank >::resize(), theta, and X().
Referenced by tensorium_RG::Metric< T >::operator()().
|
inlineprivate |
Kerr–Schild radius extraction helper.
References tensorium_RG::Metric< T >::a.
Referenced by tensorium_RG::Metric< T >::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 tensorium_RG::Metric< T >::compute_flrw(), tensorium_RG::Metric< T >::compute_kerr(), tensorium_RG::Metric< T >::compute_kerr_schild(), tensorium_RG::Metric< T >::compute_minkowski(), tensorium_RG::Metric< T >::compute_schwarzschild(), tensorium_RG::Metric< T >::custom_metric_fn, tensorium_RG::Metric< T >::type, and X().
|
inlineprivate |
Set a custom metric callable function.
References tensorium_RG::Metric< T >::custom_metric_fn, and tensorium_RG::Metric< T >::type.
| T tensorium_RG::Metric< T >::a = T(0.935) |
|
private |
Optional user-defined metric function (must accept X and fill g)
Referenced by tensorium_RG::Metric< T >::operator()(), and tensorium_RG::Metric< T >::set_custom().
| T tensorium_RG::Metric< T >::M = T(1.0) |
| std::string tensorium_RG::Metric< T >::type |
Referenced by tensorium_RG::Metric< T >::operator()(), and tensorium_RG::Metric< T >::set_custom().