EM wave passage through planar interface

Animation of planar harmonic progressive EM wave passage through planar interface. Application of Snell's law, visualization of evanescent wave when exceeding critical angle.

Normal incidence $\vartheta_1 = 0$:

Refractive indices are $n_1 = 1$, $n_2 = 2$. Wavelength and phase velocity of waves are in inverse proportion to the refractive index.

Refraction toward normal – on optically denser medium, $\vartheta_1 = 30^{\circ}$:

Refractive indices are $n_1 = 1$, $n_2 = 2$.

Refraction away from normal – on optically less dense medium, $\vartheta_1 = 30^{\circ} < \vartheta_C$:

Refractive indices are $n_1 = 1.5$, $n_2 = 1$.

Total reflection on optically less dense medium, $\vartheta_1 = 45^{\circ} > \vartheta_C$:

Refractive indices are $n_1 = 1.5$, $n_2 = 1$. In the second medium we see an evanescent wave exponentially decreasing away from the interface and propagating along the interface.

Variable angle of incidence $\vartheta_1 \in \langle 0, 90^{\circ}\rangle$ when incident on optically denser medium:

Field state is shown for constant time value. Refractive indices are $n_1 = 1$, $n_2 = 2$. For refraction toward normal, any value of angle of incidence is permissible.

Variable angle of incidence $\vartheta_1 \in \langle 0, 90^{\circ}\rangle$ when incident on optically less dense medium:

Field state is shown for constant time value. Refractive indices are $n_1 = 1.5$, $n_2 = 1$. For refraction away from normal, the wave passes into the second medium only if $\vartheta_1 < \vartheta_C$. For supercritical angle of incidence, the wave does not pass and in the second medium we observe an evanescent wave. The wave is damped away from the interface more rapidly the larger the angle of incidence.

Source code

Source code that generated the gifs displayed above: nb