|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
Functions | |
| list[Path] | _library_sources () |
| None | test_package_root_exists () |
| None | test_no_propssi_in_library_code (Path source) |
Variables | |
| str | PACKAGE_ROOT = Path(__file__).resolve().parents[1] / "feedtwin" |
| BANNED = re.compile(r"\b(PropsSI|Props1SI|HAPropsSI|PhaseSI)\s*\(") | |
| tuple | GUIDANCE |
The one rule Phase 00 exists to enforce: no ``PropsSI`` in library code.
CoolProp offers three ways to ask the same question. Measured on the development
host, nitrogen density at a fixed state point:
=========================================== ========== ============
call path per call throughput
=========================================== ========== ============
``PropsSI('D', 'T', t, 'P', p, 'Nitrogen')`` 184.5 us 5.4 k/s
``AbstractState('HEOS', ...)``, reused 3.18 us 315 k/s
``AbstractState('BICUBIC&HEOS', ...)`` 0.14 us 7.1 M/s
=========================================== ========== ============
That is a 1300x spread across three spellings of one line. ``PropsSI`` parses
its fluid name and rebuilds the backend on *every call*; the low-level interface
does that once. A stiff transient on a sixty-node network evaluates properties
millions of times over Jacobian assembly, so the choice is the difference
between a run that finishes in seconds and one that finishes overnight.
The failure mode this guards against is not someone deciding ``PropsSI`` is
fine. It is someone reaching for the convenient one-liner while debugging, in a
branch that only runs on the cold path, and it never being noticed -- because
nothing about it is wrong except how long it takes, and the profile of a slow
solve rarely names the line that caused it.
Tests are exempt. Comparing the two paths is exactly how the numbers above were
obtained, and the property layer's regression suite (Phase 01) will want the
reference implementation to check the tabulated one against.
|
protected |
Definition at line 53 of file test_property_call_discipline.py.
Referenced by test_package_root_exists().
| None test_property_call_discipline.test_no_propssi_in_library_code | ( | Path | source | ) |
No convenience CoolProp call anywhere under ``feedtwin/``.
Definition at line 64 of file test_property_call_discipline.py.
| None test_property_call_discipline.test_package_root_exists | ( | ) |
A moved package would make the scan below silently vacuous.
Definition at line 57 of file test_property_call_discipline.py.
References _library_sources().
| test_property_call_discipline.BANNED = re.compile(r"\b(PropsSI|Props1SI|HAPropsSI|PhaseSI)\s*\(") |
Definition at line 45 of file test_property_call_discipline.py.
| tuple test_property_call_discipline.GUIDANCE |
Definition at line 47 of file test_property_call_discipline.py.
| str test_property_call_discipline.PACKAGE_ROOT = Path(__file__).resolve().parents[1] / "feedtwin" |
Definition at line 38 of file test_property_call_discipline.py.