Coupling¶
The groundfield.coupling package collects every conductor-to-conductor
and conductor-to-earth coupling relation that the solvers consume.
The structure mirrors the physical decomposition: galvanic coupling
through cluster nodes (handled by the solver builder, no module of
its own), inductive coupling between distributed-conductor segments
(inductance.py, ADR-0004), and the Carson earth-return correction
that adds finite-conductivity effects to the inductive matrix
(carson.py, ADR-0005).
Inductance — Neumann self and mutual integrals (ADR-0004)¶
Implements the Neumann partial-inductance assembly under a perfect-mirror earth assumption. Each pair of distributed-conductor segments contributes a self- or mutual-inductance entry to the branch-impedance block
The thin-wire self-inductance uses Grover 1946 (closed form, plus optional internal-field \(\mu_0/(8\pi)\) contribution for the DC limit). Off-diagonal entries are evaluated by a closed-form parallel-segments fast path or, for arbitrary 3-D geometries, by a 16×16 Gauss–Legendre quadrature of the Neumann double-line integral. The image of every segment in the soil surface contributes one extra Neumann integral against the original — this is the perfect-mirror assumption and the starting point for the Carson refinement.
inductance ¶
Self- and mutual-inductance helpers for distributed conductors.
This module implements the inductance physics described in ADR-0004. It provides three public functions:
- :func:
thin_wire_self_inductance— closed-form self-inductance of a straight thin-wire segment of length \(\ell\) and radius \(a\) (Grover 1946): \(L_\text{self} = (\mu_0\,\ell)/(2\pi) \bigl[\ln(2\ell/a) - 1\bigr]\). - :func:
parallel_segments_mutual— closed-form mutual inductance of two parallel coaxial segments of equal length \(\ell\) at perpendicular distance \(d\). - :func:
neumann_mutual— generic Neumann double-line integral via two-point Gauss–Legendre quadrature, valid for any 3-D segment-pair geometry.
Earth-image contributions are handled by the caller: for a
perfect-mirror earth the caller adds the integral against the
mirror image of the source segment (see
:func:perfect_mirror_self_pair_inductance and the assembly logic
in :func:build_inductance_matrix).
References
- Grover, F. W. (1946). Inductance Calculations: Working Formulas and Tables. Dover (reprint 2004).
- Sunde, E. D. (1968). Earth Conduction Effects in Transmission Systems. Dover, ch. 7.
- Paul, C. R. (2010). Inductance: Loop and Partial. Wiley.
build_carson_correction_matrix ¶
build_carson_correction_matrix(
seg_endpoints: np.ndarray,
wire_radii: np.ndarray,
*,
omega: float,
sigma_earth: float
) -> np.ndarray
Assemble the dense Carson earth-return correction matrix.
Adds the per-segment-pair impedance correction
\(\Delta Z^{(i,j)}_\text{Carson}(\omega)\) described in ADR-0005
on top of the perfect-mirror Neumann inductance matrix. The
output has the same shape as :func:build_inductance_matrix
but is complex and frequency-dependent — it is therefore
rebuilt at every frequency by the solver.
Tiling convention (audit 2026-07-08, WP-C3)
Carson's correction is an infinite-wire, per-unit-length concept. To make the assembled matrix consistent — and, crucially, convergent under mesh refinement — the per-pair entries tile the per-unit-length values without double counting:
- Diagonal
dZ[i, i]: self correction per metre × segment length. Summed over a refined straight wire this reproduces the fullz'_self · ℓexactly, independent of the segment count. - Collinear pairs (same axis, negligible perpendicular offset): zero. The infinite-wire self value on the diagonal already contains the interaction with the rest of the same wire. The historic implementation additionally added a "mutual" term per collinear pair — with the axial midpoint distance misread as Carson's perpendicular wire separation — which made the assembled correction grow roughly linearly with the segment count (measured in the audit: no mesh convergence).
- Near-parallel pairs on distinct axes (
|cosφ| > 0.99): mutual correction per metre at the perpendicular horizontal axis separation, weighted by the axial overlap length of the two segment intervals. Summing over the segments of the other wire recoversz'_mutual · ℓ_iexactly — refinement- invariant. Non-overlapping (e.g. staggered or end-to-end) pairs contribute zero: the long-range log tail is treated as part of the infinite-wire per-metre value, in line with the transmission-line locality of Carson's derivation. - Oblique pairs (
1e-9 < |cosφ| ≤ 0.99): the historic projected geometric-mean heuristic is retained (Carson's derivation only covers parallel wires; oblique pairs are rare in Manhattan-routed networks). Orthogonal pairs contribute zero by symmetry.
Earth-conductivity sign convention
In groundfield the \(z\)-axis points into the soil. A wire
above ground has \(z < 0\) and height = -z > 0. A wire just
below the surface has \(z > 0\) and we use height = z as the
Sunde-equivalent depth (Carson's \(h\)). For the PEN cable at
\(z = 0.6\,\mathrm{m}\) this produces the textbook
"1 m below surface" Carson result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
seg_endpoints
|
ndarray
|
Array of shape |
required |
wire_radii
|
ndarray
|
Per-branch wire radii in metres (currently only used as a
regulariser when two segments would coincide; the Carson
kernel itself does not depend on the radius — that is in
the perfect-mirror \(\ln(2h/a)\) piece, which stays where
it was in :func: |
required |
omega
|
float
|
Angular frequency in rad/s. |
required |
sigma_earth
|
float
|
Earth conductivity in S/m. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dZ |
np.ndarray, shape (M, M), dtype complex
|
Symmetric Carson correction matrix in \(\Omega\). Entry
|
Source code in src/groundfield/coupling/inductance.py
721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 | |
build_inductance_matrix ¶
build_inductance_matrix(
seg_endpoints: np.ndarray,
wire_radii: np.ndarray,
*,
use_image: bool = True
) -> np.ndarray
Assemble the dense partial-inductance matrix over branches.
Vectorised implementation per ADR-0010 Tier 0b. Reproduces
:func:_build_inductance_matrix_loop bit-exactly to floating-
point precision but evaluates the off-diagonal entries one row
at a time in batched NumPy calls — typical networks
(~1000 segments) speed up by 1–2 orders of magnitude.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
seg_endpoints
|
ndarray
|
Array of shape |
required |
wire_radii
|
ndarray
|
Per-branch wire radii in metres, shape |
required |
use_image
|
bool
|
When |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
L |
(ndarray, shape(M, M))
|
Symmetric partial-inductance matrix in H. Entry |
Notes
The legacy loop-based implementation is kept as
:func:_build_inductance_matrix_loop for regression testing.
See :file:tests/test_inductance_vectorised.py for the
bit-exact regression suite.
Source code in src/groundfield/coupling/inductance.py
549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 | |
neumann_mutual ¶
neumann_mutual(
p1_a: np.ndarray,
p2_a: np.ndarray,
p1_b: np.ndarray,
p2_b: np.ndarray,
*,
min_distance: float = 1e-06,
parallel_tol: float = 1e-09
) -> float
Neumann mutual-inductance integral between two straight segments.
Hybrid implementation:
- If the two segments are parallel (or anti-parallel) within
parallel_tol, the closed-form Grover expression in :func:_parallel_filaments_mutualis used — exact, no quadrature error. This fast path covers the bulk of the typical inductance assembly (parallel PEN strands, consecutive sub-segments along the same conductor). - Otherwise the Neumann double integral is evaluated by 16×16 Gauss–Legendre quadrature. Empirically accurate to ≲ 0.05 % across the typical geometry range; see ADR-0004 for the calibration data.
The kernel \(1/r\) is clamped at min_distance to suppress the
integrable singularity for segments that touch — physically the
diagonal uses :func:thin_wire_self_inductance instead, so
this only affects pathological inputs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1_a
|
ndarray
|
Endpoints of segment a as |
required |
p2_a
|
ndarray
|
Endpoints of segment a as |
required |
p1_b
|
ndarray
|
Endpoints of segment b. |
required |
p2_b
|
ndarray
|
Endpoints of segment b. |
required |
min_distance
|
float
|
Numerical floor on \(|r_a - r_b|\) in metres. |
1e-06
|
parallel_tol
|
float
|
Tolerance on \(||\hat{u}_a\cdot\hat{u}_b| - 1|\) that triggers the closed-form fast path. |
1e-09
|
Returns:
| Name | Type | Description |
|---|---|---|
M |
float
|
Partial mutual inductance in H. |
Source code in src/groundfield/coupling/inductance.py
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 | |
parallel_segments_mutual ¶
Closed-form mutual inductance of two parallel coaxial segments.
For two segments of equal length \(\ell\) that share the same axis direction and are placed at perpendicular distance \(d\),
Used both as an internal closed-form fast path (when the segment pair geometry matches the assumption) and as a reference in the test suite.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
length
|
float
|
Segment length \(\ell\) in m (both segments have the same). |
required |
distance
|
float
|
Perpendicular distance \(d\) between the two parallel axes in m. Must be > 0. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
M |
float
|
Partial mutual inductance in H. |
Source code in src/groundfield/coupling/inductance.py
perfect_mirror_self_pair_inductance ¶
Self-inductance contribution of a segment plus its earth image.
For a single segment the partial self-inductance against itself uses the thin-wire formula. The image segment (mirrored at the soil surface) is treated as an external segment whose Neumann integral with the original is added to the total.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p1
|
ndarray
|
Endpoints in metres (with \(z > 0\) pointing into the soil). |
required |
p2
|
ndarray
|
Endpoints in metres (with \(z > 0\) pointing into the soil). |
required |
wire_radius
|
float
|
Wire radius in m (only used for the thin-wire self term). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
L |
float
|
Self-inductance plus image contribution, in henries. |
Source code in src/groundfield/coupling/inductance.py
thin_wire_self_inductance ¶
thin_wire_self_inductance(
length: float,
wire_radius: float,
*,
include_internal: bool = True
) -> float
Closed-form self-inductance of a straight thin-wire segment.
Decomposed into the external Grover 1946 thin-wire term and the internal contribution from the magnetic field inside the conductor (uniform DC current distribution, non-magnetic material):
Adding the internal term reproduces the standard Oeding/Oswald
loop-inductance formula (Gl. 9.13c) when used as the diagonal
contribution of a two-wire loop. For high-frequency studies
where the current flows on the surface only (skin effect at
\(f \gg f_\text{skin}\)), pass include_internal=False and
the external term alone is returned.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
length
|
float
|
Segment length \(\ell\) in metres. |
required |
wire_radius
|
float
|
Wire radius \(a\) in metres. |
required |
include_internal
|
bool
|
|
True
|
Returns:
| Name | Type | Description |
|---|---|---|
L |
float
|
Partial self-inductance in henries. |
Source code in src/groundfield/coupling/inductance.py
Carson earth-return correction (ADR-0005)¶
Adds Carson 1926's finite-conductivity correction \(\Delta Z_\text{Carson}(\omega)\) on top of the perfect-mirror inductance. The branch-impedance block becomes
The correction is evaluated as
with \(D = 2h_i\) (\(\theta = 0\)) for the self contribution and \(D = \sqrt{(h_i+h_j)^2 + d_{ij}^2}\), \(\theta = \arctan(d_{ij}/(h_i+h_j))\) for the mutual contribution. \(\delta(\omega) = \sqrt{2 / (\omega\mu_0\sigma_\text{earth})}\) is the electromagnetic skin depth in soil — the natural length scale at which the perfect-mirror approximation starts to break down.
Three regimes¶
Following Carson 1926 §III the implementation switches between three numerical regimes:
| Regime | Range of \(a\) | Method |
|---|---|---|
| Small | \(a \le 0.25\) | Closed-form leading-term expansion (Carson eqs. 34/35) |
| Intermediate | \(0.25 < a \le 5\) | 64-point Gauss–Legendre quadrature of Carson eq. 29 |
| Asymptotic | \(a > 5\) | Inverse-power expansion (Carson eqs. 36/37) |
Validity and limitations¶
- Homogeneous soil — the Carson series is exact (within the quasi-static / sub-kHz assumption Carson himself states) when \(\sigma_\text{earth}\) is uniform.
- Layered soil — the implementation falls back to
\(\sigma = 1/\rho_1\) of the upper layer with a runtime
UserWarning. For a rigorous result switch tobackend="mom_sommerfeld", which uses the full Pollaczek kernel. - Frequency — derived for \(\omega \ll 1 / \mu_0\sigma\); for typical (sub-kHz, \(\rho_\text{earth} \in [50, 5000]\,\Omega\,\mathrm{m}\)) the assumption is comfortably satisfied.
- Geometry — Carson's derivation assumes parallel wires above a plane homogeneous half-space. Non-parallel segment pairs are handled by projection onto the parallel component (orthogonal components contribute zero by Neumann symmetry).
carson ¶
Carson 1926 correction for the earth-return path.
This module implements the magnetic-image correction described in
ADR-0005. It complements the perfect-mirror Neumann assembly from
ADR-0004 (in :mod:groundfield.coupling.inductance) with the
finite-conductivity contribution that Carson 1926 derived for a
homogeneous, semi-infinite, conductive half-space.
Mathematical background
Carson 1926 (Bell Syst. Tech. J. 5(4)) writes the earth-return correction to the per-unit-length series impedance of a long straight wire above a homogeneous earth as
with the dimensionless Carson parameter
where \(D = 2h_i\) for the self-impedance correction (\(\theta = 0\)) and \(D = \sqrt{(h_i + h_j)^2 + d_{ij}^2}\), \(\theta = \arctan(d_{ij} / (h_i + h_j))\) for the mutual-impedance correction between two parallel wires at heights \(h_i, h_j\) with horizontal separation \(d_{ij}\).
The functions \(P, Q\) are the real and imaginary parts of Carson's infinite integral \(J(p, q)\) (Carson eq. 29, with \(p = a\cos\theta\), \(q = a\sin\theta\)):
Three evaluation regimes
We follow Carson's own discussion in section III of the original paper:
- Small \(a\) (\(a \le 0.25\)) — Carson eqs. 34/35, leading-term form. Closed form, only \(\sin / \cos / \ln\).
- Intermediate \(a\) (\(0.25 < a \le 5\)) — direct numerical quadrature of Carson's \(J(p, q)\) via Gauss–Legendre on a truncated interval. The original Carson 1926 series in that range is technically convergent but its recurrence is numerically delicate; quadrature is robust and converges to machine precision in \(\le 64\) nodes.
- Large \(a\) (\(a > 5\)) — Carson eqs. 36/37, asymptotic expansion in inverse powers of \(a\).
Every regime boundary is smoke-tested for continuity at
\(\le 10^{-6}\) — see :mod:tests.test_carson_coupling.
Implementation notes
- All formulas use SI units throughout. Carson's CGS pre-factor \(4\omega\) becomes \(\omega\mu_0 / \pi\) in SI.
- \(\sigma_\text{earth}\) is an explicit argument; the caller is responsible for selecting the right resistivity (homogeneous \(1/\rho\), or upper-layer \(1/\rho_1\) with a warning).
- \(\omega = 0\) or \(\sigma = 0\) short-circuit to
0+0j: the prefactor \(\omega\mu_0/\pi\) vanishes, so the (logarithmically diverging) \(Q\)-asymptote is harmless. - The complex-depth Deri/Semlyen approximation is provided as an
internal sanity check (:func:
deri_semlyen_correction); it is not the production code path.
References
- Carson, J. R. (1926). Wave propagation in overhead wires with ground return. Bell Syst. Tech. J. 5(4), 539–554.
- Deri, A.; Tevan, G.; Semlyen, A.; Castanheira, A. (1981). The complex ground return plane. IEEE Trans. PAS 100(8), 3686–3693.
- Tleis, N. D. (2008). Power Systems Modelling and Fault Analysis, Newnes, ch. 3.
carson_mutual_correction ¶
carson_mutual_correction(
omega: float,
height_i: float,
height_j: float,
horizontal_distance: float,
sigma_earth: float,
) -> complex
Carson earth-return correction between two parallel horizontal wires.
Evaluates the per-unit-length mutual-impedance correction
with
after Carson eq. 31. The parallel-wire assumption is the same as for ADR-0004's Neumann fast path; for non-parallel segments the caller must split into projection components.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
omega
|
float
|
Angular frequency in rad/s. |
required |
height_i
|
float
|
Heights above earth surface in metres (both positive). |
required |
height_j
|
float
|
Heights above earth surface in metres (both positive). |
required |
horizontal_distance
|
float
|
Horizontal separation \(d\) between the two wires in metres. |
required |
sigma_earth
|
float
|
Earth conductivity in S/m. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Z |
complex
|
Per-unit-length mutual correction in \(\Omega/\text{m}\). |
Source code in src/groundfield/coupling/carson.py
carson_p_q ¶
Evaluate Carson's \(P(a, \theta)\), \(Q(a, \theta)\).
Dispatches to the appropriate regime based on the magnitude of \(a\):
- \(a \le 0.25\): closed-form leading-term expansion (Carson eqs. 34/35).
- \(0.25 < a \le 5\): direct numerical quadrature of Carson's \(J(p, q)\) (Gauss–Legendre for \(\theta \approx 0\), QUADPACK Fourier integrator otherwise — audit 2026-07-08, WP-B2).
- \(a > 5\): asymptotic expansion (Carson eqs. 36/37), except for \(\theta > 1.4\) rad where the expansion degrades and the quadrature path is used instead.
The regimes are continuous at the boundaries to within the tolerances documented in ADR-0005 §5/§6.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
a
|
float
|
Dimensionless Carson parameter \(a = D \sqrt{\omega \mu_0 \sigma_\text{earth}}\). Must be \(\ge 0\). |
required |
theta
|
float
|
Angle of the image-distance vector to the vertical, in radians. \(\theta = 0\) for the self-impedance correction, \(\theta = \arctan(d/(h_i+h_j))\) for the mutual. |
required |
Returns:
| Type | Description |
|---|---|
P, Q : tuple[float, float]
|
Real and imaginary parts of Carson's integral \(J\). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in src/groundfield/coupling/carson.py
carson_parameter ¶
Dimensionless Carson parameter \(a = D \sqrt{\omega\mu_0\sigma}\).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
distance
|
float
|
Geometric distance \(D\) in metres (\(2h\) for self-impedance, \(\sqrt{(h_i+h_j)^2 + d^2}\) for mutual). |
required |
omega
|
float
|
Angular frequency in rad/s. |
required |
sigma_earth
|
float
|
Earth conductivity in S/m. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
a |
float
|
Dimensionless Carson parameter \(a\). |
Source code in src/groundfield/coupling/carson.py
carson_self_correction ¶
Carson earth-return correction for a single horizontal wire.
Evaluates the per-unit-length impedance correction
with \(a_s = 2h\sqrt{\omega\mu_0\sigma_\text{earth}}\) and \(\theta = 0\) (Carson eq. 30, ADR-0005).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
omega
|
float
|
Angular frequency \(\omega = 2\pi f\) in rad/s. |
required |
height
|
float
|
Height of the wire above the earth surface in metres (positive — for buried wires use the Sunde-equivalent height). |
required |
sigma_earth
|
float
|
Earth conductivity in S/m (\(\sigma = 1/\rho\) for a homogeneous earth). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Z |
complex
|
Per-unit-length earth-return correction in \(\Omega/\text{m}\). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in src/groundfield/coupling/carson.py
deri_semlyen_correction ¶
deri_semlyen_correction(
omega: float,
height_i: float,
height_j: float,
horizontal_distance: float,
sigma_earth: float,
) -> complex
Deri/Semlyen 1981 complex-depth approximation.
Replaces the Carson integral by the closed-form expression
with \(D = \sqrt{(h_i - h_j)^2 + d^2}\) the direct distance, \(D' = \sqrt{(h_i + h_j + 2p)^2 + d^2}\) the distance to a complex-depth image, and the complex penetration depth
The Deri/Semlyen approximation is not the production code path. It is provided as an alternative independent estimator that the test suite can compare against the Carson series — agreement within \(\approx 5\,\%\) over the typical parameter range confirms that neither implementation contains a sign or pre-factor bug.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
omega
|
float
|
Same meaning as in :func: |
required |
height_i
|
float
|
Same meaning as in :func: |
required |
height_j
|
float
|
Same meaning as in :func: |
required |
horizontal_distance
|
float
|
Same meaning as in :func: |
required |
sigma_earth
|
float
|
Same meaning as in :func: |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Z |
complex
|
Per-unit-length earth-return correction in \(\Omega/\text{m}\) according to Deri/Semlyen 1981. |
Notes
The "self" version is recovered by setting
height_i = height_j and horizontal_distance = 0: the
direct-distance term degenerates to the wire radius, which the
caller must substitute manually (the formula does not include
a wire-radius regularisation by itself).
Source code in src/groundfield/coupling/carson.py
skin_depth ¶
Electromagnetic skin depth in soil.
Returns \(\delta = \sqrt{2 / (\omega \mu_0 \sigma)}\) in metres. Diverges at \(\omega = 0\) (purely conductive earth- return path); the caller must handle that case by skipping the Carson correction altogether.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
omega
|
float
|
Angular frequency \(\omega = 2\pi f\) in rad/s. |
required |
sigma_earth
|
float
|
Earth conductivity \(\sigma\) in S/m. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
delta |
float
|
Skin depth in metres. |
Source code in src/groundfield/coupling/carson.py
Sommerfeld geometric earth-return Green's function (ADR-0006)¶
The rigorous formulation of the earth-return inductive coupling. Integrates the σ-dependent vector-potential Green's function
over the actual segment-pair geometry, where the reflection coefficient \(\Gamma_\text{mag}\) encodes the homogeneous or layered-earth structure. Reduces to the perfect-mirror case at \(\sigma\to\infty\), to free space at \(\sigma\to 0\), and converges to ADR-0005's per-meter Carson asymptote for long parallel wires over homogeneous earth. Unlike Carson, it correctly handles short wires, non-parallel geometries, and layered earth without approximation (Pollaczek/Wait kernel).
When to use which¶
| Problem class | Recommended option |
|---|---|
| Reference computations, layered earth, mixed wire lengths | "sommerfeld" |
| Long parallel PEN over homogeneous earth, fast scoping | "carson_series" |
| Pure DC studies, perfect-mirror reference | "perfect_mirror" |
sommerfeld_inductance ¶
Geometric Sommerfeld earth-return Green function (ADR-0006).
This module implements the rigorous geometric formulation of the inductive earth-return coupling described in ADR-0006. Compared to ADR-0005's Carson per-meter scaling, it integrates the actual vector-potential Green's function over the segment-pair geometry, which correctly handles short wires, non-parallel arrangements, and layered earth.
Mathematical background
(Rewritten in the 2026-07-08 audit, WP-C1: the historic kernel
1/R + ∫Γ·e^{-λ(z+z')}J0 dropped the in-soil propagation of the
primary term — precisely where the buried-wire earth-return
resistance lives — and applied the soil-side reflection sign to
overhead conductors. The implemented kernel is now the genuine
quasi-static Pollaczek form, dispatched by which side of the soil
surface the two segments are on.)
For a horizontal current element in a conducting half-space (\(z > 0\) soil, \(z < 0\) air, \(\gamma^2 = j\omega\mu_0\sigma_1\), \(u_1 = \sqrt{\lambda^2 + \gamma^2}\)), the quasi-static vector-potential Green's functions are:
Buried source, buried observer (depths \(h, h' > 0\)):
Overhead source and observer (heights \(H, H' > 0\)):
Mixed (buried \(h\), overhead \(H\)):
with the reflection coefficient
- homogeneous earth (Pillar A): \(\Gamma(\lambda) = (u_1 - \lambda)/(u_1 + \lambda)\),
- \(n\)-layer earth (Pillar B): the recursive Wait-style reflection coefficient (Wait 1972 §3, Tleis 2008 §3.5); the \(\lambda/u_1\) weight and the exponents use the top-layer \(u_1\) (the conductors live in layer 1).
The functions in this module return the correction beyond the
ADR-0004 additive perfect-mirror baseline (\(1/R + 1/R'\)), so the
solver assembles Z_b = jω·(L_Neumann+mirror) + ΔZ_Sommerfeld.
The mirror deduplication \(-1/R'\) is carried in closed form; only
the smooth reflected/transmitted remainder is integrated
numerically.
Limit checks (built into the test suite)
- \(\sigma_e\to 0\): every kernel collapses to free space — the correction tends to \(-1/R'\) and exactly cancels the ADR-0004 mirror. (At DC the soil is magnetically transparent: no image.)
- \(\sigma_e\to\infty\), overhead pair: \(-\Gamma \to -1\), the net image becomes the anti-parallel PEC image \(-1/R'\) (Carson's baseline).
- \(\sigma_e\to\infty\), buried pair: \(e^{-\gamma R} \to 0\) — the conductor is screened by the surrounding medium and the total external coupling tends to zero.
- Long parallel buried wires: the per-metre limit reproduces Pollaczek's mutual $\frac{j\omega\mu_0}{2\pi}\bigl[K_0(\gamma d)
- K_0(\gamma D') + J_P\bigr]$, whose low-frequency real part is Carson's \(\omega\mu_0/8\) (with the positive sign — the historic kernel produced \(-\omega\mu_0/8\)).
References
- Stratton, J. A. (1941). Electromagnetic Theory, McGraw-Hill, §9-10 — derivation of the half-space vector potential.
- Sommerfeld, A. (1909). Über die Ausbreitung der Wellen in der drahtlosen Telegraphie. Ann. Phys. 28(4), 665–736.
- Wait, J. R. (1972). Electromagnetic Waves in Stratified Media, Pergamon. Ch. 3.
- Tleis, N. D. (2008). Power Systems Modelling and Fault Analysis, Newnes. Ch. 3.
LayeredEarth
dataclass
¶
Frozen layered-earth configuration for the Sommerfeld kernel.
Attributes:
| Name | Type | Description |
|---|---|---|
rhos |
tuple[float, ...]
|
Resistivities \(\rho_1, \dots, \rho_n\) of the layers in \(\Omega\,\mathrm{m}\). The last entry is the semi-infinite bottom layer. |
thicknesses |
tuple[float, ...]
|
Thicknesses \(h_1, \dots, h_{n-1}\) in metres. The bottom
layer has no thickness (semi-infinite). For
|
Notes
Numerical precision contract. The reflection-coefficient
evaluators (:func:reflection_coefficient_homogeneous,
:func:reflection_coefficient_layered) and every consumer of
this dataclass operate in IEEE-754 double precision (FP64).
Future hardware-accelerated backends (e.g. an MLX path on Apple
silicon) must honour the same precision or the cross-backend
cross-check in
tests/test_layered_green.py::test_cross_backend_precision
will fail. np.complex128 is the default at every entry point
and is preserved through the Sommerfeld quadrature; do not
silently down-cast to FP32 in a derived backend.
build_sommerfeld_correction_matrix ¶
build_sommerfeld_correction_matrix(
seg_endpoints: np.ndarray,
wire_radii: np.ndarray,
*,
omega: float,
earth: LayeredEarth
) -> np.ndarray
Assemble the dense Sommerfeld earth-return correction matrix.
The output is the σ-dependent addition to the perfect-mirror
Neumann inductance matrix from
:func:groundfield.coupling.inductance.build_inductance_matrix.
The two should be added (after multiplying \(L_\text{Neumann}\)
by \(j\omega\)):
.. code-block:: python
Z_b = jω · L_Neumann + dZ_Sommerfeld
For earth.n_layers == 1 this is the homogeneous-earth
Sommerfeld kernel; for n >= 2 the layered Pollaczek-Wait
kernel is used.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
seg_endpoints
|
ndarray
|
Array of shape |
required |
wire_radii
|
ndarray
|
Per-branch wire radii. Currently unused (the radius is
already in the perfect-mirror diagonal handled by
|
required |
omega
|
float
|
Angular frequency in rad/s. |
required |
earth
|
LayeredEarth
|
Layered-earth configuration. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dZ |
np.ndarray, shape (M, M), dtype complex
|
Symmetric Sommerfeld correction matrix in \(\Omega\). |
Source code in src/groundfield/coupling/sommerfeld_inductance.py
earth_return_correction_homogeneous ¶
earth_return_correction_homogeneous(
*,
rho: float,
z_i: float,
z_j: float,
omega: float,
sigma_earth: float
) -> complex
σ-dependent earth-return correction beyond the additive mirror.
Point-kernel form of the buried–buried Pollaczek correction (audit 2026-07-08, WP-C1; see the module docstring):
with \(R = \sqrt{\rho^2 + (z - z')^2}\), \(R' = \sqrt{\rho^2 + (z + z')^2}\). This is the σ-dependent piece to be added to the ADR-0004 result (which carries \(1/R + 1/R'\)): the \(-1/R'\) removes the additive mirror, the attenuated direct term carries the buried-path earth-return resistance, and the \(\lambda/u_1\)-weighted reflection is the genuine soil-side boundary response.
Limit checks:
- \(\sigma_e \to 0\): \(\gamma \to 0\), \(\Gamma \to 0\) — correction \(\to -1/R'\) → cancels the ADR-0004 image, total → free space \(1/R\) (at DC the soil is magnetically transparent: no image). ✓
- \(\sigma_e \to \infty\): \(e^{-\gamma R} \to 0\), \(\lambda/u_1 \to 0\) — correction \(\to -1/R - 1/R'\), total → 0 (buried conductor screened by the surrounding medium). ✓ (The historic kernel instead returned the additive mirror in this limit, which is the electrostatic — not the magnetic — image; see the audit report.)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rho
|
float
|
Horizontal distance between source and field point in m. Must be ≥ 0. |
required |
z_i
|
float
|
Depths (positive into soil) in m. Must be > 0 for the integral to converge; for wires at the surface (Sunde-equivalent depth = 0) use a small regularisation \(z = \max(|\text{depth}|, r)\) where \(r\) is the wire radius. |
required |
z_j
|
float
|
Depths (positive into soil) in m. Must be > 0 for the integral to converge; for wires at the surface (Sunde-equivalent depth = 0) use a small regularisation \(z = \max(|\text{depth}|, r)\) where \(r\) is the wire radius. |
required |
omega
|
float
|
Angular frequency in rad/s. |
required |
sigma_earth
|
float
|
Earth conductivity in S/m. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
correction |
complex
|
The kernel above, dimensionless (the calling
:func: |
Source code in src/groundfield/coupling/sommerfeld_inductance.py
390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 | |
earth_return_correction_layered ¶
earth_return_correction_layered(
*,
rho: float,
z_i: float,
z_j: float,
omega: float,
earth: LayeredEarth
) -> complex
Layered-earth analogue of :func:earth_return_correction_homogeneous.
Uses :func:reflection_coefficient_layered for the reflected
term; the \(\lambda/u_1\) weight, the exponents and the direct
attenuation use the top-layer parameters (conductors live in
layer 1). For earth.n_layers == 1 it short-circuits to the
single-layer formula.
Source code in src/groundfield/coupling/sommerfeld_inductance.py
reflection_coefficient_homogeneous ¶
reflection_coefficient_homogeneous(
lambdas: np.ndarray, *, omega: float, sigma_earth: float
) -> np.ndarray
Magnetic reflection coefficient for a homogeneous half-space.
.. math::
\Gamma_\text{mag}^{(1)}(\lambda) \;=\;
\frac{u_e - \lambda}{u_e + \lambda},
\qquad u_e \;=\; \sqrt{\lambda^2 + j\omega\mu_0\sigma_e}.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lambdas
|
ndarray
|
Spectral variable, shape |
required |
omega
|
float
|
Angular frequency in rad/s. |
required |
sigma_earth
|
float
|
Earth conductivity in S/m. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Gamma |
(ndarray, complex, shape(N_lam))
|
Reflection coefficient at each \(\lambda\). |
Source code in src/groundfield/coupling/sommerfeld_inductance.py
reflection_coefficient_layered ¶
reflection_coefficient_layered(
lambdas: np.ndarray,
*,
omega: float,
earth: LayeredEarth
) -> np.ndarray
Magnetic reflection coefficient for an \(n\)-layer earth.
Implements the recursive Tagg/Sunde-Wait formula
.. math::
\Gamma_k(\lambda) \;=\;
\frac{u_k - u_{k+1} - (u_k + u_{k+1})\,\Gamma_{k+1}\,e^{-2 u_k h_k}}
{u_k + u_{k+1} + (u_k - u_{k+1})\,\Gamma_{k+1}\,e^{-2 u_k h_k}},
starting from \(\Gamma_n = 0\) (semi-infinite bottom layer) and walking up to layer 1. The top-layer reflection is \(\Gamma_\text{mag}^{(n)}(\lambda) = (u_e - \lambda)/(u_e+\lambda)\) with \(u_e \to u_1\) in the homogeneous limit, but for \(n>1\) the recursion modifies \(u_1\) effectively. The formulation below is the standard one in Tleis 2008 §3.5.
For \(n=1\) this collapses to
:func:reflection_coefficient_homogeneous.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lambdas
|
(ndarray, shape(N_lam))
|
|
required |
omega
|
float
|
Angular frequency in rad/s. |
required |
earth
|
LayeredEarth
|
Layered-earth configuration. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Gamma |
(ndarray, complex)
|
|
Source code in src/groundfield/coupling/sommerfeld_inductance.py
sommerfeld_pair_integral_homogeneous ¶
sommerfeld_pair_integral_homogeneous(
p1_a: np.ndarray,
p2_a: np.ndarray,
p1_b: np.ndarray,
p2_b: np.ndarray,
*,
omega: float,
sigma_earth: float
) -> complex
Integrate the σ-dependent magnetic Green function over a segment pair.
Computes
where \(\Delta G_\text{mag}\) is the σ-dependent earth-return
correction beyond the ADR-0004 additive-mirror baseline
(vanishes for σ → 0 together with the mirror; see the module
docstring for the case-dispatched Pollaczek kernels). Used by
:func:build_sommerfeld_correction_matrix.
The integration is 16×16 Gauss–Legendre over the two segment parameterisations. The Sommerfeld inner integral is not re-evaluated at every outer node — the spectral kernel is computed once per segment pair on a shared λ-grid and reused (valid because the segments are assumed approximately horizontal so the depth sum varies negligibly along them; see ADR-0006 numerical notes). The closed-form pieces (mirror deduplication \(-1/R'\); buried–buried direct attenuation \((e^{-\gamma R} - 1)/R\)) are evaluated exactly per outer node.
Returns:
| Name | Type | Description |
|---|---|---|
Z |
complex
|
Per-pair earth-return correction in \(\Omega\) (already includes the \(j\omega\mu_0/(4\pi)\) pre-factor). |
Source code in src/groundfield/coupling/sommerfeld_inductance.py
sommerfeld_pair_integral_layered ¶
sommerfeld_pair_integral_layered(
p1_a: np.ndarray,
p2_a: np.ndarray,
p1_b: np.ndarray,
p2_b: np.ndarray,
*,
omega: float,
earth: LayeredEarth
) -> complex
Layered-earth analogue of :func:sommerfeld_pair_integral_homogeneous.
The reflected term uses the layered reflection coefficient; the \(\lambda/u_1\) weight, the \(e^{-u_1(\cdot)}\) exponents and the buried direct-term attenuation use the top-layer \(u_1\) / \(\gamma_1\) (the conductors live in layer 1 — deeper layers act through the reflection coefficient only).
Source code in src/groundfield/coupling/sommerfeld_inductance.py
Cross-layer Green's function (ADR-0007 Phase B)¶
groundfield.coupling.layered_green solves the two-layer matching
problem for the electric Green's function — used by image_2layer,
mom_sommerfeld, cim, and bem whenever a source / observer pair
straddles the upper-layer interface (driven rods, deep meshes,
foundation electrodes that cross \(z = h_1\)).
Two entry points:
two_layer_spectral_kernel— the kernel \(\widetilde{G}(\lambda; z, z_s)\) in spectral space,two_layer_real_space_kernel— its real-space counterpart \(G(s, z, z_s)\) obtained by Sommerfeld inversion.
Together with the cross-layer-aware self-action factory
(_two_layer_self_kernel_factory) they lift the long-standing
z_max < h_1 precondition for n_layers == 2. For
n_layers >= 3 the layered backends still emit a documented
UserWarning — the n-layer extension is on the roadmap.
layered_green ¶
Cross-layer scalar Green's function for layered soil (ADR-0007).
This module implements the electric (scalar-potential) Green's
function for a 2-layer soil where source and observer can be in
either layer. It complements the existing image-series solver in
:mod:groundfield.solver.image_2layer (which assumes both points in
the upper layer) and the Sommerfeld kernel in
:mod:groundfield.solver.mom_sommerfeld (same restriction).
Mathematical background
For a 2-layer soil with upper-layer resistivity \(\rho_1\) and thickness \(h_1\), lower-layer resistivity \(\rho_2\) semi-infinite, the scalar Green's function for a unit point source at depth \(z_s\) observed at depth \(z\) takes the Hankel-transform form
where the spectral kernel \(\Phi(\lambda, z, z_s)\) is determined by the boundary-value problem
- \(\partial\Phi/\partial z = 0\) at \(z = 0\) (free surface),
- \(\Phi\) continuous at \(z = h_1\),
- \(\sigma_k\,\partial\Phi/\partial z\) continuous at \(z = h_1\).
In each layer \(\Phi\) is a sum of \(e^{\pm\lambda z}\) plus a particular solution \(e^{-\lambda|z-z_s|}/(2\lambda\sigma_k)\) in the layer that contains the source. The four layer-pair cases — \(\Phi_{uu}, \Phi_{ul}, \Phi_{lu}, \Phi_{ll}\) — correspond to the four (source-layer, observer-layer) combinations and are related by reciprocity (\(\Phi_{ul} = \Phi_{lu}\)).
Implementation
The 4×4 boundary-value system is solved numerically once per
\((\lambda, z_s)\) pair (4 unknowns: amplitudes in each layer for
each direction). Per call the cost is dominated by \(J_0\)
evaluation and the linear solve at each \(\lambda\) node — fully
vectorisable with numpy.
The implementation focuses on the 2-layer case
(:class:groundfield.soil.models.TwoLayerSoil); the n-layer
extension follows the same recursion and is deferred to ADR-0007
Phase C.
Limit checks (in the test suite)
- \(\rho_2 = \rho_1\): all four pair kernels reduce to the homogeneous Green's function \(\rho/(4\pi r) + \rho/(4\pi r')\).
- \(\rho_2 \to \infty\) (PEC bottom): for source in upper layer, \(G_{ul} \to 0\) (no penetration into the lower layer); \(G_{uu} \to G_{uu}^{K \to 1}\) — image structure with \(K \to 1\).
- \(\rho_2 \to 0\) (sink): \(G_{uu} \to G_{uu}^{K \to -1}\), spreading resistance drops dramatically.
- Source/observer in upper layer: bit-exact match to the
Tagg/Sunde image series in
:func:
groundfield.solver.image_2layer.solve_image_2layer.
References
- Sunde, E. D. (1968). Earth Conduction Effects in Transmission Systems, Dover, Ch. 3.
- Tagg, G. F. (1964). Earth Resistances, Newnes.
- Wait, J. R. (1972). Electromagnetic Waves in Stratified Media, Pergamon.
two_layer_layered_correction_group ¶
two_layer_layered_correction_group(
s_values: np.ndarray,
z: float,
z_s: float,
*,
rho_1: float,
rho_2: float,
h_1: float,
rho_baseline: float | None = None,
lambda_max_factor: float = 200.0,
n_log: int = 32,
n_lin: int = 96
) -> np.ndarray
Vectorised form of :func:two_layer_layered_correction_real_space.
Evaluates the layered correction for many horizontal distances
at one (z, z_s) pair with a single spectral-amplitude solve:
the amplitudes depend on (λ, z, z_s) only, so the per-pair cost
of the historic scalar loop (one BVP solve per matrix entry —
the dominant cost of the ADR-0007 cross-layer reaction-matrix
assembly after the WP-B1 oscillation-resolved grids) collapses
to one BVP solve per (z, z_s) group plus a J0 contraction.
The shared λ-grid is built for the most demanding radius of the
group: λ_max from the smallest s (near-field content),
oscillation resolution and log-region cap from the largest.
Source code in src/groundfield/coupling/layered_green.py
two_layer_layered_correction_real_space ¶
two_layer_layered_correction_real_space(
s: float,
z: float,
z_s: float,
*,
rho_1: float,
rho_2: float,
h_1: float,
rho_baseline: float | None = None,
lambda_max_factor: float = 200.0,
n_log: int = 32,
n_lin: int = 96
) -> float
Real-space layered correction over the homogeneous-rho_1 baseline.
Computes $$ \Delta G(s, z, z_s) \;=\; G_{\text{2-layer}}(s, z, z_s; \rho_1, \rho_2, h_1) \;-\; G_{\text{homog}}(s, z, z_s; \rho_1) $$ by subtracting the spectral kernels before the Hankel integration. The singular source term \(\rho_1/(2\lambda)\,e^{-\lambda|z-z_s|}\) is identical in both spectral kernels and cancels exactly, leaving a smooth, exponentially decaying integrand. Two big advantages:
- In the homogeneous limit \(\rho_2 = \rho_1\) the spectral difference is identically zero at every \(\lambda\), so the integrator returns 0 to machine precision (no spurious diagonal contribution from finite-Sommerfeld-quadrature error at \(z = z_s\)).
- The kernel difference $(a_1 - a_1^{\text{hom}})e^{\lambda z}
- (b_1 - b_1^{\text{hom}})e^{-\lambda z}$ has no \(1/(2\lambda)\) piece, so the small-\(\lambda\) region is finite and easy to integrate.
The caller adds this correction on top of the homogeneous
potential computed with the existing
:func:groundfield.solver.image._self_corrected_kernel (which
correctly handles the line-self diagonal).
The optional rho_baseline parameter selects which homog
soil to subtract:
None(default): subtract homog with \(\rho_1\). Suitable when the calling solver builds \(\phi_\text{hom}\) uniformly with \(\rho_1\).- explicit float: subtract homog with the given resistivity.
Use
rho_2for source segments in the lower layer when the calling solver matches its \(\phi_\text{hom}\) baseline to the source layer (recommended for production-grade solver, ADR-0007 §"Phase A.1").
Returns 0 in the homogeneous limit by construction; otherwise
a finite real value with the same units as
:func:two_layer_real_space_kernel.
Source code in src/groundfield/coupling/layered_green.py
666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 | |
two_layer_probe_matrix ¶
two_layer_probe_matrix(
probe_points: np.ndarray,
source_points: np.ndarray,
*,
rho_1: float,
rho_2: float,
h_1: float,
min_distance: float = 0.001,
lambda_max_factor: float = 200.0
) -> np.ndarray
Potential matrix phi = G @ I for arbitrary layer combinations.
Returns the (M, N) matrix with G[m, n] = potential at
probe_points[m] per unit current injected at
source_points[n], evaluated with the full two-layer spectral
kernel (:func:two_layer_real_space_kernel). Valid for every
probe/source layer combination — upper–upper, cross-layer and
lower–lower — unlike the Tagg/Sunde uu image series that the
fast paths use (audit 2026-07-08, WP-D1: the uu series applied to
layer-2 points was measured +7 % at z = 7 m and +25 % at z = 12 m
for K = +0.818, h_1 = 5 m).
Cost: one scalar Sommerfeld quadrature per (probe, source) pair — reserve for the sub-blocks that the uu series cannot handle.
Notes
The near-singularity is regularised like the image-series paths:
the horizontal distance is clamped at min_distance whenever
the vertical separation is below min_distance as well.
Cost control: probe/source pairs are grouped by their (z, z_s)
depth combination (rounded to 1 µm). Within a group the kernel is
a smooth, monotone function of the horizontal distance s
alone; groups larger than 24 pairs are evaluated on 24 log-spaced
s-nodes and interpolated (relative error ≲ 1e-4 — far below
the physical validity of the post-processing evaluation), keeping
surface-grid evaluations tractable.
Source code in src/groundfield/coupling/layered_green.py
564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 | |
two_layer_real_space_kernel ¶
two_layer_real_space_kernel(
s: float,
z: float,
z_s: float,
*,
rho_1: float,
rho_2: float,
h_1: float,
lambda_max_factor: float = 200.0,
n_log: int = 32,
n_lin: int = 96
) -> float
Cross-layer real-space scalar Green's function \(\varphi(s, z, z_s)\).
Computes \(\varphi(s, z, z_s) / I = \int_0^\infty
\Phi(\lambda, z, z_s)\,J_0(\lambda s)\,\lambda\,d\lambda\)
for a unit point source at \((0, 0, z_s)\) observed at \((s, 0, z)\).
The result already includes the \(1/(4\pi)\)-style prefactor that
is conventional in the existing mom_sommerfeld kernel
representation.
Numerical strategy: split-grid Sommerfeld quadrature
(logarithmic for small \(\lambda\), uniform-with-Bessel-resolution
for large \(\lambda\)) consistent with
:mod:groundfield.coupling.sommerfeld_inductance (ADR-0006).
For s = 0 (coaxial limit) the kernel diverges logarithmically
when z = z_s; the caller must regularise at the wire radius.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
s
|
float
|
Cylindrical radius in m, \(\ge 0\). |
required |
z
|
float
|
Observer / source depths in m. |
required |
z_s
|
float
|
Observer / source depths in m. |
required |
rho_1
|
float
|
Two-layer soil parameters. |
required |
rho_2
|
float
|
Two-layer soil parameters. |
required |
h_1
|
float
|
Two-layer soil parameters. |
required |
lambda_max_factor
|
float
|
Upper bound of the quadrature, given as a multiple of \(1 / \bar h\) with \(\bar h = \min(h_1, s + z + z_s)\). |
200.0
|
n_log
|
int
|
Number of nodes in the logarithmic / linear part of the quadrature grid. |
32
|
n_lin
|
int
|
Number of nodes in the logarithmic / linear part of the quadrature grid. |
32
|
Returns:
| Name | Type | Description |
|---|---|---|
G |
float
|
Real-space scalar Green's function (dimensionless after dividing by \(\rho\)). |
Source code in src/groundfield/coupling/layered_green.py
two_layer_spectral_kernel ¶
two_layer_spectral_kernel(
lambdas: np.ndarray,
z: float,
z_s: float,
*,
rho_1: float,
rho_2: float,
h_1: float
) -> np.ndarray
Spectral Green's function \(\Phi(\lambda, z, z_s)\).
Returns the value of the spectral kernel at every \(\lambda\)
in lambdas for given source depth \(z_s\) and observer depth
\(z\). Both depths can be in either layer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lambdas
|
ndarray
|
1-D array of spectral variable values, \(\lambda > 0\) in units of m⁻¹. |
required |
z
|
float
|
Observer / source depth in metres (\(z \ge 0\), positive into the soil). |
required |
z_s
|
float
|
Observer / source depth in metres (\(z \ge 0\), positive into the soil). |
required |
rho_1
|
float
|
Resistivities of upper / lower layer in \(\Omega\,\mathrm{m}\). |
required |
rho_2
|
float
|
Resistivities of upper / lower layer in \(\Omega\,\mathrm{m}\). |
required |
h_1
|
float
|
Upper-layer thickness in m. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Phi |
(ndarray, shape(n_lambda))
|
|
Source code in src/groundfield/coupling/layered_green.py
Earth-conductivity / earth-layer resolvers¶
These helpers normalise any soil model to a homogeneous \(\sigma_\text{earth}\) (Carson) or a layered structure (Sommerfeld). They are typically invoked by the engine builders, not by user code.
from groundfield.coupling import (
resolve_earth_conductivity, resolve_earth_layers,
)
sigma = resolve_earth_conductivity(world.soil) # Carson
layers = resolve_earth_layers(world.soil) # Sommerfeld
resolve_earth_conductivity ¶
Resolve earth conductivity \(\sigma_\text{earth}\) from a soil model.
Used by the Carson earth-return correction (ADR-0005) to get a single scalar conductivity from the (potentially layered) soil model. The mapping is:
- :class:
~groundfield.soil.models.HomogeneousSoil→ \(\sigma = 1/\rho\), exact. - :class:
~groundfield.soil.models.TwoLayerSoil→ \(\sigma = 1/\rho_1\) (upper layer), with a runtime warning. - :class:
~groundfield.soil.models.MultiLayerSoil→ \(\sigma = 1/\rho_1\) (top layer), with a runtime warning.
The layered cases are an approximation; ADR-0005 references the
Pollaczek/Sommerfeld kernel (via mom_sommerfeld) as the
rigorous alternative.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
soil
|
Any concrete soil model from
:mod: |
required |
Returns:
| Name | Type | Description |
|---|---|---|
sigma_earth |
float
|
Earth conductivity in S/m. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If the soil model has no resistivity field that can be interpreted as an upper-layer value. |
Source code in src/groundfield/coupling/__init__.py
resolve_earth_layers ¶
Resolve a soil model into a :class:LayeredEarth configuration.
Used by the Sommerfeld earth-return kernel (ADR-0006). Unlike
:func:resolve_earth_conductivity, this preserves the full
layered structure — no warning is emitted, and layered soils
are handled natively by the Pollaczek/Wait kernel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
soil
|
Any concrete soil model from
:mod: |
required |
Returns:
| Type | Description |
|---|---|
LayeredEarth
|
Frozen layered-earth configuration (resistivities and layer
thicknesses) consumable by
:func: |