Plotting Refractive Index and Abbe Number
When trying to plot the refractive index and dispersion of materials in a Geometrical Optics model, users frequently encounter two challenges:
Ray Variables and Domain Variables
For an instance of the Geometrical Optics interface with the default name gop, the variable for refractive index defined on rays is gop.nref, while the variable for refractive index in the domain is called gop.nref_local. As the rays propagate through domains in the geometry, the value of gop.nref is determined by evaluating gop.nref_local at a geometry point corresponding to each ray’s current location.
Similarly, when a ray is refracted at the boundary between two different media, the implementation of Snell’s law requires the variable gop.nref_local to be evaluated in the media on the side of the incident ray and the refracted ray, at the point where the incident ray intersects the boundary.
During postprocessing, a ray variable such as gop.nref can only be evaluated on rays, not at arbitrary points in the geometry where a ray might not be present. For example, trying to use gop.nref in a Slice plot will usually result in an error message such as:
Cannot evaluate expression.
 
Undefined variable.
- Variable: comp1.gop.nref
- Geometry: geom1
- Domains: 1
Failed to evaluate expression.
- Expression: comp1.gop.nref
- Plot: Slice 1
A better choice for the Slice plot would be the variable gop.nref_local, which is a domain variable and therefore exists at every point in the domain, regardless of whether a ray is present there or not.
However, a Slice plot of gop.nref_local will not always work. The plot will appear correctly if the refractive index is entered as a constant value in each domain; that is, if dispersion is neglected. If the model uses optical dispersion relations that define the refractive index as a function of the wavelength of the rays, you may get an error message such as:
Illegal operator context.
 
Failed to evaluate expression.
- Expression: noenv(comp1.gop.lambda0)
Failed to evaluate variable.
- Variable: comp1.gop.mp1.lambda0
- Defined as: noenv(comp1.gop.lambda0)
A more reliable means of plotting the refractive index of dispersive media is presented in the next section.
Evaluation of Refractive Index of Dispersive Media
All real materials exhibit some degree of optical dispersion, or wavelength dependence of the refractive index. You can enter a value or expression for the refractive index directly, define a function (such as an Analytic, Interpolation, or Piecewise function), or use one of the built-in dispersion relations such as the Sellmeier dispersion formula.
In addition, the Geometrical Optics interface may be configured to trace either monochromatic or polychromatic light, by selecting the desired option from the Wavelength distribution of released rays list in the physics interface Ray Release and Propagation list.
Most of the optical glass material data in the Optical Material Libraries use a dispersion formula to define the refractive index. (See Material Libraries for a more comprehensive list of the available materials.) For example, if the Sellmeier dispersion formula is used, then the variable gop.nref_local is defined as
gop.nref_local = sqrt(1
+gop.ODsma1*gop.lambda0norm^2/(gop.lambda0norm^2-gop.ODsma4)
+gop.ODsma2*gop.lambda0norm^2/(gop.lambda0norm^2-gop.ODsma5)
+gop.ODsma3*gop.lambda0norm^2/(gop.lambda0norm^2-gop.ODsma6)
)
where the variables gop.ODsma<1,2,3,4,5,6> are the Sellmeier dispersion coefficients.
The variable gop.lambda0norm is the vacuum wavelength of the ray expressed in micrometers,
gop.lambda0norm = gop.mp1.lambda0/1[um]
and this scoped variable gop.mp1.lambda0 is defined as
gop.mp1.lambda0 = noenv(gop.lambda0)
The special operator noenv() allows a two-way exchange of information between the ray and the domain it is in, for the purpose of evaluating variables. It allows a ray variable (such as the wavelength) to be used in the definition of a domain variable, which in turn can be evaluated at the ray’s location. However, this construction only works if the domain variable is evaluated at the location of a ray, not at any arbitrary location in the geometry, which is why a Slice plot of gop.nref_local fails for dispersive media.
The Medium Properties node automatically defines domain variables for the refractive index at several spectral lines:
gop.nrefd is the refractive index at the helium d-line, a yellow spectral line of helium with a wavelength of approximately 587.56 μm.
gop.nrefF is the refractive index at the hydrogen F-line, a blue spectral line of hydrogen with a wavelength of approximately 486.13 μm.
gop.nrefC is the refractive index at the hydrogen C-line, a red spectral line of hydrogen with a wavelength of approximately 656.28 μm.
The Abbe number gop.Vd is also available as a built-in postprocessing variable. Its definition is
gop.Vd=(gop.nrefd-1)/(gop.nrefF-gop.nrefC)
For displaying the refractive index in Slice or Volume plots, these variables for refractive index at specific wavelength values can be used more reliably than gop.nref_local.
Alternatively you can evaluate the refractive index of a dispersive medium at any other wavelength value using the subst() operator, which can replace the ray wavelength in the dispersion formula with a fixed value. For example, another way to plot the d-line refractive index (rather than the built-in variable gop.nrefd) is using the expression
subst(gop.nref_local,gop.mp1.lambda0,587.56[nm])
where the third argument to the subst() operator could be replaced with any other numeric value.
Summary of Available Variables
The built-in postprocessing variables gop.nrefd, gop.nrefF, and gop.nrefC can be used to plot the refractive indices of all materials at fixed wavelengths of 587.56 μm, 486.13 μm, and 656.28 μm, respectively. The built-in variable gop.Vd is the Abbe number in terms of the refractive indices at these three wavelengths. You can also plot the refractive indices of domains at any other fixed value of the wavelength using an expression of the form
subst(gop.nref_local,gop.mp1.lambda0,<wavelength>)
where <wavelength> should be replaced with a numeric value.
In the COMSOL Multiphysics Reference Manual: