|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
Classes | |
| class | Phase |
| class | PropertySpec |
| class | ThermoState |
Functions | |
| tuple[str, PropertySpec] | _spec (str name, str unit, str description) |
| PropertySpec | register_property (str name, str unit, str description) |
Variables | |
| dict | PROPERTIES |
What a property query returns, and the registry of what can be asked for. Two things live here, and they are deliberately the same concept seen twice: * :data:`PROPERTIES` -- the registry of every quantity the layer can produce. Adding one is a single entry here plus a line in whichever backends can compute it. Nothing else in the codebase enumerates properties. * :class:`ThermoState` -- an eager, immutable snapshot at one state point. **Everything is SI.** Pa, K, kg/m3, Pa.s, J/kg, J/(kg.K), W/(m.K), m/s. There is no unit handling inside the solver; conversion happens once at the schema boundary (Phase 02). A number that reaches this module is already SI. Why the snapshot is eager ------------------------- The obvious cheaper design is lazy: hold the backend and fetch properties on demand. It is a trap. Backend handles are mutable and reused -- a second query re-points the same handle -- so a lazily-evaluated state would silently answer with a *later* state point's numbers. Every field is therefore read before the snapshot is returned. That costs about eight backend reads where the solver's hot path needs one, so the hot path does not use snapshots at all: :meth:`Fluid.get` fetches a single property. :meth:`Fluid.state` is for reporting, diagnostics and frames.
|
protected |
| PropertySpec feedtwin.props.state.register_property | ( | str | name, |
| str | unit, | ||
| str | description ) |
Add a property to the registry at runtime. For quantities a project needs that this package does not ship -- a surface tension correlation, a user-supplied fouling factor. Backends that cannot compute it simply do not advertise it, and the fluid's chain falls through to one that can.
| dict feedtwin.props.state.PROPERTIES |