shell.build_problem
shell.build_problem(
thermo,
elements,
edges,
mdot_ref,
p_ref,
h_ref,
edge_models=None,
require_connected=None,
)Assemble a CompiledProblem from elements and directed (tail, head, area) edges.
The lower-level functional builder; the user-facing path is :class:nefes.shell.network.Network, whose constructor accepts the same nodes / edges lists (and auto-derives the reference scales), then .solve(). Ports are auto-assigned in attachment order; use :func:build_problem_from_connectivity to supply explicit ports (e.g. a UI export where the port ordinals carry meaning).
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| thermo | ThermoConfig | The thermodynamic model (perfect gas, frozen, or reacting equilibrium). | required |
| elements | list of ElementSpec | The network elements, in node order. | required |
| edges | list of tuple | Directed (tail, head, area) edges referencing node indices. |
required |
| mdot_ref | float | Reference mass flow, pressure and total enthalpy for the residual/variable scaling. | required |
| p_ref | float | Reference mass flow, pressure and total enthalpy for the residual/variable scaling. | required |
| h_ref | float | Reference mass flow, pressure and total enthalpy for the residual/variable scaling. | required |
| edge_models | sequence of int | Per-edge thermo-model id override aligned with edges; None uses the config’s model on every edge. |
None |
| require_connected | bool | Reject a model that splits into disconnected sub-networks; None (default) follows the :data:nefes.shell.checks.CHECK_CONNECTED toggle. |
None |
Returns
| Name | Type | Description |
|---|---|---|
| CompiledProblem | The immutable compiled problem ready for the solver. |