kicad2ems.fem.palace.model¶
The board as a Palace model: a tetrahedral gmsh mesh of the dielectric slabs
inside an air box, and the attributes the config refers to (config.py).
mdl = build(board, fmax=10e9, path='model.msh')
# Model: attributes, sizes, counts
Copper is a zero-thickness PEC sheet on each copper layer at its height (cu_z);
a via is a hole through the dielectric whose wall is PEC (its barrel, closed by
the pads it ends on). Lumped ports are rectangles: a 'z' port a vertical sheet
across the trace from the reference copper to the trace, a 'gap' port a sheet in
the copper plane across its gap (board.Port.box). The air box is the board's
extent grown by `margin` on every side, with an absorbing (first-order) boundary
on its faces. Units: mm (the config's L0 = 1e-3).
A lumped part (board.parts) is a sheet across the gap between its pads, in the
copper plane: a 0 ohm part is copper, any other one or more lumped boundaries
the config gives its R, L or C (part_elements: a part with series parasitics is
as many sheets one after another along the gap, one element each, as Palace's
lumped boundary is a parallel R-L-C). Its terminals are copper as wide as the
part, reaching a little way onto each pad (part_lands), so the sheet is fed over
its whole width. An edge wall (board.walls) is a vertical PEC sheet.
Drawn solids (board.solids, resolved into disjoint pieces by core.solids: a
later one over an earlier, over the dielectric unless it encloses the board)
are volumes: a metal one a hole whose faces are PEC, or with conductor loss
the metal's surface impedance (SOLID_METAL; a magnet's SOLID_MAGNET, of its
own conductivity), as a via's barrel; a metal sheet of no thickness a PEC sheet
(SOLID_SHEET); a dielectric one its own attribute (SOLID0 + its place in
board.solids) of its er and tan d, an air one air. The air box is grown round
them too.
Mesh size: `hmin` at the copper edges (a fraction of the smallest feature: the
gap between copper on a layer, a port's width, a slab's thickness), growing with
distance to a fraction of the wavelength at fmax: `hmax` in the slabs (the
densest dielectric's), the free-space one in the air; Palace's second-order
elements carry the field between. The ground does not ask for `hmin` (`planes`):
a ground plane's own edge, a via on a ground net (a hexagonal hole of the
barrel's cross-section, not a cylinder) and an edge wall take the size the mesh
has reached at them, growing from the signal copper, the ports and the parts.
That needs the board's nets (copper_nets, via_nets, ground_nets); a board
without them is meshed at `hmin` along every copper edge.
- class kicad2ems.fem.palace.model.Model(path: str, diel: list, air: int, pec: object, absorb: int, ports: list, hmin: float, hmax: float, margin: float, nodes: int = 0, tets: int = 0, sheets: list = <factory>, via_wall: int = None, edge_wall: int = None, parts: list = <factory>, notes: list = <factory>, solid_metal: int = None, solid_magnet: int = None, solid_sheet: int = None, solids: str = '')[source]¶
- kicad2ems.fem.palace.model.box_faces(gmsh, bb)[source]¶
The surfaces lying on a face of the box bb (x0, y0, z0, x1, y1, z1): the air box's outer faces.
- kicad2ems.fem.palace.model.build(board, fmax, path, margin=None, hmin=None, hmax=None, per_feature=1.0, per_wave=8.0, grade=3.0, log=<built-in function print>, threads=8, planes=True, flat=None)[source]¶
Mesh the board for Palace and write it to `path` (gmsh 2.2, binary). fmax in Hz. planes: the ground planes (ground_planes), the vias on ground nets and the edge walls take the size the mesh has reached at them, growing from the other copper and the ports, instead of `hmin` at their own edges. flat: a slab's elements no wider than this many times its thickness (None: as wide as the sizes above allow).
- kicad2ems.fem.palace.model.feature_size(board)[source]¶
The smallest feature the mesh must resolve, mm: the gap between separate copper on a layer, a port's width, a slab's thickness. (A part's sheets are refined on their own: build.) Every piece's nearest neighbour on its layer, through a tree (R-B21: the first 60 pieces a layer had been compared pair by pair, so a real board's narrowest gap could be any other).
- kicad2ems.fem.palace.model.fragment(occ, ents, tags)[source]¶
occ.fragment of the entities, synchronized: {piece: the roles of the entities it came from} (tags: role -> [(dim, tag)] before the fragment).
- kicad2ems.fem.palace.model.graded(fd, curves, size, far, reach)[source]¶
A Threshold field: `size` at the curves, growing to `far` over `reach` from them (from `size` away).
- kicad2ems.fem.palace.model.ground_planes(board, lay, reach)[source]¶
Which of a layer's copper polygons are ground planes: on a ground net (board.ground_nets) and mostly further than `reach` from their own edge. [bool per polygon]; all False for a board that does not name its nets.
- kicad2ems.fem.palace.model.part_elements(pt)[source]¶
A part's lumped sheets along its gap: [({'R'|'L'|'C': value}, start, stop)], empty for a 0 ohm part (metal). One element: one sheet over the whole gap. Series parasitics (ESR, ESL): the gap in equal lengths, one sheet per element, in series along it (zero-valued ones left out).
- kicad2ems.fem.palace.model.part_lands(board)[source]¶
{layer: [box]}: each part's two terminals, metal as wide as the part reaching a little way onto its pads. Without them the sheet meets a rounded pad only along the flat of its edge and the current crowds there: the demo low-pass's 0402 parts read 30% high in R, L and 1/C.
- kicad2ems.fem.palace.model.simplified(polys, tol)[source]¶
A layer's copper with its outlines straightened by up to `tol` mm (arcs and zone fills drawn in many short segments: each an edge of gmsh's geometry and its fragment; R-B21), topology kept.
- kicad2ems.fem.palace.model.wall_ends(board, axis, c, t0, t1, z0, z1, snap=0.005)[source]¶
An edge wall's ends, each moved to the wall it meets at a corner, or to a corner of the copper it joins (the layers at z0 and z1), when within `snap` mm of one: a wall drawn a hair past either would leave elements that small.