Chapter 14: Stress-Energy Tensor
The stress-energy tensor Tμν describes the distribution of energy, momentum, and stress in spacetime. It's the source of gravity in Einstein's equations, replacing Newtonian mass density with a full description of matter and fields.
Physical Interpretation
T00 = Energy Density
\( \rho c^2 \) — mass-energy per unit volume
T0i = Momentum Density
Energy flux / momentum per unit volume
Ti0 = Energy Flux
Energy flow per unit area per unit time
Tij = Stress Tensor
Pressure (diagonal), shear stress (off-diagonal)
Key property: Tμν is symmetric (Tμν = Tνμ), ensuring angular momentum conservation.
Perfect Fluid
The most common matter model in cosmology and astrophysics:
\( T_{\mu\nu} = (\rho + p/c^2) u_\mu u_\nu + p \, g_{\mu\nu} \)
ρ = energy density, p = pressure, uμ = 4-velocity
Dust (p = 0)
\( T_{\mu\nu} = \rho u_\mu u_\nu \)
Non-relativistic matter, galaxies
Radiation (p = ρc²/3)
Equation of state w = 1/3
Photons, early universe
Dark Energy (p = -ρc²)
\( T_{\mu\nu} = -\rho c^2 g_{\mu\nu} \) (cosmological constant)
Accelerating expansion
Stiff Matter (p = ρc²)
Equation of state w = 1
Hypothetical, very early universe
Electromagnetic Field
\( T_{\mu\nu} = \frac{1}{\mu_0}\left( F_{\mu\alpha}F_\nu^{\;\alpha} - \frac{1}{4}g_{\mu\nu}F_{\alpha\beta}F^{\alpha\beta} \right) \)
Properties
- • Trace-free: Tμμ = 0 (radiation-like)
- • Energy density: \( u = \frac{1}{2}(\epsilon_0 E^2 + B^2/\mu_0) \)
- • Poynting vector: \( \vec{S} = \vec{E} \times \vec{B}/\mu_0 \)
- • Maxwell stress tensor for Tij
Conservation Law
\( \nabla_\mu T^{\mu\nu} = 0 \)
Covariant conservation of energy-momentum
This equation generalizes energy and momentum conservation to curved spacetime. It contains:
ν = 0: Energy Conservation
Rate of change of energy density + divergence of energy flux = 0
ν = i: Momentum Conservation
Euler/Navier-Stokes equations emerge from spatial components
Python: Perfect Fluid Evolution
#!/usr/bin/env python3
"""
stress_energy.py - Stress-energy tensor for different matter types
Run: python3 stress_energy.py
"""
import numpy as np
import matplotlib.pyplot as plt
def perfect_fluid_stress_energy(rho, p, u_mu, g_mu_nu):
"""
Compute perfect fluid stress-energy tensor
T_mu_nu = (rho + p) u_mu u_nu + p g_mu_nu
"""
T = np.zeros((4, 4))
for mu in range(4):
for nu in range(4):
T[mu, nu] = (rho + p) * u_mu[mu] * u_mu[nu] + p * g_mu_nu[mu, nu]
return T
def em_stress_energy(E, B, c=1):
"""
Electromagnetic stress-energy tensor (3+1 form)
"""
eps0 = 1 # Natural units
mu0 = 1
T = np.zeros((4, 4))
# Energy density
u = 0.5 * (eps0 * np.dot(E, E) + np.dot(B, B) / mu0)
T[0, 0] = u
# Poynting vector (momentum density / energy flux)
S = np.cross(E, B) / mu0
T[0, 1:] = S / c
T[1:, 0] = S / c
# Maxwell stress tensor
for i in range(3):
for j in range(3):
T[i+1, j+1] = (eps0 * (E[i]*E[j] - 0.5*(i==j)*np.dot(E,E)) +
(B[i]*B[j] - 0.5*(i==j)*np.dot(B,B)) / mu0)
return T
# Flat spacetime metric
eta = np.diag([-1, 1, 1, 1])
# Fluid at rest: u^μ = (1, 0, 0, 0)
# Lower index: u_μ = g_μν u^ν = (-1, 0, 0, 0)
u_mu = np.array([-1, 0, 0, 0])
print("Stress-Energy Tensors in General Relativity")
print("="*60)
# Dust (non-relativistic matter)
print("\n1. DUST (pressureless matter, p = 0)")
rho_dust = 1.0 # Energy density
p_dust = 0.0
T_dust = perfect_fluid_stress_energy(rho_dust, p_dust, u_mu, eta)
print("T_μν =")
print(T_dust)
print(f"Trace T = {np.einsum('ii', np.einsum('ij,jk->ik', np.linalg.inv(eta), T_dust)):.4f}")
# Radiation
print("\n2. RADIATION (p = ρ/3)")
rho_rad = 1.0
p_rad = rho_rad / 3
T_rad = perfect_fluid_stress_energy(rho_rad, p_rad, u_mu, eta)
print("T_μν =")
print(np.round(T_rad, 4))
print(f"Trace T = {np.einsum('ii', np.einsum('ij,jk->ik', np.linalg.inv(eta), T_rad)):.4f}")
print("(Trace = 0 for radiation!)")
# Dark energy / Cosmological constant
print("\n3. DARK ENERGY / COSMOLOGICAL CONSTANT (p = -ρ)")
rho_de = 1.0
p_de = -rho_de
T_de = perfect_fluid_stress_energy(rho_de, p_de, u_mu, eta)
print("T_μν =")
print(T_de)
print("(Proportional to metric: T_μν = -ρ g_μν)")
# Electromagnetic field
print("\n4. ELECTROMAGNETIC FIELD")
E = np.array([1.0, 0, 0]) # Electric field in x-direction
B = np.array([0, 1.0, 0]) # Magnetic field in y-direction
T_em = em_stress_energy(E, B)
print(f"E = {E}")
print(f"B = {B}")
print("T_μν =")
print(np.round(T_em, 4))
print(f"Trace T = {np.trace(np.einsum('ij,jk->ik', np.linalg.inv(eta), T_em)):.4f}")
print("(Trace = 0 for EM field!)")
# Equation of state
print("\n" + "="*60)
print("Equation of State: p = w ρ c²")
print("-"*60)
print("w = 0 : Non-relativistic matter (dust)")
print("w = 1/3 : Radiation (photons, relativistic particles)")
print("w = -1 : Cosmological constant (dark energy)")
print("w = -1/3 : Cosmic strings")
print("w = 1 : Stiff matter (speculative)")To Run:
python3 stress_energy.py
Requires: numpy
Fortran: Conservation Check
! conservation_law.f90 - Check covariant conservation of stress-energy
! Compile: gfortran -o conservation_law conservation_law.f90
! Run: ./conservation_law
program conservation_law
implicit none
integer, parameter :: dp = selected_real_kind(15)
real(dp), parameter :: pi = 4.0_dp * atan(1.0_dp)
real(dp) :: rho, p, w
real(dp) :: a, H, rho_dot
real(dp) :: conservation_error
print '(A)', 'Stress-Energy Conservation in Cosmology'
print '(A)', '========================================'
print '(A)', ''
print '(A)', 'For FLRW universe with perfect fluid:'
print '(A)', ' ∇_μ T^μν = 0 → dρ/dt + 3H(ρ + p) = 0'
print '(A)', ''
print '(A)', 'This gives the fluid equation:'
print '(A)', ' ρ ∝ a^(-3(1+w)) where p = wρ'
print '(A)', ''
! Test different matter types
print '(A)', 'Matter Type w ρ ∝ a^n Physical'
print '(A)', '-----------------------------------------------'
! Dust
w = 0.0_dp
print '(A,F6.2,A,F6.2,A)', 'Dust ', w, ' a^', -3*(1+w), ' Matter dilutes'
! Radiation
w = 1.0_dp/3.0_dp
print '(A,F6.2,A,F6.2,A)', 'Radiation ', w, ' a^', -3*(1+w), ' + redshift'
! Cosmological constant
w = -1.0_dp
print '(A,F6.2,A,F6.2,A)', 'Λ (Dark Energy) ', w, ' a^', -3*(1+w), ' Constant!'
! Curvature (effective)
w = -1.0_dp/3.0_dp
print '(A,F6.2,A,F6.2,A)', 'Curvature ', w, ' a^', -3*(1+w), ' Geometry'
print '(A)', ''
print '(A)', 'Numerical verification for radiation-dominated era:'
! Radiation era: ρ ∝ a^(-4)
rho = 1.0_dp
w = 1.0_dp/3.0_dp
p = w * rho
a = 1.0_dp
H = 1.0_dp ! Hubble parameter (arbitrary)
! Conservation: dρ/dt = -3H(ρ + p)
rho_dot = -3.0_dp * H * (rho + p)
! For ρ ∝ a^(-4): dρ/dt = -4ρ (da/dt)/a = -4ρH
! Should equal -3H(ρ + ρ/3) = -3H(4ρ/3) = -4ρH ✓
print '(A,E12.4)', ' ρ = ', rho
print '(A,E12.4)', ' p = wρ = ', p
print '(A,E12.4)', ' dρ/dt = -3H(ρ+p) = ', rho_dot
print '(A,E12.4)', ' Expected -4Hρ = ', -4.0_dp*H*rho
conservation_error = abs(rho_dot - (-4.0_dp*H*rho))
print '(A,E12.4)', ' Error: ', conservation_error
if (conservation_error < 1.0e-10_dp) then
print '(A)', ' ✓ Conservation law verified!'
end if
end program conservation_lawTo Compile and Run:
gfortran -o conservation_law conservation_law.f90
./conservation_law