aurel.core

core.py

This module is the main event. It contains:
  • descriptions, a dictionary of all the variables used in the aurel project

  • AurelCore, the main class responsible for managing the AurelCore.data dictionary. For an input spacetime and matter distribution, AurelCore can automatically retrieve any relativistic variable listed in the descriptions dictionary. This class has many attributes and functions, a large part of which are listed in the descriptions dictionary, but also many other tensor calculus functions. The descriptions functions are called as:

    • AurelCore.variable_name() for the function itself

    • AurelCore.data[“variable_name”] for the dictionary element, which is the same as calling the function but then saves it in the AurelCore.data dictionary.

descriptions

Required quantities

gxx: \(g_{xx}\) Metric with xx indices down (need to input)

gxy: \(g_{xy}\) Metric with xy indices down (need to input)

gxz: \(g_{xz}\) Metric with xz indices down (need to input)

gyy: \(g_{yy}\) Metric with yy indices down (need to input)

gyz: \(g_{yz}\) Metric with yz indices down (need to input)

gzz: \(g_{zz}\) Metric with zz indices down (need to input)

kxx: \(K_{xx}\) Extrinsic curvature with xx indices down (need to input)

kxy: \(K_{xy}\) Extrinsic curvature with xy indices down (need to input)

kxz: \(K_{xz}\) Extrinsic curvature with xz indices down (need to input)

kyy: \(K_{yy}\) Extrinsic curvature with yy indices down (need to input)

kyz: \(K_{yz}\) Extrinsic curvature with yz indices down (need to input)

kzz: \(K_{zz}\) Extrinsic curvature with zz indices down (need to input)

rho0: \(\rho_0\) Rest mass energy density (need to input)

Assumed quantities

\(\Lambda = 0\), the Cosmological constant, to change this do AurelCore.Lambda = … before running calculations

alpha: \(\alpha = 1\), the lapse, to change this do AurelCore.data[“alpha”] = … before running calculations

dtalpha: \(\partial_t \alpha = 0\), the time derivative of the lapse

betaup3: \(\beta^i = 0\), the shift vector with spatial indices up

dtbetaup3: \(\partial_t \beta^i = 0\), the time derivative of the shift vector with spatial indices up

press: \(p = 0\), the fluid pressure

eps: \(\epsilon = 0\), the fluid specific internal energy

w_lorentz: \(W = 1\), the Lorentz factor

velup3: \(v^i = 0\), the Eulerian fluid three velocity with spatial indices up

Metric quantities

Spatial metric

gammadown3: \(\gamma_{ij}\) Spatial metric with spatial indices down

gammaup3: \(\gamma^{ij}\) Spatial metric with spatial indices up

dtgammaup3: \(\partial_t \gamma^{ij}\) Coordinate time derivative of spatial metric with spatial indices up

gammadet: \(\gamma\) Determinant of spatial metric

gammadown4: \(\gamma_{\mu\nu}\) Spatial metric with spacetime indices down

gammaup4: \(\gamma^{\mu\nu}\) Spatial metric with spacetime indices up

Extrinsic curvature

Kdown3: \(K_{ij}\) Extrinsic curvature with spatial indices down

Kup3: \(K^{ij}\) Extrinsic curvature with spatial indices up

Ktrace: \(K = \gamma^{ij}K_{ij}\) Trace of extrinsic curvature

Adown3: \(A_{ij}\) Traceless part of the extrinsic curvature with spatial indices down

Aup3: \(A^{ij}\) Traceless part of the extrinsic curvature with spatial indices up

A2: \(A^2\) Magnitude of traceless part of the extrinsic curvature

Lapse

alpha: \(\alpha\) Lapse (need to input or I assume =1)

dtalpha: \(\partial_t \alpha\) Coordinate time derivative of the lapse (need to input or I assume =0)

Shift

betaup3: \(\beta^{i}\) Shift vector with spatial indices up (need to input or I assume =0)

dtbetaup3: \(\partial_t\beta^{i}\) Coordinate time derivative of the shift vector with spatial indices up (need to input or I assume =0)

betadown3: \(\beta_{i}\) Shift vector with spatial indices down

betamag: \(\beta_{i}\beta^{i}\) Magnitude of shift vector

Timeline normal vector

nup4: \(n^{\mu}\) Timelike vector normal to the spatial metric with spacetime indices up

ndown4: \(n_{\mu}\) Timelike vector normal to the spatial metric with spacetime indices down

Spacetime metric

gdown4: \(g_{\mu\nu}\) Spacetime metric with spacetime indices down

gup4: \(g^{\mu\nu}\) Spacetime metric with spacetime indices up

gdet: \(g\) Determinant of spacetime metric

Matter quantities

Eulerian observer follows \(n^\mu\)

Lagrangian observer follows \(u^\mu\)

Lagrangian matter variables

press: \(p\) Pressure (need to input or I assume =0)

eps: \(\epsilon\) Specific internal energy (need to input or I assume =0)

rho: \(\rho\) Energy density

enthalpy: \(h\) Specific enthalpy of the fluid

Fluid velocity

w_lorentz: \(W\) Lorentz factor (need to input or I assume =1)

velup3: \(v^i\) Eulerian fluid three velocity with spatial indices up (need to input or I assume =0)

uup0: \(u^t\) Lagrangian fluid four velocity with time indice up

uup3: \(u^i\) Lagrangian fluid four velocity with spatial indices up

uup4: \(u^\mu\) Lagrangian fluid four velocity with spacetime indices up

udown3: \(u_\mu\) Lagrangian fluid four velocity with spatial indices down

udown4: \(u_\mu\) Lagrangian fluid four velocity with spacetime indices down

hdown4: \(h_{\mu\nu}\) Spatial metric orthonomal to fluid flow with spacetime indices down

hmixed4: \({h^{\mu}}_{\nu}\) Spatial metric orthonomal to fluid flow with mixed spacetime indices

hup4: \(h^{\mu\nu}\) Spatial metric orthonomal to fluid flow with spacetime indices up

Energy-stress tensor

Tdown4: \(T_{\mu\nu}\) Energy-stress tensor with spacetime indices down

Eulerian matter variables

rho_n: \(\rho^{\{n\}}\) Energy density in the \(n^\mu\) frame

fluxup3_n: \(S^{\{n\}i}\) Energy flux (or momentum density) in the \(n^\mu\) frame with spatial indices up

fluxdown3_n: \(S^{\{n\}}_{i}\) Energy flux (or momentum density) in the \(n^\mu\) frame with spatial indices down

angmomup3_n: \(J^{\{n\}i}\) Angular momentum density in the \(n^\mu\) frame with spatial indices up

angmomdown3_n: \(J^{\{n\}}_{i}\) Angular momentum density in the \(n^\mu\) frame with spatial indices down

Stressup3_n: \(S^{\{n\}ij}\) Stress tensor in the \(n^\mu\) frame with spatial indices up

Stressdown3_n: \(S^{\{n\}}_{ij}\) Stress tensor in the \(n^\mu\) frame with spatial indices down

Stresstrace_n: \(S^{\{n\}}\) Trace of Stress tensor in the \(n^\mu\) frame

press_n: \(p^{\{n\}}\) Pressure in the \(n^\mu\) frame

anisotropic_press_down3_n: \(\pi^{\{n\}_{ij}}\) Anisotropic pressure in the \(n^\mu\) frame with spatial indices down

rho_n_fromHam: \(\rho^{\{n\}}\) Energy density in the \(n^\mu\) frame computed from the Hamiltonian constraint

fluxup3_n_fromMom: \(S^{\{n\}i}\) Energy flux (or momentum density) in the \(n^\mu\) frame with spatial indices up computed from the Momentum constraint

Conserved variables

conserved_D: \(D\) Conserved mass-energy density in Wilson’s formalism

conserved_E: \(E\) Conserved internal energy density in Wilson’s formalism

conserved_Sdown4: \(S_{\mu}\) Conserved energy flux (or momentum density) in Wilson’s formalism with spacetime indices down

conserved_Sdown3: \(S_{i}\) Conserved energy flux (or momentum density) in Wilson’s formalism with spatial indices down

conserved_Sup4: \(S^{\mu}\) Conserved energy flux (or momentum density) in Wilson’s formalism with spacetime indices up

conserved_Sup3: \(S^{i}\) Conserved energy flux (or momentum density) in Wilson’s formalism with spatial indices up

dtconserved: \(\partial_t D, \; \partial_t E, \partial_t S_{i}\) List of coordinate time derivatives of conserved rest mass-energy density, internal energy density and energy flux (or momentum density) with spatial indices down in Wilson’s formalism

Kinematic variables

st_covd_udown4: \(\nabla_{\mu} u_{\nu}\) Spacetime covariant derivative of Lagrangian fluid four velocity with spacetime indices down

accelerationdown4: \(a_{\mu}\) Acceleration of the fluid with spacetime indices down

accelerationup4: \(a^{\mu}\) Acceleration of the fluid with spacetime indices up

s_covd_udown4: \(\mathcal{D}^{\{u\}}_{\mu} u_{\nu}\) Spatial covariant derivative of Lagrangian fluid four velocity with spacetime indices down, with respect to spatial hypersurfaces orthonormal to the fluid flow

thetadown4: \(\Theta_{\mu\nu}\) Fluid expansion tensor with spacetime indices down

theta: \(\Theta\) Fluid expansion scalar

sheardown4: \(\sigma_{\mu\nu}\) Fluid shear tensor with spacetime indices down

shear2: \(\sigma^2\) Magnitude of fluid shear

omegadown4: \(\omega_{\mu\nu}\) Fluid vorticity tensor with spacetime indices down

omega2: \(\omega^2\) Magnitude of fluid vorticity

Curvature quantities

Spatial curvature

s_RicciS_u: \({}^{(3)}R^{\{u\}}\) Ricci scalar of the spatial metric orthonormal to fluid flow

s_Gamma_udd3: \({}^{(3)}{\Gamma^{k}}_{ij}\) Christoffel symbols of spatial metric with mixed spatial indices

s_Riemann_uddd3: \({}^{(3)}{R^{i}}_{jkl}\) Riemann tensor of spatial metric with mixed spatial indices

s_Riemann_down3: \({}^{(3)}R_{ijkl}\) Riemann tensor of spatial metric with all spatial indices down

s_Ricci_down3: \({}^{(3)}R_{ij}\) Ricci tensor of spatial metric with spatial indices down

s_RicciS: \({}^{(3)}R\) Ricci scalar of spatial metric

Spacetime curvature

st_Gamma_udd4: \({}^{(4)}{\Gamma^{\alpha}}_{\mu\nu}\) Christoffel symbols of spacetime metric with mixed spacetime indices

st_Riemann_uddd4: \({}^{(4)}{R^{\alpha}}_{\beta\mu\nu}\) Riemann tensor of spacetime metric with mixed spacetime indices

st_Riemann_down4: \({}^{(4)}R_{\alpha\beta\mu\nu}\) Riemann tensor of spacetime metric with spacetime indices down

st_Riemann_uudd4: \({}^{(4)}{R^{\alpha\beta}}_{\mu\nu}\) Riemann tensor of spacetime metric with mixed spacetime indices

st_Ricci_down4: \({}^{(4)}R_{\alpha\beta}\) Ricci tensor of spacetime metric with spacetime indices down

st_Ricci_down3: \({}^{(4)}R_{ij}\) Ricci tensor of spacetime metric with spatial indices down

st_RicciS: \({}^{(4)}R\) Ricci scalar of spacetime metric

Kretschmann: \(K={R^{\alpha\beta}}_{\mu\nu}{R_{\alpha\beta}}^{\mu\nu}\) Kretschmann scalar

Weyl decomposition

st_Weyl_down4: \(C_{\alpha\beta\mu\nu}\) Weyl tensor of spacetime metric with spacetime indices down

Weyl_Psi: \(\Psi_0, \; \Psi_1, \; \Psi_2, \; \Psi_3, \; \Psi_4\) List of Weyl scalars for an null vector base defined with AurelCore.tetrad_to_use

Psi4_lm: \(\Psi_4^{l,m}\) Dictionary of spin weighted spherical harmonic decomposition of the 4th Weyl scalar, with AurelCore.Psi4_lm_radius and AurelCore.Psi4_lm_lmax. spinsfast is used for the decomposition.

Weyl_invariants: \(I, \; J, \; L, \; K, \; N\) Dictionary of Weyl invariants

eweyl_u_down4: \(E^{\{u\}}_{\alpha\beta}\) Electric part of the Weyl tensor on the hypersurface orthogonal to \(u^{\mu}\) with spacetime indices down

eweyl_n_down3: \(E^{\{n\}}_{ij}\) Electric part of the Weyl tensor on the hypersurface orthogonal to \(n^{\mu}\) with spatial indices down

bweyl_u_down4: \(B^{\{u\}}_{\alpha\beta}\) Magnetic part of the Weyl tensor on the hypersurface orthogonal to \(u^{\mu}\) with spacetime indices down

bweyl_n_down3: \(B^{\{n\}}_{ij}\) Magnetic part of the Weyl tensor on the hypersurface orthogonal to \(n^{\mu}\) with spatial indices down

Null ray expansion

null_ray_exp: \(\Theta_{out}, \; \Theta_{in}\) List of expansion of null rays radially going out and in respectively

Constraints

Hamiltonian: \(\mathcal{H}\) Hamilonian constraint

Hamiltonian_Escale: [\(\mathcal{H}\)] Hamilonian constraint energy scale

Momentumup3: \(\mathcal{M}^i\) Momentum constraint with spatial indices up

Momentum_Escale: [\(\mathcal{M}\)] Momentum constraint energy scale

AurelCore

class aurel.core.AurelCore(fd, verbose=True)[source]

Bases: object

Class able to calculate any variable in aurel.descriptions.

Parameters:
  • fd (class) – aurel.finitedifference.FiniteDifference

  • verbose (bool) – If True, display messages about the calculations.

param

(dict) - Dictionary containing the data grid parameters, from fd.

Type:

dict

data

(dict) - Dictionary where all the variables are stored.

Type:

dict

data_shape

(tuple) - Shape of the data arrays: (Nx, Ny, Nz)

Type:

tuple

required_vars

(set) - Set of required variables that must be defined by the user.

“gxx”, “gxy”, “gxz”, “gyy”, “gyz”, “gzz”,

“kxx”, “kxy”, “kxz”, “kyy”, “kyz”, “kzz”,

“rho0”

Type:

set

fancy_print

(bool) - If True, display messages in a fancy ipython format, else normal print is used. Default is True.

Type:

bool

Lambda

(float) - Cosmological constant. Default is 0.0.

Type:

float

tetrad_to_use

(str) - Tetrad to use for calculations. Default is “quasi-Kinnersley”.

Type:

str

Psi4_lm_lmax

(int) - Maximum ell value used, increase this to improve convergence. Default is 8.

Type:

int

Psi4_lm_radius

(float) - Radius for the Psi4_lm calculations. Default is 0.9 * min(Lx, Ly, Lz).

Type:

float

kappa

(float) - Einstein’s constant with G = c = 1. Default is 8 * pi.

Type:

float

calculation_count

(int) - Number of calculations performed.

Type:

int

clear_cache_every_nbr_calc

(int) - Number of calculations before clearing the cache.

Type:

int

memory_threshold_inGB

(int) - Memory threshold in GB for clearing the cache.

Type:

int

last_accessed

(dict) - Dictionary to keep track of when each variable was last accessed.

Type:

dict

var_importance

(dict) - Dictionary to keep track of the importance of each variable for cache cleanup. To never delete a variable, set its importance to 0.

Type:

dict

assumption(keyname, assumption)[source]

Print assumption message.

cleanup_cache()[source]

Remove old entries from the cache based on age and size.

freeze_data()[source]

Freeze the data dictionary to prevent cache removal.

kronecker_delta3()[source]

Compute Kronecker delta with 3 3D indices.

kronecker_delta4()[source]

Compute Kronecker delta with 4 4D indices.

levicivita_down3()[source]

Compute Levi-Civita tensor with 3 3D indices down.

levicivita_down4()[source]

Compute Levi-Civita tensor with 4 4D indices down.

levicivita_symbol_down3()[source]

Compute Levi-Civita symbol with 3 3D indices down.

levicivita_symbol_down4()[source]

Compute Levi-Civita symbol with 4 4D indices down.

load_data(sim_data, iteration)[source]

Load simulation data into this classe’s data dictionary, and freeze.

Parameters:
  • sim_data (dict) – Dictionary containing the simulation data, each key has a list of values for each iteration.

  • iteration (int) – The iteration number to load data from.

magnitude3(fdown)[source]

Compute magnitude of a 3D rank 2 tensor.

magnitude4(fdown)[source]

Compute magnitude of a 4D rank 2 tensor.

myprint(message)[source]

Print a message with a fancy format.

norm3(a)[source]

Compute norm of a 3D rank 1 tensor.

norm4(a)[source]

Compute norm of a 4D rank 1 tensor.

null_vector_base()[source]

Return an arbitrary null vector base.

Returns:

lup4, kup4, mup4, mbup4 – Each is (4, Nx, Ny, Nz) array_like complex

Return type:

list

Note

See ‘Introduction to 3+1 Numerical Relativity’ 2008 by M. Alcubierre page 295

s_covd(f, indexing)[source]

Spatial covariant derivative of a 3D tensor of rank 0, 1 or 2.

Covariant derivative with respects to the spatial metric.

Parameters:
  • f ((..., Nx, Ny, Nz) array_like) – Tensor of rank 0, 1 or 2. The first indices are the spatial ones.

  • indexing (str) – ‘’ for scalar, ‘u’ for upper index, ‘d’ for down index, ‘uu’ for two upper indices, ‘dd’ for two down indices, ‘ud’ for one upper and one down index

Return type:

(3, …, Nx, Ny, Nz) array_like

s_curl(fdown3, indexing)[source]

Compute curl along n of a 3D rank 2 covariant tensor.

Parameters:
  • fdown3 ((3, 3, Nx, Ny, Nz) array_like) – Rank 2 spatial tensor with both indices down

  • indexing (str) – only accepts ‘dd’ for two down indices

Return type:

(3, 3, Nx, Ny, Nz) array_like

s_div(f, indexing)[source]

Compute divergence along n of a 3D tensor of rank 1 or 2.

Parameters:
  • f – if rank 1: (3, Nx, Ny, Nz) array_like, if rank 2: (3, 3, Nx, Ny, Nz) array_like

  • indexing (str) – ‘u’ for upper index, ‘d’ for down index

Returns:

  • if rank 1 (Nx, Ny, Nz) array_like

  • if rank 2 (3, Nx, Ny, Nz) array_like

s_to_st(fdown3)[source]

Compute spacetime tensor from the spatial tensor.

Parameters:

fdown3 ((3, 3, Nx, Ny, Nz) array_like) – Rank 2 spatial tensor with both indices down

Returns:

fdown4 – Rank 2 spacetime tensor with both indices down

Return type:

(4, 4, Nx, Ny, Nz) array_like

Note

By definition the electric part of the Weyl tensor in the \(n^\mu\) frame with indices up, \({}^{(n)}E^{\alpha \beta}\), only has spatial components, same for the magnetic part, \({}^{(n)}B^{\alpha \beta}\), and the extrinsic curvature, \(K^{\alpha\beta}\). So this function only applied to those three tensors.

st_covd(f, dtf, indexing)[source]

Spacetime covariant derivative of a 4D tensor of rank 0 or 1.

Covariant derivative with respects to the spacetime metric.

Parameters:
  • f ((..., Nx, Ny, Nz) array_like) – Tensor of rank 0, or 1. The first indices are the spacetime ones.

  • dtf ((..., Nx, Ny, Nz) array_like) – Time derivative of the tensor. This array must have the same shape.

  • indexing (str) – ‘’ for scalar ‘u’ for upper index, ‘d’ for down index

Return type:

(4, …., Nx, Ny, Nz) array_like

tetrad_base()[source]

Return an quasi-Kinnersley or arbitrary tetrad base.

if AurelCore.tetrad_to_use == “quasi-Kinnersley”:

Which is the default, because the tetrad_to_use is set to “quasi-Kinnersley” in the init. Then quasi-Kinnersley tetrad is returned where the first tetrad is the normal to the hypersurface \(n^\mu\).

else:

Then an arbitrary orthonormal tetrad is returned where the first tetrad is the fluid 4-velocity \(u^\mu\).

Returns:

e0up4, e1up4, e2up4, e3up4 – Each is (4, Nx, Ny, Nz) array_like

Return type:

list

Note

  • for Kinnersly tetrad see https://doi.org/10.1103/PhysRevD.65.044001 also see: Cactus/arrangements/EinsteinAnalysis/WeylScal4/m/WeylScal4.m Like the WeylScal4 thorn: tetrad given in wave zone (lapse = 1, shift = 0) and we do not perform the final rotation. Unlike the WeylScal4 thorn: I calc Weyl tensor in full (no wave zone assumption), but this gives the same result.

  • for Gram-Schmidt scheme see Chapter 7 of ‘Linear Algebra, Theory and applications’ by W.Cheney and D.Kincaid

trace3(fdown3)[source]

Compute trace of a 3D rank 2 tensor.

trace4(fdown4)[source]

Compute trace of a 4D rank 2 tensor.

vector_inner_product3(a, b)[source]

Inner product of rank 1 3D tensors with indices up.

vector_inner_product4(a, b)[source]

Inner product of rank 1 4D tensors with indices up.