ModeSolverSemiVectorial

class modesolverpy.mode_solver.ModeSolverSemiVectorial(n_eigs, tol=0.001, boundary='0000', mode_profiles=True, initial_mode_guess=None, semi_vectorial_method='Ex')[source]

Bases: modesolverpy.mode_solver._ModeSolver

A semi-vectorial mode solver object used to setup and run a mode solving simulation.

Parameters:
  • n_eigs (int) – The number of eigen-values to solve for.
  • tol (float) – The precision of the eigen-value/eigen-vector solver. Default is 0.001.
  • boundary (str) – The boundary conditions to use. This is a string that identifies the type of boundary conditions applied. The following options are available: ‘A’ - Hx is antisymmetric, Hy is symmetric, ‘S’ - Hx is symmetric and, Hy is antisymmetric, and ‘0’ - Hx and Hy are zero immediately outside of the boundary. The string identifies all four boundary conditions, in the order: North, south, east, west. For example, boundary=‘000A’. Default is ‘0000’.
  • mode_profiles (bool) – True if the the mode-profiles should be found, `False if only the effective indices should be found.
  • initial_mode_guess (list) – An initial mode guess for the modesolver.
  • semi_vectorial_method (str) – Either ‘Ex’ or ‘Ey’. If ‘Ex’, the mode solver will only find TE modes (horizontally polarised to the simulation window), if ‘Ey’, the mode solver will find TM modes (vertically polarised to the simulation window).

Methods Summary

solve(structure) Find the modes of a given structure.
solve_ng(structure[, wavelength_step, filename]) Solve for the group index, \(n_g\), of a structure at a particular wavelength.
solve_sweep_structure(structures, …[, …]) Find the modes of many structures.
solve_sweep_wavelength(structure, wavelengths) Solve for the effective indices of a fixed structure at different wavelengths.
write_modes_to_file([filename, plot, analyse]) Writes the mode fields to a file and optionally plots them.

Methods Documentation

solve(structure)

Find the modes of a given structure.

Parameters:structure (Structure) – The target structure to solve for modes.
Returns:The ‘n_effs’ key gives the effective indices of the modes. The ‘modes’ key exists of mode profiles were solved for; in this case, it will return arrays of the mode profiles.
Return type:dict
solve_ng(structure, wavelength_step=0.01, filename='ng.dat')

Solve for the group index, \(n_g\), of a structure at a particular wavelength.

Parameters:
  • structure (Structure) – The target structure to solve for modes.
  • wavelength_step (float) – The step to take below and above the nominal wavelength. This is used for approximating the gradient of \(n_\mathrm{eff}\) at the nominal wavelength. Default is 0.01.
  • filename (str) – The nominal filename to use when saving the effective indices. Defaults to ‘ng.dat’.
Returns:

A list of the group indices found for each mode.

Return type:

list

solve_sweep_structure(structures, sweep_param_list, filename='structure_n_effs.dat', plot=True, x_label='Structure number', fraction_mode_list=[])

Find the modes of many structures.

Parameters:
  • structures (list) – A list of Structures to find the modes of.
  • sweep_param_list (list) – A list of the parameter-sweep sweep that was used. This is for plotting purposes only.
  • filename (str) – The nominal filename to use when saving the effective indices. Defaults to ‘structure_n_effs.dat’.
  • plot (bool) – True if plots should be generates, otherwise False. Default is True.
  • x_label (str) – x-axis text to display in the plot.
  • fraction_mode_list (list) – A list of mode indices of the modes that should be included in the TE/TM mode fraction plot. If the list is empty, all modes will be included. The list is empty by default.
Returns:

A list of the effective indices found for each structure.

Return type:

list

solve_sweep_wavelength(structure, wavelengths, filename='wavelength_n_effs.dat', plot=True)

Solve for the effective indices of a fixed structure at different wavelengths.

Parameters:
  • structure (Slabs) – The target structure to solve for modes.
  • wavelengths (list) – A list of wavelengths to sweep over.
  • filename (str) – The nominal filename to use when saving the effective indices. Defaults to ‘wavelength_n_effs.dat’.
  • plot (bool) – True if plots should be generates, otherwise False. Default is True.
Returns:

A list of the effective indices found for each wavelength.

Return type:

list

write_modes_to_file(filename='mode.dat', plot=True, analyse=True)[source]

Writes the mode fields to a file and optionally plots them.

Parameters:
  • filename (str) – The nominal filename to use for the saved data. The suffix will be automatically be changed to identifiy each mode number. Default is ‘mode.dat’
  • plot (bool) – True if plots should be generates, otherwise False. Default is True.
  • analyse (bool) – True if an analysis on the fundamental mode should be performed. The analysis adds to the plot of the fundamental mode the power mode-field diameter (MFD) and marks it on the output, and it marks with a cross the maximum E-field value. Default is True.
Returns:

A dictionary containing the effective indices and mode field profiles (if solved for).

Return type:

dict