Zemax is a ray-tracing software for Optical Engineers and Lens Designers. It is known for its friendly user-interface. This blog will walk you through how to design your first lens.
We want to design a 100 mm focal length lens that is diffraction limited.
Here is a downloadable file:
<https://4420950.fs1.hubspotusercontent-na1.net/hubfs/4420950/PLN_CXV_100.zip>
1. Setup
Ansys OpticStudio opens with an empty Lens Data Editor. The first thing is to open a viewing window. Click at the top toolbar Analyze -> Cross-Section (the other viewers can be opened also, 3D Viewer is helpful for systems with turn mirrors and more complicated optical paths).
Next setup the System Explorer module on the left hand side of the screen. Click Aperture and populate the fields. We can leave the Entrance Pupil Diameter as the Aperture Type. Play with the others as you see fit, but all this is doing is defining how the rays are entering the optical system. Set the Aperture value to 20 mm (units are defaulted to mm). The rest of the items in this window are usually not necessary for simple lens systems, but a question mark on every tab is available and this pulls open the help manual, where you can read about what these extra parameters do.
Now we need to setup our Fields. Just keep the 0 degree field for now, which is an on-axis beam.
Next is wavelengths. Put the required wavelength as primary and add additional wavelengths if necessary.
The rest of the System Explorer can be left the way it is for now. Each parameter is important, but for the purpose of designing a first lens it can be left alone.
2. Lens Data Editor
Next is review the Lens Data Editor. This is Sequential Mode, meaning rays start at the OBJECT, pass through the STOP, and end at the IMAGE. These three surfaces will always be here. We just need to populate lenses in between.
An OBJECT at infinity, infinite conjugate is good for this because our lens will have the best focus. An OBJECT at infinity means that a source that emits a spherical wave is infinity mm away from the next surface. By the time is reaches us the wavefronts will look like Plane Waves.
Lets add 50 mm dummy surface between our OBJECT and our STOP just for viewing purposes.
Our STOP will be the lens itself. At the STOP surface add a Material "N-BK7" glass. Add a thickness, and input some Radius of Curvature. Blur in an optical system is unavoidable. Light bends around corners, that is diffraction and the physical limit of performance, and glass is imperfect which adds deviations from a perfect spherical wavefront (converging focus), that is aberrations. We always strive from a diffraction limited design.
The Radius will control how fast we focus (fast is shorter focal length). More curvature means rays are bent more. Fast, short focal length are low f-number systems are in general harder to correct for aberrations.
Input 100 mm into the Radius, and 10 mm in the thickness for the STOP surface.
A fast read for a designer is the bar at the bottom of the screen, where EFFL is effective focal length, WFNO is working f number, ENPD is entrance pupil diameter, and TOTR is total track length (I like to change this one to ISNA, which is image space numerical aperture).
3. Focus
Now we have made a lens. Our EFFL is 192.856 mm and our WFNO is 9.6. Lets adjust our settings in the Layout View to see the STOP and the IMAGE. Click settings near the Layout tab. First, insert a dummy surface between the STOP and the IMAGE. Change First surface to 0 and Last Surface to 4.
Here we have light coming from a source at infinity, our dummy surface and the lens. Lets do a few things to evaluate the focus or optical performance of our lens.
A quick note: Rays travel from left to right in a positive Z-direction. A lens is centered on the optical axis an its diameter is laterally in the XY-Plane.
First, lets use a Marginal Ray Solve. Geometrical Ray-tracing has a few rays that are tracked. Of those rays Chief and Marginal rays are important here. A Chief ray is defined as the ray that crosses the optical axis at the STOP or when the ray height is y=0. A Marginal ray is defined as the ray that determines the diameter of the STOP surface. So, if we use a Marginal Ray Solve we are telling Zemax that when the outer most ray crosses the optical axis or when the Marginal ray height is y=0 (remember that it was once at the edge of our STOP, which for us is y=10 mm), this is where our paraxial focus will be.
On Surface 3, our dummy surface before the IMAGE, within the Thickness column, click the tiny box to the right of the 0.00. Solve Type: Click and navigate to Marginal Ray Height and it should automatically have 0 in the Height: field and press enter.
4. Analyze
Now we have a focus. Let's see how good it is. Click on the Analyze Tab at the top and lets open Rays & Spots -> Spot Diagram.
The Spot Diagram shows us what our focus point looks like at the IMAGE. A quick way to evaluate its performance is to click the settings button for the Spot Diagram tab and make sure the box that says airy disc is checked.
The Airy Disc Radius for this optical system is 6.5 um and our RMS radius is 18.059. We are not diffraction limited with this design. However, before we go crazy optimizing the lens to get something perfect we must ask ourselves, "Is this the best focus?". If we zoom in we see that we are not at the best focus. And we see some aberration. What aberration? Spherical. For a better understanding of the Seidel Aberrations read this Blog. <https://blog.ozeninc.com/resources/lens-design-in-zemax-aberration-theory>
When we zoom in, it is clear our IMAGE plane is not at the best focus. The Marginal Ray solve is usually good for a paraxial focus, but where is the real focus? Lets see how far we were off. First remove the Marginal Ray solve by setting it back to Fixed. Next add another dummy surface between surface 3 and 4 like the figure above.
5. Optimize
Next go to the top of the screen with your cursor and click the Optimize tab. Next click Quick Focus all the way to the left. At the drop down menu click Spot Size Radial and keep the Use Centroid unchecked and click OK.
The IMAGE moved closer to the ideal focus. Lets see if we are diffraction limited by bringing up the Spot Diagram once again.
Now we are much closer to diffraction limited. The Airy Radius is 6.449 um with an RMS smaller and a GEO slightly larger. Now are we at the best focus?
Next we are going to use the optimization wizard and the Gaussian Quadrature algorithm to find the best focus and see if we are diffraction limited.
Okay first, delete your dummy surface and re-click the Quick Focus to get a single distance between the lens and the image plane of 185.896 mm.
Now make surface 3 a variable. Click the box next to the 185.896 mm on Surface 3 and use the drop down menu to select Variable, there should now be a V in that box indicating it is now a variable.
Next click the Optimize tab at the top. Navigate to Merit Function Editor. The Merit Function Editor is where we can add operands with weights that will use the Variable to find the best solution. It is important to know that the optimization will only converge to a solution if you are already close to one. Otherwise the solution could diverge to something unwanted or unrealistic.
With the Merit Function Editor we can click on the drop down that says "Wizards and Operands". Basically we are going to use the wizard to populate the operands for us. We can add our own operands if necessary, but for now we are just going to use the Optimization Wizard (which is also located at the top in the Optimize tab).
For the Image Quality field choose "Spot" for RMS Spot size. Click Apply.
The operands will populate with their respective weights. Click ok and Optimize! The IMAGE did not move. We can now say that this is the best focus. Yet we are still not diffraction limited.
Now we can focus on the specs of the optical system. The way it is built now the EFFL is 192.856 mm, which is an odd focal length. What we really wanted was a 100 mm focal length lens.
First, fix all the variables.
Next, click the Setup tab.
Click Scale Lens.
Scale by factor 0.5. (We intentionally built a bigger system then necessary and optimized it down so that we are nearly diffraction limited and now we have a last trick.) Click OK.
Notice, that every parameter was scaled by this factor.
Open the Spot Diagram.
We are now diffraction limited. The last thing to do is to ensure this system is 100 mm focal length at our design wavelength.
To do this, make the the front surface of the lens radius a variable. Click the Merit Function Editor. Clear all the operands with the red x at the top of the Merit Function Window.
Enter the Operand "EFFL" which is Effective Focal Length. Go to the Target and enter 100 mm. Go to the Weight and enter any value, since it is the only operand the weight just needs to be greater than 0. Optimize!
If you mess up, there is a back or undo button at the top near the save.
Now the EFFL at the bottom tab and in the Merit Function says the value is 100 mm.
One more refocus using the Quick Focus.
Viola, we have designed a 100 mm focal length Plano-Convex, diffraction limited lens.
Ozen Engineering Inc. leverages its extensive consulting expertise in CFD, FEA, optics, photonics, and electromagnetic simulations to achieve exceptional results across various engineering projects, addressing complex challenges such as antenna design, signal integrity, electromagnetic interference (EMI), and electric motor analysis using Ansys software.
We offer support, mentoring, and consulting services to enhance the performance and reliability of your electronics systems. Trust our proven track record to accelerate projects, optimize performance, and deliver high-quality, cost-effective results. For more information, please visit https://ozeninc.com.
If you want to learn more about our consulting services, please visit: https://www.ozeninc.com/consulting/
CFD: https://www.ozeninc.com/consulting/cfd-consulting/
FEA: https://www.ozeninc.com/consulting/fea-consulting/
Optics: https://www.ozeninc.com/consulting/optics-photonics/
Photonics: https://www.ozeninc.com/consulting/optics-photonics/
Electromagnetic Simulations: https://www.ozeninc.com/consulting/electromagnetic-consulting/
Thermal Analysis & Electronics Cooling: https://www.ozeninc.com/consulting/thermal-engineering-electronics-cooling/