58 """Saturation temperature and liquid density at 1 atm."""
60 state = fluid.state(p=ATM, q=0.0)
62 assert state.T == pytest.approx(T_sat, rel=5e-3)
63 assert state.rho == pytest.approx(rho_liquid, rel=5e-3)
64 assert state.phase
is Phase.TWO_PHASE
65 assert state.quality == pytest.approx(0.0, abs=1e-9)
68@pytest.mark.parametrize("name,Tc,Pc_MPa", CRITICAL_POINTS)
70 """The species resolves to the fluid we think it does.
72 Read through CoolProp's trivial-property interface rather than a state
73 query, because the critical point is a property of the substance and not of
76 import CoolProp.CoolProp
as CP
78 backend_fluid =
Fluid(name).species.backend_fluid
79 assert CP.PropsSI(
"Tcrit", backend_fluid) == pytest.approx(Tc, rel=1e-4)
80 assert CP.PropsSI(
"Pcrit", backend_fluid) == pytest.approx(Pc_MPa * 1e6, rel=5e-3)
127 """Interpolated tables agree with the equation of state behind them.
129 The check with no external reference: it does not ask whether either path
130 is right, only that they are the same. That is what catches a stale table
131 cache after a CoolProp upgrade -- a failure mode with no other symptom,
132 because both paths keep returning confident numbers.
134 1e-3 relative: bicubic interpolation error, not agreement to machine
135 precision, which tables cannot give.
137 fast =
Fluid(name, chain=[
"bicubic"])
138 exact =
Fluid(name, chain=[
"heos"])
143 assert fast.get(prop, p=p, T=T) == pytest.approx(
144 exact.get(prop, p=p, T=T), rel=1e-3
static ActuatorControllerState state