GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — nec2++ Sommerfeld (gn 2) unreliable for near-ground conductors that don't touch the plane — nec2c/nec2dxs/momwire three-way agreement against it · Issue #15 · stevenmburns/python-necpp

nec2++ Sommerfeld (gn 2) unreliable for near-ground conductors that don't touch the plane — nec2c/nec2dxs/momwire three-way agreement against it #15

New issue
Copy link
New issue
Copy link
Closed
#16
stevenmburns/necpp
#5
stevenmburns/necpp#5
Closed
nec2++ Sommerfeld (gn 2) unreliable for near-ground conductors that don't touch the plane — nec2c/nec2dxs/momwire three-way agreement against it#15
#16
stevenmburns/necpp
#5
Copy link

Description

@stevenmburns
stevenmburns
opened on Jul 20, 2026
Issue body actions

Found via antennaknobs' wild-corpus benchmark (stevenmburns/antennaknobs#448, where the full diagnosis lives) and momwire's golden-capture controls (2026-07-06).

Symptom

On identical geometry, nec2++ (via PyNEC / pynec-accel 1.7.5) gn 2 Sommerfeld solves diverge hard from three agreeing implementations (nec2c, 4nec2's nec2dxs — independent Fortran lineage — and momwire's sinusoidal basis) whenever conductors run within ~0.1λ of the ground plane without touching it:

deck nec2c nec2dxs momwire sin nec2++
300 MHz monopole + 8 radials at 0.002λ (Cebik Tutorial-2 11-4) 32.1−3.5j 32.1−3.5j 32.3−3.5j 9.5−70.9j
dual 1.25λ verticals + low guys, 7.15 MHz 2134−5975j 2054−5957j 2103−6231j 277−5448j

Controls isolating the defect to gn 2 + low height:

  • gn 0 (reflection coefficient) on the identical deck: nec2++ agrees with momwire to <1% — geometry/feed handling is fine.
  • Raising the entire structure +0.2λ: nec2++ gn 2 agrees to <0.5%.
  • Across a 3,146-deck corpus, all 19 decks where nec2++ broke against an agreeing nec2c+momwire pair have near-ground non-grounded conductor (low radial fields, hanging open ends of half-squares/bobtails/slopers, low horizontal runs/beverages — beverages break even when their ends ARE grounded); plain ground-connected verticals are clean.

Also previously measured (momwire capture script, 2026-07-06): the gn 2 solve is order-dependent — the same case solved twice in one process returns different impedances (62.791−2.173j then 62.308−2.532j), and a preceding low solve shifts a later one by ~17 Ω. This suggests state carried across Sommerfeld setups (somnec grid/interpolation state) plus an evaluation defect in the near-interface region, which NEC-2's SOMNEC explicitly supports.

Minimal repro

Half-wave dipole at 0.02λ height, gn 2: nec2++ returns erratic values across similar grounds (572−227j / 216−783j / 78+43j for (εr,σ) = (10,0.002)/(13,0.005)/(3,0.001)) where nec2c varies smoothly (95+32j / 91+30j / 93+31j) and is segment-refinement stable (0.8 Ω at 2×).

Suspect area

The somnec port's evaluation for image distances below/near the interpolation grid's near region, and whatever per-context state persists between Sommerfeld setups.

antennaknobs' PyNECEngine now warns on this geometry class at solve time (antennaknobs PR #473); this issue tracks the actual nec2++ fix.

Activity

  1. stevenmburns commented on Jul 23, 2026

    @stevenmburns
    stevenmburns
    on Jul 23, 2026
    OwnerAuthor
    More actions

    Root cause found and fixed — PR stevenmburns/necpp#5 (base accelerated) awaiting review.

    c_ggrid::interpolate() (NEC-2's INTRP) inverted the original control flow. In NEC-2/nec2c, a point below the current grid region's origin (x < xs || y < ys) sets a jump flag that forces recalculation of the cell coefficients; reuse only ever happens for in-range points landing in the same 4×4 cell. The C++ port did the opposite: in-range points always recalculated (the cache never hit), while out-of-range points tested the reuse condition against indices left over from the previous call — a test that passes almost always (right after any recalculation |ix−ixs| ≤ 1 by construction, and ixeg = −10000 away from grid edges).

    So every downward grid-region crossing evaluated cubic polynomials extrapolated outside their valid cell. The r = 0.2 λ boundary guards the near-field grid exactly where the Sommerfeld fields vary fastest — conductors near the ground that don't touch it have source–observer pairs straddling it constantly, and raising a structure so z+z' ≥ 0.4 λ removes the crossing entirely. That's the whole observed geometry class, including 'heals when raised' and 'beverages break even when grounded'.

    The order dependence is the same state: the cache is thread_local (6d7eaca on accelerated; plain static upstream), so it outlives the solve inside pooled worker threads and could serve coefficients computed against a previous grid — another ground, another frequency, another nec_context. The fix stamps the cache with an (owner, generation) identity refreshed on every sommerfeld() grid fill, so it self-invalidates.

    Validation (dipole @ 0.02 λ, gn 2, three grounds): fixed build matches nec2c to 4 digits (114.70+79.46j / 111.54+74.91j / 108.90+84.54j vs garbage before); 2× refinement stable; gn 0 + elevated controls unchanged; Tutorial-2/11-4 → 32.18−3.28j and 7-2xhalfwldr → 2132.6−5974.9j, matching the three-way references; repeat solves bit-identical under OMP_NUM_THREADS=4.

    An equivalent patch against the upstream-master lineage (per-instance members, no TLS) is on branch fix/sommerfeld-intrp-region-crossing for eventual upstreaming to tmolteno/necpp — the bug exists there too.

    Remaining after merge: bump necpp_src pin here, cut a pynec-accel release, then re-run the antennaknobs corpus and retire the PyNECEngine solve-time warning (antennaknobs#448).

  2. stevenmburns
    closed this as completedin necpp#5on Jul 23, 2026
  3. stevenmburns
    added a commit that references this issue on Jul 23, 2026

    release: pynec-accel 1.7.6 (Sommerfeld gn 2 near-ground fix)

    This issue will close once commit 0d5324a is merged into the 'accelerated' branch.
    0d5324a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402520 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.