kicad2ems.pcbqs.mqs_iterative

Compressed MQS (inductance only, capacitance=False): loop currents by GMRES
on the compressed copper inductance.

The dense path projects R and L onto the loop basis C and factors C^T Z C at
each frequency: O(n^2) memory, which stops a 32 GB machine near 12k triangles.
Here Z is applied as products (sparse R and its skin correction exactly, L
through its hierarchical matrix) and C^T Z C is never formed. The preconditioner
inverts C^T D C exactly for a diagonal D (each branch's resistance, self
inductance and part): with the loops' cotree branches carrying the force, that
is one sparse graph-Laplacian solve on the nodes, A D^-1 A^T, factored once per
frequency.

Copper ports (port_matrix) have many right-hand sides (ports x frequencies),
which changes what pays: with few loops the dense loop matrix is built from
compressed products and solved directly (loop_matrices); with face sheets the
common-mode / difference-loop preconditioner replaces the graph one
(mqs_precond.FaceLoops). port_method chooses; model.port_solver ('auto',
'direct', 'iterative') and model.port_preconditioner ('auto', 'graph', 'faces')
override it.
kicad2ems.pcbqs.mqs_iterative.face_pairs(model, Le)[source]
Face sheets: the (2, P) edge pairs (an edge on one face, the same edge on
the other) and their mutual partial inductance, exactly, for the
preconditioners' 2x2 blocks. Empty without face sheets.
kicad2ems.pcbqs.mqs_iterative.loop_matrices(model, log=None)[source]
The dense loop matrices (Rl, Ll) of the compressed model, as the dense
backend's _assemble gives them: C^T R C, and C^T L C from one compressed
product per loop. Kept on the model.
kicad2ems.pcbqs.mqs_iterative.loop_products(model, left, right, chunk=48)[source]
left^T L right as a dense real matrix, for sparse sets of branch currents
left and right (nb, k): the compressed inductance applied to `chunk` columns
of right at a time (its scratch grows with the columns).
kicad2ems.pcbqs.mqs_iterative.port_matrix(model, freqs, log=None)[source]
Copper ports on the compressed backend (mqs_ports.CopperPorts): for each
frequency (0 allowed: DC) the port impedance matrix (P, P) and the branch
currents (nb, P) of a unit current into each port in turn, the others open.
By port_method: the dense loop matrices from compressed products, solved
directly (few loops); or one GMRES per port in lockstep, sharing each
frequency's preconditioner, with no dense loop matrix, so face sheets fit in
memory. Same conventions as the dense extraction: branch = -(the source
loops' currents).
kicad2ems.pcbqs.mqs_iterative.port_method(model, n_freq)[source]
('direct' | 'iterative', 'graph' | 'faces') for the copper ports of a
compressed model at n_freq frequencies (the constants above). 'faces' is
asked for; port_matrix falls back to 'graph' where it does not apply.
kicad2ems.pcbqs.mqs_iterative.solve(model, freqs, amps=None)[source]
MQS.solve for matrix_backend='hierarchical' without capacitance: the same
Result (z, zc) as the dense path.