kicad2ems.gfdtd.nf2ff

Near-field to far-field, as openEMS's nf2ff (openEMS.nf2ff): a box of six faces
records E and H in the frequency domain (node-interpolated HDF5 dumps
<name>_E_<n>.h5 / <name>_H_<n>.h5), and CalcNF2FF turns them into the far field
over (theta, phi), written in openEMS's result file and returned as openEMS's
nf2ff_results.

    nf = FDTD.CreateNF2FFBox(frequency=[2.4e9])  # before the run: the faces
                                                 # inside the absorbing
                                                 # boundaries
    FDTD.Run(path)
    r = nf.CalcNF2FF(path, [2.4e9], theta, phi, center=[0, 0, 0])
    r.Dmax, r.Prad, r.E_norm[0]  # (theta, phi) per frequency

The faces carry the equivalent currents J = n x H and M = -n x E (n: outward),
summed with trapezoid weights at the nodes. The far field (e^jwt, r -> inf):

    N = sum J w e^(jk r^.r'),  L = sum M w e^(jk r^.r')
    E_theta = -jk e^-jkr / (4 pi r) (L_phi + eta N_theta),
        E_phi = jk e^-jkr / (4 pi r) (L_theta - eta N_phi)

On a planar face e^(jk r^.r') is a product over its two axes, so each sum is two
matrix products. Mirrors (a PEC or PMC side the box rests on) add the image
currents. P_rad = |E|^2 / (2 eta). Prad is the power through the recorded faces,
1/2 Re sum (E x H*).n w (the images not counted), and Dmax = 4 pi r^2 max(P_rad)
/ Prad, as openEMS's.
kicad2ems.gfdtd.nf2ff.far_field(faces, freq, th, ph, r, center)[source]
[dict(E_theta, E_phi, P_rad (ntheta, nphi), Prad, Dmax)] per
frequency.
class kicad2ems.gfdtd.nf2ff.nf2ff(CSX, name, start, stop, directions=None, mirror=None, frequency=None, **kw)[source]
openEMS's nf2ff recording box: directions (6 bools: xmin, xmax, ...),
mirror (6: 0 off, 1 PEC, 2 PMC), frequency (Hz: frequency-domain recording),
or None: the faces recorded in the time domain (HDF5, every sample step),
any frequency of the run's band then taken by CalcNF2FF (a DFT, as
openEMS's).
CalcNF2FF(sim_path, freq, theta, phi, radius=1, center=(0, 0, 0), outfile=None, read_cached=True, verbose=0)[source]
The far field at radius (m) over theta, phi (degrees), phase centre
`center` (m); written to outfile (in sim_path; default <name>.h5) and
returned as nf2ff_results.
class kicad2ems.gfdtd.nf2ff.nf2ff_results(fn)[source]
openEMS's nf2ff results: theta, phi (rad), r, freq, Dmax, Prad, and per
frequency E_theta, E_phi, E_norm, E_cprh, E_cplh, P_rad (theta, phi).
kicad2ems.gfdtd.nf2ff.write_result(fn, freq, th, ph, r, res)[source]
openEMS's NF2FF result file, in the layout its Octave / Matlab interface
reads (real and imaginary parts, (phi, theta)): openEMS's nf2ff_results and
kicad2ems's antenna.read_sphere both read it.