differt.em.fresnel_coefficients

differt.em.fresnel_coefficients#

fresnel_coefficients(n_r, cos_theta_i)[source]#

Compute the Fresnel reflection and refraction coefficients at an interface.

The Snell’s law describes the relationship between the angle of incidence and refraction:

\[n_i\sin\theta_i = n_t\sin\theta_t,\]

where \(n\) is the refraction index, \(\theta\) is the angle between the ray path and the normal to the interface, and \(i\) and \(t\) indicate, respectively, the first (i.e., incidence) and the second (i.e., transmission) media.

The s and p reflection coefficients are:

\[r_s = \frac{n_i\cos\theta_i - n_t\cos\theta_t}{n_i\cos\theta_i + n_t\cos\theta_t},\]

and

\[r_p = \frac{n_t\cos\theta_i - n_i\cos\theta_t}{n_t\cos\theta_i + n_i\cos\theta_t}.\]

The s and p refraction coefficients are:

\[t_s = \frac{2n_i\cos\theta_i}{n_i\cos\theta_i + n_t\cos\theta_t},\]

and

\[t_p = \frac{2n_i\cos\theta_i}{n_t\cos\theta_i + n_i\cos\theta_t}.\]

Then, we define \(n_r \triangleq \frac{n_t}{n_i}\) and rewrite the four coefficients as:

\[\begin{split}r_s &= \frac{\cos\theta_i - n_r\cos\theta_t}{\cos\theta_i + n_r\cos\theta_t},\\ r_p &= \frac{n_r^2\cos\theta_i - n_r\cos\theta_t}{n_r^2\cos\theta_i + n_r\cos\theta_t},\\ t_s &= \frac{2\cos\theta_i}{\cos\theta_i + n_r\cos\theta_t},\\ t_p &= \frac{2n_r\cos\theta_i}{n_r^2\cos\theta_i + n_r\cos\theta_t},\end{split}\]

where \(n_t\cos\theta_t\) is obtained from:

\[n_r\cos\theta_t = \sqrt{n_r^2 + \cos^2\theta_i - 1}.\]
Parameters:
Return type:

tuple[tuple[Complex[Array, '*batch'], Complex[Array, '*batch']], tuple[Complex[Array, '*batch'], Complex[Array, '*batch']]]

Returns:

The reflection and refraction coefficients for s and p polarizations.

Examples

The following example reproduces the air-to-glass Fresnel coefficients. The Brewster angle (defined by \(r_p=0\)) is indicated by the vertical red line.

>>> from differt.em import fresnel_coefficients
>>>
>>> n = 1.5  # Air to glass
>>> theta = jnp.linspace(0, jnp.pi / 2)
>>> cos_theta = jnp.cos(theta)
>>> (r_s, r_p), (t_s, t_p) = jax.tree.map(
...     jnp.real,
...     fresnel_coefficients(n, cos_theta)
... )  # Here Fresnel coefficients are purely real numbers
>>> theta_d = jnp.rad2deg(theta)
>>> theta_b = jnp.rad2deg(jnp.arctan(n))
>>> plt.plot(theta_d, r_s, "b:", label=r"$r_s$")
>>> plt.plot(theta_d, r_p, "r:", label=r"$r_p$")
>>> plt.plot(theta_d, t_s, "b-", label=r"$t_s$")
>>> plt.plot(theta_d, t_p, "r-", label=r"$t_p$")
>>> plt.axvline(theta_b, color="r", linestyle="--")
>>> plt.xlabel("Angle of incidence (°)")
>>> plt.ylabel("Amplitude")
>>> plt.xlim(0, 90)
>>> plt.ylim(-1.0, 1.0)
>>> plt.title("Fresnel coefficients")
>>> plt.legend()
>>> plt.tight_layout()
../../_images/differt-em-fresnel_coefficients-1.png

The following example produces the same but glass-to-air interface. The critical angle (total internal reflection) is indicated by the vertical black line.

>>> from differt.em import fresnel_coefficients
>>>
>>> n = 1 / 1.5  #  Glass to air
>>> theta = jnp.linspace(0, jnp.pi / 2, 300)
>>> cos_theta = jnp.cos(theta)
>>> (r_s, r_p), (t_s, t_p) = jax.tree.map(
...     lambda x: jnp.where(jnp.imag(x) == 0, jnp.real(x), jnp.inf),
...     fresnel_coefficients(n, cos_theta)
... )  # Here Fresnel coefficients are purely real numbers before
...    # the critical angle. After the critical angle, they become complex.
>>> theta_d = jnp.rad2deg(theta)
>>> theta_b = jnp.rad2deg(jnp.arctan(n))
>>> theta_c = jnp.rad2deg(jnp.arcsin(n))
>>> plt.plot(theta_d, r_s, "b:", label=r"$r_s$")
>>> plt.plot(theta_d, r_p, "r:", label=r"$r_p$")
>>> plt.plot(theta_d, t_s, "b-", label=r"$t_s$")
>>> plt.plot(theta_d, t_p, "r-", label=r"$t_p$")
>>> plt.axvline(theta_b, color="r", linestyle="--")
>>> plt.axvline(theta_c, color="k", linestyle="--")
>>> plt.xlabel("Angle of incidence (°)")
>>> plt.ylabel("Amplitude")
>>> plt.xlim(0, 90)
>>> plt.ylim(-0.5, 3.0)
>>> plt.title("Fresnel coefficients")
>>> plt.legend()
>>> plt.tight_layout()
../../_images/differt-em-fresnel_coefficients-2.png