Engee documentation
Notebook

Lens model

Let us describe the lens model, give the properties of the optical system and evaluate how parallel rays pass through it.

Problem description

We will create a model of a lens and a surface. Light will propagate through air (refractive index of which is equal to 1.0), then cross a spherical surface, the optical centre of which is located at 1 (coordinates have no dimensionality, the user can express them in any system). The radius of the first spherical surface is equal to 6.0. Then the light passes through the material with refractive index 1.5 (glass) until it reaches the second spherical surface located on the Z-axis at coordinate 2 and having radius -6. After crossing the second surface, the beam passes through the air again and reaches a surface located on the Z-axis at the coordinate 8.

For this work we will use the package for calculations of geometrical optics problems GeometricalOptics.

In [ ]:
Pkg.add( url="https://github.com/airspaced-nk5/GeometricalOptics.jl#master" )

The geometry of the lens and the wall limiting the propagation of rays is defined as follows:

In [ ]:
using GeometricalOptics

funcsList = [spherical, spherical, zplane]    # объекты на пути луча
coeffsList = [[1., 6.], [2., -6.], [8.]]      # свойства объектов
nList = [1., 1.5, 1.]                         # индексы рефракции

optSta = opticalstack( coeffsList, funcsList, nList );

We see that there are three objects in the system: two spherical surfaces spherical (on which refraction occurs) and one plane zplane.

Refraction coefficients are given for the media through which light passes before crossing the next boundary (given by the corresponding object in the list funcsList). In our case, the first coefficient characterises the space in front of the lens.

The object spherical in the library is defined by the function spherical( x, y, coeffs=[zpos,signed_radius] ), where zpos is the position of the object on the optical axis, and signed_radius is the radius of curvature of the surface.

The user can create his own functions and use them in the definition of the optical system. For example, the function my_ytilt(x,y,coeffs)=coeffs[1]+coeffs[2]*y will create a description of an inclined plane, the position of which on the Z axis is defined by the first coefficient and the inclination on the Y axis by the second coefficient.

Creating the ray source

The most concise way to create a beam of parallel beams is the function bundle(x,y,angx,angy,zpos). Other functions are also present, for example bundle_as_array, which allows you to create a beam with a circular cross-section.

The function bundle takes arguments x,y,zpos (position of the beam centre) and angx,angy (divergence of rays in the beam, specified in radians, along X and Y axes). Each argument can be specified by a vector, so the following command creates a comb of rays.

In [ ]:
test_bundle = bundle( [0.], (-1:0.2:1), 0., 0., 0. );

Each ray starts at a point with coordinates X=0 and Z=0, and we create a total of 11 rays with coordinates from -1 to 1 spaced at 0.2.

Calculation and output of graphs

Several different graphical diagrams can be produced for this system.

Characterisation of beam curvature

We have 1 source and k surfaces, so we can relate the dependence of beam coordinates between any two surfaces from k+1 available.

If we simply pass the beam test_bundle to the object optSta ("optical stack ") and display the graph using the function rac, we will get one curve.

In [ ]:
trace1 = optSta( test_bundle )
rac( trace1, 1, 4 )
Out[0]:

Here is a graph of dependence of coordinates of each ray in the beam on the fourth surface (axis Y) on its coordinate on the first surface (axis X).

The command rms_spot will return the RMS scattering of the beam on the last surface of the optical system (if you call it without additional arguments).

In [ ]:
rms = rms_spot( trace1 )
Out[0]:
0.03846450937451718

Two-dimensional ray propagation graph

If we pass to the object optSta not only the source characteristic test_bundle, but also the argument rend, we will get a two-dimensional (or three-dimensional) graph in the output.

In [ ]:
p_lens = optSta( test_bundle; rend = "YZ" )
Out[0]:

Experiment with possible arguments of this command to get different graphs (we have converted the graph to gr() format for the sake of faster rendering).

In [ ]:
gr()
Out[0]:
Plots.GRBackend()
In [ ]:
rend = "3Dcirc" # @param ["YZ", "XZ", "3Dcirc", "3Dsq"]
ymin = -2.0
ymax = 2.0

p_lens = optSta(test_bundle; rend=rend, ydom = -2:0.1:2)
Out[0]:

Conclusion

We have learnt how to use the library GeometricalOptics to describe simple models demonstrating the effects of geometrical optics (the model does not reflect wave effects).

In addition to installing the library, we needed 7 lines of code to create a model of ray beam propagation through a lens.