# Solver and analysis

FDM

Calculate the waveguide modes using the finite difference method. It automatically runs EM_mesh as needed (generating x, y, x_edge, y_edge, permittivity, and permeability). After solving the mode, the effective index (effective_index), mode propagation loss (loss_dB_per_m), and field components (Fx, Fy, Ex, Ey, Ez, Hx, Hy, Hz, Sx, Sy, Sz) are available, where the fields are normalized to the equation below.

$\frac{1}{2} \mathrm{Re} \iint \left( \vec E \times \vec H^* \right) \! \cdot \! \hat{z} \, \mathrm{d}x \, \mathrm{d}y = 1 \, \mathrm{W}$

It also calculates the TE fraction of each mode (TE_fraction) with the following equation, and it saves the indices of the TE and TM modes (TE_indices and TM_indices).

$\mathrm{{TE_fraction}} = \frac{\iint \left| \vec E_\mathrm{x} \right|^2 \, \mathrm{d}x \, \mathrm{d}y}{\iint \left| \vec E_\mathrm{x} \right|^2 + \left| \vec E_\mathrm{y} \right|^2 \, \mathrm{d}x \, \mathrm{d}y}$
Parameters:
• label (str) – dataset label name to automatically create a dataset after running FDM(), no dataset is created if blank, default: ‘’

• simulation_name (str) – simulation name, default: ‘emode’

sweep

This function sweeps a calculation as a function of any available setting, shape parameter, or section parameter (EMode3D only). Run a parameter sweep of key over defined values by solving solve_type for each value and saving a list of parameters defined by ‘result’ that correspond to the values. After running a sweep, the data will be available from a parameter called sweep_data, which includes all of the specified parameters of this funcion and the data specified by the result parameter.

Parameters:
• key (str) – any settings, shape, or section parameter that will have its value changed in the sweep, directly specify the key for settings parameters, specify ‘shape, SHAPE_NAME, SHAPE_KEY’ to specify shape the SHAPE_KEY of SHAPE_NAME, specify ‘section, SECTION_NAME, SECTION_KEY’ to specify the SECTION_KEY of SECTION_NAME

• values (list or array) – the values that define the key during the sweep

• solve_type (str) – either ‘Mesh’, ‘FDM’, or ‘EME’ to specify which solver to run at each sweep step, default: automatically chosen based on the key and result selection

• result (str or list) – the parameters to save from each iteration of the sweep, default: ‘effective_index’

• label (str) – dataset label to use in the parameter sweep, default: ‘’

• simulation_name (str) – simulation name, default: ‘emode’

confinement

Calculate confinement factor of specified shape. By default, only the area of the shape that is used to define the refractive index profile is included in the confinement factor. For instance, if another shape with a higher priority overlaps the specified shape, the overlapped area is not included.

Parameters:
• shape_list – name (from shape) or list of names of shapes to include in confinement or ‘all’ for all shapes, default: ‘all’

• mode_list (str or list) – desired modes to calculate confinement, ‘all’, ‘TE’, ‘TM’, or a list of the desired mode indices, default: ‘all’

• vertices (list (Nx2)) – list of vertices that define a closed polygon, specifying this parameter will override the shape_list input, default: None

• ignore_priority (bool) – toggle ignoring overlapped shapes with higher priority, default: False

• simulation_name (str) – simulation name, default: ‘emode’

effective_area

Calculate the effective areas for all modes. After running this function, an array called effective_area will become available and report will display the effective areas.

$A_\mathrm{eff} = \frac{\left( \iint \left| \vec E \right|^2 \, \mathrm{d}x \, \mathrm{d}y \right)^2}{\iint \left| \vec E \right|^4 \, \mathrm{d}x \, \mathrm{d}y}$
Parameters:

simulation_name (str) – simulation name, default: ‘emode’

orthogonality

Calculate the highest value of mode overlap between modes in the mode list. After running this function, a variable called maximum_overlap will become available either in the simulation data or in the labeled dataset if specified. Ideally, this value is less than $$10^{-3}$$, indicating an accurate mode list.

Parameters:
• label (str) – dataset label, default: ‘’

• simulation_name (str) – simulation name, default: ‘emode’

group_index

Calculate the group index for all modes. First, group_index runs FDM (if not already run), then it runs FDM a second time with 0.01 % longer wavelength to calculate the group index. After running this function, an array called group_index will become available and report will display the group index.

Parameters:

simulation_name (str) – simulation name, default: ‘emode’

report

Display a simulation report table with information about each mode: mode number; effective index; TE fraction; loss (dB/m); confinement factors (if calculated); effective areas (if calculated).

Parameters:
• save (bool) – whether to save the table to a file or not, default: False

• file_name (str) – name of the file to save, default: ‘mode_report’

• file_type (str) – file type to save, ‘txt’, ‘latex’, or ‘csv’, default: ‘txt’

• simulation_name (str) – simulation name, default: ‘emode’

label

Creates a labeled dataset from the current settings and field data, saved as a Python dictionary or a MATLAB structure array called dataset_LABEL. It can be used to run different simulations and compare the outputs. Also, it is used in conjunction with calc_overlap.

Parameters:
• label (str) – label added to current mode set, default: ‘0’

• simulation_name (str) – simulation name, default: ‘emode’

overlap

Calculate overlap integral between two modes. The result is saved as overlap.

Coldren, Larry A., Scott W. Corzine, and Milan L. Mashanovitch, ‘’Diode lasers and photonic integrated circuits,’’ John Wiley & Sons, 2012.

$\mathrm{overlap} = \frac{4 n_\mathrm{eff,1} n_\mathrm{eff,2}}{(n_\mathrm{eff,1} + n_\mathrm{eff,2})^2} \frac{\left| \iint \vec E_2^* \cdot \vec E_1 \, \mathrm{d}x \, \mathrm{d}y \right|^2}{\iint \left| \vec E_1 \right|^2 \, \mathrm{d}x \, \mathrm{d}y \, \iint \left| \vec E_2 \right|^2 \, \mathrm{d}x \, \mathrm{d}y}$
Parameters:
• label_a (str) – label of first mode set, or a blank string for the current mode set, default: ‘’

• mode_a (int) – mode number from the first mode set, default: 0

• simulation_name_a (str) – simulation name for the first mode set, default: ‘emode’

• label_b (str) – label of second mode set, or a blank string for the current mode set, default: ‘’

• mode_b (int) – mode number from the second mode set, default: 0

• simulation_name_b (str) – simulation name for the second mode set, default: ‘emode’

scattering

Calculates the scattering loss from a specified shape and mode using the Volume Current Method [1]. Results are saved in the variables SHAPE['scattering_vertical_edges'] (total loss from all vertical interfaces), SHAPE['scattering_horizontal_edges'] (total loss from all horizontal interfaces), SHAPE['scattering_sum'] (total scattering loss), SHAPE['edges'] (list of edge points for calculating scattering loss), and SHAPE['scattering_all_edges'] (scattering loss from corresponding edges). The fields are interpolated to the exact edge position along the interface.

[1] T. Barwicz and H. A. Haus, “Three-dimensional analysis of scattering losses due to sidewall roughness in microphotonic waveguides,” J. Lightwave Technol. 23, 2719 (2005).

Parameters:
• shape (str) – name of the shape for calculating the interfacial scattering

• mode_list – mode number, list of mode numbers, or ‘all’, default: ‘all’

• simulation_name (str) – simulation name for the second mode set, default: ‘emode’

plot

Interactive plot for the fields (if available), refractive index, and shapes, or saving a plot. Colorbars are in V/nm for the electric fields, A/nm for the magnetic fields, and W/nm for the Poynting vectors.

Parameters:
• component (str) – field component or index, ‘Ex/y/z’; ‘Hx/y/z’; ‘Sx/y/z’; ‘Index’; ‘Shapes’, default: ‘Ex’

• plot_function (str) – plotting function, ‘real’; ‘imag’; ‘abs’; ‘abs^2’; ‘log’, default: ‘real’

• mode (int) – mode number, default: 0

• aspect_ratio (str or float) – the height:width aspect ratio, ‘norm’ uses the normal aspect ratio of 0.707, ‘real’ uses the real aspect ratio defined by the simulation window, or a float specifies the aspect ratio, default: ‘norm’

• index_outline (bool) – setting index outline, default: True

• text_display (bool) – setting text display, default: True

• mesh_display (bool) – setting mesh display, default: False

• window_display (bool) – setting window display, default: False

• legend (bool) – setting inclusion of a legend on the index and shape plots, default: True

• file_name (str) – if specified, forces the function to save a file with the given parameters and will not display the interactive plot, default: False

• file_type (str) – file type for saving a plot, ‘pdf’ or ‘png’, default: ‘pdf’

• simulation_name (str) – simulation name, default: ‘emode’

material_explorer

Interactive material explorer to plot the refractive indices of all available materials. The default wavelength range in the plot corresponds to the recommended range from the material reference listed below the plot. If wavelengths are specified outside this range, the model will be plotted with a dashed line instead of a solid line. User defined materials are also available.

Parameters:

simulation_name (str) – simulation name, default: ‘emode’

refractive_index

Returns the refractive index from a material name (retrieved from the internal reference list) or from a custom refractive index value. Optionally, the material’s reference (or citation) may be returned.

Parameters:
• material (str or float) – material name or refractive index value; for AlGaAs, the fraction of Al relative to Ga is included in the material name separated by a comma, for example: “AlGaAs, 0.2” for a Al_{0.2}Ga_{0.8}As.

• wavelength (float) – [nm] wavelength, default: 1550

• reference (bool) – additionally return the citation for the material, default: False

Returns:

[n_xx, n_yy, n_zz] or ([n_xx, n_yy, n_zz], reference)

permeability

Returns the relative permeability from a material name (retrieved from the internal reference list) or from a custom permeability value. Optionally, the material’s reference (or citation) may be returned.

Parameters:
• material (str or float) – material name or refractive index value

• wavelength (float) – [nm] wavelength, default: 1550

• reference (bool) – additionally return the citation for the material, default: False

Returns:

[permeability_xx, permeability_yy, permeability_zz] or ([permeability_xx, permeability_yy, permeability_zz], reference)

mesh

Generalized mesh tool for arbitrary shapes on a rectangular grid. This is called internally by FDM if it has not already been called by the user. Generates vertices for each shape (shape_name_vertices), the actual refractive index for each shape (shape_NAME_refractive_index_value), arrays to define the edges (x_edge, y_edge) and center points (x, y) of the mesh grid, and the relative permittivity and permeability matrices (permittivity and permeability).

Parameters:

simulation_name (str) – simulation name, default: ‘emode’