kicad2ems.fem.elmer.layered

The whole board as a layered mesh for Elmer: one triangle mesh of the board's
outline that every layer's copper edges, the vias and the terminals' pads are
lines of, swept through the stack as wedges. Each wedge is copper, a via barrel,
board material or (beside the copper of an outer layer) absent, by where its
triangle lies in that layer.

    m = layered_mesh(board, 'case/mesh', electric={'VHB'},
                     terminals={'Q1': [(layer, polygon)]}, h=0.3)
    m['boundaries']  # {tag: (names, area mm2)}: 1 the exposed faces,
                     # 10.. the terminals' pads (also exposed)
    m['bodies']      # the bodies present: COPPER_E, BARREL_E (of
                     # `electric` nets), COPPER, BARREL, BOARD

No 3D booleans: the copper of real boards (planes with hundreds of holes, on
several layers) breaks them, and all the board's copper matters to where the
heat goes. Shapely does the layout's arithmetic in 2D, on a grid of `grid` mm. A
via is a prism through the layers it joins: of its plating's area with
`plating` (solid copper, each via's own), else of its hole's.
kicad2ems.fem.elmer.layered.layered_mesh(board, folder, electric=(), copper=None, terminals=None, crop=None, h=0.3, hmax=2.0, dz=0.5, tol=0.02, grid=0.005, grade=0.35, plating=None, log=<built-in function print>)[source]
Write Elmer's mesh of the board to `folder`. electric: the nets that
carry current (bodies COPPER_E and BARREL_E, meshed at `h`); copper: the
other nets to keep (None: all); terminals: {name: [(layer, polygon)]}, pads
on the outer layers, each a boundary (pads shared by several names are one
boundary of those names). plating (mm): each barrel a solid copper
cylinder of its plating's cross-section (radius sqrt(r^2 - (r - plating)^2),
m['plating'] says so: its conductance and heat path its own; one copper
fraction for every barrel, from their mean, had put a 0.2 mm drill's 32 %
low and a 0.6 mm one's 87 % high beside each other); None: the drill's
cylinder. Returns the mesh's description (see the module's text) with the
arrays the results are read with.
kicad2ems.fem.elmer.layered.triangulate(region, lines, size, grid, log=<built-in function print>)[source]
Triangles of `region` (a polygon) with the segments of `lines` (noded, on
the grid) as edges. size: (x0, y0, step, array[ny, nx]) of the element size
wanted, mm. Returns (xy [n, 2], triangles [m, 3], counter-clockwise).
kicad2ems.fem.elmer.layered.z_cells(board, dz=0.5)[source]
The stack as cells bottom to top: [(z0, z1, copper layer or None)]. A
copper layer is one cell of its thickness, the board between them cells of
at most `dz` mm.