aquakin.Stream#
- class aquakin.Stream(Q, C, model, scalars=<factory>)[source]#
Bases:
objectA flow stream — bulk volumetric rate plus a concentration vector.
Streams are produced by a unit’s
compute_outputsand consumed by downstream units’rhs/compute_outputscalls. They are intentionally immutable per evaluation: a connection delivers the upstream output directly, with optionalStateTranslatorinterposed for cross-model mappings.- Variables:
Q (jnp.ndarray) – Volumetric flow rate (scalar), units must be consistent across the plant (typically m³/d for BSM-family plants).
C (jnp.ndarray) – Concentration vector, shape
(n_species,)where species ordering ismodel.species.model (CompiledModel) – The kinetic model whose species ordering applies to
C.scalars (Mapping[str, jnp.ndarray]) –
Per-stream side-channel scalars carried algebraically through the flowsheet alongside
Q/C– a single open-ended map rather than a fixed field per quantity, so a new carried scalar needs no new field, nowith_*copier and nomixed_*combiner. Multi-inlet units combine them with the one sharedmixed_scalars(); pass-through units forward them unchanged (scalars=s_in.scalars). A scalar absent from the map means the stream does not carry it (an agnostic feed / a zero-flow recycle seed); its presence is a static structural property (consistent across RHS calls), so callers stay jit-safe. The two used today are:"T"– stream temperature (K); reactors read their inlet temperature from it for temperature-dependent kinetics and fall back to their static condition when it is absent."org"– indicator-organism density (e.g. CFU/100 mL) for disinfection; a disinfection unit reduces it by the computed log-inactivation and falls back to its designinlet_densitywhen it is absent.
Read a scalar with
stream.scalars.get(name)(Noneif not carried); build the map for a leaf stream withmake_scalars(), which drops the agnostic (None) entries.
- Parameters:
Q (jnp.ndarray)
C (jnp.ndarray)
model (CompiledModel)
scalars (Mapping[str, jnp.ndarray])
- __init__(Q, C, model, scalars=<factory>)#
- Parameters:
Q (jnp.ndarray)
C (jnp.ndarray)
model (CompiledModel)
scalars (Mapping[str, jnp.ndarray])
- Return type:
None
Methods
__init__(Q, C, model[, scalars])Per-species mass flow rate
Q * C, shape(n_species,).with_C(C)Return a new stream with a new
Cvector, everything else (including the side-channelscalars) preserved.with_Q(Q)Return a new stream with a new flow rate, everything else (including the side-channel
scalars) preserved.Attributes
QCmodelscalars