kicad2ems.mom25d.quads¶
mom25d.quads - quadrilateral cells on straight runs, as a constant-divergence
subspace of the RWG basis.
Two triangles that share an edge and together make a near-rectangle (the strips
between the edge rings along a straight trace, the cells of the tensor mesher)
are merged into one quad cell: the current is constrained to have the same
divergence (charge density) on both, which fixes the current across their shared
diagonal from the currents through the quad's four sides. The diagonal stops
being an unknown.
What is left on a quad has the degrees of freedom of a rooftop (one per side,
the charge uniform over the cell) and is still a conforming RWG current, so
nothing downstream changes: the matrix is filled on the triangles as before and
projected, Z_q = T^T Z T, E_q = T^T E, I = T I_q (Galerkin with the merged
functions as both bases and tests). An n x m strip of rectangles split into
triangles has ~3nm edge unknowns; as quads ~2nm: a third fewer, and the LU (N^3)
about 3.4x cheaper on those cells.
T, info = quad_subspace(rwg, n_total, exclude_tris=..., exclude_edges=...,
tol_deg=25)
- kicad2ems.mom25d.quads.excluded(rwg, exclude_tris=(), exclude_edges=())[source]¶
Boolean masks (triangles, edges) of the triangles and edges that must stay as they are.
- kicad2ems.mom25d.quads.project(Z, keep, elim, C)[source]¶
T^T Z T for T = (identity on `keep` in its first len(keep) columns, rows `elim` = C), without forming T: Z (N x N) dense, C (ne x Nr) sparse, Nr >= len(keep) (the columns past len(keep) are combined functions on the eliminated unknowns). Stays in Z's dtype; returns the Nr x Nr matrix (C order). The compiled core reduces Z's rows in place (Z is overwritten) on every thread: the demo transition's 8.3k unknowns in 0.2 s against 1.4 s in NumPy.
- kicad2ems.mom25d.quads.quad_subspace(rwg, n_total, exclude_tris=(), exclude_edges=(), tol_deg=25.0)[source]¶
T (n_total x n_reduced, CSC) mapping the merged unknowns to the RWG (+ via) unknowns, and a dict of counts. Unknowns at index >= rwg.Ne (vias) pass through. exclude_tris: triangles that must stay triangles (via fans: the via's charge is spread over them); exclude_edges: edges that must stay unknowns (port gaps, sample cuts, lumped elements).