############################################################# # scriptfile: evanescent.lsf # # This file calculates the reflection spectrum for a 2 and 3 # layer dielectric stack. It does both polarizations # (TE and TM) and compares to the analytic result. # # Copyright 2010, Lumerical Solutions, Inc. ############################################################# #runsweep("sweep"); select("multilayer stack"); num_layers = get("num_layers"); R = getsweepresult("sweep", "R"); T = getsweepresult("sweep", "T"); theta= R.source_angle; f = R.f; # define the indices and layer thicknesses n = matrix(num_layers); d = matrix(num_layers); n(1) = getnamed("multilayer stack","index"); n(2) = 1; d(1) = 0; #does not matter d(2) = 0.5e-6; # does not matter if 2 layer stack if(num_layers==3){ n(3) = n(1); } RT_Theory = stackrt(n,d,f,theta); plot(theta*180/pi,-R.T,T.T,RT_Theory.Rs,RT_Theory.Ts,"angle (degrees)","R and T","R,T vs angle"); legend("R FDTD","T FDTD","R Theory","T Theory");