[Contents]   [Back]   [Prev]   [Up]   [Next]   [Forward]  


Specifying Designs

Designs are coded in Scheme language files. More than one design can be specified in a design file, permitting sharing of code. A variety of design examples are contained in the validation suites `dielectric.scm', `metallic.scm', and `granular.scm'. The graphs output by these suites are shown and discussed in
http://people.csail.mit.edu/jaffer/FreeSnell/dielectric.html,
http://people.csail.mit.edu/jaffer/FreeSnell/metallic.html, and
http://people.csail.mit.edu/jaffer/FreeSnell/granular.html

Specifying Materials

The index-of-refraction of dielectric materials often varies little with wavelength. In these cases the index-of-refraction can be a number. It is often convenient to give a symbolic name to numbers. For example:

(define ZnS 2.2)                ;znscub +0.01i
(define Ge 4.2)                 ;ge

After these definitions, layers can reference the identifiers:

(optical-stack
 (substrate 1)
 (layer      ZnS   528.64e-9)
 (layer      Ge    178.96e-9)
 (layer      ZnS   250.12e-9)
 (layer      Ge    123.17e-9)
             ...

Sometimes the index-of-refraction is specified as a formula of wavelength. The Refractive index database at http://refractiveindex.info gives a formula for the refractive-index of the plastic PMMA over the range 0.4358.um to 1.052.um. We can use its formula as a Scheme function:

;; n^2 = C1 + C2*wl^2 + C3*wl^-2 + C4*wl^-4 + C5*wl^-6 + C6*wl^-8
(define PMMA
  (let ((C1 2.399964)
        (C2 -8.308636E-2)
        (C3 -1.919569E-1)
        (C4 8.720608E-2)
        (C5 -1.666411E-2)
        (C6 1.169519E-3))
    (lambda (w)                         ; wavelength in meters
      ;; wavelength in microns and limited to valid range
      (let* ((wl (max 0.4358 (min 1.052 (* w 1e6))))
             (wl^-2 (/ 1 wl wl)))
        (sqrt (+ C1
                 (* C2 wl wl)
                 (* (+ C3 (* (+ C4 (* (+ C5 (* C6
                                               wl^-2))
                                      wl^-2))
                             wl^-2))
                    wl^-2)))))))

For more compliated material properties FreeSnell retrieves the wavelength-dependent index-of-refraction by calling functions which interpolate values from the materials database (see section Material Databases).

(require 'FreeSnell)
(require 'databases)
(require 'database-interpolate)

(defvar nk (open-database (or (getenv "NK_DATABASE_PATH") "nk.rwb")
            'rwb-isam))
(defvar ge (interpolate-from-table (open-table nk 'ge) 2))
(defvar zns (interpolate-from-table (open-table nk 'znscub) 2))
...

In this example ge and zns can be passed as arguments to layer and substrate.

For dielectric films embedded with spherical metal granules much smaller than the thickness of the film and the wavelengths under consideration, Maxwell Garnett Theory provides a means to calculate the effective n and k. The thickness of the granular film must be several times the granule size; otherwise the more complicated machinations of [Granfilm] are required.

Function: granular-IR ir q ir0
The complex ir and ir0 specify the indexes of refraction for the metallic and matrix materials respectively. The real number q is the fractional volume occupied by the metal. granular-IR returns a complex index-of-refraction for the composite layer.
(define (ruby-glass w) (granular-IR (Au w) 8.0e-6 1.5))

Optical Stack

Function: optical-stack layer1 ...
Function: optical-stack layer1 ... bottom-substrate
Function: optical-stack top-substrate layer1 ... bottom-substrate
Returns a data structure combining its layer arguments. Each layer is returned from a call to layer or substrate. Substrate arguments must be first or last and default to having an index-of-refraction of 1. A substrate has arbitrarily large thickness, and is the source or sink of test inputs (radiation).

Function: layer ir thick nom
Function: layer ir thick
Returns a layer having the specified index-of-refraction and thickness.

If ir is a number, then the index-of-refraction is ir at all wavelengths. If ir is a procedure then the index-of-refraction at wavelength w is (ir w).

If the number thick is smaller than 1/50, then it is taken as the actual thickness. Note that the effective optical thickness will be larger than the actual thickness because light is slowed by the index-of-refraction.

If the number thick is larger than 1/50, then the thickness is thick times nominal divided by the real-part of the index-of-refraction at nominal, where nominal is either the third argument nom or the value set by the nominal function. This is a convenient notation for the fractional optical wavelengths often used to specify filter elements.

Layers specified by layer model the interference effects of reflections of reflections. This is correct for thin layers or if the modeled optical system will be illuminated by coherent light. But layers thicker than several wavelengths have variations extremely sensitive to incident angle.

Incoherent illumination will average over the wiggles. For these layers FreeSnell computes the transmitted and reflected power ratios, rather than E-fields.

Function: layer* ir thick
Returns an incoherent layer having the specified index-of-refraction and thickness.

Function: substrate ir
Returns a substrate having the specified index-of-refraction.

If ir is a number then the index-of-refraction is ir at all wavelengths. If ir is a procedure then the index-of-refraction at wavelength w is (ir w).

If substrates are not specified, then their index-of-refraction defaults to 1 (vacuum).

To place a substrate between two sets of layers, use layer* instead.

Function: nominal nom
Sets the default nominal thickness to nom. Multiple nominal commands are allowed interspersed with layer commands. The arguments to optical-stack are considered in order from the first to the last.

Function: repeat k layer1 layer2 ...
Inserts k copies of the sequence layer1, layer2, ... into the stack.

Plot-response

Function: plot-response arg1 arg2 ...
One or more of arg1, arg2, ... should be an optical stack returned by optical-stack, or a value returned by a call to IR. The other arguments should be values returned by the functions in sections section Ranges and Units, section Traces, and section Color-Swatches.

Plot-response creates a graph, data file, or color patches as directed by its arguments. If more than one optical stack is given, the same quantities are computed for each optical stack; but all are plotted to a single graph.

Function: stack-colors color1 color2 ...
Each color1, ... should be a string naming a Resene color, a saturate color, or a number between 0 and 100. If supplied, there should be one color for each optical-stack. color1, ... default to black (0). If stack-colors is called more than once, then its color arguments are appended together.

stack-colors causes the traces from each optical stack to be drawn in its corresponding color.

Ranges and Units

Function: title str filebase
Function: title str
Sets title for the run to str. If the string filebase is given, then it is used for the output filename root; otherwise str is used.

Function: output-format sym
Function: output-format k1 k2
Function: output-format sym k1 k2

According to the symbol sym, sets the disposition of plots to be:
eps filebase.eps
ps filebase.ps
png filebase.png
jpg filebase.jpg
jpeg filebase.jpeg
pdf filebase.pdf
#t views filebase.eps using ps:viewer.

If output-format is not used, then the output-format defaults to the value of top-level identifier *output-format*, which defaults to #t.

If a pair of nonnegative exact integers, k1 and k2 follows sym, then the plot will be k1 pixels horizontally and k2 pixels vertically.

The output-format command does not affect the data written by output-data.

Function: font x
Function: font fnt
Function: font fnt x
Function: font x left-template right-template
Function: font fnt left-template right-template
Function: font fnt x left-template right-template

If a string fnt is supplied, then it names the PostScript font which will be used. The default value is Times.

If a nonnegative real number x follows the fnt, then x is the fontsize.

If two strings follow, then they are used as the templates whose printed representation using fnt is used to size the left and right margins respectively. If not specified, the templates default to `-.0123456789'.

If x is not specified and k1 is, then the font height will be k1/33. If neither is specified, then the font height will be 12.

The font command does not affect the data written by output-data.

Function: output-data file
Function: output-data file str1
Function: output-data file str1 str2
If the first character of file is `|', then lines of data are piped to the stdin of the command line in file; otherwise a file of data is written to file.

str1 and str2 are printf format strings for the first number and the rest of the numbers printed on one line. If #f is passed, then the corresponding numbers are written with full Scheme precision and tab delimited.

Function: range low high
Sets the ordinate range of the plot to low to high.

Function: range low high 'db
Function: db low high
Sets the ordinate range of the plot to low to high decibels.

Function: wavelengths w
Sets the abscissa range of the plot to be linear from wavelengths 0.75*w to 1.25*w.

Function: wavelengths w1 w2
Sets the abscissa range of the plot to be linear from wavelengths w1 to w2.

Function: wavelengths w1 w2 g1 g2
Sets the abscissa range of the plot to be linear from wavelengths w1 to w2 in a graph rectangle from wavelengths g1 to g2.

Function: wavenumbers w
Sets the abscissa range of the plot to be logarithmic from wavenumbers 0.666*w to 1.5*w.

Function: wavenumbers w1 w2
Sets the abscissa range of the plot to be logarithmic from wavenumbers w1 to w2.

Function: wavenumbers w1 w2 g1 g2
Sets the abscissa range of the plot to be linear from wavenumbers w1 to w2 in a graph rectangle from wavenumbers g1 to g2.

Function: eVs x
Sets the abscissa range of the plot to be linear from energy 0.666*x to 1.5*x electron Volts.

Function: eVs x1 x2
Sets the abscissa range of the plot to be linear from energy x1 to x2 electron Volts.

Function: eVs x1 x2 g1 g2
Sets the abscissa range of the plot to be linear from energy x1 to x2 electron Volts in a graph rectangle from energies g1 to g2 electron Volts.

Function: logarithmic w
Sets the abscissa range of the plot to be logarithmic from wavelengths 0.666*w to 1.5*w.

Function: logarithmic w1 w2
Sets the abscissa range of the plot to be logarithmic from wavelengths w1 to w2.

Function: logarithmic w1 w2 g1 g2
Sets the abscissa range of the plot to be logarithmic from wavelengths w1 to w2 in a graph rectangle from wavelengths g1 to g2.

Function: angles theta
Sets the abscissa range of the plot to be linear from angles 0.75*theta to 1.25*theta.

Function: angles theta1 theta2
Sets the abscissa range of the plot to be linear from angles theta1 to theta2.

Function: marker w1 w2 ...
Places vertical arrows at abscissa coordinates w1, w2, .... The marker command does not affect the data written by output-data.

Function: samples k
Sets the number of abscissa coordinates to k. The default value is 200.

Function: smooth sigma
Convolves the traces (before converting values to decibels) with a Gaussian filter having wavelength standard deviation sigma.

Traces

These functions specify whether the plot holds angle constant and varies wavelength; holds wavelength constant and varies angle; or plots components of the index-of-refraction of a material. Multiple invocations of any one of these functions puts all those specified traces in one plot. To generate separate plots call plot-response multiple times.

The type of a trace appearing in a plot is specified by a symbol. The first ten in this table are for separate polarizations. The rest average the two polarizations.
T_s S-plane transmission
R_s S-plane reflection from top
B_s S-plane reflection from bottom
A_s S-plane absorption from top
L_s S-plane absorption from bottom
T_p P-plane transmission
R_p P-plane reflection from top
B_p P-plane reflection from bottom
A_p P-plane absorption from top
L_p P-plane absorption from bottom
T tranmission
R reflection from top
B reflection from bottom
A absorption from top
L absorption from bottom

A trace can also be a quoted scheme expression combining numbers and the symbols listed above with the operators +, -, *, /, ln, log_10, and average. The following example computes the reflectivity relative to a substrate reflectivity of 0.023:

(incident 45 '(/ (- R_p .023) .023))

Function: incident angle trace1 trace2 ...
A plot of trace1, trace2, ... versus wavelength will be generated for radiation incident at angle degrees.

The angle argument can also be a list of angles in degrees. In this case the plots of trace1, trace2, ... will be averaged over the angles given.

This is useful when profiling materials whose thicknesses are several times wavelengths of interest. Plots at a single angle of incidence can oscillate wildly with wavelength as the reflections go in and out of phase, constructively and destructively interfering.

Function: wavelength w trace1 trace2 ...
A plot of trace1, trace2, ... versus incident angle will be generated for radiation at wavelength w.

Function: ir substance comp1 comp2 ...
Plots characteristics of procedure substance versus wavelength. Symbols comp1, comp2, ... determine the characteristics to be plotted:
n
real
real-part
n
k
imag
imag-part
ec
extinction-coefficient
k
k/n
k/n
r0
reflect
reflectance
Normal reflectance from a thick layer.

Color-Swatches

Function: color-swatch angle trace
Computes the color of trace at angle degrees from normal using CIE illuminant D65.

The following statement will cause plot-response to compute the reflected color (average of both polarizations) at 30 degrees from the surface normal.

(color-swatch 30 'R)

If there are any color-swatch statements passed to plot-response, then a file named filebase-color.png will be written containing 64x64 pixels color squares, one for each color computed. The squares are arrayed horizontally in the order they are passed to plot-response. Vertically, one such row is generated for each optical stack.

The filebase string is that set by the title command.


[Contents]   [Back]   [Prev]   [Up]   [Next]   [Forward]