Skip to content

v2.3.5: Sommerfeld Ground & Near-Ground Fixes

Latest

Choose a tag to compare

@tmolteno tmolteno released this 23 Nov 10:51

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.
    • rom2 subdivision cap was derived from structure size instead of NEC-2's NM = 65536 constant — small models over ground got the coarsest integration; both copies now terminate on the RX = 1e-4 error test.
    • c_ggrid::interpolate guard inverted relative to SUBROUTINE INTRP — interpolation results depended on request order; restored the reference jump-flag form.
    • efld thin-wire displacement used norm() instead of norm2() — the observation point sat at the wrong radius on every thin-wire ground evaluation.
    • Cross-validated against nec2c, nec2dx, nec2dxs, xnec2c over 16 GN 2 decks; an order-dependence sweep found 3657/20301 differing interpolation records before, 0 after.
  • gshank Shanks-tail convergence floor restored after a 200×-looser floor (#131 item 3) caused non-terminating Sommerfeld integrations (endless ROM2 -- STEP SIZE LIMITED output) on wires close to a GN 2 ground; 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++, nec2c and the original Fortran all deviate from the exact GN 1 image-theory result there.

Bug Fixes

  • nec2diff compares 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 of inf); main() returns 1 on any difference; missing arguments print usage instead of throwing.
  • nec2diff no 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_vector no 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 ERROR instead 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 a GN card fails at simulate() 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 -w option 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 one xl*xl across all five uses (#131); no heap allocation in the Sommerfeld field hot path (stack work arrays in efld/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 in em::impedance()/em::speed_of_light()
  • Link-time optimization on by default (NECPP_ENABLE_LTO), opt-in NECPP_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 ctest necpp_nec2diff_issue138 exit-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