› Mass Diffusion Simulator Back
Diffusion Simulator

Mass Diffusion & Fick's Law Simulator

Compare semi-infinite and finite-slab profiles. Draw an initial profile, save comparison curves, and share reproducible input conditions.

What this calculator shows

Compare concentration changes for a constant diffusivity D. The surface is fixed at C/Cs=1; choose a semi-infinite solid or a finite slab with no flux at the back face. Outputs are concentration ratios and normalized flux, not a material safety assessment.

Two reproducible worked examples
Parameters
Illustrative diffusivities, not certified material data
Diffusion coefficient D [m²/s]
10⁻¹⁴ ~ 10⁻⁸ m²/s(Log Scale)
Observation length / slab thickness L [mm]
mm
Boundary model (surface C/Cs=1)
Initial concentration ratio C0/Cs
Number of displayed times
Maximum time t_max [h]
h
Initial concentration profile
Click on the chart to set initial concentration distribution points. A concentration point is added at the clicked position with linear interpolation.
Playback Controls
0.00 s
Concentration Distribution Snapshot

Results
—
Diffusion length sqrt(Dt) [um]
—
10% concentration-increment depth [μm]
—
Average concentration Cbar/Cs
—
Normalized surface flux J₀/Cs [m/s]
—
Time to 50% mean concentration increase [h]
Diff
CAE Applications

For comparison with analysis software, match units, the location of x=0, initial profile, observation interval, fixed surface concentration and zero back-face flux. Numerical agreement is not material safety certification.

Theory & Key Formulas

Diffusion equation for constant D

$$\frac{\partial c}{\partial t}=D\frac{\partial^2 c}{\partial x^2}$$

Semi-infinite solution for uniform q=C₀/Cs (t>0)

$$c(\xi,t)=q+(1-q)\,\mathrm{erfc}\!\left(\frac{\xi}{2\sqrt{Fo}}\right)$$

Finite slab: λₙ=(n+1/2)π and Fo=Dt/L² (t>0)

$$c(\xi,t)=q+(1-q)\left[1-\sum_{n=0}^{\infty}\frac{2\sin(\lambda_n\xi)}{\lambda_n}e^{-\lambda_n^2Fo}\right]$$

Finite-slab mean concentration

$$\bar c=q+(1-q)\left[1-\sum_{n=0}^{\infty}\frac{2}{\lambda_n^2}e^{-\lambda_n^2Fo}\right]$$

Normalized surface flux for a uniform initial profile

$$\left.\frac{J_0}{C_s}\right|_{\rm semi}=(1-q)\sqrt{\frac{D}{\pi t}},\qquad \left.\frac{J_0}{C_s}\right|_{\rm finite}=\frac{2D(1-q)}{L}\sum_{n=0}^{\infty}e^{-\lambda_n^2Fo}$$

These closed forms apply to uniform initial concentration. A drawn profile is evolved using Gaussian kernels / eigenfunctions for the same boundaries; the curve, mean and flux use that same initial profile. Animation frames are not numerical time steps controlling solution stability.

What can Fick's law help you compare?

🙋
Student: How much does changing diffusivity affect a 10-hour result?
🎓
Professor: Example A uses D=10⁻¹¹ m²/s and gives a diffusion length of 600 μm at 10 hours. Multiplying D by four doubles this length at the same time. Apply the example, save its curve, then change D to compare the original and new conditions.
🙋
Student: Why is the 50% time 160.60 hours when the graph only shows 10 hours?
🎓
Professor: The maximum displayed time only sets the graph's time window. The 50% result separately finds the first time the mean over 0–L reaches the midpoint between its initial mean and the fixed surface value. It is not the time a central point reaches 50%.
🙋
Student: Does material bounce back from the far face of a finite slab?
🎓
Professor: This is diffusion, not a reflected wave. This slab has zero outward flux at x=L. For a symmetric slab treated identically on both faces, a half-domain can represent the symmetry plane: use half the full thickness as L.

Coordinates, initial conditions and boundaries

The horizontal axis is ξ=x/L and the vertical axis is c=C/Cs. The fixed-concentration surface is x=0; positive surface flux points into the solid. D is constant in space and time. Advection and reactions are not included.

The semi-infinite domain continues over x≥0, but the plot and reported mean cover only 0–L. Here L is an observation length, not a physical back face. The finite slab covers 0≤x≤L, with c(0,t)=1 and ∂c/∂x(L,t)=0. A different fixed back-face concentration or a prescribed constant-flux boundary is not an available option.

How to interpret the outputs

Diffusion length √(Dt)
A characteristic length, not a particular concentration threshold or hardened case depth.
10% concentration-increment depth
The first end of the surface-connected region satisfying c(x,t)−cinitial(x)≥0.1[1−cinitial(x)]. Disconnected interior regions of a drawn profile are not counted. ≥L means that the condition holds to the observation limit, not that a deeper position has been measured.
Mean concentration C̄/Cs
The spatial mean over 0–L. Even in semi-infinite mode it is not the mean of the entire infinite domain.
Normalized flux J₀/Cs [m/s]
Only concentration ratios are entered, so this is not absolute flux. If Cs is separately specified in mol/m³, multiplying by Cs gives mol/(m²·s). A mass concentration instead gives the corresponding mass-flux units.
Time to 50% mean concentration increase
The first time the mean reaches (1+c̄₀)/2, halfway from its initial mean to 1. A drawn semi-infinite profile can redistribute material out of the observation region, so its mean need not be monotone; a later crossing is not substituted for the first.

Drawn profiles, zero time and numerical limits

Click the graph at least twice to replace the uniform initial concentration with a piecewise-linear profile. The first and last point values extend constantly to the interval endpoints; in semi-infinite mode the last value also extends beyond x=L. Moving the initial-concentration slider or clearing the profile restores uniform concentration. A shared URL restores the points and boundary model. Saved comparison curves exist only in this tab and are not included in that URL.

At zero time the initial profile is shown. If its surface value differs from 1, imposing the fixed surface concentration creates a singular ideal t=0+ flux, displayed as 'Singular (t=0+)'. A profile already matching 1 at the surface instead has flux determined by its surface gradient. The depth at zero time is reported as zero by convention.

An initial profile equal to 1 everywhere does not change: its 50% time is zero, and its positive-time depth is capped at ≥L. Near saturation, threshold contacts or searches not resolved at the configured precision / evaluation budget are reported as 'Numerically unresolved'. A small fabricated value or a later root is not reported as certain. Checked examples do not certify errors for every possible drawn profile.

Frequently asked questions

Use published or measured data matching the diffusing species, host material, phase, temperature and concentration range. Presets are numerical illustrations, not certified material values. Temperature dependence is often written D=D₀ exp(−Q/RT), but this page does not calculate D from temperature, D₀ and Q.
No. The surface is fixed at c=1. Choose a semi-infinite domain or a finite slab with zero back-face flux. Do not directly reuse these results for a problem requiring different boundary conditions.
This tool evaluates analytical solutions and profile integrals / series at each requested time. It is not a time-marching finite-difference solver and has no automatic time-step adjustment. A smaller L reduces L²/D; reduce the displayed time window to inspect the faster initial changes.
Not directly. It uses this page's 10% increment relative to each location's initial concentration. Actual hardened depth or acceptance criteria require separate material, heat-treatment, microstructure and hardness information.
The output is J₀/Cs, so its unit is m/s. Only when an absolute Cs is separately specified in mol/m³ can the displayed value be multiplied by Cs to obtain mol/(m²·s).
Neither. It is the first time the mean over 0–L reaches half the increase from its initial mean towards surface value 1. Changing the maximum displayed time does not change this result for unchanged physical conditions.
Two or more points activate a piecewise-linear initial profile, used for the concentration curves, mean, flux and metrics. A shared URL restores these points and input conditions. Saved comparison curves are tab-only and are not included in shared URLs.
A mismatched initial and fixed surface concentration has an ideal t=0+ flux singularity, which is shown explicitly. 'Numerically unresolved' means that the threshold search could not be settled at its configured precision or limits; it is not a definite depth or time. Review the conditions and profile, and compare with another analysis when needed.
No. It compares diffusion profiles and does not model stress, microstructure, trapping, damage or fracture criteria. Do not infer safety or service life from its concentration ratio, depth or 50% time alone.

From inputs to a useful comparison

  1. Choose the boundary model and a D suitable for your conditions, in m²/s. The numerical D field contains log₁₀(D).
  2. L is the observation length in semi-infinite mode, or the surface-to-back-face length for a finite slab. Enter uniform C₀/Cs or add at least two points on the graph.
  3. Set the maximum time and number of displayed times. Overview cards use the maximum time; playback and single-frame views use the displayed frame time.
  4. Save a curve before changing conditions to compare them. Sharing restores inputs and a drawn profile; comparison curves remain in this tab only.

Two reproducible worked examples

These are verification inputs, not material design values. Each button sets a uniform initial profile and the specified conditions. Existing comparison curves are retained.

Example A: semi-infinite observation

D=10⁻¹¹ m²/s, L=5 mm, C₀/Cs=0, t=10 h. Diffusion length: 600.0 μm; 10% increment depth: 1395.7 μm; mean: 0.135; J₀/Cs≈9.40×10⁻⁹ m/s; 50% time: 160.60 h. A 50% time beyond the displayed window is calculated separately.

Example B: finite slab with an insulated back face

D=10⁻¹¹ m²/s, L=1 mm, C₀/Cs=0.2, t=10 h. Diffusion length: 600.0 μm; 10% increment depth: ≥1000.0 μm; mean: 0.733; J₀/Cs≈6.59×10⁻⁹ m/s; 50% time: 5.46 h. The target mean is 0.6, not a centre-point concentration of 0.5.

These values were checked by independently evaluating the uniform semi-infinite erfc solution and the finite-slab mixed-boundary sine series. Display rounding is included.

Scope and practical limitations