Electromagnetic Fields Simulator: Electric, Magnetic and Light Waves

A free electromagnetism simulator: place charges and see field lines, equipotentials and Gauss's law, add current-carrying wires and check Ampere's law, steer a charged particle through electric and magnetic fields, watch Maxwell's equations make waves reflect, refract and diffract, and explore a 3D electromagnetic plane wave.

Place charges and see the electric field they make: field lines leave positive charges and end on negative ones, equipotentials are the lines of equal voltage. Drag a charge to move it. Hover anywhere to read the field and the voltage. Draw a Gauss sphere to check Gauss's law by adding up the field on its surface.

Pointer–position in metres
Electric field there–
Voltage there–
Gauss's law–
New charge: Size of the next charge you add (microcoulombs).
Picture width:
Field lines per charge:
Colour the plane by
Kind of charge
Test charge: 1 nC, 1 g. Click with the test-charge tool to drop one at rest and watch it move.

Electricity, magnetism and light in one place

Four equations describe all of classical electromagnetism. Gauss's law says electric field lines start on positive charge and end on negative charge. Gauss's law for magnetism says magnetic field lines never start or end: they close in loops. Faraday's law says a changing magnetic field makes an electric field, and Ampère–Maxwell says currents and changing electric fields make a magnetic field. Together they predict waves that travel at 299,792,458 m/s: light.

Gauss \(\displaystyle \oint \mathbf E\cdot d\mathbf A = \dfrac{Q_\text{enc}}{\varepsilon_0}\)
no monopoles \(\displaystyle \oint \mathbf B\cdot d\mathbf A = 0\)
Faraday \(\displaystyle \nabla\times\mathbf E = -\dfrac{\partial \mathbf B}{\partial t}\)
Ampère–Maxwell \(\displaystyle \nabla\times\mathbf B = \mu_0\mathbf J + \mu_0\varepsilon_0\dfrac{\partial \mathbf E}{\partial t}\)
Lorentz force \(\displaystyle \mathbf F = q\,(\mathbf E + \mathbf v\times\mathbf B)\)
speed of light \(\displaystyle c = \dfrac{1}{\sqrt{\mu_0\varepsilon_0}}\)

What each tab shows

  • Electric charges. Coulomb's law adds up the field of every charge. The field lines are drawn by following the field direction from the positive charges; the closer together they are, the stronger the field. Equipotentials cross field lines at right angles. The Gauss surface adds up E·A over a sphere around the charges with numerical integration and compares it with Q/ε₀: they agree whatever the shape of the charge cloud inside, and charges outside add nothing. Switch to “long line charges” to see the 2D version, where the field falls as 1/r and the surface is a circle.
  • Currents. Each straight wire makes a field μ₀I/(2πr) circling round it. The field lines are drawn as contours of the vector potential, which is exactly what field lines are. Ampère's law says the loop integral of B equals μ₀ times the current inside; the loop shows it. Try the solenoid (the field inside is uniform, outside it nearly cancels) and the coaxial cable (no field outside at all). The force between two wires is how the ampere is defined: 1 A in each, 1 m apart, makes 2×10⁻⁷ N per metre.
  • Charged particle. The Lorentz force makes a charge in a magnetic field go in a circle of radius r = mv/(qB) with a period 2πm/(qB) that does not depend on its speed: that is how a cyclotron works. Add an electric field across it and the circles drift sideways at E/B whatever the charge or mass. Where v = E/B the forces cancel: a velocity selector. Different masses make different circles: a mass spectrometer. At high speed the relativistic mass makes the circles bigger (switch Mechanics between Newtonian and relativistic to compare).
  • Waves. A two-dimensional finite-difference time-domain (FDTD, Yee) solution of Maxwell's equations with the electric field out of the screen. Glass slows the wave to c/n and bends it (Snell's law); a metal surface forces the field to zero so the wave reflects with a sign flip; a lossy absorber turns the wave into heat; the box with metal walls is a resonant cavity that only rings at certain frequencies; two slits make an interference pattern.
  • Plane wave. The textbook picture of an electromagnetic wave in three dimensions, for any wavelength from radio waves to gamma rays, with linear, circular and elliptical polarisation. The numbers (frequency, field strength, intensity, photon energy) are exact for the settings.

Accuracy and limits

The electrostatic and magnetostatic fields are exact formulas (checked against Gauss's law, Ampère's law and E = −∇V in the tests). Particle paths use the Boris integrator, which conserves the energy of a particle in a magnetic field to rounding error, with a relativistic option. The wave solver is second-order accurate: waves with fewer than about 10 cells per wavelength travel a few per cent too slowly, and the absorbing edges reflect about 1% (see the tests). It is a 2D, single-polarisation model, so it does not show magnetic-field direction or 3D effects such as Brewster's angle. Everything runs on your device and nothing is uploaded.

Light in a Medium · Michelson–Morley · Photoelectric Effect · More MES tools

Comments
Advertisement