kicad2ems.pcbqs.circuit.fields

The fields over a board while its circuit runs: H from the currents in its
copper, E from the voltages on it.

    python -m kicad2ems.pcbqs.circuit model.json --out result --fields
        # implies --copper
    export(model, summary, copper, out, log)  # engine.run(..., fields=True)
                                              # calls it

For each case, on planes 1 and 5 mm above the top copper (fields.heights_mm),
over the last period:

    H  The copper's port currents of the reported run are taken apart into
       harmonics of the period (the first 16, fields.harmonics; from ngspice's
       own time steps). The solver that gave the circuit its copper model
       (pcbqs.mqs) gives, at each harmonic, the current everywhere in the copper
       for those port currents, and H from that by Biot-Savart. Put back
       together over the period.
    E  Each net's copper is a conductor at its node's voltage, the ground at
       zero. The charge that puts on the copper comes from the board's
       capacitance (the same mesh, with its dielectric), once for a volt on each
       net; E at any instant is those fields weighted by the nets' voltages at
       that instant. Nothing is band-limited here: E has the edges as the
       circuit has them.

What that is, and is not:
    - the copper and its vias only. No part's own field is in it: not an
      inductor's stray field, not the E of a part's body or a heatsink tab above
      the board. Those need a model of each part (docs/circuit.md).
    - quasi-static: the Coulomb E of the charges, without the induced E of
      changing currents (-dA/dt), and no radiation. It is what a near-field
      probe a few millimetres over the board sees, not a far field.
    - the board taken as grounded: its ground copper at zero volts against its
      surroundings. A board that floats has a common-mode voltage on top of this
      that no circuit on the board alone decides.
    - H up to the last harmonic kept: the ringing at the edges (hundreds of MHz)
      is above it, and case['fields'] says what share of the port currents' AC
      was left out.

<case>/exc_fields/: the fields as field dumps a viewer shows (kicad2ems's Viewer
finds <run>/*/exc_*): H and E on each plane over the period, time_samples frames
each (dump_H_top_1mm_td_0000.vtr ...), with dump_info.json (the period's step,
the copper to outline). <case>/fields.npz: x_mm, y_mm, heights_mm, time_s,
H_A_per_m and E_V_per_m (time, x, y, height, 3), their RMS maps with and without
the part that does not change over the period, H's harmonics; <case>/fields.png:
the AC RMS maps over the board's copper (a picture for a page, not the
report's).
kicad2ems.pcbqs.circuit.fields.export(model, summary, copper, out, log=<built-in function print>)[source]
Every case's fields, written beside it; each case of `summary` gets its
'fields' (what was kept, the largest values, the files). The copper's solver
model is made once, its response once for each period.
kicad2ems.pcbqs.circuit.fields.grid(q, s)[source]
The planes' points: x, y (mm, the board's frame) over the meshed region
and a margin, z (mm) above the top copper.
kicad2ems.pcbqs.circuit.fields.harmonics_of(result, labels, period, count)[source]
The complex Fourier coefficients c_n (n = 0..count) of signals over the
last period, from uniform samples: x(t) = c_0 + 2 Re sum c_n exp(2 pi i n t
/ period). (count + 1, signals).
kicad2ems.pcbqs.circuit.fields.picture(path, board, model, case, x, y, H, E, heights)[source]
The AC RMS maps of H and E on each plane (what changes over the period:
the DC current's H and the rails' steady E left out), the board's top copper
and its parts' references drawn over them.
kicad2ems.pcbqs.circuit.fields.unit_fields(model, board, x, y, z, log=<built-in function print>)[source]
E at the planes' points for one volt on each net and none on the others:
({net: E (nx, ny, nh, 3) V/m per V}, {net: its capacitance to everything
else, F}). The copper's charge for those voltages comes from its
coefficients of potential, in the board's dielectric stack.
kicad2ems.pcbqs.circuit.fields.write_copper_loss(folder, q, driven, weights, total_W)[source]
<folder>/copper-loss.npz: each triangle's share of the copper's loss (its
sheet resistance x |J|^2 x its area, summed over the harmonics kept, J at
its centroid), scaled to the run's own copper loss total_W: layer, x_mm,
y_mm, W. pcbqs.thermal heats the board with it (the copper's loss had
reached no thermal map). Its file name.
kicad2ems.pcbqs.circuit.fields.write_dumps(exc, q, board, x, y, z, heights, Ht, Et, period)[source]
H and E (time, x, y, height, 3) over the period as time-domain field
dumps in exc (a viewer's run folder): a plane a height, a frame a sample.
[the dumps' names]
kicad2ems.pcbqs.circuit.fields.write_vtr(path, x, y, z, H)[source]
H on a rectilinear grid (x, y, one z) as a VTK file (ParaView).