Solver and analysis

FDM

Calculate the waveguide modes using the finite difference method. It automatically runs EM_mesh as needed (generating x, y, 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:
  • profile (str or int) – profile name to automatically create a profile after running FDM(), default: ‘_default’

  • section (str) – name of an EME section to solve a slice from, instead of the profile’s own settings/shapes, default: None

  • propagation_distance (float) – [nm] optional propagation distance used to compute an additional propagation phase/loss, default: None

  • mode_filter (str) – choose to filter the mode list for propagation direction of ‘forward’, ‘backward’, or ‘none’, default: ‘forward’

  • fLanczos (int) – number of Lanczos vectors used by the eigensolver, default: 5

  • solve_type (str) – either ‘isotropic’, ‘anisotropic’, or ‘auto’ to control whether anisotropic materials are solved with the full tensor or reduced to their isotropic diagonal, default: ‘auto’

  • include_heat (bool) – whether to include heat-related material properties when meshing, default: True

  • scattering (bool) – whether to automatically calculate interfacial scattering loss for all shapes after solving, default: False

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

Note

The direct return value of this function (as called through emodeconnection) is a dict with keys field (a Field object), n_eff_tilde, TE_fraction, TE_indices, and TM_indices. The individual field components and derived quantities described above (effective_index, loss_dB_per_m, Ex/Ey/etc.) become available afterward from the saved profile via get()/get_fields(), not as top-level keys of this return value.

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. The result parameter can include any parameter that is listed in the inspect() output (after running the desired simulation). Additionally, the result parameter can include ‘scattering_loss’ (a sum of all scattering losses for each mode) or ‘mode_order’ (a list of mode indices used for tracking the order of the modes).

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. This can be any value in the eph file. Internally, this calls get, so if you can read the value with get you can collect it with sweep. Additionally, ‘scattering_loss’ and ‘mode_order’ are accepted. default: ‘effective_index’

  • seed (bool) – whether to seed each solve step with the previous step’s mode list, default: True

  • 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. The confinement factors are also returned by this function; for a multi-wavelength profile, the return value is a dict keyed by wavelength.

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

  • 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. The effective_area is also returned by this function and is in units of \(\mu\text{m}^2\); for a multi-wavelength profile, the return value is a dict keyed by wavelength.

\[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} \, \mu\text{m}^2\]
Parameters:
  • profile (str) – profile label, default: ‘_default’

  • 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 in metadata of the labeled (or default) dataset, and the maximum_overlap is returned by this function; for a multi-wavelength profile, the return value is a dict keyed by wavelength. Ideally, this value is less than \(10^{-3}\), indicating an accurate mode list.

Parameters:
  • profile (str or int) – profile label, default: ‘_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. The group_index array is also returned by this function; for a multi-wavelength profile, the return value is a dict keyed by wavelength.

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

  • 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:
  • profile (str) – profile label, default: ‘_default’

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

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

Parameters:
  • name (str) – save the current simulation state to this name, default: ‘0’

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

overlap

Calculate overlap integral between two modes. The result is saved in the profile metadata as overlap and is returned by this function.

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_1 \times \vec H_2 \, \mathrm{d}x \, \mathrm{d}y \right|^2}{\iint \left| \vec E_1 \times \vec H_1 \right| \, \mathrm{d}x \, \mathrm{d}y \, \iint \left| \vec E_2 \times \vec H_2 \right| \, \mathrm{d}x \, \mathrm{d}y}\]
Parameters:
  • profile_a (str or int) – label of first profile, default: ‘_default’

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

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

  • profile_b (str or int) – label of second profile, default: ‘_default’

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

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

mode_order

Calculate mode ordering between two mode lists. The result is returned as a list.

Parameters:
  • profile_a (str or int) – label of first profile, default: ‘’

  • profile_b (str or int) – label of second profile, default: ‘’

  • raw_fields (bool) – use the raw (un-normalized) field data for the ordering comparison instead of the interpolated fields, default: False

  • simulation_name (str) – simulation name, 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.metadata['scattering_vertical_edges'] (total loss from all vertical interfaces), SHAPE.metadata['scattering_horizontal_edges'] (total loss from all horizontal interfaces), SHAPE.metadata['scattering_sum'] (total scattering loss), SHAPE.metadata['edges'] (list of edge points for calculating scattering loss), and SHAPE.metadata['scattering_all_edges'] (scattering loss from corresponding edges). The fields are interpolated to the exact edge position along the interface. The scattering results are also returned by this function as a dictionary keyed by shape name; for a multi-wavelength profile, the return value is a dict keyed by wavelength.

[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:
  • profile (str) – profile label, default: ‘_default’

  • shape (str) – name of the shape for calculating the interfacial scattering, can also be a list of shapes or None (which calculates scattering for all shapes), default: None

  • shapes (str) – alias for shape

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

For EME plots in the ‘z-x’ or ‘z-y’ planes, the data dropdown also offers an ‘Outline’ view that displays a geometry-only outline of the declared sections. Once sections are declared with straight_section(), taper_section(), or gds_section(), calling plot() before running EME() shows only the ‘Outline’ view, which is useful to check the section layout before solving. After EME() has run, ‘Outline’ is available alongside the field components.

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

  • port (int or str) – (EME) input port setting, default: 0

  • plane (str) – (EME) plot cross-section plane setting. For 2D simulations, this defaults to ‘x-y’. For 3D simulations, it accepts ‘x-y’, ‘z-x’, or ‘z-y’, default: ‘z-x’

  • slice_position (float or None) – (EME) location of the third dimension for a cross-section display. For example, if plane is ‘z-x’, then the slice_position refers to the y-position of the cross-section. If None, it reduces the third dimension with the reduction selected in the plot window: ‘sum’ (default), which totals the field across the fixed transverse axis, or ‘mean’, which averages it, default: None

  • forward_only (bool) – (EME) render only the forward-propagating component of the field instead of the total (forward + backward) field; this only changes the display decomposition of the already-solved field, it does not re-solve, default: False

  • resolution (float or str) – (EME) sample spacing in nm along the propagation axis for the ‘z-x’/’z-y’ longitudinal panels, smaller is finer; ‘auto’ picks a spacing of roughly one sample per horizontal display pixel, default: ‘auto’

  • file_name (str) – if specified, forces the function to save a file with the given parameters and will not display the interactive plot, file is saved under a directory called EM_figures, default: None

  • file_type (str) – file type for saving a plot, ‘pdf’ or ‘png’, default: ‘’ (no extension is added to file_name unless a file type is given)

  • 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), a MaterialSpec object, or from a custom refractive index value. Optionally, the material’s reference (or citation) may be returned.

Parameters:
  • material (str) – material name; 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_x, n_y, n_z] or ([n_x, n_y, n_z], 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) – material name

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

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

Returns:

[permeability_x, permeability_y, permeability_z] or ([permeability_x, permeability_y, permeability_z], reference)

permittivity

Returns the relative permittivity from a material name (retrieved from the internal reference list) or from a custom value. For isotropic materials this is a 3-element array; for fully anisotropic materials it is a 3×3 tensor. Optionally, the material’s reference (or citation) may be returned.

Parameters:
  • material (str, float, or list) – material name, or a float/list for a custom value

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

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

Returns:

[eps_x, eps_y, eps_z], a 3×3 array, or the corresponding tuple with reference

d_matrix

Returns the second-order nonlinear d-matrix of a material. Optionally, the material’s reference (or citation) may be returned.

Parameters:
  • material (str) – material name

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

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

Returns:

d-matrix with shape (3, 6), or (d-matrix, 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, the actual refractive index for each shape, arrays to define the center points (x, y) of the mesh grid, and the relative permittivity and permeability matrices (permittivity and permeability).

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

  • run_mesh (bool) – whether to actually run the meshing step now, or just mark the profile as prepared for meshing without running it, default: True

  • verbose (bool) – control the display of the progress bar, default: True

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