When the fluid is relativistic
A pressure imbalance sets a fluid in motion. At relativistic speeds, its evolution couples rest mass, momentum and energy through the Lorentz factor. Pressure and internal energy also contribute to the fluid’s inertia. The familiar Euler equations must account for these effects.
Here we consider a perfect fluid in Minkowski spacetime: flat spacetime, with no gravitational source terms in Cartesian coordinates. A one-dimensional shock tube lets us see the resulting waves in density, pressure and velocity, then ask how a physics-informed neural network can represent their evolution.
The equations in flat spacetime
Let be the rest-mass density measured with the fluid, its pressure and its four-velocity. We set and use metric signature . Rest-mass conservation and energy–momentum conservation are
Here is the Minkowski metric. The perfect-fluid stress-energy tensor contains the specific enthalpy . For an ideal gas with adiabatic index , the closure is
Here is specific internal energy, and is the squared three-speed. The density is a rest-frame quantity; the velocity and the conserved densities below refer to the chosen laboratory frame.
For motion along one Cartesian direction, with no transverse velocity, the system becomes
The three components are laboratory-frame rest-mass density , momentum density and energy density excluding rest-mass energy . Their fluxes describe what crosses a fixed surface. The Lorentz factor couples the primitive variables to all three conserved quantities. Martí and Müller’s review develops this formulation and its numerical solution.
Open a relativistic shock tube
Initially, two uniform fluids move to the right at half the speed of light, separated at . The left side is denser and has higher pressure. Choose and the following states:
| Initial state | Rest-mass density | Pressure | Velocity |
|---|---|---|---|
| Left | 1 | 1 | 0.5 |
| Right | 0.125 | 0.1 | 0.5 |
Density is measured in units of the initial left density, pressure in that density times , and velocity in units of . Position uses an arbitrary length scale; the time unit is the time light takes to cross that length.
The pressure imbalance changes the flow. The surfaces sample the exact Riemann solution over position and time. Select a fluid variable, rotate the view, and move the time slider to inspect its profile.
Read the three waves
The initial jump separates into three features:
- Rarefaction. An expanding fan travels into the high-pressure left state. Density and pressure decrease smoothly through it while the fluid accelerates to the right.
- Contact discontinuity. Two fluids meet at the same pressure and velocity but with different densities. The contact moves with the fluid.
- Shock. A sharp compression propagates into the right state. Density, pressure and velocity change across it.
The contact moves at approximately 0.769 times the speed of light; the shock moves at 0.936. The wave pattern can therefore travel faster than the material behind it. This distinction is clear in the velocity panel: the fluid speed between the rarefaction and shock is about 0.769, not the shock speed.
Across a shock, ordinary derivatives are insufficient. Integrating the conservation laws through the moving front gives
Brackets denote the difference between right and left states, and is the front speed. All three balances must hold. The physical shock also satisfies the entropy condition. The relativistic Riemann construction combines these jump conditions with the smooth rarefaction solution.
What the neural network learns
A PINN takes position and time as inputs and predicts the primitive variables:
These outputs determine the Lorentz factor, enthalpy, conserved state and flux. Automatic differentiation then evaluates the time and space derivatives in the Euler residuals. Training combines those residuals with the known initial states and the boundary conditions, and updates the network parameters through backpropagation.
For this time interval, the waves stay inside the domain, so its ends remain in their initial states. The output parameterization can enforce positive density and pressure and a speed below light speed. Such bounds help keep the prediction physically admissible; the conservation equations still have to be learned.
Predicting primitive variables directly is convenient: a conventional conservative solver must recover them from the evolved conserved state, which requires a nonlinear inversion in relativistic hydrodynamics. A neural representation avoids that inversion at evaluation, but introduces a training problem of its own.
Learning across a shock
At a shock, a smooth network represents the jump as a thin transition. Its derivatives can become large, and the pointwise Euler residual can dominate training.
Our GA-PINNs paper addresses this with a gradient-dependent weight. Writing for the predicted density, pressure and velocity, one of its forms is
The positive parameters and set each gradient’s influence. Small gradients give a weight close to one. At a steep front, decreases and reduces that point’s contribution to the squared residual. This can reduce the pressure to smear the jump while retaining the equation constraints where gradients are small.
After the weighting example, the animation compares a GA-PINN prediction with the analytical solution (ground truth) at . Black curves show the reference; coloured curves and open circles show the prediction. A closer view reveals how the network resolves the contact and shock. The prediction comes from the saved public repository model, which adds causal weighting to the method in the paper.
Video description
Density is green, pressure orange and velocity blue. A pale green band marks the rarefaction; purple dashes and grey dots mark the contact and shock on all three variables. Only density jumps at the contact; all three jump at the shock. A network then predicts these variables from position and time, and automatic differentiation computes the Euler residuals. Narrowing a smooth shock profile increases its gradients. The weight proposed in the GA-PINNs paper falls as those gradients grow: the curves show its inverse dependence, its minimum at the front and the reduction in the residual's contribution to the loss. Next, black curves show the analytical ground truth and coloured curves with open circles show the saved GA-PINN prediction at time 0.5. The full profiles give way to a close view of the contact and shock. This repository model includes causal weighting. A general PINN training loop then combines the weighted residual with initial and boundary conditions. Wave speeds, jump balances and physical bounds are checked after training.
After training, check the predicted wave positions and all three conservation budgets on points separate from training. Check density and pressure positivity, the velocity bound, and the jump balance across the shock. The exact shock-tube solution provides a reference for each of these tests, including the contact that appears in density but not in pressure or velocity.