# 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:

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

confinement

Calculate confinement factor of specified shape.

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

• 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’

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

Adds a label to the data from the current mode set. 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 . Results are saved in the variables shape_NAME_scattering_vertical_edges (total loss from all vertical interfaces), shape_NAME_scattering_horizontal_edges (total loss from all horizontal interfaces), shape_NAME_scattering_sum (total scattering loss), shape_NAME_edges (list of edge points for calculating scattering loss), and shape_NAME_scattering_all_edges (scattering loss from corresponding edges).

 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’

• correlation_length (float or list) – interfacial roughness correlation length, a single value is applied to all interfaces, a list of 2 applies the first value to all vertical interfaces and the second value to all horizontal interfaces, a list the length of edges applies each value to the corresponding edge, default: [100,80]

• roughness_rms (float or list) – interfacial roughness standard deviation in nm rms, a single value is applied to all interfaces, a list of 2 applies the first value to all vertical interfaces and the second value to all horizontal interfaces, a list the length of edges applies each value to the corresponding edge, default: [5,0.5]

• num_slices (int or str) – number of slices to analyze at the interfacial boundary, must be greater than 0, an automatic function scales the number of slices to have at least 1 per 5 nm, default: ‘auto’

• slice_op (str) – operation to apply on interfacial slices to find the field value at the interface, either ‘max’ or ‘mean’, default: ‘max’

• 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’