This is a 2D companion to the 3D cylindrical-bar quench simulator, but it solves a genuinely different geometry with an independent numerical method: instead of a 1D radial finite-difference model (which assumes perfect circular symmetry), this sim discretizes the full 2D cross-section of a square bar into a grid of cells and solves the 2D transient heat-conduction equation directly, cell by cell:
Interior cell: ρc·∂T/∂t = k·(T_E+T_W+T_N+T_S − 4T)/Δr²
Edge cell: one neighbour replaced by convection: h·(T∞−T)/Δr
Corner cell: two neighbours replaced by convection (cooled from two faces at once)
a = k/(ρc) ≈ 1.17×10⁻⁵ m²/s (plain-carbon steel)
Every cell tracks the coldest temperature it has reached, Tmin, and once Tmin drops below the martensite-start temperature Ms the same Koistinen-Marburger relation used by the 3D sim converts that cell to martensite — no shared code, just the same physical law reapplied per grid cell:
Ms(°C) ≈ 539 − 423·(%C) (Andrews' relation, carbon term)
f_M(T) = 1 − exp[ −0.011·(Ms − T) ] for T < Ms, else 0
HRC_max(%C) ≈ min(66, 20 + 58·%C) HRC(cell) ≈ 10·(1 − f_M) + HRC_max·f_M
Because a corner cell loses heat through two exposed faces simultaneously while a face-center cell loses heat through only one, and the core loses heat only by conduction, the three positions cool — and harden — at genuinely different rates even though every cell shares the same carbon content and quenchant. This "corner effect" is a well-known headache in real heat treatment of rectangular and square stock, and it simply cannot appear in a purely radial 1D model: a cylinder has no corners.
- Carbon content — sets Ms and the achievable hardness ceiling, identical relation to the 3D sim.
- Quenching medium — sets the surface heat-transfer coefficient h at every exposed face independently.
- Bar side length — a thicker bar lengthens the conduction path from every face to the core, delaying core hardening the most (it only ever sees one-directional relief, from four faces converging, never the two-sided boost a corner gets).
- Watch the four bright corners harden first, then the face midlines darken inward from two sides, while the core — the last region to feel the quench at all — can stay soft, untransformed austenite long after the corners are fully martensitic.