Skip to content

World

groundfield.World is the container of the physical model: the soil, the electrodes, the leakage-free junction nodes, the conductors between them, the sources and the boundary conditions. It holds no numerics; backend, frequencies and discretisation belong to the Engine, and world.solve(engine) runs one against the other.

Mathematical and physical context

A world describes one boundary-value problem of the quasi-static grounding field (\(f < 1\,\mathrm{kHz}\)):

  • in the soil, \(\nabla\cdot(\sigma\nabla\varphi) = 0\) with \(\varphi \to 0\) at remote earth and no current through the soil surface;
  • every galvanic cluster (electrodes joined by ideal conductors) is one equipotential body, and the current it leaks is the integral of the current density over its surface;
  • the conductor network (conductors with impedance, junctions) obeys Kirchhoff's current law at every node and \(\varphi_a - \varphi_b = Z_b I_b\) along every branch;
  • the sources impress currents between a node and remote earth or between two nodes.

The names of electrodes and junctions share one namespace: they are the nodes that conductors and sources refer to.

Checks before a solve

World.check() validates the model before any backend runs: every source terminal and conductor end must name an existing node (the error suggests the closest names), the two terminals of a source must not be bonded into one cluster, voltage sources without internal resistance must not form a loop (through ideal bonds or remote earth; the message names the sources of the loop), magnitudes and internal impedances must be finite (the impedances ≥ 0), a current source must not be 0 A (a voltage source of 0 V is a short through its internal impedance), and a world needs at least one electrode and one source of non-zero magnitude. Every solve calls the check; the solver pipeline also rejects junctions without a conductor path to an electrode. The diagnostics module adds advisory checks (problem size, segment resolution, close wires).

Sources are restored after a solve

world.solve(engine) works on a snapshot of the sources: the source objects returned by create_source stay attached to the world, so a parameter loop can edit them between solves.

import groundfield as gf

world = gf.create_world(soil=gf.HomogeneousSoil(rho=100.0))
gf.create_electrode(world, "rod", name="g1", position=(0.0, 0.0, 0.0), length=3.0)
src = gf.create_source(world, attached_to="g1", magnitude=10.0)
engine = gf.create_engine(frequencies=[50.0])

potentials = []
for current in (10.0, 20.0, 40.0):
    src.magnitude = current            # src is still world.sources[0]
    potentials.append(world.solve(engine).electrode_potentials["g1"][0])

assert abs(potentials[2] / potentials[0] - 4.0) < 1e-12   # linear problem

API reference

world

Central World object: container for the entire physics.

A World bundles everything that belongs to the physical description of a grounding system:

The World is intentionally free of numerics. The numerical evaluation (backend selection, mesh resolution, frequency list, tolerances) is configured in a groundfield.solver.Engine and applied to the world via world.solve(engine).

World

Bases: BaseModel

Top-level container for a grounding field problem.

Notes

A World is usually not instantiated directly but built via groundfield.create_world(). The helper methods add_* and the top-level factories gf.create_* populate the container incrementally.

add_conductor

add_conductor(conductor: Conductor) -> Conductor

Add a conductor.

Raises:

Type Description
ValueError

If the name is already taken.

KeyError

If start_electrode / end_electrode names no electrode or junction of the world (review finding 10.66: such a conductor used to drop out of the network silently). The message names the closest node names.

Source code in src/groundfield/world.py
def add_conductor(self, conductor: Conductor) -> Conductor:
    """Add a conductor.

    Raises
    ------
    ValueError
        If the name is already taken.
    KeyError
        If ``start_electrode`` / ``end_electrode`` names no
        electrode or junction of the world (review finding 10.66: such a
        conductor used to drop out of the network silently). The
        message names the closest node names.
    """
    index = _name_index(self)
    if index.taken(self, "conductors", conductor.name):
        raise ValueError(f"Conductor name '{conductor.name}' already taken.")
    self._check_conductor_ends(conductor, index.node_view(self))
    self.conductors.append(conductor)
    index.added(self, "conductors", conductor.name)
    return conductor

add_electrode

add_electrode(electrode: _ElectrodeBase) -> _ElectrodeBase

Add an electrode and check for unique name.

Electrodes and junctions share one node namespace.

Raises:

Type Description
ValueError

If the name is already taken by an electrode or a junction, or starts with a reserved prefix (RESERVED_NAME_PREFIXES).

Source code in src/groundfield/world.py
def add_electrode(self, electrode: _ElectrodeBase) -> _ElectrodeBase:
    """Add an electrode and check for unique name.

    Electrodes and junctions share one node namespace.

    Raises
    ------
    ValueError
        If the name is already taken by an electrode or a junction, or
        starts with a reserved prefix (:data:`~groundfield.world.RESERVED_NAME_PREFIXES`).
    """
    _check_reserved_name(electrode.name, "Electrode")
    index = _name_index(self)
    if index.taken(self, "electrodes", electrode.name):
        raise ValueError(f"Electrode name '{electrode.name}' already taken.")
    if index.taken(self, "junctions", electrode.name):
        raise ValueError(
            f"Electrode name '{electrode.name}' already taken by a junction."
        )
    self.electrodes.append(electrode)
    index.added(self, "electrodes", electrode.name)
    return electrode

add_junction

add_junction(junction: Junction) -> Junction

Add a leakage-free junction node.

Raises:

Type Description
ValueError

If the name is already taken by an electrode or a junction (one node namespace), or starts with a reserved prefix (RESERVED_NAME_PREFIXES).

Source code in src/groundfield/world.py
def add_junction(self, junction: Junction) -> Junction:
    """Add a leakage-free junction node.

    Raises
    ------
    ValueError
        If the name is already taken by an electrode or a junction
        (one node namespace), or starts with a reserved prefix
        (:data:`~groundfield.world.RESERVED_NAME_PREFIXES`).
    """
    _check_reserved_name(junction.name, "Junction")
    index = _name_index(self)
    if index.taken(self, "junctions", junction.name):
        raise ValueError(f"Junction name '{junction.name}' already taken.")
    if index.taken(self, "electrodes", junction.name):
        raise ValueError(
            f"Junction name '{junction.name}' already taken by an electrode."
        )
    self.junctions.append(junction)
    index.added(self, "junctions", junction.name)
    return junction

add_source

add_source(source: Source) -> Source

Add a source.

Raises:

Type Description
ValueError

If the name is already taken, the source feeds a conductor (a conductor is not a node), or attached_to and return_to are the same node.

KeyError

If attached_to / return_to names no electrode or junction of the world (review finding 10.66). The message names the closest node names.

Source code in src/groundfield/world.py
def add_source(self, source: Source) -> Source:
    """Add a source.

    Raises
    ------
    ValueError
        If the name is already taken, the source feeds a conductor
        (a conductor is not a node), or ``attached_to`` and
        ``return_to`` are the same node.
    KeyError
        If ``attached_to`` / ``return_to`` names no electrode or
        junction of the world (review finding 10.66). The message
        names the closest node names.
    """
    index = _name_index(self)
    if index.taken(self, "sources", source.name):
        raise ValueError(f"Source name '{source.name}' already taken.")
    self._check_source_terminals(source)
    self.sources.append(source)
    index.added(self, "sources", source.name)
    return source

check

check(*, require_source: bool = True) -> None

Validate the cross references and the excitation of the world.

Called by every solve through solve() and by the shared injection step of the solver pipeline, so a world edited after its objects were created, or loaded from JSON, is checked before any numerics run (review finding 10.66; up to 0.15.0 each of the cases below solved silently to zero currents or nan impedances).

Parameters:

Name Type Description Default
require_source bool

Require at least one electrode and at least one source of non-zero magnitude (default True, the state a world must be in to be solved). False checks only the references of a world that is still being assembled.

True

Raises:

Type Description
KeyError

A source terminal or a conductor end names no node of the world; the message names the closest node names.

ValueError

A name is used twice: two electrodes, two junctions, an electrode and a junction (one node namespace), two conductors or two sources (audit round 2, A2S-06: a world loaded from JSON or edited through its lists with two electrodes of one name failed in the solver with a singular matrix, an electrode and a junction of one name were merged into one node). An electrode or junction name starts with a reserved prefix (RESERVED_NAME_PREFIXES, audit A3S-03). A source feeds a conductor or returns to its own node; both terminals of a source are bonded into one galvanic cluster by ideal conductors (the source is short-circuited); voltage sources form a loop, through ideal bonds or through remote earth (two of them on one cluster to remote earth, a ring of two-terminal ones), which fixes one potential difference twice; a current source has magnitude 0; a source has a non-finite magnitude / phase; the world has no electrode or no source of non-zero magnitude (with require_source). A conductor with conductor_type="cable_shield" and resistance_model="skin", which the conductor's validator rejects but model_copy(update=...) lets through (user decision Q33; audit W1R2-10: up to then only the inductive assembly of image and mom raised, fem solved its resistive fallback).

Notes

A VoltageSource of 0 V is accepted: it is an ideal short between its terminals (or to remote earth) whose current the solve returns (up to 0.15.0 voltage sources were dropped with a warning and solved to zero potentials).

Source code in src/groundfield/world.py
def check(self, *, require_source: bool = True) -> None:
    """Validate the cross references and the excitation of the world.

    Called by every solve through :meth:`solve` and by the shared
    injection step of the solver pipeline, so a world edited after
    its objects were created, or loaded from JSON, is checked before
    any numerics run (review finding 10.66; up to 0.15.0 each of the
    cases below solved silently to zero currents or ``nan``
    impedances).

    Parameters
    ----------
    require_source
        Require at least one electrode and at least one source of
        non-zero magnitude (default ``True``, the state a world must
        be in to be solved). ``False`` checks only the references of
        a world that is still being assembled.

    Raises
    ------
    KeyError
        A source terminal or a conductor end names no node of the
        world; the message names the closest node names.
    ValueError
        A name is used twice: two electrodes, two junctions, an
        electrode and a junction (one node namespace), two conductors
        or two sources (audit round 2, A2S-06: a world loaded from
        JSON or edited through its lists with two electrodes of one
        name failed in the solver with a singular matrix, an electrode
        and a junction of one name were merged into one node).
        An electrode or junction name starts with a reserved prefix
        (:data:`~groundfield.world.RESERVED_NAME_PREFIXES`, audit A3S-03).
        A source feeds a conductor or returns to its own node; both
        terminals of a source are bonded into one galvanic cluster by
        ideal conductors (the source is short-circuited); voltage
        sources form a loop, through ideal bonds or through remote
        earth (two of them on one cluster to remote earth, a ring of
        two-terminal ones), which fixes one potential difference
        twice; a current source has magnitude 0; a source has a
        non-finite magnitude / phase; the world has no electrode or
        no source of non-zero magnitude (with ``require_source``).
        A conductor with ``conductor_type="cable_shield"`` and
        ``resistance_model="skin"``, which the conductor's validator
        rejects but ``model_copy(update=...)`` lets through (user
        decision Q33; audit W1R2-10: up to then only the inductive
        assembly of ``image`` and ``mom`` raised, ``fem`` solved its
        resistive fallback).

    Notes
    -----
    A :class:`~groundfield.sources.VoltageSource` of 0 V is accepted:
    it is an ideal short between its terminals (or to remote earth)
    whose current the solve returns (up to 0.15.0 voltage sources
    were dropped with a warning and solved to zero potentials).
    """
    self._check_unique_names()
    if require_source and self.soil is None:
        raise ValueError("World has no soil model. Set one before calling solve().")
    if require_source and not self.electrodes:
        raise ValueError("World contains no electrodes.")
    nodes = set(self._node_names())
    for c in self.conductors:
        self._check_conductor_ends(c, nodes)
        # model_copy(update=...) skips the conductor's validator: a
        # cable shield copied onto the solid-round skin model is
        # rejected here, for every backend (audit W1R2-10, Q33)
        shield_check = getattr(c, "_check_shield_resistance_model", None)
        if shield_check is not None:
            shield_check()
    n_driving = 0
    zero_volt: list[str] = []
    for src in self.sources:
        self._check_source_terminals(src)
        unit = "V" if src.kind == "voltage" else "A"
        magnitude = float(src.magnitude)
        phase = float(src.phase_deg)
        if not (math.isfinite(magnitude) and math.isfinite(phase)):
            raise ValueError(
                f"Source {src.name!r}: magnitude ({magnitude!r} {unit}) and "
                f"phase_deg ({phase!r}) must be finite."
            )
        if src.kind == "voltage":
            # model_copy(update=...) skips the field validators
            # (user decision D1: R, L >= 0 and finite; audit W2R2-10:
            # 0 or a normal float).
            for field, unit_q in (
                ("internal_resistance_ohm", "Ω"),
                ("internal_inductance_h", "H"),
            ):
                value = float(getattr(src, field))
                problem = _internal_impedance_problem(value)
                if problem is not None:
                    raise ValueError(
                        f"Voltage source {src.name!r}: {field} ({value!r} "
                        f"{unit_q}) {problem}."
                    )
        if magnitude == 0.0:
            if src.kind == "voltage":
                # An ideal short (0 V): its current is solved for.
                zero_volt.append(src.name)
                continue
            raise ValueError(
                f"Source {src.name!r} has magnitude 0 A: it injects "
                "nothing. Remove it or give it a non-zero magnitude."
            )
        n_driving += 1
    self._check_short_circuited_sources()
    if require_source and n_driving == 0:
        if zero_volt:
            raise ValueError(
                f"World {self.name!r} has no source with a non-zero "
                f"magnitude: its voltage source(s) {zero_volt} impress 0 V "
                "and it has no current source, so every potential and "
                "current would be zero. Give a source a non-zero magnitude."
            )
        raise ValueError(
            f"World {self.name!r} has no current source and no voltage "
            "source, so every potential and current would be zero and "
            "every impedance nan. Add one with gf.create_source(world, "
            "attached_to=...)."
        )

get_conductor

get_conductor(name: str) -> Conductor

Return a conductor by name.

Source code in src/groundfield/world.py
def get_conductor(self, name: str) -> Conductor:
    """Return a conductor by name."""
    for c in self.conductors:
        if c.name == name:
            return c
    raise KeyError(f"Conductor '{name}' not found in world.")

get_electrode

get_electrode(name: str) -> Electrode

Return an electrode by name.

Source code in src/groundfield/world.py
def get_electrode(self, name: str) -> Electrode:
    """Return an electrode by name."""
    for e in self.electrodes:
        if e.name == name:
            return e
    raise KeyError(f"Electrode '{name}' not found in world.")

get_junction

get_junction(name: str) -> Junction

Return a junction by name.

Source code in src/groundfield/world.py
def get_junction(self, name: str) -> Junction:
    """Return a junction by name."""
    for j in self.junctions:
        if j.name == name:
            return j
    raise KeyError(f"Junction '{name}' not found in world.")

reset_concrete_corrections

reset_concrete_corrections() -> dict[str, float]

Clear and return the ADR-0012 V1 concrete-shell registry.

Up to 0.15.0 the concrete_shell_corrections dict accumulated one entry per foundation-electrode anchor that the generator pipeline materialised with a non-None concrete_rho_ohm_m field (ADR-0012, V1 "lumped" path), and a World re-used across several builds leaked stale shell resistances into later samples. Since 2026.11 the registry is deprecated, no generator writes it and no solver reads it (the shell is the per-length coefficient of the encased wires); the helper clears entries of worlds loaded from 0.15.0 JSON, which would otherwise warn at every solve.

Returns:

Type Description
dict[str, float]

The previous contents of the registry, before clearing. The returned dict is a shallow copy so the caller can inspect or log the dropped entries without holding a live reference to the (now empty) registry on the world.

Notes

Calling this on a world that was never touched by the concrete-encasement code path is a no-op; the returned dict is empty.

Source code in src/groundfield/world.py
def reset_concrete_corrections(self) -> dict[str, float]:
    """Clear and return the ADR-0012 V1 concrete-shell registry.

    Up to 0.15.0 the :attr:`concrete_shell_corrections` dict
    accumulated one entry per foundation-electrode anchor that the
    generator pipeline materialised with a non-``None``
    ``concrete_rho_ohm_m`` field (ADR-0012, V1 "lumped" path), and a
    :class:`World` re-used across several builds leaked stale shell
    resistances into later samples. Since 2026.11 the registry is
    deprecated, no generator writes it and no solver reads it (the
    shell is the per-length coefficient of the encased wires); the
    helper clears entries of worlds loaded from 0.15.0 JSON, which
    would otherwise warn at every solve.

    Returns
    -------
    dict[str, float]
        The previous contents of the registry, before clearing. The
        returned dict is a shallow copy so the caller can inspect or
        log the dropped entries without holding a live reference to
        the (now empty) registry on the world.

    Notes
    -----
    Calling this on a world that was never touched by the
    concrete-encasement code path is a no-op; the returned dict is
    empty.
    """
    previous = dict(self.concrete_shell_corrections)
    self.concrete_shell_corrections.clear()
    return previous

set_boundary_conditions

set_boundary_conditions(**kwargs: Any) -> BoundaryConditions

Update individual fields of the boundary configuration.

Parameters:

Name Type Description Default
**kwargs Any

Fields of BoundaryConditions (e.g. far_field, surface, reference_node).

{}

Returns:

Type Description
BoundaryConditions

The updated boundary-conditions object.

Warns:

Type Description
UserWarning

If any provided value differs from the defaults consumed by the v0.2.0 integral / image-charge backends (far_field="dirichlet", surface="neumann", reference_node=None). The non-default value is stored on the model and round-trips through serialisation, but no backend reads it. The fields are reserved for the upcoming FEM backend; see groundfield.boundary.BoundaryConditions for the full implementation-status note.

UserWarning

If a field is reverted from a previously-set non-default value back to the default. The previous non-default value was never consumed by any backend, so a silent revert would suggest a change of behaviour that the user never actually experienced. The revert warning makes that visible.

Source code in src/groundfield/world.py
def set_boundary_conditions(self, **kwargs: Any) -> BoundaryConditions:
    """Update individual fields of the boundary configuration.

    Parameters
    ----------
    **kwargs
        Fields of :class:`BoundaryConditions` (e.g. ``far_field``,
        ``surface``, ``reference_node``).

    Returns
    -------
    BoundaryConditions
        The updated boundary-conditions object.

    Warns
    -----
    UserWarning
        If any provided value differs from the defaults consumed
        by the v0.2.0 integral / image-charge backends
        (``far_field="dirichlet"``, ``surface="neumann"``,
        ``reference_node=None``). The non-default value is stored
        on the model and round-trips through serialisation, but
        no backend reads it. The fields are reserved for the
        upcoming FEM backend; see
        :class:`groundfield.boundary.BoundaryConditions` for the
        full implementation-status note.
    UserWarning
        If a field is reverted from a previously-set non-default
        value back to the default. The previous non-default value
        was never consumed by any backend, so a silent revert
        would suggest a change of behaviour that the user never
        actually experienced. The revert warning makes that
        visible.
    """
    # Snapshot the previous boundary state so we can detect both
    # "non-default value set" and "non-default value reverted to
    # default" transitions on the keys the caller touched.
    previous = self.boundary.model_dump()

    new = self.boundary.model_copy(update=kwargs)
    # Force re-validation through a fresh model construction
    self.boundary = BoundaryConditions(**new.model_dump())

    # Warn if the caller asked for a value the v0.2.0 backends do
    # not actually implement. We only warn on the keys the caller
    # touched (so a no-op call after construction stays quiet).
    non_default = {
        k: v
        for k, v in kwargs.items()
        if k in _DEFAULT_BOUNDARY_VALUES and v != _DEFAULT_BOUNDARY_VALUES[k]
    }
    if non_default:
        warnings.warn(
            "BoundaryConditions field(s) "
            f"{sorted(non_default)} set to a non-default value, "
            "but the v0.2.0 integral / image-charge backends ignore "
            "this setting and report potentials relative to remote "
            "earth (φ → 0 at infinity, Neumann at z = 0). The value "
            "is preserved on the model for forward-compatibility "
            "with the upcoming FEM backend. See "
            "groundfield.boundary.BoundaryConditions for the full "
            "implementation-status note.",
            UserWarning,
            stacklevel=2,
        )

    # Revert detection: a key the caller now sets back to the
    # default *was* previously non-default. The previous value
    # never reached any backend; warning the user closes that
    # silent-no-op feedback gap.
    reverted = {
        k: previous[k]
        for k, v in kwargs.items()
        if k in _DEFAULT_BOUNDARY_VALUES
        and v == _DEFAULT_BOUNDARY_VALUES[k]
        and previous.get(k) != _DEFAULT_BOUNDARY_VALUES[k]
    }
    if reverted:
        warnings.warn(
            "BoundaryConditions field(s) "
            f"{sorted(reverted)} reverted to the default value. The "
            "previous non-default setting "
            f"{reverted!r} was never consumed by the v0.2.0 integral "
            "/ image-charge backends, so this revert does not change "
            "any computed result. See "
            "groundfield.boundary.BoundaryConditions for the full "
            "implementation-status note.",
            UserWarning,
            stacklevel=2,
        )
    return self.boundary

solve

solve(engine: 'Engine', *, snapshot_sources: bool = True) -> 'FieldResult'

Run the simulation with the given Engine.

Delegates to Engine.solve(), so world.solve(engine), engine.solve(world) and groundfield.run_simulation() follow the same source-snapshot semantics: every sources entry is snapshotted before the backend runs and restored on exit, and the result records the sources as built.

Parameters:

Name Type Description Default
engine 'Engine'

The Engine instance that drives the backend.

required
snapshot_sources bool

Deprecated. True (default) additionally guards the sources around engine.solve here, which protects against Engine subclasses that override solve and mutate the world before delegating. False drops only that extra guard and emits a DeprecationWarning: Engine.solve() always takes the snapshot (it costs a deep copy of a few flat models), so the opt-out saves nothing. It will be removed no earlier than 2027.5.

True

Returns:

Type Description
FieldResult

The result of Engine.solve().

Raises:

Type Description
TypeError

If engine is not an Engine.

(KeyError, ValueError)

If the world fails check() (dangling source or conductor references, no source of non-zero magnitude, a short-circuited source, a loop of voltage sources).

BackendCapabilityError

If the backend cannot represent the world (for example three soil layers on image_2layer, or a strip on fem with FemOptions.model="axisymmetric").

Notes

Solving never rewrites the input world, whichever entry point is used (review finding 10.72; up to the calendar release only World.solve and run_simulation restored the sources, Engine.solve let a backend rewrite them).

The roll-back is identity-preserving (since 0.15.0): the field values recorded in the snapshot are written back onto the very objects that create_source() returned, and sources keeps its list object. A handle the caller is holding therefore stays live across an arbitrary number of solves, so the canonical sweep pattern

.. code-block:: python

src = gf.create_source(world, attached_to="g1", magnitude=10.0)
r1 = world.solve(engine)
src.magnitude = 20.0     # still attached to ``world``
r2 = world.solve(engine)

does what it reads like. Before 0.15.0 the snapshot list was rebound onto the world, which silently detached the caller's handles after the first solve and made every subsequent mutation a no-op.

Source code in src/groundfield/world.py
def solve(
    self,
    engine: "Engine",
    *,
    snapshot_sources: bool = True,
) -> "FieldResult":
    """Run the simulation with the given ``Engine``.

    Delegates to :meth:`Engine.solve`, so ``world.solve(engine)``,
    ``engine.solve(world)`` and :func:`groundfield.run_simulation`
    follow the same source-snapshot semantics: every :attr:`sources`
    entry is snapshotted before the backend runs and restored on
    exit, and the result records the sources as built.

    Parameters
    ----------
    engine
        The :class:`~groundfield.solver.engine.Engine` instance that
        drives the backend.
    snapshot_sources
        Deprecated. ``True`` (default) additionally guards the
        sources around ``engine.solve`` here, which protects against
        :class:`Engine` subclasses that override ``solve`` and
        mutate the world before delegating. ``False`` drops only
        that extra guard and emits a :class:`DeprecationWarning`:
        :meth:`Engine.solve` always takes the snapshot (it costs a
        deep copy of a few flat models), so the opt-out saves
        nothing. It will be removed no earlier than ``2027.5``.

    Returns
    -------
    FieldResult
        The result of :meth:`Engine.solve`.

    Raises
    ------
    TypeError
        If ``engine`` is not an :class:`Engine`.
    KeyError, ValueError
        If the world fails :meth:`check` (dangling source or
        conductor references, no source of non-zero magnitude, a
        short-circuited source, a loop of voltage sources).
    BackendCapabilityError
        If the backend cannot represent the world (for example three
        soil layers on ``image_2layer``, or a strip on ``fem`` with
        ``FemOptions.model="axisymmetric"``).

    Notes
    -----
    Solving never rewrites the input world, whichever entry point is
    used (review finding 10.72; up to the calendar release only
    ``World.solve`` and ``run_simulation`` restored the sources,
    ``Engine.solve`` let a backend rewrite them).

    The roll-back is **identity-preserving** (since 0.15.0): the
    field values recorded in the snapshot are written back onto the
    very objects that :func:`~groundfield.api.create_source`
    returned, and :attr:`sources` keeps its list object. A handle
    the caller is holding therefore stays live across an arbitrary
    number of solves, so the canonical sweep pattern

    .. code-block:: python

        src = gf.create_source(world, attached_to="g1", magnitude=10.0)
        r1 = world.solve(engine)
        src.magnitude = 20.0     # still attached to ``world``
        r2 = world.solve(engine)

    does what it reads like. Before 0.15.0 the snapshot list was
    rebound onto the world, which silently detached the caller's
    handles after the first solve and made every subsequent
    mutation a no-op.
    """
    # Local import to avoid a circular dependency at module load.
    from groundfield.solver.engine import Engine, _guarded_sources
    from groundfield.solver.registry import DEPRECATION_REMOVAL, warn_external

    if not isinstance(engine, Engine):
        raise TypeError(
            f"Expected an Engine, got {type(engine).__name__}. "
            "Build one with gf.create_engine(backend='image')."
        )
    # Central validation for every backend (10.66); the shared
    # injection step of the solver pipeline repeats it for callers
    # of Engine.solve.
    self.check()
    if not snapshot_sources:
        warn_external(
            "World.solve(snapshot_sources=False) is deprecated: "
            "Engine.solve always snapshots and restores the sources, "
            "so the opt-out saves nothing. The argument will be "
            f"removed no earlier than {DEPRECATION_REMOVAL}.",
            DeprecationWarning,
        )
        return engine.solve(self)
    # Engine.solve guards the sources itself; this outer guard (the
    # same identity-preserving roll-back, F31) also covers Engine
    # subclasses that override ``solve`` and mutate the world before
    # delegating to it.
    with _guarded_sources(self):
        return engine.solve(self)

summary

summary() -> str

Compact textual summary of the world.

Source code in src/groundfield/world.py
def summary(self) -> str:
    """Compact textual summary of the world."""
    soil_str = f"{self.soil.kind}" if self.soil is not None else "<no soil model>"
    junctions = f"junctions={len(self.junctions)}, " if self.junctions else ""
    return (
        f"World '{self.name}': soil={soil_str}, "
        f"electrodes={len(self.electrodes)}, "
        f"{junctions}"
        f"conductors={len(self.conductors)}, "
        f"sources={len(self.sources)}, "
        f"boundary.far_field={self.boundary.far_field}"
    )