Skip to content
LumenaryAcademy
Processes 70 min

Diffusion

Atoms on the move — random walks simulated, Fick's two laws, the diffusion equation solved on a grid and checked against the error function, the Arrhenius law, carburising steel and doping silicon.

Code tested · 6AI-draftedAwaiting review by a materials scientist

Your guides: Chloe · The Materials Scientist, Margaret · The Tester, Gideon · The Failure Analyst

MotivationH

A solid that is never still

A gear in a car's gearbox or a wind turbine's drivetrain has to do two things that pull in opposite directions. Its teeth slide and roll against each other millions of times, so their surfaces must be very hard to resist wear and pitting. But the gear also takes shock loads, so its core must be tough, able to absorb a blow without cracking. A steel hard enough for the surface would be too brittle for the core, and one tough enough for the core would wear away.

The usual answer is to make one part out of two steels without ever joining anything. A tough, low-carbon steel gear is held at about 900 °C in an atmosphere rich in carbon, and carbon atoms walk into it from the surface. After some hours the outer millimetre holds three or four times as much carbon as the core. Quenched, the high-carbon skin becomes hard and the low-carbon core stays tough. This is carburising, and it works only because atoms can move through a solid crystal.

The same process, with different atoms, makes computer chips: boron or phosphorus atoms in silicon make the p- and n-type regions of transistors. Diffusion also drives the rest of this level, from the growth of new phases (phase transformations) to the sintering of ceramic powders (processing and heat treatment).

IntuitionH

Random hops, steady drift

The atoms of a crystal sit on lattice sites, but they are never still. Each vibrates about its site about 101310^{13} times a second, and once in a great many vibrations one gathers enough energy to squeeze past its neighbours into a nearby site. That is a jump. Two mechanisms account for most jumps in crystals, both built on the point defects of defects and dislocations.

  • Vacancy diffusion. An atom next to a vacancy jumps into it, and the vacancy moves the other way. Atoms of the host and substitutional solutes, such as nickel in iron or copper in aluminium, move like this. They can jump only when a vacancy happens to be next door, which is rare, so they are slow.
  • Interstitial diffusion. A small atom sitting in the gaps between the host atoms, such as carbon, nitrogen or hydrogen in iron, jumps from one gap to the next. Nearly all the neighbouring gaps are empty, so it never has to wait for a vacancy, and it moves much faster.
vacancy mechanisminterstitial mechanismvacancy
The two main mechanisms of diffusion in crystals. Left: an atom (shaded) jumps into a neighbouring vacancy (dashed circle), and the vacancy moves the opposite way. Right: a small interstitial atom squeezes between two host atoms into the next empty gap, without needing a vacancy.

No atom knows which way is "down the concentration gradient". Each jump is equally likely to go in any allowed direction. Yet if there are more solute atoms on the left than on the right, more of them happen to jump from left to right than from right to left, simply because there are more of them available to jump. The net flow is a matter of counting, not of force.

Analogy, not a formal construction

Picture a crowded hall with an empty hall next door and the doors open. Nobody decides to move into the empty hall; everyone wanders at random. But people near the door who wander through it are rarely matched by people wandering back, because there is almost no one on the other side. Over time the crowd spreads evenly over both halls. When it is even, people still wander through the doors, but as many come back as go, and the net flow stops.

ComputationC

A random walk on a lattice

Simulating the jumps directly shows the two facts on which everything else rests. The first part of the block below lets 4000 atoms each make 1000 jumps on a simple cubic lattice, every jump of length aa in one of the six directions chosen at random, and measures how far they get. The second part starts with 100 atoms on every site of the left half of a one-dimensional bar and none on the right, and lets every atom hop left or right at random for 400 steps.

python
import math
import numpy as np

rng = np.random.default_rng(2026)

# 1. Atoms hopping on a simple cubic lattice: each jump has length a (= 1 here)
#    along one of the six directions +x, -x, +y, -y, +z, -z, chosen at random.
walkers, jumps = 4000, 1000
directions = np.array([[1, 0, 0], [-1, 0, 0], [0, 1, 0], [0, -1, 0], [0, 0, 1], [0, 0, -1]])
paths = np.cumsum(directions[rng.integers(0, 6, size=(walkers, jumps))], axis=1)
print("jumps n   <r^2>/a^2   <r^2>/(n a^2)   rms distance/a   net drift <x>/a")
for n in (10, 100, 1000):
    r = paths[:, n - 1]
    r2 = np.mean(np.sum(r**2, axis=1))
    print(f"{n:7d}   {r2:9.1f}   {r2 / n:13.3f}   {np.sqrt(r2):14.1f}   {np.mean(r[:, 0]):+15.2f}")

# 2. A concentration step: 100 atoms on every site from -200 to -1, none from 0 up.
#    Each time step every atom hops one site left or right, independently.
atoms = np.repeat(np.arange(-200, 0), 100)
n = 400
for _ in range(n):
    atoms += rng.choice((-1, 1), size=atoms.size)
counts, edges = np.histogram(atoms, bins=np.arange(-60, 61, 10))
print(f"\nafter {n} steps: atoms per site (each # is 5), and the erfc prediction")
for c, lo in zip(counts, edges[:-1]):
    per_site = c / 10
    x = lo + 5                                   # bin centre, measured from the old step at -0.5
    theory = 100 * 0.5 * math.erfc(x / math.sqrt(2 * n))
    print(f"{lo:4d} to {lo + 9:3d}  {per_site:5.1f}  {theory:5.1f}  {'#' * round(per_site / 5)}")
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

The first table shows that the average displacement is zero to within the noise, but the mean square displacement is ⟨r2⟩=na2\langle r^2 \rangle = n a^2 to within 2 %: after 10, 100 and 1000 jumps the typical distance from the start is about 3.2, 10.1 and 31.6 jumps' worth. A hundred times more jumps carries an atom only ten times further. The second table shows the sharp step at the origin smoothing into an S-shaped profile, about 40 atoms per site just to the right of the old step and about 60 just to the left, which matches, to within the random scatter, a formula built from the error function that the next sections derive.

Theorem— Mean square displacement of a random walk

If an atom makes nn jumps, each of length λ\lambda, in directions that are independent of one another and have no preferred direction, then ⟨r2⟩=nλ2\langle r^2 \rangle = n\lambda^2. If it jumps Γ\Gamma times per second, then after time tt, ⟨r2⟩=Γλ2t=6Dt\langle r^2 \rangle = \Gamma\lambda^2 t = 6Dt in three dimensions, where

D=16 Γλ2D = \tfrac16\,\Gamma\lambda^2

defines the diffusion coefficient. (In one dimension, with jumps only left or right, ⟨x2⟩=2Dt\langle x^2 \rangle = 2Dt and D=12Γλ2D = \tfrac12\Gamma\lambda^2.)

Proof

Write the displacement as a sum of jump vectors, r=s1+⋯+sn\mathbf r = \mathbf s_1 + \cdots + \mathbf s_n. Then r2=∑isi⋅si+∑i≠jsi⋅sjr^2 = \sum_i \mathbf s_i\cdot\mathbf s_i + \sum_{i \ne j}\mathbf s_i\cdot\mathbf s_j. Each si⋅si=λ2\mathbf s_i\cdot\mathbf s_i = \lambda^2. For i≠ji \ne j the jumps are independent and each has zero mean, so ⟨si⋅sj⟩=⟨si⟩⋅⟨sj⟩=0\langle \mathbf s_i\cdot\mathbf s_j\rangle = \langle\mathbf s_i\rangle\cdot\langle\mathbf s_j\rangle = 0. Hence ⟨r2⟩=nλ2\langle r^2\rangle = n\lambda^2. With n=Γtn = \Gamma t and the definition 6D=Γλ26D = \Gamma\lambda^2, ⟨r2⟩=6Dt\langle r^2 \rangle = 6Dt. The factor 6 is twice the number of dimensions, because ⟨r2⟩=⟨x2⟩+⟨y2⟩+⟨z2⟩\langle r^2\rangle = \langle x^2\rangle + \langle y^2\rangle + \langle z^2\rangle and each of the three equals 2Dt2Dt.

∎

This is the Einstein–Smoluchowski relation, from Einstein's 1905 paper on Brownian motion. Its practical consequence is the most useful rule of thumb in the subject: a diffusion distance is of order Dt\sqrt{Dt}. Doubling the depth of a carburised case takes four times as long; a feature ten times smaller homogenises a hundred times faster.

DefinitionsH

Fick's two laws

Fick, a physiologist studying salt in water, guessed that diffusion obeys the same law as heat conduction, which Joseph Fourier had published in 1822. The random walk shows why he was right.

Definition— diffusion flux

The flux JJ of a species is the amount crossing unit area per unit time, in mol m⁻² s⁻¹ (or kg m⁻² s⁻¹, or atoms m⁻² s⁻¹). Concentration CC is the amount per unit volume, in the matching unit per m³.

Definition— Fick's first law

In one dimension, the flux is proportional to the concentration gradient and flows down it:

J=−D ∂C∂x,J = -D\,\frac{\partial C}{\partial x},

where the diffusion coefficient DD, in m² s⁻¹, is the same DD as in the random-walk theorem. In three dimensions, J=−D ∇C\mathbf J = -D\,\nabla C for an isotropic material.

To see where the law comes from, picture two neighbouring atomic planes a jump length λ\lambda apart, holding n1n_1 and n2n_2 solute atoms per unit area. Each atom jumps Γ\Gamma times a second, and in one dimension half of those jumps go towards the other plane, so the net flux from plane 1 to plane 2 is 12Γ(n1−n2)\tfrac12\Gamma(n_1 - n_2). The concentrations are C=n/λC = n/\lambda, so n1−n2=−λ2 ∂C/∂xn_1 - n_2 = -\lambda^2\,\partial C/\partial x, and J=−12Γλ2 ∂C/∂xJ = -\tfrac12\Gamma\lambda^2\,\partial C/\partial x. That is Fick's first law, with the one-dimensional D=12Γλ2D = \tfrac12\Gamma\lambda^2 of the theorem.

Theorem— Fick's second law (the diffusion equation)

If no atoms are created or destroyed and DD does not depend on position or concentration, then

∂C∂t=D ∂2C∂x2.\frac{\partial C}{\partial t} = D\,\frac{\partial^2 C}{\partial x^2}.

Proof

Take a thin slice of the material between xx and x+Δxx + \Delta x, with unit cross-section. Atoms enter at the left face at the rate J(x)J(x) and leave at the right face at the rate J(x+Δx)J(x + \Delta x), so the amount in the slice, C ΔxC\,\Delta x, changes as Δx ∂C/∂t=J(x)−J(x+Δx)\Delta x\,\partial C/\partial t = J(x) - J(x + \Delta x). Dividing by Δx\Delta x and letting it shrink gives the continuity equation ∂C/∂t=−∂J/∂x\partial C/\partial t = -\partial J/\partial x. Substituting Fick's first law gives ∂C/∂t=∂(D ∂C/∂x)/∂x\partial C/\partial t = \partial(D\,\partial C/\partial x)/\partial x, which is D ∂2C/∂x2D\,\partial^2C/\partial x^2 when DD is constant.

∎

The second law says that concentration rises wherever the profile curves upwards (a dip fills in) and falls where it curves downwards (a peak flattens). It is mathematically the heat equation, met in Lumenary ME's heat transfer and in partial differential equations, with concentration in place of temperature and DD in place of the thermal diffusivity.

When the concentrations at the boundaries are held fixed for long enough, the profile stops changing. Then ∂C/∂t=0\partial C/\partial t = 0, so ∂2C/∂x2=0\partial^2 C/\partial x^2 = 0: the profile is a straight line and the flux is the same everywhere. This steady state is how gas-separation membranes and hydrogen-purifying palladium foils work.

Example— Carbon through a hot steel wall

A wall of steel 2.0 mm thick is held at 1000 °C, in the austenite range, with carbon-rich gas on one side keeping the carbon content just inside that surface at 1.0 wt% and carbon-poor gas on the other keeping it at 0.2 wt%. At this temperature the diffusion coefficient of carbon in austenite is about 1.95×10−111.95 \times 10^{-11} m² s⁻¹ (the next section shows where that comes from). Taking the density of hot iron as roughly 7600 kg m⁻³, a difference of 0.8 wt% is 0.008×7600=60.80.008 \times 7600 = 60.8 kg of carbon per m³. In the steady state

J=D ΔCΔx=1.95×10−11×60.80.0020=5.9×10−7 kg m−2 s−1,J = D\,\frac{\Delta C}{\Delta x} = 1.95 \times 10^{-11} \times \frac{60.8}{0.0020} = 5.9 \times 10^{-7}\ \text{kg m}^{-2}\,\text{s}^{-1},

or about 2.1 g of carbon per square metre per hour. Halving the wall thickness doubles the flux; raising the temperature, as we will see, changes it far more.

ComputationC

Solving the diffusion equation

Most diffusion problems in processing are not steady. Carburising is the standard example: a steel with a uniform carbon content C0C_0 is put in a furnace atmosphere at time zero, and the surface concentration jumps to CsC_\text{s} and stays there. The steel is thick compared with the distance carbon travels, so it can be treated as semi-infinite.

Theorem— The error-function solution

For ∂C/∂t=D ∂2C/∂x2\partial C/\partial t = D\,\partial^2 C/\partial x^2 on x≥0x \ge 0, with C(x,0)=C0C(x, 0) = C_0, C(0,t)=CsC(0, t) = C_\text{s} for t>0t > 0, and C→C0C \to C_0 far from the surface,

C(x,t)−C0Cs−C0=1−erf⁡ ⁣(x2Dt)=erfc⁡ ⁣(x2Dt),erf⁡(z)=2π∫0ze−u2 du.\frac{C(x,t) - C_0}{C_\text{s} - C_0} = 1 - \operatorname{erf}\!\left(\frac{x}{2\sqrt{Dt}}\right) = \operatorname{erfc}\!\left(\frac{x}{2\sqrt{Dt}}\right), \qquad \operatorname{erf}(z) = \frac{2}{\sqrt\pi}\int_0^z e^{-u^2}\,du.

Proof

The problem has no natural length scale, only xx and Dt\sqrt{Dt}, so look for a solution that depends on the single combination η=x/(2Dt)\eta = x/(2\sqrt{Dt}). With C=C(η)C = C(\eta), the chain rule gives ∂C/∂t=−η2tC′\partial C/\partial t = -\tfrac{\eta}{2t}C' and ∂2C/∂x2=14DtC′′\partial^2 C/\partial x^2 = \tfrac{1}{4Dt}C'', and the diffusion equation becomes the ordinary differential equation C′′+2ηC′=0C'' + 2\eta C' = 0. Its solutions satisfy C′=Ae−η2C' = A e^{-\eta^2}, so C=Cs+Berf⁡(η)C = C_\text{s} + B\operatorname{erf}(\eta). The boundary condition at x=0x = 0 (η=0\eta = 0) is already met, and both the initial condition (t=0t = 0) and the far-field condition send η→∞\eta \to \infty, where erf⁡→1\operatorname{erf} \to 1, so B=C0−CsB = C_0 - C_\text{s}. Rearranging gives the result.

∎

A given concentration therefore always sits at the same value of x/Dtx/\sqrt{Dt}: the profile keeps its shape and stretches as t\sqrt t. The same function, a half-step 12erfc⁡\tfrac12\operatorname{erfc}, described the random-walk histogram above.

Formulas like this exist only for simple geometries and constant DD. A gear tooth's curved surface, a DD that changes with carbon content or a changing furnace cycle needs a numerical solution. The simplest method replaces the derivatives by differences on a grid with spacing Δx\Delta x and time step Δt\Delta t:

Cin+1=Cin+r (Ci+1n−2Cin+Ci−1n),r=D ΔtΔx2.C_i^{n+1} = C_i^n + r\,\big(C_{i+1}^n - 2C_i^n + C_{i-1}^n\big), \qquad r = \frac{D\,\Delta t}{\Delta x^2}.

This explicit scheme is stable only for r≤12r \le \tfrac12; Lumenary ME's heat transfer lesson shows why, with the same equation for temperature. The block solves a carburising problem this way and compares it with the error-function solution: a steel with 0.20 wt% carbon, its surface held at 1.00 wt%, for 4 hours at 925 °C.

python
import math
import numpy as np

R = 8.314                      # J/(mol K)
D0, Q = 2.3e-5, 148e3          # carbon in austenite (rounded literature values), m^2/s and J/mol
T = 925 + 273.15               # K
D = D0 * math.exp(-Q / (R * T))
C0, Cs = 0.20, 1.00            # wt% carbon: the steel, and the surface held by the furnace gas
hours = 4.0
t_end = hours * 3600

# Grid: 0 to 4 mm in steps of 0.05 mm.  Explicit (FTCS) scheme, r = D dt / dx^2 <= 1/2.
dx = 0.05e-3
x = np.arange(0, 4e-3 + dx / 2, dx)
r = 0.4
dt = r * dx**2 / D
steps = math.ceil(t_end / dt)
dt = t_end / steps                                 # land exactly on t_end (r drops slightly)
r = D * dt / dx**2
C = np.full_like(x, C0)
C[0] = Cs
for _ in range(steps):
    C[1:-1] = C[1:-1] + r * (C[2:] - 2 * C[1:-1] + C[:-2])
    C[0] = Cs                                      # surface held at Cs
    C[-1] = C[-2]                                  # far end: no flux (the bar is deep)

exact = Cs - (Cs - C0) * np.array([math.erf(xi / (2 * math.sqrt(D * t_end))) for xi in x])
print(f"D = {D:.2e} m^2/s at {T - 273.15:.0f} C;  {steps} steps of {dt:.0f} s,  r = {r:.3f}")
print(f"diffusion length sqrt(D t) = {math.sqrt(D * t_end) * 1e3:.3f} mm after {hours:.0f} h\n")
print(" depth (mm)   grid (wt% C)   erf solution   difference")
for depth_mm in (0.0, 0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 2.0):
    i = round(depth_mm * 1e-3 / dx)
    print(f"{depth_mm:10.2f}   {C[i]:12.3f}   {exact[i]:12.3f}   {C[i] - exact[i]:+10.4f}")

# Case depth: where the carbon content falls to 0.40 wt%, by linear interpolation.
target = 0.40
j = np.argmax(C < target)
depth = x[j - 1] + (C[j - 1] - target) / (C[j - 1] - C[j]) * dx
print(f"\n0.40 wt% C is reached at {depth * 1e3:.2f} mm (grid)")

# The same depth from the erf solution: erf(z) = (Cs - 0.40)/(Cs - C0), solved by bisection.
lo, hi = 0.0, 3.0
for _ in range(60):
    mid = (lo + hi) / 2
    lo, hi = (mid, hi) if math.erf(mid) < (Cs - target) / (Cs - C0) else (lo, mid)
print(f"0.40 wt% C is reached at {2 * lo * math.sqrt(D * t_end) * 1e3:.2f} mm (erf, z = {lo:.4f})")
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

At 925 °C the diffusion coefficient is 8.11×10−128.11 \times 10^{-12} m² s⁻¹ and the diffusion length Dt\sqrt{Dt} after 4 hours is 0.342 mm. The 117 explicit steps agree with the error function to better than 0.001 wt% everywhere, and both put the 0.40 wt% level at 0.56 mm below the surface. At 2 mm the steel has not noticed anything has happened. The figure shows the profile after 1, 4 and 16 hours: each fourfold increase in time doubles the depth.

1.00.60.40.2000.51.01.52.02.5depth below the surface (mm)carbon (wt%)1 hour4 hours16 hours0.40 wt%: the case depth
Carbon profiles in a 0.20 wt% C steel carburised at 925 °C with its surface held at 1.00 wt% C, from the error-function solution. The marked points show where each profile crosses 0.40 wt% carbon: 0.28 mm after 1 hour, 0.56 mm after 4 hours and 1.11 mm after 16 hours. Four times the time gives twice the depth.
ComputationC

Temperature and the Arrhenius law

A jump needs the atom to pass a saddle point in energy between two sites, and the fraction of attempts with enough energy follows the Boltzmann factor, just as for the reactions in Lumenary Chemistry's chemical kinetics. So diffusion coefficients obey an Arrhenius law,

D=D0 exp⁡ ⁣(−QRT),D = D_0\,\exp\!\left(-\frac{Q}{RT}\right),

with a pre-exponential factor D0D_0 and an activation energy for diffusion QQ, both found by measuring DD at several temperatures and fitting a straight line to ln⁡D\ln D against 1/T1/T. For an interstitial, QQ is just the energy barrier for a jump. For vacancy diffusion it is the barrier plus the energy to form a vacancy, because the fraction of sites that are vacant is itself an Arrhenius factor (calculated in defects and dislocations). That is why substitutional diffusion has the larger QQ and is so much slower, and why vacancies trapped by quenching from a high temperature can speed diffusion at room temperature for a while, as in the ageing of aluminium alloys (phase transformations).

The block uses rounded literature values for carbon in austenite (D0≈2.3×10−5D_0 \approx 2.3 \times 10^{-5} m² s⁻¹, Q≈148Q \approx 148 kJ mol⁻¹) and for iron's self-diffusion in austenite (D0≈5×10−5D_0 \approx 5 \times 10^{-5} m² s⁻¹, Q≈284Q \approx 284 kJ mol⁻¹); compilations differ by tens of per cent, so design work takes them from a critical compilation such as Mehrer's (see the references). It asks how long a 1.0 mm case takes at different temperatures, how much faster carbon is than iron, and how often a carbon atom jumps.

python
import math

R = 8.314                                   # J/(mol K)
# Rounded literature values (see the references): D0 in m^2/s, Q in J/mol.
carbon_in_austenite = (2.3e-5, 148e3)
iron_in_austenite = (5.0e-5, 284e3)         # self-diffusion: needs vacancies

def D(params, T_celsius):
    D0, Q = params
    return D0 * math.exp(-Q / (R * (T_celsius + 273.15)))

def erfinv(y):
    lo, hi = 0.0, 6.0
    for _ in range(80):
        mid = (lo + hi) / 2
        lo, hi = (mid, hi) if math.erf(mid) < y else (lo, mid)
    return (lo + hi) / 2

# Carburising: steel with 0.20 wt% C, surface held at 1.00 wt% C.
# How long until 0.40 wt% C reaches 1.0 mm below the surface?
C0, Cs, C_case, depth = 0.20, 1.00, 0.40, 1.0e-3
z = erfinv((Cs - C_case) / (Cs - C0))        # depth = 2 z sqrt(D t)
print(f"z = {z:.4f}\n")
print(" T (C)    D_carbon (m^2/s)   time for a 1.0 mm case")
for T in (875, 900, 925, 950, 1000):
    Dc = D(carbon_in_austenite, T)
    t = (depth / (2 * z)) ** 2 / Dc
    print(f"{T:5d}    {Dc:16.2e}   {t / 3600:6.1f} h")

# Carbon (interstitial) against iron itself (substitutional, by vacancies), at 925 C.
Dc, Dfe = D(carbon_in_austenite, 925), D(iron_in_austenite, 925)
print(f"\nat 925 C carbon diffuses {Dc / Dfe:.1e} times faster than iron")

# How often does a carbon atom jump?  Octahedral sites in FCC iron are a/sqrt(2) apart.
a = 0.365e-9                                 # m, lattice parameter of austenite, approximately
jump = a / math.sqrt(2)
rate = 6 * Dc / jump**2                      # from D = (jump rate) * (jump length)^2 / 6
print(f"jump length {jump * 1e9:.3f} nm, jump rate {rate:.1e} per second")
print(f"jumps in one hour {rate * 3600:.1e}; rms distance sqrt(6 D t) = {math.sqrt(6 * Dc * 3600) * 1e3:.2f} mm")
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

Raising the furnace from 875 °C to 1000 °C cuts the time for a 1.0 mm case from 24.7 hours to 5.4 hours, because DD rises 4.6-fold over those 125 K. At 925 °C carbon diffuses about 3.9×1053.9 \times 10^5 times faster than the iron atoms around it, the difference between an interstitial that can always jump and a substitutional atom that must wait for a vacancy.

Worked examplesH

Worked case: carburising a gear

Carburising is done in industrial furnaces. In gas carburising, the parts sit at roughly 900 to 950 °C in an atmosphere of carbon monoxide and hydrocarbons, controlled to set a chosen carbon potential, the carbon content the steel surface would reach in equilibrium with the gas. In low-pressure (vacuum) carburising, short pulses of hydrocarbon gas supply carbon, which then diffuses inwards. Both are run by trained staff in plants built around their hazards: hot surfaces, flammable and toxic gases, and the quench that follows. None of it is a home activity.

Example— Planning a case

A gear made from a steel with 0.20 wt% carbon needs an effective case depth of 1.0 mm, taken here as the depth at which the carbon content falls to 0.40 wt%, enough for the quenched steel there to be hard. The furnace holds the surface at 1.00 wt%.

  1. From the error-function solution, the 0.40 wt% level is where erf⁡(z)=(1.00−0.40)/(1.00−0.20)=0.75\operatorname{erf}(z) = (1.00 - 0.40)/(1.00 - 0.20) = 0.75, so z=0.8134z = 0.8134 and the depth is 2zDt2z\sqrt{Dt}.
  2. For 1.0 mm, Dt=1.0/(2×0.8134)=0.615\sqrt{Dt} = 1.0/(2 \times 0.8134) = 0.615 mm, so Dt=3.78×10−7Dt = 3.78 \times 10^{-7} m².
  3. At 925 °C, D=8.11×10−12D = 8.11 \times 10^{-12} m² s⁻¹, so t=4.66×104t = 4.66 \times 10^4 s, about 12.9 hours, as in the table.

In practice the case forms faster than this constant-DD estimate, because the real DD rises with carbon content, as Gideon noted. Furnaces also often run a boost–diffuse cycle: a high carbon potential first to push carbon in fast, then a lower one so that the surface does not end up with so much carbon that brittle carbides or soft retained austenite remain after quenching. Such cycles are planned with numerical models like the one above, which also replace the fixed surface concentration with a flux set by the reactions between gas and steel, J=β(Cgas−Csurface)J = \beta(C_\text{gas} - C_\text{surface}), with a mass-transfer coefficient β\beta fitted to the furnace.

After carburising, the gear is quenched and tempered (see processing and heat treatment), giving hard martensite over a tough core. In nitriding, nitrogen diffuses into suitable alloy steels at around 500 to 580 °C and forms fine nitrides; with no quench the parts distort less, but the cases are thinner because DD is far smaller at the lower temperature.

Worked examplesH

Worked case: doping silicon

A p–n junction, the heart of every diode and transistor, is made by putting acceptor atoms such as boron into silicon that already contains donors, or the reverse (see Lumenary EE's semiconductors and diodes and semiconductor materials). Where the boron concentration exceeds the background donor concentration CBC_B the silicon is p-type; the junction depth xjx_j is where they are equal. For the first decades of the industry, dopants were put in by diffusion in two steps, and both are classic solutions of Fick's second law.

  1. Predeposition. The wafer is heated with a dopant source at its surface that holds the surface concentration at CsC_\text{s}, usually near the dopant's solid solubility. This is the same boundary condition as carburising, so C=Cserfc⁡ ⁣(x/2Dt)C = C_\text{s}\operatorname{erfc}\!\big(x/2\sqrt{Dt}\big), and integrating gives the dose that has entered, Q=2CsDt/π\mathcal Q = 2C_\text{s}\sqrt{Dt/\pi} atoms per unit area.
  2. Drive-in. The source is removed and the wafer is heated again, usually hotter and longer. No atoms enter or leave, so the dose is fixed and spreads out. When the drive-in diffusion length is much larger than the predeposition one, the profile becomes a Gaussian, C=QπDtexp⁡ ⁣(−x24Dt)C = \dfrac{\mathcal Q}{\sqrt{\pi Dt}}\exp\!\left(-\dfrac{x^2}{4Dt}\right).

The block computes both profiles for illustrative values of the right order for boron diffusing into n-type silicon: a 30-minute predeposition with D=4×10−19D = 4 \times 10^{-19} m² s⁻¹ (a cooler step) and a 2-hour drive-in with D=1.5×10−17D = 1.5 \times 10^{-17} m² s⁻¹ (near 1100 °C), into a wafer doped with 101610^{16} donors per cm³. Concentrations are printed per cm³, as the semiconductor industry quotes them.

python
import math

# Illustrative values, of the right order for boron diffusing into n-type silicon.
# Concentrations in atoms per cm^3 (the semiconductor industry's unit), lengths in metres.
Cs = 1e20            # surface held near the solubility limit during predeposition
CB = 1e16            # the wafer's background (n-type) doping
D_pre, t_pre = 4e-19, 30 * 60          # m^2/s and s: a short, cooler predeposition
D_drive, t_drive = 1.5e-17, 2 * 3600   # a longer, hotter drive-in with the source removed

L_pre = math.sqrt(D_pre * t_pre)
dose = 2 * Cs * L_pre * 100 / math.sqrt(math.pi)   # atoms per cm^2 (L in cm)
L_drive = math.sqrt(D_drive * t_drive)
C_peak = dose / (math.sqrt(math.pi) * L_drive * 100)

def predeposition(x):                  # constant surface concentration: erfc profile
    return Cs * math.erfc(x / (2 * L_pre))

def drive_in(x):                       # fixed dose, spread out: Gaussian profile
    return C_peak * math.exp(-x**2 / (4 * L_drive**2))

def junction(profile):                 # where the boron falls to the background, by bisection
    lo, hi = 0.0, 1e-4
    for _ in range(100):
        mid = (lo + hi) / 2
        lo, hi = (mid, hi) if profile(mid) > CB else (lo, mid)
    return lo

def show(c):
    return f"{c:.2e}" if c > 1e10 else "negligible"

print(f"predeposition: sqrt(Dt) = {L_pre * 1e9:.1f} nm, dose = {dose:.2e} atoms/cm^2")
print(f"drive-in:      sqrt(Dt) = {L_drive * 1e9:.0f} nm, surface now {C_peak:.2e} /cm^3\n")
print(" depth (um)   after predeposition   after drive-in   (atoms/cm^3)")
for x_um in (0.0, 0.05, 0.1, 0.2, 0.5, 1.0, 1.5, 2.0):
    x = x_um * 1e-6
    print(f"{x_um:10.2f}   {show(predeposition(x)):>19}   {show(drive_in(x)):>14}")
print(f"\njunction depth: {junction(predeposition) * 1e6:.3f} um after predeposition, "
      f"{junction(drive_in) * 1e6:.2f} um after drive-in")

# Check: the drive-in conserves the dose (integrate the Gaussian numerically, 1 nm steps).
total = sum(drive_in(i * 1e-9) for i in range(20000)) * 1e-9 * 100
print(f"dose after drive-in by numerical integration: {total:.2e} atoms/cm^2")
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

The predeposition puts in a dose of 3.0×10143.0 \times 10^{14} boron atoms per cm² in a skin only about 0.15 µm deep. The drive-in spreads the same dose (the numerical integral checks it) over a diffusion length of 329 nm, lowering the surface concentration from 102010^{20} to 5.2×10185.2 \times 10^{18} per cm³ and pushing the junction to 1.64 µm. Separating the two steps lets the engineer set the dose and the depth independently.

Modern chips no longer work this way. Since the 1970s dopants have been placed by ion implantation, which fires ions of a chosen dose and energy into the wafer, and the anneal that follows is made as short as possible, with rapid thermal, flash or laser annealing, precisely to stop diffusion. In transistors whose critical layers are a few nanometres thick, the total time at high temperature, the thermal budget, is closely guarded, and implant damage creates excess point defects that briefly make boron diffuse much faster (transient enhanced diffusion).

ExplanationH

Diffusion in research and industry

History. William Roberts-Austen made the first measurements of diffusion in solids in 1896, following gold into solid lead. For half a century most metallurgists assumed atoms in a crystal swapped places directly or in rings. In 1947 Ernest Kirkendall and Alice Smigelskas wrapped a brass block with molybdenum wires and plated it with copper; after annealing, the wires had moved inwards, because zinc diffused out of the brass faster than copper diffused in. Unequal fluxes are impossible if atoms simply swap, so the experiment, the Kirkendall effect, established the vacancy mechanism. The same unequal flow leaves pores at some interfaces, a failure mode still studied in solder joints and in hollow nanoparticles made on purpose.

Measurement. A thin layer of a tracer isotope is deposited on a polished surface, annealed and sectioned; the profile is a Gaussian, so ln⁡C\ln C against x2x^2 is a straight line of slope −1/4Dt-1/4Dt. Secondary-ion mass spectrometry measures dopant profiles in silicon to nanometres.

Computation. Density functional theory now calculates jump barriers from first principles, and kinetic Monte Carlo strings millions of jumps together (atomistic simulation). At the scale of parts, codes couple diffusion with thermodynamic databases to model carburising and the growth of phases (multiscale modelling). Fast paths matter: diffusion along grain boundaries, dislocations and surfaces has lower activation energies than through the lattice, and dominates at lower temperatures, in thin films and in nanocrystalline materials.

Where diffusion matters in 2026. Lithium moving through electrode crystals limits how fast batteries charge (battery materials); hydrogen diffusing into high-strength steels embrittles them, a concern for hydrogen pipelines; and diffusion at interfaces limits the lives of turbine coatings and of chips' copper wiring, kept out of the silicon by barrier layers a few nanometres thick.

Common misconceptionsH

Common misconceptions

Misconception

"Atoms diffuse because they are pushed down the concentration gradient." No force acts on any atom. Each jumps at random; the net flow comes from there being more atoms to jump on one side. The random-walk simulation produces Fick's law with no force anywhere in the code.

Misconception

"Diffusion distance grows in proportion to time." It grows as Dt\sqrt{Dt}. A case twice as deep needs four times as long at the same temperature, which is why deep cases are expensive and why raising the temperature is the more effective lever.

Misconception

"Diffusion always runs from high concentration to low." Strictly, atoms move down the gradient of their chemical potential, and in an ideal dilute solution that is the same as the concentration gradient. When another element changes the chemical potential, atoms can diffuse "uphill". Lawrence Darken showed this in 1949 by welding two steels with nearly the same carbon content, one of which also contained silicon; silicon raises carbon's chemical potential, and carbon moved out of the silicon-bearing steel into the other, making the higher concentration higher still.

Exercises

Exercises

Take R=8.314R = 8.314 J mol⁻¹ K⁻¹. For carbon in austenite use D0=2.3×10−5D_0 = 2.3 \times 10^{-5} m² s⁻¹ and Q=148Q = 148 kJ mol⁻¹. Python's math.erf and math.erfc are in the standard library.

1. Diffusion

Warm-upHuman

A carbon atom in iron makes jumps of 0.25 nm, each in a random direction independent of the last. How many jumps does it need, on average, for its root-mean-square distance from where it started to reach 1 µm?

2. Diffusion

Warm-upHuman

A carburising furnace produces a case 0.5 mm deep in 3 hours. At the same temperature, with the same steel and the same surface carbon content, how many hours does a case 1.5 mm deep take?

3. Diffusion

CoreHuman

At 925 °C, carbon diffuses through austenite about 4×1054 \times 10^5 times faster than iron atoms do. Which statements help explain this? Select all that apply.

Choose all that apply

4. Diffusion

CoreHuman

A carburising furnace runs at 900 °C. By how many kelvin must its temperature be raised to double the diffusion coefficient of carbon in austenite (Q=148Q = 148 kJ mol⁻¹)? Give the nearest whole number.

5. Diffusion

CoreHuman

A boron predeposition has put a fixed dose into a silicon wafer. In the drive-in that follows, at constant temperature, the time is made four times longer. Assuming the Gaussian profile applies, what happens to the surface concentration and the diffusion length Dt\sqrt{Dt}?

Choose one

6. Diffusion

CoreComputational

Write carburise(C0, Cs, D, depth, t, nx=81), which solves Fick's second law by the explicit finite-difference scheme for a bar of the given depth (m) whose surface is held at concentration Cs from time 0, starting from a uniform C0. Use nx grid points from 0 to depth, choose the time step so that r=D Δt/Δx2≤0.4r = D\,\Delta t/\Delta x^2 \le 0.4 and the steps land exactly on t, hold C[0] at Cs, and treat the far end as a no-flux boundary (C[-1] = C[-2] after every step). Return (x, C) as NumPy arrays.

The tests compare your profile with the error-function solution for the lesson's 4-hour case, and check that a long run stays stable.

Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

7. Diffusion

StretchComputational

Write carburising_time(depth, C0, Cs, C_case, D), which returns the time in seconds for the concentration C_case to reach depth metres below the surface of a semi-infinite solid that starts at C0 with its surface held at Cs, using the error-function solution. Solve erf⁡(z)=(Cs−Ccase)/(Cs−C0)\operatorname{erf}(z) = (C_\text{s} - C_\text{case})/(C_\text{s} - C_0) for zz by bisection (math.erf is available), then use depth =2zDt= 2z\sqrt{Dt}. It must work for decarburising too (Cs<C0C_\text{s} \lt C_0), and raise ValueError unless C_case lies strictly between C0 and Cs.

Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

Further reading and resources