-
Notifications
You must be signed in to change notification settings - Fork 5
Example: Thin film single layer
Here we will calculate the spectra of a single layer of SnO2 deposited onto a silicon wafer, giving a three media system with air as incident one and silicon as a substrate.
The complete code can be found here.
We will use the Plots
and LaTeXStrings
packages for plotting and then load the modules for the calculations. The RefractiveIndicesDB.jl and RefractiveIndicesModels.jl are part of ThinFilmsTools.jl and export the RIdb
and RI
modules, respectively to handle the builtin functions.
using Plots, LaTeXStrings
pyplot(reuse=false, grid=false)
using ThinFilmsTools
The first thing to do is to define the parameters for the beam (the incident light to the structure), by setting the wavelength range (nanometers) and the angle of incidence. The λ0
parameter is the reference wavelength. Note that the angle of incidence must be wrapped into a vector. We set it to normal incidence.
λi = 400 # intial wavelength [nm]
λf = 1000 # final wavelength [nm]
λ = LinRange(λi, λf, λf-λi+1) # wavelength range [nm]
θ = [0.] # angle of incidence [degrees]
beam = PlaneWave(λ, θ)
Here we define the information for each layer of interest that will be used in the calculations. For each layer we let type :GT
(geometrical or physical thickness, taken by default), the index of refraction n
and the thickness d
.
layers = [
LayerTMMO(RIdb.air(beam.λ)),
LayerTMMO(RIdb.sno2f(beam.λ); d=150., nλ0=RIdb.sno2f([beam.λ[150]])),
LayerTMMO(RIdb.silicon(beam.λ)),
]
λ0 = 700.0
After defining the parameters we call the main function for it tmm_optics
and store the results in sol
:
sol = tmm_optics(beam, layers; λ0=λ0)
The results can be plotted using some recipes and functions included in the package. For instance, for plotting the Reflectance, Transmittance and Absorbance spectra, we could do:
plot(Spectrum1D(),
sol.beam.λ, [sol.Spectra.Rp, sol.Spectra.Tp, 1.0.-(sol.Spectra.Rp.+sol.Spectra.Tp)],
label=["Reflectance" "Transmittance" "Absorbance"],
line=([:solid :dash :dashdot]),
)
gui()
And to plot the profile of indexes of refraction inside the structure:
plot(RIprofile(), sol)
gui()
This last plot is useful to see the indexes of refraction, at the reference wavelength, across the structure. The light strikes the system from the left to the right, being the incident medium the leftmost one and the substrate the rightmost one.