Injection
Mouse movement deposits weighted density and velocity into nearby cells.
Numerical simulation / Graphics / C
An interactive CPU fluid experiment in C using diffusion, pressure projection, semi-Lagrangian advection, and real-time D3D11 visualization.
Mouse input injects density and velocity into a 128 × 128 CPU grid; D3D11 presents the evolving field.
02 / Intent
gooey began as an experiment in turning a set of numerical operations into something immediate and tactile. Density provides the visible material, while the velocity field carries it through the grid.
The implementation is intentionally compact. Rather than hiding the solver behind an engine, the project keeps diffusion, projection, advection, interaction, and rendering close enough to trace as one complete loop.
03 / Architecture
Each frame advances the same fixed grid through a short solver pipeline before converting density into display pixels.
Mouse movement deposits weighted density and velocity into nearby cells.
Iterative neighbor solves spread density and velocity according to diffusion and viscosity parameters.
Computes divergence, iteratively solves pressure, and subtracts its gradient from velocity.
Backtraces through velocity and uses bilinear interpolation to move both velocity and visible density.
04 / Engineering decisions
Density, velocity, pressure, divergence, and working values live in fixed arrays. Each solver stage operates directly on those fields, making the order of simulation work unambiguous.
Semi-Lagrangian advection traces each destination cell backward through the velocity field and bilinearly samples the previous state, producing stable interactive motion with a straightforward implementation.
The CPU solver owns scalar density and vector velocity. Rendering only maps density through a color lookup and updates a texture, keeping graphics concerns out of the numerical operations.
05 / Current reality
gooey is a recovered visual experiment rather than a validated computational-fluid-dynamics tool. It runs on a 128 × 128 CPU grid with periodic boundaries, fixed iteration counts, and parameters chosen for interaction and appearance rather than measured physical accuracy.