In[1]:=

Needs["Rayica`Rayica`"]

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

Rayica 2.0 was loaded in 18 s and needs 7083 kilobytes of memory on top of 4761 kilobytes already used

GrinLens Examples

GRINLens is the latest optical element to be added to the Rayica/Wavica modeling environment. You can use GRINLens to model both many forms of graded-index refraction.

?GRINLens

GRINLens[aperture, length] defines an  optical lens component that incorporates the  ... n2, aperture, length] are also supported by GRINLens. See also: DefaultGRINIndex, GradeRefraction.

Options[GRINLens]

RowBox[{{, RowBox[{LabelsGRINLens, ,, LabelPositionsAutomatic, ,, ComponentDes ... ty}, ,, Solid {SurfaceRendering {Fill, Trace}, CrossRenderingTrace}}], }}]

GRINLens automatically uses a default index model that is called DefaultGRINIndex

?DefaultGRINIndex

DefaultGRINIndex specifys an spatial-dependent, axial-symmetric refractive index model that is ... ens when no other index model has been specified by the user. See also: GRINLens, GradeRefraction.

ModelRefractiveIndex[DefaultGRINIndex]

RowBox[{RowBox[{RowBox[{RowBox[{2.5, }], -, RowBox[{0.04,  , SurfaceCoordinates . SurfaceCoordinates}]}], /., , #1}], &}]

Otherwise you can always define your own refractive index model as follows:

Unprotect[ModelRefractiveIndex]

{ModelRefractiveIndex}

ModelRefractiveIndex[GRINIndex] = Function[(2.5-.04*Dot[SurfaceCoordinates,SurfaceCoordinates])/.#]

RowBox[{RowBox[{RowBox[{RowBox[{2.5, }], -, RowBox[{0.04,  , SurfaceCoordinates . SurfaceCoordinates}]}], /., , #1}], &}]

grinrod = GRINLens[10,18, ComponentMedium->GRINIndex]

GRINLens[10, 18, {ComponentMediumGRINIndex}]

TurboPlot gives you the fastest trace, however you cannot see the interior of the GRINLens trace with TurboPlot.

TurboPlot[{LineOfRays[7,NumberOfRays->11],Move[grinrod,10], Boundary[50]},PlotType->TopView];

[Graphics:HTMLFiles/index_9.gif]

You can use AnalyzeSystem to visualize the interior of the GRINLens trace at the cost of a slower result.

AnalyzeSystem[{LineOfRays[7,NumberOfRays->11],Move[grinrod,10], Boundary[50]},PlotType->TopView];

[Graphics:HTMLFiles/index_10.gif]

DrawSystem[{Move[SingleRay[],{0,4.5}],Move[grinrod,{10,5},45], Boundary[50]},PlotType->TopView];

[Graphics:HTMLFiles/index_11.gif]

DrawSystem[{Move[SingleRay[],{0,0}],Move[grinrod,{10,10},-45], Boundary[50]},PlotType->TopView];

[Graphics:HTMLFiles/index_12.gif]

DrawSystem[{Move[SingleRay[],{0,4.5}],Move[grinrod,10], Boundary[50]},PlotType->TopView];

[Graphics:HTMLFiles/index_13.gif]

DrawSystem[{LineOfRays[9,NumberOfRays->11],Move[grinrod,10], Boundary[50]},PlotType->TopView];

[Graphics:HTMLFiles/index_14.gif]

You can also add a spherical surface curvature to the front and back of GRINLens as follows:

curvedgrinrod = GRINLens[10,-10,10,18,RunningCommentary->GradedRefraction]

RowBox[{An extrapolation distance of AbsoluteStepSize -> , , 0.18, ,  will be used.}]

GRINLens[10, -10, 10, 18, {RunningCommentaryGradedRefraction}]

DrawSystem[{LineOfRays[7,NumberOfRays->11],Move[curvedgrinrod,10], Boundary[50]},PlotType->TopView];

[Graphics:HTMLFiles/index_17.gif]

DrawSystem[{LineOfRays[7,NumberOfRays->11],Move[curvedgrinrod,10,-30], Boundary[50]},PlotType->TopView];

[Graphics:HTMLFiles/index_18.gif]

Optimize GrinLens

You can use SymbolicRefractiveModels with TurboPlot to specify your own symbolic function for the graded refractive index.

In[2]:=

?SymbolicRefractiveModels

SymbolicRefractiveModels -> {opticalmedium->symbolicexpression,...} is an option of Turb ...  to be exchanged with the pre-existing model identified by opticalmedium. See also: OpticalMedium.

grinrod = GRINLens[10,18]

GRINLens[10, 18]

sys = TurboPlot[{LineOfRays[7,NumberOfRays->11],Move[grinrod,10], Boundary[50]},PlotType->TopView, SymbolicRefractiveModels->{DefaultGRINIndex->(a-b SurfaceCoordinates.SurfaceCoordinates)}, SymbolicValues->{a->2.5, b->.04}];

[Graphics:HTMLFiles/index_21.gif]

Next you can use OptimizeSystem to find the optimal values for the symbolic constants: a and b.

sol = OptimizeSystem[{LineOfRays[7,NumberOfRays->11],Move[grinrod,10], Boundary[50]},PlotType->TopView, SymbolicRefractiveModels->{DefaultGRINIndex->(a-b SurfaceCoordinates.SurfaceCoordinates}, SymbolicValues->{a->2.5, b->.04}]

RowBox[{{, RowBox[{RowBox[{SymbolicValues, , RowBox[{{, RowBox[{RowBox[{a, , 2 ... 0341155}]}], }}]}], ,, NumberOfCycles651, ,, RowBox[{FinalMerit, , 2.1446}]}], }}]

The optimization does not look very good in this instance.

TurboPlot[sys,sol,PlotType->TopView];

[Graphics:HTMLFiles/index_23.gif]

Here is a model that uses three symbol parameters and is a forth order function.

sys = TurboPlot[{LineOfRays[7,NumberOfRays->11],Move[grinrod,10], Boundary[50]},PlotType->TopView, SymbolicRefractiveModels->{DefaultGRINIndex->(a-b SurfaceCoordinates.SurfaceCoordinates-c (SurfaceCoordinates.SurfaceCoordinates)^2)}, SymbolicValues->{a->2.5, b->.04, c->.0001}];

[Graphics:HTMLFiles/index_24.gif]

The optimization is improved somewhat.

sol = OptimizeSystem[{LineOfRays[7,NumberOfRays->11],Move[grinrod,10], Boundary[50]},PlotType->TopView, SymbolicRefractiveModels->{DefaultGRINIndex->(a-b SurfaceCoordinates.SurfaceCoordinates-c (SurfaceCoordinates.SurfaceCoordinates)^2)}, SymbolicValues->{a->2.5, b->.04, c->.0001}]

RowBox[{{, RowBox[{RowBox[{SymbolicValues, , RowBox[{{, RowBox[{RowBox[{a, , 2 ... 85407}]}], }}]}], ,, NumberOfCycles364, ,, RowBox[{FinalMerit, , 0.634941}]}], }}]

TurboPlot[sys,sol,PlotType->TopView];

[Graphics:HTMLFiles/index_26.gif]

Finally here is a model that uses four symbol parameters and is a eighth order function.

sys = TurboPlot[{LineOfRays[7,NumberOfRays->11],Move[grinrod,10], Boundary[50]},PlotType->TopView, SymbolicRefractiveModels->{DefaultGRINIndex->(a-b SurfaceCoordinates.SurfaceCoordinates-c (SurfaceCoordinates.SurfaceCoordinates)^2-d (SurfaceCoordinates.SurfaceCoordinates)^4)}, SymbolicValues->{a->2.5, b->.04, c->.0001, d->.000001}];

[Graphics:HTMLFiles/index_27.gif]

sol = OptimizeSystem[{LineOfRays[7,NumberOfRays->11],Move[grinrod,10], Boundary[50]},PlotType->TopView, SymbolicRefractiveModels->{DefaultGRINIndex->(a-b SurfaceCoordinates.SurfaceCoordinates-c (SurfaceCoordinates.SurfaceCoordinates)^2-d (SurfaceCoordinates.SurfaceCoordinates)^4)}, SymbolicValues->{a->2.5, b->.04, c->.0001, d->.000001}]

RowBox[{{, RowBox[{RowBox[{SymbolicValues, , RowBox[{{, RowBox[{RowBox[{a, , 2 ... 607}]}]}], }}]}], ,, NumberOfCycles564, ,, RowBox[{FinalMerit, , 0.645406}]}], }}]

The optimization is improved even further.

TurboPlot[sys,sol,PlotType->TopView];

[Graphics:HTMLFiles/index_29.gif]


Created by Mathematica  (April 26, 2005)