Usually a proper field plot gives the best idea about the guiding characteristics of a dielectric structure. Besides, profile visualizations are required e.g. for checking the correctness of results, and for purposes of demonstration.
Since graphics capabilities are not directly incorporated into the
WMM programs, a plot requires to export suitable data sets, where the
output format naturally depends on the numerical sofware for which the
data is intended. The export routines are favourably implemented as
member functions of Mode
(WMM_Mode
) or
WMM_ModeArray
objects;
the methods
writeprofile |
Evaluate a mode component on a finite rectangular regular mesh in the x-y-plane, store the profile data in a file. |
writesec |
Evaluate a mode component on equidistant points on a line segment in the x-y-plane, save the profile section data to a file (extension .xyf). |
(defined in
mode.h, mode.cpp)
may serve
as examples, and as candidates for adapting the WMM output to a new
visualization tool.
The WMM_Mode
members
field
and wg
provide
the necessary
information about mode profiles and the underlying structures.
WMM_ModeArray.field
gives access to propagating guided fields.
This section describes a collection of functions which export the field data to MATLAB script files (extension '.m'). The routines are defined in mode.h, mode.cpp for the mode profiles, and in wmmarr.h, wmmarr.cpp for mode interference fields, with helper functions found in wmmvis.h and wmmvis.cpp (the latter actually write the MATLAB commands).
Besides the field data, a proper figure requires further information, e.g. about axis annotations or scaling ratios. In the present case, a sketch of the structure under consideration is usually appropriate (helpful for immediate on-screen inspection as well as for publishing). This information is at hand when the export routine is executed, and at this moment one has usually a shape of the final plot already in mind. Therefore, the output m-files produce an entire figure when invoked in MATLAB, including plot commands, axis annotations, scaling, and, if appropriate, lines or patches to indicate the dielectric structure. In this way the path from the raw mode solver output to an acceptable plot is short and almost automatized.
Since 'acceptable' is a matter of taste (and of the actual problem), some ways to change the look of the final figure are to be mentioned:
The type of plot is determined by selecting the appropriate
function, or its
argument, respectively. Additionally, a few global options influence
the output (possible settings are YES
and NO
):
Mlop_Colour |
Decides, whether the plot uses colours.
Set this value to NO to enforce a gray scale figure.
|
Mlop_Print |
Most types of m-files contain print commands at the very end, which
are commented, if this option is not set to YES . Doing so
enforces MATLAB to write a graphics file (encapsulated postscript (.eps) or
portable network graphics (.png))
at completing the figure setup.
|
These options may be useful, if an entire sequence of graphics is to be generated automatically. They are introduced in wmmvis.h, wmmvis.cpp.
In conclusion, for plotting a field profile you may adhere to the following steps:
m.mfile(HX, SQR, display, 75, 115, '0', '0', 'I');
Hx >> vcsqHx00I.m
vcsqHx00I
Most of the the figures shown below are generated in this way, without any further editing.
The following functions,
defined in
mode.h and mode.cpp as
members of WMM_Mode
objects, initiate mode profile plots.
Comments on some of the common arguments can be found
at the bottom of this page. See e.g.
rib.cpp for examples
on the use of the plot commands; the figures in this section correspond to
the profile of the fundamental symmetrical vectorial mode of the rib
waveguide, which is analysed in that program.
acmfile |
Surface plots of the six (all) electromagnetic components collected in
one figure. The subplot's axes are adjusted such that the field amplitudes
are comparable within each row.
The script file contains a line 's = 1; '
at the beginning of the section with plot commands. Changing this
to 's = -1; ' inverts all field amplitudes.
|
mfile, 'N' |
Generate a m-file for a single mode component. The last argument specifies the type of plot. 'N' or a character which is not listed below yields a m-file that contains merely the field data, without any plot commands. |
mfile, 'C' |
A contour plot of one field component with a sketch of lines and patches that indicates the guiding structure. The gray scale levels of the patches are adjusted to the actual refractive indices (darker shading means higher refractive index). To enlarge the contrast (e.g. between substrate and film regions with, compared to the cover, very similar permittivity), change these values, such that the steps between the refractive index levels become equal. The waveguide data can be found at the beginning of the m-file. |
mfile, 'S' |
A surface mesh plot of one field component.
The waveguide boundaries are indicated on top of the axis box.
If the mode solver happens to have made the wrong choice of signs for a proper
look of the selected component, you might wish to invert the plot:
insert a minus sign in
the line starting ' minf and maxf at the beginning of the plot section in the m-file.
|
mfile, 'I' |
Intensity plot of one field component.
The field amplitude is indicated by blue scale shading, with the levels
extending linearly from the minimum amplitude (blue) to the maximum field
(white).
In case one is tired of blue,
MATLAB offers several beautiful predefined
colormaps. With 'colormap(blue); ' replaced
by 'colormap(hot) ' and with
'ls = 'w-'; ' substituted for 'ls = 'k-'; '
(boundaries in white), the m-file yields the following output:
Here the colour scaling renders larger regions with small field amplitudes
visible.
A somewhat more objective method, i.e.
plotting the modulus of the field instead of its square
(mfile -argument MOD instead of SQR ),
has a similar effect. The statement 'Mlop_Colour = NO; '
before the mfile command
switches the plot to gray scale levels and white lines for the
permittivity boundaries.
|
fancymfile |
fancy (adj.):
..., bred esp. for bizarre or ornamental qualities that lack
practical utility, ...
(Merriam-Websters Collegiate Dictionary). A lighted surface plot. Black lines at the surface level indicate the dielectric discontinuities: At present, the function accepts no Afo argument. The plot
always depicts the original field component.
|
For a strictly quantitative illustration of mode profiles, one should restrict
the graphics to two dimensional data.
There is one WMM_Mode
member function, which stores mode profile
section data into m-files (see
mode.h, mode.cpp for
the precise definition):
secmfile, 'L' |
With argument 'L', the function evaluates a mode component on equidistant
points on a line segment in the x-y-plane and writes the data to a file
*L.m, together with figure initialization commands, axis annotations,
plot commands, and instructions for illustrating the relevant
dielectric structure. The line segment is to be specified by the
coordinates
(x0 , y0 ) and (x1 , y1 )
of the end points.
If the segment crosses a dielectric boundary, the boundary position enters
the plot.
To indicate other positions or to modify the shading,
edit the variable assignments
below the '% Crossed boundaries ' comment at the beginning
of the output file (nbd , bd , and ri are the
number of boundaries, the positions, and the refractive indices inbetween).
|
secmfile, 'V' |
'V' restricts the output to field data and plot commands. The output
is named *V.m.
These files are intended to add curves to an m-file produced by the 'L' version
of secmfile . The plot command section of the *L.m files (end of the file)
contains the comments
% Include further field section data
Replacing the second line by the (uncommented) base filename of an *V.m file adds the curve to the figure. |
... and vertical lines of the x-y-plane:
rib.cpp writes eight files, which contain mode profile section data.
First the files *h?V.m and *v?V.m were included
into *haL.m or *vaL.m, respectively. To indicate all horizontal
boundaries in the bottom figure, vcsEyvaL.m
was edited to read
% Crossed boundaries
(line 43).
Then invoking the *L scripts in MATLAB resulted in the figures as shown.
nbd = 3;
bd = [0.0 0.5 1.0];
ri = [1.9 2.2 1.5 1.0];
The transverse components
Ex and Ey of the mode profile may be discontinuous
at dielectric boundaries. Therefore, if different media are involved,
the m-files written by secmfile
usually define more than one
curve. While the points in each segment are connected, the segments
are not joined, such that the discontinuities become explicitely
apparent.
At present, secmfile
is retricted to either horizontal
(x0
==x1
) or
vertical (y0
==y1
) profile sections. A profile on a tilted
line must be processed manually, e.g. using the output of the
writesec
function.
wmmarr.h and
wmmarr.cpp define
several procedures for illustrating the interference of WMM_Mode
s.
The functions are members of WMM_ModeArray
s. Confer the section
below for comments on some of the arguments, and the
corresponding section on the preceding page for remarks
on mode interference.
The application mmi.cpp exemplifies the use of the interference visualization procedures. All figures included in this section belong to that program. It simulates the guided wave propagation in a multimode interference (MMI) coupler, here a wide, multimode raised strip waveguide. Semivectorial analysis yields three symmetrical and two antisymmetrical TE modes:
The following functions evaluate superpositions of these fields.
Single waveguide segment:
Initial mode amplitudes are supplied as explicit arguments.
mfile |
The function generates
a plot of the mode interference field versus the position on the
waveguide cross section plane, at a certain propagation distance.
Analogously to mfile for single mode profiles, the last character
argument (one of 'C', 'S', 'I', or 'N') specifies the type of plot,
a contour plot, surface mesh, an intensity image, or the raw MATLAB
data definitions. See the section on mode profile visualization
for comments on the plot types.
In mmi.cpp, After propagating a certain distance, the power concentrates around two focus points (note that the contour levels of the two plots are not comparable): Where appropriate, the figures contain the z-position as an annotation. |
fancymfile |
A lighted surface plot of the interference field over the x-y-plane at a fixed z-position, cf. WMM_Mode.fancymfile. |
movie |
An animated sequence of plots of the two former types, for a specified
number of equidistant z-positions. movie first
generates a separate m-file for each
propagation distance, numbered by the ext? character arguments.
Afterwards the function writes a script *M.m, which collects MATLAB
commands to initialize the single figures, and statements to show them
sequentially afterwards. *M.m stores the
entire sequence of frames in a MATLAB variable 'M'. The command
movie(M, 10)
repeats the animation 10 times. This is what it looks like for the MMI example with 32 frames on a distance of one focusing length (click on the figures for a magnified version): Note that this is a stationary process; time represents the propagation distance z. |
prop |
A plot of the interference pattern in the y-z-plane
ybeg < y < yend ,
zbeg < z < zend at a certain elevation x,
i.e. a top view of the waveguide. The blue or gray scale levels
correspond to the squareroot of the local intensity (Sz).
Now the y-direction is the vertical plot axis;
the propagation distance z extends over the horizontal plot axis.
For the MMI waveguide from above, the |
Three segment couplers:
Overlap integrals determine the initial mode amplitudes.
ioprop |
A function similar to prop , which assumes the
three segment coupler
model. Instead of initial amplitudes, ioprop takes input and output
modes (WMM_Mode s or WMM_ModeArray s, respectively)
as arguments, and computes the mode amplitudes for the central segment
and for the output channel(s) by overlap integrals.
The plot may include the central interference segment as well as the
straight input and output channels, with black lines indicating the
device boundaries.
Depending on the position z, the plot displays the following information:
The function exist in three versions, which differ by their
input arguments. The information about the input respectively output
channels can be supplied either as a single In the case of more than one input or output channel, the model requires spatially well separated input and output ports; coupling between the port waveguides is assumed to be negligible. Note that the model neglects reflections at the waveguide junctions completely. Parts of the electromagnetic fields which are radiated in forward direction do not enter the plot as well (this shows up in small discontinuities in the intensity at the junctions).
Applied to the MMI example, One input port, device length is half the focusing length, two properly spaced output channels, a TE power splitter: Two input waveguides, symmetrical excitation, one centered output channel, constructive interference: Antisymmetrical excitation, destructive interference: Only one input channel of the combiner is excited; about half of the power passes the device: |
Some of the plot output functions listed above take arguments of somewhat exotic types, which may need commenting:
Rect |
A rectangular region, defined in
waveg.h,
waveg.cpp.
The class contains four double values
x0 ,
y0 ,
x1 ,
y1 to fix the lower left and the upper right corners (note the
orientation of the coordinate system). In
the present context, the argument usually specifies a plot window, where
the two accompanying integer values define the numbers of points in
a regular output mesh.
|
Fcomp |
The field component which is to be plotted, one of
EX ,
EY ,
EZ ,
HX ,
HY ,
HZ , or
SZ for the three components of the electric field, the three magnetic
components, and the longitudinal component of the time averaged Poynting
vector, as declared in maxweq.h.
For mode profiles, note the convention of real components,
as explained in the comment on the WMM_Mode.field function.
|
Afo |
An attribute for the field output, declared in
maxweq.h.
Possible values are
MOD: the absolute value,
ORG: the original field,
SQR: the square of the field,
REP: the real part, and
IMP: the imaginary part.
Note that usually not all choices and combinations of Fcomp and Afo
arguments are permitted and/or meaningful.
|
Additionally, in most cases two character arguments
(named ext0
and ext1
)
have to be supplied to fill two identifier places in
the automatically composed
filename
base.