ensim4 is a real-time inline combustion engine test-bed simulator that uses isentropic
flow equations and one dimensional computational fluid dynamics to simulate exhaust gas
pipe dynamics.
ensim4 generates audio, so crank up your headphones!
For an audio sample:
https://www.youtube.com/watch?v=fq1WPNeVXrI
Requires a C23 compatible compiler.
Dependencies:
pacman -S sdl3
Compile one of either built in engines:
make ENGINE=ENGINE_3_CYL
./ensim4
or
make ENGINE=ENGINE_8_CYL
./ensim4
Then, to start your engine:
- Hold
spaceto engage your starter - Tap
dwhile holdingspaceto ignite your spark plugs - Manage your throttle with
h, j, k, l
Engine nodes (volumes) can be toggled with the cursor.
Otherwise, via the keyboard:
p: Selects all piston nodes
i: Selects all intake nodes
e: Selects all exhaust nodes
c: Clears selection
n: Selects the next node(s) of the currently (only) selected node
The effects of 1D-CFD on audio can be enabled and disabled with the y key.
Performance tuning is done via perf-stat. Logs to perf.txt, runs for a number of cycles.
make perf
Ange Yaghi for inspiration and impulse convolution (https://github.com/ange-yaghi/engine-sim).