Lorentz Force Simulator
1. Real‑world phenomenon
Charged particles rarely travel in straight lines. Inside cathode‑ray tubes, electrons arc toward phosphor screens; in space, solar wind ions spiral along Earth’s magnetic field; in mass spectrometers, molecular fragments curve under carefully tuned fields. These trajectories are all governed by the Lorentz force, the vector sum of electric and magnetic influences acting on moving charge. Traditional calculators output a single force magnitude, yet they fail to convey the resulting motion. The simulator above retains the original goal of computing Lorentz force but augments it with an animated particle whose path is updated in real time. As you tweak charge, mass, field strengths, or time step, the dot on the canvas swirls according to the same physics that steer beams in particle accelerators. Energy bars reveal how electric fields do work while magnetic fields redirect without changing speed. A downloadable CSV captures every time step for further analysis, transforming a static equation into a tangible experiment.
2. Variables and assumptions
The model considers a point particle of charge q and mass m moving in the (x, y) plane. Uniform electric fields Ex and Ey lie in the same plane, while a constant magnetic field Bz points perpendicular to it. Initial velocity components vx0 and vy0 set the starting direction. We assume the fields are uniform over the particle’s path, ignore radiation losses, and restrict speeds well below the speed of light so relativistic effects remain negligible. Potential energy is referenced to x = y = 0; with uniform fields this origin choice merely sets a constant offset. All quantities use SI units: coulombs, kilograms, volts per meter, teslas, meters, and seconds. Input validation rejects non-finite or nonsensical values such as negative mass. The time step Δt is clamped to the range 0.0001–0.05 s to maintain numerical stability and reasonable performance.
3. Governing equations
The Lorentz force in vector form is
Formula: F → = q E → + v → × B →
For our two-dimensional motion with Bz only, the force components reduce to dvx/dt = (q/m) (Ex + vy Bz) and dvy/dt = (q/m) (Ey - vx Bz).
Position evolves via dx/dt = vx and dy/dt = vy. Kinetic energy is KE = 1/2 m (vx^2 + vy^2). Electric potential energy in uniform fields is PE = -q(Ex x + Ey y). Magnetic forces do no work, so total energy TE = KE + PE should remain constant; deviations ΔE = TE - TE0 signal numerical error.
4. Numerical scheme
The coupled first‑order system is integrated using the classical fourth‑order Runge–Kutta (RK4) method. For each step of size , four derivative estimates sample the acceleration at the current state, two half steps, and a trial endpoint. The weighted average advances both position and velocity. RK4’s global error scales with , so halving the step shrinks drift by roughly a factor of sixteen. The algorithm is explicit and thus stable provided is short compared with the fastest gyration period . The simulation reports the energy deviation each frame, giving a direct measure of integration accuracy and serving as an educational tool for numerical analysis.
5. Worked example
Consider a singly charged dust grain with charge q = 1×10^-6 C and mass m = 1×10^-3 kg injected into a region with Ex = 0, Ey = 0, and Bz = 0.1 T. The particle enters with vx = 10 m/s and vy = 0. With no electric field, the motion should be a circle of radius r = m v / (|q| B) = 0.1 m and period 2πm / (|q|B) = 0.0628 s. Enter these values and press Play: the dot loops smoothly, energy bars remain constant, and the CSV shows periodic position data. If we introduce an electric field Ey = 50 V/m, the path becomes a cycloid drifting in +y, illustrating the E × B drift exploited in plasma devices. Energy stays constant because the electric field does work while the magnetic field merely redirects.
6. Comparison table
The table summarizes how changing field strengths alters motion, based on simulation output after one gyration.
| Scenario | E_y (V/m) | B_z (T) | Radius (m) | Drift Speed (m/s) |
|---|---|---|---|---|
| Baseline | 0 | 0.10 | 0.10 | 0.00 |
| Electric field | 50 | 0.10 | 0.10 | 500 |
| Stronger B | 50 | 0.20 | 0.05 | 250 |
A doubled magnetic field halves the gyroradius and, combined with the same electric field, halves the drift speed, reinforcing the inverse relationship between and both quantities.
7. How to read the animation
The canvas displays a top‑down view with the origin centered. A blue trail traces the particle’s past path, while an orange disk marks its current position. Because the canvas is square and auto‑scales to the largest excursion, circular or helical orbits remain centered regardless of parameters. The striped orange bar indicates kinetic energy; the striped blue bar shows the magnitude of electric potential energy. Their combined length corresponds to the initial total energy, so any shrinkage or growth signals numerical drift. The caption beneath the canvas narrates time, position, speed, and energy deviation for screen‑reader users, and an identical text summary is mirrored in the hidden fallback div. Keyboard users can tab to the canvas and press the space bar to toggle play and pause. Tooltips on inputs remind you of SI units, ensuring the simulation remains grounded in real measurements.
8. Limitations
The simulator assumes uniform, time‑independent fields and neglects radiation reaction, space charge effects, collisions, and relativistic corrections. At speeds approaching light, mass increases with the Lorentz factor and the equations of motion change. Extremely strong electric fields may accelerate the particle beyond non‑relativistic limits within a few steps, invalidating the model. The visualization is confined to two dimensions; a true three‑dimensional treatment would show helices when the velocity has a component parallel to the magnetic field. Numerical integration, while robust, still accumulates error for large or extreme field values, so the energy drift readout should always be monitored. Finally, the potential energy definition assumes the electric field remains constant over the simulation range, which may not hold in laboratory devices with electrodes.
9. Suggested extensions
Future versions could include three‑dimensional motion, relativistic momentum, or spatially varying fields computed from analytic expressions. Incorporating collisions with background gas would model plasma diffusion, while an adaptive time step could maintain accuracy during periods of strong acceleration. Phase‑space plots of velocity versus position would reveal conserved quantities and resonance structures. Another extension would let users superimpose multiple particles to visualize beams and collective effects.
10. References and related tools
For background reading on electromagnetic motion, consult J. D. Jackson’s Classical Electrodynamics or D. J. Griffiths’ Introduction to Electrodynamics. The equations for charged particle drifts are summarized in many plasma physics texts, including F. F. Chen’s Introduction to Plasma Physics and Controlled Fusion. Explore related calculators on this site: estimate relativistic effects with the Lorentz Factor Calculator, compute cyclotron periods using the Cyclotron Frequency Calculator, or visualize static fields with the Point Charge Electric Field Simulator.
Field Line Flyer Mini-Game
Time electric pulses so the particle hugs the glowing ring. Feel how F = q(E + v × B) sets orbit radius while gusty magnetic drift and flux pickups keep every run fresh.
- [ ] Units: inputs in SI (C, kg, V/m, T, m/s, s)
- [ ] Energy conservation: ΔE ≈ 0 when E fields present
- [ ] Edge cases: rejects nonfinite or negative mass; Δt clamped 0.0001–0.05 s
- [ ] Performance: animation remains smooth for Δt extremes
