qtcad.device.capacitance module
- class qtcad.device.capacitance.Solver(d: Device, signal_conductors: list[str] | dict[str, list[str]], solver_params: SolverParams | None = None, geo_file: str | Path | None = None)
Bases:
Solver
Capacitance solver class.
- Attributes:
d (device object) – The device for which to extract the capacitance.
signal_conductors (list or dictionary) – surfaces of signal conductors.
geo_file (str, Path, or None) – Geometry file (needed if adaptive meshing is used).
See SolverParams docstring for other attributes.
- __init__(d: Device, signal_conductors: list[str] | dict[str, list[str]], solver_params: SolverParams | None = None, geo_file: str | Path | None = None)
Constructor for the Solver class.
- Parameters:
d – Device for which capacitance is to be extracted.
signal_conductors – Option 1: list of Dirichlet boundaries corresponding to each signal conductor.
Option 2: dictionary specifying the signal conductors. The keys in the dictionary are the names to be given to the conductors. The values are the lists of Dirichlet boundaries comprising conductor surfaces.
All Dirichlet boundaries excluded from the signal_conductors are assumed to correspond to the ground conductors.
solver_params – parameters of the capacitance solver. See SolverParams docstring for defaults.
geo_file – required for adaptive meshing. It is the path to the raw geometry file (recommended format: .xao) containing the geometry of the problem. If geo_file is not given, then the capacitance is found using the mesh of the device dvc, and the mesh is static. If geo_file is provided, adaptive meshing will be used, with dvc.mesh as the starting coarse mesh.
- print_cap(cap: dict[tuple[str, str], float], decimals: int = 4)
Prints capacitance matrix in dictionary form.
- Parameters:
cap – the capacitance matrix represented as a dictionary with the keys being pairs of signal nets and values being the corresponding capacitance values.
decimals – how many digits after decimal point to print.
- solve() dict[tuple[str, str], float]
Computes the capacitance matrix for 2D or 3D problems.
- Returns:
Dictionary of capacitance values between the signal nets.
Note
The only boundaries allowed are Dirichlet boundaries with constant potential and natural boundaries.
- to_array(cap: dict[tuple[str, str], float]) ndarray[float]
Convert capacitance in dictionary representation to array.
- Parameters:
cap – the capacitance matrix represented as a dictionary with the keys being pairs of signal nets and values being the corresponding capacitance values.
- class qtcad.device.capacitance.SolverParams(inp_dict=None)
Bases:
SolverParams
Parameters to pass to the capacitance solver.
- Attributes:
tol_rel (float) – relative tolerance (see Note). Default: 0.02.
tol_abs (float) – absolute tolerance (see Note). Default: 0.0.
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: 3. 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.
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.
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.
max_cpus (int) – the largest number of CPUs to use during the solution. Default: the number of logical CPUs available.
save_intermediate_results (bool, optional) – when adaptive meshing is used, if True then refined mesh will be saved at every iteration. Otherwise, only convergence files are updated at every iteration and mesh is saved only at the end of the solver execution. Default: False.
Note
The convergence threshold for each entry of the capacitance matrix \(C_{ij}\) is set as \(\mbox{tol_rel} * |C_{ij}| + \mbox{tol_abs}\). The attribute tol_abs is useful when \(|C_{ij}|\) is expected to be zero or very small.