groundfield 0.4.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- groundfield/__init__.py +331 -0
- groundfield/api.py +408 -0
- groundfield/boundary.py +83 -0
- groundfield/conductors/__init__.py +33 -0
- groundfield/conductors/conductor.py +256 -0
- groundfield/coupling/__init__.py +141 -0
- groundfield/coupling/carson.py +531 -0
- groundfield/coupling/inductance.py +824 -0
- groundfield/coupling/layered_green.py +486 -0
- groundfield/coupling/sommerfeld_inductance.py +730 -0
- groundfield/diagnostics.py +490 -0
- groundfield/generators/__init__.py +150 -0
- groundfield/generators/base.py +285 -0
- groundfield/generators/building.py +179 -0
- groundfield/generators/distributions.py +335 -0
- groundfield/generators/electrode_specs.py +287 -0
- groundfield/generators/grounding.py +220 -0
- groundfield/generators/measurement.py +363 -0
- groundfield/generators/placement.py +158 -0
- groundfield/generators/soil_specs.py +192 -0
- groundfield/generators/tn_network.py +693 -0
- groundfield/generators/tn_ortsnetz.py +43 -0
- groundfield/geometry/__init__.py +41 -0
- groundfield/geometry/electrodes.py +243 -0
- groundfield/geometry/primitives.py +11 -0
- groundfield/io/__init__.py +67 -0
- groundfield/io/csv.py +236 -0
- groundfield/io/groundinsight.py +687 -0
- groundfield/io/vtk.py +310 -0
- groundfield/postprocess/__init__.py +100 -0
- groundfield/postprocess/convergence.py +210 -0
- groundfield/postprocess/current_balance.py +538 -0
- groundfield/postprocess/geometry_plot.py +579 -0
- groundfield/postprocess/plotting.py +616 -0
- groundfield/postprocess/rho_f_standard.py +276 -0
- groundfield/postprocess/safety.py +431 -0
- groundfield/postprocess/sweep.py +359 -0
- groundfield/postprocess/vector_fitting.py +538 -0
- groundfield/references/__init__.py +39 -0
- groundfield/references/carson.py +222 -0
- groundfield/references/dwight1936.py +381 -0
- groundfield/references/oeding.py +179 -0
- groundfield/soil/__init__.py +47 -0
- groundfield/soil/models.py +135 -0
- groundfield/solver/__init__.py +49 -0
- groundfield/solver/_layered.py +377 -0
- groundfield/solver/bem.py +422 -0
- groundfield/solver/cim.py +683 -0
- groundfield/solver/engine.py +244 -0
- groundfield/solver/fem.py +705 -0
- groundfield/solver/field_study.py +26 -0
- groundfield/solver/image.py +1539 -0
- groundfield/solver/image_2layer.py +739 -0
- groundfield/solver/image_nlayer.py +196 -0
- groundfield/solver/mom.py +664 -0
- groundfield/solver/mom_sommerfeld.py +585 -0
- groundfield/solver/result.py +414 -0
- groundfield/sources.py +76 -0
- groundfield/utils/__init__.py +13 -0
- groundfield/utils/logging.py +43 -0
- groundfield/validation.py +238 -0
- groundfield/world.py +200 -0
- groundfield-0.4.0.dist-info/METADATA +230 -0
- groundfield-0.4.0.dist-info/RECORD +73 -0
- groundfield-0.4.0.dist-info/WHEEL +4 -0
- groundfield-0.4.0.dist-info/entry_points.txt +4 -0
- groundfield-0.4.0.dist-info/licenses/LICENSE +21 -0
- scripts/__init__.py +6 -0
- scripts/benchmarks/__init__.py +0 -0
- scripts/benchmarks/pen_1km_carson.py +304 -0
- scripts/generate_graphify_report.py +340 -0
- scripts/generate_third_party_licenses.py +288 -0
- scripts/release.py +738 -0
groundfield/__init__.py
ADDED
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
"""groundfield — numerical field computation for grounding systems.
|
|
2
|
+
|
|
3
|
+
``groundfield`` is an open-source Python package for the physical
|
|
4
|
+
reference modelling of networked grounding systems. Within the
|
|
5
|
+
``groundmeas`` / ``groundinsight`` / ``groundfield`` software family it
|
|
6
|
+
covers the field-theoretical side: soil models, electrode geometries,
|
|
7
|
+
conductors and their couplings are formulated as a 3-D problem in the
|
|
8
|
+
soil and solved numerically. The results are field profiles, potential
|
|
9
|
+
curves, current distributions, and reduced equivalent models
|
|
10
|
+
(``rho-f``) for further use in ``groundinsight``.
|
|
11
|
+
|
|
12
|
+
The package is deliberately designed to support the reference
|
|
13
|
+
computations required for work package 1 of the dissertation on
|
|
14
|
+
networked grounding systems: a TN distribution network with a
|
|
15
|
+
substation, house connections, cable cabinets, and layered soil.
|
|
16
|
+
|
|
17
|
+
Subpackages
|
|
18
|
+
-----------
|
|
19
|
+
soil
|
|
20
|
+
Soil models (homogeneous, multi-layer, frequency-dependent).
|
|
21
|
+
geometry
|
|
22
|
+
Electrode and conductor geometries, mesh generation.
|
|
23
|
+
conductors
|
|
24
|
+
Conductors, PEN, cable shields, and their self/mutual impedances.
|
|
25
|
+
solver
|
|
26
|
+
Numerical field solver (image method, MoM) in the frequency domain.
|
|
27
|
+
coupling
|
|
28
|
+
Inductive and galvanic coupling between conductors, shields, and
|
|
29
|
+
soil.
|
|
30
|
+
postprocess
|
|
31
|
+
Evaluation: potential curves, touch and step voltages, current
|
|
32
|
+
densities, plots.
|
|
33
|
+
io
|
|
34
|
+
File I/O and exchange formats, in particular the export of
|
|
35
|
+
reduced ``rho-f`` models for ``groundinsight``.
|
|
36
|
+
utils
|
|
37
|
+
Helpers for coordinates, units, logging, and validation.
|
|
38
|
+
|
|
39
|
+
Examples
|
|
40
|
+
--------
|
|
41
|
+
>>> import groundfield as gf
|
|
42
|
+
>>> soil = gf.TwoLayerSoil(rho_1=100.0, rho_2=500.0, h_1=2.0)
|
|
43
|
+
>>> world = gf.create_world(soil=soil)
|
|
44
|
+
>>> gf.create_electrode(world, "rod", name="g1",
|
|
45
|
+
... position=(0.0, 0.0, 0.0), length=1.5)
|
|
46
|
+
>>> gf.create_source(world, attached_to="g1", magnitude=1.0)
|
|
47
|
+
>>> result = gf.create_engine(backend="image", segment_length=0.05).solve(world)
|
|
48
|
+
>>> result.cluster_impedance("g1")[0].real # doctest: +SKIP
|
|
49
|
+
"""
|
|
50
|
+
|
|
51
|
+
from __future__ import annotations
|
|
52
|
+
|
|
53
|
+
# Version
|
|
54
|
+
__version__ = "0.4.0"
|
|
55
|
+
|
|
56
|
+
# Re-exports — data model
|
|
57
|
+
from groundfield.boundary import BoundaryConditions
|
|
58
|
+
from groundfield.conductors.conductor import Conductor, ConductorType
|
|
59
|
+
from groundfield.geometry.electrodes import (
|
|
60
|
+
Electrode,
|
|
61
|
+
GridMeshElectrode,
|
|
62
|
+
MeshElectrode,
|
|
63
|
+
RingElectrode,
|
|
64
|
+
RodElectrode,
|
|
65
|
+
StripElectrode,
|
|
66
|
+
)
|
|
67
|
+
from groundfield.soil.models import (
|
|
68
|
+
HomogeneousSoil,
|
|
69
|
+
MultiLayerSoil,
|
|
70
|
+
SoilLayer,
|
|
71
|
+
SoilModel,
|
|
72
|
+
TwoLayerSoil,
|
|
73
|
+
)
|
|
74
|
+
from groundfield.solver.engine import Backend, Engine
|
|
75
|
+
from groundfield.solver.result import FieldResult
|
|
76
|
+
from groundfield.sources import CurrentSource, Source, VoltageSource
|
|
77
|
+
from groundfield.world import World
|
|
78
|
+
|
|
79
|
+
# Re-exports — top-level factories
|
|
80
|
+
from groundfield.api import (
|
|
81
|
+
create_conductor,
|
|
82
|
+
create_electrode,
|
|
83
|
+
create_engine,
|
|
84
|
+
create_source,
|
|
85
|
+
create_world,
|
|
86
|
+
run_simulation,
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
# Re-exports — postprocess / plots
|
|
90
|
+
from groundfield.postprocess.plotting import (
|
|
91
|
+
plot_potential_contour,
|
|
92
|
+
plot_potential_profile,
|
|
93
|
+
plot_potential_radial,
|
|
94
|
+
plot_surface_potential,
|
|
95
|
+
world_bounds_xy,
|
|
96
|
+
)
|
|
97
|
+
from groundfield.postprocess.safety import (
|
|
98
|
+
permissible_touch_voltage_en50522,
|
|
99
|
+
step_voltage,
|
|
100
|
+
touch_voltage,
|
|
101
|
+
touch_voltage_envelope,
|
|
102
|
+
)
|
|
103
|
+
from groundfield.postprocess.current_balance import (
|
|
104
|
+
cluster_current_balance,
|
|
105
|
+
electrode_current_table,
|
|
106
|
+
plot_current_sharing,
|
|
107
|
+
split_factor,
|
|
108
|
+
)
|
|
109
|
+
from groundfield.postprocess.geometry_plot import (
|
|
110
|
+
plot_world,
|
|
111
|
+
plot_world_3d,
|
|
112
|
+
world_bounds_3d,
|
|
113
|
+
)
|
|
114
|
+
from groundfield.postprocess.sweep import (
|
|
115
|
+
plot_sweep_heatmap,
|
|
116
|
+
plot_sweep_lines,
|
|
117
|
+
sweep,
|
|
118
|
+
)
|
|
119
|
+
from groundfield.postprocess.convergence import (
|
|
120
|
+
convergence_study,
|
|
121
|
+
plot_convergence,
|
|
122
|
+
)
|
|
123
|
+
from groundfield.postprocess.vector_fitting import (
|
|
124
|
+
VectorFitResult,
|
|
125
|
+
fit_to_sympy,
|
|
126
|
+
rho_f_from_field_result,
|
|
127
|
+
vector_fit,
|
|
128
|
+
)
|
|
129
|
+
from groundfield.postprocess.rho_f_standard import (
|
|
130
|
+
RhoFStandardFit,
|
|
131
|
+
fit_rho_f_standard,
|
|
132
|
+
fit_to_sympy_standard,
|
|
133
|
+
rho_f_standard_from_results,
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
# Re-exports — io / sister-project bridge
|
|
137
|
+
from groundfield.io.csv import (
|
|
138
|
+
save_cluster_impedances_csv,
|
|
139
|
+
save_electrode_table_csv,
|
|
140
|
+
save_potential_path_csv,
|
|
141
|
+
)
|
|
142
|
+
from groundfield.io.groundinsight import (
|
|
143
|
+
BusTypeSpec,
|
|
144
|
+
load_bustype_json,
|
|
145
|
+
save_bustype_json,
|
|
146
|
+
to_bustype,
|
|
147
|
+
to_bustype_dict,
|
|
148
|
+
)
|
|
149
|
+
from groundfield.io.vtk import (
|
|
150
|
+
export_field_vtk,
|
|
151
|
+
export_geometry_vtk,
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
# Re-exports — world generators (AP1 + future)
|
|
155
|
+
from groundfield.generators import (
|
|
156
|
+
BuildingTypeSpec,
|
|
157
|
+
Categorical,
|
|
158
|
+
Constant,
|
|
159
|
+
Discrete,
|
|
160
|
+
Distribution,
|
|
161
|
+
ElectrodeSpec,
|
|
162
|
+
ExplicitPlacement,
|
|
163
|
+
FoundationElectrodeSpec,
|
|
164
|
+
GeneratorConfig,
|
|
165
|
+
GroundingSystemSpec,
|
|
166
|
+
HomogeneousSoilSpec,
|
|
167
|
+
LogNormal,
|
|
168
|
+
ManhattanGridPlacement,
|
|
169
|
+
MeasurementInjectionConfig,
|
|
170
|
+
MeasurementLeadConfig,
|
|
171
|
+
MeasurementProbeConfig,
|
|
172
|
+
MeasurementSetupConfig,
|
|
173
|
+
MultiLayerSoilSpec,
|
|
174
|
+
Normal,
|
|
175
|
+
RingElectrodeSpec,
|
|
176
|
+
RodElectrodeSpec,
|
|
177
|
+
StripElectrodeSpec,
|
|
178
|
+
TnNetworkConfig,
|
|
179
|
+
TnNetworkGenerator,
|
|
180
|
+
TwoLayerSoilSpec,
|
|
181
|
+
Uniform,
|
|
182
|
+
Weibull,
|
|
183
|
+
WorldGenerator,
|
|
184
|
+
buried_lead,
|
|
185
|
+
default_building_catalog,
|
|
186
|
+
neighbour_substation_grounding,
|
|
187
|
+
overhead_lead,
|
|
188
|
+
rod_circle,
|
|
189
|
+
single_rod_grounding,
|
|
190
|
+
)
|
|
191
|
+
|
|
192
|
+
# Analytical reference formulas (used in plausibility tests)
|
|
193
|
+
from groundfield.references import dwight1936
|
|
194
|
+
|
|
195
|
+
# Cross-engine validation (see ADR-0001)
|
|
196
|
+
from groundfield.validation import EngineComparison, compare_engines
|
|
197
|
+
|
|
198
|
+
# Pre-solve world diagnostics
|
|
199
|
+
from groundfield.diagnostics import (
|
|
200
|
+
check_segment_resolution,
|
|
201
|
+
expected_segments,
|
|
202
|
+
world_statistics,
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
__all__ = [
|
|
206
|
+
"__version__",
|
|
207
|
+
# Data model
|
|
208
|
+
"World",
|
|
209
|
+
"BoundaryConditions",
|
|
210
|
+
"HomogeneousSoil",
|
|
211
|
+
"TwoLayerSoil",
|
|
212
|
+
"MultiLayerSoil",
|
|
213
|
+
"SoilLayer",
|
|
214
|
+
"SoilModel",
|
|
215
|
+
"Electrode",
|
|
216
|
+
"RodElectrode",
|
|
217
|
+
"RingElectrode",
|
|
218
|
+
"StripElectrode",
|
|
219
|
+
"MeshElectrode",
|
|
220
|
+
"GridMeshElectrode",
|
|
221
|
+
"Conductor",
|
|
222
|
+
"ConductorType",
|
|
223
|
+
"Source",
|
|
224
|
+
"CurrentSource",
|
|
225
|
+
"VoltageSource",
|
|
226
|
+
# Numerics
|
|
227
|
+
"Engine",
|
|
228
|
+
"Backend",
|
|
229
|
+
"FieldResult",
|
|
230
|
+
# Factories
|
|
231
|
+
"create_world",
|
|
232
|
+
"create_electrode",
|
|
233
|
+
"create_conductor",
|
|
234
|
+
"create_source",
|
|
235
|
+
"create_engine",
|
|
236
|
+
"run_simulation",
|
|
237
|
+
# Plots
|
|
238
|
+
"plot_potential_contour",
|
|
239
|
+
"plot_potential_profile",
|
|
240
|
+
"plot_potential_radial",
|
|
241
|
+
"plot_surface_potential",
|
|
242
|
+
"world_bounds_xy",
|
|
243
|
+
# Safety (touch / step voltage)
|
|
244
|
+
"touch_voltage",
|
|
245
|
+
"touch_voltage_envelope",
|
|
246
|
+
"step_voltage",
|
|
247
|
+
"permissible_touch_voltage_en50522",
|
|
248
|
+
# Current sharing
|
|
249
|
+
"cluster_current_balance",
|
|
250
|
+
"electrode_current_table",
|
|
251
|
+
"split_factor",
|
|
252
|
+
"plot_current_sharing",
|
|
253
|
+
# World geometry plots (no solve required)
|
|
254
|
+
"plot_world",
|
|
255
|
+
"plot_world_3d",
|
|
256
|
+
"world_bounds_3d",
|
|
257
|
+
# Parameter-sweep helpers
|
|
258
|
+
"sweep",
|
|
259
|
+
"plot_sweep_lines",
|
|
260
|
+
"plot_sweep_heatmap",
|
|
261
|
+
"convergence_study",
|
|
262
|
+
"plot_convergence",
|
|
263
|
+
# rho-f fits (vector fitting + dissertation standard form)
|
|
264
|
+
"VectorFitResult",
|
|
265
|
+
"vector_fit",
|
|
266
|
+
"fit_to_sympy",
|
|
267
|
+
"rho_f_from_field_result",
|
|
268
|
+
"RhoFStandardFit",
|
|
269
|
+
"fit_rho_f_standard",
|
|
270
|
+
"fit_to_sympy_standard",
|
|
271
|
+
"rho_f_standard_from_results",
|
|
272
|
+
# IO / groundinsight bridge
|
|
273
|
+
"BusTypeSpec",
|
|
274
|
+
"to_bustype_dict",
|
|
275
|
+
"to_bustype",
|
|
276
|
+
"save_bustype_json",
|
|
277
|
+
"load_bustype_json",
|
|
278
|
+
# IO / CSV
|
|
279
|
+
"save_potential_path_csv",
|
|
280
|
+
"save_electrode_table_csv",
|
|
281
|
+
"save_cluster_impedances_csv",
|
|
282
|
+
# IO / VTK
|
|
283
|
+
"export_geometry_vtk",
|
|
284
|
+
"export_field_vtk",
|
|
285
|
+
# Generators / distributions
|
|
286
|
+
"GeneratorConfig",
|
|
287
|
+
"WorldGenerator",
|
|
288
|
+
"Distribution",
|
|
289
|
+
"Constant",
|
|
290
|
+
"Uniform",
|
|
291
|
+
"Normal",
|
|
292
|
+
"LogNormal",
|
|
293
|
+
"Weibull",
|
|
294
|
+
"Discrete",
|
|
295
|
+
"Categorical",
|
|
296
|
+
"TnNetworkConfig",
|
|
297
|
+
"TnNetworkGenerator",
|
|
298
|
+
# Spec layer
|
|
299
|
+
"RodElectrodeSpec",
|
|
300
|
+
"RingElectrodeSpec",
|
|
301
|
+
"StripElectrodeSpec",
|
|
302
|
+
"FoundationElectrodeSpec",
|
|
303
|
+
"ElectrodeSpec",
|
|
304
|
+
"GroundingSystemSpec",
|
|
305
|
+
"BuildingTypeSpec",
|
|
306
|
+
"HomogeneousSoilSpec",
|
|
307
|
+
"TwoLayerSoilSpec",
|
|
308
|
+
"MultiLayerSoilSpec",
|
|
309
|
+
"ManhattanGridPlacement",
|
|
310
|
+
"ExplicitPlacement",
|
|
311
|
+
"rod_circle",
|
|
312
|
+
"default_building_catalog",
|
|
313
|
+
# Measurement setup
|
|
314
|
+
"MeasurementSetupConfig",
|
|
315
|
+
"MeasurementInjectionConfig",
|
|
316
|
+
"MeasurementProbeConfig",
|
|
317
|
+
"MeasurementLeadConfig",
|
|
318
|
+
"overhead_lead",
|
|
319
|
+
"buried_lead",
|
|
320
|
+
"single_rod_grounding",
|
|
321
|
+
"neighbour_substation_grounding",
|
|
322
|
+
# Reference formulas
|
|
323
|
+
"dwight1936",
|
|
324
|
+
# Cross-engine
|
|
325
|
+
"compare_engines",
|
|
326
|
+
"EngineComparison",
|
|
327
|
+
# Pre-solve diagnostics
|
|
328
|
+
"world_statistics",
|
|
329
|
+
"expected_segments",
|
|
330
|
+
"check_segment_resolution",
|
|
331
|
+
]
|