Needs["Rayica`Rayica`"]

+++++++++++++++++++++++++

Rayica 2.0 was loaded in 19 s and needs 7120 kilobytes of memory on top of 4762 kilobytes already used

Optimization of Aspheric Components

Rayica can be used to optimize nearly every optical set-up. Such optimization can involve aspheric components. Rayica has built-in functions for modelling both aspheric and toriodal lenses and mirrors. In this example, we will examine how to use Rayica for optimizing the design of an aspheric lens. The AsphericLens function is used to model aspheric lenses in Rayica. You can get an overview of the use of AsphericLens with the ?AsphericLens:

In[46]:=

?AsphericLens

AsphericLens[{curvature1, conic1, polynomialcoefficients1,insideaperture1}, {curvature2, conic ...  also: AsphericLensSurface, AsphericMirror, ToroidalLensSurface, ToroidalLens, and ToroidalMirror.

In order to get started, we can use the DataToRayica[AsphericLens] in order to pull a typical aspheric lens system from Rayica's built-in database of catalog elements.

In[52]:=

DataToRayica[AsphericLens]

Loading database ...

Out[52]=

RowBox[{{, RowBox[{TagBox[StyleBox[TagBox[RowBox[{AsphericLens, [, RowBox[{RowBox[{{, RowBox[{ ... ], ]}], ,, 1.5925}], ]}], HoldForm], FontColor -> RGBColor[0., 0.392187, 0.]], DisplayForm]}], }}]

Below is a plot of the reported system. Note that there is a second window present present in addition to the aspheric lens. This element models the effects of an optical window used with many laser diodes. For our further work, however, this element will be omitted.

In[54]:=

ShowSystem[%];

[Graphics:HTMLFiles/index_5.gif]

We can now use the generated aspheric lens as a started condition for our optimization. First we assign symbolic values to accompany each numeric parameter in the previously generated aspheric lens. These symbolic parameters are used in the optimization procedure. We do not assign symboic values to the lens aperture parameters since these are not relavent to the optimization procedure.

In[55]:=

alens = AsphericLens[{{curva,0.9},{ka,-0.696917},{ca1,0},{ca2,0},{ca3,-0.0869628},{ca4,-0.0133304},{ca5,-0.153352},1.3},
    {{curvb,-0.9},{kb,-6.99529},{cb1,0},{cb2,0},{cb3,-0.171893},{cb4,-0.0409008}, {cb5,0.0885435}, 1.13},2.4, 1.03,{ComponentMedium→CO550}]

Out[55]=

TagBox[StyleBox[TagBox[RowBox[{AsphericLens, [, RowBox[{RowBox[{{, RowBox[{RowBox[{{, RowBox[{ ... nentMediumCO550}}], ]}], HoldForm], FontColor -> RGBColor[0., 0.392187, 0.]], DisplayForm]

Each aspheric lens surface is internally represented by an equation which you can examine from the SymbolicSurfaceFunction of the lens as follows.

In[59]:=

SymbolicSurfaceFunction/.(Surfaces/.alens)[[{1,4}]]

Out[59]=

{{ca1 (#1^2 + #2^2) + ca2 (#1^2 + #2^2)^2 + ca3 (#1^2 + #2^2)^3 + ca4 (#1^2 + #2^2)^4 + ca5 (# ... + #2^2)^5 + (curvb (#1^2 + #2^2))/(1 + (1 - curvb^2 (1 + kb) (#1^2 + #2^2))^(1/2)), #1, #2} &}

For the default settings of the lens, each symbolic parameter is assigned a numeric value for the purposes of making a numeric trace of the system. These assignments are stored in SymbolicValues.

In[60]:=

?SymbolicValues

SymbolicValues -> {symbol->value,...} is an option that attaches numerical values to the ... can be user-specified or, in some cases, is automatically generated during the Component creation.

Here are the SymbolicValues for alens.

SymbolicValues/.(Surfaces/.alens)

RowBox[{{, RowBox[{RowBox[{{, RowBox[{ca10, ,, ca20, ,, RowBox[{ca3, , ... curvb, , RowBox[{-, 0.9}]}], ,, RowBox[{kb, , RowBox[{-, 6.99529}]}]}], }}]}], }}]

We will now place a light source in front of this lens and trace rays to a screen surface placed a fixed distance from the lens.

plot = TurboPlot[{WedgeOfRays[20,NumberOfRays->11],Move[alens,2.5],Move[Screen[2.5],5]},PlotType->TopView];

[Graphics:HTMLFiles/index_10.gif]

Here we can see that the rays are not focusing to the smallest possible point on the screen. Using FindSpotSize, we can measure the spot size on the screen.

SpotSize/.FindSpotSize[plot]

[Graphics:HTMLFiles/index_11.gif]

0.0228802

Finally we can use OptimizeSystem to determine values for the aspheric lens parameters that generate a better focus.

?OptimizeSystem

OptimizeSystem[system, options] optimizes the performance of an optical system for a specified ... \nSee also: ConstructMeritFunction, MeritType, MinimizationType, TurboTrace, and RayTraceFunction.

sol = OptimizeSystem[{WedgeOfRays[20,NumberOfRays->11],Move[alens,2.5],Move[Screen[2.5],5]}]

RowBox[{{, RowBox[{RowBox[{SymbolicValues, , RowBox[{{, RowBox[{RowBox[{ca1, , ... }]}], }}]}], ,, NumberOfCycles1720, ,, RowBox[{FinalMerit, , 0.0000106892}]}], }}]

After 1720 iterations, OptimizeSystem has found better values the aspheric lens coefficients to minimize the spot size of the trace, as revealed by TurboPlot and FindSpotSize below.

bestplot = TurboPlot[plot,PlotType->TopView,sol];

[Graphics:HTMLFiles/index_15.gif]

SpotSize/.FindSpotSize[bestplot]

[Graphics:HTMLFiles/index_16.gif]

0.0000341828


Created by Mathematica  (September 2, 2005)