An interactive 3D incompressible Navier- ...

An interactive 3D incompressible Navier-Stokes solver

Jul 16, 2026

I built an interactive 3D incompressible Navier-Stokes solver in Swift and Metal that simulates flow around a NACA 0012 wing at high angle of attack, in real time, at 60 fps on Apple silicon.

What it does:

- Full 3D simulation grid (128x64x64), every stage running as a Metal compute kernel: semi-Lagrangian RK2 advection, Jacobi pressure projection, vorticity confinement

- Grab the wing with the mouse and rotate it against the flow, and watch the leading-edge vortex and wingtip vortices respond instantly

- Three visualization modes: volume-rendered vorticity, Q-criterion structures colored by vortex direction, and dye streaklines like in a real wind tunnel

- 200k GPU tracer particles on top, with a single-pass raymarcher that renders the volume and the wing in one fragment shader

The engineering detail I like most: the wing is an analytic signed distance field, not a mesh. Rotating it costs nothing. The simulation kernels simply transform sample points through a world-to-wing matrix. No remeshing, no voxelization, no pipeline stalls, just a different matrix next frame.

All parameters are live: viscosity, flow speed, vorticity confinement, dye injection. Move a slider and the flow reacts.

Built with Swift, SwiftUI and Metal compute.

Sources: https://github.com/makarov-mm/turbulence-lab

Подобається цей допис?

Купити для Michael Makarov Coffee

Більше від Michael Makarov