kicad2ems.fem.elmer.mag¶
Coils with ferrite, with Elmer: the inductance of wound coils and the
coupling between them, beside ferrite plates.
python -m kicad2ems.fem.elmer.mag \
--coil tx:turns=10,inner=10,outer=22,z=0,t=1 \
--coil rx:turns=14,inner=8,outer=16,z=5,t=0.5 \
--plate z=-2.5,t=2.5,size=50x50,mur=2000 --out mag
A coil is a flat ring of winding (mm: inner and outer radius, z of its lower
face, thickness t; x, y of its centre, 0 when not given) that carries its turns'
current spread evenly over its section: litz or fine wire well below its
resonance, not one solid turn. A plate is a ferrite slab (size=AxB or r=RADIUS,
z, t, mur; x, y). Every coil's axis is z. Elmer solves the static field of each
coil alone and of each pair together in an air ball; the inductances come from
the field energy. Writes <out>/mag.json: L (H, the matrix), k, and `air`, the
same coils without ferrite from the ring formulas (air_core below), which no
ferrite run needs but every result can be read against.
from kicad2ems.fem.elmer.mag import solve, air_core
r = solve([dict(name='tx', turns=10, inner=10, outer=22, z=0, t=1)],
[dict(z=-2.5, t=2.5, size=(50, 50), mur=2000)], 'mag')
r['L'][0][0], r['air'][0][0]
With --freq F (R-E21), each coil alone again in the time-harmonic field at F:
its inductance there and its series resistance from the ferrite's loss (a
plate's mur_im, mu''), from the eddy currents of metal plates (sigma=: a shield,
a battery's can, as a surface impedance) and its winding's own (r=, given), and
its Q: `ac` in mag.json.
What is left out: the winding's skin and proximity loss (the turns' current is
spread over the section), the ferrite's saturation, a metal plate thinner than a
few skin depths, and coils drawn as board copper (pcbqs has those in air).
- kicad2ems.fem.elmer.mag.air_core(coils, cells=0.25)[source]¶
The inductance matrix (H) of the coils in air: each coil's section cut into circles about `cells` mm apart, their mutual inductances summed (Maxwell's formula; Neumann's integral between coils off one axis), a circle's own from its cell's geometric mean distance.
- kicad2ems.fem.elmer.mag.mag_model(coils, plates, path, h=None, margin=6.0, log=<built-in function print>, threads=8, grow=0.35, metal=False)[source]¶
The mesh (.msh version 2, mm, ten-node tetrahedra): the coils' rings, the plates and an air ball `margin` times the parts' reach around them. h: mesh size at the coils and plates (None: from their sections); it grows by `grow` of the distance from them. A metal plate (sigma) is a hole in the air whose faces are boundary METAL0 + j with metal=True (the harmonic run's surface impedance), and is left out with metal=False (at DC a non-magnetic metal is transparent). Returns dict(bodies {body: (kind, index)}, metals {boundary: index}, tets, radius, sizes).
- kicad2ems.fem.elmer.mag.sif(m, coils, plates, amps, freq=None)[source]¶
The .sif with coil i carrying amps[i] in each turn: CoilSolver lays the winding's current around each ring, the same density everywhere in it (a wound coil: `Normalize Coil Current`; without it the current crowds to the inner radius as in one solid turn), WhitneyAVSolver solves the static field, the energy goes to scalars.dat. Second-order edge elements on second-order tetrahedra. First-order ones are 2 to 4% low at any mesh this tool would make (a thin winding has one element through it), and second-order ones on a first-order mesh do not converge: the current is made divergence-free on the mesh's nodes, which must then be second-order too. freq (Hz): the time-harmonic field at that frequency instead (WhitneyAVHarmonicSolver; R-E21), the current amps[i] its peak, a ferrite plate at its real mu' (its loss: _ac). A metal plate (sigma) is a hole whose faces are a surface impedance (Layer Electric Conductivity: a skin depth well under its thickness), its loss Elmer's surface current power.
- kicad2ems.fem.elmer.mag.solve(coils, plates=(), out='mag', h=None, margin=6.0, log=<built-in function print>, freq=None)[source]¶
The coils' inductance matrix beside the plates. coils: dicts(name, turns, inner, outer, z, t, x, y, r: the winding's own resistance, ohm, at freq), mm; plates: dicts(z, t, mur, mur_im, sigma, size=(a, b) or r, x, y). Returns the dict written to <out>/mag.json: names, L (H), k, air (the coils without the plates, air_core), tets, seconds; with freq (Hz), `ac`: each coil alone at that frequency (R-E21), dict(name, L, R_ferrite, R_metal, R_winding, R, Q), from the harmonic field: L from its energy, R twice the time-averaged loss of a 1 A peak current.