PyNEC-5 translates the 10 Fortran-90/77 modules of LLNL's
NEC-5 (NECMP) into clean, modular Python/NumPy
files. Global Fortran COMMON blocks are replaced by a
single typed Nec5State dataclass hierarchy, and
Sommerfeld lookup tables are persisted to compressed .npz
caches.
| Fortran Source | Python Module | Key Routines & Role |
|---|---|---|
NECMPMOD.f |
necmpMod.py |
Nec5State container holding
NodeData, ElemData,
BasisFuncData, ZMatData,
GroundParam, PGroundTables,
EhGroundTables, and
CurrentData. |
NECMP.f |
necmpRun.py |
runNec5, applyControlCard,
solveSweep, nfPat,
rdPat. Main control-card interpreter,
frequency sweep driver, near-field grid evaluator, and
far-field gain/polarization integration. |
NEC5GEO.f |
nec5Geo.py |
datagn, wire, arc,
helix, patch, move,
reflc, connect. Parses geometry
cards (GW/GC/GA/GH/SP/SM/SC/GM/GR/GX/GS/PA) and
builds RWG, rooftop, wire, and 1/ρ singular
junction basis functions. |
NECMPFLD.f |
necmpFld.py |
cmSet, potEval,
wPotInt, tPotInt,
rPotInt, neFld,
nhFld, ffld, gFld.
Mixed-potential integral equation (MPIE) matrix fill,
analytic singular/near-singular triangle/rectangle
quadrature, near E/H fields, and far-zone radiation. |
NECMPSOLV.f |
necmpSolver.py |
load, factrs,
solvePs, etmns,
sorVt1, sorPwa,
netWk, curMp,
powerLoss. Impedance loading (LD),
symmetry block LU factorization, excitation RHS,
TL/NT network solver, and branch-to-element
current mapping. |
| Fortran Source | Python Module | Key Routines & Role |
|---|---|---|
SOMLIBPEH.f |
somlibPeh.py |
bessel, hank12,
erfcF, fBarS, rom1,
bc1Cont, bc2Cont,
sadPt, sdlPt. Complex
Bessel/Hankel functions, steepest-descent saddle-point
locators, branch-cut contours, and adaptive Romberg
quadrature. |
SOMGP.f |
somgP.py |
somgPot1, somgPot2,
sipEval, gpEval,
triNtSi1/2, recIntSi1/2.
Michalski scalar and vector potential Sommerfeld integrals
for wires and patches on same or opposite sides of
z = 0, plus 3D cubic table generation and
lookup. |
SOMGEH.f |
somgEh.py |
somFld, somFldH,
geEval, geEvalT,
ghEvalX, sTrInt,
seRecInt, shTriInt,
shRecInt. Cylindrical and spherical Sommerfeld
E/H field integrals and 3D total/branch-cut interpolation
tables for near fields and ground waves. |
GASYP.F |
gasyP.py |
gasyP, gasy1P,
gasy2P, gasy2ZzP,
gasyRhP. Steepest-descent and small-ρ
asymptotic approximations for far-separation potential
Sommerfeld integrals. |
GASYEH.F |
gasyEh.py |
gasyEh, gasy1I,
gasy2I, gasy2Zz,
gasyRh. High-frequency asymptotic expansions
for the 10 E/H Sommerfeld integrals outside the
interpolated table domain. |
| Python Module | Key Routines & Role |
|---|---|
nec5.py |
Command-line interface (nec5), ASCII report
formatter (formatNec5Report), and default
PySide6 GUI launcher. |
config.py & deck.py |
loadConfig, buildEmbeddedDeck,
parseDeck, validateDeck,
previewModel. Parses var val and
card.group.field config files, validates decks,
and computes 3D geometry previews. |
plots.py & nec5Plots.py |
renderNec5Plots,
plotAntennaGeometry,
plotRadiationPattern3d,
plotPolarCuts2d,
plotFrequencySweep. Renders RF current
coloring, patches, sources/loads, 3D patterns, polar cuts,
and VSWR sweeps. |
gui.py |
Nec81Gui / launchGui. Six-tab
PySide6 desktop application with structured card editor, raw
deck editor, 3D geometry preview, background runner, report
viewer, and plot browser. |