Learn
Iron-Carbon Phase Diagram
The iron-carbon (Fe-C) phase diagram is a graphical tool used to understand the different microstructures and phases of iron and its alloys (steel and cast iron) based on temperature (Y-axis) and carbon content (X-axis). It describes how the material behaves under equilibrium conditions, typically during slow heating or cooling.
Try this simulation yourself
The entire diagram runs on four mathematical boundary functions that define where each phase exists:
liquidusT(c) — the melting curve. Above this temperature at any carbon %, everything is liquid. It's a piecewise function: drops steeply from 1538°C at pure iron down to 1147°C at 4.3% C (eutectic point), then rises again toward cementite.
a3T(c) — the ferrite-to-austenite boundary. Starts at 912°C at pure iron and drops linearly to 727°C at 0.76% C (eutectoid point). Below this line on the left side, ferrite starts forming.
acmT(c) — the cementite dissolution line. Rises from 727°C at 0.76% C up to 1147°C at 2.14% C. Above this line, austenite dissolves all the carbon. Below it, excess carbon precipitates as cementite (Fe₃C).
727°C horizontal — the eutectoid isotherm. Below this, austenite can't exist. It transforms into pearlite (alternating ferrite + cementite layers).
The phase identification engine — getPhase(c, t) — is a nested conditional tree. It takes the crosshair position, checks which boundaries the point falls between, and returns the phase name, crystal structure, color, and description. The order matters: it checks liquid first, then the steel region (< 2.14% C) with its sub-regions, then the cast iron region (> 2.14% C).
The rendering loop — every time you drag, it redraws the canvas: tinted phase fills first, then grid lines, then the boundary curves, then critical point dots, then labels, then the crosshair. The crosshair dot color dynamically matches whatever phase it's sitting in.
Key points buttons call goTo(c, t) which jumps the crosshair to important locations — eutectoid at 0.76%/727°C, eutectic at 4.3%/1147°C, and max solubility points.
