Skip to content

Process acceptance

Post-solve physical audits of process results: audit_stream for a stream's phase state, audit_balance for component and energy closure at a boundary, the checked unit wrappers (flash_drum_checked, heater_checked, valve_checked), and audit_flowsheet over declared BalanceBoundary objects. See the measured qualification guide for the criteria and their limits.

acceptance

Process acceptance using the thermodynamic package's physical criteria.

Audit stream phase inventories and unit/plant boundaries after solving. This keeps stability searches out of recycle iterations while ensuring accepted process results carry equilibrium, material, energy, and applicability evidence.

Classes:

Name Description
CheckedUnit

Unit result, endpoint thermodynamic evidence, and an independent balance.

BalanceBoundary

Named process boundary with its heat and shaft work into the fluid.

Functions:

Name Description
audit_stream

Verify a stream's preserved phase inventory, or resolve an unspecified PT state.

audit_balance

Check component and enthalpy flow closure at an explicit process boundary.

heater_checked

Run a heater, then verify both states and its component/energy balance.

valve_checked

Run an isenthalpic valve with independent endpoint and balance checks.

flash_drum_checked

Run a flash drum, then verify both outlet states and its balance.

audit_flowsheet

Audit a solved flowsheet's streams and explicitly declared process boundaries.

CheckedUnit

Bases: NamedTuple

Unit result, endpoint thermodynamic evidence, and an independent balance.

Methods:

Name Description
check

Raise at a host boundary before a failed result is used downstream.

to_dict

Serialize acceptance evidence independently of the unit's output type.

Attributes:

Name Type Description
accepted Array

Whether all endpoint states and the process boundary passed.

accepted property

accepted: Array

Whether all endpoint states and the process boundary passed.

check

check() -> None

Raise at a host boundary before a failed result is used downstream.

to_dict

to_dict() -> dict[str, Any]

Serialize acceptance evidence independently of the unit's output type.

BalanceBoundary dataclass

BalanceBoundary(
    inputs: tuple[str, ...],
    outputs: tuple[str, ...],
    heat: float = 0.0,
    work: float = 0.0,
    units: tuple[str, ...] = (),
)

Named process boundary with its heat and shaft work into the fluid.

The boundary's heat and work are the explicit heat and work plus the heat and work a solved fugacio.sim.Flowsheet retained for each unit named in units.

audit_stream

audit_stream(
    stream: Stream,
    model: PropertyPackage,
    *,
    policy: AcceptancePolicy = DEFAULT_POLICY,
) -> PhysicalReport

Verify a stream's preserved phase inventory, or resolve an unspecified PT state.

Empty streams have no meaningful equilibrium composition and are rejected by this physical audit. Their structural Stream.report remains available.

audit_balance

audit_balance(
    inputs: tuple[Stream, ...],
    outputs: tuple[Stream, ...],
    model: PropertyPackage,
    *,
    heat: Array | float = 0.0,
    work: Array | float = 0.0,
    component_generation: Array | None = None,
    tolerance: float = 1e-07,
) -> SolveReport

Check component and enthalpy flow closure at an explicit process boundary.

Heat and shaft work are positive into the fluid (watts). Reactions must supply net component generation in mol/s and use a formation-consistent enthalpy package. All streams must share package component order.

heater_checked

heater_checked(
    feed: Stream,
    *,
    model: PropertyPackage,
    policy: AcceptancePolicy = DEFAULT_POLICY,
    **options: Any,
) -> CheckedUnit

Run a heater, then verify both states and its component/energy balance.

valve_checked

valve_checked(
    feed: Stream,
    p_out: Array | float,
    *,
    model: PropertyPackage,
    policy: AcceptancePolicy = DEFAULT_POLICY,
    **options: Any,
) -> CheckedUnit

Run an isenthalpic valve with independent endpoint and balance checks.

flash_drum_checked

flash_drum_checked(
    feed: Stream,
    t: Array | float,
    p: Array | float,
    *,
    model: PropertyPackage,
    policy: AcceptancePolicy = DEFAULT_POLICY,
) -> CheckedUnit

Run a flash drum, then verify both outlet states and its balance.

Every outlet is audited for equilibrium, stability (including a second liquid), and applicability. Call .check() on the result to raise a fugacio.thermo.acceptance.PhysicalAcceptanceError naming the failed criterion; the returned values have nonfinite derivatives when rejected.

audit_flowsheet

audit_flowsheet(
    result: Any,
    model: PropertyPackage,
    *,
    boundaries: dict[str, BalanceBoundary],
    policy: AcceptancePolicy = DEFAULT_POLICY,
) -> dict[str, Any]

Audit a solved flowsheet's streams and explicitly declared process boundaries.

result is a fugacio.sim.flowsheet.FlowsheetResult (from Flowsheet.solve_with_info) or an equation-oriented solution. Boundary heat and work come from the solved units a boundary names (retained by the flowsheet result) plus its explicit values: a list of endpoints alone can't establish energy conservation. Numerical failures are retained, and no missing boundary is advertised as checked.

Raises:

Type Description
ValueError

With no boundaries, or for a boundary naming a unit whose heat and work the result didn't retain.