STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
test_time_varying_stability_inputs.py
Go to the documentation of this file.
1"""The chug margin over a burn uses the closure's own injector drops and SMDs.
2
3The time-varying solve (and the runner's array path) passed the stability analysis only the flows
4and tank pressures, so it fell back to placeholder drops (0.30*Pc injector, 0.10*Pc feed) and
5SMDs (80/60 um): GM 1.290 against forward mode's 1.479 at the same point on the 6.8 kN engine.
6Checked against forward mode, which passes the closure's diagnostics: at the same tank pressures
7and t = 0 (no erosion yet) the two must agree.
8"""
9import copy
10import os
11import sys
12
13import numpy as np
14import pytest
15
16sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
17
18from engine.core.runner import PintleEngineRunner # noqa: E402
19from engine.pipeline.io import load_config # noqa: E402
20
21CFG = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "configs", "ethalox_6800N.yaml")
22PSI = 6894.757293168361
23
24
25@pytest.fixture(autouse=True)
26def _python_physics(monkeypatch):
27 monkeypatch.setenv("ED_ACCEL", "off")
28
29
31 cfg = load_config(CFG)
32 P = 578.0 * PSI
33 forward = PintleEngineRunner(copy.deepcopy(cfg)).evaluate(P, P, P_ambient=94070.0, silent=True)
34 gm = forward["stability_results"]["chugging"]["stability_margin"]
35 t = np.array([0.0, 0.05])
36 series = PintleEngineRunner(copy.deepcopy(cfg)).evaluate_arrays_with_time(
37 t, np.full(2, P), np.full(2, P), use_coupled_solver=True, P_ambient=94070.0)
38 assert float(series["chugging_stability_margin"][0]) == pytest.approx(gm, rel=1e-6)