loading...
running...
How to use
Pick a preset or change geometry, compression ratio, boost, spark and mixture. The p-V loop, pressure, temperature and torque graphs update at once; the white dot marks the current crank angle. Use slow motion (default 0.04x) to watch the 720 deg cycle; drag to orbit and use the camera buttons. Switch to free-running mode to see a flywheel average the torque pulses. Space pauses, R resets.
Four cylinders are fixed in 3D (use the 2D page for 1 to 3 cylinders). Models and baked PBR textures made in Blender; the gas colour shows temperature and a flash marks each spark.
The science
Slider-crank. With crank radius a = stroke/2, rod length L and crank angle theta from top dead centre, the piston-pin distance from the crank axis is
x(theta) = a cos(theta) + sqrt(L² - a² sin²(theta)), V(theta) = Vc + A (L + a - x), r = (Vd + Vc)/Vc
The lever arm that turns piston force into crank torque is -dx/dtheta = dV/dtheta / A, so gas torque is T = (p - p0) dV/dtheta. The reciprocating mass m adds an inertia term T = m w² x''(theta) dV/dtheta / A that averages to exactly zero over a revolution (checked below) but grows with rpm squared.
Gas model. Each cylinder is a single-zone ideal gas with constant effective gamma. From the closed-cylinder first law,
dp/dphi = (gamma-1)/V [dQ_burn/dphi - dQ_loss/dphi] - gamma p/V dV/dphi
Heat release follows a Wiebe function x_b = 1 - exp(-6.908 ((phi - phi_s)/Δphi)³), Q = eta_c m_fuel LHV with LHV = 44 MJ/kg and stoichiometric air-fuel ratio 14.7. Wall loss is h A_w (T - T_wall) with a constant coefficient. The charge mass is p_in V_BDC / (R T_in), scaled by an illustrative volumetric-efficiency curve that peaks at the intake tuning rpm. Exhaust blow-down, intake and exhaust pressures are simple fixed levels, not a gas-dynamics model.
Performance. IMEP = (closed-loop integral of p dV) / Vd. Friction uses an illustrative FMEP curve (97 kPa + 15 kPa/1000 rpm + 5 kPa/(1000 rpm)², typical order of magnitude, not a specific engine). BMEP = IMEP - FMEP, brake torque = BMEP Vd n_cyl / (4 pi), power = torque x w. Four-cylinder firing order 1-3-4-2 spaces power strokes 180 deg apart; the torque graph shows how cylinder count smooths the pulsation, and the free-running mode lets a flywheel of inertia J integrate J dw/dt = T_gas+inertia - T_friction - T_load.
Honest simplifications. Air-standard gas with constant gamma over-predicts peak temperature (no dissociation, no variable specific heats): results are qualitatively right, not a calibrated engine map. No knock, emissions, valve flow losses, crevice volumes, blow-by or cycle-to-cycle variation. The Otto check removes loss, blow-down and uses a 3 deg burn so the numerical cycle must reproduce eta = 1 - r^(1-gamma).