Bruno Glecer

Real-time EM Simulator (Interactive!)

What's being solved?

The simulation is iteravely solving in real time for \( \mathbf{E} \) and \( \mathbf{B} \) taking into account the values of \( \rho \) and \( \mathbf{J} \) determined by the position and velocity of the blue charge controlled by the mouse pointer:

\[ \nabla \cdot \mathbf{\color{red}{E}} = \frac{\color{cyan}{\rho}}{\varepsilon} \] \[ \nabla \cdot \mathbf{\color{green}{B}} = 0 \] \[ \nabla \times \mathbf{\color{red}{E}} = -\frac{\partial \mathbf{\color{green}{B}}}{\partial t} \] \[ \nabla \times \mathbf{\color{green}{B}} = \mu_0 \mathbf{\color{cyan}{J}} + \mu_0 \varepsilon \frac{\partial \mathbf{\color{red}{E}}}{\partial t} \]

The value of \( \mu_0 \) is fixed and the value of \( \varepsilon \) is dependent on the dielectric configuration.

What is ACTUALLY being solved?

In this simulation, only a finite number of points of the fields are being simulated. Only \( E_x \), \( E_y \) and \( H_z \) are taken into account, and are discretized in the following way:

Yee lattice grid

This allows the curl \( \left(\nabla \times \right) \) calculations to be most accurate where they are needed. This is called a Yee latice and the method is called Finite-difference time-domain method (FDTD).

A complete tutorial on the method can be referenced in the excelent open licensed book by John B. Schneider Understanding the Finite-Difference Time-Domain Method

How does it work?

To be able to update the grid several times per second, some access to parallel computing is needed, especially if the only tool available is Javascript. To overcome this I used the GPU.JS library.

Wait, why can I make the particle move faster than the speed of light?

Technically, yes, it's travelling faster than the speed of light *in the arbitrary medium it's being simulated*. The simulation is being carried out with normalized values for \( \mu \) and \( \varepsilon \), one may consider the actual values of these parameters very large, giving a very small value for \( v = 1/\sqrt{\varepsilon \mu} \)