Repository navigation
Sommerfeld Ground (GN 2) Fixes
- Three defects in the ground-integration path (#130, @KJ7LNW): feed impedances over a Sommerfeld/Norton ground were wrong by tens to hundreds of ohms and could even go negative on low antennas.
rom2subdivision cap was derived from structure size instead of NEC-2'sNM = 65536constant — small models over ground got the coarsest integration; both copies now terminate on theRX = 1e-4error test.c_ggrid::interpolateguard inverted relative toSUBROUTINE INTRP— interpolation results depended on request order; restored the referencejump-flag form.efldthin-wire displacement usednorm()instead ofnorm2()— the observation point sat at the wrong radius on every thin-wire ground evaluation.- Cross-validated against
nec2c,nec2dx,nec2dxs,xnec2cover 16GN 2decks; an order-dependence sweep found 3657/20301 differing interpolation records before, 0 after.
gshankShanks-tail convergence floor restored after a 200×-looser floor (#131 item 3) caused non-terminating Sommerfeld integrations (endlessROM2 -- STEP SIZE LIMITEDoutput) on wires close to aGN 2ground; output byte-identical to the pre-loosening build.- Sommerfeld near-ground limitation documented: new deck
testharness/data/sommerfeld_near_ground.nec(PRs #137/#141) records the shared NEC-2/SOMNEC limitation in the σ→PEC limit for a dipole 0.02λ above ground — nec2++,nec2cand the original Fortran all deviate from the exactGN 1image-theory result there.
Bug Fixes
nec2diffcompares negative values correctly and exits non-zero when results differ (#138):diff()now normalizes by the larger magnitude (any two negatives no longer compare equal; sign flips report finite values instead ofinf);main()returns 1 on any difference; missing arguments print usage instead of throwing.nec2diffno longer reports spurious radiation-pattern differences: blank SENSE columns (undefined polarization, gain-999.99) no longer shift the remaining columns or read uninitialized memory; all 52 testharness decks now self-compare exactly clean.- EX type-4 current source coincident with an element center now zeroes its rhs rows (#128, @KJ7LNW): stale values in the persistent
current_vectorno longer corrupt the solution (wire currents are antisymmetric about the source plane, as they must be). - Network table lookup fails loudly: a missing source segment throws
NETWORK DATA ERRORinstead of reading out of bounds. GE -1(zero-current) ground mode implemented per NEC-2 Part 3: signed ground modes validate segments that extend below the plane; a non-none connection without aGNcard fails atsimulate()instead of silently running free space.- Tab accepted as a geometry-card field separator (#125), with regression test.
- Geometry overlap checking derived from the final segment arrays; junction nodes classified geometrically (#127): legally connected wires no longer raise false intersection errors; a new
-woption selects the overlap-warning policy. nec_wire::axis_distance()throws on a zero-length wire instead of dividing by zero.- Examples updated to the current
nec_geometry_complete()signature.
Performance
saoa()shares onexl*xlacross all five uses (#131); no heap allocation in the Sommerfeld field hot path (stack work arrays inefld/rom2/sflds/pcint/cmsw/evlua/rom1/gshank)- Triangular solves use Eigen's blocked
solveInPlace; LU factorization is truly in-place on the caller's storage; cached square roots inem::impedance()/em::speed_of_light() - Link-time optimization on by default (
NECPP_ENABLE_LTO), opt-inNECPP_NATIVE_ARCH(-march=native) - Measured on an 8×8 dipole array (1216 segments, 5 frequencies): ~4% faster from the code changes, ~17% total with
NECPP_NATIVE_ARCH=ON; numerical output bit-identical on all 52 testharness decks
Tests
- Wire-order invariance regression for Sommerfeld interpolation:
wire_order_normal.nec/wire_order_reversed.nec, unit test[issue139] tests/data/issue138/fixtures and ctestnecpp_nec2diff_issue138exit-code test- Tab-separated geometry field regression; EX type-4 coincident-patch test; Sommerfeld kernel transcendental unit tests
Full Changelog: v2.3.4...v2.3.5