The physics in the picture
Viscosity lets the moving lid drag the fluid just beneath it, and that sets up a single clockwise primary vortex filling the cavity. That is why the speed map is bright only just below the lid (speed ≈ 1) and dark in the middle. The vortex centre is the point where the velocity is zero.
Re = UL/ν is the ratio of inertia to viscosity; here U = L = 1, so ν = 1/Re. At low Re viscosity dominates and the vortex is nearly symmetric left to right (centre x ≈ 0.55). As Re grows, inertia carries the fluid downstream toward the right wall, and the centre moves right and down (x ≈ 0.61, y ≈ 0.67 at Re 300).
Pressure is high in the top-right corner, where fluid carried by the lid runs into the wall (a stagnation point), and low in the top-left corner, where fluid is pulled away from the wall. The dimensionless pressure p/(ρU²) shrinks as Re grows: viscous pressure scales as μU/L, so after dividing by ρU² it goes as 1/Re. In the CFD, the top-right corner pressure is at Re 20 and at Re 300.
What the network gets right: where the vortex sits and how strong it is
Over the 10 Test cases (Re values held out of training) the error is about 1.5% of the lid speed: RMSE . More importantly, the network follows how the vortex centre moves with Re. One grid cell is 0.02 wide, and the NN centre stays within one cell of the CFD centre in most cases. Vortex strength (the minimum of the streamfunction ψ) matches the CFD to within 3%.
Vortex centre x vs Re
Vortex centre y vs Re
Sanity check: at Re 100 this CFD puts the centre at , close to the high-resolution benchmark of Ghia et al. (1982), (0.617, 0.734). Even the coarse 50 × 50 reference captures the primary vortex well.
Where the error remains: the lid and the two top corners
Share of the Test-case squared error that falls in the top 10% band (y > 0.9). The band is only a tenth of the area, yet it holds most of the error.
The cause is the corner singularity. Where the lid (u = 1) meets a side wall (u = 0), the velocity jumps, and in theory the pressure becomes unbounded. A smooth function with two tanh hidden layers of 32 nodes cannot represent such sharp peaks, so it flattens them.
RMSE per case vs Re (all 50 cases)
The error is largest at the ends of the range, especially the pressure near Re 20, even though that is a Train case. Low-Re pressure peaks are both larger (1/Re scaling) and sharper, while the output normalization uses one standard deviation for all Re, so these extremes carry relatively little weight in training. Cases at the ends of the range also have training neighbours on one side only.
Physical laws are not guaranteed
The network was trained only to fit the CFD data with MSE. The continuity equation ∂u/∂x + ∂v/∂y = 0 was never imposed as a constraint; this is not a PINN. Applying the same central difference to the cell-centred values of both fields gives the RMS divergence below (closer to zero means better mass conservation).
The NN field diverges 3–5 times more than the CFD field. The CFD value is not zero only because it is computed from cell-centred averages; on the solver's own MAC grid the divergence is about 10−15. For the same reason, the small secondary eddies in the bottom corners cannot be trusted. In the CFD their strength grows with Re from 4×10−6 to 1×10−4, while the NN gives about 2×10−3 regardless of Re. The streamlines that curl in those corners are error, not physics.
Why it can predict a new Re without running CFD
Notebook Check question: once training finishes, why can the model predict a new Reynolds condition without running CFD again?
Re is an input, and the 40 training cases were learned together, so the network has learned one function (x, y, Re) → (u, v, p) that is continuous in Re. A new Re is just a new input to that function. Evaluating it is a fixed-weight matrix product over 2,500 cells, about 1,200 multiplications per cell. One NN field takes about 7 ms; one CFD case needs thousands of time steps and took about 3 s.
This holds only for interpolation inside the training range. Outside it, the function simply keeps going with nothing to anchor it:
At Re 400 the true centre moves back toward the middle (x ≈ 0.55), but the NN keeps extending its rightward trend. That is why the demo limits Re to 20–300.