STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
test_props_chain Namespace Reference

Functions

None test_ordinary_states_are_served_by_the_tables ()
None test_the_chain_falls_through_to_the_equation_of_state (str label, dict[str, float] state)
None test_the_tables_refuse_rather_than_extrapolate (str label, dict[str, float] state)
None test_an_exhausted_chain_preserves_why (str label, dict[str, float] state)
None test_a_state_nothing_can_serve_raises_and_explains ()
None test_impossible_inputs_are_rejected_before_any_backend (dict[str, float] state, str expected)
None test_unknown_property_and_unknown_fluid_say_what_is_available ()
None test_an_unformable_state_lists_the_valid_pairs ()
None test_accessor_and_get_agree_including_argument_order ()
None test_accessor_falls_through_the_chain_too ()
None test_quality_is_none_outside_the_dome_not_a_sentinel ()
None test_the_chain_is_visible ()
None test_a_declared_liquid_is_solved_as_a_liquid ()
None test_multiphase_is_opt_in_and_changes_the_answer ()
None test_a_pressurant_is_untouched_by_the_liquid_rule ()
None test_a_network_defaults_to_single_phase ()

Variables

 IN_TABLES = dict(p=1.0e7, T=300.0)
list PAST_THE_TABLES

Detailed Description

The fallback chain, and refusing to answer when there is no honest answer.

The chain is the design (see :mod:`feedtwin.props.fluid`): fast tables first,
the equation of state behind them, measured data in front when there is any.
These tests hold it to the two promises that make it safe to rely on --

* a state point the fast backend cannot reach is **served by the next one**,
  not failed and not guessed at; and
* a state point *nothing* can serve **raises**, naming what each backend said,
  rather than returning a number.

The second matters more than it looks. Every backend in this package refuses
outside its envelope, so the only way a wrong number gets out is if this layer
invents one.

Function Documentation

◆ test_a_declared_liquid_is_solved_as_a_liquid()

None test_props_chain.test_a_declared_liquid_is_solved_as_a_liquid ( )
The default is *not* to infer phase from ``(p, T)``.

Asking the property layer to decide has failed twice here from two
different causes, and both times silently: oxygen at an ambient default is
a gas at 40 kg/m^3 where LOX is 1140, so the leg solves at a thirtieth of
the density and every number after it stays plausible. Below the critical
point a declared fluid is evaluated on its saturated-liquid line, which
cannot come back as a gas whatever pressure the solve is guessing.

Definition at line 188 of file test_props_chain.py.

◆ test_a_network_defaults_to_single_phase()

None test_props_chain.test_a_network_defaults_to_single_phase ( )

Definition at line 231 of file test_props_chain.py.

◆ test_a_pressurant_is_untouched_by_the_liquid_rule()

None test_props_chain.test_a_pressurant_is_untouched_by_the_liquid_rule ( )
Nitrogen at 4500 psi and room temperature is supercritical -- there is no
liquid line to sit on, and forcing one would be nonsense.

Definition at line 221 of file test_props_chain.py.

◆ test_a_state_nothing_can_serve_raises_and_explains()

None test_props_chain.test_a_state_nothing_can_serve_raises_and_explains ( )
The error names every backend and what it said.

Definition at line 95 of file test_props_chain.py.

◆ test_accessor_and_get_agree_including_argument_order()

None test_props_chain.test_accessor_and_get_agree_including_argument_order ( )
A positional API must honour the order the caller declared.

Definition at line 144 of file test_props_chain.py.

◆ test_accessor_falls_through_the_chain_too()

None test_props_chain.test_accessor_falls_through_the_chain_too ( )
The fast path must not lose the fallback it was optimised around.

The point is off the table and served by the equation of state, so the
number is the equation of state's -- not, as it was, a density
extrapolated into solid nitrogen. See :data:`PAST_THE_TABLES`.

Definition at line 153 of file test_props_chain.py.

◆ test_an_exhausted_chain_preserves_why()

None test_props_chain.test_an_exhausted_chain_preserves_why ( str label,
dict[str, float] state )
A chain of only the tables fails, and the OutOfRange survives as the cause.

Definition at line 87 of file test_props_chain.py.

◆ test_an_unformable_state_lists_the_valid_pairs()

None test_props_chain.test_an_unformable_state_lists_the_valid_pairs ( )

Definition at line 139 of file test_props_chain.py.

◆ test_impossible_inputs_are_rejected_before_any_backend()

None test_props_chain.test_impossible_inputs_are_rejected_before_any_backend ( dict[str, float] state,
str expected )
A negative pressure should say so, not fail inside a root find.

Handed p < 0, CoolProp reports that a Brent bracket does not contain a
root -- true, useless, and three layers below the mistake. NaN matters even
more: it is what a diverging solve produces, and propagating it would turn
one bad iteration into a plausible-looking density.

Definition at line 115 of file test_props_chain.py.

◆ test_multiphase_is_opt_in_and_changes_the_answer()

None test_props_chain.test_multiphase_is_opt_in_and_changes_the_answer ( )
It has to be reachable, and it has to actually do something -- a flag
that quietly does nothing is worse than no flag.

Definition at line 208 of file test_props_chain.py.

◆ test_ordinary_states_are_served_by_the_tables()

None test_props_chain.test_ordinary_states_are_served_by_the_tables ( )

Definition at line 49 of file test_props_chain.py.

References state.

◆ test_quality_is_none_outside_the_dome_not_a_sentinel()

None test_props_chain.test_quality_is_none_outside_the_dome_not_a_sentinel ( )
CoolProp reports -1 or -1000 for "not two-phase"; neither may escape.

A sentinel that survives into a mass balance is read as a vapour fraction,
and -1000 kg of vapour does not raise anything.

Definition at line 164 of file test_props_chain.py.

◆ test_the_chain_falls_through_to_the_equation_of_state()

None test_props_chain.test_the_chain_falls_through_to_the_equation_of_state ( str label,
dict[str, float] state )
Past the tables, the equation of state answers -- and says it did.

Definition at line 54 of file test_props_chain.py.

References state.

◆ test_the_chain_is_visible()

None test_props_chain.test_the_chain_is_visible ( )
Which sources a fluid is using is inspectable, not implicit.

Definition at line 176 of file test_props_chain.py.

◆ test_the_tables_refuse_rather_than_extrapolate()

None test_props_chain.test_the_tables_refuse_rather_than_extrapolate ( str label,
dict[str, float] state )
Pinned on the backend itself, because the whole design leans on it.

If the tabulated backend ever started extrapolating instead of raising,
every test above would still pass -- the chain would simply never fall
through, and would return quietly wrong numbers at the edges. This is the
test that would notice.

Asserted one level below :class:`Fluid` deliberately: through a fluid, an
exhausted chain reports :class:`PropertyError` summarising every backend's
reason, which is right for a caller but too coarse to prove *this* backend
refused for *this* reason.

Definition at line 64 of file test_props_chain.py.

◆ test_unknown_property_and_unknown_fluid_say_what_is_available()

None test_props_chain.test_unknown_property_and_unknown_fluid_say_what_is_available ( )

Definition at line 129 of file test_props_chain.py.

Variable Documentation

◆ IN_TABLES

test_props_chain.IN_TABLES = dict(p=1.0e7, T=300.0)

Definition at line 23 of file test_props_chain.py.

◆ PAST_THE_TABLES

list test_props_chain.PAST_THE_TABLES
Initial value:
1= [
2 ("above the temperature ceiling", dict(p=1.0e7, T=3000.0)),
3 ("below the pressure floor", dict(p=1.0, T=300.0)),
4 ("far below the pressure floor", dict(p=1.0e-3, T=300.0)),
5]

Definition at line 42 of file test_props_chain.py.