python光學仿真之菲涅耳公式

從物理學的機制出發,波動模型相對於光線模型,顯然更加接近光的本質;可是從物理學的發展來講,波動光學旨在解決幾何光學沒法解決的問題,可謂光線模型的一種升級。從編程的角度來講,波動光學在某些狀況下能夠簡單地理解爲在光線模型的基礎上,引入一個相位項。html

波動模型

通常來講,三個特徵能夠肯定空間中的波場:頻率、振幅和相位,故光波場可表示爲:python

E = A c o s ( ω t k r ) E = Acos(\omega t-kr) web

其中, A A 爲振幅, ω = 2 π f = 2 π T \omega=2\pi f=\frac{2\pi}{T} 爲角頻率, k = 2 π λ k=\frac{2\pi}{\lambda} ,爲波數。由上式可知,當時間固定時,光在傳播方向上有一個正弦波的外形;而對於空間中任意一點,沿着振幅方向也呈正弦波的規律上下振動。編程

其中,振幅、波數以及空間位置均爲矢量,當座標比較混亂的時候,也能夠寫成 E = A c o s ( ω t k r ) \vec E = \vec{A}cos(\omega t-\vec k\vec r) ;有時爲了計算方便,也能夠寫成指數形式app

E = A e i ( ω t k r ) E = Ae^{-i(\omega t-kr)} ide

對於平面波來講,其發散角爲0,即光場中的全部點,都具備統一的傳播方向,且振幅相等。設其傳播方向爲 z z ,則可寫爲svg

E = A c o s ( ω t k z ) E = Acos(\omega t-kz) ui

球面波則相對複雜,令 r r 爲空間中任意一點到點光源的距離,則對於 a b a、b 兩點來講,其單位面積的光通量之比爲 I a I b = r b 2 r a 2 \frac{I_a}{I_b}=\frac{r^2_b}{r^2_a} ,則振幅之比爲 E b E a = r a r b \frac{E_b}{E_a}=\frac{r_a}{r_b} 。這說明球面波振幅反比于波陣面到光源距離,即spa

E = A r e i ( ω t k r ) E = \frac{\vec A}{r}e^{-i(\omega t-\vec k\vec r)} 3d

經過截取 x O z xOz 平面,假設光波長爲532nm,則能夠畫出這一截面處的光波振幅圖。

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
z = np.arange(15,200)*10    #單位爲nm
x = np.arange(15,200)*10
x,z = np.meshgrid(x,z)      #建立座標系
E = 1/np.sqrt(x**2+z**2)*np.cos(2*np.pi*np.sqrt(x**2+z**2)/(532*1e-9))
fig = plt.figure()
ax = Axes3D(fig)
ax.plot_surface(x,z,E)
plt.show()

其結果如圖所示

在這裏插入圖片描述

菲涅耳公式

幾何光學能夠經過費馬原理獲得折射定律,可是沒法獲知光波的透過率,菲涅耳公式在幾何光學的基礎上,解決了這個問題。

因爲光是一羣橫波的集合,故能夠根據其電矢量的震動方向,將其分爲平行入射面與垂直入射面的兩個份量,分別用 p p 份量和 s s 份量來表示。一束光在兩介質交界處發生折射,兩介質折射率分別爲 n 1 n_1 n 2 n_2 ,對於 p p 光來講,其電矢量平行於入射面,其磁矢量則垂直於入射面,即只有 s s 份量;而對於 s s 光來講,則偏偏相反,如圖所示。

在這裏插入圖片描述

則對於 p p 光來講即
{ E p = E p 0 e i ( k ( n ^ r ) ω t ) B s = B s 0 e i ( k ( n ^ r ) ω t ) \left\{ \begin{aligned} E_p&=E_{p0}e^{i(k(\hat{n}\cdot r)-\omega t)}\\ B_s&=B_{s0}e^{i(k(\hat{n}\cdot r)-\omega t)} \end{aligned}\right.

n 1 n_1 n 2 n_2 平面內,其波數分別爲 k 1 = 2 π n 1 / λ k_1=2\pi n_1/\lambda , k 1 = 2 π n 2 / λ k_1=2\pi n_2/\lambda ,則入射波、反射波和透射波分別能夠寫爲
{ E i = E i 0 e i [ k 1 ( s i n θ i x c o s θ i y ) ω t ] E r = E r 0 e i [ k 1 ( s i n θ r x + c o s θ r y ) ω t ] E t = E t 0 e i [ k 2 ( s i n θ t x c o s θ t y ) ω t ] \left\{ \begin{aligned} E_i&=E_{i0}e^{i[k_1(sin\theta_ix-cos\theta_iy)-\omega t]}\\ E_r&=E_{r0}e^{i[k_1(sin\theta_rx+cos\theta_ry)-\omega t]}\\ E_t&=E_{t0}e^{i[k_2(sin\theta_tx-cos\theta_ty)-\omega t]} \end{aligned}\right.

其角度關係爲
θ i = θ r \theta_i=\theta_r

n 1 s i n θ i = n 2 s i n θ t n_1sin\theta_i=n_2sin\theta_t

則波數之間的關係爲
k 1 s i n θ i = k 1 s i n θ r = k 2 s i n θ t k_1sin\theta_i=k_1sin\theta_r=k_2sin\theta_t

又因在界面上,反射波和透射波在x軸上的投影必然等於入射波,故對於電矢量而言,有
c o s θ i E i 0 = c o s θ r E r 0 + c o s θ t E t 0 cos\theta_iE_{i0}=cos\theta_rE_{r0}+cos\theta_tE_{t0}

對於磁矢量而言,有
n 1 B i 0 + n 1 B r 0 = n 2 B t 0 n 1 E i 0 + n 1 E r 0 = n 2 E t 0 n_1B_{i0}+n_1B{r0}=n_2B_{t0} \to n_1E_{i0}+n_1E{r0}=n_2E_{t0}

令振幅反射係數和透射係數分別爲 r p = E r 0 E i 0 , t p = E t 0 E i 0 r_p = \frac{E_{r0}}{E_{i0}},t_p = \frac{E_{t0}}{E_{i0}}

則有
{ c o s θ r r p + c o s θ t t p = c o s θ i n 1 r p n 2 t p = n 1 \left\{ \begin{aligned} cos\theta_rr_p+cos\theta_tt_p&=cos\theta_i\\ n_1r_p-n_2t_p &= -n_1 \end{aligned}\right.

s光的計算方法與之相似,最後獲得
{ r p = n 2 c o s θ i n 1 1 ( n 1 / n 2 ) 2 s i n 2 θ i n 2 c o s θ i + n 1 1 ( n 1 / n 2 ) 2 s i n 2 θ i t p = 2 n 1 c o s θ i n 2 c o s θ i + n 1 1 ( n 1 / n 2 ) 2 s i n 2 θ i r s = n 1 c o s θ i n 2 1 ( n 1 / n 2 ) 2 s i n 2 θ i n 1 c o s θ i + n 2 1 ( n 1 / n 2 ) 2 s i n 2 θ i t s = 2 n 1 c o s θ i n 1 c o s θ i + n 2 1 ( n 1 / n 2 ) 2 s i n 2 θ i \left\{\begin{aligned} r_p&=\frac{n_2cos\theta_i-n_1\sqrt{1-(n_1/n_2)^2sin^2\theta_i}}{n_2cos\theta_i+n_1\sqrt{1-(n_1/n_2)^2sin^2\theta_i}}\\ t_p&=\frac{2n_1cos\theta_i}{n_2cos\theta_i+n_1\sqrt{1-(n_1/n_2)^2sin^2\theta_i}}\\ r_s&=\frac{n_1cos\theta_i-n_2\sqrt{1-(n_1/n_2)^2sin^2\theta_i}}{n_1cos\theta_i+n_2\sqrt{1-(n_1/n_2)^2sin^2\theta_i}}\\ t_s&=\frac{2n_1cos\theta_i}{n_1cos\theta_i+n_2\sqrt{1-(n_1/n_2)^2sin^2\theta_i}} \end{aligned}\right.

咱們能夠經過python繪製出當入射光的角度不一樣時,其振幅反射率和透過率的變化

import matplotlib.pyplot as plt
import numpy as np
def fresnel(theta, n1, n2):
    theta = theta*np.pi/180
    xTheta = np.cos(theta)
    mid = np.sqrt(1-(n1/n2*np.sin(theta))**2)          #中間變量
    rp = (n2*xTheta-n1*mid)/(n2*xTheta+n1*mid)  #p份量振幅反射率
    rs = (n1*xTheta-n2*mid)/(n1*xTheta+n2*mid)
    tp = 2*n1*xTheta/(n2*xTheta+n1*mid)
    ts = 2*n1*xTheta/(n1*xTheta+n2*mid)
    return rp, rs, tp, ts

def testFres(n1=1,n2=1.45):         #默認n2爲1.45
    theta = np.arange(0,90,0.1)+0j
    a = theta*np.pi/180
    rp,rs,tp,ts = fresnel(theta,n1,n2)

    fig = plt.figure(1)
    plt.subplot(1,2,1)
    plt.plot(theta,rp,'-',label='rp')
    plt.plot(theta,rs,'-.',label='rs')
    plt.plot(theta,np.abs(rp),'--',label='|rp|')
    plt.plot(theta,np.abs(rs),':',label='|rs|')
    plt.legend()

    plt.subplot(1,2,2)
    plt.plot(theta,tp,'-',label='tp')
    plt.plot(theta,ts,'-.',label='ts')
    plt.plot(theta,np.abs(tp),'--',label='|tp|')
    plt.plot(theta,np.abs(ts),':',label='|ts|')
    plt.legend()
    plt.show()

if __init__=="__main__":
    testFres()

獲得其圖像爲

在這裏插入圖片描述

因爲強度與振幅之間存在一個平方的關係,因此強度反射率和透過率爲 r 2 |r|^2 n 2 n 1 t 2 \frac{n_2}{n_1}|t|^2 。而能流與強度之間還須要除以一個橫截面積,故能流反射率和透過率分別爲:
{ R = r 2 T = n 2 c o s θ t n 1 c o s θ i t 2 \left\{\begin{aligned} R &= |r|^2\\ T &= \frac{n_2cos\theta_t}{n_1cos\theta_i|t|^2} \end{aligned}\right.

經過python進行繪圖,將上面程序中的testFres改成如下代碼便可。

def testFres(n1=1,n2=1.45):
    theta = np.arange(0,90,0.1)+0j
    a = theta*np.pi/180
    rp,rs,tp,ts = fml.fresnel(theta,n1,n2)

    Rp = np.abs(rp)**2
    Rs = np.abs(rs)**2
    Rn = (Rp+Rs)/2

    Tp = n2*np.sqrt(1-(n1/n2*np.sin(a))**2)/(n1*np.cos(a))*np.abs(tp)**2
    Ts = n2*np.sqrt(1-(n1/n2*np.sin(a))**2)/(n1*np.cos(a))*np.abs(ts)**2
    Tn = (Tp+Ts)/2

    fig = plt.figure(2)
    plt.subplot(1,2,1)
    plt.plot(theta,Rp,'-',label='R_p')
    plt.plot(theta,Rs,'-.',label='R_s')
    plt.plot(theta,Rn,'-',label='R_n')
    plt.legend()

    plt.subplot(1,2,2)
    plt.plot(theta,Tp,'-',label='T_p')
    plt.plot(theta,Ts,'-.',label='T_s')
    plt.plot(theta,Tn,'--',label='T_n')
    plt.legend()

    plt.show()

在這裏插入圖片描述