STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
injector_layout.py
Go to the documentation of this file.
1
"""Print the injector layout (engine/core/injectors/layout.py) for a config, as JSON.
2
3
python3 scripts/injector_layout.py configs/ethalox_8kN_SHIP.yaml
4
5
The config is evaluated at its tank pressures (lox_tank / fuel_tank ``initial_pressure_psi``) and
6
the solve's flows go to the layout, so it also reports the channels' velocity head, the orifices'
7
cavitation margin and the plate's bending at the solved Pc. ``--no-flows`` skips the solve:
8
geometry only, with the plate checked at ``target_chamber_pressure_psi``.
9
10
Regenerate the frontend's drawing fixture (geometry only, so it does not move with the physics):
11
12
python3 scripts/injector_layout.py --no-flows configs/ethalox_6500N.yaml \
13
> frontend/src/components/__fixtures__/layout_6500N.json
14
"""
15
import
copy
16
import
json
17
import
sys
18
from
pathlib
import
Path
19
20
import
yaml
21
22
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
23
from
engine.core.injectors.layout
import
flows_from_result, layout_from_config
# noqa: E402
24
25
PSI = 6894.757
26
27
28
def
solved_flows
(path: str):
29
"""The flows of ``path`` evaluated at its tank pressures."""
30
from
engine.core.runner
import
PintleEngineRunner
31
from
engine.pipeline.io
import
load_config
32
c = load_config(path)
33
r = PintleEngineRunner(copy.deepcopy(c)).evaluate(
34
c.lox_tank.initial_pressure_psi * PSI, c.fuel_tank.initial_pressure_psi * PSI, silent=
True
)
35
return
flows_from_result(r, c)
36
37
38
if
__name__ ==
"__main__"
:
39
args = [a
for
a
in
sys.argv[1:]
if
a !=
"--no-flows"
]
40
path = args[0]
41
flows =
None
if
"--no-flows"
in
sys.argv[1:]
else
solved_flows
(path)
42
with
open(path)
as
fh:
43
print(json.dumps(layout_from_config(yaml.safe_load(fh), flows=flows), indent=1, sort_keys=
True
))
engine.core.injectors.layout
Definition
layout.py:1
engine.core.runner
Definition
runner.py:1
engine.pipeline.io
Definition
io.py:1
injector_layout.solved_flows
solved_flows(str path)
Definition
injector_layout.py:28
EngineDesign
scripts
injector_layout.py
Generated by
1.15.0