Skip to content

Fire / Gas / Weather simulator

A fire that obeys the ideal gas law.

A 72x72 Eulerian field ignites a fuel bed, lets combustion cross ignition and self-sustain, lofts soot as a light-absorbing plume, then drops water and watches the flame die - every frame solved and encoded to GIF in nothing but C# on the .NET base class library. No engine, no shader, no image file.

Blackbody light Buoyant advection Beer-Lambert smoke Phase change

1429K
Peak flame temperature
561K
After the water drop
34
Frames at ~20 fps
6/6
Physics self-tests pass

How it works

Five bits of physics, one field.

Combustion

Fuel plus oxygen plus heat releases energy; once a cell passes the ignition point it keeps its neighbours burning without the pilot.

Ideal gas

Pressure follows P = rho R T at every cell - the self-test checks it to 1e-6 before a single frame is drawn.

Buoyancy

Hot, light gas rises. The smoke centre of mass climbs from row 5 to row 16 over the run - measured, not faked.

Blackbody light

The flame emits by temperature: green lifts against red as it heats, and blue only emerges near white-hot.

Phase change

Dropped water carries latent heat. Melting and boiling stay isothermal; injected joules are conserved to within one J.

Suppression

Water pulls the doused column below ignition - the core falls from 1429 K to 561 K and the fire gives up.

Build

Nothing but the BCL.

The solver leans on eight OnlyCSharp 1.7 leaves - stable fluids, noise, thermodynamics, fluids physics, fast RNG and math, and a from-scratch Gif89a encoder. Each depends on nothing outside .NET itself.

dotnet run --project FireGasSim -c Release

One run renders the beauty and debug GIFs and prints the six-test log: ideal gas, combustion, buoyancy, Wien shift, phase-change energy, and suppression - all PASS.