qtcad.device.maxwell_eigenmode module

Maxwell eigenmode solver.

class qtcad.device.maxwell_eigenmode.Solver(d: Device, solver_params: SolverParams | None = None, geo_file: str | Path | None = None)

Bases: SolverEigenmode

Finite element solver for finding eigenmodes in cavities by solving Maxwell equations.

Attributes:
  • d (device object) – the device for which modes are to be found. Results are assigned to the corresponding attributes.

  • geo_file (str or Path, optional) – geometry file.

  • See the SolverParams docstring for other attributes.

__init__(d: Device, solver_params: SolverParams | None = None, geo_file: str | Path | None = None)

Constructor of the Solver class (Maxwell eigensolver).

Parameters:
  • d – the device for which modes are to be found. Results are assigned to the corresponding attributes.

  • solver_params – The parameters of the solver. See SolverParams docstring for details.

  • geo_file (string) – path to a raw geometry file (recommended format: .xao) containing the geometry of the problem. If geo_file is None then the solver will be applied to a static mesh. If it is not None, the adaptive solver will be used.

solve()

Solve for eigenvalues of electromagnetic fields in a cavity using Maxwell equations.

Note

  • The field normalization is such that the electric energy equals to 1/2.

  • The frequencies are stored in dvc.maxwell_freqs. The fields are also stored in dvc and can be retreived by calling the corresponding field finding methods such as dvc.e_field.

class qtcad.device.maxwell_eigenmode.SolverParams(inp_dict=None)

Bases: SolverEigenmodeParams

Parameters to pass to the Maxwell eigenmode solver (Solver constructor).

Attributes:
  • num_modes (int) – Number of modes to solve for. Default: 3.

  • tol_rel (float) – the adaptive meshing tolerance on frequency. Default: 0.05.

  • min_freq – the resonant frequencies the solver looks for will be above this value. This is not relevant to “fast” solver.

  • min_converged_iters (int) – how many consecutive iterations are required to give results that agree within the tolerance thresholds (minimum value is 1, meaning that the last result needs to match well with the result computed in the previous interation). Default: 5. Reducing this value should be done with caution, as this could lead to false convergence. Increasing this value gives a more robust convergence criterion but slows down the simulation.

  • min_iters (int) – the solver does not terminate until at least min_iters iterations (refinements) have been completed, even if the values have converged. Default: 0.

  • min_nodes (int) – the solver does not terminate until the refined mesh contains at least min_nodes nodes. Default: 0.

  • output_dir (Path or str, optional) – the directory where output will be stored in adaptive meshing. Default: the current working directory.

  • name – name that can be specified for the device, the test, or solver call. For example it will be used to name files or folders created in adaptive meshing, if applicable. By default, the name of the mesh file for the initial mesh is used.

  • make_subdir (bool) – if True, computation results will be stored in a new subdirectory within output_dir, labeled by the current date and time. Default: False.

  • save_intermediate_results (bool, optional) – when adaptive meshing is used, if True then all intermediate results will be saved at every iteration (for example refined meshes). Otherwise, only convergence files are updated at every iteration and other files are saved only at the end of the solver execution. Default: False.

__init__(inp_dict=None)

Instantiate the SolverParams object.

Parameters:

inp_dict (dict, optional) – Dictionary specifying certain solver parameters to be used instead of their default values.