You are on page 1of 85

Roland Schilling, 12 Sep 2007, ./crc.

ps

AF

OptoCad

DR

A Fortran 95 module for tracing Gaussian TEM00 beams


through an optical set-up
Version 0.93i
written by

Roland Schilling

Users Guide

optocad_ug_0.93i

19 Jul 2013 16:41

T
AF
DR

The program packages RSUTIL, RSPLOT and O PTO C AD and the accompanying users guides have been
written by
Roland Schilling
D 85748 Garching
E-mail: ros@rzg.mpg.de
Phone:
+49-89-32929 670

A BSOLUTELY NO WARRANTY, A LL R IGHTS R ESERVED ,


c BY ROLAND S CHILLING 1995 2013.
C OPYRIGHT
This program package is still under development, thus the author urgently requests feedback from the
users. The programs have mainly been written to serve the needs of the GEO 600 gravitational-wave
detection project. O PTO C AD is not free software, but can currently also be used free of charge by other
cooperating, non-commercial groups. Therefore, please do not distribute O PTO C AD any further. For any
wider distribution, in particular for non-scientific applications, please contact the author.
19 Jul 2013 16:41

optocad_ug_0.93i

C ONTENTS

Contents

1.1 Input to O PTO C AD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1.2 Principle of operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1.3 Output from O PTO C AD . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1.4 Using O PTO C AD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1.5 Public variables and parameters

. . . . . . . . . . . . . . . . . . . . . . . .

1.6 Sign convention in O PTO C AD . . . . . . . . . . . . . . . . . . . . . . . . . .

1.7 Installation of O PTO C AD . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1.7.1

Installation by shell scripts . . . . . . . . . . . . . . . . . . . . . . . .

1.7.2

Compilation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10

1.7.3

Editing .ocd files . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10

The O PTO C AD subroutines and functions . . . . . . . . . . . . . . . . . . . . . .

11

2.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

11

2.2 Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

11

Subroutine OC_BEAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

12

Subroutine OC_BIND . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

14

OC_CAVITY . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

14

Subroutine OC_EXIT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

14

Subroutine OC_FINESSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

15

Subroutine OC_FRAME . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

15

Subroutine OC_INIT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

17

Subroutine OC_INPUT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

18

OC_LENS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

19

Subroutine OC_MSG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

19

Subroutine OC_RESET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

19

Subroutine OC_SET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

20

Subroutine OC_SURF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

22

Subroutine OC_TRACE . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

23

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

24

Syntax for the O PTO C AD input data . . . . . . . . . . . . . . . . . . . . . . . . .

25

3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

25

3.2 The different types of input lines

. . . . . . . . . . . . . . . . . . . . . . . .

26

3.2.1

Type e : End of input . . . . . . . . . . . . . . . . . . . . . . . . . .

26

3.2.2

Type x : Auxiliary input . . . . . . . . . . . . . . . . . . . . . . . . .

26

3.2.3

Type o : Origin/orientation . . . . . . . . . . . . . . . . . . . . . . . .

27

3.2.4

Type b : Initial beam . . . . . . . . . . . . . . . . . . . . . . . . . . .

27

3.2.5

Type c : General component or single surface . . . . . . . . . . . . . . .

28

3.2.6

Type d : Dual-surface component

28

DR

Function

Function

Subroutine OC_WP
3

Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

AF

optocad_ug_0.93i

. . . . . . . . . . . . . . . . . . . .

19 Jul 2013 16:41

C ONTENTS
3.2.7

Type h : Hole in a component . . . . . . . . . . . . . . . . . . . . . .

29

3.2.8

Type i : Insert preset optical component data . . . . . . . . . . . . . . .

29

3.2.9

Type p : Parameter list for preset optical components . . . . . . . . . . .

30

3.2.10 Type + : Secondary surface

. . . . . . . . . . . . . . . . . . . . . . .

30

3.3.1

The action string ac . . . . . . . . . . . . . . . . . . . . . . . . . . .

32

3.3.2

Aspherical and off-axis surfaces . . . . . . . . . . . . . . . . . . . . . .

34

3.3.3

Default values for reflectance and transmittance . . . . . . . . . . . . . .

35

3.3.4

Phase shifts at reflection and transmission . . . . . . . . . . . . . . . . .

35

3.3.5

Reflectance and transmittance for grating surfaces . . . . . . . . . . . . .

35

3.3.6

Numbering of the surfaces

. . . . . . . . . . . . . . . . . . . . . . . .

36

3.4 Labels for surfaces and components . . . . . . . . . . . . . . . . . . . . . . .

36

3.5 Some details about type c and type d components . . . . . . . . . . . . . . .

37

Special treatments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

37

4.1 Interferences

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

37

4.1.1

Action strings for interferences . . . . . . . . . . . . . . . . . . . . . .

38

4.1.2

Action strings for beam-splitters in Michelson interferometers . . . . . . .

38

4.2 Optical cavities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

39

Eigenmode and eigenray of optical cavities

. . . . . . . . . . . . . . . .

39

4.2.2

Action strings for optical cavities . . . . . . . . . . . . . . . . . . . . .

40

4.2.3

Detuning of optical cavities . . . . . . . . . . . . . . . . . . . . . . . .

40

4.2.4

Access to cavity data . . . . . . . . . . . . . . . . . . . . . . . . . . .

40

4.3 Lenses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

41

4.3.1

AF

4.2.1

DR

. . . . . . . . . . . . . . . . . . .

3.3 Lines describing components and surfaces

30

Access to lens data . . . . . . . . . . . . . . . . . . . . . . . . . . . .

41

4.4 Closely positioned components or surfaces . . . . . . . . . . . . . . . . . . .

41

4.5 Overlapping components . . . . . . . . . . . . . . . . . . . . . . . . . . . .

42

4.6 Save and restart of beams . . . . . . . . . . . . . . . . . . . . . . . . . . . .

42

4.7 Thermal lensing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

42

The O PTO C AD output data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

43

5.1 The output specified by print or write . . . . . . . . . . . . . . . . . . .

43

5.1.1

Precision and range for real values . . . . . . . . . . . . . . . . . . . . .

43

5.1.2

Key rd : Radial distance of hit . . . . . . . . . . . . . . . . . . . . . .

45

5.1.3

Key lb : Surface or component labels . . . . . . . . . . . . . . . . . .

45

5.1.4

Keys ipp and tpp : Optical path for phase propagation . . . . . . . . .

45

5.1.5

Keys gp.. and Gp.. : Gouy phases . . . . . . . . . . . . . . . . . .

45

5.2 The output of cavity data . . . . . . . . . . . . . . . . . . . . . . . . . . . .

46

5.2.1

Text output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

46

5.2.2

Eigenrays of optical cavities . . . . . . . . . . . . . . . . . . . . . . . .

46

5.3 The output of lens data . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

47

5.4 The output of interference data . . . . . . . . . . . . . . . . . . . . . . . . .

47

19 Jul 2013 16:41

optocad_ug_0.93i

C ONTENTS
48

The generated F INESSE input file . . . . . . . . . . . . . . . . . . . . . . . . . . .

48

The generated WAVE P ROP file . . . . . . . . . . . . . . . . . . . . . . . . . . . .

49

Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

51

8.1 A sample Fortran program . . . . . . . . . . . . . . . . . . . . . . . . . . .

51

8.2 A simple optical cavity example . . . . . . . . . . . . . . . . . . . . . . . . .

52

8.3 Various cavity and interferometer examples . . . . . . . . . . . . . . . . . . .

54

8.4 A power-recycled simple Michelson interferometer . . . . . . . . . . . . . . .

57

8.5 A power-recycled Michelson interferometer with FP arm cavities . . . . . . . .

61

8.6 A triangular cavity inserting preset components . . . . . . . . . . . . . . . . .

62

8.7 Polarizing beam-splitters . . . . . . . . . . . . . . . . . . . . . . . . . . . .

64

8.8 EOM and AOM optical modulators . . . . . . . . . . . . . . . . . . . . . . .

66

AF

5.5 O PTO C AD statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

68

8.10 An all-reflective Fabry-Perot cavity . . . . . . . . . . . . . . . . . . . . . . .

70

8.11 An all-reflective Michelson interferometer

. . . . . . . . . . . . . . . . . . .

72

8.12 Findng the best curvatures for a spherical lens . . . . . . . . . . . . . . . . .

74

8.13 Finding the best shape for an aspherical lens . . . . . . . . . . . . . . . . . .

76

8.14 A parabolic telescope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

78

8.15 DO-loop to find best mode matching into a cavity . . . . . . . . . . . . . . . .

81

DR

8.9 A curved optical diffraction grating . . . . . . . . . . . . . . . . . . . . . . .

optocad_ug_0.93i

19 Jul 2013 16:41

I NTRODUCTION

1 Introduction
O PTO C AD is a Fortran 95 module consisting of a collection of subroutines that can
trace one or more Gaussian (orthogonal astigmatic) TEM 00 beams through an optical set-up that
even may contain aspherical surfaces,
calculate the characteristic data of all ray segments found,
interfere beams, if this was indicated by the user,

calculate (and apply) thermal lensing in the component substrates,


calculate the characteristic data of all optical cavities indicated by the user,
calculate the characteristic data of all lenses specified by the user,

plot all components of the optical set-up together with the ray segments found by the program,
either at once, or in a step-by-step mode,

AF

generate a *.kat input file and call F INESSE.

generate a Fortran file for WAVE P ROP.


O PTO C AD can be used in two ways: either by tracing one (or more) Gaussian beams in order to see, how
the Gaussian beam parameters evolve from the start beam through the whole optical set-up, or to operate
in a kind of ray-tracing mode using a pencil of rays that also allows to see image defects like spherical
aberration or koma.

1.1 Input to O PTO C AD

DR

The primary item of O PTO C AD is the optical surface, usually the interface between two different optical
media. The input to O PTO C AD essentially consists of a list of surfaces, specifying their principal parameters and the actions to be taken, when a beam hits a surface. Several surfaces usually form an optical
component, surrounding a certain optical medium that can be characterized by up to three parameters:
the index of refraction and, optionally, the absorption per unit length and the sag of the wavefront (caused
by thermal lensing) per Watt of absorbed power.
O PTO C AD is essentially 2-dimensional, i. e. all optical surfaces are assumed to be perpendicular to the
plane of the set-up which also is the plane of the drawing. Thus all ray segments are in this plane too,
although the beam data are calculated in both, the tangential plane (the plane of the set-up) and the
sagittal plane. Also the curvature of the optical surfaces can be specified individually for this two planes,
i. e. they can have astigmatism.
The input of the characteristics of the optical set-up can occur in two ways: Either via an (external)
ASCII file (called .ocd file), or through an internal character array (called ocd array) defined in the
users main Fortran program. These contain one line per surface to be defined, several successive lines
forming a component. Also the initial beam(s) are defined in this way.

1.2 Principle of operation

The routine oc_input reads the input data and determines the position, orientation and extension of
all surfaces and components in the optical set-up. oc_trace then follows the initial light beam(s) by
extending a straight line in the given beam direction and finding all surfaces crossed by this line. The
surface that has the minimum distance from the origin of the beam is considered to be hit by the beam
and taken as the target surface. All relevant data for this ray segment are calculated and stored. The next
step depends on the action specified for this surface by the user. Typical actions are reflect, transmit, split
or dump. With transmit the beam either enters or leaves the component the surface belongs to, and with

19 Jul 2013 16:41

optocad_ug_0.93i

1.3

O UTPUT

FROM

O PTO C AD

I NTRODUCTION

split the beam is usually split into a reflected and a transmitted beam. This process is repeated until the
beam hits a dumping surface. Then the beams previously split off are followed in the sequence they are
generated. Should there be more than one initial beam specified the whole procedure is repeated for all
initial beams.

In a particular mode of operation O PTO C AD can do a kind of ray tracing. In this mode also imaging
defects (lens aberrations) can be seen. Instead of a single run through the optical set-up several runs
occur in a loop over oc_bind , oc_input , oc_trace and oc_beam . oc_bind changes the
initial beam in position or angle and oc_input re-reads the data for the initial beam. oc_trace
traces this beam and oc_beam displays the beam axis on its way through the set-up. Thus, instead of
a single beam a pencil of rays is traced, hence also showing differences between rays close to the optical
axis and far from it. See the examples SPHERICAL_LENS and ASPHERICAL_LENS on page 74ff.

1.3 Output from O PTO C AD

1.4 Using O PTO C AD

AF

The output occurs in two ways also: On the one side there can be output to the terminal, into a file, or
into a character array, showing the numerical data of the ray segments and cavities found by O PTO C AD.
The composition of this output can be determined by the user. On the other side a PostScript output file
can be generated showing all surfaces and components, and the ray segments found by O PTO C AD. Also
the appearance of this PostScript file can, to a large extent, be influenced by the user. In particular, the
ray segments can be drawn in their true shape, i. e. converging or diverging or both, showing the beam
waists with their appropriate diameter.

In order to utilize O PTO C AD the user has to write a little Fortran 90/95 program that calls the O PTO C AD
subroutines in the proper sequence. Sample files can be found in Section 8 on page 51ff. The first statement in such a Fortran file needs to be

DR

use optocad
Optionally you can add the line(s)
use rsutil
use rsplot

and/or

if you want to use any routines of the packages RSUTIL and RSPLOT in your (main) Fortran program.
Since O PTO C AD internally also uses RSUTIL and RSPLOT these modules must be available (and compiled) in any case.
A call of oc_init initializes O PTO C AD which, in turn, initializes RSPLOT. 1 A call of oc_frame
sets up a frame (a coordinate system) for the plot output. There can be several frames on one page
provoked by multiple calls of oc_frame . Certain parameters might be set supplying some physical
data and controlling the O PTO C AD behaviour. This is done by the subroutine oc_set . Most important
here are the light wavelength and the indices of refraction. Next would usually come the input of the
optical-component data, done by a call of oc_input . Only now the actual tracing of the light beam(s)
can be started by calling oc_trace , followed by oc_beam which plots all ray segments found. This
sequence of oc_trace and oc_beam should be repeated for all input beams specified in the opticalcomponent data. The plotting of the interior of the components is already done by oc_input . The
routine oc_surf plots all surfaces in the set-up and can be called at any time after oc_input , but it
1

Any direct calls of RSPLOT routines must not occur before the call of oc_init . Particular attention is demanded when
using the RSPLOT subroutine ps_insert . Importing an external PostScript file (e. g. to insert a logo into the PostScript file
generated by O PTO C AD) should occur before the first call of oc_frame only! The actual insertion can take place later, and
you should call it with clip = 0, if the figure is inserted outside the frame.

optocad_ug_0.93i

19 Jul 2013 16:41

I NTRODUCTION

1.5

P UBLIC

VARIABLES AND PARAMETERS

seems reasonable to make that call after plotting the ray segments. The program must be terminated by
a call of oc_exit which also closes the PostScript output file, unless there was none.
It is possible to repeatedly call oc_init in order to produce more than one PostScript output page. In
such a case the finishing of the previous page is implicitly done by oc_init , and there should only
be one call of oc_exit at the very end of the program. Any recall of oc_init re-initializes all
parameters relevant for O PTO C AD, except for the paper format and orientation.

1.5 Public variables and parameters


The four real-valued parameters pi , twopi , deg (= pi/180) and sol (speed of light in m/s) and
the character string optocad_version are made available to the public. Furthermore, the derivedtype arrays cavities and lenses are accessible by the user.
The derived-type cavities has the structure:
is
ib
ir
dt
ph
fsr=0.
bw=0.
fi=0.
gp(2)=0.
w0(2)=0.
w1(2)=0.
z0(2)=0.
z1(2)=0.
c1(2)=0.
mm(2)=0.
ms(2)=0.
ma(3)=0.
mc(2)=0.
m
n=0
ni=0

!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!

index of cavity entrance surface


index of current input beam
ray segment hitting the cavity first
detuning of cavity (fraction of FSR)
cavity round-trip phase
free spectral range
bandwidth
finesse
Gouy phase contributions for t + s plane
waist radius (tang. and sagi. plane)
beam radius at entrance surface (t + s)
Rayleigh range (tang. and sagi. plane)
pos. of entrance surface rel. to waist
wavefront curvature at entrance surface
mode matching (for perfect alignment)
mode spacing (tang. and sagi. plane)
misalignment w.r.t. cavity eigenray
mismatch for closing the cav. (pos, ang)
mode of cavity treatment
index of nested cavity
number of iterations for cavity eigenray

AF

type, public :: cavity


integer
::
integer
::
integer
::
real
::
real
::
real
::
real
::
real
::
real
::
real
::
real
::
real
::
real
::
real
::
real
::
real
::
real
::
real
::
integer, private ::
integer, private ::
integer, private ::
end type cavity

DR

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

The variable names that are followed by (2) are two-element arrays that contain (except for lines 18
and 19) the value for the tangential plane at index 1 and for the sagittal plane at index 2 . In case of the
variable gp the contributions to the accumulated Gouy phase for a round trip through the cavity from
the tangential and sagittal planes are given; the actual Gouy phase is the sum of this two values. Different
Gouy phases in the two planes cause different mode spacings, hence also the two values for ms . The
variable ma contains the misalignment in position and angle between the cavity input beam and the
cavity eigenray. Similarly, mc contains the mismatch of the beam returning from a round trip through
the cavity with respect to the beam starting at the cavity input surface. (See Section 5.2.2 on page 46
for details.) The last three values (lines 20 to 22) are not accessible by the user, they are for internal use
only.
The cavities are numbered in the sequence they are specified (by the action letter c ) in the ocd file or
array. You can access any of the cavity values by writing cavities( n )%<keyword> , where n
is the number of the cavity. The values are given in the units of length and angle selected at the call of
OC_INIT . To inquire the total number of cavities found, use size(cavities); to get the number
of an individual cavity use the integer function oc_cavity(<label> ), specifying the cavity by
the label of its first surface. E. g., if you want to set the variables fsr and w0t (the waist radius in the
19 Jul 2013 16:41

optocad_ug_0.93i

1.6

S IGN

CONVENTION IN

O PTO C AD

I NTRODUCTION

tangential plane) of your main Fortran program to the values calculated by O PTO C AD for cavity 1 you
use the two statements
fsr=cavities(1)%fsr
w0t=cavities(1)%w0(1)

! get free spectral range from OptoCad


! get waist radius in tang. plane from OptoCad

Also see Example 8.15 on page 81.

type, public :: lenses


character(29)
:: lb=
real
:: fl(2)=0.
real
:: d(2)=0.
real
:: c(2,2)=0.
real

:: dp(2,2)=0.

end type lenses

!
!
!
!
!
!
!

label
focal length, tang (1) & sagi (2)
thickness, at center (1) and rim (2)
curvature, tang (1) & sagi (2),
... first (1) and second (2) surface
pos. of principal plane, tang (1) &
... sagi (2), 1st (1) & 2nd (2) plane

AF

1
2
3
4
5
6
7
8
9

The derived-type lenses has the following structure:

For the component fl the index refers to tangential and sagittal plane, for d to the thickness of the
lens at the center and the rim, for c and dp the first index refers to tangential and sagittal plane and the
second to the first and the second surface of the lens. dp is the distance of the principal planes from the
first surface of the lens.
The access of any of the lens values occurs in an analogous way to that for cavities. To inquire the number
of lenses found, use size(lenses) , to get the number of a lens by the label of its first surface use
the integer function oc_lens(<label> ) .
Please note: After a call of OC_EXIT with the argument cc either being not present or having a
value 0 the arrays cavities and lenses are not accessible anymore since OC_EXIT then
deallocates these arrays.

DR

1.6 Sign convention in O PTO C AD

In the context of optical surfaces (e. g. of mirrors and lenses) and wavefronts the sign convention for
curvatures and curvature radii become important. In O PTO C AD the position of the center of curvature
with respect to the current position determines the sign. A wavefront radius or curvature is considered
positive for a converging beam, i. e. if the center of curvature is following (down beam) the current
position. And consequently, an optical surface with a positive radius or curvature appears convex to the
incoming beam. Here, incoming beam means a beam that approaches a component surface from outside
the component. Hence, the curvatures of both surfaces of a biconvex lens are considered to be positive.

1.7 Installation of O PTO C AD


1.7.1

Installation by shell scripts

Prerequisite for the installation is the availability of a Fortran 95 compiler on your system. The zipped
O PTO C AD package contains two shell scripts for easy installation of O PTO C AD. Use INSTALL.sh
for installation on Linux/Unix/Mac-OSX systems and INSTALL.cmd for Windows systems. Both
install scripts can do the compilation for GNU g95, GNU GFortran, NAG nagfor, Intel ifort and Lahey/Fujitsu lf95 compiler, INSTALL.sh also for IBM xlf95 and Sun f95 .
These scripts place the command occr (O PTO C AD Compile and Run) into a directory that is listed in
the environment variable PATH , hence you can call occr from any directory. The command occr
should be followed by your O PTO C AD Fortran file and, if necessary, by an .ocd file. This Fortran file
will then be compiled, linked and run.
optocad_ug_0.93i

19 Jul 2013 16:41

I NTRODUCTION
1.7.2

1.7

I NSTALLATION

OF

O PTO C AD

Compilation

For those who cannot or dont want to use one of the install scripts mentioned above the following gives
some hints for the compilation of the various files of the O PTO C AD package.
Unfortunately, the various compiler vendors have different notions about the reasonable and allowed
source file extensions. The Fortran modules RSUTIL, RSPLOT and O PTO C AD use the extension .F95 .
This means, depending on the compiler you are using, you may have to rename the extensions of this
modules, e. g. for the Intel compiler to .F90 .

For the compilation of RSUTIL please consult the RSUTIL users guide. The modules RSPLOT and
O PTO C AD can be compiled together (but need not); double precision floating-point arithmetic should be
used. O PTO C AD has been tested using the following compilers and options:
GNU GFortran compiler release 4.5.0 20091001 (rev. 152364 or newer) 2 :
GFortran -c -fdefault-real-8 -fno-backslash optocad.F95

AF

GNU g95 compiler (version as of 2005-06-24 or newer) 3 :


g95 -c -r8 -fno-backslash optocad.F95

NAGWare f95 compiler release 5.2 (edit 733 or newer) :


f95 -c -O -r8 -f2003 rsplot.F95 optocad.F95
Intel Fortran compiler release 9.1 (or newer) :
ifort -c -r8 rsplot.F90 optocad.F90

Lahey/Fujitsu Fortran 95 compiler release L6.2 or newer :


lf95 -c --dbl --ntrace --f95 --pca rsplot.F95 optocad.F95
IBM XL Fortran compiler release 9.1.0.4 or newer :
xlf95_r -c -qfree=f90 -O -qnoescape -qrealsize=8 -qsuffix=cpp=F95
rsplot.F95 optocad.F95
Sun Fortran 95 compiler release 7.1 or newer :
f95 -c -O -xtypemap=real:64 rsplot.F95 optocad.F95

DR

Also your Fortran main program needs to be compiled with the same set of options. E. g., when using
the NAGWare f 95 compiler the compile-and-link command for the file sample.f90 would look like
f95 -r8 rsutil.o rsplot.o optocad.o -o sample sample.f90
and for the GNU g95 compiler

g95 -r8 -fno-backslash rsutil.o rsplot.o optocad.o -o sample sample.f90


and correspondingly for the other compilers. These commands only work if the files rsplot.o ,
rsplot.mod , optocad.o and optocad.mod (and also rsutil.o and rsutil.mod ) are
all in the current directory. Otherwise certain paths must be set.
When using the compiler option -DF2003 (in fact a preprocessor variable) several operations are
somewhat simplified, e. g. the use of the functions I2C , R2C and N2C . Currently this is supported,
e. g., by the NAG Fortran compiler release 5.2, the Intel compiler release 12.0 and the IBM XLF compiler
release 12.1 .
1.7.3

Editing .ocd files

For those who are using Emacs or XEmacs editors the file .optocad-mode.el is available providing
simple syntax highlighting to ease editing of .ocd files.
2
3

The GNU GFortran compiler can be downloaded from gcc.gnu.org/wiki/GFortran .


The GNU g95 compiler can be downloaded from www.g95.org .

19 Jul 2013 16:41

10

optocad_ug_0.93i

T HE O PTO C AD

SUBROUTINES AND FUNCTIONS

2 The O PTO C AD subroutines and functions


2.1 Overview
Subroutine to initialize O PTO C AD.

OC_FRAME

Subroutine to initialize RSPLOT and set up a frame for the plot.

OC_SET

Subroutine to set certain parameters important for the operation of O PTO C AD.

OC_BIND

Subroutine to bind a keyword to a symbolic variable for use in the data file or array.

OC_INPUT

Subroutine to read in the data of the optical components.

OC_TRACE

Subroutine to trace a Gaussian beam through the optical set-up.

OC_BEAM

Subroutine to plot all ray segments found by OC_TRACE .

OC_SURF

Subroutine to plot the surfaces of the optical components and their labels.

AF

OC_INIT

OC_FINESSE Subroutine to generate a *.kat input file and call F INESSE. 4


Subroutine to generate a Fortran file for WAVE P ROP. 5

OC_RESET

Subroutine to reset certain parameters to allow repeated calls of OC_TRACE .

OC_MSG

Subroutine to write messages, by default to stdout or stderr .

OC_EXIT

Subroutine to terminate O PTO C AD and close the PostScript output file.

OC_CAVITY

Integer function returning the sequential number of a cavity.

OC_LENS

Integer function returning the sequential number of a lens.

2.2 Details

DR

OC_WP

On the following pages you will find a description of all O PTO C AD routines in alphabetical order. Some
of the subroutine arguments are mandatory (shown in bold face ), others are optional (shown in
italics ). For all optional arguments a default is set by O PTO C AD.

F INESSE is a Frequency domain INterferomEter Simulation SoftwarE, written by Andreas Freise.


WAVE P ROP is a program to simulate the propagation of EM waves by FFT. IT can be downloaded from
www.rzg.mpg.de/ ros/ .
5

optocad_ug_0.93i

11

19 Jul 2013 16:41

OC_BEAM

OC_BEAM

Subroutine OC_BEAM (wb, lc, lp, lw, fill, pst, cst, rns, rnc,
pthh, frm, frs, lrs, step, pwi, cbs, mcp)

Subroutine to plot all ray segments found by OC_TRACE , tracing the current input beam.
Real, specifying the multiple of the nominal beam radius (1/e 2 of intensity) at which
contour lines should be drawn or, if fill is present, that should be filled with color.
For wb = 0., or if wb is not present, the beam axis is drawn, optionally together with the
waist indicators if pwi is not present or set appropriately.

lc

Integer, selecting the index of a predefined color for drawing the beam axis or contour. (See
PS_COLOR in the RSPLOT users guide.) Default is the currently set color, initially black
( lc = 1 ). A negative value suppresses the drawing of the beam axis.

lp

Integer, selecting the index of a predefined line pattern for drawing the beam axis or
contour. (See PS_PATTERN in the RSPLOT users guide.) For the beam contour, default
is the currently set line pattern, initially a solid line. For the beam axis, the default is the
pattern [50 20 10 20]0. .

lw

Real, specifying the line width (in mm) for drawing the beam axis or contour. Default is the
value of cslw , initially 0.2 mm .

fill

Integer, selecting the index of a predefined color by which the beam area will be filled. (See
PS_COLOR in the RSPLOT users guide.) If also lc or lp or lw are present, the beam
area will be filled and the contour plotted. The color actually used also depends on the
arguments pst and cst . Default is no fill.

pst

Real array, specifying an arbitrary number of steps of decreasing light powers at which the
color (saturation) of the plot should change. See below for further details.

cst

Integer array, specifying an arbitrary number of color indeces to which the color
(saturation) of the plot should change at the respective power step given by pst . See
below for further details.

rns

Real, specifying the font size (in mm) for plotting the ray-segment numbers. This will be
effective only when plotting the beam axis, i. e. with wb = 0. , and is meant mainly for
debugging. The numbers will be plotted at the right side of the ray segment (looking along
the ray) close to the axes, at 70 % down the segment, i. e. 30 % before the target surface.
Default font size is 3 mm. If neither rns nor rnc are present no numbers will be plotted.

rnc

Integer, selecting the index of a predefined color for plotting the ray-segment numbers (see
rns ). Default is rnc = 1 (black). If neither rnc nor rns are present no numbers will
be plotted.

pthh

Real, specifying a power threshold for plotting the ray segments. Default is pthh = 0. ,
i. e. all ray segments are plotted.

frm

Integer, selecting the frame for which the ray segments should be plotted. If frm is not
present the ray segments for all frames will be plotted.

frs

Integer, selecting the first ray segment to be plotted. Default is frs = 1 .

lrs

Integer, selecting the last ray segment to be plotted. By default all ray segments following
frs are plotted.

step

Integer. Specifying step causes O PTO C AD to draw the successive ray segments
stepwise, starting at frs and ending at lrs , whereas the plotting of all other items is not
affected. In order to highlight the respective last ray segment of a page, the value assigned
to step specifies the index of a predefined color that is used to draw this last segment.

DR

AF

wb

19 Jul 2013 16:41

12

optocad_ug_0.93i

OC_BEAM

OC_BEAM
(See PS_COLOR in the RSPLOT users guide.) This stepwise mode is meant mainly as an
aid for setting up the action strings for certain surfaces in complicated cases, or for
demonstrating the path of the light in a presentation. See the examples opmc_step and
comic_step in the subdirectory examples .
Character string, specifying which waist indicators should be plotted, t or T for the
tangential plane, or s or S for the sagittal plane (or both). Default is pwi = ts ,
i. e. both waist indicators are plotted. pwi is effective only for wb = 0. or if wb is not
present.

cbs

Real, specifying a multiple of the nominal beam radius (like wb ) for which it is tested
whether all the surfaces hit by this beam have a sufficient size. A warning message is
issued for all surfaces not big enough. Default is cbs = 0. , i. e. no test is made.

mcp

Integer (0, 1, or 2), specifying the mode of plotting the beam contour. See below for details.
Default is the value set by OC_SET , initially mcp = 1 .

pwi

AF

The waist indicators for tangential and sagittal plane are plotted together with the beam axis ( wb = 0. ).
Setting lc < 0 with this call suppresses the drawing of the beam axis.
The power and color steps given by pst and cst are effective for the beam axis or contour if fill
is not present, otherwise for the beam area to be filled with color. For light powers above the first value
of pst the color given by lc or fill is used, for powers below or equal to the specified steps the
respective color steps of cst are used.

DR

If only pst is present but not cst a number of color steps equal to the extent of pst is generated
by linear interpolation between the color given by lc or fill and white. (See example OPMC on
page 52.) In such a case, the end color white actually is not painted but the plotting is suppressed for the
corresponding range of power, i. e. previous plots are not being overlapped. If only one color is specified
by cst this is used instead of white as the end value of the interpolation. If more than one color is
specified the number steps used is given by the minimum of the extents of pst and cst , and a warning
is issued if these extents do not agree. A color index < 0 suppresses the plotting for the corresponding
range of power.
Using the optional argument frm allows ray segments to be plotted with individual parameters for the
different frames. One can, e. g., change the color of the beams or switch on or off the plot of ray-segment
numbers.
For mcp = 0 the contour is plotted regardless
whether a surface hit by the beam has a sufficient
size ( rd ) or not. For mcp = 1 plotting the contour
is stopped for that parts of the contour that does not
fit on a surface; from the next surface on the contour
is completed again. With mcp = 2 this completion
does not occur. This is illustrated in the figure on the
right.

The beam contour is plotted for relative beam radii


1w , 2w and 3w . The left part of the beam contour
for 3w doesnt fit completely on surface 1, and on
surface 2 even the contour for 1w exceeds its size.

mcp = 0

1
3

4
2

mcp = 1

6
78

1
3

4
2

mcp = 2

6
78

1
3

4
2

6
8

Roland Schilling, 02 Feb 2012, show_mcp.ps

optocad_ug_0.93i

13

19 Jul 2013 16:41

OC_BEAM

OC_EXIT

Subroutine OC_BIND (key, var)


Subroutine to bind a keyword to a scalar value or variable of type integer, real or character string, or to a
variable of type character array.
Character string, specifying a keyword that should be bound to the variable var .

var

Scalar value or variable of type integer, real or character, or a character array, that is to be
related to the keyword key .

key

The keyword key can then be used like a symbolic variable in ocd files or arrays, whereas the direct
use of symbolic variables is not feasible.

AF

Please note: The value that is actually associated with the keyword key is the value the variable var
did have at the point the OC_BIND command was executed. This does not hold for the case of a
character array, where the key represents a pointer to that array. If var represents a numerical value
the data type of the variable associated with key is defined by the data type of var , i. e. if var is a
real numerical constant it must contain a decimal point or the letter e or E in order to be recognized
and stored as such.
If var is a character string (of maximum length 64) it can serve as an action string. When using it in
this sense the keyword has to be immediately preceeded by an @-sign in order to avoid misinterpretation
as a directly specified action string. If var denotes a character array (of fixed character length 128),
this may contain the data of a preset component. OC_BIND can be executed prior to the (first) call of
OC_INIT . (See Subsection 3.1 on page 25 and the examples TRC on page 62 f, GRATING, ARFPC
and ARMIN on page 68 ff, and MM_LOOP on page 81 f.)

Integer Function OC_CAVITY (label)


label

DR

Function returning the sequential number of a cavity by the label of its first surface.
Character string, specifying the label of the first surface of a cavity.

Subroutine OC_EXIT (cc)

Subroutine to terminate O PTO C AD and close the PostScript output file, and to print out some statistics.
cc

Integer, specifying the Continuation Code. cc = 0 terminates O PTO C AD and closes the
PostScript file. cc = 1 terminates O PTO C AD but leaves open the PostScript file which can
be useful if O PTO C AD is used together with, e. g., WAVE P ROP. cc < 0 is the same as
cc = 0 , but suppresses the print of the O PTO C AD statistics. Default is cc = 0 .

The call of this routine can only be omitted, if there was no call of OC_FRAME or if plot = 0 was set
at the call of OC_INIT .

19 Jul 2013 16:41

14

optocad_ug_0.93i

OC_FINESSE

OC_FRAME

Subroutine OC_FINESSE (katin, ib, frs, lrs, katout, options)


Subroutine to generate a *.kat input file for the initial beam ib and call F INESSE.
katin

Can either be a scalar character string, specifying the name of an input file, or the name of a
character array, defined inside the users main Fortran program. These external or internal
files should contain additional directives for the F INESSE input file, e.g. xaxis ... ,
put ... or pd ... . (Hint: In case of an internal character array, before filling with
data make sure the array contains blanks only.)

If katin is not present or empty, the call of F INESSE is suppressed.

Integer, specifying the initial beam for which a F INESSE input file should be generated.
Default is ib = 1 .

frs

Integer, selecting the first ray segment of the selected initial beam to be used for generating
the F INESSE input file. Default is the first ray segment of the selected initial beam.

lrs

Integer, selecting the last ray segment of the selected input beam to be used for generating
the F INESSE input file. Default is the last ray segment of the selected initial beam.

katout

Character string, specifying a filename for the F INESSE input file to be generated. The
extension .kat is automatically appended to the given filename. If katout is not
present or if it is present but empty the name of the O PTO C AD Fortran file is used with an
_ appended and followed by the number of the current input beam.

AF

ib

options Character string, specifying a possible set of options for the call of F INESSE, e. g.
options=-max .
OC_FINESSE should be located after the call of OC_TRACE but before a potential next call of
OC_RESET(2) or OC_EXIT . It can be called several times for different initial beams; the generated kat files are distinguished by appending an _<ib> to the O PTO C AD filename.

DR

For details about the generated kat file see Section 6 on page 48 and Example 8.4 on page 57ff .

Subroutine OC_FRAME (xbeg, ybeg, xend, yend, xbl, ybl, scale,


nfr, ax, d_tl, d_tm, exp, glc, glp, glw, gld, clip, fill, unit)

Subroutine to initialize a frame of Cartesian coordinates. Can be called multiple times per page to
establish several frames on the same page, distinguished by the frame number nfr .
xbeg

Real, specifying the start value of the frame (in user coordinates) in x direction.

ybeg

Real, specifying the start value of the frame (in user coordinates) in y direction.

xend

Real, specifying the end value of the frame (in user coordinates) in x direction.

yend

Real, specifying the end value of the frame (in user coordinates) in y direction.

xbl

Real, specifying the bottom-left corner x value of the frame in paper coordinates.
Default is 25 mm .

ybl

Real, specifying the bottom-left corner y value of the frame in paper coordinates.
Default is 25 mm .

scale

Real, specifying the scale of the drawing, i. e. the ratio of lengths on the paper to that in
user coordinates (in the optical set-up), like on a map. Default is scale = 1.

nfr

Integer, output only. It returns the reference number for this frame. (Will be counted up
automatically with each call of OC_FRAME .)

optocad_ug_0.93i

15

19 Jul 2013 16:41

OC_FRAME

OC_FRAME
Character string, specifying one or more default axes to be plotted. A first x or X
draws an x axis at the bottom of the frame, a first y or Y draws a y axis at the left
edge of the frame. For a lowercase x or y the axis only has tic marks, for an
uppercase X or Y the axis also has tic labels. You can specify xy to get both,
and even double x and/or y to get second axes to be plotted at the top and/or right edge of
the frame. In case you want a second axis only, use a period as kind of a placeholder
directly preceeding the letter that characterizes the type of axis. E. g., .Y will produce a
single y axis (with annotation) on the right-hand side of the frame. Default is a complete
frame ( ax = XxYy ) with tic labels at the bottom and the left side. An empty string
( ax = ) suppresses the plot of any axes.

d_tl

Real, specifying the minimum distance (in mm) between successive tic labels on the axes.
It actually will not be smaller than the distance of the major tic marks. A given value
remains valid for later calls of OC_FRAME unless a new value is specified. Default is
d_tl = 25 mm .

d_tm

Real, specifying the minimum distance (in mm) between successive minor tic marks on the
axes. A given value remains valid for later calls of OC_FRAME unless a new value is
specified. Default is d_tm = 5 mm .

exp

Integer, specifying the number representation for the tic labels on the axes. When the
absolute value of the numbers is > 10 |exp| or < 10|exp| (i. e. with more than |exp| digits
after the decimal point) an appropriate power of ten is split off and notified at the end of the
line containing the axis title. For exp < 0 and if no power of ten is split off the zero left of
the decimal point is suppressed for numbers less than one. The default is exp = 5 .

glc

Integer, selecting the index of a predefined color for drawing the grid lines. (See
PS_COLOR in the RSPLOT users guide.) If also ax is present or at its default, but not
gld , grid lines are plotted at the positions of the tic marks of those axes that are specified
in ax with a capital letter. Default is glc = 14 (light gray).

glp

Integer, selecting the index of a predefined line pattern for drawing the grid lines. (See
PS_PATTERN in the RSPLOT users guide.) If also ax is present or at its default, but not
gld , grid lines are plotted at the positions of the tic marks of those axes that are specified
in ax with a capital letter. Default is a solid line, i. e. glp = 0 .

glw

Real, specifying the line width (in mm) for drawing the grid lines. If also ax is present or
at its default, but not gld , grid lines are plotted at the positions of the tic marks of those
axes that are specified in ax with a capital letter. Default is glw = 0.2 mm .

gld

Real, enabling the plotting of grid lines and specifying their distance (in user coordinates).
See example OPTMOD on page 66.
If gld is present, the plotting of grid lines at the positions of the tic labels requested by
the simultaneous presence of glc , glp or glw is omitted.

clip

Integer, switching off ( clip = 0 ) or on ( clip = 1 ) clipping at the size of the frame.
Default is clipping on ( clip = 1 ).

fill

Integer, selecting the index of a predefined color by which the frame will be filled.
(See PS_COLOR in the RSPLOT users guide.) Default is no fill.

unit

Character string, specifying the type of axis ( x or y or both) for which the length
unit should be plotted at the end of the axis.

DR

AF

ax

Paper coordinates are always in millimeters, user coordinates in the unit specified at the call
of OC_INIT .
19 Jul 2013 16:41

16

optocad_ug_0.93i

OC_FRAME

OC_INIT

Using the argument ax is an easy way to draw a set of axes using begin and end values as given with
the call of OC_FRAME . The lengths of the axes are calculated from the ranges in user coordinates using
scale . If you are not satisfied with the defaults set ax = and use the RSPLOT routine PS_AXIS .
O PTO C AD generates four auxiliary surfaces for each frame along the outlines of the frames. These are
transparent to the beams (action n ), but produce a line of output like a regular surface when hit by the
beam. The associated surface numbers are < 4 .

O PTO C AD also erects a rectangular fence enclosing all frames and surfaces defined by the user. This
fence is opaque for beams coming from inside, but transparent for beams from outside. The associated
surfaces have the numbers 1 to 4 .

Subroutine OC_INIT (pform, psize, rot90, plot, pid, unit, psout,


prt)

AF

Subroutine to initialize O PTO C AD.

Character string, selecting a predefined paper format to specify the plotting area. Examples
are letter_p for letter format in portrait orientation, or A4_L (the default) for
A4 paper in landscape orientation. (See Table 1 .) pform is not case-sensitive.

psize

Specifies the plotting area on the paper in x and y direction as a two-value real array, e. g.:
psize=(/270., 180./) . The values must be given in millimeters. For the default
see argument pform . psize has precedence over the value set by pform .

rot90

Integer, specifying the number of 90 rotations of the paper. The default is given by the
default for pform , unless psize is present, then the default is 0 . rot90 has
precedence over the value set by pform .

plot

Integer, allowing to switch plotting on (1) or off (0). The latter entirely suppresses the
generation of a PostScript file. Default is plot = 1 .

pid

Character string that will be plotted at the lower-left corner of the plot. It is meant as an
identification of the plot and may contain any text. See PS_INIT and PS_TEXT in the
RSPLOT users guide. Default is pid = \fi1\fs2.\user, \date, \file , if
the environment variable USERNAME is set, otherwise it is
pid = \fi1\fs2.OptoCad (version ...), \date, \file .

unit

Character string that defines the units of length and angle. The length unit is used for
specifying position and size of surfaces/components and initial beams, radii of curvature,
focal length etc., and for the positioning of their labels (both in the ocd file or array), as
well as for the user coordinates at calls of OC_FRAME . It is also effective when specifying
values by OC_SET like lambda, abs, tlc, etc. The angle unit is used for
specifying of phase shifts, the orientation of surfaces/components and initial beams, and of
coordinate systems.

DR

pform

unit is a comma- or blank-separated list of the keywords m (meter), cm (centimeter),


mm (millimeter), deg (degree) or rad (radian). The selected units are not effective for
all direct calls of RSPLOT routines. Default is unit = m, deg .
psout

Character string, specifying a filename for the PostScript output file to be generated by
O PTO C AD. The extension .ps is automatically appended to the given filename. Default
is the basename of the Fortran file. Also see the argument fileout of the routine
PS_INIT in the RSPLOT users guide.

prt

Character string controlling the output that occurs via OC_MSG . To enable normal
messages prt must contain the letter n , to enable warning messages it must contain the

optocad_ug_0.93i

17

19 Jul 2013 16:41

OC_INIT

OC_INPUT
letter w , and to enable error messages it must contain the letter e . Any combination is
possible. If prt contains the letter X it is treated as if prt is not present.
Default is prt = nwe .

Portrait

Landscape
size

format

size

A0_P
A1_P
A2_P
A3_P
A4_P
A5_P
A6_P
LETTER_P
LEGAL_P

841 mm 1189 mm
595 mm 841 mm
420 mm 595 mm
297 mm 420 mm
210 mm 297 mm
149 mm 210 mm
105 mm 149 mm
8.5 in 11 in
8.5 in 14 in

A0_L
A1_L
A2_L
A3_L
A4_L
A5_L
A5_L
LETTER_L
LEGAL_L

1189 mm 841 mm
841 mm 595 mm
595 mm 420 mm
420 mm 297 mm
297 mm 210 mm
210 mm 149 mm
149 mm 105 mm
11 in 8.5 in
14 in 8.5 in

AF

format

Table 1 Predefined paper formats.

If OC_INIT is called with plot = 0 RSPLOT is not initialized and no PostScript file is generated. In
such a case also no other RSPLOT routines should be called (unless PS_INIT is called explicitly); the
subroutines OC_FRAME, OC_BEAM and OC_SURF are skipped automatically and a call of OC_EXIT
is not required. In such a case ( plot = 0 ) the overall fence erected by O PTO C AD (see OC_INIT or
OC_FRAME ) is determined by the outermost surfaces, and these may then be covered by the fence.

DR

It is possible to repeatedly call OC_INIT in order to produce more than one PostScript output page. In
such a case the finishing of the current page is implicitly done by an internal call of OC_EXIT(1),
and there should only be one call of OC_EXIT at the very end of the program. Any recall of OC_INIT
re-initializes almost all parameters relevant for O PTO C AD, except for the wavelength , the parameters
of the optical media and all arguments of OC_INIT .

Subroutine OC_INPUT (ocd, nib, rest, frm)


Generic subroutine to read in the data of the optical components. These data can come either from an
external file or from a character array defined in the users main Fortran program. OC_INPUT can also
convert a ray segment saved by OC_TRACE into an input beam.
ocd

Can either be a scalar character string, specifying the name of an input file, or the name of a
character array, defined inside the users main Fortran program. These external or internal
files should contain the data of the optical components. (Hint: In case of an internal
character array, before filling with data make sure the array contains blanks only.)
With ocd = O PTO C AD first looks for a command-line argument following the Fortran
executable, then for a file <filename>.ocd . With ocd = <integer> it looks for a
command-line argument at position integer after the Fortran executable. If nothing is found
you will be prompted for a filename.

nib

Integer, output only. Returns the number of initial beams found in the input data.

rest

Character string, specifying a comma-separated list of names, under which ray-segment


data have been saved with the subroutine OC_TRACE , and that are to be converted into
input beams, like entries of type b in optical component data. rest can be specified

19 Jul 2013 16:41

18

optocad_ug_0.93i

OC_INPUT

OC_RESET
together with a character array ocd , but not together with an external file name ocd . A
change of the origin/orientation by an input line of type o in optical component data ocd
given together with rest will also be effective for the generated input beam(s).
Integer, selecting the frame for which the interior of the components should be filled with
color (see below). If frm = 0 or not present the component interior for all frames will be
filled, if frm < 0 filling of the interior is suppressed.

frm

The syntax for the O PTO C AD input data is described in Section 3 on page 25 .

The surfaces specified by the input data are numbered consecutively. O PTO C AD also erects a rectangular
fence enclosing all frames and surfaces. The associated surfaces have the numbers 1 to 4 . This fence
is opaque for beams coming from inside, but transparent for beams from outside.

AF

OC_INPUT not only reads the surface and component data, it also plots the interior of the components,
filled by a color defined either by the color index icc or the array rgb (see description of input lines
on page 26 and on page 30). Their outlines, the surfaces, are plotted by the routine OC_SURF .

Integer Function OC_LENS (label)

Function returning the sequential number of a lens by the label of its first surface.
label

Character string, specifying the label of the first surface of a lens.

Subroutine OC_MSG (type, text, u, adv)

Subroutine to write messages, by default to stdout or stderr .

Integer, selecting the type of the message: 0 normal message, 1 warning, 2 error, 3 fatal
error (aborting the program).

text

Character string, containing the message to be printed. A double backslash \\ is


interpreted as a new-line command.

Integer, selecting the Fortran I/O unit used for the message. If u < 0 the message is written
to abs(u) and to stdout or stderr (depending on type ). For type = 0 the default
is the value of the public variable u_norm , otherwise that of u_werm . (See below.)

adv

Character string, not case sensitive, corresponding to the ADVANCE specifier in WRITE
statements. For adv = no the message is written in non-advancing mode. Default is
adv = yes .

DR

type

This subroutine is almost identical to the RSUTIL routine MSG . For details please see the RSUTIL Users
Guide. For type = 3 messages a call of OC_EXIT is executed before aborting the program.

Subroutine OC_RESET (level)


Routine to reset certain internal parameters and counters allowing repetitive calls of OC_INPUT and/or
OC_TRACE .
level

Integer, can have the values 1 (the default) or 2 .

With level = 1 only certain internal parameters and counters for the optical surfaces are re-initialized
allowing for repetitive calls of OC_TRACE .
level = 2 causes a more comprehensive reset and allows loops also enclosing OC_INPUT . This reset
affects the number of components, surfaces, media, sets of grating data, initial start beams, interferences,
cavities and associated cavity cycles. Therefore, in oder to plot the surfaces, a call of OC_SURF should
be placed before the call of OC_RESET(2) .
optocad_ug_0.93i

19

19 Jul 2013 16:41

OC_SET

OC_SET

Subroutine OC_SET (n, lambda, print, write, rix, fslb, prsd,

pctl, wctl, mct, ndcav, dpl, dpr, dpt, rslc, dslc, nslc, hslc,
cslw, icc, ciwis, ciwit, rwi, wismin, part, toni, dztol, dtun,
pind, abs, tlc, mtlt, nela, pcad, pcld, pstat, prt, nice, mcp)

Subroutine to set certain parameters important for the operation of O PTO C AD.
Integer, specifying the start index for the array arguments rix , abs and tlc , to by set
with the same call of OC_SET . Default is n = 1 .

lambda

Real, specifying the wavelength to be assumed by O PTO C AD. Default is 1.064 m.

print

Character string, specifying which of the data calculated by O PTO C AD should be printed
on standard out, i. e. to the terminal. For details see Section 5 on page 43 .
The default is print = rs s2 act rd ang w0t w2t z0t z2t pw lb .

write

Character string, specifying which of the data calculated by O PTO C AD should be written to
a file or a character array specified by the call of OC_TRACE . For details see Section 5 on
page 43 . The default is identical to the string print (see above).

rix

Real 1-dimensional array, specifying the indeces of refraction for the optical media n,
n+1, n+2, (see argument n ). E. g., rix = (/1.44963, 1.77333/) would
set the refractive index to 1.44963 for medium 1 (fused silica) and to 1.77333 for medium 2
(SF 6 by Schott), if no n was specified (i. e. n = 1 ). For medium 0 O PTO C AD sets the
refractive index to 1.0 (vacuum). The default for medium 1 is rix(1) = 1.5 .

fslb

Real, specifying the font size (in mm) for plotting the labels. Default is fslb = 3.

prsd

Integer, switches on (1) or off (0) the print of the ray-segment data as specified by print .
Default is prsd = 1 .

pctl

Integer, switches on (1) or off (0) the print of ray-segment data while in cavity test cycles.
Default is pctl = 0 .

wctl

Integer, switches on (1) or off (0) the writing of ray-segment data while in cavity test
cycles. Default is wctl = 0 .

mct

Integer, specifying the default mode of cavity treatment. mct = 0 means no cavity
treatment, mct = 1 normal cavity treatment, mct = 2 cavities are assumed to be in
resonance, mct = 3 too assumes cavities to be in resonance, but also switches the beam
parameters to that of the Gaussian cavity eigenmode. mct can be overwritten individually
in the ocd file or array. Default is mct = 3 .

ndcav

Integer, specifying the number of significant digits with which cavity data are printed.
Default is ndcav = 4 .

dpl

Real, specifying the default power loss of surfaces. (see Section 3.3.3 on page 35).
Default is dpl = 0. .

dpr

Real, specifying the default power reflectance of surfaces (see Section 3.3.3 on page 35).
Default is dpr = 1. .

dpt

Real, specifying the default power transmittance of surfaces. (see Section 3.3.3 on
page 35). Default is dpt = 1. .

rslc

Integer, selecting the index of a predefined color for drawing regular surfaces. Default is
rslc = 7 (cyan).

dslc

Integer, selecting the index of a predefined color for drawing beam-dumping surfaces.
Default is dslc = 1 (black).

DR

AF

19 Jul 2013 16:41

20

optocad_ug_0.93i

OC_SET

OC_SET
Integer, selecting the index of a predefined color for drawing neglected surfaces. Default is
nslc = 1 (black).

hslc

Integer, selecting the index of a predefined color for drawing hidden surfaces. Default is
hslc = -1 , i. e. the surfaces are not plotted.

cslw

Real, specifying the default line width (in mm) for beam contours, beam axes and surfaces.
Default is 0.2 mm .

icc

Integer, specifying the index of a predefined color (e. g. set by PS_COLOR ) used for filling
the component interior. For icc < 0 filling the interior is suppressed. Default is a very
light cyan.

ciwis

Integer, selecting the index of a predefined color for drawing the sagittal waist indicators.
Default is ciwis = 6 (magenta). For ciwis <= 0 the sagittal waist indicator is not
plotted.

ciwit

Integer, selecting the index of a predefined color for drawing the tangential waist indicators.
Default is ciwit = 3 (green). For ciwit <= 0 the tangential waist indicator is not
plotted.

rwi

Real, specifying the relative size of the waist indicators. The actual size is given by rwi
times the size of the waist in the tangential plane, with a minimum given by wismin ,
initially 2 mm . A value rwi <= 0. suppresses the plot of the waist indicators.
Default is rwi = 4.

wismin

Real, specifying the minimum size of the waist indicators (in mm).
Default is wismin = 2.

part

Integer, switches on (1) or off (0) the calculation of optical phases according to reflectance
and transmittance (see Subsection 3.3.4 on page 35). Default is part = 0 .

toni

Real, specifying the tolerance at almost normal incidence for a grating surface. If the
magnitude of the incidence angle is less than toni , then the sign for the grating order is
taken from the sign of the surface angle. The latter can be arbitrarily set by adding or
subtracting 360 . Default is toni = 10 epsilon .

dztol

Real, specifying the tolerance in distance for surface hits. Two surfaces hit by the beam
within dztol are considered to be isotopic, i. e. at the same place. See Section 4.4 on
page 41 . Default is dztol = 1106 m.

dtun

Real, specifying the default detuning of cavities, specified as a fraction of the free spectral
ranges. Default is no detuning, i. e. all cavities are assumed to be at resonance if mct 2
is set. dtun can be overwritten individually in the ocd file or array.

pind

Integer, switches on (1) or off (0) the print of the interference data, consisting of the phase
difference and the deviations in position, angle, beam radius, wavefront curvature and
relative power. See Section 5.4 on page 47 for further details. Default is pind = 1 .

abs

Real 1-dimensional array, specifying the absorption per unit length for the optical media
n, n+1, n+2, (see argument n ). Default is no absorption.

tlc

Real 1-dimensional array, specifying the thermal-lensing coefficient for the optical media
n, n+1, n+2, (see argument n ). Default is no thermal lensing.
See Section 4.7 on page 42.

mtlt

Integer, specifying the mode of thermal-lens treatment. mtlt = 0 means no treatment of


thermal lensing, mtlt = 1 causes the thermal lenses to be calculated and possibly printed,
but not applied to the beams, and mtlt = 2 calculates and applies the thermal lenses.
Default is no thermal-lens treatment ( mtlt = 0 ). See Section 4.7 on page 42.

DR

AF

nslc

optocad_ug_0.93i

21

19 Jul 2013 16:41

OC_SET

OC_SURF
Integer, specifying the maximum number of executions of the last action in an action string.
(Does not apply to the actions d , h and n .) If this number is exceeded, the beam is
stopped. Default is nela = 16 .

pcad

Integer, switches on (1) or off (0) the print of the cavity data. Default is pcad = 1 .

pcld

Integer, switches on (1) or off (0) the print of the calculated lens data. The number of
significant digits printed is (currently) the same as for cavity data, i. e. given by ndcav .
Default is pcld = 1 .

pstat

Integer, switches on (1) or off (0) the print of the statistics at the end of the program.
Default is pstat = 1 .

prt

Character string, controlling the output that occurs via OC_MSG . To enable normal
messages prt must contain the letter n , to enable warning messages it must contain the
letter w , and to enable error messages it must contain the letter e . Any combination is
possible. If prt contains the letter X it is treated as if prt is not present.
Default is prt = nwe .

nice

Integer, specifying the default number of iterations for finding the eigenray of cavities.
nice can be overwritten individually in the ocd file or array. Default is nice = 0 .

mcp

Integer (0, 1, or 2), specifying the mode of plotting the beam contour. See OC_BEAM on
page 12 for details. Default is mcp = 1 .

AF

nela

Subroutine OC_SURF (lc, lp, lw, fc, fs, fi, fn, sns, snc, frm)
Subroutine to plot the surfaces of the optical components and their labels.

Integer, selecting the index of a predefined color for drawing those major reflecting or
transmitting surfaces for which no color has been set in the ocd file or array. (See
PS_COLOR in the RSPLOT users guide.) Default is lc = 7 (cyan).

lp

Integer, selecting the index of a predefined line pattern for drawing all surfaces. (See
PS_PATTERN in the RSPLOT users guide.) Default is the currently set line pattern,
initially a solid line.

lw

Real, specifying the line width (in mm) for drawing all surfaces. Default is the value of
cslw , initially 0.2 mm .

fc

Integer, specifying the color index for plotting the surface labels. Default is the currently
set color index, initially 1 = black. (See PS_COLOR in the RSPLOT users guide.)

fs

Real, specifying the font size (in mm) for plotting the surface labels. Default is fs = 3. .

fi

Integer, selecting the index of a predefined font for plotting the surface labels. Default is
fi = 9 , i. e. Helvetica. (See PS_TEXT in the RSPLOT users guide.)

fn

Character string, selecting a predefined font by its abbreviation. fn has precedence over
fi . Default is fn = H , i. e. Helvetica. (See PS_TEXT in the RSPLOT users guide.)

sns

Real, specifying the font size (in mm) for plotting the surface numbers. Default font size is
sns = 3. . If neither sns nor snc are present no numbers will be plotted.

snc

Integer, selecting the index of a predefined color for plotting the surface numbers (see
sns ). Default is snc = 1 (black). If neither sns nor snc are present no numbers will
be plotted.

frm

Integer, selecting the frame for which the surfaces should be plotted. If frm is not present
the surfaces for all frames will be plotted.

DR

lc

19 Jul 2013 16:41

22

optocad_ug_0.93i

OC_SURF

OC_TRACE

By default all surfaces and their labels are plotted. lc = 0 switches off plotting of the surfaces, fc = 0
that of the labels.
Using the optional argument frm allows surfaces and labels to be plotted with individual parameters
for the different frames. One can, e. g., change the font size of the labels or switch on or off the plot of
surface numbers.

Plotting of the surface numbers is meant mainly for debugging. The numbers will be plotted close to
the upper-left side of the surfaces (for normal orientation of the surface). The numbering occurs in the
sequence the surfaces are specified for a certain component in the ocd file or array, followed by the
surfaces generated by O PTO C AD in order to close the outline of the component.

Subroutine OC_TRACE (ib, of, oa, save)


Subroutine to trace a Gaussian beam through the optical set-up.

Integer, specifying the initial beam to be traced. Default is ib = 1 .

of

Character string, specifying the name of an output file into which O PTO C AD should write
that collection of values given by write (see OC_SET ). But an output will occur for
those ray segments only that hit a surface that has a > or a >> sign at the end of its label
string. If of is not present, no output will be written to a file.

oa

Name of a character array, defined inside the users main Fortran program, into which
O PTO C AD should write the collection of values specified by write (see OC_SET ). But
an output will occur for those ray segments only that hit a surface having a > or a >> sign
at the end of its label string. If oa is not present, no output will be written to the array.

save

Character string, specifying a comma-separated list of names, under which ray-segment


data are to be stored that can later be used to restart the current beam by converting them
into input beams by the subroutine OC_INPUT . These saved data are identified by the
labels of the surfaces the ray segments hit, and these labels are serving as the names in the
list of saved ray-segment data. In case the specified surface(s) is(are) hit more than once,
the last hit is saved by default. This can be changed by appending an @ to the label of the
surface in the saving list, followed by the number of the hit for which the ray segment data
are to be saved. See Section 4.6 on page 42 for more information.

DR

AF

ib

Starting with the initial beam, OC_TRACE loops through all surfaces in order to find the ones that are
actually hit by the beam. Of all these the one closest to the beam origin is taken as the target. Decisive
for this process is the beam axis only, i. e. independent of where the axis hits a surface, the whole beam
cross section is assumed to hit this surface. And correspondingly, even if the beam axis just misses a
surface, the whole beam cross section is assumed to miss this surface.
This procedure is repeated for all ray segments until the beam hits a beam-dumping surface; and also all
beams split-off are treated in this way. Note that there are two thresholds used in the search:
i) Surfaces that are hit at points closer together than dztol (= 10 6 m) are considered to be
isotopic, i. e. at the same place.
ii) A beam that forms an angle with the surface of less than 1 mrad is considered to miss the surface.
OC_TRACE may be called more than once, e. g. if there are several input beams. In such a case it is
advisable to put a call of OC_RESET at the end of the sequence of repeated statements. This, among
other things, resets the action pointers of all surfaces, so that the action strings are used again from the
beginning. See e. g. example VACIX on page 54.
The possibility to write output data to a character array allows the construction of loops in order to find
optimum values of certain component data or alignment. Varying certain component data in a loop and
optocad_ug_0.93i

23

19 Jul 2013 16:41

OC_TRACE

OC_WP

writing appropriate output data to a file or array can be used to produce curves describing the dependence
of one parameter from another. See Section 5 on page 43 and the examples 8.12, 8.13, and 8.15 on
page 74ff.
The arguments of and oa can be present simultaneously in which case the data will be written to both,
the file and the character array.

Subroutine OC_WP (nx, sg, mode, ib, frs, lrs, plot, maxtilt,
Subroutine to generate a Fortran file for WAVE P ROP.

wpfile, rtph, check)

Integer, specifying the exponent of two for the number ng of grid points in x as well as in
y dimension, i. e. ng = 2nx . It must be nx 3 when using the FFT routine internal to
WAVE P ROP. Default is nx = 8 .

sg

Real, specifying the geometric size in one direction of the grid. Default is ten times the
maximum beam radius of all ray-segments between frs and lrs .

mode

Character string, not case sensitive, specifying the mode to be used for WAVE P ROP. The
first character determines whether an Hermite-Gaussian ( h ) or a Laguerre-Gaussian
( l ) mode should be used. The following two integer characters determine the mode
number. Default is mode = h00 .

ib

Integer, specifying the initial beam to be used. Default is ib = 1 .

plot

Integer, specifying whether calling of WP_PLOT3D for all regular EM fields should be
active (1) or commented out (0). Default is plot = 1 .

AF

nx

DR

maxtilt Real, specifying a borderline value for the angles between the beam and the normal to the
surfaces. For angles below maxtilt the respective surface is tilted, i. e. surf%ti is
set, for angles above maxtilt surf%ai is set. For details please see the WAVE P ROP
Users Guide. Default is maxtilt = 0. , i. e. surf%ai is set for any incidence angle.
wpfile

Name of the generated Fortran file. Default is the name of the O PTO C AD file appended
with an _ followed by the number of the current input beam and appended with _wp .
Also see WP_SETUP .

rtph

Integer, specifying whether the phase change at interaction with a surface used by
O PTO C AD should also be used for the generated WAVE P ROP file (1) or just set to zero (0).
Default is rtph = 1 .

check

Integer, specifying the response if the phase step while setting up the surface exceeds
0.49. check = 0 means no checking, 1 only issuing a warning and 2 plot the area(s)
where the maximum phase step of 0.49 is exceeded, if this occurs at all. Default is
check = 1 .

OC_WP should be located after the call of OC_TRACE but before a potential next call of OC_RESET(2)
or OC_EXIT . It can be called several times for different initial beams (<ib>); the generated Fortran files are distinguished by appending an _<ib> followed by _wp to the O PTO C AD filename.
For further details see Section 7 on page 49. The Users Guide of WAVE P ROP (version 0.98c or later)
contains an example for the use of OC_WP .

19 Jul 2013 16:41

24

optocad_ug_0.93i

S YNTAX

FOR INPUT DATA

3 Syntax for the O PTO C AD input data


3.1 Introduction

O PTO C AD can read (case-sensitive) input data (by means of the routine OC_INPUT ) either from an
external ASCII file ( .ocd file) or from an internal character array, containing the data of the optical
components, one line for each (major) surface. Every component is usually described by a first line
specifying the primary surface of that component, followed by one or more lines for secondary (major)
surfaces.
Usually the sequence of the components in the input file or character array does not matter. But there is
an exception: In case components overlap each other or surfaces are isotopic the ones specified later are
considered to be on top of the others. See the Sections 4.4 and 4.5 .

AF

There is a certain set of parameters that describe the properties of a surface, like position, orientation,
size, etc., where all linear dimensions and angles should be given in the units selected at the call of
OC_INIT , unless different units have been chosen by an input line of type x . All properties of a
particular surface, at least if they deviate from the defaults, must be listed in one line, separated by
commas (and optional blanks). These parameters can be entered either in a fixed sequence (positional
parameters) or identified by a keyword in the form keyword = value. Positional parameters must appear
first and always start with the first parameter in the given set of parameters (see below). Once a first
keyword is used, the rest of the parameters must all have keywords. The sequence of keyword-identified
parameters is arbitrary. If an entity appears more than once within an input line, the last value is the one
that is used. Reading of the input data by O PTO C AD is case-sensitive!

DR

Some of the parameters are mandatory (shown in bold face), others are optional (shown in italics). For
all optional parameters a default is set by O PTO C AD. In general, all parameters have to be entered
as numerical values or character strings, but there is the additional possibility to bind such values to a
character string, kind of a symbolic variable, by means of the routine OC_BIND . Also simple arithmetic
expressions are allowed using the operations + , - , , , / , ( and ), as well as mixing numerical
values and symbolic variables. (See examples GRATING, ARFPC and ARMIN on page 68ff.) Also
for action strings a symbolic name can be assigned using OC_BIND , as well as for character arrays
containing the data of preset components. (See example TRC on page 62f.)
The first non-blank character of an input line has a special meaning; it identifies the type of the line,
e. g. in general the type of surface or component. This type also selects the set of parameters that can be
specified on this line. The following Table 2 shows the types currently implemented.

type

description

!
#
+
b
c
d
e
h
i
o
p
x

comment line
also a comment line
indicating a secondary (major) surface
initial beam (start beam)
general component or a single surface
dual-surface component
end of input
hole (in a component)
inserting preset optical component data
changes some general parameters
parameter list for a preset component
auxiliary input

Table 2 Different types of input lines.


optocad_ug_0.93i

25

19 Jul 2013 16:41

3.2

T HE

S YNTAX

DIFFERENT TYPES OF INPUT LINES

FOR INPUT DATA

3.2 The different types of input lines


3.2.1

Type e : End of input

The program ignores all following lines of the input data.


3.2.2

Type x : Auxiliary input

This type allows to set or change certain parameters that should get values different from the default
or from the value previously set by OC_SET in the main Fortran program. Currently the following
parameters can be set:
n, lam, pri, wri, rix, abs, tlc, nop, rgb, icc, dsc, unit, acs, rfs
They have the following meaning:

Integer, specifying the start index for any array argument to by set later on the same input line.
Default is n = 1 .

lam

Real, specifying the wavelength to be assumed by O PTO C AD.

pri

Character string, specifying which of the data calculated by O PTO C AD should be printed on
standard out, i. e. to the terminal. For details see Section 5 on page 43 .

wri

Character string, specifying which of the data calculated by O PTO C AD should be written to a file
or a character array specified by the call of OC_TRACE . For details see Section 5 on page 43 .

rix

Real 1-dimensional array, specifying the indeces of refraction for the optical media n, n+1,
n+2, (see argument n ). E. g., rix = (/1.44963, 1.77333/) would set the
refractive index to 1.44963 for medium 1 (fused silica) and to 1.77333 for medium 2 (SF 6 by
Schott), if no n was specified ( n = 1 ).

abs

Real 1-dimensional array, specifying the absorption per unit length for the optical media n,
n+1, n+2, (see argument n ).

tlc

Real 1-dimensional array, specifying the thermal-lensing coefficient for the optical media n,
n+1, n+2, (see argument n ). For further details see Section 4.7 on page 42.

nop

Does not need a value. Switches off all further output to the PostScript file.

rgb

Real 3-component array, specifying the /red, green, blue/ color components used for filling the
component interior. For rgb = /1.,1.,1./ filling the interior is suppressed. The default is
set by OC_SET (see page 20), initially a very light cyan.

icc

Integer, specifying the index of a predefined color (e. g. set by PS_COLOR ) used for filling the
component interior. For icc < 0 filling the interior is suppressed.

dsc

Integer, specifying a predefined color (e. g. set by PS_COLOR ) used as a default surface color if
its value is > 0 and no individual color is specified. See parameter sc in Section 3.3 on
page 30 for the defaults.

DR

AF

unit Character string that defines the units of length and angle. The length unit is used for specifying
position and size of surfaces/components and initial beams, radii of curvature, focal length etc.,
and for the positioning of their labels (both in the ocd file or array), as well as values like
lambda, abs, tlc, etc. The angle unit is used for specifying of phase shifts, the
orientation of surfaces/components and initial beams, and of coordinate systems.
unit is a comma- or blank-separated list of the keywords m (meter), cm (centimeter), mm
(millimeter), deg (degree) or rad (radian). Defaults are the units selected at the call of
OC_INIT , initially m and deg .
19 Jul 2013 16:41

26

optocad_ug_0.93i

3.2

T HE

S YNTAX

DIFFERENT TYPES OF INPUT LINES

FOR INPUT DATA

Character, specifying the action to be taken for surfaces that will be added automatically by
O PTO C AD to close a component. This is effective for the current input only.
Default is acs = d .

rfs

Real, specifying a relative font size for plotting the surface labels. This allows to change the font
size for a group of ocd input lines compared to the globally set font size fslb .
Default is rfs = 1.

3.2.3

Type o : Origin/orientation

acs

This allows to specify a change in the origin and the orientation of the coordinate system for the components and surfaces. It uses the following set of input parameters:
xo, yo, ag, xr, yr
They have the following meaning:

Real, specifying an x-offset of the coordinate system, applied before rotation. Default is
xo = 0.

yo

Real, specifying an y-offset of the coordinate system, applied before rotation. Default is
yo = 0.

ag

Real, specifying a rotation of the coordinate system. Default is ag = 0.

xr

Real, specifying an x-offset of the coordinate system, applied after rotation. Default is xr = 0.

yr

Real, specifying an y-offset of the coordinate system, applied after rotation. Default is yr = 0.

AF

xo

If xo or yo is given, ag, xr and yr are reset, unless they are also specified. If ag is given, xo
and yo are unchanged, but xr/yr are reset. If only xr/yr are given, also ag remains unchanged.
Any call of OC_INPUT resets all five parameters.
Type b : Initial beam

DR

3.2.4

This describes the parameters of an input beam, using the following set of input parameters:
x, y, w, ag, c, m, p, z, rc, wt, ws, ct, cs, zt, zs, rct, rcs
They have the following meaning:
x

Real, specifying the x-start-position of the beam.

Real, specifying the y-start-position of the beam.

Real, specifying the radius of the beam (1/e 2 of intensity) in both, tangential and sagittal plane
at a distance z from the start.

ag

Real, specifying the angle of the beam with respect to the positive X-axis. A beam propagating
in positive X direction has the angle zero. Default is ag = 0.

Real, specifying the curvature of the wavefront in both, tangential and sagittal plane at a
distance z from the start. (See page 9 for the O PTO C AD sign convention.) Default is c = 0.

Integer, specifying the medium (refractive index) in which the beam starts. Default is m = 0 .

Real, specifying the power of the beam (in Watts). Default is p = 1.

Real, specifying the distance between the start point of the beam and the point for which the
values w, c or rc are specified (see below). Positive values of z refer to down-beam
positions. Default is z = 0.

optocad_ug_0.93i

27

19 Jul 2013 16:41

3.2

T HE

S YNTAX

DIFFERENT TYPES OF INPUT LINES

FOR INPUT DATA

Real, specifying the radius of curvature of the wavefront in both, tangential and sagittal plane at
a distance z from the start. (See page 9 for the O PTO C AD sign convention.)
Default is rc = 1/c .

wt

Real, specifying the radius of the beam in the tangential plane at a distance z from the start.
Default is wt = w .

ws

Real, specifying the radius of the beam in the sagittal plane at a distance z from the start.
Default is ws = w .

ct

Real, specifying the curvature of the wavefront in the tangential plane at a distance z from the
start. (See page 9 for the O PTO C AD sign convention.) Default is ct = c .

cs

Real, specifying the curvature of the wavefront in the sagittal plane at a distance z from the
start. (See page 9 for the O PTO C AD sign convention.) Default is cs = c .

zt

Real, specifying the distance in the tangential plane between the start point of the beam and the
point for which the values wt, ct or rct are specified (see below). Default is zt = z

zs

Real, specifying the distance in the sagittal plane between the start point of the beam and the
point for which the values ws, cs or rcs are specified (see below). Default is zs = z

rct

Real, specifying the radius of curvature of the wavefront in the tangential plane at a distance z
from the start. (See page 9 for the O PTO C AD sign convention.) Default is rct = rc .

rcs

Real, specifying the radius of curvature of the wavefront in the sagittal plane at a distance z
from the start. (See page 9 for the O PTO C AD sign convention.) Default is rcs = rc .

AF

rc

Please note that an input beam is assumed to start from a (virtual) beam-start surface. Even if this surface
abuts that of another component, no matter whether this is a leaving or entering surface, the beam is
always assumed to lie outside the component and to start in medium 0, unless otherwise specified.

DR

There are two different applications for the use of z, zt or zs . In the one case you want to model a
light source of which you know the beam parameter at a place different from the start point of the beam.
This case is simple and the use of z, zt or zs is straight forward.
In the other possible application you want the light source to fulfill your requirements, i. e. you specify
the beam parameters at a point different from the start point of the beam. This case is simple too, as
long as there is no optical material along the distance z . But there is a catch in it if this condition is not
satisfied, or if the beam starts inside a component with a refractive index > 1. In this case, z cannot
simply be specified as the geometrical distance, but must be given concerning the mode-propagation
lengths. I. e., the pieces of geometrical lengths in different media along the path z have to be divided
by their respective indices of refraction, and then added up to yield z . And even this procedure gives
correct results only if all surfaces involved are plane and are hit under normal incidence.
3.2.5

Type c : General component or single surface

This describes the parameters of a general component, consisting of one or more surfaces. See Section 3.3 on page 30 for a list of possible arguments. The angle specified for the primary surface causes
the whole component to be rotated by this angle. For a single surface the medium ( m ) is always assumed
to be -1 (i. e. no medium), neglecting any possible specification on the input line. See also Section 3.5 on
page 37 .
3.2.6

Type d : Dual-surface component

This describes the parameters of a component that has exactly two major surfaces, one primary and one
secondary (like lenses or real mirrors). See Section 3.3 on page 30 for a list of possible arguments. The
19 Jul 2013 16:41

28

optocad_ug_0.93i

3.2

T HE

S YNTAX

DIFFERENT TYPES OF INPUT LINES

FOR INPUT DATA

angle specified for the primary surface causes the whole component to be rotated by this angle. See also
Section 3.5 on page 37 and Section 4.3 on page 41 .
3.2.7

Type h : Hole in a component

3.2.8

This describes the parameter for a hole in a component. The same rules apply as for c or d components
(with a maximum number of two major surfaces), but with a default medium 0, a default transmittance
of 1., and an interior like the background of the frame. See Section 3.3 on page 30 for a list of possible
arguments.
Type i : Insert preset optical component data

AF

It may sometimes be useful to insert a preset batch of optical component data into the actual array of
data. In this way it is possible to use prefabricated components that are often needed. They can exist
either as an external file or as an internal character array. The following set of input parameters is used:
name, xo, yo, ag, mag % <actual individual parameters>
They have the following meaning:

name Character string, specifying either the name of an input file (possibly including a path), or the
name of a character array, defined inside the users main Fortran program. These external or
internal files should contain the data of the optical component(s) to be inserted. (Hint: In case of
an internal character array, before filling with data make sure the array contains blanks only.)
Real, specifying the x-position of the reference point (origin of the coordinate system) of the
data to be inserted. Default is xo = 0.

yo

Real, specifying the y-position of the reference point (origin of the coordinate system) of the
data to be inserted. Default is yo = 0.

ag

Real, specifying the angle by which the inserted structure should be rotated around its internal
reference point. Default is ag = 0.

mag

Real, specifying a magnification factor to be applied to the data to be inserted. This


magnification applies to all dimensions of the component(s), as well as to their positions, radii
of curvature, focal lengths, etc., but it does not apply to the parameters lam , abs and tlc ,
entered via a type x input line. Default is mag = 1.

DR

xo

If name refers to an internal character array it must be bound by OC_BIND to the name of the array,
and this array must have a fixed length of 128 characters. 6 This is not necessary if it refers to a file name.
O PTO C AD first searches for an internal character array.
Usually preset components may have parameters that one wants to set individually, dependent on the
actual application. The total set of such parameters should be specified in the first line (a type- p input
line) of the ocd -array forming the component to be inserted (see below). If such a line is read-in the first
time, the associated default values are assigned to a keyword formed by the name of the preset component
followed by a _ and the name of the parameter by an internal call of OC_BIND . The actual parameters
for a particular application can be specified following the general parameters (see above), separated from
it by a % -sign. They can either be inserted simply by their value, if they come in the sequence given
in the type- p input line, or by name = value pairs. The values can be given either as pure integers,
reals or character strings, or by symbolic variables (set by OC_BIND ) or even expressions.
Please note: also the (numerical) values entered this way may be subject to a modification according to
mag!
6

This length can be changed in line 24 of the file optocad.F95 .

optocad_ug_0.93i

29

19 Jul 2013 16:41

3.3

L INES

DESCRIBING COMPONENTS AND SURFACES

S YNTAX

FOR INPUT DATA

As with lines describing surfaces and components also a type i input line may be finished with a # sign
followed by a label (see Section 3.4 on page 36). This label is then attached to the first surface or
component specified in the ocd array or file to be inserted, disregarding a label possibly internally
stated for this surface. See Example 8.6 ( TRC ) on page 62.

3.2.9

A special case is the numbering of optical media. These should be numbered in the usual way, i. e. 1, 2,
3, ... for the (different) media of components to be inserted. But since these numbers might already be
used by the main data set an offset n is determined corresponding to the maximum number of media in
the main data, and the actual numbers for the inserted data are moved up by this offset, hence starting at
n+1 , n+2 , ...
Type p : Parameter list for preset optical components

3.2.10

AF

This type of input line is useful only for preset components to be inserted via a type- i input line. It
should be the first line of the ocd -array forming the component to be inserted, containing a list of
all parameters in the following lines of the ocd -array. These parameters should have symbolic names
(no longer than 16 characters) and they should be listed together with default values in the form of
name = value pairs. The values must be given as pure integers, reals or character strings; variables or
expressions are not allowed.
Type + : Secondary surface

Secondary surfaces are the one or more optically relevant surfaces that are specified in addition to a
primary surface. See Section 3.3 on page 30 for a list of possible arguments.
The data for position and orientation of any secondary surfaces can either be given in absolute values,
or referenced to that of the primary surface, with absolute values having precedence. For components of
type c the default for the position ( x, y ) is that of the primary surface, for type d or h the default is
the center of the primary surface. The default angle ( ag ) is 180 against the primary surface.

DR

If the position is not specified at all (neither absolute nor relative), the surface is concatenated to the
previous one at the edges, whereby its orientation is defined by the given angle ag . A positive angle
cause a counterclockwise concatenation, a negative angle a clockwise concatenation. I. e., for a positive
angle the top of the current surface abuts the bottom of the previous surface, and for a negative angle the
bottom of the current surface abuts the top of the previous one. Thus, the surfaces have to be specified
either strictly counterclockwise or strictly clockwise. See example OPMC on page 52.
Any surfaces missing to complete a component after specification of the secondary surfaces are automatically added by O PTO C AD.

3.3 Lines describing components and surfaces

All lines, describing components and surfaces, use, more or less, the same set of parameters:
ac, x, y, rd, ag, c, m, r, t, rc, ct, cs, rct, rcs, gf, icc,
sc, f, ft, fs, vp, dx, dy, dm, da, pp, dtun, mct, nice, sh, zr
The specification of ac is mandatory for any surface, x, y and rd only for primary surfaces. The
parameters dx, dy, dm and da are effective for secondary surfaces only.
They above keys have the following meaning:
ac

Character string, specifying the actions to be taken upon successive hits of the beam(s).
See Subsection 3.3.1 for details.

19 Jul 2013 16:41

30

optocad_ug_0.93i

3.3

L INES

DESCRIBING COMPONENTS AND SURFACES

S YNTAX

FOR INPUT DATA

Real, specifying the x-position of the apex of the surface. For a secondary surface the default is
given by dx .

Real, specifying the y-position of the apex of the surface. For a secondary surface the default is
given by dy .

rd

Real, specifying the radius of the surface, i. e. half of its extent in the plane of the set-up,
measured perpendicular to the normal on the surface at its apex. For a secondary surface the
default is the radius of the respective primary surface. (See sketch in Section 3.3.2 on page 34.)

ag

Real, specifying the angle of the normal on the surface at its apex with respect to the positive
X-axis. The normal on the surface always points into the interior of the component! Default is
ag = 0 . for the primary surface, and given by da for secondary surfaces.

Real, specifying the curvature of the surface in both, tangential and sagittal plane. (See page 9
for the O PTO C AD sign convention.) Default is c = 0.

Integer 0, specifying the medium (refractive index) the component consists of. Default is
m = 1 (except for type h and for single surfaces).

Real, specifying the power reflectance of the surface. For the default see Subsection 3.3.3 , for
the specification of phase shifts and diffraction orders see Subsections 3.3.4 and 3.3.5 .

Real, specifying the power transmittance of the surface. For the default see Subsection 3.3.3 , for
the specification of phase shifts and diffraction orders see Subsections 3.3.4 and 3.3.5 .

rc

Real, specifying the radius of curvature of the surface in both, tangential and sagittal plane. (See
page 9 for the O PTO C AD sign convention.) Default is rc = 1/c .

ct

Real, specifying the curvature of the surface in the tangential plane. (See page 9 for the
O PTO C AD sign convention.) Default is ct = c .

cs

Real, specifying the curvature of the surface in the sagittal plane. (See page 9 for the O PTO C AD
sign convention.) Default is cs = c .

rct

Real, specifying the radius of curvature of the surface in the tangential plane. (See page 9 for the
O PTO C AD sign convention.) Default is rct = rc .

rcs

Real, specifying the radius of curvature of the surface in the sagittal plane. (See page 9 for the
O PTO C AD sign convention.) Default is rcs = rc .

gf

Real, specifying the grating frequency, i. e. the inverse of the grating period (measured in the
unit selected), for a surface acting as a diffraction grating. Default is no grating, i. e. gf = 0.

icc

Integer, specifying the index of a predefined color (e. g. set by PS_COLOR ) used for filling the
component interior. This is effective for the current component only. For icc < 0 filling the
interior is suppressed. Default is the color set by OC_SET or by the latest type x input line
(see page 26).

sc

Integer, specifying a predefined color (e. g. set by PS_COLOR in the main program) used for
drawing the surface. The default depends on the actions specified for this surface: If the action
string contains a t or r , the default is given by rslc , initially 7 (= cyan). If not, but the
action string contains a d , the default is given by dslc , initially 1 (= black). If not, but the
action string contains an n , the default is given by nslc , initially 1 (= black). If not, but the
action string contains an h , the default is given by hslc , initially -1 (= not plotted).

Real, specifying the focal length of a lens (given as a dual-surface component) in both,
tangential and sagittal plane. For details see Section 4.3 on page 41 .

ft

Real, specifying the focal length of a lens (given as a dual-surface component) in the tangential
plane. For details see Section 4.3 on page 41 .

DR

AF

optocad_ug_0.93i

31

19 Jul 2013 16:41

3.3

L INES

DESCRIBING COMPONENTS AND SURFACES

S YNTAX

FOR INPUT DATA

Real, specifying the focal length of a lens (given as a dual-surface component) in the sagittal
plane. For details see Section 4.3 on page 41 .

vp

Real, specifying the geometrical length of an additional piece of light path invisible in the plane
of the optical setup, e. g. running vertically like in a periscope. vp becomes effective only
together with the action v . Default is vp = 0.

dx

Real, specifying the x-position of the apex of a secondary surface with respect to that of the
associated primary surface, measured along the normal on the primary surface at its apex. It is
effective only if neither x nor y are given. The default is dx = dm .

dy

Real, specifying the y-position of the apex of a secondary surface with respect to that of the
associated primary surface, measured perpendicular to the normal on the primary surface at its
apex. It is effective only if neither x nor y are given. The default is dy = 0, but there is an
internal offset given by the zonal radii zr specified for the primary and the secondary surface:
dy = dy + zr1 zr2 * cos da .

dm

Real, specifying the minimum thickness of a dual-surface component (type d or h ), measured


along the normal on the apex of the respective primary surface. More precisely, for a pair of
surfaces acting like diverging lens (f < 0) dm determines the distance at the center of the
surfaces whereas for a pair of surfaces acting like converging lens (f > 0) the same is true for
the center of the chords of the surfaces. E. g. for a lens with positive focal length it defines the
thickness at the rim (in the tangential plane), for one with negative focal length that at the center.
A specification of dm is effective for a secondary surface only, and if neither x nor y nor dx
nor dy are given. The default is dm = 0.

da

Real, specifying the deviation of the angle of the normal on the surface at its apex from that of
the respective primary surface. It is effective for a secondary surface only. The default is
da = 180 . A specification of ag has precedence over that of da .

pp

Integer, specifying whether the first principal plane in the tangential ( pp = 1 ) or the sagittal
( pp = 2 ) plane of a lens should be placed at a position specified by the parameter x . The
default is pp = 0 , i. e. the principal plane is ignored. Effective only for components for which
a focal length is specified.

DR

AF

fs

dtun Real, specifying the detuning of the current cavity, specified as a fraction of the free spectral
ranges (also see OC_SET on page 20). dtun is effective only for all surfaces of a component
starting a cavity, i. e. if one of their action strings contains a c .
mct

Integer, specifying the mode of cavity treatment individually for the current cavity (see
OC_SET on page 20 and Section 4.2 on page 39). mct is effective only for all surfaces of a
component starting a cavity, i. e. if one of their action strings contains a c .

nice Integer, specifying the number of iterations for finding the eigenray of the current cavity (also
see OC_SET on page 20 and Section 4.2 on page 39). nice is effective only for all surfaces
of a component starting a cavity, i. e. if one of their action strings contains a c .
sh

Real, specifying the shape of the surface. Default is sh = 1. , i. e. a spherical shape. For details
see Section 3.3.2 on page 34 .

zr

Real, zonal radius, specifying the offset of the surface with respect to its symmetry axis (for
aspherics). Default is zr = 0. , i. e. no offset. For details see Section 3.3.2 on page 34 .

3.3.1

The action string ac

The action string ac determines the action(s) to be taken when the beam hits the surface. Since a
surface can be hit several times, O PTO C AD needs instructions about what to do at each individual hit.
19 Jul 2013 16:41

32

optocad_ug_0.93i

3.3

L INES

DESCRIBING COMPONENTS AND SURFACES

S YNTAX

FOR INPUT DATA

The action string therefore consists of a sequence of letters each of which determines a single action.
These letters, listed in alphabetical order, are:
Start a cavity and save the action immediately following the c for later treatment. This
determines the action to be taken with the beam that is not entering the cavity. (If there is more
than one action to be saved, these actions have to be enclosed in parentheses.) The next letter,
i. e. the one following the saved action(s), determines the action taken to enter the cavity. See
Subsection 4.2.2 on page 40 for further details.

Dump the beam, i. e. the beam is stopped here, and tracing is continued with the oldest beam
split off.

Hide the surface (and component), i. e. make the surface and the component it belongs to
invisible to the beam. No output line is printed for action h .

Stop the beam and save the current ray segment for later interference with either a beam
previously split off but not traced yet, or another input beam. Also stored are the (one or more)
actions following the i (enclosed in parentheses if more than one). See Subsection 4.1.1 on
page 38 for further details.

Neglect the surface (and component), i. e. assume full transmission and ignore the component
the surface belongs to, but stop the current ray segment, print an output line and start a new ray
segment.

Reflect the beam. For a grating surface, the diffraction order and possibly an index for the
incidence angle may be appended to the r (see Subsection 3.3.5).

Split the beam and save the action immediately following the s for later treatment. Continue
with the action coming next in the action string. After finishing the current beam and all beams
that have been split off before, the tracing continues starting at the current surface and with the
action that has been saved. With grating surfaces the beam can be split into more then two
secondary beams requiring more then one beam to be split off. In such a case the actions for the
split-off beams must be enclosed in parentheses (see example GRATING on page 68).

Transmit the beam. In case the conditions for total internal reflection are fulfilled, the beam is
reflected instead of being transmitted, and a warning message is issued. For a grating surface,
the diffraction order and possibly an index for the incidence angle may be appended to the t
(see Subsection 3.3.5).

Add the geometrical length vp (specified with the current surface) to the path traveled
(vertically) by the ray segment before carrying out the next action. No output line is printed for
action v .

Starting a repetition range.

}n

Ending a repetition range. The optional integer n indicates the number of executions for the
string enclosed in braces. The default is n = 1 , unless it is the last action in ac .

Starting a protected range. Actions inside such a range are not used for closing a cavity or
performing an interference.

Ending a protected range.

Starting a group of actions saved for later use. This can follow a c , i or s action character.

Ending a group of actions to be saved.

DR

AF

The last action in the action string is repeatedly performed for all hits exceeding the number of actions
specified. The maximum number of executions of the last action is given by the parameter nela (see
OC_SET on page 20). This limitation does not apply to the actions d , h and n . Any substring of the
optocad_ug_0.93i

33

19 Jul 2013 16:41

3.3

L INES

S YNTAX

DESCRIBING COMPONENTS AND SURFACES

FOR INPUT DATA

action string can be enclosed in braces { }. This establishes a separate group of actions with the effect
that hits belonging to these actions are not considered as hits closing a cavity loop (from a preceding c )
or interfering with a another beam (from a preceding i ). An integer immediately following the closing
brace causes the group to be performed as many times, as the integer specifies. If an action string ends
with such a group the sequence of actions in this group is executed as often as required, but not more
often than nela times.

AF

Setting up the action string can be rather complicated for complex optical arrangements, where the
optical beam is hitting certain surfaces several times. In particular the consideration of beams split off
complicates the situation. In order to master this task you should know that O PTO C AD treats split-off
beams in the sequence it encounters them. For each action letter s O PTO C AD comes across an entry
is made into a list of split-off beams for later treatment. Once the current beam comes to an end, e. g.
at a beam-dumping surface or a point of (later) interference, O PTO C AD continues with the next split-off
beam from this list. In more complex cases with nested cavities this rule can be violated, since the path
through the cavities is followed first, before tracing the remaining split-off beams in the sequence they
are stored. Also see Subsections 4.1.2 on page 38, 4.2.2 on page 40 and example PRMIFP on page 61 .
In case the action string should not be specified directly, but rather by a symbolic variable that the actual
string is assigned to by the OC_BIND command, the name of that symbolic variable must be directly
preceeded by an @-sign. This is to avoid misinterpretation as a directly specified action string.
A call of OC_RESET clears the list of split-off beams.

The stepwise mode of the routine OC_BEAM (see page 12) can be of quite some help in order to gain a
clear perception of the correct sequence of actions at certain problematic surfaces.
3.3.2

Aspherical and off-axis surfaces

DR

A surface can have any shape of a conic section, determined by the shape parameter s ( sh in the ocd file or
array). We choose a representation where one(the) apex
is at the origin of the coordinate system:
y 2 = 2Rx s x2

with R being the radius of curvature at the apex. The


shape parameter s has the following effect:
s

<

hyperbolic shape

parabolic shape

0 <s< 1

lying elliptic shape

circular shape (default)

>

standing elliptic shape

All these shapes (except for the circle) have a dedicated


symmetry axis, in the sketch shown on the right collinear
with the X-axis.

2.0

0.5

0.0
0.5

1.5

1.0

1.0
2.0

1.4

0.5

0.0

0.5

1.0

1.5

2.0
0.0

See the Example 8.14 on page 78f .

s = 1.0

0.5

1.0

1.5

2.0

Roland Schilling, 30 Aug 2011, conic_section.ps

19 Jul 2013 16:41

34

optocad_ug_0.93i

3.3

L INES

S YNTAX

DESCRIBING COMPONENTS AND SURFACES

rd

zr

rd

The input parameter zr (zonal radius) together with rd


allows to specify an off-axis part of an aspheric surface, as
shown on the right in the example of an off-axis parabola.
As for circular surfaces the x / y parameters should specify the position of the apex of the surface and ag the
angle between the symmetry axis of the surface and the
positive x direction.

FOR INPUT DATA

ag

3.3.3

(x,y)

Default values for reflectance and transmittance

The default values used for reflectance and transmittance depend on the parameters dpl, dpr and
dpt (see OC_SET ), and on the action string:
If no reflectance is given it is set to 1 minus the sum of dpl and (all) transmittance(s).
If no transmittance is given it is set to 1 minus the sum of dpl and (all) reflectance(s).
If neither reflectance nor transmittance is given the following is done:
If the action string contains an r , but no t , the reflectance is set to dpr and the transmittance
to 0, if it contains a t , but no r , the transmittance is set to dpt and the reflectance to 0, if it
contains both, r and t , the reflectance is set to to dpr/max(1,(dpr+ dpt)/(1 - dpl))
and the transmittance to dpt/max(1,(dpr+ dpt)/(1 - dpl)) , and if it contains neither r
nor t , then the reflectance is set to dpr *(1 - dpl)/(dpr + dpl) and the transmittance to
dpt*(1 - dpl)/(dpr + dpl). This ensures energy conservation.
3.3.4

AF

Roland Schilling, 28 Jan 2012, oa_def.ps

Phase shifts at reflection and transmission

DR

Usually a phase shift 6= 0 occurs with the reflection at or the transmission through a beam-splitting
surface. By default, O PTO C AD sets this phase shift to 0 for transmission and to 90 for reflection, if
the parameter part (see OC_SET ) is set to zero. With part = 1 these phase shifts are calculated
according
 reflectance and transmittance, i. e. the phase shift on reflection is set to r =
pto the given
r/(r + t) and on transmission to t = r 90 (with r and t being the power reflectance
arccos
and transmittance, respectively). These settings can be overridden by appending a phase specification
to the value(s) given for reflectance or transmittance in the form r = power _reflectance < phase , e. g.
r = 0.9 < 30 for a power reflectance of 0.9 with a phase shift of 30 . If one phase is specified in this
way, the other phase for the current surface is set to the complementary angle, unless specified explicitly
also.
For the generated F INESSE input file these phase shifts are not accounted for.
3.3.5

Reflectance and transmittance for grating surfaces

A surface is characterized to be an optical grating by the specification of a grating frequency gf > 0 .


Also with grating surfaces reflectance and transmittance cannot be calculated by O PTO C AD , but must
be given by the user. These values will, in general, depend on the diffraction order and on the angle of
incidence. O PTO C AD allows the diffraction orders to be in the range from -9 to +9 , and they are specified
by appending the corresponding number to the keywords r or t , e. g. r-1 = 0.1 or t2 = 0.02 . The
order 0 stands for the regular reflection or transmission and can be omitted, as can the plus sign. Phase
shifts can be specified as described in Subsection 3.3.4 .
optocad_ug_0.93i

35

19 Jul 2013 16:41

3.4

L ABELS

S YNTAX

FOR SURFACES AND COMPONENTS

FOR INPUT DATA

Since it might be necessary, for some grating surface, to specify reflectance (or transmittance) for a
certain diffraction order at two or more different angles of incidence, it must be possible to define multiple
values for the same diffraction order. O PTO C AD provides the possibility to specify up to nine such values
by allowing to append another digit (between 1 and 9) to the one specifying the diffraction order, e. g.
r-12 = 0.25 defines a power reflectance of 0.25 for order 1 at a second incidence angle. Here 1 is
the default and need not be specified, i. e. r+31 is the same as r+3 or r3 . If, for the regular reflection
or transmission, multiple values have to be given the 0 defining the diffraction order must not be omitted.

The same notation that is used here for specifying the reflectances and transmittances must also be used
in the action string. In this context the question of the sign convention for the diffraction orders comes
up. In O PTO C AD the sign of the diffraction order is considered to be positive, if the diffraction vector has
the same sign as the wave vector of the regularly reflected beam. See example GRATING on page 68.

3.3.6

Numbering of the surfaces

AF

This convention leads to problems if the incidence angle is (nearly) normal to the surface. In this case,
i. e. if the magnitude of the incidence angle is less than the parameter toni (see OC_SET ), O PTO C AD
takes the sign for the grating order from the sign of the orientation angle of the surface. The latter can be
arbitrarily set by adding or subtracting 360 .

The numbering of the surfaces, as optionally plotted by OC_SURF (see page 22) and/or printed out (see
Section 5 on page 43), occurs in the following way: The numbering is successive over all surfaces. For
each component it starts with the primary surface and continues with the secondary surfaces as they are
specified in the ocd file or array, followed, possibly, by the surfaces added by O PTO C AD in order to
complete the component. For the numbers of the frame outline surfaces see the end of Section 2.2 .

3.4 Labels for surfaces and components

DR

Each input line may be finished with a # sign possibly followed by a label with a maximum length of
32 characters. If lb is present in the print-string (see OC_SET on page 20 and Section 5), this label
is printed on each output line that describes a ray segment with this surface being the target surface. This
is very helpful in understanding and interpreting the output data. (See also Subsection 5.1.3 on page 45.)
With an @ sign following the label (after a possible > sign and optional blanks), the label will also appear
in the plotted PostScript output. Since this plot is accomplished by the RSPLOT routine PS_TEXT a
TEX-like notation can be used (see the RSPLOT users guide). The position of the label, relative to the
center of the surface, is controlled by two additional, comma-separated numbers following the @ sign.
These numbers specify the offset in x and y of the label from the center of the surface. If only the first
number is given, the y-value is assumed to be to zero. If only the second number is given, the x-value is
assumed to be to zero, but in this case the comma must be there. The values must be given in user, not in
paper coordinates, since the dimensions of the surface are also in user coordinates.
An optional third number (after an additional comma) specifies a scaling factor for the font size used for
plotting the label, thus allowing individual font sizes for different labels. The general font size for the
labels can be set by the argument fslb of OC_SET (see page 20), with the default being 3 mm .
Normally one will use this scheme for the primary surface of a component only. This set of (up to
three) numbers can be preceded by two letters specifying the reference point of the text. By default, the
reference point is the lower-left start point of the text. These two letters can be l, c, r (left, center,
right) for the x position and b, c, t (bottom, center, top) for the y position.

19 Jul 2013 16:41

36

optocad_ug_0.93i

3.5

S OME

DETAILS ABOUT TYPE

AND TYPE

S PECIAL

COMPONENTS

TREATMENTS

3.5 Some details about type c and type d components


Type c, zr=0.5

Type d, zr=0.5

AF

The figure on the right shows one of the differences


between a two-surface component of type c and
type d . The only inequality in the ocd array between the three cases shown is in the component
code and in the zonal radius zr . If no dy is
specified, for type d components the center of the
secondary surface is kept on the component axis as
given by the primary surface, even if zr 6= 0 is specified. This is different for type c components as can
be seen in the figure.

Type c or d, zr=0.

DR

A common feature for both types of components is


depicted in the next figure. If two surfaces intersect
at one or two points, the surmounting parts are cutoff, and the values for rd and zr are changed accordingly. The example on the right shows an overlapping parabolic primary and a tilted, elliptic secondary surface. The dashed cyan (and grey) colored
lines are the surfaces without modification of rd
and zr . The blue (and black) lines show the outline of the resulting component. These cut-offs and
modifications do not happen, if the secondary surface(s) is(are) concatenated to the preceding one(s)
(see 3.2.10 on page 30).

5Roland Schilling,

28 Jan 2012, show_cd.ps

dy
dx

18
da

5
0

Roland Schilling, 13 Feb 2012, show_rd.ps

4 Special treatments
4.1 Interferences

In a rather simple way, O PTO C AD can deal with interferences also: It just adds the complex amplitudes
of two interfering beams. This gives a correct result only if the two beams match perfectly, i. e.
if they agree exactly in position, orientation and mode (radius and wavefront curvature) which,
in general, is not fulfilled. As a consequence, the powers printed might be wrong. In any case,
O PTO C AD derives the parameters for the resulting ray segment from the first of the two interfering
beams.
optocad_ug_0.93i

37

19 Jul 2013 16:41

4.1
4.1.1

I NTERFERENCES

S PECIAL

TREATMENTS

Action strings for interferences

For an interference to be performed by O PTO C AD at a certain surface its action string should contain an
i when the first of the two interfering beams hits this surface. The beam is stopped here and the current
ray segment is saved for later interference with a beam previously split off but not traced yet. Also stored
are the (one or more, typically two) actions following the i (enclosed in parentheses if more than one),
determining the action to be performed at the current surface before the beam is brought to interference
with the other beam. When a beam re-encounters this joining surface it usually is split into a reflected
and a transmitted beam, both of which are to be interfered with the saved ray segment. Thus, an s
(causing the splitting) should follow in the action string, followed, in turn, by the actions t and r in
the appropriate sequence.

AF

For the ray segment stored at the encounter of the i the actions saved with it are performed and the
interference with the current ray segment takes place. These actions should be set such that actions t
with r or r with t are combined. The actions saved with the i are treated in the sequence they are
specified. Besides r and t , they may also contain an n in which case the beam currently hitting the
surface is treated normally, i. e. not interfered with the stored ray segment. See the two interferometer
examples g and h in VACIX on page 54.
In the case of a grating surface the beams can be split into more than two secondary beams, and also
two reflected (or two transmitted) beams can interfere with each other, if they are of different diffraction
order. See the examples ARFPC on page 70 and ARMIN on page 72.
4.1.2

Action strings for beam-splitters in Michelson interferometers

Creating an action string for the beam-splitter of a Michelson interferometer (MI) is one of the more
difficult tasks in O PTO C AD, in particular when dealing with multiple reflections inside the beam-splitter
substrate caused by reflections at the back surface of the beam-splitter. In the following 16 different
configurations of MIs are considered:

DR

The incoming beam being first reflected by or first transmitted through the beam-splitter.
An interferometer with normal arms or with Fabry-Perot cavities (FP) in the arms.
An interferometer in the normal configuration or with power recycling (PR).
A beam-splitter without or with reflections at the back surface.

configuration
[PR]MI

[PR]MIFP

front surface

back surface

remark

stri(nrt)srt

reflection first

srti(ntr)str

transmission first

stri(rt)srt

reflection first

srti(tr)str

transmission first

Table 3 Action strings for front and back surface of MI beam-splitters without reflections
at the back.
Table 3 shows the action strings required for the front and the back surface of the beam-splitter in the
case without reflections at the back surface, whereas Table 4 shows the cases with (multiple) reflections.
As one can see from Table 3 there is no difference whether the interferometer is power recycled or not,
and only a small difference (no n inside the parentheses) if the arms contain Fabry-Perot cavities.
For the action strings listed in Table 4 it was assumed that all additional beams emerging from the beamsplitter are either leaving the optical set-up or being captured by appropriate beam dumps. (See example
19 Jul 2013 16:41

38

optocad_ug_0.93i

S PECIAL

CAVITIES

configuration

[PR]MI

PRMIFP

MIFP

TREATMENTS

front surface

back surface

remark

stri(nrnt){srt}
stri(nrt)srt{[srt]}

{srt}
{srt}

reflection first

srti(ntnr){str}
srti(ntr)str{[str]}

{srt}
{srt}

transmission first

stri(rnt){srt}
stri(rt)srt{[srt]}

{srt}
{srt}

reflection first

srti(tnr){str}
srti(tr)str{[str]}
stri(nrnt){srt}
stri(rt)[srt]{srt}
srtsrti(tnr){str}
srt[srt]i(tr){str}

O PTICAL

{srt}
{srt}

transmission first

{srt}
{srt}

reflection first

{srt}
{srt}

transmission first

AF

4.2

Table 4 Action strings for front and back surface of MI beam-splitters with reflections at
the back. Two solutions each are given for the front surface.
PRMIFP on page 61.) In each case there are two solutions given for the action strings of the front
surface.

4.2 Optical cavities

4.2.1

DR

Since optical cavities essentially are based upon interference, all that is said in the previous section with
respect to matching of interfering beams also applies here.
Eigenmode and eigenray of optical cavities

If mct , the mode of cavity treatment (see OC_SET on page 20), is set to be > 0 , the cavity eigenmode
is calculated with respect to the TEM parameters beam radius and wavefront curvature, as well as to
position and orientation of the cavity eigenray. The mode-matching factor between incoming beam and
cavity eigenmode is calculated assuming a perfect alignment of the input beam. If mct is set to 1
or 2 , the parameters derived from the cavity input beam are used inside the cavity. Only for mct = 3
the TEM parameters of the cavity eigenmode (as mentioned above) are used inside the cavity and for the
beams leaving it, and the mode-matching factor is applied to the cavity internal power.
In order to determine the eigenray of a cavity, i. e. position and orientation of the eigenmode, three test
round trips through the cavity are performed. If nice is set to be > 0 , this process is iterated to
improve the parameters for the eigenray. Furthermore, the ray segments inside the cavity are placed
according to the calculated eigenray. (See example TRC on page 62f.) Usually, the test cycles through
the cavity are not printed, only the final results, unless the parameter pctl is set to 1 (see OC_SET on
page 20).
In order to perform the interference between the beam entering the cavity with the one returning from the
round trip through the cavity yet another cycle through the cavity loop is necessary. Only during this last
cycle the beam has the full power due to the resonance enhancement, and may have the TEM parameter
of the cavity eigenmode. However, that part of the input beam that is not entering the cavity, always has
its parameter derived from the input beam.

optocad_ug_0.93i

39

19 Jul 2013 16:41

4.2

O PTICAL

S PECIAL

CAVITIES

TREATMENTS

Cavities can also be nested, i. e. a new cavity can start while the current cavity cycle is still not finished
yet. The cavity parameters calculated in such a case (like free spectral range or finesse) always refer to
the individual cavities, not to the system of coupled cavities.
4.2.2

Action strings for optical cavities

That part of an action string that starts an optical cavity begins with a c , actually forcing the beam
to split into a part that enters the cavity and another part that does not. This splitting is specified by
the actions following the c , whereby the one immediately following is saved for later treatment and
determines the action to be taken with the beam that is not entering the cavity. The next letter, i. e. the
one following the saved action, determines the action taken to enter the cavity. For a regular surface (i. e.
not a grating) these actions can only be r and t , and the first part of the action string is either crt or
ctr .

AF

For a grating surface, however, the beam can be split into more than two secondary beams of which only
one is entering the cavity. Thus, there can be several actions to be saved which in this case have to be
enclosed in parentheses.
When the beam entering the cavity returns from its cycle through the cavity it is split again, in fact into
the same number of secondary beams as the incoming beam. This has to be described in the action string
by a s followed by the (saved) actions to be performed later and the action that redirects the beam into
the cavity, i. e. closing it. This latter beam interferes with the beam entering the cavity. (In fact the cavity
loop is cycled twice in order to achieve this.) The other beam(s) split off leak(s) out of the cavity and
interfere(s) with the beam(s) split off the input beam. Thus, for a regular surface a typical action string
would look like crtstr (or ctrsrt ), provided the surface is not hit again inside the cavity cycle.
See, e. g., the examples a, b, d and h in Section 8.3 on page 54.
In the case of a grating surface the situation can be even more complicated. Appropriate examples will
be provided in due course.

4.2.3

DR

The action string for the surfaces belonging to a cavity must be set up such that the cavity path is closed
on the shortest possible way. This means that all furcations in the cavity cycle should first follow the way
to close the cavity, otherwise a fatal error occurs. If cavities are nested this requirement is modified such
that, at the splitting surface, first the path into the secondary cavity has to be followed, otherwise the two
cavities would not really be nested. See example b in Section 8.3 on page 54.
Detuning of optical cavities

With mcad 2 the cavities are forced to be in resonance. But the parameter dtun , settable globally
by OC_SET or individually in the ocd file or array, allows to keep cavities at a fixed frequency offset
from resonance. dtun has to be specified as the fraction of the frequency offset with respect to the
free-spectral-range. I. e., dtun = 0.5 will keep the cavity at antiresonance, dtun = 0.5*BW/FSR at
the half-maximum point (with BW being the FWHM-bandwidth of the cavity).
4.2.4

Access to cavity data

To get access to the data of cavities from the Fortran main program one can use the derived-type array
cavities . The components of this derived type are described in Section 1.5 on page 8. The integer
function OC_CAVITY allows to find the sequential number of a cavity by the label of its first surface.

19 Jul 2013 16:41

40

optocad_ug_0.93i

4.3

L ENSES

S PECIAL

TREATMENTS

4.3 Lenses
Lenses are essentially components of type d . A type d component is treated as a lens if the specification
of either the primary or the secondary surface contains at least one of the (additional) parameters f,
ft or fs , defining the focal length for both planes, the tangential, or the sagittal plane, respectively.
The calculation of the curvature(s) necessary to achieve the specified focal length assumes the medium
outside the lens to have a refractive index of 1.

The chords of primary and secondary surface are forced to be parallel (da = 180), and the center of the
secondary is forced to be on the normal to the primary surface (dy = 0).

AF

If a curvature or a radius of curvature is specified neither for the primary nor for the secondary surface
a symmetric lens (biconvex or biconcave) is constructed with equal curvatures for both surfaces. If the
curvature or the radius of curvature for one of the two surfaces is specified that of the other surface is
calculated as to achieve the requested focal length. If this is not possible, an error message is issued
and the program aborted. In case the curvatures for both surfaces are specified the lens parameters are
overdetermined and an warning message is printed, but the program continues by ignoring the focallength specification. All this applies to both the tangential and the sagittal plane.
The thickness of a lens is forced not to be less than 2 dztol in order to avoid a misinterpretation as
isotopic surfaces (see Subsection 4.4 below).
The calculation of the necessary curvatures occurs in the subroutine OC_INPUT , hence a setting of the
index of refraction of the medium (by OC_SET ) used for the lens should be placed before the call of
OC_INPUT .
4.3.1

Access to lens data

To get access to the data of lenses from the Fortran main program one can use the derived-type array
lenses . The components of this derived type are described in Section 1.5 on page 8.

DR

The component dp contains the distance of the two principal planes from the apex of the first surface.
By means of the input parameter pp (see Section 3.3 on page 30) one can force the first principal plane
to be placed at the position specified by the input parameter x . If one wants the second principal plane
to be placed at a given position one has to reverse the sequence in which the surfaces are specified, i. e.
the rear surface should be specified first, hence becoming the primary surface of the lens. By means of
the parameter ag one then rotates the lens by 180 in order to get the orientation right.

4.4 Closely positioned components or surfaces

If two components are (almost) touching each other, i. e. if two of their surfaces are (almost) parallel
to each other and also are at (almost) the same position, this may lead to problems. This can occur if
one wants to model components that are optically contacted or glued together. It then may happen that
a small air-gap is formed where the light unintentionally experiences total internal reflection. In order
to avoid this O PTO C AD has a built-in tolerance dztol . If, at the point where the beam hits, the two
surfaces are closer together than dztol , the surfaces are assumed to be isotopic, i. e. exactly at the
same place. dztol can be set by OC_SET (see page 20); the default is 1 m .
Isotopic surfaces are dealt with in the following sequence: First all leaving surfaces are treated, i. e. the
ones where the beam leaves a component, next all singular surfaces, and finally all entering surfaces.
Please note that any beam start is associated with a singular surface.

optocad_ug_0.93i

41

19 Jul 2013 16:41

4.5

OVERLAPPING

S PECIAL

COMPONENTS

TREATMENTS

4.5 Overlapping components


In case of an overlap of components, i. e. if a later defined component (partly or fully) covers an area of a
previously defined component, O PTO C AD sees all parts of the previously defined component(s) that are
not covered. This feature can be used when modeling components that are optically contacted or glued
together, thus avoiding problems as described in the previous section. Furthermore, it can be helpful in
simulating,e. g., polarization effects. See the examples OPMC on page 52 and PBS on page 64.

4.6 Save and restart of beams

AF

It sometimes can be beneficial to save the beam data it a certain point in order to be able to restart the
beam at that point later, e. g. for building loops. For this purpose the optional argument save of the
subroutine OC_TRACE (see page 23) allows to store the data of a ray segment when it hits a certain
surface. The label of this surface serves as the identifier both, to determine the ray segment, whose data
are to be stored, and to name the entry in the list of saved ray-segment data. The strings used as identifier
should start with the # that opens a label, e. g. # Mirror_1 , not just containing the bare label.
For a secondary surface the string accordingly should start with + , unless it has got its own label.
Specifying the argument rest in the subroutine OC_INPUT (see page 18) with a name from the list
of saved ray-segment data generates a new input beam that continues at the point, i. e. at the surface,
where the data have been stored, executing the next action for this surface. Typically, the sequence of
statements to save and restart a beam will look like
call oc_trace(...,save=# Mirror_1)
...
call oc_input(...,nib=nib,rest=# Mirror_1)
call oc_trace(nib)

! save beam data at Mirror_1

! regenerate saved beam


! restart saved beam

where nib is the number of the beam to be traced.

DR

In general, the action, where the beam data are saved, is a d , i. e. the beam is stopped here. If this
is not the case, the beam continues after saving and later, when it is restarted, passes the same surfaces
again that follow the point of saving the beam data. If so, or if in a loop, the actions of the surfaces to
follow the saving point have already been used. In order to use them again, a call of OC_RESET should
precede the OC_INPUT that regenerates the beam to be continued. This will reset all action pointers,
but the one of the saving surface will be restored by the call of OC_INPUT .

4.7 Thermal lensing

In order to treat thermal lensing the subroutine OC_TRACE is (internally) passed twice if mtlt > 0 .
During the first pass the total absorption of light power is determined for the various substrates, which
maybe passed multiple times. In the second pass the resulting additional curvature of the wavefronts is
calculated and, if mtlt = 2 , used to correct the ray-segment data. It should be noted that this in turn
will influence the cavity eigenmode and possibly also the cavity eigenray. Hence, an iterative treatment
of cavities ( nice > 0 ) will improve the results. The values determined for absorption and focal length
can be output by the keys pa , tlt (tangential plane) and tls (sagittal plane). See Section 5.1 .
To be able to calculate the thermal-lensing effect the specific absorption and the thermal-lensing coefficient () must be specified for the considered substrates. I. e. the parameter abs and tlc should be
set either with OC_SET or with an input line of type x in the ocd file or array.
The thermal-lensing coefficient is the (additional) sag (in the selected length unit) per Watt of absorbed
power the wavefront of the light experiences when passing an optical medium. It can be estimated by


0.1084 dn
=
+n ,
kth
dT
19 Jul 2013 16:41

42

optocad_ug_0.93i

T HE O PTO C AD

OUTPUT DATA

where kth is the thermal conductivity, n is the refractive index, dn/dT is the temperature dependence of
the refractive index, and is the thermal expansion coefficient.

5 The O PTO C AD output data

By default, regular text is sent to stdout (unit 6), warning and error messages to stderr (unit 0).
This can be changed by starting the Fortran main program with the statement use rsutil and modifying the variables u_norm and/or u_werm as desired.

5.1 The output specified by print or write

AF

There is a certain number of characteristic values for each ray segment that can be sent to stdout (i. e.
usually to the terminal) or written to a file and/or into a character array. This is done by the subroutine
OC_TRACE which means that the output occurs in the sequence the ray segments are found. Each
output line describes one ray segment, in fact the one that starts from surface s1 (source surface) and
hits surface s2 (target surface). The output to stdout will occur for all ray segments calculated by
O PTO C AD and can, of course, be redirected into a file.
The direct output into a file or a character array (as specified by the call of OC_TRACE ) is primarily
intended to be used for selected surfaces, thus it will occur only for those rays segments that hit a surface
having a > or a >> sign at the end of its label string (i. e. before a possible @ sign specifying the plot
position of the label). A >> sign appearing at a primary surface of a component will force the output
not only of this surface but also for all secondary surfaces belonging to the same component.
Please note: The output into a file or a array occurs in the sequence in which the surfaces marked by
a > sign are found by the routine OC_TRACE , not in the sequence they are specified in the ocd file
or array. Furthermore, output is generated each time the marked surface is treated inside OC_TRACE .
E. g., if the parameter wctl (see OC_SET on page 20) is set to be > 0 , this will occur several times
for the surfaces belonging to a cavity, because of the multiple test loops through the cavity.

DR

The collection of values to be sent out is determined by the character strings print and write, set
either by OC_SET (page 20) or under input-line type x (page 26). The individual values are identified
by an associated key and separated by blanks. They can occur in arbitrary sequence and are also put out
in this sequence.
Table 5 contains all the quantities calculated by O PTO C AD together with the associated, case-sensitive
key. Some of the keys contain the characters 1 or 2, referring to the surface, where the ray segment starts
from (1), or the surface hit by the ray segment (2), respectively.
By OC_INPUT , an unequivocal number, starting at 1, is assigned to all surfaces, the ones specified in
the input data as well as the ones automatically added by the program to complete a component. All
initial beams start from a virtual surface number 0 . The numbers -4 to -1 belong to the four surfaces
forming a fence that encloses all frames and surfaces. Surface numbers < 4 belong to the outlines of
the frames.
Appending _n to the key rs (the ray-segment index) provides room for a maximum of n digits.
Default is 3 digits.
All angles and linear dimensions are given in the units selected at the call of OC_INIT . Wavefront
radius R and curvature C are positive for a converging beam, i. e. if the center of curvature is following
(down beam) the current position.
5.1.1

Precision and range for real values

All real numbers are printed in engineering notation, i. e. the exponent always is an integral multiple
of 3, and, by default, with 4 significant digits for the mantissa. The number of significant digits can be
optocad_ug_0.93i

43

19 Jul 2013 16:41

5.1

T HE

OUTPUT SPECIFIED BY

key

print

OR

write

T HE O PTO C AD

OUTPUT DATA

description

AF

index of current ray segment


index of the source surface for the current ray segment
index of the target surface for the current ray segment
number of component the current ray segment is in
medium the current ray segment is in
action taken at the target surface (1 character)
action taken at the target surface (4 chars: action, sign, diffraction order, index of incidence)
radial distance of the point hit on the target surface from the reference point of that surface
direction of propagation with respect to the positive X-axis
like ang , but output as offset to a multiple of 90 or pi/2
emergence angle of ray segment with respect to local normal on the source surface
incidence angle of ray segment with respect to local normal on the target surface
radius of the waist (1/e2 of intensity) in tangential plane
radius of the waist (1/e2 of intensity) in sagittal plane
radius of the beam (1/e2 of intensity) at the source surface in tangential plane
radius of the beam (1/e2 of intensity) at the source surface in sagittal plane
radius of the beam (1/e2 of intensity) at the target surface in tangential plane
radius of the beam (1/e2 of intensity) at the target surface in sagittal plane
Rayleigh range in tangential plane
Rayleigh range in sagittal plane
distance of source surface from the waist in tangential plane
distance of source surface from the waist in sagittal plane
distance of target surface from the waist in tangential plane
distance of target surface from the waist in sagittal plane
radius of curvature of the wavefront at source surface in tangential plane
radius of curvature of the wavefront at source surface in sagittal plane
radius of curvature of the wavefront at target surface in tangential plane
radius of curvature of the wavefront at target surface in sagittal plane
curvature of the wavefront (1/R) at source surface in tangential plane
curvature of the wavefront (1/R) at source surface in sagittal plane
curvature of the wavefront (1/R) at target surface in tangential plane
curvature of the wavefront (1/R) at target surface in sagittal plane
incremental optical path for phase propagation
total optical path for phase propagation
power of the beam
power density in the center of the beam at the target surface
absorbed power
focal length of thermal lens in tangential plane
focal length of thermal lens in sagittal plane
relative phase of the light amplitude at the target surface
Tangential-plane contribution to local Gouy phase at the source surface
Sagittal-plane contribution to local Gouy phase at the source surface
Tangential-plane contribution to local Gouy phase at the target surface
Sagittal-plane contribution to local Gouy phase at the target surface
Accumulated total Gouy phase at the source surface
Accumulated total Gouy phase at the target surface
Tangential-plane contribution to accumulated Gouy phase at the source surface
Sagittal-plane contribution to accumulated Gouy phase at the source surface
Tangential-plane contribution to accumulated Gouy phase at the target surface
Sagittal-plane contribution to accumulated Gouy phase at the target surface
x start position of the current ray segment at the source surface
y start position of the current ray segment at the source surface
x end position of the current ray segment at the target surface
y end position of the current ray segment at the target surface
x distance of hit on target surface from its center (in input-frame coordinates)
y distance of hit on target surface from its center (in input-frame coordinates)
the label of the surface or component hit by the beam

DR

rs
s1
s2
cp
med
act
Act
rd
ang
Ang
an1
an2
w0t
w0s
w1t
w1s
w2t
w2s
z0t
z0s
z1t
z1s
z2t
z2s
R1t
R1s
R2t
R2s
C1t
C1s
C2t
C2s
ipp
tpp
pw
pd
pa
tlt
tls
ph
gp1t
gp1s
gp2t
gp2s
Gp1
Gp2
Gp1t
Gp1s
Gp2t
Gp2s
x1
y1
x2
y2
dx
dy
lb

Table 5 The keys associated with the available output values.


19 Jul 2013 16:41

44

optocad_ug_0.93i

5.1

T HE

OUTPUT SPECIFIED BY

print

OR

write

T HE O PTO C AD

OUTPUT DATA

changed to n by appending _n to the key, e. g. R1t_6 would print the radius of wavefront curvature
in the tangential plane with 6 significant digits.
For keys specified by print values with a magnitude below 10 9 are printed as 0.0 , for those
specified by write this happens for values below 10 30 . If the magnitude of the value is above 10 9
print outputs <-1.E+9 or >+1.E+9 . For write this limit is 10 30 and it writes -1.E+30 or
1.E+30 .
Key rd : Radial distance of hit

5.1.2

The key rd provides the distance between the hit of the beam on the surface and the reference point of
the surface, i. e. its apex (or symmetry axis). If the parameter zr is 6= 0 the surface is hit at its center
when rd = zr .
Key lb : Surface or component labels

AF

5.1.3

If lb is present in the list of keys, and if there was a label given in the O PTO C AD input data for the
surface hit by the beam, this label is printed and will help identifying this ray segment. The printed label
usually starts with a # for the primary surface, with a + for any other major surface and with - for
any surface added by O PTO C AD for completing a component. If the beam hits a frame outline surface
the label looks like, e. g., @ frame 1 right, unless this surface is concurrent with one surface of the outer
fence in which case the label for the same example would be @ right outside.
Default length for the label string is 16 characters. Appending _n to the key lb reserves a field of n
characters.
5.1.4

Keys ipp and tpp : Optical path for phase propagation

DR

ipp is the incremental optical-path length for phase propagation, counted from a source surface to the
respective target surface. If source and target surface are located in different frames ipp shows the
accumulated partial paths.
tpp shows the total optical-path length accumulated along the beam. It does not contain any Gouy
phases and is reset at the start of the beam, i. e. with each call of OC_TRACE .
5.1.5

Keys gp.. and Gp.. : Gouy phases

These keys show the Gouy phases at the source and the target surfaces. At any point along the beam
there is only one such Gouy phase independent of the plane looked at, whether tangential or sagittal,
but one can split the Gouy phase into a contribution from each of these planes which may be different
for an astigmatic Gaussian beam. The total Gouy phase is the sum of the Gouy-phase contributions
from the tangential and the sagittal planes. Keys with a lower-case g refer to the local Gouy phase
contributions, i. e. to the values = 0.5 arctan(z/z 0 ). A beam, when propagating over some distance
and components, accumulates a certain Gouy phase. Keys with an upper-case G refer to the accumulated
Gouy phase contributions; and especially Gp1 and Gp2 to the total accumulated Gouy phases at the
source and the target surface, i. e. Gp1 = Gp1t + Gp1s and Gp2 = Gp2t + Gp2s .
The accumulated contributions for the two planes are important when calculating the mode spacing of
the resonance frequencies of a cavity with astigmatic components. The mode spacing f in a cavity is
then given by f = FSR Gp/, where FSR is the free spectral range and Gp the round-trip Gouy-phase
contribution for the respective plane.
The accumulated Gouy phases at the source surface of the current ray segment are identical to that of
optocad_ug_0.93i

45

19 Jul 2013 16:41

5.2

T HE

T HE O PTO C AD

OUTPUT OF CAVITY DATA

OUTPUT DATA

the preceeding segment (i. e. the parent segment) at its target surface, since the phase doesnt change
while passing a surface. Like the total optical path tpp also the Gouy phases are accumulated along
the beam, and are reset at the start of the beam, i. e. with OC_TRACE , and with the begin of each final
cavity cycle.

5.2 The output of cavity data


Text output

5.2.1

DR

AF

For each cavity dealt with by O PTO C AD ten additional lines are printed, if pcad > 0 , containing the
characteristic data of the cavity. Eight of them appear just before the start of the final cavity cycle, the
remaining two at its end. The first line contains an identification of the cavity. The next line contains the
accumulated phase shift from all the surfaces in the cavity cycle (also considering a possible detuning),
the free spectral range FSR (in Hz), the bandwidth (in Hz) and the finesse (provided it is defined). The
third line shows, for the tangential plane, the radius w0 of the waist and the Rayleigh range z0 , and the
radius w1 of the beam, the distance z1 to the waist and the radius of curvature R1 of the wavefront
at the entrance mirror, all with respect to the medium the first intra-cavity ray segment is in, and all in
the unit of length selected at the call of OC_INIT . The fourth line is the same as the third line, but
for the sagittal plane. The fifth line contains the mismatch (in position and angle) for closing the cavity
between the returning beam and the input beam, with the position mismatch given in the plane of the
input surface. The sixth line deals with the misalignment between input beam and cavity eigenray, with
the position mismatch again given in the plane of the input surface, the first angle referring to the beam
coming from outside and the second angle to the first ray segment inside the cavity (see below). This
line is meaningful only if the eigenray is determined, i. e. if nice > 0 . The seventh line gives the modematching factor for a perfectly aligned cavity input beam as the product of two factors ( mt * ms ),
showing separately the effect of the mismatch on the light amplitude in the tangential and the sagittal
plane. The eighth line specifies the reflectance and transmittance of the coupling mirror required for
perfect impedance matching.
The last two lines (at the end of the final cavity cycle) contain the round-trip Gouy phase and the mode
spacing for the cavity.
Also for the cavity data the number of significant digits printed can be selected, but only globally for all
values at once. This is done by the (optional) argument ndcav of OC_SET . Setting pcad = 0 (see
OC_SET ) suppresses the output of the cavity data.
All the above mentioned data are also accessible from inside the users main Fortran program via the
derived-type array cavities , as described in Section 1.5 on page 8.
5.2.2

Eigenrays of optical cavities

When treating an optical cavity O PTO C AD attempts to find the eigenray of the cavity, i. e. the (approximate) position and angle of the cavity eigenmode. The component ma of the derived-type array
cavities contains the misalignment between the cavity input beam and the cavity eigenray: ma(1)
the distance between the two in the plane of the input surface, ma(2) the angle between the first ray
segment inside the cavity and the eigenray, and ma(3) the same, but for the actual ray segment hitting the coupling surface and one that would match the eigenray. The distinction between ma(2) and
ma(3) makes sense in case the index of refraction changes when passing the input surface.
This is illustrated in the following figure showing a cavity input mirror. Blue lines represent a misaligned
input beam and red lines the perfectly aligned case including the eigenray. On the left the input beam
is misaligned in position, leading to a negative value for ma(1), since it is measured in the coordinate
19 Jul 2013 16:41

46

optocad_ug_0.93i

5.3

T HE

T HE O PTO C AD

OUTPUT OF LENS DATA

OUTPUT DATA

system of the cavity input surface. On the right the input beam is misaligned in angle, resulting in a
positive ma(2) and a negative ma(3), since for the latter case the input beam is the reference.

ma(3)

ma(1)

ma(2)

AF

If the parameter nice (set by OC_SET or in the ocd file or array) is > 0 the beam inside the cavity is
aligned according to the parameters found for the eigenray, and the cavity test cycles are repeated nice
Roland Schilling, 28 Jul 2010, misalign.ps
times. Hence there will be a mismatch in position and/or angle of the beam inside the cavity with respect
to the input beam . This process is iterated nice times. (See example TRC on page 62f.)
The component mc contains the mismatch for closing the cavity, i. e. the mismatch in position and angle
of the beam returning from a round trip through the cavity with respect to the beam starting at the cavity
input surface. Also here the positional difference ( mc(1) ) is measured in the plane of the cavity input
surface. Therefore, the values of mc can be used as a measure for the matching of the input beam to the
eigenray of the cavity; mc = 0. indicates perfect alignment.

5.3 The output of lens data

DR

For each lens indicated as such in the ocd file or array (by specifying a focal length, see Section 4.3 on
page 41) two lines are printed at the beginning of the terminal output: the first line is called
*** Calculated curvatures ... and the second one *** Principal planes: . The
first line contains the calculated curvatures for the tangential and the sagittal planes. This applies to both
surfaces if the lens is symmetric, i. e. biconvex or biconcave. The second line lists the distances of the
principal planes from the apex of the first surface of the lens in the tangential and sagittal planes for both
surfaces.
The number of significant digits printed is (currently) the same as for cavity data, i. e. given by ndcav .
Setting pcld = 0 (see OC_SET ) suppresses the output of the lens data.

5.4 The output of interference data

For each interference calculated by O PTO C AD four additional lines are printed containing some of the
interference data. The first line notifies the interfering ray segments together with the action they experienced at the joining surface, and the phase difference between them. The following three lines
contain various deviations between the two ray segments, starting with the relative power, i. e.
max(p1 , p2 )/ min(p1 , p2 ) 1 , and the deviations in position and angle. Next comes the deviation in
beam radius and wavefront curvature for the tangential plane, and, finally, the same for the sagittal plane.
Please also note what is said at the beginning of Section 4.1 on page 37.
The number of significant digits printed is (currently) the same as for cavity data, i. e. given by ndcav .
Setting pind = 0 (see OC_SET ) suppresses the output of the interference data.

optocad_ug_0.93i

47

19 Jul 2013 16:41

5.5

O PTO C AD

5.5

O PTO C AD statistics

STATISTICS

T HE

GENERATED

F INESSE

INPUT FILE

At the end of the program a statistics is printed about the number of components, surfaces, cavities, input
beams, ray segments calculated, beams split off and interferences performed. This print can be switched
off by setting pstat = 0 (see Section 2.2 on page 20).

6 The generated F INESSE input file

AF

The output generated by OC_FINESSE is meant as an input file for the program F INESSE. 7 It consists
of lines representing an input beam ( l : laser) and its Gaussian parameters ( gauss ), ray segments
( s : space), surfaces ( m : mirror or bs : beam-splitter) and their additional attributes ( attr ). Cavities
that are indicated as such in the ocd file or array are also recognized and produce a line of type cav .
For complex configurations this may not always work satisfactory and may require subsequent correction
by hand.
The names of the F INESSE space components are composed of rs followed by O PTO C ADs raysegment number, that of the mirror or beam-splitter components of sf followed by O PTO C ADs surface
number. If a surface is used more than once, consecutive letters A , B , C , etc. are appended.
The names of the nodes always start with n followed by O PTO C ADs surface number followed by a
lowercase letter. For m components this letter is f for the front and b for the back of the surface,
where front is that side of the surface which is hit first by the beam and back the other side. According
to the F INESSE syntax only surfaces that are hit under normal incidence are treated as m components,
all others are bs components. O PTO C AD also declares beam dumps (surfaces that have the action d
only) as m components.

DR

For bs components these letters are w , n , e or s , indicating the four directions (west, north, east,
south) of the beams in a standard Michelson interferometer. The beam hitting the surface first is connected to either the node w or n , depending on the angle of incidence. A beam returning to a beamsplitter already registered by OC_FINESSE is connected to one of its nodes only if the position mismatch is less than a beam radius.
At the end of l , m and bs lines a comment is added that comprises the O PTO C AD label of this surface,
as it is given in the ocd file or array. In case of s lines the labels of the source and the target surfaces
are shown. In O PTO C AD, each optical component has one primary surface (the one that is specified
first in the ocd file) and usually one or more secondary surfaces. The primary surface is marked by an
appended {p}, the secondary surfaces by an appended {s}.
The generated kat file does, initially, not contain any photo detectors or F INESSE commands. To
include these you can either add an appropriate array to your main Fortran program, read in an external
file with F INESSE commands (see OC_FINESSE on page 15), or you edit the kat file afterwards. For
some of the F INESSE commands it is necessary to know the ray-segment and surface numbers assigned
by O PTO C AD. Knowledge about these numbers can be obtained by adding the keys rs and s2 to
the string print (or write ) specifying the O PTO C AD text output (see Section 5 on page 43), or by
activating the plot of the ray-segment numbers in OC_BEAM (Section 2.2 on page 12) and the surface
numbers in OC_SURF (Section 2.2 on page 22).
In order to get comparable results it is necessary that F INESSE uses the same wavelength as O PTO C AD.
Hence, the wavelength set in the kat.ini file is checked. If, for older versions (revision < 3362)
of F INESSE, it deviates by more then one-tenth of a percent a warning message is issued and the call
of F INESSE is skipped. For newer versions a correcting lambda statement is added to the generated
kat file in any case.
7

F INESSE is a Frequency domain INterferomEter Simulation SoftwarE, written by Andreas Freise.

19 Jul 2013 16:41

48

optocad_ug_0.93i

T HE

GENERATED

WAVE P ROP

FILE

Please note: Currently grating surfaces cannot yet be dealt with correctly. If required, the kat file has
to be patched by hand.

7 The generated WAVE P ROP file

The Fortran file generated for running WAVE P ROP is by no means the shortest and fastest possible code.
It can only be a framework for the final WAVE P ROP file. It will usually require quite some adaptation
by hand, e. g. the insertion of plot commands or mode decomposition, etc. Or some modifications in
order to speed-up the calculations or to save memory space. Also, e. g., all surfaces are setup over and
over again, any time they are hit by the beam. Hence, a hand-written or modified program can be much
more compact, but for a first test the code generated by OC_WP may do and can serve as a basis for an
improved program.

AF

The generated Fortran file also contains a subroutine SU_SURF for setting up the parameters of the
surfaces. This is because there is only one derived-type variable surf , and the surfaces are setup many
times. Such a subroutine would, in general, not be necessary or reasonable in a hand-written program.
For (aspheric) off-axis surfaces the offset zr of the center of the surface against the apex on the symmetry axis is converted to a zr in y direction, i. e. into zr(2) of the variable surf .
In case of cavities a loop is constructed in order to achieve some resonance step-up. The number of round
trips in a cavity is set to two times the finesse of this cavity. This means that for greater values of nx
and cavities with high finesse the computing time can become quite large. This also holds for coupled
cavities since the total number of round trips is the product of the number of round trips for each cavity.
Here again some adaptation by hand can be very helpful.
The Users Guide of WAVE P ROP (version 0.98c or later) contains an example for the use of OC_WP .

DR

Please note: To work properly, the generated Fortran file should be run with version 0.98c of WAVE P ROP
(or later).

optocad_ug_0.93i

49

19 Jul 2013 16:41

50

19 Jul 2013 16:41

50

optocad_ug_0.93i

A SAMPLE F ORTRAN

E XAMPLES

PROGRAM

8 Examples
Many of the above descriptions of the syntax and the rules for using O PTO C AD will remain quite hard
to understand without some examples.

8.1 A sample Fortran program

Program SAMPLE

A very simple test program for the use of OptoCad.


use optocad
use rsplot
call oc_init

! Load the module OptoCad.


! Load the module RSPLOT.

AF

!
!
!

! Initialize OptoCad (A4 landscape).

!
!

Set up a coordinate system that describes, e.g., a small optical


table (120cm x 80cm) with its origin in the lowerleft corner:
call oc_frame(.0, .0, 1.2, .8, 30. ,25., .2) ! Set up a frame.

Set up a few parameters, e.g.


call oc_set(rix = (/1.45/),
& ! the n of fused silica at 1064nm,
lambda = 1.064e6,
& ! the light wavelength of Nd:YAG and
print = rs s2 act rd ang_6 tpp pw lb) ! the list of printed data.

!
!
!

The following reads the data of the optical components from a file specified
as the first argument to the executable (sample or a.out), or from the
file sample.ocd or a.out.ocd, and returns the number nib of input beams:
call oc_input(, nib)

Set the colors for plotting the beam up to a certain radius:


icb0=1
! Beam axis : black
icb1=2
! Up to 1*w : red
icb2=ps_color((/1., .6, .6/))
! Up to 2*w : light red
icb3=ps_color((/1., .8, .8/))
! Up to 3*w : very light red

!
!

Trace all beams and plot it. The do loop is necssary only if there is
more than one input beam:
do ib=1,nib
! Trace and plot all beams.
call oc_trace(ib)
! Trace all segments of the current beam.
call oc_beam(3.0, fill=icb3)
! Plot the outer part of the beams.
call oc_beam(2.0, fill=icb2)
! Plot the middle part of the beams.
call oc_beam(1.0, fill=icb1)
! Plot the inner part of the beams.
call oc_beam(0.0, icb0, 5, .1)
! Plot beam axes as a dasheddotted line
! ... (see PS_LINE) with linewidth 0.1mm.
end do
! End of loop over all input beams.
call oc_surf
! Plot all surfaces with linewidth 0.2mm.

DR

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
end

This is a Fortran 90 file that can serve as a sample for the first steps in using O PTO C AD. It makes use
almost entirely of the defaults set by O PTO C AD. It expects the .ocd file to be provided as an argument
to the executable or, by default, looks for a file sample.ocd in the current directory.

call oc_exit
end

! Exit OptoCad and close the PostScript file.

The use of the module RSPLOT is necessary because of the two calls of ps_color on lines 27 and 28 .

optocad_ug_0.93i

51

19 Jul 2013 16:41

E XAMPLES

A SIMPLE

OPTICAL CAVITY

8.2 A simple optical cavity example

This is the Fortran 90 file:

!
!

Program OPMC
Modelling a Virgotype output mode cleaner
use optocad
use rsplot
character(len=80)
integer
real
ac
ocd(01)=b
ocd(02)=c
t,
ocd(03)= +
h,
ocd(04)= +
t,
ocd(05)= +
t,
ocd(06)=c crtstr,
ocd(07)= +
d,
ocd(08)= +
r,
ocd(09)= +
d,
ocd(10)= +
str,

:: ocd(10)=
:: ccb1, ccb2, ccb3, fcb1, fcb2, fcb3
:: pst(6)

AF

!
!
!

x
y
rd
ag
c
15.00, 0.0, 0.160,
0., .0032
3.75, 0.0, 4.469, r=.0005, t=.99949
rd= 7.500, da= 90., r=.0005, t=.99949
rd= 4.469, da=180., r=.0005, t=.99949
rd= 7.500, da=270., r=.0005, t=.99949
0.00, 0.0, 5.834, 40., r=.99, t=.01
rd= 8.370, da= 40.
rd= 7.500, da=130., c=.002273, r=1.
rd= 8.370, da=220.
rd= 5.834, da=260., r=.99,
t=.01

label
# input beam
# ioprisms

# pentaprism

call oc_init(unit=mm)
! Initialize OptoCad (A4 landscape)
call oc_frame(15.0,25.0,20.0,10.0,70.,25.,4.,d_tm=3.)! Set up a frame
call oc_set(rix=(/1.45/),
& ! n of fused silica at 1064nm with ...
abs=(/1e5/),
& ! ... 100ppm/cm absorption
lambda=1.064e3,
& ! Light wavelength of Nd:YAG
print=rs s2 act rd ang_6 w2t z2t tpp pw lb)
fcb1=2
! Reference color for beam upto 1*w
fcb2=ps_color((/1.,.6,.6/))
! Reference color for beam upto 2*w
fcb3=ps_color((/1.,.8,.8/))
! Reference color for beam upto 3*w
ccb1=ps_color((/1.,.7,.7/))
! Color for beam contour at 1*w
ccb2=fcb3
! Color for beam contour at 2*w
ccb3=ps_color((/1.,.9,.9/))
! Color for beam contour at 3*w
pst=(/100.,10.,1.,.1,.01,.001/)
! Power thresholds for color steps
call oc_input(ocd)
! This reads the data of the components
call oc_trace
! Trace all ray segments
call oc_beam(3.0,fill=fcb3,lc=ccb3,lw=.1,pst=pst)
! Outer part, ...
call oc_beam(2.0,fill=fcb2,lc=ccb2,lw=.1,pst=pst)
! middle part, ...
call oc_beam(1.0,fill=fcb1,lc=ccb1,lw=.1,pst=pst)
! inner part of beam
call oc_beam(0.0,1,5,.2,rns=2.5,rnc=6)
! Plot beam axes in black ...
! ... and raysegment numbers in magenta
call oc_surf(lw=.3,sns=2.5)
! Plot all surfaces with linewidth 0.3mm
! ... and surface numbers in black
call oc_exit
end

DR

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
end

The following example is a simple, triangular optical cavity, resembling the Virgo output modecleaner.
This modecleaner is essentially a pentaprism that acts as a cavity. In order to keep ingoing and outgoing
beam in line one needs additional triangular prisms on both, the input and the output surface. This can
be modelled by O PTO C AD using one rectangular piece of optical material (e. g. fused silica) in addition
to the pentaprism. The roof of the pentaprism is overlapping the center of the rectangle thus forming the
two extra triangular prisms.

In this example the data of the optical components are given in millimeters, and are included in the
main Fortran file as the character array ocd (lines 13 to 22). Please note the following two points
concerning this method: i) It is recommended to initially fill the character array with the null string to
avoid errors caused by unused array components. ii) Make sure the length (number of characters) is
sufficient, otherwise the strings describing the component surfaces might be truncated. Such an error
cannot be detected by the program!
For demonstration, surface numbers (black, line 45) and ray-segment numbers (magenta, line 43) are
also plotted in this example.
19 Jul 2013 16:41

52

optocad_ug_0.93i

A SIMPLE

E XAMPLES

OPTICAL CAVITY

Running opmc produces the PostScript figure below and the following output on the terminal:
This is OptoCad (Version 0.91c) by Roland Schilling.
All rights reserved. ABSOLUTELY NO WARRANTY!
Input of optical component data from character array.
Beam # 1:
rs s2 a
0
0 n
1
1 t
2
5 t

rs
3
6
7

ang[deg]
0.0
0.0
0.0

w2t[mm]
z2t[mm]
160.0E3 17.27E+0
156.1E3 6.022E+0
155.7E3 4.983E+0

tpp[mm]
0.0
11.25E+0
16.69E+0

power[W]
1.000E+0
1.000E+0
999.5E3

label
@ beam start
# ioprisms
# pentaprism

Evaluated data of cavity 1 (when in resonance):


Roundtrip phase = 0.000E+0, FSR = 4.078E+9, Bandwidth = 13.33E+6, Finesse = 306.0
Tangent. plane: w0 = 154.1E3, z0 = 101.7E+0, w1 = 154.2E3, z1 = 3.751E+0, R1 = 2.761E+3
Sagittal plane: w0 = 155.4E3, z0 = 103.4E+0, w1 = 155.5E3, z1 = 3.751E+0, R1 = 2.852E+3
Mismatch for closing cavity 1: Position: 2.524E3, Angle:
269.1E6
Misalignment w.r.t. cavity eigenray: Position:
0.000E+0, Angle:
0.000E+0,
0.000E+0
Mode matching (for perfect alignment): mt*ms = 999.9E3 * 1.000E+0 = 999.9E3
Perfect impedance matching requires: r = 989.572E3, t = 10.4276E3
9 r
0.0
0.0 154.2E3 3.749E+0 27.56E+0 95.78E+0 + pentaprism
7 r 1.033E3 100.000E+0 158.8E3 25.35E+0 58.88E+0 94.81E+0 + pentaprism
5 i 2.524E3 99.9997E+0 154.2E3 3.751E+0 90.20E+0 94.79E+0 # pentaprism
Roundtrip Gouy phase of cavity 1: 14.00 + 13.78 = 27.78
Mode spacing in cavity 1: Tangent. plane: 317.1E+6, Sagittal plane: 312.2E+6
s2
9
3
5

a
t
t
n

rd[mm]
0.0
0.0
7.500E+0

ang[deg]
0.0
0.0
0.0

AF

***
***
***
***
***
***
***
***
3
4
5
***
***

input beam
rd[mm]
0.0
0.0
0.0

w2t[mm]
154.2E3
154.5E3
157.1E3

z2t[mm]
3.749E+0
7.499E+0
13.92E+0

tpp[mm]
27.56E+0
33.00E+0
41.75E+0

power[W]
95.78E+0
957.8E3
957.3E3

label
+ pentaprism
+ ioprisms
@ frame 1 right

rs s2 a
rd[mm]
ang[deg]
w2t[mm]
z2t[mm]
tpp[mm] power[W] label
5
5 t 2.524E3 99.9997E+0 154.2E3 3.751E+0 16.69E+0 94.79E+0 # pentaprism
*** Interference of ray segment 5t with 2r at surface 5. Phase difference: 180.0E+0
*** Deviations: Rel. power = 43.89E3, Position = 2.524E3, Angle = 269.1E6
***
Tang. plane: Radius = 1.474E3, Curvature = 101.4E6
***
Sagi. plane: Radius = 219.7E6, Curvature = 113.0E6
8
4 t 4.538E+0 100.000E+0 155.5E3 444.6E3 23.27E+0 446.7E6 + ioprisms
9 6 n 4.727E+0 104.583E+0 153.3E3 5.419E+0 28.98E+0 446.5E6 @ frame 1 top

DR

OptoCad statistics:
Number of optical components: 2
Number of optical surfaces: 9
Number of optical cavities: 1
Number of input beams: 1
Number of ray segments: 9
Number of beams split off: 2

10

7
9

10

20
7

10
Roland Schilling, 20 Jul 2005, opmc.ps
optocad_ug_0.93i

53

10

20

19 Jul 2013 16:41

E XAMPLES

VARIOUS

CAVITIES AND INTERFEROMETERS

8.3 Various cavity and interferometer examples


An example showing 8 different cases of optical cavities and interferometers is produced by the following
Fortran and .ocd files:

Various cavity and interferometer examples.


use optocad
use rsplot

Program VACIX

call
call
call
call
call
call
call
call
call
call
call
call

oc_init(A4_P,unit=mm)
! Initialize OptoCad (A4 portrait)
oc_frame(0., 0., 180., 270., 15., 15., ax=)
! Frame w/o axes
ps_set(fs=4.)
! Make 4 mm the default font size
ps_text(1,a) FabryPerot cavity,xc=45.,yb=255.,just=c)
ps_text(1,b) Nested FabryPerot cavities,xc=45.,yb=255.,just=c)
ps_text(1,c) Multireflection cavity,xc=45.,yb=208.,just=c)
ps_text(1,d) Triangular cavity,xc=45.,yb=208.,just=c)
ps_text(1,e) FoxSmith cavity,xc=45.,yb=145.,just=c)
ps_text(1,f) Modified FoxSmith cavity,xc=45.,yb=145.,just=c)
ps_text(1,g) MachZehnder interferometer,xc=45.,yb=65.,just=c)
ps_text(1,h) Simple Michelson interferometer,xc=45.,yb=65.,just=c)
oc_set(lambda=3.e3,
&
! Light wavelength 3.0m
fslb = 2.5,
&
! Font size for labels (mm)
print=rs s2 act rd ang z0t z0s z2t z2s R1t ph pw lb)
call oc_input(,nib)
! Readin optical component data

AF

!
!
!
!

do ib=1,nib
! Trace and plot all beams.
call oc_trace(ib)
! Trace all segments of the current beam.
call oc_beam(3.0,fill=ps_color((/1.,.8,.8/))) ! Plot outer part of beam
call oc_beam(2.0,fill=ps_color((/1.,.6,.6/))) ! Plot middle part of beam
call oc_beam(1.0,fill=2)
! Plot inner part of beam
call oc_beam(0.0, 1, 5, .2)
! Plot the beam axes in black
call oc_reset
! Prepare for repeated call of OC_TRACE
end do
call oc_surf(lw=.3)
! Plot all surfaces with linewidth 0.3mm
call oc_exit
end

DR

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
end

The file containing the optical-component data (.ocd-file) is shown on the next page, followed by a plot
of the generated PostScript file. Please note that the modes of the input beams are not matched to the
Gaussian eigenmodes of the cavities. Thus the beam radii of the input beams and that inside the cavities
are different. Moreover, example c , a multi-reflection cavity, is confocal and hence unstable.

19 Jul 2013 16:41

54

optocad_ug_0.93i

# File vacix.ocd : Various cavity and interferometer examples.


#
# a) Simple FabryPerot cavity:
#
ac
x
y
rd
ag
c
m
r
t # label
b
5.,
238., .50,
0.00
# Simple FabryPerot cavity
d
crtstr,
20.,
238., 10.,
180., .010, 1,
.9, .1 # FP_1 @cb1,11.5
+
t, dx=3.
d
r,
70.,
238., 10.,
0., .010, 1,
1., .0 # FP_2 @cb2,11.5
+
d, dx=3.
c
d,
0.,
238., 5.
# BD_0 @cb0,6.5
#
# b) Nested FabryPerot cavities:
#
ac
x
y
rd
ag
c
m
r
t # label
b
105.,
238., .50,
0.00
# Nested FabryPerot cavities
d
crtstr, 120.,
238., 10.,
180., .010, 1,
.9, .1 # NFP_1 @cb1,11.5
+
t, dx=3.
d
crtstr, 140.,
238., 10.,
180., .000, 1,
.9, .1 # NFP_2 @cb1,11.5
+
t, dx=3.
d
r, 170.,
238., 10.,
0., .010, 1,
1., .0 # NFP_3 @cb2,11.5
+
d, dx=3.
c
d, 100.,
238., 5.
# BD_0 @cb0,6.5
#
# c) Multireflection cavity:
#
ac
x
y
rd
ag
c
m
r
t # label
b
5.,
178., .30,
0.00
# Multireflection cavity
d crt[{str}3]str,
20.,
183., 10.,
180., .000, 1,
.9, .1 # MRC_1 @cb1,11.5
+
t, dx=3.
d
r,
70.,
183., 10.,
0., .010, 1,
1., .0 # MRC_2 @cb2,11.5
+
d, dx=3.
c
d,
0.,
183., 10.
# BD_0 @cb0,11.5
#
# d) Triangular cavity:
#
ac
x
y
rd
ag
c
m
r
t # label
b
105., 169.2, .50, 11.31
# Triangular cavity
d
crtstr, 120.,
173., 10.,129.345, .000, 1,
.9, .1 # TC_1 @lc9,7
+
t, dx=3.
d
r, 170.,
183., 10.,
0.00, .015, 1,
.9, .1 # TC_2 @cb1,11.5
+
d, dx=3.
d
r, 120.,
193., 10., 129.345, .000, 1,
.9, .1 # TC_3 @lc9,7
+
d, dx=3.
c
d, 119.,
160., 5.,
90.
# BD_1 @ct0,1
#
# e) FoxSmith cavity:
#
ac
x
y
rd
ag
c
m
r
t # label
b
5.,
94., .50,
0.00
# FoxSmith cavity
d
crt[str]str,
30.,
95., 10., 135., .000, 1,
.9, .1 # BS
@cb7,8
+
t, dx=3.
d
r,
70.,
95., 10.,
0., .010, 1,
1., .0 # FS_1 @cb2,11.5
+
d, dx=3.
d
r,
30.,
135., 10.,
90., .010, 1,
1., .0 # FS_2 @cb0,4.5
+
d, dx=3.
c
d,
0.,
94., 5.
# BD_0 @cb0,6.5
c
d,
29.,
80., 5.,
90.
# BD_1 @ct0,1
#
# f) Modified FoxSmith cavity:
#
ac
x
y
rd
ag
c
m
r
t # label
b
120.,
110., .50,
0.00
# Modified FoxSmith cavity
d
ctr[srt]srt, 135.,
110., 10.,
45., .000, 1,
.1, .9 # BS
@cb8,8
+
t, dx=3.
d
r, 136.,
85., 10.,
90., .020, 1,
1., .0 # MFS_1 @ct0,4
+
d, dx=3.
d
r, 135.,
135., 10.,
90., .020, 1,
1., .0 # MFS_2 @cb0,4.5
+
d, dx=3.
c
d, 110.,
110., 5.
# BD_0 @cb0,6.5
c
d, 160.,
109., 5.
# BD_1 @cb0,6.5
#
# g) MachZehnder interferometer:
#
ac
x
y
rd
ag
c
m
r
t # label
b
5.,
10., .50,
0.00
# MachZehnder interferometer
d
str,
20.,
10., 10.,
45.,
0., 1,
.5, .5 # BS
@cb8,8
+
t, dx=3.
d
r,
60.,
9., 10.,
45.,
0., 1,
1., .0 # MZ_1 @cb8,8
+
d, dx=3.
d
r,
20.,
45., 10.,
135.,
0., 1,
1., .0 # MZ_2 @cb6,10
+
d, dx=3.
d
i(rt)srt,
60.,
44., 10.,
135.,
0., 1,
.5, .5 # RP
@cb6,10
+
t, dx=3.
c
d,
59.,
58., 5.,
90.
# BD_2 @rc6,0
c
d,
73.,
44., 5.
# BD_1 @cb0,6.5
#
# h) Simple Michelson interferometer:
#
ac
x
y
rd
ag
c
m
r
t # label
b
105.,
15., .50,
0.00
# Simple Michelson interferometer
d
srti(ntr)str, 130.,
15., 10.,
45.,
0., 1,
.5, .5 # BS
@cb8,8
+
t, dx=3.
d
r, 170.,
15., 10.,
0.,
0., 1, 1.<+90, .0 # MI_1 @cb2,11.5
+
d, dx=3.
d
r, 130.,
55., 10.,
90.,
0., 1, 1.<90, .0 # MI_2 @cb0,4.5
+
d, dx=3.
c
d, 100.,
15., 5.
# BD_0 @cb0,6.5
c
d, 131.,
.1, 5.,
90.
# BD_1 @ct0,1

AF

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
end

E XAMPLES

CAVITIES AND INTERFEROMETERS

DR

VARIOUS

optocad_ug_0.93i

55

19 Jul 2013 16:41

E XAMPLES

VARIOUS

a) FabryPerot cavity
FP1

CAVITIES AND INTERFEROMETERS

b) Nested FabryPerot cavities


FP2

NFP1

NFP2

NFP3

BD0

BD0

c) Multireflection cavity

d) Triangular cavity
TC3

MRC1

MRC2

AF

BD0

TC2

TC1

BD1

e) FoxSmith cavity
FS2

f) Modified FoxSmith cavity


MFS2

BS

BD0

DR

BD0

BD1

FS1

BS

MFS1

BD1

g) MachZehnder interferometer
MZ2

BD2

BS

RP

MI2

BD1

BS

BD0

MI1

MZ1

BD1

Roland Schilling, 03 Aug 2010, vacix.ps

19 Jul 2013 16:41

h) Simple Michelson interferometer

56

optocad_ug_0.93i

P OWER - RECYCLED

SIMPLE

M ICHELSON

E XAMPLES

INTERFEROMETER

8.4 A power-recycled simple Michelson interferometer


The main purpose of the following example is to demonstrate the use of OC_FINESSE . Subject is a
simple, power-recycled Michelson interferometer. A few F INESSE commands (in the array kat ) tune
the phase at one of the interferometer mirrors and connect an amplitude detector to the power-recycling
mirror inside the PR cavity.

!
!

Modelling a simple, powerrecycled Michelson interferometer.

Program PRMI

use optocad
use rsplot
character(len=80)

:: ocd(20)=, kat(10)=

ac
x
y
ocd(01)=b
0., 0.,
ocd(02)=d
crtstr, 15., 0.,
ocd(03)= +
t, dx=3.
ocd(04)=d stri(nrt)srt, 35., 0.,
ocd(05)= +
t, dx=3.
ocd(06)=d
r, 75., 1.,
ocd(07)= +
d, dx=3.
ocd(08)=d
r, 35., 40.,
ocd(09)= +
d, dx=3.
ocd(10)=c
d,10., 0.,
ocd(11)=c
d, 36.,15.,
ocd(12)=c
h, 0., 0.,

rd
ag
c m
.50, 0.
10., 180.,.002, 1,

t # label
# Input beam
.9, .1 # PRM @cb1,13

10., 45., .000, 1,

.5, .5 # BS

AF

!
!
!

10.,
10.,

@cb7,9

0.,.002, 1, 1.<+88, .0 # MI_1 @cb1,13

90.,.002, 1, 1.<88, .0 # MI_2 @cb0,5

5.
5., 90.
5., sc=13

# BD_0 @cb0,6.5
# BD_1 @ct0,1
# Beam start @ct1,6,.8

kat(01)=xaxis sf9 phi lin 180 180 300


kat(02)=yaxis abs:deg
kat(03)=gnuterm ceps
kat(04)=ad ad1 0 n1b
kat(05)=trace 2
kat(06)=retrace off

call oc_init(unit=mm)
! Initialize OPTOCAD (A4 landscape)
call oc_frame(15.,20.,85.0,50.,40.,30.,2.,glp=0)
! Set up a frame
call oc_set(fslb=4.,print=rs s2 act rd ang_6 w0t w2t z2t tpp pw lb)
ico=ps_color((/1.,.8,.8/))
! color for outer part of beam
icm=ps_color((/1.,.6,.6/))
! color for middle part of beam
ici=2
! color for inner part of beam
call oc_input(ocd)
! This reads the data of the components.
call oc_trace
! Trace all ray segments
call oc_beam(3.0,fill=ico)
! Plot outer part of beam
call oc_beam(2.0,fill=icm)
! Plot middle part of beam
call oc_beam(1.0,fill=ici)
! Plot inner part of beam
call oc_beam(0.0,1,5,.1,rnc=1)
! Plot the beam axes and numbers in black
call oc_surf(lw=.3,snc=6)
! Plot all surfaces with linewidth 0.3mm

DR

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
end

call oc_finesse(kat)
call oc_exit
end

optocad_ug_0.93i

57

19 Jul 2013 16:41

E XAMPLES

P OWER - RECYCLED

SIMPLE

M ICHELSON

INTERFEROMETER

The following shows the output to the terminal:


This is OptoCad (Version 0.91c) by Roland Schilling.
All rights reserved. ABSOLUTELY NO WARRANTY!
Input of optical component data from character array.
Beam # 1:
rs s2 a
0
0 n
1
2 t
2
1 t

Input beam
rd[mm]
0.0
0.0
0.0

ang[deg]
0.0
0.0
0.0

w0t[mm]
500.0E3
500.0E3
500.0E3

w2t[mm]
500.0E3
500.1E3
500.1E3

z2t[mm]
0.0
12.00E+0
21.00E+0

tpp[mm]
0.0
12.00E+0
16.50E+0

power[W]
1.000E+0
1.000E+0
1.000E+0

label
@ beam start
+ PRM
# PRM

Evaluated data of cavity 1 (when in resonance):


Roundtrip phase = 0.000E+0, FSR = 2.498E+9, Bandwidth = 42.39E+6, Finesse = 58.9
Tangent. plane: w0 = 200.5E3, z0 = 118.7E+0, w1 = 206.8E3, z1 = 30.00E+0, R1 = 500.0E+0
Sagittal plane: w0 = 200.5E3, z0 = 118.7E+0, w1 = 206.8E3, z1 = 30.00E+0, R1 = 500.0E+0
Mismatch for closing cavity 1: Position: 2.283E15, Angle:
0.000E+0
Misalignment w.r.t. cavity eigenray: Position:
0.000E+0, Angle:
0.000E+0,
0.000E+0
Mode matching (for perfect alignment): mt*ms = 671.5E3 * 671.5E3 = 450.9E3
Perfect impedance matching requires: r = 998.782E3, t = 1.21797E3
5 r
0.0
0.0 200.5E3 201.2E3 10.00E+0 36.50E+0 16.74E+0 # BS
13 r
0.0 90.0000E+0 200.5E3 206.8E3 30.00E+0 76.50E+0 8.372E+0 # MI_2
5 i
0.0 90.0000E+0 200.5E3 201.2E3 10.00E+0 116.5E+0 8.372E+0 # BS

rs
3
6
7
8
9
***
***
***
***
10
***
***

s2 a
rd[mm]
ang[deg]
w0t[mm]
w2t[mm]
z2t[mm]
tpp[mm] power[W] label
5 t
0.0
0.0 200.5E3 201.2E3 10.00E+0 36.50E+0 16.74E+0 # BS
6 t 1.604E+0 16.8745E+0 250.1E3 250.8E3 19.93E+0 41.60E+0 8.372E+0 + BS
9 r 12.57E3
0.0 200.5E3 206.1E3 28.20E+0 78.35E+0 8.372E+0 # MI_1
6 t 1.601E+0 179.997E+0 199.3E3 199.5E3 5.761E+0 115.1E+0 8.372E+0 + BS
5 t 2.717E3 163.127E+0 248.6E3 249.0E3 16.85E+0 120.2E+0 8.372E+0 # BS
Interference of ray segment 9t with 5r at surface 5. Phase difference: 4.000E+0
Deviations: Rel. power = 530.4E18, Position = 2.717E3, Angle = 2.882E3
Tang. plane: Radius = 1.594E3, Curvature = 181.1E6
Sagi. plane: Radius = 889.6E6, Curvature = 98.04E6
1 i
0.0 180.000E+0 200.5E3 206.8E3 30.00E+0 136.5E+0 16.72E+0 # PRM
Roundtrip Gouy phase of cavity 1: 28.36 + 28.36 = 56.72
Mode spacing in cavity 1: Tangent. plane: 393.6E+6, Sagittal plane: 393.6E+6

AF

***
***
***
***
***
***
***
***
3
4
5

rs s2 a
rd[mm]
ang[deg]
w0t[mm]
w2t[mm]
z2t[mm]
tpp[mm] power[W] label
9
5 r 2.717E3 163.127E+0 248.6E3 249.0E3 16.85E+0 116.5E+0 8.372E+0 # BS
*** Interference of ray segment 9r with 5t at surface 5. Phase difference: 176.0E+0
*** Deviations: Rel. power = 530.4E18, Position = 2.717E3, Angle = 1.540E3
***
Tang. plane: Radius = 1.980E3, Curvature = 77.64E6
***
Sagi. plane: Radius = 889.6E6, Curvature = 65.36E6
11
6 t 1.604E+0 73.1255E+0 250.1E3 251.3E3 26.74E+0 121.6E+0 20.39E3 + BS
12 18 d 12.57E3 90.0000E+0 200.5E3 204.3E3 23.20E+0 133.3E+0 20.39E3 # BD_1

DR

rs s2 a
rd[mm]
ang[deg]
w0t[mm]
w2t[mm]
z2t[mm]
tpp[mm] power[W] label
10
1 t
0.0 180.000E+0 200.5E3 206.8E3 30.00E+0 16.50E+0 16.72E+0 # PRM
*** Interference of ray segment 10t with 2r at surface 1. Phase difference: 180.0E+0
*** Deviations: Rel. power = 858.2E3, Position = 2.283E15, Angle = 0.000E+0
***
Tang. plane: Radius = 293.2E3, Curvature = 2.017E3
***
Sagi. plane: Radius = 293.2E3, Curvature = 2.017E3
13
2 t
0.0 180.000E+0 109.7E3 506.1E3 240.0E+0 21.00E+0 118.7E3 + PRM
14 17 d
0.0 180.000E+0 109.7E3 572.6E3 182.0E+0 43.00E+0 118.7E3 # BD_0

FINESSE pre0.99.8 (build 3354)


o_.=.
Frequency domain INterferomEter Simulation SoftwarE
(\".\|
29.10.2009
A. Freise (afreise@googlemail.com)
.> (_.
_=/d
,^\
Input file prmi_1.kat,
~~ \)

Output file prmi_1.out,


/ |
Gnuplot file prmi_1.gnu

Tue Mar 22 16:44:13 2011

cavity tracing
cavity cavity1:
cavity is stable! Eigenvalues:
q=(0.03 + 0.118743i), w0=200.53984um z=30mm
finesse : 4.01179, roundtrip power loss: 0.775
opt. length: 120mm, FSR: 2.4982705GHz
FWHM: 622.73256MHz (pole: 311.36628MHz)
cavity cavity1A:
cavity is stable! Eigenvalues:
qx=(0.0291013 + 0.117063i), w0x=199.1159um zx=29.101325mm
qy=(0.0295063 + 0.117824i), w0y=199.76204um zy=29.506286mm
finesse : 4.01179, roundtrip power loss: 0.775
opt. length: 123.69461mm, FSR: 2.4236501GHz
FWHM: 604.13226MHz (pole: 302.06613MHz)
OptoCad statistics:
Number of optical components: 7
Number of optical surfaces: 19
Number of optical cavities: 1
Number of input beams: 1
Number of ray segments: 14
Number of beams split off: 3

19 Jul 2013 16:41

58

optocad_ug_0.93i

P OWER - RECYCLED

SIMPLE

M ICHELSON

E XAMPLES

INTERFEROMETER

The upper part of this output originates from O PTO C AD, the lower part from F INESSE. Both programs
produce data about the power-recycling cavity, but these data dont agree exactly. The reason for this
discrepancy is that O PTO C AD performs kind of an idealized interference of the two beams returning
from the arms of the interferometer, hence seeing only one (split) cavity with low losses for a dark-fringe
operating point. F INESSE, however, treats both arms separately, thus seeing two cavities which both
seem to have high losses because of the 50 % beam-splitter.

MI2
15

40

The following figure shows the plot generated by O PTO C AD. The small-sized black figures indicate the
ray-segment numbers, the magenta ones the surface numbers.

14

16

AF

13

20
PRM
4

BD0
17

19
14

Beam start

10

11

11 6

DR

12

20

MI1

BS

13
1

10
12

18

BD1

20

40

60

80

Roland Schilling, 08 Jan 2007, prmi.ps

optocad_ug_0.93i

59

19 Jul 2013 16:41

E XAMPLES

P OWER - RECYCLED

SIMPLE

M ICHELSON

INTERFEROMETER

And this is the F INESSE input file ( prmi.kat ) generated by O PTO C AD:
# Generated by OptoCad version 0.90

l i1 1.E0 0 n0
# Input beam
gauss g1 i1 n0 500.E6 0.E0 500.E6 0.E0
s rs1 12.E3 1. n0 n2f
# beam start{p} > PRM{s}
m sf2 0.E0 1.E0 0 n2f n2b
# PRM{s}
s rs2 3.E3 1.5 n2b n1f
# PRM{s} > PRM{p}
m sf1 900.E3 100.E3 0 n1f n1b
# PRM{p}
attr sf1 Rcx 500.E3 Rcy 500.E3
s rs3 20.E3 1. n1b n5w
# PRM{p} > BS{p}
bs sf5 500.E3 500.E3 0 45.E0 n5w n5n n5e n5s # BS{p}
s rs4 40.E3 1. n5n n13f
# BS{p} > MI_2{p}
m sf13 1.E0 0.E0 0 n13f dump
# MI_2{p}
attr sf13 Rcx 500.E3 Rcy 500.E3
s rs6 3.401680257E3 1.5 n5e n6w
# BS{p} > BS{s}
bs sf6 0.E0 1.E0 0 28.1255057E0 n6w dump n6e dump
# BS{s}
s rs7 36.74478608E3 1. n6e n9f
# BS{s} > MI_1{p}
m sf9 1.E0 0.E0 0 n9f dump
# MI_1{p}
attr sf9 Rcx 500.E3 Rcy 500.E3
s rs11 3.401680257E3 1.5 n5s n6An
# BS{p} > BS{s}
bs sf6A 0.E0 1.E0 0 28.1255057E0 dump n6An dump n6As
# BS{s}
s rs12 11.74478624E3 1. n6As n18f
# BS{s} > BD_1{p}
m sf18 0 0 0 n18f dump
# BD_1{p}
cav cavity1 sf1 n1b sf13 n13f
cav cavity1A sf1 n1b sf9 n9f
xaxis sf9 phi lin 180 180 300
yaxis abs:deg
gnuterm ceps
ad ad1 0 n1b
trace 2
retrace off

AF

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
end

3.5
3

Abs

2.5
2
1.5
1
0.5
0

-150

-100

-50

50

200
150
100
50
0
-50

Phase [Deg]

DR

prmiby F INESSESun
Jan 7in18:14:12
2007figure:
The gnuplot output produced
is shown
the following

-100
-150
100

150

-200

phi [deg] (sf9)


n1f : Phase [Deg]

n1f : Abs

19 Jul 2013 16:41

60

optocad_ug_0.93i

P OWER - RECYCLED M ICHELSON

INTERFEROMETER WITH

FP ARMS

E XAMPLES

8.5 A power-recycled Michelson interferometer with FP arm cavities


The following example shows a power-recycled Michelson interferometer with Fabry-Perot cavities in
the interferometer arms.

!
!

use optocad
use rsplot
character(len=80)
real

:: ocd(20)=
:: pst(5)

ac
ocd(01)=b
ocd(02)=d
crtstr,
ocd(03)= +
t,
ocd(04)=d srti(tnr){str},
ocd(05)= +
{srt},
ocd(06)=d
crtstr,
ocd(07)= +
t,
ocd(08)=d
r,
ocd(09)= +
d,
ocd(10)=d
crtstr,
ocd(11)= +
t,
ocd(12)=d
r,
ocd(13)= +
d,
ocd(14)=c
d,
ocd(15)=c
d,
ocd(16)=c
h,
ocd(17)=c
d,
ocd(18)=c
d,
ocd(19)=c
d,
call
call
call
call

Program PRMIFP
Modelling a powerrecycled Michelson IFO with FPcavities in the arms.

x
y
rd
ag
c
75., 100.,1.18, z=165.
125., 100., 30., 180., 1e5,
dm=10.
200., 100., 30., 45.,
0.,
dm=10., r=.01
300., 95., 30., 180.,
0.,
dm=10., t=1.<+90
500., 95., 30.,
0., 1e5,
dm=10.
200., 200., 30., 90.,
0.,
dm=10.
200., 400., 30., 90., 1e5,
dm=10.
25., 100., 25.
205., 20., 25., 90.
75., 100., 25., sc=13
270., 114., 13.
217., 170., 13., 90.
150., 83., 13.

# label
# Input beam
r=.9 # PR @cb5,40
r=.5 # BS @cb35,35

r=.9 # Me1 @rb10,40


r=1. # Me2 @cb4,40

AF

!
!
!
!

r=.9 # Mn1 @lt40,3


r=1. # Mn2 @lb40
#
#
#
#
#
#

BDw1 @cb,30,.8
BDs @ct,5,.8
Beam start @ct,30,.8
BDe @cb,18,.8
BDn @lc18,,.8
BDw2 @ct,18,.8

oc_init(A4_P,unit=mm)
! Initialize OPTOCAD (A4 portrait)
oc_frame(0.,0.,1000.,1500.,10.,20.,.3,ax=)
! Set up a frame
oc_set(fslb=3.,print=rs s2 act rd ang w2t z2t tpp ph pw lb)
oc_input(ocd)
! This reads the data of the optical components

lpba=ps_pattern([30 10 8 10]0.) ! Pattern for plotting the beam axis


pst=(/1.e2,1.,1.e2,1.e4,1.e6/) ! Power steps for plotting the beam body
call oc_trace
! Trace all ray segments
call oc_beam(3.0,fill=ps_color((/1.,.8,.8/)),pst=pst) ! Plot outer part
call oc_beam(2.0,fill=ps_color((/1.,.6,.6/)),pst=pst) ! Plot middle part
call oc_beam(1.0,fill=2,pst=pst)
! Plot inner part
call oc_beam(0.0,1,lpba,.1)
! Plot the beam axes
call oc_surf(lw=.3)
! Plot all surfaces with linewidth 0.3mm
call oc_exit
end

DR

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
end

Mn2

Mn1

BDn

PR

BDw1

Beam start

BS

BDe

Me1

Me2

BDw2

BDs

optocad_ug_0.93i
Roland Schilling, 22 Apr 2010, prmifp.ps

61

19 Jul 2013 16:41

E XAMPLES

T RIANGULAR

CAVITY INSERTING PRESET COMPONENTS

8.6 A triangular cavity inserting preset components


This is an example using a preset mirror and a preset photodiode component. The generic mirror component is specified as a character array internal to the main Fortran file, the photodiode component as an
external file (just to demonstrate both alternatives). Individual parameters for the component mirror are
action string ( a ), curvature ( c ) and reflectance ( r ). Furthermore, the mirror TRC 3 is intentionally
misaligned by 2 deg to show the resulting mismatch between input beam and cavity eigenray.

Program TRC

!
!
!

Triangular ring cavity using preset components.


use optocad
use rsplot
character(len=80)
character(len=128)

ocd(1)=b
ocd(2)=i
ocd(3)=i
ocd(4)=i
ocd(5)=i

:: ocd(10)=
:: mir(3)=

15., 3.8, .25, 11.31


mirror, ag=129.345
% crtstr, 0., .9
mirror, 0., 20., 131.345 % r
mirror, 50., 10., 0., 1.5 % c=.015
phd.ocd, 1.,18.,90., .8

mir(1)=p a=r, c=0., r=1.


mir(2)=d @a, 0., 0., 10., 0., c, r=r
mir(3)= + t, dx=3.

#
#
#
#
#

AF

Triangular cavity
TRC_1 @lc9,7
TRC_3 @lc9,7
TRC_2 @lb6
PhD @6,1

# Mirror

call oc_init(unit=mm)
! Initialize OPTOCAD (A4 landscape)
call oc_frame(25.,25.,65.0,35.,40.,30.,2.,glp=0)
! Set up a frame
call oc_set(nice = 1,
&
! One iteration for cavity eigenray
pstat= 0,
&
! Switch off output of statistics
fslb = 4.,
&
! Font size for labels (mm)
print=rs s2 act rd ang w0t w0s z2t z2s pw lb)
call oc_bind(mirror,mir)
call oc_input(ocd)
! read in data of optical components

call
call
call
call
call
call

oc_trace
! Trace all ray segments
oc_beam(3.0,fill=ps_color((/1.,.8,.8/)))! Plot outer part of beam
oc_beam(2.0,fill=ps_color((/1.,.6,.6/)))! Plot middle part of beam
oc_beam(1.0,fill=2)
! Plot inner part of beam
oc_beam(0.0,1,5,.2,rnc=1)
! Plot the beam axes in black
oc_surf(lw=.3,snc=6)
! Plot all surfaces with linewidth 0.3mm

DR

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
end

call oc_exit
end

The photodiode file phd.ocd looks like


1
2
3
4
5
6
end

#
#
d

Generic OCDfile for a photo diode with window

+
+

d, 0., 0., 5., 0.


# Photodiode
d, dm=0., rd=3.2, c=0.3125, icc=14
t, 4., 0., 5., 0.
# Window @6,1
t, dm=1.

19 Jul 2013 16:41

62

optocad_ug_0.93i

T RIANGULAR

E XAMPLES

CAVITY INSERTING PRESET COMPONENTS

The above Fortran file produces the following output on the terminal:
This is OptoCad (Version 0.91c) by Roland Schilling.
All rights reserved. ABSOLUTELY NO WARRANTY!
Input
Input
Input
Input
Input

of
of
of
of
of

optical
optical
optical
optical
optical

component
component
component
component
component

data
data
data
data
data

from
from
from
from
from

character array.
character array mirror
character array mirror
character array mirror
file phd.ocd

AF

Beam # 1: Triangular cavity


rs s2 a
rd[mm] ang[deg]
w0t[mm]
w0s[mm]
z2t[mm]
z2s[mm] power[W] label
0
0 n
0.0 11.31E+0 250.0E3 250.0E3
0.0
0.0 1.000E+0 @ beam start
1
2 t 1.445E+0 11.31E+0 250.0E3 250.0E3 12.22E+0 12.22E+0 1.000E+0 + TRC_1
2
1 t 45.96E3 25.65E+0 293.0E3 250.0E3 28.48E+0 21.64E+0 1.000E+0 # TRC_1
*** WARNING from OC_TRACE:
Light path of cavity 1 badly aligned or not closed at all!
*** Evaluated data of cavity 1 (when in resonance):
*** Roundtrip phase = 0.000E+0, FSR = 2.432E+9, Bandwidth = 122.6E+6, Finesse = 19.8
*** Tangent. plane: w0 = 126.7E3, z0 = 47.39E+0, w1 = 129.8E3, z1 = 10.60E+0, R1 = 222.4E+0
*** Sagittal plane: w0 = 130.0E3, z0 = 49.86E+0, w1 = 132.9E3, z1 = 10.60E+0, R1 = 245.1E+0
*** Mismatch for closing cavity 1: Position:
1.941E+0, Angle: 3.958E+0
*** Misalignment w.r.t. cavity eigenray: Position:
1.780E+0, Angle:
2.450E+0, 1.377E+0
*** Mode matching (for perfect alignment): mt*ms = 806.3E3 * 818.4E3 = 659.9E3
*** Perfect impedance matching requires: r = 810.000E3, t = 190.000E3
*** Repetition 1 of cavity test cycles to (further) approach the eigenray of cavity 1:
rs s2 a
rd[mm] ang[deg]
w0t[mm]
w0s[mm]
z2t[mm]
z2s[mm] power[W] label
***
***
***
***
***
***
***
***
3
4
5
***
***

Evaluated data of cavity 1 (when in resonance):


Roundtrip phase = 0.000E+0, FSR = 2.458E+9, Bandwidth = 123.9E+6, Finesse = 19.8
Tangent. plane: w0 = 127.4E3, z0 = 47.94E+0, w1 = 129.6E3, z1 = 8.958E+0, R1 = 265.5E+0
Sagittal plane: w0 = 129.6E3, z0 = 49.61E+0, w1 = 131.7E3, z1 = 8.958E+0, R1 = 283.7E+0
Mismatch for closing cavity 1: Position:
107.7E3, Angle: 50.16E3
Misalignment w.r.t. cavity eigenray: Position:
1.750E+0, Angle:
2.530E+0, 1.421E+0
Mode matching (for perfect alignment): mt*ms = 809.0E3 * 817.0E3 = 661.0E3
Perfect impedance matching requires: r = 810.000E3, t = 190.000E3
9 r 829.0E3 8.860E+0 127.4E3 129.6E3 60.99E+0 60.99E+0 3.093E+0 # TRC_2
5 r 2.763E+0 170.2E+0 127.4E3 129.6E3 8.144E+0 8.144E+0 2.784E+0 # TRC_3
1 i 1.718E+0 87.50E+0 127.4E3 129.6E3 8.958E+0 8.958E+0 2.505E+0 # TRC_1
Roundtrip Gouy phase of cavity 1: 51.83 + 50.87 = 102.70
Mode spacing in cavity 1: Tangent. plane: 707.7E+6, Sagittal plane: 694.7E+6

DR

rs s2 a
rd[mm] ang[deg]
w0t[mm]
w0s[mm]
z2t[mm]
z2s[mm] power[W] label
5
1 t 1.718E+0 87.50E+0 127.4E3 129.6E3 8.958E+0 8.958E+0 2.505E+0 # TRC_1
*** Interference of ray segment 5t with 2r at surface 1. Phase difference: 180.0E+0
*** Deviations: Rel. power = 2.592E+0, Position = 1.672E+0, Angle = 1.405E+0
***
Tang. plane: Radius = 137.9E3, Curvature = 1.541E3
***
Sagi. plane: Radius = 119.0E3, Curvature = 2.069E3
6
2 t 1.353E+0 104.3E+0 293.0E3 250.0E3 31.79E+0 24.95E+0 200.8E3 + TRC_1
7 17 t 144.5E3 90.00E+0 250.0E3 250.0E3 27.05E+0 28.25E+0 200.8E3 # Window
8 18 t 144.5E3 90.00E+0 250.0E3 250.0E3 41.38E+0 43.18E+0 200.8E3 + Window
9 13 d 144.5E3 90.00E+0 250.0E3 250.0E3 29.99E+0 31.19E+0 200.8E3 # PhD

20

TRC3

11
9

TRC2
3

6 2

10

12

TRC1

17 19
Window
8
20 18
9 13
PhD
1614
15

20
20
Roland Schilling, 30 Jul 2010, trc.ps

optocad_ug_0.93i

20

63

40

60

19 Jul 2013 16:41

E XAMPLES

P OLARIZING

BEAM - SPLITTERS

8.7 Polarizing beam-splitters


The following Fortran file contains two examples, a thin-film polarizing beam-splitter cube and a GlanTaylor-type polarizer. Although O PTO C AD doesnt know polarization, the file shows a way how to
simulate polarization dependent components with O PTO C AD. The trick is to double the essential part(s)
and rely on O PTO C ADs treatment of overlaying surfaces/components (see Section 4.5 on page 42).

In case of the polarizing beam-splitter cube only the beam-splitting surface has been doubled ( ocd(06) ,
ocd(07) ), and these two surfaces can be given different r and t values, referring to the two planes
of polarization. With only one such surface it would be an ordinary, non-polarizing beam-splitter.
The Glan-Taylor polarizer consists of two prisms with an air gap (of 7.8 m) in between. Here, both
prisms have been doubled, and the two sets have been given different indeces of refraction (for the oand the e-beam in calcite).

!
!
!

Program PBS
Modelling polarizing beam splitters.
use optocad
use rsutil
use rsplot
character(80)

AF

!
!
!

:: ocd(40)=

ac
x
y
rd
ag
c m
r
t # label
ocd(01)=b
10.00, 75., 1.0
ocd(02)=c
t, 40.00, 75., 10.0,
0., 0., 1, .005, .995 # PBScube
ocd(03)= +
t, rd=10., ag= 90., r=.005, t=.995
ocd(04)= +
t, rd=10., ag=180., r=.005, t=.995
ocd(05)= +
t, rd=10., ag=270., r=.005, t=.995
ocd(06)=c srt, 50.00, 75., 14.1, 45., 0., 1, .995, .000 # PBS2
ocd(07)=c srth, 50.00, 75., 14.1, 45., 0., 1, .490, .490 # \bf PBS @15,13
ocd(08)=d
t, 80.00, 75., 10.0
# \lambda/4 @cb1,15
ocd(09)= +
t, dx=2.
ocd(10)=d
r,100.00, 75., 10.0
# M @lb1,15
ocd(11)= +
d, dx=5.
ocd(12)=c
d, 50.00, 55., 10.0, 90.
# Beam dump
ocd(13)=c
h, 10.00, 75., 10.0, sc=13
# Beam start @ct,10
ocd(21)=b
10.00, 25., 1.0
ocd(22)=c
t, 50.00, 25., 12.9, 141., 0., 2, .005,
ocd(23)= +
t, rd=10., ag=270., r=.005, t=.995
ocd(24)= +
t, rd=10., ag= 0., r=.005, t=.995
ocd(25)=c
t, 50.01, 25., 12.9, 39., 0., 2, .005,
ocd(26)= +
t, rd=10., ag= 90., r=.005, t=.995
ocd(27)= +
t, rd=10., ag=180., r=.005, t=.995
ocd(28)=c srth, 50.00, 25., 12.9, 141., 0., 3, .005,
ocd(29)= + th, rd=10., ag=270., r=.005, t=.995
ocd(30)= + th, rd=10., ag= 0., r=.005, t=.995
ocd(31)=c
th, 50.01, 25., 12.9, 39., 0., 3, .005,
ocd(32)= +
h, rd=10., ag= 90., r=.005, t=.995
ocd(33)= + th, rd=10., ag=180., r=.005, t=.995
ocd(34)=d
t, 80.00, 25., 10.0
ocd(35)= +
t, dx=2.
ocd(36)=d
r,100.00, 25., 10.0
ocd(37)= +
d, dx=5.
ocd(38)=c
d, 45.00, 45., 10.0, 90.
ocd(39)=c
h, 10.00, 25., 10.0, sc=13

DR

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
end

call
call
call
call

.995 # GTP1o
.995 # GTP2o
.995 # GTP1e
.995 # GTP2e
# \lambda/4 @cb1,15
# M @lb1,15
# Beam dump
# Beam start @ct,10

oc_init(unit=mm)
! Initialize OptoCad
oc_frame(0.,0.,120.,100.,30.,25.,1.)
ps_text(1,\bf GlanTaylor,20.,38.,fs=3.)
oc_set(n=2, rix=(/1.658,1.486/), &
print=rs s2 act rd ang w0t z0t ipp med pw lb)

call oc_input(ocd,nb)
! Read data of components
do i=1,nb
call oc_trace(i)
! Trace all ray segments
call oc_beam(3.0,fill=ps_color((/1.,.8,.8/)))
! Plot outer part
call oc_beam(2.0,fill=ps_color((/1.,.6,.6/)))
! Plot middle part
call oc_beam(1.0,fill=2)
! Plot inner part of beam
call oc_beam(0.0,1,5,.1,rns=2.) ! Plot the beam axes in black
call oc_reset
end do
call oc_surf(lw=.2,sns=2.,snc=6)
! Plot all surfaces with numbers
call oc_exit
end

19 Jul 2013 16:41

64

optocad_ug_0.93i

P OLARIZING

BEAM - SPLITTERS

E XAMPLES

The above Fortran file produces the following output on the terminal:
This is OptoCad (Version 0.92c) by Roland Schilling.
All rights reserved. ABSOLUTELY NO WARRANTY!
Input of optical component data from character array.

rs
2
13
14

s2
6
2
15

a
r
t
d

rs
10
15
16

s2
5
4
6

a
r
t
n

Beam
rs
0
1
2
3
4
5
6
7
8
9
10
11
***

ang[deg]
0.0
0.0
0.0
0.0
0.0
0.0
0.0
180.0E+0
180.0E+0
180.0E+0
180.0E+0
180.0E+0
180.0E+0

w0t[mm]
1.000E+0
1.000E+0
1.000E+0
1.000E+0
1.000E+0
1.000E+0
1.000E+0
1.000E+0
1.000E+0
1.000E+0
1.000E+0
1.000E+0
1.000E+0

z0t[mm]
2.953E+3
2.953E+3
4.429E+3
4.429E+3
2.953E+3
4.429E+3
2.953E+3
2.953E+3
4.429E+3
2.953E+3
4.429E+3
4.429E+3
2.953E+3

rd[mm] ang[deg]
0.0
0.0
0.0 90.00E+0
0.0 90.00E+0

w0t[mm]
1.000E+0
1.000E+0
1.000E+0

z0t[mm]
4.429E+3
4.429E+3
2.953E+3

w0t[mm]
1.000E+0
1.000E+0
1.000E+0
w0t[mm]
1.000E+0
1.000E+0
1.000E+0
455.8E3
1.000E+0
1.000E+0
1.000E+0
1.000E+0
1.000E+0
1.000E+0
1.000E+0
1.000E+0

rd[mm]
0.0
0.0
10.00E+0

ang[deg]
180.0E+0
90.00E+0
90.00E+0

ipp[mm] md
0.0 0
30.00E+0 0
15.00E+0 1
15.00E+0 1
20.00E+0 0
3.000E+0 1
18.00E+0 0
18.00E+0 0
3.000E+0 1
20.00E+0 0
15.00E+0 1
15.00E+0 1
40.00E+0 0

power[W]
1.000E+0
1.000E+0
995.0E3
487.5E3
485.1E3
485.1E3
485.1E3
485.1E3
485.1E3
485.1E3
482.7E3
0.0
0.0

label
@ beam start
# PBScube
# \bf PBS
+ PBScube
# \lambda/4
+ \lambda/4
# M
+ \lambda/4
# \lambda/4
+ PBScube
# PBS2
# PBScube
@ frame 1 left

ipp[mm] md
40.00E+0 1
15.00E+0 1
10.00E+0 0

power[W]
995.0E3
487.5E3
485.1E3

label
# \bf PBS
+ PBScube
# Beam dump

z0t[mm]
4.429E+3
4.429E+3
2.953E+3

ipp[mm] md
0.0 1
15.00E+0 1
15.00E+0 0

power[W]
482.7E3
480.3E3
477.9E3

label
# PBS2
+ PBScube
@ frame 1 top

z0t[mm]
2.953E+3
2.953E+3
4.388E+3
613.3E+0
4.388E+3
2.953E+3
4.429E+3
2.953E+3
2.953E+3
4.429E+3
2.953E+3
4.895E+3

ipp[mm] md
0.0 0
28.12E+0 0
17.66E+0 3
21.94E3 0
17.64E+0 3
18.11E+0 0
3.000E+0 1
18.00E+0 0
18.00E+0 0
3.000E+0 1
18.11E+0 0
19.69E+0 2

power[W]
1.000E+0
1.000E+0
995.0E3
990.0E3
985.1E3
980.1E3
980.1E3
980.1E3
980.1E3
980.1E3
980.1E3
975.2E3

label
@ beam start
+ GTP1e
# GTP1e
# GTP2e
+ GTP2e
# \lambda/4
+ \lambda/4
# M
+ \lambda/4
# \lambda/4
+ GTP2o
# GTP2o

# 1:
s2 a
rd[mm]
0 n
0.0
1 t
0.0
6 t
0.0
3 t
0.0
7 t
0.0
8 t
0.0
11 r
0.0
8 t
0.0
7 t
0.0
3 t
0.0
5 t
0.0
1 t
0.0
7 n 25.00E+0

AF

Beam
rs
0
1
2
3
4
5
6
7
8
9
10
11
12

12
13

# 2:
s2 a
rd[mm] ang[deg]
0 n
0.0
0.0
27 t 25.18E3
0.0
25 t
0.0
0.0
29 t 14.23E3 30.26E+0
31 t 36.24E3
0.0
33 t 11.06E3
0.0
34 t 11.06E3
0.0
37 r 11.06E3
0.0
34 t 11.06E3 180.0E+0
33 t 11.06E3 180.0E+0
23 t 36.24E3 180.0E+0
21 t 14.23E3 180.0E+0
WARNING from OC_TRACE:
Total internal reflection
22 t 260.5E3 78.00E+0
8 n 2.349E+0 69.84E+0

rs
2
14
15

s2
25
26
41

a
rd[mm]
r
0.0
t 249.2E3
d 371.2E3

at "# GTP2o" ! ph_p = 64.87, ph_s = 26.03


1.000E+0 4.895E+3 17.01E+0 2 975.2E3 + GTP2o
959.7E3 2.719E+3 15.95E+0 0 970.4E3 @ frame 1 bottom

ang[deg]
0.0
102.0E+0
108.0E+0

w0t[mm]
1.000E+0
1.000E+0
972.3E3

z0t[mm]
4.388E+3
4.388E+3
2.791E+3

ipp[mm] md
15.95E+0 3
15.23E+0 3
10.49E+0 0

power[W]
995.0E3
4.975E3
4.950E3

label
# GTP1e
+ GTP1e
# Beam dump

DR

OptoCad statistics:
Number of optical components: 15
Number of optical surfaces: 42
Number of optical cavities: 0
Number of input beams: 2
Number of ray segments: 31
Number of beams split off: 3

100

16

PBS

16

11

10

Beam start

11
8

6
8

14

12

10

14

/4

15

50

41

GlanTaylor

15

19
27

42

18 32
26
24
29
21

14

Beam start

2
17
25
20 22
28

10
4

12

35

39

33

11
1

37
9

5
23
31

7
34

36

38
40

13

0
0
Roland
optocad_ug_0.93i

13

13

15

6
5

12

/4

Schilling, 12 Jul 2011, pbs.ps

50

65

100
19 Jul 2013 16:41

E XAMPLES

O PTICAL

MODULATORS

8.8 EOM and AOM optical modulators


The following example models an EOM and an AOM optical modulator.

!
!
!
!

!
!
!
!

Modelling an EOM and an AOM


use optocad
use rsplot
character(len=80)

:: ocd(0:20)=

Program OPTMOD

Optical component data for a double Brewster EOM:


ocd(
ocd(
ocd(
ocd(
ocd(
ocd(

0)=o
1)=b
2)=d
3)= +
4)=d
5)= +

ac

x
y
rd
ag
120.,
80.
120.,
0., 1.,
0.0,
t, 60.,
0., 10., 56.31,
t, dx=40., dy=27.2
t, 60.,
0., 10., 123.69,
t, dx=40., dy=27.2

# label

0., z=100.
0., 2,
# PC1

AF

!
!
!

0.,

2,

# PC2

Optical component data for a dualpass AOM:

ac
x
y
rd
ag
c
m
ocd(10)=o
120.,
30.
ocd(11)=b
120.,
6., 1.,
3.0, .008667
ocd(12)=d
t, 15.,
0., 20.
ocd(13)= +
t, dx=30.
ocd(14)=c {st1t},
0.,
0., 20., t=.9, t1=.1, gf=100.
ocd(15)=d
r, 120.,
0., 20.,
0.0,.008667
ocd(16)= +
d, dm=10.
call
call
call
call
call

# label
# AOM_block
# AOM_grating
# Mirror

oc_init(unit=mm)
! Initialize OptoCad (A4 landscape)
oc_frame(0.,0.,260.,130.,25.,25.,gld=50.,glc=14) ! Frame & grid lines
ps_text(1,\bf DoubleBrewster EOM,120.,115.,fs=4.,just=c)
ps_text(1,\bf Dualpass AOM,120.,60.,fs=4.,just=c)
oc_set(n=2,rix=(/1.4797/), & ! Refractive index of medium 2
print=rs s2 Act rd ang w2t w2s, pw lb)
call oc_input(ocd,nib)
! Readin optical component data
do ib=1,nib
! Trace and plot all beams
call oc_trace(ib)
! Trace all segments of the current beam
call oc_beam(3.,fill=ps_color((/1.,.8,.8/))) ! Plot outer part, ...
call oc_beam(2.,fill=ps_color((/1.,.6,.6/))) ! ... middle part, ...
call oc_beam(1.,fill=2)
! ... inner part of the beam
call oc_beam(0.,1,5,.2)
! Plot the beam axes in black
call oc_reset
! Prepare for repeated call of OC_TRACE
end do
call oc_surf(lw=.3)
! Plot all surfaces with linewidth 0.3mm

DR

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
end

call oc_exit
end

The plot on the next page shows, for the EOM, a certain distance between the positions of the waists
in the tangential (green) and the sagittal (magenta) plane. This is due to the astigmatism caused by the
(first) EOM crystal.
The AOM is simulated as a block of fused silica with an embedded diffraction grating, using the diffraction orders 0 and -1 . Input beam for the AOM is the upper one on the two beams at the left-hand side.

19 Jul 2013 16:41

66

optocad_ug_0.93i

O PTICAL

E XAMPLES

MODULATORS

The above Fortran file produces the following output on the terminal:
This is OptoCad (Version 0.88a) by Roland Schilling.
All rights reserved. ABSOLUTELY NO WARRANTY!
Input of optical component data from character array
w2t[mm]
1.001E+0
1.000E+0
1.491E+0
1.000E+0
1.491E+0
1.001E+0

w2s[mm]
1.001E+0
1.000E+0
1.000E+0
1.000E+0
1.000E+0
1.001E+0

power[W]
1.000E+0
1.000E+0
1.000E+0
1.000E+0
1.000E+0
1.000E+0

label
@ beam start
# PC1
+ PC1
+ PC2
# PC2
@ frame 1 right

Beam
rs
0
1
2
3
4
5
6
7
8

# 2:
s2 asoi
rd[mm] ang[deg]
0 n
0.0 3.000E+0
9 t
497.2E3 3.000E+0
13 t+01 26.50E3 1.999E+0
10 t
550.2E3 1.999E+0
14 r
6.045E+0 3.000E+0
10 t
538.9E3 177.0E+0
13 t+01 14.20E3 178.0E+0
9 t
510.6E3 178.0E+0
7 n
28.98E+0 177.0E+0

w2t[mm]
1.000E+0
95.60E3
39.08E3
94.57E3
997.4E3
98.85E3
39.54E3
90.71E3
989.8E3

w2s[mm]
1.000E+0
95.60E3
39.05E3
94.74E3
997.7E3
98.64E3
39.44E3
91.15E3
990.8E3

power[W]
1.000E+0
1.000E+0
1.000E+0
810.0E3
810.0E3
810.0E3
810.0E3
656.1E3
656.1E3

label
@ beam start
# AOM_block
# AOM_grating
+ AOM_block
# Mirror
+ AOM_block
# AOM_grating
# AOM_block
@ frame 1 left

rs
2
9
10
11
12
13
14

s2
13
10
14
10
13
9
7

asoi
t11
t
r
t
t+01
t
n

ang[deg]
1.999E+0
2.066E+0
3.099E+0
176.9E+0
178.0E+0
178.0E+0
176.9E+0

w2t[mm]
39.08E3
94.58E3
997.5E3
98.87E3
39.54E3
90.70E3
989.9E3

w2s[mm]
39.05E3
94.74E3
997.7E3
98.65E3
39.44E3
91.14E3
990.9E3

power[W]
1.000E+0
100.0E3
100.0E3
100.0E3
100.0E3
81.00E3
81.00E3

label
# AOM_grating
+ AOM_block
# Mirror
+ AOM_block
# AOM_grating
# AOM_block
@ frame 1 left

rs
6
15
16

s2
13
9
7

asoi
rd[mm] ang[deg]
t11 14.20E3 178.0E+0
t
554.1E3 177.9E+0
n
41.23E+0 176.9E+0

w2t[mm]
39.54E3
90.71E3
989.9E3

w2s[mm]
39.44E3
91.15E3
990.9E3

power[W]
810.0E3
81.00E3
81.00E3

label
# AOM_grating
# AOM_block
@ frame 1 left

rs
12
17
18

s2
13
9
7

asoi
t11
t
n

w2t[mm]
39.54E3
90.70E3
989.9E3

w2s[mm]
39.44E3
91.14E3
990.9E3

power[W]
100.0E3
10.00E3
10.00E3

label
# AOM_grating
# AOM_block
@ frame 1 left

rd[mm] ang[deg]
68.21E3 178.0E+0
600.1E3 178.0E+0
28.81E+0 177.0E+0

DR

OptoCad statistics:
Number of optical components: 5
Number of optical surfaces: 17
Number of optical cavities: 0
Number of input beams: 2
Number of ray segments: 23
Number of beams split off: 3

AF

rd[mm]
26.50E3
514.5E3
6.191E+0
601.0E3
68.21E3
464.6E3
41.06E+0

Beam # 1:
rs s2 asoi
rd[mm] ang[deg]
0
0 n
0.0
0.0
1
1 t
0.0
0.0
2
2 t
38.69E6 22.09E+0
3
6 t
38.69E6
0.0
4
5 t
0.0 22.09E+0
5 5 n
15.00E+0
0.0

DoubleBrewster EOM

100

Dualpass AOM

50

0
0

50

100

150

200

250

Roland Schilling, 22 Apr 2010, optmod.ps

optocad_ug_0.93i

67

19 Jul 2013 16:41

E XAMPLES

A CURVED

OPTICAL GRATING

8.9 A curved optical diffraction grating


The following program gives an example of a curved optical grating as one surface of a component. The
grating frequency is 12000 lines/cm, the incidence angle 20 and the wavelength of the light 1064 nm.

Modelling the diffraction at a curved optical grating.


use optocad
use rsplot
use rsutil

Program GRATING

character(len=120)
real, target

:: ocd(3)=
:: alpha, xo, yo

alpha=20.0
d =80.0
xo=d*sin(alpha*deg)
yo=+d*cos(alpha*deg)

!
!
!
!

Angle of Incidence [deg]


Distance of beam origin [mm]
X start position of the beam
Y start position of the beam

AF

!
!
!

ocd(01)=b xo, yo, .5, ai90.


# Input beam
ocd(02)=d s(t1t1t2rr1)t, 0., 0., 50., 90.,.005, gf=1200.,&
& t1=.2, t1=.1, t2=.1, r=.2, r1=.2, t0=.2 # grating
ocd(03)= + t, dm=40.
call oc_init(unit=mm) ! Initialize OptoCad (A4 landscape)
call oc_frame(120.,70.,120.,80.,30.,25.,d_tm=6.)
call ps_text(1,Reflection at and transmission through a curved &
&diffraction grating,xc=0.,yt=8.,fs=5.,just=c)
call ps_set(fs=3.)
! Set default font size to 3 mm.
call ps_text(1,Incident beam,50.,60.)
call ps_text(1,Reflected beam,28.,60.)
call ps_text(1,(order 0),28.,55.)
call ps_text(1,Transmitted beam,18.,55.)
call ps_text(1,(order 0),18.,60.)
call ps_text(1,Reflective diffraction order 1,90.,40.)
call ps_text(1,Transmissive diffraction order +1, 20.,45.)
call ps_text(1,Transmissive diffraction order 1,105.,50.)
call ps_text(1,Transmissive diffraction order 2,105.,22.)
call oc_set(rix=(/2.4/),
& ! Index of refraction
print=rs s2 Act ang w0t w0s w2t w2s z2t z2s lb)
call oc_bind(xo,xo)
call oc_bind(yo,yo)
call oc_bind(ai,alpha)
u_werm=6
! Write warning/error messages to stdout
ico=ps_color((/1.,.8,.8/))
! Color for outer part of the beam
icm=ps_color((/1.,.6,.6/))
! Color for middle part of the beam
ici=2
! Color for inner part of the beam
call oc_input(ocd)
! This reads the data of the components.
call oc_surf
! Plot all surfaces with linewidth 0.2mm
call oc_trace
! Trace all ray segments
call oc_beam(3.0,fill=ico)
! Plot outer part of beam
call oc_beam(2.0,fill=icm)
! Plot middle part of beam
call oc_beam(1.0,fill=ici)
! Plot inner part of beam
call oc_beam(0.0,1,5,.2,rns=2.5)
! Plot the beam axes (in black) and ...
! ... also the raysegment numbers
call ps_grid(1,.0,lp=3,lw=.1)
! Plot a normal on the surface

DR

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
end

call oc_exit
end

Please note that the index of refraction is set to 2.4 in order to demonstrate a total internal reflection.

19 Jul 2013 16:41

68

optocad_ug_0.93i

A CURVED

E XAMPLES

OPTICAL GRATING

The above Fortran file produces the following output on the terminal:
This is OptoCad (Version 0.82d) by Roland Schilling.
All rights reserved. ABSOLUTELY NO WARRANTY!
Input of optical component data from character array
Beam # 1: Input beam
rs s2 asoi ang[deg]
0
0 n
70.00E+0
1
1 t+01 70.00E+0
2
2 t
81.81E+0
3 8 n
70.00E+0

w0s[mm]
500.0E3
500.0E3
90.45E3
90.45E3

w2t[mm]
500.0E3
502.9E3
596.4E3
699.7E3

w2s[mm]
500.0E3
502.9E3
565.1E3
683.3E3

z2t[mm]
0.0
80.00E+0
354.0E+0
164.9E+0

z2s[mm]
0.0
80.00E+0
357.5E+0
180.9E+0

label
@ beam start
# grating
+ grating
@ frame 1 bottom

rs s2 asoi ang[deg]
w0t[mm]
1
1 t+11 70.00E+0 500.0E3
4
2 t
47.58E+0 69.55E3
*** WARNING from OC_TRACE:
Total internal reflection at
5
3 d
47.58E+0 69.55E3

w0s[mm]
500.0E3
99.57E3

w2t[mm]
502.9E3
503.7E3

w2s[mm]
502.9E3
578.4E3

z2t[mm]
80.00E+0
245.9E+0

z2s[mm] label
80.00E+0 # grating
402.0E+0 + grating

rs
1
6
7

s2
1
2
8

asoi ang[deg]
t11 70.00E+0
t
112.9E+0
n
159.2E+0

w0t[mm]
500.0E3
134.8E3
52.00E3

w0s[mm]
500.0E3
153.6E3
153.6E3

w2t[mm]
502.9E3
536.8E3
752.3E3

rs
1
8

s2 asoi ang[deg]
1 t21 70.00E+0
4 d
157.1E+0

w0t[mm]
500.0E3
52.21E3

w0s[mm]
500.0E3
142.3E3

w2t[mm]
502.9E3
75.51E3

w2s[mm]
z2t[mm]
z2s[mm] label
502.9E3 80.00E+0 80.00E+0 # grating
451.6E3 20.18E+0 432.1E+0 grating

rs
1
9

s2 asoi ang[deg]
1 r+01 70.00E+0
6 n
70.00E+0

w0t[mm]
500.0E3
63.64E3

w0s[mm]
500.0E3
72.04E3

w2t[mm]
502.9E3
78.42E3

w2s[mm]
z2t[mm]
z2s[mm] label
502.9E3 80.00E+0 80.00E+0 # grating
121.2E3 8.609E+0 20.74E+0 @ frame 1 top

rs
1
10

s2 asoi ang[deg]
1 r11 70.00E+0
7 n
159.2E+0

w0t[mm]
500.0E3
34.82E3

w0s[mm]
500.0E3
104.1E3

w2t[mm]
502.9E3
1.062E+0

w2s[mm]
502.9E3
127.9E3

w0t[mm]
500.0E3
500.0E3
84.62E3
80.33E3

"+ grating" ! ph_p = 152.83, ph_s = 71.39


99.57E3 543.8E3 606.3E3 265.8E+0 422.0E+0 grating
z2t[mm]
80.00E+0
496.4E+0
115.2E+0

AF

w2s[mm]
502.9E3
541.1E3
721.6E3

z2s[mm]
80.00E+0
564.6E+0
319.7E+0

label
# grating
+ grating
@ frame 1 bottom

z2t[mm]
z2s[mm] label
80.00E+0 80.00E+0 # grating
109.2E+0 22.85E+0 @ frame 1 left

OptoCad statistics:
Number of optical components: 1
Number of optical surfaces: 4
Number of optical cavities: 0
Number of input beams: 1
Number of ray segments: 10
Number of beams split off: 5

DR

All propagating diffraction orders are shown, i. e. the reflections of order 0 and -1 and the transmissions
of order +1, 0, -1 and -2. The transmissive order +1 experiences total internal reflection at the back
surface of the component.
Reflection at and transmission through a curved diffraction grating

Incident beam

50

Reflected beam
(order 0)

Reflective diffraction order 1


10

Transmissive diffraction order 2

Transmissive diffraction order +1

50

Transmissive diffraction order 1


7

100

50

Transmitted beam
(order 0)

50

100

Roland Schilling, 21 Oct 2005, grating.ps

optocad_ug_0.93i

69

19 Jul 2013 16:41

E XAMPLES

A LL - REFLECTIVE FABRY-P EROT

CAVITY

8.10 An all-reflective Fabry-Perot cavity


This is an example for an all-reflective Fabry-Perot cavity using an optical grating as coupling mirror.
The grating is operated in Littrow mounting with an angle of incidence of 20 . The grating frequency
necessary for the Littrow arrangement is calculated from the given wavelength and incidence angle to be
6429 lines/cm . Please note that in this example the printing of the cavity test cycle is activated (line 29).

Modelling an allreflective FabryPerot cavity


with the grating in Littrow mounting.

Program ARFPC

use optocad
use rsplot
character(len=160)
real, target

:: ocd(10)=
:: ai, d, gf, xo, yo

ai= 20.0
ab=180.2.*ai
wl=1.064e3
gf=2.*abs(sin(ai*deg))/wl
d =50.0
xo=d*cos(ab*deg)
yo=d*sin(ab*deg)

!
!
!
!
!
!
!

Incidence angle (in degrees)


Angle of input beam (in degrees)
light wavelength (in mm)
Grating frequency (in lines/mm)
Radial distance of beam origin (in mm)
Xposition of beam origin
Yposition of beam origin

AF

!
!
!
!

ocd(01)=b xo, yo, .5, 180.2*ai, z=dist


ocd(02)=c hn, xo, yo, 10., 180.2*ai, sc=13 # beam start @0,10
ocd(03)=d cr1rsrr1,
0., 0., 10., 180.ai, gf=gf, &
&r0=.01, r1=.99
# FP1 (grating) @15,17
ocd(04)= + d, dx=10.
ocd(05)=d r, 100., 0.,10.,0.,.18e3, r=1. # FP2 @0,17
ocd(06)= + d, dx=10.
call oc_init(unit=mm)
! Initialize OPTOCAD (A4 landscape)
call oc_frame(20.,50.,120.,25.,glp=0)
! Set up a frame
call oc_set(pctl=1,
& ! Print cavity test loop
part=1,
& ! Set phases according to r and t
print=rs s2 Act ang w0t w2t z2t ph pw lb)
call oc_bind(xo,xo)
call oc_bind(yo,yo)
call oc_bind(ai,ai)
call oc_bind(dist,d)
call oc_bind(gf,gf)
call oc_input(ocd)
! This reads the data of the components.
call oc_trace
! Trace all ray segments
call oc_beam(3.,fill=ps_color((/1.,.8,.8/))) ! Plot outer part, ...
call oc_beam(2.,fill=ps_color((/1.,.6,.6/))) ! ... middle part, ...
call oc_beam(1.,fill=2)
! ... inner part of the beam
call oc_beam(0.0,1,5,.2,rns=3.)
! Plot beam axes and numbers in black
call oc_surf(lw=.3,sns=3.,snc=6)
! Plot all surfaces with linewidth 0.3mm
! ... and surface numbers in magenta
call oc_exit
end

DR

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
end

19 Jul 2013 16:41

70

optocad_ug_0.93i

A LL - REFLECTIVE FABRY-P EROT

E XAMPLES

CAVITY

The output produced on the terminal:


This is OptoCad (Version 0.91c) by Roland Schilling.
All rights reserved. ABSOLUTELY NO WARRANTY!
Input of optical component data from character array.
power[W] label
1.000E+0 @ beam start
1.000E+0 # FP1 (grating)
10.00E3 # FP2
10.00E3 # FP1 (grating)

Evaluated data of cavity 1 (when in resonance):


Roundtrip phase = 0.000E+0, FSR = 1.499E+9, Bandwidth = 2.398E+6, Finesse = 625.2
Tangent. plane: w0 = 500.2E3, z0 = 738.6E+0, w1 = 500.2E3, z1 = 154.2E15, R1 = <1.E+9
Sagittal plane: w0 = 500.2E3, z0 = 738.6E+0, w1 = 500.2E3, z1 = 0.000E+0, R1 = >+1.E+9
Mismatch for closing cavity 1: Position: 34.19E15, Angle:
0.000E+0
Misalignment w.r.t. cavity eigenray: Position:
0.000E+0, Angle:
0.000E+0,
0.000E+0
Mode matching (for perfect alignment): mt*ms = 1.000E+0 * 1.000E+0 = 1.000E+0
6 r
0.0 500.2E3 504.7E3 100.0E+0 84.26E+0 398.0E+0 # FP2
2 i
180.0E+0 500.2E3 500.2E3
0.0 90.00E+0 398.0E+0 # FP1 (grating)
Roundtrip Gouy phase of cavity 1: 7.71 + 7.71 = 15.42
Mode spacing in cavity 1: Tangent. plane: 64.21E+6, Sagittal plane: 64.21E+6

AF

***
***
***
***
***
***
***
2
3
***
***

w0t[mm]
w2t[mm]
z2t[mm] phas[deg]
500.0E3 501.1E3 50.00E+0
0.0
500.0E3 500.0E3
0.0
0.0
evaluate data of cavity 1:
500.0E3 504.6E3 100.0E+0 84.26E+0
500.0E3 500.0E3 236.4E3 84.26E+0

Beam # 1:
rs s2 asoi ang[deg]
0
0 n
140.0E+0
1
2 r+01 140.0E+0
*** First test cycle to
2
6 r
0.0
3
2 r11 180.0E+0

rs s2 asoi ang[deg]
w0t[mm]
w2t[mm]
z2t[mm] phas[deg] power[W] label
3
2 r+01 180.0E+0 500.2E3 500.2E3
0.0 90.00E+0 398.0E+0 # FP1 (grating)
*** Interference of ray segment 3r+01 with 1r11 at surface 2. Phase difference: 180.0E+0
*** Deviations: Rel. power = 3.020E+0, Position = 34.19E15, Angle = 0.000E+0
***
Tang. plane: Radius = 156.2E6, Curvature = 325.6E21
***
Sagi. plane: Radius = 156.2E6, Curvature = 13.01E21
4
1 n
40.00E+0 500.0E3 501.1E3 50.00E+0 174.3E+0 1.000E+0 # beam start
5 8 n
40.00E+0 500.0E3 502.8E3 77.79E+0 174.3E+0 1.000E+0 @ frame 1 bottom

DR

OptoCad statistics:
Number of optical components: 3
Number of optical surfaces: 9
Number of optical cavities: 1
Number of input beams: 1
Number of ray segments: 5
Number of beams split off: 1

The following PostScript figure is generated:

FP1 (grating)
5
3

FP2
8
6

7
9

beam start

1
5

50
0

50

100

Roland Schilling, 30 Jul 2010, arfpc.ps

optocad_ug_0.93i

71

19 Jul 2013 16:41

E XAMPLES

A LL - REFLECTIVE M ICHELSON

INTERFEROMETER

8.11 An all-reflective Michelson interferometer


The following program gives an example of an all-reflective Michelson interferometer. The beam-splitter
is a diffraction grating that, for the given wavelength (1064 nm) and grating frequency (12000 lines/cm),
only propagates the orders 0 and -1. The angle of incidence (19.53 ) is chosen such that the interferometer arms are orthogonal to each other.

Modelling an allreflective Michelson inteferometer.

Program ARMIN

use optocad
use rsplot
character(len=120)
real, target
ai=19.53
d =80.0
xo=d*sin(ai*deg)
yo=d*cos(ai*deg)

:: ocd(12)=
:: ai, xo, yo
!
!
!
!

Incidence angle (in degrees)


Radial distance of beam origin (in mm)
Xposition of beam origin
Yposition of beam origin

AF

!
!
!

ocd(01)=b
xo, yo, .5, ai90, .1485e3
ocd(02)=d sr1ri(nr1r)sr1r, 0., 0., 10., 90.,&
& gf=1.2e3, r0=.5, r1=.5
ocd(03)= + d, dx=5.
ocd(04)=d r,xo, yo, 10., 90ai, c=.1485e3, r=1.
ocd(05)= + d, dm=5.
ocd(06)=d r,yo,xo, 10.,180ai, ct=5.4e3, cs=.1485e3
ocd(07)= + d, dm=5.
ocd(08)=d d, yo,xo, 10.,
ai
ocd(09)= + d, dm=0., rd=6.25, c=.16, icc=14
ocd(10)=d d, xo, yo, 6., 90.+ai
ocd(11)= + d, dx=25., icc=14

# GBS @4,10
# M1 @0,7
# M2 @12
# PD @8
# Laser @23,10

call oc_init(unit=mm)
! Initialize OPTOCAD (A4 landscape)
call oc_frame(100.,20.,100.,110.,30.,25.) ! Set up a frame
call oc_set(part=1,print=rs s2 Act ang w2t z2t tpp ph pw lb)
ico=ps_color((/1.,.8,.8/))
! color for outer part of beam
icm=ps_color((/1.,.6,.6/))
! color for middle part of beam
ici=2
! color for inner part of beam
call oc_bind(ai,ai)
call oc_bind(xo,xo)
call oc_bind(yo,yo)
call oc_input(ocd)
! This reads the data of the components.
call oc_trace
! Trace all ray segments
call oc_beam(3.0,fill=ico)
! Plot outer part of beam
call oc_beam(2.0,fill=icm)
! Plot middle part of beam
call oc_beam(1.0,fill=ici)
! Plot inner part of beam
call oc_beam(0.0,1,5,.1,rnc=1)
! Plot the beam axes and numbers in black
call oc_surf(lw=.3)
! Plot all surfaces with linewidth 0.3mm

DR

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
end

call oc_exit
end

19 Jul 2013 16:41

72

optocad_ug_0.93i

A LL - REFLECTIVE M ICHELSON

E XAMPLES

INTERFEROMETER

The above Fortran file produces the following output on the terminal:
This is OptoCad (Version 0.82d) by Roland Schilling.
All rights reserved. ABSOLUTELY NO WARRANTY!
Input of optical component data from character array
w2t[mm]
z2t[mm]
500.0E3 79.95E+0
497.0E3 46.83E3
500.0E3 80.05E+0
497.0E3 131.7E3

tpp[mm] phas[deg]
0.0
0.0
80.00E+0
0.0
160.0E+0 45.00E+0
240.0E+0 45.00E+0

power[W]
1.000E+0
1.000E+0
500.0E3
500.0E3

Beam # 1:
rs s2 asoi ang[deg]
0
0 n
70.47E+0
1
1 r+01 70.47E+0
2
5 r
70.47E+0
3
1 i
109.5E+0

label
@ beam start
# GBS
# M1
# GBS

AF

rs s2 asoi ang[deg]
w2t[mm]
z2t[mm]
tpp[mm] phas[deg] power[W] label
1
1 r11 70.47E+0 497.0E3 46.83E3 80.00E+0
0.0 1.000E+0 # GBS
4
9 r
160.5E+0 233.9E3 80.01E+0 160.0E+0 45.00E+0 500.0E3 # M2
5
1 r+01 19.53E+0 176.3E3 27.49E3 240.0E+0 45.00E+0 500.0E3 # GBS
*** Interference of ray segment 5r+01 with 3r11. Phase difference: 0.000E+0
*** Deviations: Rel. power = 8.882E15, Position = 26.87E3, Angle = 6.434E3
***
Tang. plane: Radius = 21.26E6, Curvature = 5.235E6
***
Sagi. plane: Radius = 2.765E9, Curvature = 47.60E9
6 13 d
19.52E+0 233.9E3 80.02E+0 320.0E+0
0.0 1.000E+0 # PD
rs s2 asoi ang[deg]
w2t[mm]
z2t[mm]
tpp[mm] phas[deg] power[W] label
5
1 r11 19.53E+0 176.3E3 27.49E3 240.0E+0 45.00E+0 500.0E3 # GBS
*** Interference of ray segment 5r11 with 3r+01. Phase difference: 180.0E+0
*** Deviations: Rel. power = 8.882E15, Position = 26.87E3, Angle = 2.282E3
***
Tang. plane: Radius = 104.4E6, Curvature = 658.5E9
***
Sagi. plane: Radius = 2.765E9, Curvature = 47.60E9
7 17 d
109.5E+0 500.0E3 80.13E+0 320.0E+0
0.0
0.0 # Laser
OptoCad statistics:
Number of optical components: 5
Number of optical surfaces: 20
Number of optical cavities: 0
Number of input beams: 1
Number of ray segments: 7
Number of beams split off: 2

100

DR

And this is the generated PostScript figure:

Laser

50

M2

PD

M1

GBS

100

50

50

100

Roland Schilling, 21 Oct 2005, armin.ps

optocad_ug_0.93i

73

19 Jul 2013 16:41

E XAMPLES

F INDING

THE BEST CURVATURES FOR A SPHERICAL LENS

8.12 Findng the best curvatures for a spherical lens


This example shows the use of O PTO C AD in the ray-tracing mode in order to find the best combination
of curvatures for a spherical lens with respect to spherical aberration. Considered is a collimated input
beam, represented by four rays, and a lens with a focal length of 50 mm . The curvature of the second
surface is varied between -0.025 1/mm and +0.050 1/mm, i. e. a radius of curvature between -40 mm over
infinity (plan surface) to +20 mm . The Fortran program is shown on the next page and the resulting
PostScript file on the bottom of the current page.

[mm]

20

10

20

Distance between focal points [mm]

10

30

20

10

DR

10

10

20

30

40

50

60

[mm]

70

0.06

0.04

0.02

0.00
0.02

0.01

0.00

0.01

0.02

0.03

0.04

0.05

Curvature of primary surface [1/mm]

This is the generated PostScript file:

AF

The upper part of the figure is generated by lines 36 to 49 of the Fortran program and shows the case for
a lens with the optimum arrangement of curvatures, as it results from the calculations in the lower part
of the program (lines 52 to 78). This second part consists of a loop over 50 values of the curvature of the
second surface, for each case determining the distance of the focal points for the pair of rays close to the
axis and that far from the axis. This distance is plotted in black on lower part of the figure, together with
the curvature required for the first surface in order to achieve a focal length of 50 mm (red curve).

Curvature of secondary surface [1/mm]


Roland Schilling, 17 Sep 2011, spherical_lens.ps

19 Jul 2013 16:41

74

optocad_ug_0.93i

!
!

!
!

!
!

Program SPHERICAL_LENS
Show Spherical Aberration using ray tracing.
use optocad
use rsutil
use rsplot

! Load the module OptoCad.


! Load the module RSUTIL.
! Load the module RSPLOT.

character(80)
integer, parameter
integer
real
real
by=[ 2.00,
bc=[
2,

::
::
::
::
::

ocd(0:3)=, test(1)=
npt=50
bc(4)
by(4), pos(4), ang(4)
cur(npt,2), dx(npt)

2.00,12.00, 12.00]
2,
4,
4]

! Beam position
! Beam color

!
!
!

ocd(00)=b
10.00,
by, 1.00
ocd(01)=d t, 0.00, 0.00, 15.00, f=50.
ocd(02)= + t, dm=1., c=cur
ocd(03)=c n, 70.0, 0.00, 40.
call
call
call
call

# parallel input beam


# lens
# test >

oc_init(unit=mm, rad)
! Initialize OptoCad (A4 landscape).
oc_frame(10.,20.,70.0,20.,50.,120.,scale=2.,glp=0,d_tl=15.)
ps_text(1,[mm],xr=30.,yb=15.)
ps_text(1,[mm],xl=15.,yt=30.,rot=90*deg)

AF

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
end

E XAMPLES

THE BEST CURVATURES FOR A SPHERICAL LENS

Set up a few parameters:


call oc_set(rix = (/1.44963/),
ciwis=0, ciwit=0,
pcld =0,
write=rd_8 ang_8,
print=rs s2 act ang

& !
& !
& !
& !
z1t

The n of fused silica


Switch off waist indicators
Switch off printing of lens data
Write out position and angle at test
z2t z0t lb) ! List of printed data.

Example with optimum curvature of second surface:


call oc_bind(cur,+0.009)
! Optimum curvature of second surface
call oc_input(ocd(1:))
! Read data of surfaces 1 to 3
do i=1,4
! Loop over the 4 input rays
call oc_bind(by,by(i))
! Change beam Y position
call oc_input(ocd(0:0),nib)
! (Re)read data of input beam
call oc_trace(nib,oa=test)
! Trace current beam
call oc_beam(0.0,bc(i),5,.2)
! Plot rays as a dasheddotted lines
read(test,*) pos(i),ang(i)
! Convert character string to reals
end do
call oc_surf
! Plot all surfaces
x1=70.+(pos(1)pos(2))/(tan(ang(2))tan(ang(1)))
! Position of focus
x2=70.+(pos(3)pos(4))/(tan(ang(4))tan(ang(3)))
! Position of focus
call ps_line(1,x1,5.,x1,5.,ci=2,lw=.2)
! Indicate position of focus
call ps_line(1,x2,5.,x2,5.,ci=4,lw=.2)
! Indicate position of focus

DR

F INDING

!
! Calculate dependence of spherical aberration on curvature of second curface:
cur(:,2)=vector(npt,.025,.05)
! Set of curvatures for second surface
call oc_set(prt=we)
! Only allow warning and error messages
do k=1,npt
! Loop over npt curvatures of 2nd surf.
call oc_reset(2)
call oc_bind(cur,cur(k,2))
! New value for curvature of 2nd surface
call oc_input(ocd(1:),frm=1)
! Reread data of the lens
do i=1,4
! Loop over the 4 input rays
call oc_bind(by,by(i))
! Change beam Y position
call oc_input(ocd(0:0),nib)
! Reread data of input beam
call oc_trace(nib,oa=test)
! Trace current beam
read(test,*) pos(i),ang(i)
! Convert character string to reals
end do
x1=70.+(pos(1)pos(2))/(tan(ang(2))tan(ang(1)))
! Position of focus
x2=70.+(pos(3)pos(4))/(tan(ang(4))tan(ang(3)))
! Position of focus
dx(k)=x1x2
! Save distance between focal points
cur(k,1)=lenses(1)%c(1,1)
! Save curvature of first surface
end do
call ps_frame(2,cur(1,2),0.,cur(npt,2),30.,50.,30.,160.,60.)
call ps_axis(2,ax=Xx,gld=.005, &
title=\fs4 Curvature of secondary surface [1/mm])
call ps_axis(2,ax=Y,gld=5., &
title=\fs=4 Distance between focal points [mm])
call ps_plot(2,npt,cur(:,2),dx)
! Plot distance between focal points
call ps_frame(3,cur(1,2),0.,cur(npt,2),.06,50.,30.,160.,60.)
call ps_plot(3,npt,cur(:,2),cur(:,1),ci=2)
! Plot curvature of 1st surf.
call ps_axis(3,ax=.Y, &
title=\fs4\ci2 Curvature of primary surface [1/mm])
!
call oc_exit
end

optocad_ug_0.93i

75

19 Jul 2013 16:41

E XAMPLES

F INDING

THE BEST SHAPE FOR AN ASPHERICAL LENS

8.13 Finding the best shape for an aspherical lens


It is well known that the use of aspherical surfaces can largely reduce image defects, in particular spherical aberration. The following example shows a way to find the best shape for a plano-convex lens used
to focus a collimated input beam. The Fortran program for this (quite similar to that of the previous
example) is shown on the following page, and the resulting PostScript file at the bottom of the current
page.

The upper part of the figure is generated essentially by the lines 34 to 55 and shows a plano-convex lens
with a focal length of 50 mm. This is known to be an unfavorable orientation, i. e. the plane surface
facing the collimated input beam. With a spherical lens it would lead to large spherical aberration. The
apex of the curved surface is placed at position x = 0 , hence for this arrangement the second focal point
is at x = 50 . The example shown here uses the optimal shape for the curved surface, a hyperbola with
sh = 1.1014, and the perfect focusing is demonstrated by three pairs of input rays.

AF

This optimum value for the shape parameter results from the calculations in the lower part of the program
(lines 58 to 88). This second part consists of a loop over 50 values of the shape parameter of the curved
surface, for each case determining the positions of the focal points for the three pair of input rays. The
distance of these positions between the inner and the outer pair of rays is plotted in the lower part of the
figure. It can be seen that this distance vanishes for a shape parameter of sh 1.1 .

[mm]

20

10

DR

10

20

10

10

20

30

40

50

60

1.5

2.0

[mm]

30

10

elliptic

spheric

hyperbolic

20

parabolic

Distance between focal points [mm]

20

10
2.0

1.5

1.0

0.5

0.0

0.5

1.0

Shape parameter sh of curved surface


Roland Schilling, 17 Sep 2011, aspherical_lens.ps

19 Jul 2013 16:41

76

optocad_ug_0.93i

E XAMPLES

THE BEST SHAPE FOR AN ASPHERICAL LENS


Program ASPHERICAL_LENS
Test focusing of an aspherical lens using ray tracing.
use optocad
use rsutil
use rsplot

character(80)
integer, parameter
integer
real
real

by=[ 1.,
bc=[
2,

!
!

1., 6.,
2,
3,

::
::
::
::
::

ocd(0:4)=, test(1)=
npt=50
bc(6)
by(6), pos(6), ang(6)
sh(npt), dx(npt)

6., 12., 12.]


3,
4,
4]

! Beam position
! Beam color

ocd(00)=b
20.0, by, 1.0
ocd(01)=c n, 60.0, 0.0, 40.0
ocd(02)=d t, 0.0, 0.0, 15.0, pi, f=50., sh=sh
ocd(03)= + t, dm=1., c=.0

!
!
!

! Load the module OptoCad.


! Load the module RSUTIL.
! Load the module RSPLOT.

!
!
!

call oc_init(unit=mm, rad)

# parallel input beam


# test >
# lens

! Initialize OptoCad (A4 landscape)

Set up a few parameters:


call oc_set(rix = (/1.44963/),
ciwis=0, ciwit=0,
pcld =0,
write=rd_8 ang_8,
print=rs s2 act ang
call oc_bind(pi,pi)

& !
& !
& !
& !
z1t
!

The n of fused silica


Switch off waist indicators
Switch off printing of lens data
Write out position and angle at test
z2t z0t lb) ! List of printed data
make pi available to input data

AF

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
end

Aspherical lens with optimal shape:


call oc_frame(20.,20.,60.,20.,35.,120.,scale=2.,glp=0,d_tl=15.)
call ps_text(1,[mm],xr=30.,yb=15.)
call ps_text(1,[mm],xl=15.,yt=30.,rot=90*deg)
call oc_reset(2)
call oc_bind(sh,1.1014)
! optimum shape for curved surface
call oc_input(ocd(1:))
! (Re)read data of the lens
call oc_surf
! Plot all surfaces
do i=1,6
! Loop over the 6 input rays
call oc_bind(by,by(i))
! Change beam Y position
call oc_input(ocd(0:0),nib)
! (Re)read data of input beam
call oc_trace(nib,oa=test)
! Trace current beam
call oc_beam(0.,bc(i),5,.2)
! Plot rays as a dasheddotted lines
read(test,*) pos(i),ang(i)
! Convert character string to reals
end do
x1=60.+(pos(1)pos(2))/(tan(ang(2))tan(ang(1)))
! Position of focus
x2=60.+(pos(3)pos(4))/(tan(ang(4))tan(ang(3)))
! Position of focus
x3=60.+(pos(5)pos(6))/(tan(ang(6))tan(ang(5)))
! Position of focus
call ps_line(1,x1,5.,x1,5.,ci=2,lw=.2)
! Indicate position of focus
call ps_line(1,x2,5.,x2,5.,ci=3,lw=.2)
! Indicate position of focus
call ps_line(1,x3,5.,x3,5.,ci=4,lw=.2)
! Indicate position of focus
write(*,(/a,3f10.3)) Deviation from nominal focus [mm]:, &
x150.,x250.,x350.

DR

F INDING

!
! Calculate dependence of aberration on shape of curved curface:
sh=vector(npt,2.,2.)
! Set of shapes for curved surface
call oc_set(prt=we)
! Only allow warning and error messages
do k=1,npt
! Loop over npt shapes of 2nd surface
call oc_reset(2)
call oc_bind(sh,sh(k))
! New value for shape of 2nd surface
call oc_input(ocd(1:),frm=1)
! Reread data of the lens
do i=1,6
! Loop over the 4 input rays
call oc_bind(by,by(i))
! Change beam Y position
call oc_input(ocd(0:0),nib)
! Reread data of input beam
call oc_trace(nib,oa=test)
! Trace current beam
read(test,*) pos(i),ang(i)
! Convert character string to reals
end do
x1=60.+(pos(1)pos(2))/(tan(ang(2))tan(ang(1)))
! Position of focus
x2=60.+(pos(3)pos(4))/(tan(ang(4))tan(ang(3)))
! Position of focus
x3=60.+(pos(5)pos(6))/(tan(ang(6))tan(ang(5)))
! Position of focus
dx(k)=x1x3
! Save distance between focal points
end do
call ps_frame(2,sh(1),10.,sh(npt),30.,35.,30.,160.,60.)
call ps_quad(2,2.,10.,2.,40.,fill=ps_color([.85,1.,.9]))
call ps_quad(2, 0.,10.,2.,40.,fill=ps_color([.9,.85,1.]))
call ps_axis(2,ax=Xx,d_tm=3.,glp=0, &
title=\fs4 Shape parameter {\it sh} of curved surface)
call ps_axis(2,ax=Yy,glp=0, &
title=\fs=4 Distance between focal points [mm])
call ps_line(2,2., 0.,2., 0.,ci=13)
call ps_line(2, 0.,10.,0.,30.,ci=13)
call ps_line(2, 1.,10.,1.,30.,ci=13)
call ps_text(2,\fs=4 hyperbolic\hs{50.}elliptic,1.5,22.)
call ps_text(2,\fs=4 parabolic,.03,10.,rot=pi/2)
call ps_text(2,\fs=4 spheric,.97, 1.,rot=pi/2)
call ps_plot(2,npt,sh,dx,ci=2)
! Plot distance between focal points
!
call oc_exit
end

optocad_ug_0.93i

77

19 Jul 2013 16:41

E XAMPLES

PARABOLIC

TELESCOPE

8.14 A parabolic telescope


This example has kindly been made available by Julien Marque of the EGO/Virgo project. It shows
the input telescope for the Virgo GW detector which should enlarge the beam from the small radius of
2.6 mm, necessary to pass the beam through a Faraday Isolator, to the size required at the interferometer
input. The challenge was to construct a telescope with an 8-fold magnification, oblique incidence on the
mirrors and negligible aberration and astigmatism. This required the use of off-axis parabolic mirrors.

This is the O PTO C AD Fortran file to simulate the parabolic telescope:


Program PARABOLIC_TELESCOPE

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
end

!
!
!

Example of an allreflective offaxis parabolic telescope:


The Advanced Virgo input telescope with a magnification of 8
and negligible aberration and astigmatism.

character(len=80)
ocd(01)=b
ocd(02)=d
ocd(03)= +
ocd(04)=d
ocd(05)= +
ocd(06)=c
call
call
call
call

call
call
call
call
call
call
call

:: ocd(10)=

0.1,
0.0, 2.6e3, z=0.5
r,
0.8,.01255, .02,
0., rc=.14896, sh=0, zr=.0127 # M1 @lt,.05
d, dm=.015
r, .12152,.01255, .07, 180., rc=1.2080, sh=0, zr=.1015 # M2 @rb,.1
d, dm=.031
d, 3000.,.11405, 0.2
# ETM @lb.01,.1

oc_init(unit=m)
oc_frame(0.,0.1,0.9,0.3,20.,20.,0.2,glp=0)
oc_frame(2999.9,0.1,3000.1,0.3,220.,20.,0.2,glp=0)
oc_set(lambda=1.064e6,
& ! light wavelength of Nd:YAG
fslb = 4.0,
& ! character height for annotation (mm)
wismin= 3.,
& ! minimum size of waist indicator (mm)
print =rs act rd ang w0t w0s z0t z0s z2t z2s lb)
oc_input(ocd)
oc_trace
oc_beam(3.0,fill=ps_color((/1.,.8,.8/)))
oc_beam(2.0,fill=ps_color((/1.,.6,.6/)))
oc_beam(1.0,fill=2)
oc_beam(0.0,1,5,.2,rns=3.)
oc_surf(lw=.3,sns=3.,snc=6)

DR

AF

use optocad
use rsplot

call oc_exit
end

And this is the PostScript figure generated:

M2

0.2

ETM

0.2

5
7

0.0

3
1

0.0

M1
0.0

0.2

0.4

0.6

0.8

3000.0

Roland Schilling, 07 Nov 2011, parabolic_telescope.ps

19 Jul 2013 16:41

78

optocad_ug_0.93i

PARABOLIC

E XAMPLES

TELESCOPE

The above Fortran file produces the following output on the terminal:
This is OptoCad (Version 0.93d) by Roland Schilling.
All rights reserved. ABSOLUTELY NO WARRANTY!
Input of optical component data from character array.
w0t[m]
2.600E3
2.600E3
2.600E3
9.770E6
21.08E3
21.08E3
21.08E3

OptoCad statistics:
Number of optical components: 3
Number of optical surfaces: 9
Number of optical cavities: 0
Number of input beams: 1
Number of ray segments: 6
Number of beams split off: 0

w0s[m]
2.600E3
2.600E3
2.600E3
9.770E6
21.08E3
21.08E3
21.08E3

z0t[m]
19.96E+0
19.96E+0
19.96E+0
281.8E6
1.313E+3
1.313E+3
1.313E+3

z0s[m]
z2t[m]
z2s[m] label
19.96E+0 500.0E3 500.0E3 @ beam start
19.96E+0 400.0E3 400.0E3 @ frame 1 left
19.96E+0 399.5E3 399.5E3 # M1
281.8E6 608.3E3 608.3E3 # M2
1.313E+3 21.50E+0 21.50E+0 @ frame 1 right
1.313E+3 3.021E+3 3.021E+3 @ frame 2 left
1.313E+3 3.021E+3 3.021E+3 # ETM

ang[deg]
0.0
0.0
0.0
170.4E+0
0.0
0.0
0.0

AF

Beam # 1:
rs a
rd[m]
0 n
0.0
1 n 100.0E3
2 r 12.55E3
3 r 101.8E3
4 n 14.32E3
5 n 14.32E3
6 d 275.0E6

The following Fortran program used a pencil of rays in order to check the aberrations of the parabolic
telescope:
Program PARABOLIC_TELESCOPE_POR
!
!
!
!
!
!

Example of an allreflective offaxis parabolic telescope:


The Virgo input telescope with a magnification of 8 and
negligible astigmatism and spherical aberration.
Using a pencil of rays to check abberations.
use optocad
use rsplot

!
!

character(len=80)
integer
real

:: ocd(10)=
:: bc(7)
:: by(7)

DR

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
end

ocd(01)=b
ocd(02)=d
ocd(03)= +
ocd(04)=d
ocd(05)= +
ocd(06)=c
ocd(07)=c

0.4,
by,
r,
0.8,.01255,
d, dm=.015
r,.12152,.01255,
d, dm=.031
n, 0.85,.11405,
d, 3000.,.11405,

2.6e3 #>
.02,
0., rc=.14896, sh=0, zr=.0127 # M1 @lt,.05
.07, 180.,

rc=1.208, sh=0, zr=.1015 # M2 @rb,.1

0.1
0.2

by=[0.,2.6, 2.6,5.2, 5.2, 7.8, 7.8]*1e3


bc=[ 1,
2,
2,
3,
3,
4,
4]
call
call
call
call

# Test >@cb,.12
# ETM >@lb.01,.1
! Beam position
! Beam color

oc_init(unit=m)
oc_frame(0.,0.1,0.9,0.3,20.,20.,0.2,glp=0)
oc_frame(2999.9,0.1,3000.1,0.3,220.,20.,0.2,glp=0)
oc_set(lambda= 1.064e6,
& ! light wavelength of Nd:YAG
fslb = 4.0,
& ! character height for annotation (mm)
ciwis = 0, ciwit=0, & ! Switch off waist indicators
write = rs act rd ang w2t w2s w0t w0s z0t z2t z2s lb,&
print = rs act rd ang w2t w2s w0t w0s z0t z2t z2s lb)
call oc_input(ocd(2:))
do i=1,7
call oc_bind(by,by(i))
! Change beam Y position
call oc_input(ocd(1:1),nib)
! (Re)read data of input beam
call oc_trace(nib,of=ptp.log)
call oc_beam(0.0,bc(i),5,.2)
end do
call oc_surf(lw=.3)
call oc_exit
end

optocad_ug_0.93i

79

19 Jul 2013 16:41

E XAMPLES

PARABOLIC

TELESCOPE

This is the generated PostScript figure:

Test

M2

ETM

0.2

0.0

0.2

0.0

M1

0.2

0.4

0.6

0.8

AF

0.0

Roland Schilling, 07 Nov 2011, parabolic_telescope_por.ps

3000.0

The following list shows, slightly modified, the output file produced:
rd[m]

ang[deg]

w2t[m]

0 n
3 n
6 d

0.0
275.0E6
275.0E6

0.0
0.0
0.0

2.600E3
21.09E3
52.90E3

7 n
10 n
13 d

0.0
21.36E3
21.36E3

0.0
0.0
0.0

2.600E3
21.09E3
52.90E3

14 n
0.0
17 n 20.81E3
20 d 20.81E3

0.0
0.0
0.0

2.600E3
21.09E3
52.90E3

21 n
24 n
27 d

0.0
42.44E3
42.44E3

0.0
0.0
0.0

2.600E3
21.09E3
52.90E3

28 n
0.0
31 n 41.89E3
34 d 41.89E3

0.0
0.0
0.0

2.600E3
21.09E3
52.90E3

0.0
0.0
0.0

42 n
0.0
0.0
45 n 62.98E3 204.E15
48 d 62.98E3 204.E15

35 n
38 n
41 d

0.0
63.53E3
63.53E3

w2s[m]

w0t[m]

w0s[m]

z0t[m]

z2t[m]

2.600E3
21.09E3
52.90E3

2.600E3
21.08E3
21.08E3

2.600E3
21.08E3
21.08E3

19.96E+0
1.313E+3
1.313E+3

0.0
21.45E+0
3.021E+3

0.0 @ Beam 1
21.45E+0 # Test
3.021E+3 # ETM

2.600E3
21.09E3
52.90E3

2.600E3
21.08E3
21.08E3

2.600E3
21.08E3
21.08E3

19.96E+0
1.313E+3
1.313E+3

0.0
21.42E+0
3.021E+3

0.0 @ Beam 2
21.42E+0 # Test
3.021E+3 # ETM

2.600E3
21.09E3
52.90E3

2.600E3
21.08E3
21.08E3

2.600E3
21.08E3
21.08E3

19.96E+0
1.313E+3
1.313E+3

0.0
21.48E+0
3.021E+3

0.0 @ Beam 3
21.48E+0 # Test
3.021E+3 # ETM

2.600E3
21.09E3
52.90E3

2.600E3
21.08E3
21.08E3

2.600E3
21.08E3
21.08E3

19.96E+0
1.313E+3
1.313E+3

0.0
21.38E+0
3.021E+3

0.0 @ Beam 4
21.38E+0 # Test
3.021E+3 # ETM

2.600E3
21.09E3
52.90E3

2.600E3
21.08E3
21.08E3

2.600E3
21.08E3
21.08E3

19.96E+0
1.313E+3
1.313E+3

0.0
21.51E+0
3.021E+3

0.0 @ Beam 5
21.51E+0 # Test
3.021E+3 # ETM

2.600E3
21.09E3
52.90E3

2.600E3
21.09E3
52.90E3

2.600E3
21.08E3
21.08E3

2.600E3
21.08E3
21.08E3

19.96E+0
1.313E+3
1.313E+3

0.0
21.33E+0
3.020E+3

0.0 @ Beam 6
21.33E+0 # Test
3.020E+3 # ETM

2.600E3
21.09E3
52.90E3

2.600E3
21.09E3
52.90E3

2.600E3
21.08E3
21.08E3

2.600E3
21.08E3
21.08E3

19.96E+0
1.313E+3
1.313E+3

0.0
21.52E+0
3.021E+3

0.0 @ Beam 7
21.52E+0 # Test
3.021E+3 # ETM

DR

#rs a

z2s[m] label

One can see from the figure as well as from the numerical output that the geometrical and the Gaussian
beam parameters are independent of the input position of the beam, even at a distance of 3 km .

19 Jul 2013 16:41

80

optocad_ug_0.93i

DO- LOOP

E XAMPLES

TO FIND BEST MODE MATCHING

8.15 DO-loop to find best mode matching into a cavity


The Fortran program on the next page gives an example of how to find the optimum parameters for
position and focal length of a coupling lens in order to achieve the best mode-matching into an optical
cavity. This example is somewhat similar to the output section of the GEO-HF gravitational-wave detector. In particular, it uses the same output mode cleaner OMC (see page 83, top), used here in a twofold
magnification.

The first part of the Fortran program, after setting up the ocd array, is a normal O PTO C AD run producing a print of the data of ray segments and a plot of the components and light beams (see page 83,
bottom, and page 84, top). The modeled set-up consists of a mode-matching telescope, formed by the
focusing mirror M1 , the passive mirror M2 and the lens L , and the optical cavity OMC .

AF

The program starts with loading the modules for O PTO C AD, RSPLOT and RSUTIL, and with allocating
the variables and arrays used. This is followed by the optical component data of the set-up in the character
array ocd (lines 16 to 24), with the last line inserting the data of the OMC , magnified by a factor of
two. Please note that the three symbolic names M1_c , L_x and L_fl are used for the parameters
curvature of M1 , x-position of lens L and focal length of L , respectively. Lines 26 to 41 represent the
normal O PTO C AD run, producing the first page of the plot output and the upper part of the log file. On
the lines 32 to 34 the three symbolic parameters in the ocd -array are given fixed values.
On line 45 the part with the DO-loops begins with OC_INIT being called again, but with the plots and
prints switched off. This is followed by assigning a range of values for the arrays l_fl and l_x ,
running from 0.15 m to 0.25 m for the focal length and from 1.10 m to 1.30 m for the x-position of
the lens. On lines 49 to 55 RSPLOT is initialized explicitely, thus starting a new page of the PostScript
output file, and a plot is set up in order to prepare for plotting the mode matching into the OMC as a
function of the position of the lens, with its focal length as parameter.

DR

The actual DO-loops are on lines 58 to 76, with the outer Do-loop running over 101 values for the
focal length, and the inner DO-loop varying the x-position of the lens. The corresponding values for
the parameters L_fl and L_x are set on lines 59 and 61, respectively. Line 65 calculates the mode
matching for the current focal length and x-position and saves it in the array moma . After the inner
DO-loop the mode matching is plotted for every fifth value of focal length, and its maximum is printed,
together with the corresponding x-position. For this print, and for that of the associated headline on
line 56, PS_MSG must be used instead of OC_MSG since all prints are switched off in O PTO C AD.
Page 83, bottom, shows the resulting print-out, and the following page the two pages of the generated
PostScript file. As one can see, the best mode matching is achieved with a focal length of 0.20 m at a
position of 1.197 m . The fact that it is only 0.983 is caused by the astigmatism of the beam which, in
turn, is due to the oblique incidence to the focusing mirror M1 . One can see this at ray-segment 5 in the
print-out, the ray-segment that is impinging on the back of MOMC_1 . Here the beam radii ( w2t and
w2s ) as well as the position of the beam waists ( z2t and z2s ) in the tangential and the sagittal plane
are quite different. If one would replace the input beam by
15

ocd(00)=b

0.000, 0.000, .004950, c=0.7214

# input beam

the beam would start at the position of M2 and the mode-matching factor would very closely approach
unity.
Another way to depict the dependence of the mode matching on position and focal length of the lens
is shown on page 85 using a colored contour plot. Lines 78 to 84 of the Fortran program contain the
respective part initializing RSPLOT again, thus starting a new page of the PostScript output file, and
then preparing and doing the contour plot using RSPLOT commands. Line 83 assigns 51 contour levels
corresponding to mode-matching values from 0.5 to 1.0 .

optocad_ug_0.93i

81

19 Jul 2013 16:41

E XAMPLES

!
!

!
!
!

Example for a doloop finding the best mode matching to a cavity.


use optocad
use rsplot
use rsutil
character(120)
integer, parameter
integer, parameter
integer, parameter
real

::
::
::
::
::

ocd(0:16)=
npt=200
! number
nfl=101
! number
ncl=51
! number
moma(npt,nfl), l_fl(nfl),

of x positions of L
of focal lengths of L
of contour levels
l_x(npt), rcl(ncl)

act
xap
yap rap
phi
cur
ocd(00)=b
0.000, 0.200, .01
ocd(01)=c
h, 0.000, 0.200, .09, sc=13
ocd(02)=d
r, 1.400, 0.200, .05, 4.06505, M1_c, r=1.
ocd(03)= +
d, dx=.050
ocd(04)=d
r, 0.000, 0.000, .05,180+4.06505, .0, r=1.
ocd(05)= +
d, dx=.050
ocd(06)=d
t,
L_x, 0.000,.025, t=1.0, f=L_fl
ocd(07)= +
t, dx=.005
ocd(08)=i OMC.ocd, 1.6, .00668, 0., 2.

#
#
#
#

label
input beam
beam start @cb,.11
M1 @rb,.07

Program MM_LOOP

call
call
call
call
call
call
call
call
call
call
call
call
call
call

# M2

@rb,.07

# L

@cb,.04

! insert OMC

oc_init
! initialize OptoCad
oc_frame(0.2,.5,2.0,0.5,20.,20.,.1,d_tl=30.,d_tm=8.)
ps_text(1,OMC,1.72,0.15,fs=3.)
oc_set(rix=[1.44963],
& ! ref. index of fused silica at 1064nm
cslw = .1,
& ! linewidth for surface of components
print=rs s2 act rd ang w2t w2s z2t z2s pw lb)
oc_bind(M1_c,1./(5.60))
! curvature of M1
oc_bind(L_fl,0.200)
! focal length of lens L
oc_bind(L_x, 1.1970)
! xposition of lens L
oc_input(ocd)
oc_trace
! trace the light beam
oc_beam(3.0,fill=ps_color((/1.,.8,.8/)))! Plot outer part of beam
oc_beam(2.0,fill=ps_color((/1.,.6,.6/)))! Plot middle part of beam
oc_beam(1.0,fill=2)
! Plot inner part of beam
oc_beam(0.0, 1, 5, .2)
! Plot the beam axes in black
oc_surf(lw=.1)
! plot all surfaces with 0.1mm linewidth

AF

!
!
!

TO FIND BEST MODE MATCHING

Do nested loops over focal length and xposition of lens L and plot
the modematching into the OMC:
call oc_init(plot=0,prt=)
! initialize OptoCad: no plots or prints
l_fl=vector(nfl,0.15,0.25)
! focal length of lens L
l_x=vector(npt,1.10,1.30)
! xposition of lens L
call ps_init
! new page to plot mode matching curves
call ps_frame(1,l_x(1),.90,l_x(npt),1.,40.,clip=1, & ! frame for mode...
fill=ps_color([.94,.94,.94]))
! ...matching plot
call ps_axis(1,ax=Xx,glp=0,d_tm=5.,title= &
! xaxis for mode...
XPosition of the lens L [m])
! ...matching plot
call ps_axis(1,ax=Yy,title=ModeMatching into the OMC,glp=0) ! yaxis
call ps_text(1,Focal length of L =,xr=7.,yt=10.,fs=4.)
call ps_msg(0,\\Maximum mode matching:)
m=1
do k=1,nfl
! loop over focal lengths of lens L
call oc_bind(L_fl,l_fl(k))
! set focal length of lens L
do i=1,npt
! loop over xpositions of lens L
call oc_bind(L_x,l_x(i))
! set xposition of lens L
call oc_input(ocd)
call oc_trace
! trace the light beam
call oc_reset(2)
! reset parameters to allow loops
moma(i,k)=cavities(1)%mm(1)*cavities(1)%mm(2) ! get mode match. to OMC
end do
if (mod(k1,nfl/10) == 0) then
! only plot and print every fifth l_fl
call ps_text(1, {\fi2//trim(r2c(l_fl(k),F+1.3))//}\,m, &
xr=7.,yt=10.7.*m,ci=m,fs=4.)
! print the mode matching
call ps_plot(1,npt,l_x,moma(:,k),ci=m)
! plot the mode matching
call ps_msg(0,Focal length = //trim(r2c(l_fl(k),F+1.3))// &
m, ModeMatching =//trim(r2c(maxval(moma(:,k)),F2.5))// &
, L_x =//trim(r2c(l_x(sum(maxloc(moma(:,k)))),F2.5)))
m=m+1
end if
end do

DR

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
end

DO- LOOP

call ps_init
! new page to plot mode matching contour
call ps_frame(1,l_x(1),l_fl(nfl),l_x(npt),l_fl(1),35.)
call ps_axis(1,ax=Xx,glp=0,d_tm=5.,title= &
! xaxis for ...
XPosition of the lens L [m])
! ...contour plot
call ps_axis(1,ax=Yy,title=Focal length of lens L [m],glp=0)! yaxis
rcl=vector(ncl,.5,1.0)
! contour levels
call ps_contour(1,npt,nfl,moma,rcl,pal=1,csw=10.)
! contour plot
call oc_exit
end

19 Jul 2013 16:41

82

optocad_ug_0.93i

DO- LOOP

E XAMPLES

TO FIND BEST MODE MATCHING

The optical-component data for the GEO-HF mode cleaner OMC:


#
#
d

Output mode cleaner for GEOHF:


+

optical component data

cntr, .035,
0.0,.02,18041.5825, .0, t=.02
t, dm=.012, t=0.999
str, +.035,
0.0,.02,41.5825,
.0, t=.02
t, dm=.012, t=0.999
r,+.0175, +.146,.018, 90., rc=2.350, r=1.
t, dm=.012, t=0.999
r,.0175, .146,.018, 90., rc=2.350, r=1.
d, dm=.012

# MOMC\_1

@.13,.06,.8

# MOMC\_2

@.02,.07,.8

# MOMC\_3N @.07,.04,.8
# MOMC\_3S @.07,.06,.8

1
2
3
4
5
6
7
8
9
10
end

The resulting print-out:

This is OptoCad (Version 0.91c) by Roland Schilling.


All rights reserved. ABSOLUTELY NO WARRANTY!

Beam
rs
0
1
2
3
4
5
6

rs
7
11
12

w2t[m]
10.00E3
10.00E3
4.937E3
657.1E6
650.5E6
585.5E6
693.8E6

w2s[m]
10.00E3
10.00E3
4.962E3
703.7E6
697.6E6
700.9E6
702.1E6

z2t[m]
z2s[m]
0.0
0.0
1.400E+0 1.400E+0
1.379E+0 1.393E+0
181.6E3 195.7E3
460.4E3 529.6E3
226.1E3 183.0E3
435.9E3 292.2E3

power[W]
1.000E+0
1.000E+0
1.000E+0
1.000E+0
1.000E+0
1.000E+0
999.0E3

label
@ beam start
# M1
# M2
# L
+ L
+ MOMC\_1
# MOMC\_1

Evaluated data of cavity 1 (when in resonance):


Roundtrip phase = 0.000E+0, FSR = 227.7E+6, Bandwidth = 1.465E+6, Finesse = 155.5
Tangent. plane: w0 = 630.7E6, z0 = 1.175E+0, w1 = 631.8E6, z1 = 70.00E3, R1 = 19.78E+0
Sagittal plane: w0 = 633.2E6, z0 = 1.184E+0, w1 = 634.3E6, z1 = 70.00E3, R1 = 20.09E+0
Mismatch for closing cavity 1: Position: 3.472E6, Angle:
127.0E6
Misalignment w.r.t. cavity eigenray: Position:
0.000E+0, Angle:
0.000E+0,
0.000E+0
Mode matching (for perfect alignment): mt*ms = 992.7E3 * 990.3E3 = 983.0E3
Perfect impedance matching requires: r = 980.000E3, t = 20.0000E3
18 r 4.731E6 16.65E6 631.8E6 634.3E6 70.00E3 70.00E3 49.10E+0 # MOMC\_2
22 r 3.292E6 96.83E+0 660.3E6 662.5E6 364.1E3 364.1E3 48.12E+0 # MOMC\_3N
26 r 1.918E6 96.83E+0 660.3E6 662.5E6 294.1E3 294.1E3 48.12E+0 # MOMC\_3S
14 d 1.314E6 96.83E+0 631.8E6 634.3E6 70.00E3 70.00E3 48.12E+0 # MOMC\_1
Roundtrip Gouy phase of cavity 1: 30.81 + 30.59 = 61.40
Mode spacing in cavity 1: Tangent. plane: 38.99E+6, Sagittal plane: 38.70E+6
s2
18
19
5

DR

***
***
***
***
***
***
***
***
7
8
9
10
***
***

# 1: input beam
s2 a
rd[m] ang[deg]
0 n
0.0
0.0
2 r
0.0
0.0
6 r 58.25E9 171.9E+0
10 t 58.11E9
0.0
11 t 58.61E9 5.717E6
15 t 12.36E3 16.65E6
14 t 4.786E6 14.33E+0

AF

Input of optical component data from character array.


*** Calculated curvatures for lens 1 ("L"): ct = 5.536E0 1/m cs = 5.536E0 1/m
*** Principal planes: dp1t = +1.717E3 m d2t = +3.283E3 m d1s = +1.717E3 m d2s = +3.283E3 m
Input of optical component data from file OMC.ocd

a
rd[m] ang[deg]
t 4.731E6 16.65E6
t 12.35E3 14.33E+0
n 13.37E3 16.65E6

Maximum mode
Focal length
Focal length
Focal length
Focal length
Focal length
Focal length
Focal length
Focal length
Focal length
Focal length
Focal length

matching:
= 0.150m,
= 0.160m,
= 0.170m,
= 0.180m,
= 0.190m,
= 0.200m,
= 0.210m,
= 0.220m,
= 0.230m,
= 0.240m,
= 0.250m,

optocad_ug_0.93i

w2t[m]
631.8E6
751.5E6
664.1E6

ModeMatching
ModeMatching
ModeMatching
ModeMatching
ModeMatching
ModeMatching
ModeMatching
ModeMatching
ModeMatching
ModeMatching
ModeMatching

=
=
=
=
=
=
=
=
=
=
=

w2s[m]
634.3E6
635.0E6
667.1E6

0.91676,
0.94226,
0.96087,
0.97341,
0.98048,
0.98313,
0.98182,
0.97728,
0.97013,
0.96080,
0.94972,

83

z2t[m]
70.00E3
170.3E3
387.0E3

L_x
L_x
L_x
L_x
L_x
L_x
L_x
L_x
L_x
L_x
L_x

=
=
=
=
=
=
=
=
=
=
=

z2s[m]
70.00E3
128.5E3
392.5E3

power[W]
49.10E+0
982.1E3
981.1E3

label
# MOMC\_2
+ MOMC\_2
@ frame 1 right

1.24070
1.23166
1.22362
1.21457
1.20553
1.19749
1.18945
1.18040
1.17236
1.16432
1.15628

19 Jul 2013 16:41

E XAMPLES

DO- LOOP

TO FIND BEST MODE MATCHING

Page 1 of the generated PostScript file: The optical layout


0.5
MOMC_3N

beam start

M1
OMC

M2

0.0

AF

MOMC_1

0.5
0.0

0.5

Roland Schilling, 30 Jul 2010, mm_loop.ps

1.0

MOMC_2

MOMC_3S

1.5

2.0

Page 2 of the generated PostScript file: The resulting mode matching

0.98

0.96

0.94

0.92

0.90
1.10

DR

ModeMatching into the OMC

1.00

1.12

1.14

1.16

1.18

1.20

1.22

1.24

1.26

Focal length of L =
0.150 m
0.160 m
0.170 m
0.180 m
0.190 m
0.200 m
0.210 m
0.220 m
0.230 m
0.240 m
0.250 m

1.28

1.30

XPosition of the lens L [m]

Roland Schilling, 30 Jul 2010, mm_loop.ps

19 Jul 2013 16:41

84

optocad_ug_0.93i

DO- LOOP

E XAMPLES

TO FIND BEST MODE MATCHING

Page 3 of the generated PostScript file: The resulting mode matching as contour plot
1.0
0.16

0.18

0.20

0.22

0.24

1.10

1.12

1.14

AF

Focal length of lens L [m]

0.9

1.16

1.18

1.20

1.22

1.24

1.26

0.8

0.7

0.6

0.5
1.28

1.30

XPosition of the lens L [m]

DR

Roland Schilling, 30 Jul 2010, mm_loop.ps

optocad_ug_0.93i

85

19 Jul 2013 16:41