Soil¶
Soil models describe the conducting half-space: horizontal layers with
a resistivity \(\rho_i\) in Ω·m and a thickness \(h_i\) in m, below
non-conducting air. Three models share one interface:
HomogeneousSoil(rho=...), TwoLayerSoil(rho_1=..., rho_2=..., h_1=...)
and MultiLayerSoil(layers=[SoilLayer(rho=..., h=...), ...]) with
h=None for the bottom half-space.
Mathematical and physical context¶
Below 1 kHz the soil is a quasi-static conductor. The potential obeys
with \(\varphi\) and the normal current density \(\rho^{-1}\partial_z\varphi\) continuous at every layer interface and \(\varphi \to 0\) at remote earth. For two layers the image-series coefficient is the reflection coefficient
the source is reflected into a series of images spaced \(2h_1\) apart
whose strengths decay like \(K^n\) (slowly for high contrast; the AP1
corner soil \(\rho_1 = 1000\), \(\rho_2 = 30\,\Omega\,\mathrm{m}\) has
\(|K| = 0.94\)). Three or more
layers are solved by quadrature of the layered Green's function
(mom_sommerfeld) or by the experimental fem backend; see
Explanation → Engines.
Validity. Linear, isotropic, horizontally layered soil; the displacement current is neglected against the conduction current. Their ratio is \(\omega\varepsilon_0\varepsilon_r\rho\):
import math
eps_0 = 8.8541878128e-12 # F/m
ratio = {rho: 2 * math.pi * 1e3 * eps_0 * 81 * rho for rho in (100.0, 1e3, 1e4)}
assert ratio[100.0] < 1e-3 and ratio[1e3] < 1e-2 and ratio[1e4] < 5e-2
At 1 kHz and \(\varepsilon_r = 81\) it is \(4.5\cdot10^{-4}\) for
100 Ω·m and \(4.5\cdot10^{-3}\) for 1000 Ω·m; only very resistive rock
(10 kΩ·m) reaches \(4.5\cdot10^{-2}\), a limit of the quasi-static model
itself. No backend reads relative_permittivity; a non-default value
warns with InertConfigurationWarning.
Example¶
import groundfield as gf
homogeneous = gf.HomogeneousSoil(rho=100.0)
two_layer = gf.TwoLayerSoil(rho_1=100.0, rho_2=500.0, h_1=1.0) # 1 m topsoil over rock
three_layer = gf.MultiLayerSoil(
layers=[
gf.SoilLayer(rho=80.0, h=0.5),
gf.SoilLayer(rho=300.0, h=2.0),
gf.SoilLayer(rho=50.0), # bottom half-space: h=None
]
)
K = (two_layer.rho_2 - two_layer.rho_1) / (two_layer.rho_2 + two_layer.rho_1)
assert abs(K - 2 / 3) < 1e-12
assert three_layer.kind == "multi_layer" # discriminator for JSON round trips
Parameters are validated on construction and on assignment: a
resistivity or thickness must be finite and positive. The names
resistivity and thickness of releases up to 0.15.0 still work with a
DeprecationWarning (see Deprecations).
Effective resistivity¶
A groundinsight bus carries one resistivity, its
specific_earth_resistance. The AP1 catalogue of real LV networks
describes a two-layer soil for that purpose by its effective
resistivity, a weighted geometric mean of the two layers,
with \(h_\text{ref} = 10\) m and weights \((w_0, \beta)\) of the electrode
class (presets). The default is the AP1
calibration over all LV networks, \(w_0 = 0.13\), \(\beta = 0.8\): the
weight of the lower layer falls with the thickness of the upper layer,
\(w\) = 0.47, 0.23, 0.13 and 0.054 for \(h_1\) = 2, 5, 10 and 30 m. AP2
gives a bus \(\rho_\text{eff}\), so the rho of a BusType fitted in
layered soil is \(\rho_\text{eff}\) of the soil it was fitted in
(IO and groundinsight).
gf.effective_resistivity(soil) (or with the keywords rho_1, rho_2,
h_1)
- returns \(\rho\) itself for homogeneous soil and for a stack of equal layers, without round-off (the plain formula gives 200.00000000000003 Ω·m for \(\rho_1 = \rho_2 = 200\ \Omega\,\mathrm{m}\), \(h_1 = 10\) m);
- reduces a
MultiLayerSoilto its canonical stack (adjacent layers of equal resistivity merged, as every layered backend does) and raisesValueErrorfor three or more distinct layers; - limits \(w\) to \([0, 1]\), so \(\rho_\text{eff}\) lies between \(\rho_1\) and \(\rho_2\). Without the limit \(w > 1\) for \(h_1 < h_\text{ref}\,w_0^{1/\beta}\) (0.78 m with the default weights, 0.28 … 1.34 m over the presets) and \(\rho_\text{eff}\) leaves the interval (17.9 Ω·m for \(\rho_1 = 100\), \(\rho_2 = 30\ \Omega\,\mathrm{m}\), \(h_1 = 0.5\) m); with the limit such a thin upper layer gives \(\rho_2\);
- is bit-identical, inside the calibration range, to
r1 ** (1 - w) * r2 ** wof the AP1 / AP2 scripts with the same weights.
soil = gf.TwoLayerSoil(rho_1=1000.0, rho_2=30.0, h_1=10.0)
rho_eff = gf.effective_resistivity(soil) # w = w0 = 0.13 at h_1 = 10 m
assert abs(rho_eff - 1000.0**0.87 * 30.0**0.13) < 1e-9 and abs(rho_eff - 633.907) < 1e-3
assert gf.effective_resistivity(gf.HomogeneousSoil(rho=200.0)) == 200.0
assert gf.effective_resistivity(rho_1=200.0, rho_2=200.0, h_1=10.0) == 200.0
assert gf.effective_resistivity(rho_1=100.0, rho_2=30.0, h_1=0.5) == 30.0 # w limited to 1
assert gf.effective_resistivity(soil, w0=0.0) == 1000.0 # w0 = 0: the upper layer
stack = gf.MultiLayerSoil( # two-layer after merging: rho_1 = 100, h_1 = 2 + 3 m
layers=[gf.SoilLayer(rho=100.0, h=2.0), gf.SoilLayer(rho=100.0, h=3.0), gf.SoilLayer(rho=30.0)]
)
assert gf.effective_resistivity(stack) == gf.effective_resistivity(rho_1=100.0, rho_2=30.0, h_1=5.0)
try:
gf.effective_resistivity(three_layer) # 80 / 300 / 50 Ohm m from the example above
except ValueError as error:
print(error) # effective_resistivity: the soil has 3 distinct layers (rho = 80, 300, 50 Ohm m); ...
Presets per electrode class¶
The weights depend on the extent of the earthing system: a compact
electrode in the upper layer sees less of the lower layer than an LV
network with its foundation electrodes. gf.soil.EFFECTIVE_RESISTIVITY_PRESETS
is a read-only mapping from a name to the weights (w0, beta) of one
electrode class, all at \(h_\text{ref} = 10\) m;
gf.effective_resistivity(soil, preset=...) uses them, and an explicit
w0 or beta replaces that weight only.
| Preset | Electrode class | \(w_0\) | \(\beta\) |
|---|---|---|---|
"lv_network" (default) |
all LV networks of the AP1 catalogue (global calibration, the hand-over's method A0) | 0.13 | 0.8 |
"station" |
the station electrode alone: 4 m × 4 m ring with three 4 m rods, no foundation electrodes, purely resistive | 0.06 | 1.3 |
"lv_group_<g>_p<pp>" |
LV network of group \(g\) with \(pp\) % foundation electrodes | table below |
\((w_0, \beta)\) of "lv_group_<g>_p<pp>", fitted per group and
penetration (method A, the values of the group's median network, q50):
| Group | p = 5 % | p = 10 % | p = 20 % | p = 40 % |
|---|---|---|---|---|
| 1 single objects, hamlets | 0.06, 1.1 | 0.04, 1.6 | 0.04, 1.6 | 0.06, 1.3 |
| 2 villages | 0.06, 1.4 | 0.10, 0.9 | 0.16, 0.9 | 0.24, 0.5 |
| 3 large villages, districts | 0.12, 0.9 | 0.16, 0.6 | 0.20, 0.5 | 0.24, 0.4 |
| 4 dense built-up areas | 0.12, 0.8 | 0.18, 0.6 | 0.28, 0.4 | 0.36, 0.3 |
An LV network belongs to a group by its perimeter equivalent
\(n_U = \sum_i U_i / 40\ \mathrm{m}\) (\(U_i\) the perimeter of building
\(i\)) with the thresholds 20, 100 and 250, so "lv_group_2_p10" is a
village with 10 % foundation electrodes.
Provenance. The values are those of the author's AP2 hand-over
(gruppen_bustypes.json and bericht_gruppen.md, generated on
2026-10-20 by gruppenbildung.py from the AP1 catalogue computed with
groundfield 0.14.0). Their calibration range is that of the catalogue:
\(h_1\) = 5 … 30 m, \(\rho_1\) = 30 … 1000 Ω·m, \(\rho_2\) = 30 … 200 Ω·m. They
belong to that catalogue and are re-derived when it is recomputed (the
author re-runs it with groundfield 2026.11). The hand-over's q10 and q90
BusTypes carry weights of their own, which are not presets.
presets = gf.soil.EFFECTIVE_RESISTIVITY_PRESETS
assert presets["lv_network"] == (0.13, 0.8) and presets["station"] == (0.06, 1.3)
soil = gf.TwoLayerSoil(rho_1=100.0, rho_2=30.0, h_1=5.0)
network = gf.effective_resistivity(soil) # "lv_network": w = 0.226
station = gf.effective_resistivity(soil, preset="station") # w = 0.06 * 0.5**-1.3 = 0.148
village = gf.effective_resistivity(soil, preset="lv_group_2_p10") # w = 0.10 * 0.5**-0.9 = 0.187
assert abs(network - 76.1465) < 1e-4 and abs(station - 83.7050) < 1e-4 and abs(village - 79.8780) < 1e-4
assert gf.effective_resistivity(soil, preset="station", beta=0.8) == gf.effective_resistivity(soil, w0=0.06)
try:
gf.effective_resistivity(soil, preset="statoin")
except ValueError as error:
print(error) # effective_resistivity: unknown preset 'statoin'. Did you mean 'station'? ...
A BusType and the bus it is paired with must use the same weights:
fit the BusType of a station over \(\rho_\text{eff}\) with "station"
and give its bus the same \(\rho_\text{eff}\). The exporters record the
preset you name (rho_preset="station", metadata["rho_preset"]), and
evaluate_spec / bustype_from_spec warn when the bus uses another one
(user decision Q39, IO and groundinsight).
Validity. An empirical one-parameter description of a two-layer
soil, calibrated on the AP1 catalogue; outside the calibration range it
is an extrapolation, and a preset belongs to its electrode class. For
the AP1 station (the ring and rods above, at 0.6 m) solved in the 39
soils of the AP1 grid, \(R = c\,\rho_\text{eff}\) with \(c\) from
homogeneous soil misses the field solution by a median of 2.1 % over the
36 two-layer soils and at most 15.7 % with "station", by 5.5 % and
35.9 % with "lv_network" and by 12.4 % and 41.9 % over \(\rho_1\) (rms
5.5, 11.8 and 18.9 %); counting the three homogeneous soils, where the
relation is exact, the median over all 39 soils is 1.8 % with "station"
(5.0 % with "lv_network", 11.9 % over \(\rho_1\)). The LV network presets give an rms error of 5.5 % (group 1) up to 39.9 %
(group 4, 40 %) there. The hand-over quotes a median of 1.7 % and a
maximum of 15.7 % for the station without naming its metric; they appear
to be this error over all 39 soils, computed with the point kernel at
1.5 m segments (the kernel of groundfield up to 0.15.0 and the segment
length of the AP1 pipeline), which gives 1.71 % and 15.69 %. The point
kernel alone changes the 36-soil median by 0.01 percentage points; the
three exact soils lower the median by 0.26 (default engine) to 0.37
points. An independent thin-wire boundary-element solution of the
station (audit D2B) gives the same medians to 0.01 points. For the station
of the IO example (a 2 m ring and a 3 m rod at 0.8 m)
swept over \(\rho_1\) at \(\rho_2 = 100\ \Omega\,\mathrm{m}\), the standard
form fits to 7.5 / 2.9 / 0.6 % over \(\rho_\text{eff}\) with "station",
13.4 / 8.3 / 3.6 % with "lv_network" and 3.9 / 1.9 / 0.6 % over
\(\rho_1\) for \(h_1\) = 5 / 10 / 30 m: at fixed \(\rho_2\) the constant \(k_0\)
absorbs the lower layer, which favours \(\rho_1\), but a bus carries
\(\rho_\text{eff}\). Check max_relative, and calibrate \((w_0, \beta)\)
for systems unlike the hand-over's classes. \(\rho_\text{eff}\) is not
FieldResult.soil_resistivity, which holds \(\rho_1\) of a layered soil.
Penetration depth¶
The earth-return impedance of a cable or an overhead line is commonly written with a complex penetration depth \(p = \sqrt{\rho/(j\omega\mu_0)}\) (Dubanton; Deri et al. 1981): the earth is replaced by a perfectly conducting plane at the depth \(p\), and two parallel wires at the distances \(h_i\), \(h_j\) from the surface and the horizontal distance \(x\) couple by
per metre (the self impedance with \(x\) the wire radius). For a layered
soil, gf.penetration_depth(soil, frequencies) returns per frequency the
depth \(p\) for which these homogeneous formulas reproduce the layered
earth-return impedance, and the equivalent homogeneous resistivity
\(\rho_\text{eq} = j\omega\mu_0 p^2\) with the same depth (complex; its
modulus is the magnetotelluric apparent resistivity). \(p\) is the plane-wave
surface impedance of the stack over \(j\omega\mu_0\) (transmission-line
recursion from the bottom layer up), so \(e^{-2p\lambda}\) agrees with the
layered surface reflection coefficient to second order in the horizontal
wavenumber \(\lambda\). It is exact for homogeneous soil (\(p = 1/\gamma\),
\(\rho_\text{eq} = \rho\)), tends to the layer values for thin and thick top
layers, and the error vanishes at large separations; any number of layers
is accepted.
import groundfield as gf
soil = gf.TwoLayerSoil(rho_1=1000.0, rho_2=30.0, h_1=5.0)
pd = gf.penetration_depth(soil, [50.0, 1000.0])
print(pd.depth) # complex depth p in m, per frequency
print(abs(pd.resistivity)) # apparent resistivity in Ohm m: 30.8 / 33.5
z = pd.mutual_impedance(0.7, 0.7, 10.0) # two cables at 0.7 m, 10 m apart, Ohm/m
hom = gf.penetration_depth(gf.HomogeneousSoil(rho=100.0), [50.0])
assert hom.resistivity[0] == 100.0
Accuracy (stream w3perf; two methods: the exact layered earth-return
integral coupling.sommerfeld_inductance.per_metre_mutual_impedance, any
number of layers, against the formula with the equivalent depth; the
integral is within 6e-8 of the earth-return correction of an independent
reference integral up to 300 m and 7e-7 at 1 km for buried pairs, 4e-8
overhead, audit W3B-08, and agrees with Carson and the two-layer Pollaczek
integral). Over the 39
soils of the AP1 grid (\(\rho_1\) = 30 … 1000, \(\rho_2\) = 30 … 200 Ω·m,
\(h_1\) = 5 / 10 / 30 m), 50 Hz … 1 kHz and separations of 0.1 … 1000 m, the
earth-return correction (Carson's quantity, relative to the perfectly
conducting image) of two wires overhead at 10 m / buried at 0.7 m is
reproduced within a median of 2.2 % and at most 28.4 % / 33.4 %; the same
formula in homogeneous soil, against Carson's and Pollaczek's integrals, has
a median error of 2.4 % and a maximum of 12.3 % / 13.0 %. The homogeneous
depth of \(\rho_1\) is off by a median of 31 % / 23 % (up to 2255 % /
2797 %), that of \(\rho_\text{eff}\) by 27 % / 20 %. The error grows with
the separation and the frequency (overhead: at most 6.3 % up to 10 m,
12.7 % at 100 m and 28.4 % at 300 m at 1 kHz; 3.1 / 4.7 / 6.5 % at 50 Hz)
and is largest for a conductive top layer over a resistive one
(30 over 200 Ω·m, \(h_1\) = 30 m) where \(x\) approaches \(|p|\); it falls again
beyond (the worst soil at 1 kHz: 15 % at 1 km, 0.05 % at 10 km) and slowly
towards low frequency (12.7 % at 1 kHz, 1.4 % at 0.1 Hz for 100 m). The
equivalence of the soils alone — the exact homogeneous integral at the
complex \(\rho_\text{eq}\) against the layered one — is within a median of
0.4 % (at most 26 % / 29 %). Beyond two layers the error is larger
(audit W3B-08; both references agree to 3e-5 %): in 300 / 50 / 2000 Ω·m
(\(h\) = 2 / 20 m) at 1 kHz 8.1 / 8.4 / 14 / 44 % overhead and 5.1 / 7.8 / 16 /
46 % buried at 0.1 / 10 / 100 / 1000 m, in 50 / 500 / 20 / 1000 Ω·m (\(h\) =
2 / 3 / 50 m) 7.2 / 7.6 / 20 / 54 % and 3.9 / 7.0 / 28 / 77 %, at 50 Hz up
to 9 % and 37 %. penetration_depth is a modelling aid for line-impedance
formulas; the solver's earth-return models do not use it.
Frequencies are finite, positive real numbers of at least
numpy.finfo(float).tiny: bool, str and complex values and subnormal
numbers raise ValueError (audit W3B-11). A PenetrationDepth is a value:
its arrays are read-only copies, two results with equal arrays compare
equal and have equal hashes.
API reference¶
soil ¶
Soil models for groundfield.
This subpackage describes the propagation medium "soil": a horizontally stratified half-space below a non-conducting air half-space, described by the layer resistivities \(\rho_i\) (Ω·m) and thicknesses \(h_i\) (m). Below 1 kHz the formulation is quasi-static (conduction currents only), so the resistivities and thicknesses are the only parameters any backend reads. The solver turns them into Green's functions or image-charge coefficients.
Contents
HomogeneousSoil
Uniform half-space with a single resistivity rho.
TwoLayerSoil
Upper layer (rho_1, thickness h_1) over a semi-infinite
lower layer (rho_2).
MultiLayerSoil
Generic multi-layer model with arbitrarily many horizontal layers.
SoilLayer
Single layer (rho, thickness h; h=None for the bottom
half-space) used by MultiLayerSoil.
SoilModel
Discriminated union of all supported soil types (kind).
effective_resistivity
Effective resistivity \(\rho_\text{eff} = \rho_1^{1-w}\rho_2^{w}\) of a
homogeneous or two-layer soil (AP1 calibration): the rho of a
groundinsight bus and of a BusType fitted in layered soil.
EFFECTIVE_RESISTIVITY_PRESETS
Read-only mapping of named weight presets (w0, beta) of
effective_resistivity per electrode class ("lv_network", the
default; "station"; "lv_group_<g>_p<pp>" of the AP2 hand-over).
penetration_depth, PenetrationDepth
Complex penetration depth \(p\) and equivalent resistivity of a soil with
any number of layers, per frequency, for the complex-depth (Dubanton /
Deri) earth-return formulas of cables and overhead lines.
Notes
The two-layer model is the primary case (parameter space: varying
resistivities and layer thicknesses). Names follow the literature
symbols; the pre-2026.11 names resistivity and thickness are
deprecated aliases (see groundfield.soil.models).
EFFECTIVE_RESISTIVITY_PRESETS
module-attribute
¶
EFFECTIVE_RESISTIVITY_PRESETS: Mapping[str, tuple[float, float]] = MappingProxyType({'lv_network': (0.13, 0.8), 'station': (0.06, 1.3), 'lv_group_1_p05': (0.06, 1.1), 'lv_group_1_p10': (0.04, 1.6), 'lv_group_1_p20': (0.04, 1.6), 'lv_group_1_p40': (0.06, 1.3), 'lv_group_2_p05': (0.06, 1.4), 'lv_group_2_p10': (0.1, 0.9), 'lv_group_2_p20': (0.16, 0.9), 'lv_group_2_p40': (0.24, 0.5), 'lv_group_3_p05': (0.12, 0.9), 'lv_group_3_p10': (0.16, 0.6), 'lv_group_3_p20': (0.2, 0.5), 'lv_group_3_p40': (0.24, 0.4), 'lv_group_4_p05': (0.12, 0.8), 'lv_group_4_p10': (0.18, 0.6), 'lv_group_4_p20': (0.28, 0.4), 'lv_group_4_p40': (0.36, 0.3)})
Weight presets name -> (w0, beta) of effective_resistivity().
A read-only mapping; the weights are dimensionless, at
\(h_\text{ref} = 10\) m. "lv_network" (0.13, 0.8) is the default, the
global calibration over all LV networks of the AP1 catalogue (method A0 of
the AP2 hand-over). "station" (0.06, 1.3) is the station electrode
alone: a 4 m × 4 m ring with three 4 m rods, no foundation electrodes,
purely resistive (the hand-over quotes a median error of 1.7 % and a
maximum of 15.7 %; they appear to be the error of \(R = c\,\rho_\text{eff}\)
over all 39 soils of the AP1 grid, the three homogeneous ones at zero,
with the point kernel at 1.5 m segments: 2.1 % median over the 36
two-layer soils with the default engine).
"lv_group_<g>_p<pp>" holds the weights fitted per LV network group
g and penetration pp % of foundation electrodes (method A, the
values of each group's median network, q50):
| group | p = 5 % | p = 10 % | p = 20 % | p = 40 % |
|---|---|---|---|---|
| 1 | 0.06, 1.1 | 0.04, 1.6 | 0.04, 1.6 | 0.06, 1.3 |
| 2 | 0.06, 1.4 | 0.10, 0.9 | 0.16, 0.9 | 0.24, 0.5 |
| 3 | 0.12, 0.9 | 0.16, 0.6 | 0.20, 0.5 | 0.24, 0.4 |
| 4 | 0.12, 0.8 | 0.18, 0.6 | 0.28, 0.4 | 0.36, 0.3 |
The groups are formed by the perimeter equivalent \(n_U = \sum\) building perimeter / 40 m of an LV network, thresholds 20, 100 and 250: 1 single objects and hamlets, 2 villages, 3 large villages and districts, 4 dense built-up areas.
Provenance: the author's AP2 hand-over (gruppen_bustypes.json and
bericht_gruppen.md, generated 2026-10-20 by gruppenbildung.py from
the AP1 catalogue computed with groundfield 0.14.0). Calibration range of
every preset: \(h_1\) = 5 … 30 m, \(\rho_1\) = 30 … 1000 Ω·m,
\(\rho_2\) = 30 … 200 Ω·m. The values belong to that catalogue and are
re-derived when the catalogue is recomputed; the hand-over's q10 and q90
BusTypes carry weights of their own, which are not presets.
SoilModel
module-attribute
¶
SoilModel = Annotated[Union[Annotated[HomogeneousSoil, Tag('homogeneous')], Annotated[TwoLayerSoil, Tag('two_layer')], Annotated[MultiLayerSoil, Tag('multi_layer')]], Discriminator(_soil_kind)]
Union of the soil models, discriminated by kind.
HomogeneousSoil ("homogeneous"), TwoLayerSoil
("two_layer") and MultiLayerSoil ("multi_layer"). The
kind is inferred from the keys when a plain mapping omits it. Used by
World.soil.
HomogeneousSoil ¶
Bases: _SoilBase
Homogeneous soil: a half-space of uniform resistivity.
The potential of a point current source I at depth d is the
source term plus its image above the surface,
\(\varphi = \frac{\rho I}{4\pi}\left(\frac{1}{r} +
\frac{1}{r'}\right)\).
Attributes:
| Name | Type | Description |
|---|---|---|
rho |
float
|
Resistivity \(\rho\) in \(\Omega\,\mathrm{m}\); finite and
positive. Deprecated alias: |
relative_permittivity |
float
|
Relative permittivity \(\varepsilon_r\) (dimensionless). Default 10. Not read by any backend (quasi-static formulation); a non-default value warns. |
resistivity
property
writable
¶
Deprecated alias of rho (Ω·m); removed in 2027.5 at the earliest.
MultiLayerSoil ¶
Bases: _SoilBase
Horizontally stratified soil with an arbitrary number of layers.
layers runs from the surface downwards. Every layer but the last
has a finite thickness h; the last one is the semi-infinite
bottom half-space (h=None). A single-layer stack is a valid,
if roundabout, homogeneous half-space.
Attributes:
| Name | Type | Description |
|---|---|---|
layers |
list[SoilLayer]
|
The layers, top to bottom (at least one). |
PenetrationDepth
dataclass
¶
Complex penetration depth of a soil, per frequency.
A value: the three arrays are read-only copies of the given ones, two
results compare equal when their arrays are equal (==), and a result
is hashable (by its frequency values, so equal results have equal
hashes), so it can key a dictionary or join a set (audit W3B-11). A
result built directly is validated as penetration_depth() builds
it: finite, positive frequencies, no NaN in the depth or the resistivity
(audit W3R2B-05: f = +0.0 and -0.0 compared equal but hashed differently,
and a NaN depth made x == x False).
Attributes:
| Name | Type | Description |
|---|---|---|
frequencies |
ndarray
|
Frequencies in Hz, shape |
depth |
ndarray
|
Complex penetration depth \(p\) in m, shape |
resistivity |
ndarray
|
Equivalent homogeneous resistivity \(\rho_\text{eq} = j\omega\mu_0
p^2\) in Ω·m, shape |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the three arrays are not one-dimensional of one length, a frequency is not finite and positive, or the depth or the resistivity holds a NaN. |
mutual_impedance ¶
Per-metre impedance of the complex-depth formula, every frequency.
\(Z' = \frac{j\omega\mu_0}{2\pi}\ln(D'/D)\) with
\(D = \sqrt{(z_i - z_j)^2 + x^2}\) and
\(D' = \sqrt{(|z_i| + |z_j| + 2p)^2 + x^2}\) (see the module
docstring): the mutual impedance of two parallel wires, or the self
impedance of one wire with z_i == z_j and distance its radius
(or GMR). Earth return and external inductance only (no internal
impedance of the wire).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
z_i
|
float
|
Depths of the wires in m, the groundfield convention ( |
required |
z_j
|
float
|
Depths of the wires in m, the groundfield convention ( |
required |
distance
|
float
|
Horizontal distance in m ( |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Complex impedance in Ω/m, shape |
Raises:
| Type | Description |
|---|---|
ValueError
|
For wires on opposite sides of the surface, a non-finite input or a distance that is not positive. |
Source code in src/groundfield/soil/penetration.py
SoilLayer ¶
Bases: _ModelLayerBase
A single horizontal layer of a MultiLayerSoil.
Attributes:
| Name | Type | Description |
|---|---|---|
rho |
float
|
Resistivity \(\rho\) of the layer in \(\Omega\,\mathrm{m}\);
finite and positive. Deprecated alias: |
h |
float | None
|
Layer thickness in m, finite and positive; |
relative_permittivity |
float
|
Relative permittivity (dimensionless). Not read by any backend; a non-default value warns. |
TwoLayerSoil ¶
Bases: _SoilBase
Two-layer soil: an upper layer of thickness h_1 over a half-space.
The Tagg / Sunde image series of the two-layer model is driven by the reflection coefficient \(K = (\rho_2 - \rho_1) / (\rho_2 + \rho_1) \in (-1, 1)\).
Attributes:
| Name | Type | Description |
|---|---|---|
rho_1 |
float
|
Resistivity of the upper layer \(\rho_1\) in \(\Omega\,\mathrm{m}\); finite and positive. |
rho_2 |
float
|
Resistivity of the lower (semi-infinite) layer \(\rho_2\) in \(\Omega\,\mathrm{m}\); finite and positive. |
h_1 |
float
|
Thickness of the upper layer \(h_1\) in m; finite and positive.
(For \(h_1 \to \infty\) use |
relative_permittivity |
float
|
Common relative permittivity of both layers (dimensionless). Not read by any backend; a non-default value warns. |
reflection_coefficient
property
¶
Reflection coefficient \(K = (\rho_2 - \rho_1) / (\rho_2 + \rho_1)\).
effective_resistivity ¶
effective_resistivity(soil: SoilModel | None = None, *, rho_1: float | None = None, rho_2: float | None = None, h_1: float | None = None, preset: str = 'lv_network', w0: float | None = None, beta: float | None = None, h_ref: float = 10.0) -> float
Effective resistivity of a homogeneous or two-layer soil in Ω·m.
\(\rho_\text{eff} = \rho_1^{\,1-w}\,\rho_2^{\,w}\) with
\(w = w_0\,(h_1/h_\text{ref})^{-\beta}\) limited to \([0, 1]\); the
resistivity itself for homogeneous soil. This is the rho of a
BusType fitted in layered soil and the specific_earth_resistance of
the matching groundinsight bus (see groundfield.soil.effective
for the derivation, the limit of \(w\) and the calibration range). The
weights \((w_0, \beta)\) come from a named preset of
EFFECTIVE_RESISTIVITY_PRESETS; w0 or beta given
explicitly replace that weight.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
soil
|
(HomogeneousSoil, TwoLayerSoil or MultiLayerSoil)
|
The soil. A |
None
|
rho_1
|
float
|
Resistivity of the upper layer in Ω·m, finite and positive
(keyword, instead of |
None
|
rho_2
|
float
|
Resistivity of the lower half-space in Ω·m, finite and positive
(keyword, instead of |
None
|
h_1
|
float
|
Thickness of the upper layer in m, finite and positive (keyword,
instead of |
None
|
preset
|
str
|
Name of the weight preset, a key of
|
'lv_network'
|
w0
|
float
|
Weight of the lower layer at \(h_1 = h_\text{ref}\)
(dimensionless, finite, \(\ge 0\)). Default |
None
|
beta
|
float
|
Exponent of the thickness dependence (dimensionless, finite,
\(\ge 0\), so that the weight does not grow with \(h_1\)). Default
|
None
|
h_ref
|
float
|
Reference thickness in m, finite and positive. Default 10 m, the
reference of every preset (a different |
10.0
|
Returns:
| Type | Description |
|---|---|
float
|
\(\rho_\text{eff}\) in Ω·m, between \(\rho_1\) and \(\rho_2\). |
Raises:
| Type | Description |
|---|---|
TypeError
|
If both |
ValueError
|
If |
Notes
Inside the calibration range the value is bit-identical to the
AP1 / AP2 scripts' r1 ** (1 - w) * r2 ** w with the same weights;
the default preset reproduces every call made before the presets
existed. For a thin upper layer
(\(h_1 < h_\text{ref}\,w_0^{1/\beta}\): 0.78 m for "lv_network",
1.15 m for "station") the limit \(w = 1\) gives \(\rho_2\), where the
unlimited formula would leave the interval \([\rho_1, \rho_2]\).
Examples:
>>> import groundfield as gf
>>> soil = gf.TwoLayerSoil(rho_1=100.0, rho_2=30.0, h_1=5.0)
>>> round(gf.effective_resistivity(soil), 4) # w = 0.13 * 0.5**-0.8 = 0.226
76.1465
>>> gf.effective_resistivity(gf.HomogeneousSoil(rho=100.0))
100.0
>>> gf.effective_resistivity(rho_1=100.0, rho_2=30.0, h_1=0.5) # w limited to 1
30.0
>>> round(gf.effective_resistivity(soil, preset="station"), 4) # w = 0.148
83.705
Source code in src/groundfield/soil/effective.py
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 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 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
penetration_depth ¶
Complex penetration depth and equivalent resistivity of a soil.
Per frequency, the complex depth \(p\) for which the homogeneous
complex-depth formulas of Dubanton and Deri reproduce the earth-return
impedance of the (layered) soil, and the equivalent homogeneous
resistivity \(\rho_\text{eq} = j\omega\mu_0 p^2\) with the same \(p\) (see
groundfield.soil.penetration for the matching, where it is exact
and its accuracy). Homogeneous soil gives \(p = \sqrt{\rho/(j\omega\mu_0)}\)
and \(\rho_\text{eq} = \rho\); any number of layers is accepted.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
soil
|
(HomogeneousSoil, TwoLayerSoil or MultiLayerSoil)
|
The soil (reduced to its canonical stack: adjacent layers of equal resistivity merged, as in every layered backend). |
required |
frequencies
|
float or array_like
|
Frequencies in Hz: finite, positive real numbers, at least
|
required |
Returns:
| Type | Description |
|---|---|
PenetrationDepth
|
|
Raises:
| Type | Description |
|---|---|
TypeError
|
If |
ValueError
|
If a frequency is not a finite, positive real number ( |
Notes
The recursion is the transmission-line transformation of the plane-wave surface impedance from the bottom half-space up through the layers; it is the \(\lambda \to 0\) value of the input admittance of the stack, which makes \(e^{-2p\lambda}\) agree with the layered surface reflection coefficient to second order in the horizontal wavenumber.
Examples:
>>> import groundfield as gf
>>> pd = gf.penetration_depth(gf.HomogeneousSoil(rho=100.0), [50.0])
>>> complex(pd.resistivity[0])
(100+0j)
>>> pd = gf.penetration_depth(gf.TwoLayerSoil(rho_1=1000.0, rho_2=30.0, h_1=5.0), [50.0])
>>> round(float(abs(pd.resistivity[0])), 3) # the lower layer dominates at 50 Hz
30.756
Source code in src/groundfield/soil/penetration.py
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 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 | |