Skip to content

Boundary conditions

BoundaryConditions records the boundary conditions of the field problem on the World. Every backend implements the same set — remote earth as the potential reference and an insulating soil surface — so the fields exist for documentation and forward compatibility only. A non-default value is stored but read by no backend and warns with InertConfigurationWarning.

Mathematical and physical context

Below 1 kHz the displacement current in the soil is negligible, the leakage current density follows Ohm's law \(\mathbf{J} = -\sigma\nabla\varphi\), and charge conservation \(\nabla\cdot\mathbf{J} = 0\) gives

\[ \nabla\cdot\bigl(\sigma(\mathbf{r})\,\nabla\varphi(\mathbf{r})\bigr) = 0 , \]

Laplace's equation \(\nabla^2\varphi = 0\) inside every homogeneous layer. The injected currents are not a volume source; they enter through the electrode surfaces. A well-posed problem needs three conditions, which are the three fields of this model:

Field Value used by every backend Meaning
far_field "dirichlet" \(\varphi \to 0\) for \(\lvert\mathbf{r}\rvert \to \infty\): remote earth is the reference of every potential
surface "neumann" \(\partial\varphi/\partial z = 0\) at \(z = 0\): no current into the air; realised by the mirror image at \(z \to -z\)
reference_node None the datum is remote earth

At an interface between layers \(\varphi\) and the normal current density \(\sigma\,\partial_n\varphi\) are continuous; the layered Green's functions of the solvers satisfy these conditions, not this model.

Validity. Linear, isotropic, piecewise homogeneous soil in the quasi-static regime. The inductive coupling of conductors (and its earth-return correction) is a separate branch impedance of the conductor network, not part of this electrostatic-type boundary-value problem.

Example

import warnings

import groundfield as gf
from groundfield.utils import InertConfigurationWarning

with warnings.catch_warnings(record=True) as caught:
    warnings.simplefilter("always")
    boundary = gf.BoundaryConditions(surface="dirichlet")   # stored, not used
assert [w.category for w in caught] == [InertConfigurationWarning]
world = gf.create_world(soil=gf.HomogeneousSoil(rho=100.0), boundary=boundary)

World.set_boundary_conditions(...) stores a changed value as well and warns with a plain UserWarning, also when a value is set back to the default.

API reference

boundary

Boundary conditions for the field computation.

The boundary configuration bundles the assumptions imposed at the boundary of the computational domain:

  • far_field: behaviour at infinity (Dirichlet \(\varphi = 0\), Neumann \(\partial_n \varphi = 0\)). For grounding systems, Dirichlet at infinity is the standard assumption ("remote earth").
  • surface: condition at the soil surface (\(z = 0\)). Default is Neumann (no current flow into the air).
  • reference_node: optional reference node that fixes the zero point of the potential.
Implementation status

No backend reads these fields (checked for image, image_2layer, image_nlayer, cim, mom, mom_sommerfeld, bem and fem: a world with every field set to a non-default value solves bit-identically, see tests/test_boundary_conditions.py). Every backend imposes the defaults implicitly:

  • far_field = "dirichlet" through the \(1/r\) decay of the Green's function (the potential vanishes at remote earth);
  • surface = "neumann" through the air-side image charge at \(z \to -z\) (the fem backend through its natural boundary condition);
  • reference_node is never consulted; all potentials are reported relative to remote earth (\(\varphi \to 0\) at infinity).

The fields are accepted and round-trip through serialisation for forward compatibility. Setting a non-default value warns with InertConfigurationWarning — when the model is constructed (directly, via groundfield.create_world() or from a world JSON) and in groundfield.world.World.set_boundary_conditions().

BoundaryConditions

Bases: BaseModel

Boundary-condition configuration of a World.

Attributes:

Name Type Description
far_field Literal['dirichlet', 'neumann']

Condition at infinity. "dirichlet" (default): φ → 0 at remote earth. Not read by any backend.

surface Literal['neumann', 'dirichlet']

Condition at the soil surface z = 0. "neumann" (default): no current flows into the air. Not read by any backend.

reference_node str | None

Name of an electrode whose potential would define zero. Not read by any backend: potentials are always relative to remote earth.

Warns:

Type Description
InertConfigurationWarning

When a field is set to a value other than the implemented default (see the module docstring).