Spotlight #71: Physics, Chemistry & Engineering Simulations

Six recently enriched simulations — from X-ray powder diffraction and plasma shielding to oscillating chemical reactions and thermal engines — that make textbook equations genuinely interactive.

Every simulation on this platform starts with a concrete question: what does this equation actually look like when you run it? The recently enriched simulations highlighted in this spotlight all share that quality. They cover physical phenomena that appear in undergraduate and postgraduate curricula across physics, chemistry and engineering, but that are rarely demonstrated interactively — usually because the computational cost was historically prohibitive in a browser context. WebGL and optimised numerical methods have changed that. Each of the six simulations described here runs at interactive speed on any modern device, no plugins required.

I. Bragg Diffraction

X-ray crystallography is the technique that revealed the structure of DNA, the shapes of protein active sites, and the arrangement of atoms in every material whose properties we understand at depth. The technique rests on a formula so elegant that it was derived by William Lawrence Bragg at the age of 22:

nλ = 2d sinθ

where:
  n      : reflection order (positive integer)
  λ      : X-ray wavelength
  d      : spacing between crystal planes (d-spacing)
  θ      : glancing angle of incidence

For FCC:  reflections allowed when h, k, l all odd or all even
For BCC:  reflections allowed when h + k + l is even
Simple cubic: all hkl allowed

The simulation computes the powder diffraction pattern for FCC, BCC and simple cubic crystal structures by summing contributions from all allowed Bragg reflections up to a user-defined maximum 2θ. Peak intensities incorporate the structure factor, the Lorentz-polarisation factor, and Gaussian broadening to model finite crystallite size (the Scherrer equation: β = Kλ / L cosθ). The result is displayed as a stick diagram overlaid on a Debye-Scherrer ring simulation.

The most instructive feature is the crystal-structure switcher. Toggle from FCC to BCC and the systematic absences change immediately: FCC suppresses reflections with mixed-parity Miller indices (so the (1,0,0) and (1,1,0) reflections vanish), while BCC suppresses reflections with odd h+k+l. This makes the connection between unit cell geometry and diffraction pattern directly perceivable rather than purely algebraic. Sliders control wavelength λ and the lattice parameter a, letting users reproduce published diffraction patterns for real materials by matching peak positions.

Bragg Diffraction — FCC/BCC Powder Pattern

Switch crystal structures, adjust wavelength and lattice parameter, and watch systematic absences appear and disappear in real time. Ideal for crystallography courses and materials science labs.

II. Debye Length

In a plasma, free charges rearrange themselves to screen any electrostatic disturbance over a characteristic distance called the Debye length. The formula is:

λD = √(ε0 kB T / n q²)

Screened potential around a test charge:
  φ(r) = (q / 4πε0 r) exp(−r / λD)

This is the Yukawa potential: Coulomb law multiplied by an
exponential decay on the scale of λD.

The simulation places a test charge at the centre of a 2D plasma grid and renders the resulting electrostatic potential as a false-colour heatmap, with the colour scale spanning from the strong central field through the shielded peripheral region. Sliders control the electron temperature T and number density n. As you drag them, the heatmap redraws in real time, showing how λD scales as √(T/n): raising temperature increases the Debye length (hotter electrons can escape further from the shielding region), while raising density decreases it (more electrons are available to screen the perturbation at shorter range).

A companion radial plot on a logarithmic scale confirms the exponential decay and shows the transition from the unscreened 1/r Coulomb law at short range to the exponentially suppressed Yukawa tail at large r. This dual display — heatmap and radial profile simultaneously — is the feature most requested by plasma physics educators who use the simulation.

Debye Length — Plasma Shielding Heatmap

Adjust electron temperature and density with sliders and watch the shielding radius contract and expand around a test charge. The companion log-scale radial plot confirms the Yukawa exponential.

III. Carnot Cycle

The Carnot cycle is the theoretical upper bound on heat engine efficiency. No engine operating between a hot reservoir at temperature TH and a cold reservoir at TC can exceed the Carnot efficiency:

ηCarnot = 1 − TC / TH

The four steps of the cycle on a P-V diagram:
  1. Isothermal expansion at TH:  QH absorbed, work done by gas
  2. Adiabatic expansion:           Q = 0, temperature drops to TC
  3. Isothermal compression at TC: QC rejected, work done on gas
  4. Adiabatic compression:         Q = 0, temperature rises to TH

Net work = area enclosed by the cycle on the P-V diagram
Efficiency η = W_net / QH

The simulation animates the working gas through all four stages on a live P-V diagram, with the state point tracing the closed cycle as the animation runs. Sliders control TH and TC, and a companion T-S diagram displays the cycle in entropy space (where the Carnot cycle is a rectangle, making the geometric interpretation of efficiency immediately clear). A running tally shows the current values of QH, QC, Wnet and η, updating with each cycle. The entropy panel is the feature that makes this simulation genuinely more useful than a static textbook diagram: students can see why reversibility is thermodynamically special.

🔥

Carnot Cycle — P-V and T-S Diagrams

Animate the four stages of the ideal heat engine, watch work and heat values update in real time, and compare efficiency against the theoretical Carnot limit as you adjust reservoir temperatures.

IV. Belousov-Zhabotinsky Reaction

The Belousov-Zhabotinsky (BZ) reaction is a family of oscillating chemical reactions that spontaneously generate spatial patterns: concentric rings, rotating spirals and travelling waves in what appears to be a well-mixed solution. The mechanism involves a redox reaction that oscillates between oxidising and reducing states, coupled to autocatalytic feedback. The Oregonator model reduces the mechanism to three species:

Oregonator ODEs (simplified):
  ∂u/∂t = Du∇²u + (1/ε)(u − u² − f v (u − q)/(u + q))
  ∂v/∂t = Dv∇²v + u − v

where:
  u : concentration of HBrO2 (autocatalyst)
  v : concentration of Ce(IV) (oxidised catalyst)
  ε : ratio of timescales (~0.04)
  f : stoichiometric parameter (~1.4)
  q : ratio of rate constants (~0.002)

The simulation integrates the Oregonator equations on a 2D grid using an explicit finite-difference scheme. Starting from random initial conditions, the system spontaneously develops spiral wave patterns after a brief transient — exactly as observed in a BZ reaction in a Petri dish. The colour field maps HBrO2 concentration to the classic blue-red oscillation of the cerium-catalysed BZ reaction.

The most striking feature is the interaction of spiral waves. Two counter-rotating spirals that approach each other annihilate, while a spiral that collides with a boundary reflects. These collision rules are purely emergent from the local reaction-diffusion dynamics, with no explicit rule specifying what happens at boundaries or when waves meet. This emergence of global order from purely local interactions is the property that makes the BZ reaction a canonical example of self-organisation in far-from-equilibrium chemistry.

🌀

Belousov-Zhabotinsky — Oregonator Reaction-Diffusion

Watch spiral waves and concentric rings emerge spontaneously from random initial conditions. Adjust the stoichiometric parameter f to switch between spiral and target-pattern regimes.

V. Bernoulli's Principle

Bernoulli's equation is one of the most used and most misunderstood equations in introductory physics. It is not a law of aerodynamics in isolation; it is a conservation statement for inviscid, incompressible, steady flow along a streamline:

P + ½ρv² + ρgh = constant along a streamline

For horizontal flow (h = const):
  P1 + ½ρv1² = P2 + ½ρv2²

Continuity equation (incompressible):
  A1 v1 = A2 v2

So a narrower cross-section means higher velocity means lower pressure.

The simulation models flow through a channel whose cross-sectional profile can be drawn by the user. The velocity field is solved using a stream-function approach on a 2D grid, with streamlines rendered as animated tracer paths. The pressure field is computed from the velocity via Bernoulli's equation and displayed as a colour overlay, so students can immediately see the pressure drop in the constricted region. A Venturi meter mode adds pressure-tap indicators at two points and displays the differential pressure and inferred flow rate, exactly as a physical Venturi meter would operate.

The simulation also demonstrates Bernoulli's limitations: drag the Reynolds-number slider high enough and the flow separates from the channel walls, creating recirculation zones where the Bernoulli equation breaks down. This honest treatment of the equation's assumptions — steady, inviscid, incompressible — makes the simulation more useful for teaching critical thinking than a version that simply validates the formula.

💨

Bernoulli's Principle — Flow Visualiser

Draw a channel cross-section, watch streamlines and pressure fields update in real time, and observe where the Bernoulli approximation breaks down at high Reynolds number.

VI. Brownian Motion

Brownian motion was one of Einstein's four 1905 papers, and it provided the first quantitative evidence for the atomic hypothesis. A pollen grain observed under a microscope traces an erratic, seemingly random path because it is being kicked by individual water molecules. Einstein showed that the mean-squared displacement grows linearly with time:

⟨r²(t)⟩ = 2dDt

where:
  d : spatial dimension (2 for 2D motion)
  D : diffusion coefficient = kBT / (6πηR)
  η : fluid viscosity
  R : particle radius
  kB : Boltzmann constant
  T : temperature

Path is a Wiener process: increments Δr ~ N(0, 2DΔt)

The simulation renders multiple Brownian particles simultaneously, tracing their paths as fading trails on a 2D canvas. A live plot of mean-squared displacement versus time grows linearly, confirming the Einstein relation. The diffusion coefficient is extracted by fitting a slope to the MSD curve and compared to the theoretical Stokes-Einstein value for the chosen particle size and temperature. Sliders control temperature, viscosity and particle radius, and the diffusion coefficient updates continuously, making the 1/R and T dependencies directly observable.

An optional single-particle mode zooms in on one trajectory and displays the displacement distribution at user-selected time intervals, confirming that displacements are Gaussian with variance growing linearly — the defining statistical signature of a Wiener process and the mathematical foundation of all modern stochastic calculus.

🟡

Brownian Motion — Einstein Diffusion, MSD Plot

Watch particles trace random paths, observe mean-squared displacement growing linearly with time, and verify the Stokes-Einstein diffusion coefficient from the fitted slope.

Common Threads

Looking across these six simulations, a few design principles recur that are worth making explicit. First, every simulation displays at least two representations simultaneously: a spatial visualisation and a quantitative plot. This dual-representation approach means users can move between intuition (the pattern) and measurement (the curve) without switching between different tools or pages.

Second, every simulation has at least one slider or interactive parameter that changes the phenomenon qualitatively, not just quantitatively. Switching between FCC and BCC in the Bragg simulation does not just move peaks; it changes which peaks exist. Raising temperature in the Brownian simulation does not just make particles move faster; it changes the diffusion coefficient in a specific, measurable way. These qualitative transitions are where the deepest learning happens.

All six simulations are available in English (/), Ukrainian (/uk/) and Polish (/pl/). The full physics category and chemistry category list the complete collections in each domain.

← Devlog #102: Milestone 1000 Spotlight #72: Algorithms & Maths →