STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
spray_report.py
Go to the documentation of this file.
1"""Spray and mixing report for a design at its own tank pressures.
2
3 python3 scripts/spray_report.py configs/<design>.yaml [--no-sensitivity]
4
5engine/core/injectors/spray_report.py builds it; the Geometry tab shows the same report.
6"""
7import argparse
8import sys
9from pathlib import Path
10
11sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
12
13
14def main() -> None:
15 ap = argparse.ArgumentParser()
16 ap.add_argument("config")
17 ap.add_argument("--no-sensitivity", action="store_true")
18 a = ap.parse_args()
19 from engine.pipeline.io import load_config
20 from engine.core.injectors.spray_report import spray_mixing_report
21 rep = spray_mixing_report(load_config(a.config), with_sensitivity=not a.no_sensitivity)
22 d = rep["design"]
23 print(f"{a.config}: F {d['F']:.0f} N, Pc {d['Pc_psia']:.1f} psia, O/F {d['OF']:.3f}, Isp {d['Isp']:.1f} s")
24 for sec in rep["sections"]:
25 print(f"\n{sec['title']}")
26 for r in sec["rows"]:
27 v = r["value"]
28 vs = f"{v:.4g}" if isinstance(v, float) else str(v)
29 print(f" {r['status']:4s} {r['label']:34s} {vs:>10s} {r['unit']:14s} {r['band']:24s} {r['note']}")
30 if rep["sensitivity"]:
31 print("\nWhat it rests on (re-solved as written)")
32 print(f" {'case':38s}{'F N':>8s}{'Isp s':>8s}{'Pc psia':>9s}{'O/F':>7s}{'η c*':>8s}{'η vap':>8s}{'η mix':>8s}{'fuel vap':>9s}")
33 for s in rep["sensitivity"]:
34 if "error" in s:
35 print(f" {s['case']:38s} did not solve: {s['error']}")
36 continue
37 print(f" {s['case']:38s}{s['F']:8.0f}{s['Isp']:8.1f}{s['Pc_psia']:9.1f}{s['OF']:7.3f}"
38 f"{s['eta_cstar']:8.4f}{s['eta_vap']:8.4f}{s['eta_mix']:8.4f}{s['vap_F'] * 100:8.1f}%"
39 + ("" if s["applied"] else " <-- NOT APPLIED"))
40
41
42if __name__ == "__main__":
43 main()