qtcad.device.poisson module

Non-linear Poisson solver.

class qtcad.device.poisson.Solver(d, solver_params=None, geo_file=None)

Bases: device.core.poisson.Solver

Finite element solver for the non-linear Poisson equation.

Attributes

d (device object) – The device for which to solve Poisson’s equation

__init__(d, solver_params=None, geo_file=None)

Constructor of the solver class.

Parameters
  • d (device object) – Device for which Poisson’s equation must be solved.

  • solver_params – A SolverParams object containing the parameters of the non-linear Poisson solver.

  • geo_file (string) – path to .geo_unrolled file containing the geometry of the problem. If geo_file is None then Poisson’s equation is solved over the mesh saved in d, and the mesh is static. If geo_file is not None, adaptive meshing will be used.

get_error_log()

Returns the maximum errors and their location for each self-consistent iteration.

Returns

ndarray – The maximum errors. ndarray: The location of the maximum errors. The row index corresponds to iterations, the column index to Cartesian coordinates

solve(initialize=True)

Iterates the Poisson solver until a specified convergence criterion is achieved.

Parameters

initialize (bool) – Automatically initialize potential from device properties or not. Default: True.

Returns

bool – Whether or not calculation converged

Note

Modifies self.d.phi, self.d.rho, and self.d.rho_prime.

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

Bases: device.core.poisson.SolverParams

Parameters to pass to a non-linear Poisson solver.

Attributes
  • tol (float) – Tolerance to use in a self-consistent calculation. Default: 1e-5

  • maxiter (int) – Maximum number of iterations in a self-consistent loop. Default: 200.

  • method (str) – The method to use to solve the linear problem at each self-consistent iteration: “direct” or “iterative”. Default: “iterative”.

  • errortype (str) – Type of error to use in a convergence criterion. Relative (‘rel’ or ‘relative’) or absolute (‘abs’ or ‘absolute’). Default: ‘abs’.

  • output_interval (int) – Number of iterations between outputs in a self-consistent loop. Default: 1.

  • verbose (bool) – Verbosity level. Default: True.

  • initial_ref_factor (float between 0 and 1) – The maximal relative error threshold used at every adaptive iteration. Used only for adaptive Poisson solver. Default: 0.1.

  • final_ref_factor (float between 0 and 1) – Factor that relates to the ‘amount of mesh refinement’ that will occur once the solver saturates. The lower the number the more refined the output mesh will be. Used only for adaptive Poisson solver. Default: 0.75.

  • maxiter_adapt (int) – maximal number of iterations permitted before the mesh is adapted. Used only for adaptive Poisson solver. Default: -1, indicating that there is no maximum.

  • dot_region (list of strings and/or lists of tuples or list of 2 – tuples or single string): Regions where we would like to set the maximal value of the characteristic length. If None, no maximal characteristic length will not be set in any region. Used only for adaptive Poisson solver. Default: None.

  • h_dot (float or list of floats) – Maximal value of the characteristic length in each of the regions defined in dot_region. Used only for adaptive Poisson solver. Default: None.

  • max_nodes (int) – Maximal number of nodes permitted for an adaptive iteration to be performed. If the maximum is exceeded no aditional adaptive iterations will take place. Used only for adaptive Poisson solver. Default: 1e6.

  • min_nodes (int) – Minimal number of nodes allowed by the solver. If Poisson solver converges with less nodes, then the initial mesh will be uniformly refined and the adaptive procedure will restart. Used only for adaptive Poisson solver. Default: 1e5.

  • size_map_filename (string) – Path to .pos file containing size map of refined mesh. Used only for adaptive Poisson solver. Default: "size_map.pos".

  • refined_mesh_filename (string) – Path to refined mesh. Used only for adaptive Poisson solver. Default: "refined_mesh.msh2".

__init__(inp_dict=None)

Constructor of the SolverParams class.

Parameters

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