shell.validate_network
shell.validate_network(elements, conn, area, require_connected=None)Check structural and area-consistency invariants before compiling.
Also normalizes element display names to be unique (see :func:ensure_unique_names) – duplicates, common with the factory defaults, are suffixed in place rather than rejected.
Raises ValueError (naming the offending element) on the first violation:
- every edge area is finite and strictly positive;
- each element’s wired port count is admissible – exactly
FIXED_NPORTSfor an element with a fixed port count,>= 2for the variable junction/splitter; - elements that do not permit an area change (
ALLOWS_AREA_CHANGEisFalse– the constant-area duct) carry one shared area across all their incident edges. An intended area change at an element indifferent to area (e.g. a sudden expansion) must use anisentropic_area_changeorsudden_area_changeelement; - a pressure reference exists (see :func:
_check_pressure_reference); - unless disabled, the elements form a single connected sub-network (see :func:
nefes.shell.checks.assert_single_component); - unless disabled, no edge joins an incompatible element-type pairing (see :func:
nefes.shell.checks.assert_allowed_connections).
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| elements | list of ElementSpec | The network elements, in node order. | required |
| conn | Connectivity | The compiled connectivity (per-node incident edges and degrees). | required |
| area | ndarray | Per-edge cross-sectional area, indexed by global edge id. | required |
| require_connected | bool | Reject a model that splits into disconnected sub-networks. None (default) follows the process-wide :data:nefes.shell.checks.CHECK_CONNECTED toggle; pass True / False to force the check on / off for this call. |
None |