STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
test_pressurant_is_gas.py
Go to the documentation of this file.
1"""The pressurant is a gas wherever it is on the drawing.
2
3The team's rocket-and-GSE drawing vents the LOX tank through a mated QD pair
4and the cart's vent solenoid. Those cart nodes are neither in the pressurant
5reach nor painted with a tank's contents, so they were left with no declared
6phase and fell to the property layer's temperature rule. GN2 vented off a LOX
7tank chilling through Ox Fill crosses nitrogen's 126.2 K critical temperature,
8and from there the vent valve was priced on the saturated-*liquid* line:
9414 kg/m^3 at 125 K, 730 at 93 K, against ~2.7 for the gas -- the vent's
10back-pressure (about a psi at 12.6 g/s) vanished mid-load.
11"""
12
13from __future__ import annotations
14
15import json
16from pathlib import Path
17
18import pytest
19
20from feedtwin.pid import build_network, read_diagram
21
22DRAWING = Path(__file__).resolve().parent / "fixtures" / "le4_rocket_and_gse.json"
23
24
25def _built(): # type: ignore[no-untyped-def]
26 return build_network(
27 read_diagram(json.loads(DRAWING.read_text()), name="le4_rocket_and_gse")
28 )
29
30
32 net = _built().network
33 undeclared = sorted(
34 node_id
35 for node_id, node in net.nodes.items()
36 if node.fluid == "nitrogen" and node.phase != "gas"
37 )
38 assert undeclared == []
39
40
42 """A QD drawn with no Cv or Cd is priced as a long-radius elbow (K ~0.25,
43 a small fraction of a real disconnect's loss), and said so: the eight on
44 the team's drawing, four of them on the tank vent paths, were silent."""
45 built = _built()
46 from feedtwin.comps.elements import Fitting
47
48 unsized = sorted(
49 built.network.branches[n].component.id
50 for n in built.network.branches
51 if isinstance(built.network.branches[n].component, Fitting)
52 )
53 assert unsized, "the drawing has unsized disconnects"
54 notes = [w for w in built.warnings if "no Cv or Cd" in w]
55 assert len(notes) == 1
56 for label in unsized:
57 assert label in notes[0]
58
59
61 """Below 126 K, at the cart's LOX vent solenoid: p / (R T), not the
62 liquid line."""
63 net = _built().network
64 node_id = "node_58.in" # behind OU-QD-A, ahead of the cart's vent valve
65 assert net.nodes[node_id].fluid == "nitrogen"
66 net.nodes[node_id].temperature = 110.0
67 flow = net.conditions(node_id, 101325.0)
68 ideal = 101325.0 / (8314.46261815324 / 28.0134 * 110.0)
69 assert flow.rho == pytest.approx(ideal, rel=0.03)