############################################################# # scriptfile: plane_4layer.lsf # # This file calculates the reflection spectrum for # a 4-layer dielectric stack for a given polarization ( split-field formulation # and broadband source) and # compares to the analytic result. # # Copyright 2015, Lumerical Solutions, Inc. ############################################################# run; R =- transmission("R"); T = transmission("T"); pol = getnamed("Source1","polarization angle"); theta = getnamed("Source1","angle theta"); f = getdata("R","f"); fmin=min(f); fmax=max(f); n = matrix(4); d = matrix(4); # define the indices and layer thicknesses n(1) = 1; n(2) = 1.5; n(3) = 2.5; n(4) = 1.5; d(1) = 1; #does not matter d(2) = .5e-6; # layer thickness d(3) = .8e-6; # layer thickness d(4) = 9e-6; #does not matter since n(4) is real T_theory=T*0; RT_Theory = stackrt(n,d,f,theta); if(pol==90){ T_theory=RT_Theory.Ts;} if(pol==0){ T_theory=RT_Theory.Tp;} ma=getnamed("FDTD","mesh accuracy"); plot(c/f*1e6,T,T_theory,"wavelength um","T ","incident angle "+num2str(theta)+"deg mesh accuracy "+num2str(ma)+"for pol="+num2str(pol)); legend("Sim","Theory");