STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
test_engine Namespace Reference

Functions

dict[str, object] impinging_config ()
None test_a_real_layer1_config_imports_with_nothing_retyped ()
None test_every_shipped_config_imports ()
None test_import_from_a_parsed_config ()
None test_a_missing_key_names_itself_and_where_it_looked ()
None test_an_unknown_propellant_is_refused_with_a_suggestion ()
None test_an_unknown_injector_type_is_refused_not_guessed ()
None test_propellant_aliases_cover_both_naming_conventions ()
None test_impinging_area_is_n_round_jets ()
None test_pintle_uses_orifices_on_one_side_and_an_annulus_on_the_other ()
None test_coaxial_uses_core_ports_and_an_outer_annulus ()
None test_injector_types_are_registered_not_hardcoded ()
None test_cd_follows_the_engine_design_correlation ()
None test_cd_is_clamped_at_both_ends ()
None test_cd_rises_with_flow ()
None test_injector_leg_follows_the_orifice_relation ()
None test_injector_dp_is_symmetric_and_quadratic ()
None test_injector_stiffness_at_the_design_point_is_sane ()
None test_chamber_pressure_is_mdot_cstar_over_throat ()
None test_a_shut_engine_sits_at_ambient_not_at_vacuum ()
None test_chamber_at_altitude_takes_a_different_floor ()
None test_chamber_fill_time_is_milliseconds ()
None test_cea_table_reproduces_real_combustion ()
None test_cstar_peaks_below_the_stoichiometric_ratio ()
None test_leaving_the_table_is_reported_not_absorbed ()
None test_chamber_temperature_moves_with_mixture_ratio ()
None test_the_chamber_loop_absorbs_part_of_an_upstream_change ()
None test_the_current_vehicle_engine_imports ()
None test_ethalox_cstar_peaks_where_the_optimiser_put_the_mixture_ratio ()
None test_ethalox_injector_stiffness_is_in_the_design_band ()
( None) test_a_config_that_disagrees_with_itself_resolves_to_intent_and_records_it ()
None test_a_consistent_config_warns_about_nothing ()
None test_the_geometry_cd_model_is_honoured_when_the_config_asks_for_it ()
 _config_with (tmp_path, **overrides)
None test_thrust_resolves_like_mixture_ratio_and_chamber_pressure (tmp_path)
None test_thrust_falls_back_when_no_target_is_stated (tmp_path)
None test_agreeing_thrust_values_are_not_flagged (tmp_path)

Variables

str ENGINE_DESIGN = Path(__file__).resolve().parents[3] / "EngineDesign"
str REAL_CONFIG = ENGINE_DESIGN / "configs" / "impinging_lox_ch4_8000N_optimal.yaml"
str REAL_CACHE = ENGINE_DESIGN / "output" / "cache" / "cea_cache_LOX_CH4_3D.npz"
 needs_engine_design
 needs_cea
str ETHALOX = ENGINE_DESIGN / "configs" / "ethalox_doublet_7000N.yaml"
str ETHALOX_CACHE = ENGINE_DESIGN / "output" / "cache" / "cea_cache_LOX_Ethanol_3D.npz"
 needs_ethalox

Detailed Description

Phase 08: a Layer-1 engine dropped onto the end of a feed system.

The promise being tested is narrow and checkable: **point it at what the
optimizer wrote, and nothing gets retyped.** So most of these tests read real
EngineDesign configs off disk when the sibling repo is present, and fall back to
inline fixtures when it is not -- the fixtures are copied from the real schema,
so a schema change breaks the on-disk tests loudly rather than leaving the
inline ones passing against a format nobody uses any more.

The two things that fail silently get the most attention. An **injector area**
from the wrong formula is a wrong mass flow and every number downstream stays
plausible, so each injector type's area is checked against its closed form. And
a **combustion table read outside its range** returns a clamped number that
looks like a physical plateau, so extrapolation is surfaced rather than absorbed.

Function Documentation

◆ _config_with()

test_engine._config_with ( tmp_path,
** overrides )
protected
The shipped ethalox config with a couple of keys changed.

Built from the real file rather than a hand-rolled dict: the importer
legitimately requires a full injector geometry, and a synthetic fixture
would be testing the fixture.

Definition at line 561 of file test_engine.py.

Referenced by test_agreeing_thrust_values_are_not_flagged(), test_thrust_falls_back_when_no_target_is_stated(), and test_thrust_resolves_like_mixture_ratio_and_chamber_pressure().

◆ impinging_config()

◆ test_a_config_that_disagrees_with_itself_resolves_to_intent_and_records_it()

( None ) test_engine.test_a_config_that_disagrees_with_itself_resolves_to_intent_and_records_it ( )
The ethalox config carries its design point twice, and they disagree.

``chamber_geometry`` is what the geometry was last sized at:
``design_MR`` 2.55, a leftover from when this config was LOX/methane, and
``design_pressure`` 350 psi. ``design_requirements`` is what the optimiser
was told to hit: ``optimal_of_ratio`` 1.65, where the LOX/ethanol c*
actually peaks, and ``target_chamber_pressure_psi`` 420.

**Intent wins**, for both. The geometry block goes stale every time a
config is re-run or switches propellant pair, so a disagreement is the
normal state of a config being worked on -- and this used to raise a
warning on it, which is how a healthy config came to shout at its operator
twice on every import.

Not silently, though. Which field was used, and what the other one said, is
recorded in provenance, so the choice is auditable without being noise.

Definition at line 503 of file test_engine.py.

◆ test_a_consistent_config_warns_about_nothing()

None test_engine.test_a_consistent_config_warns_about_nothing ( )
A warning that fires on healthy input is noise, and noise gets ignored.

Definition at line 541 of file test_engine.py.

◆ test_a_missing_key_names_itself_and_where_it_looked()

None test_engine.test_a_missing_key_names_itself_and_where_it_looked ( )
An import failure saying only 'missing field' sends someone hunting.

Definition at line 135 of file test_engine.py.

References impinging_config().

◆ test_a_real_layer1_config_imports_with_nothing_retyped()

None test_engine.test_a_real_layer1_config_imports_with_nothing_retyped ( )
The Phase 08 promise, against the file the optimizer actually wrote.

Definition at line 98 of file test_engine.py.

◆ test_a_shut_engine_sits_at_ambient_not_at_vacuum()

None test_engine.test_a_shut_engine_sits_at_ambient_not_at_vacuum ( )
Not a numerical guard: a chamber is open to atmosphere through its nozzle.

Without this the loop drives chamber pressure toward zero when nothing is
flowing, and then asks the feed system to solve a 650 psi drop into 0.5 psi
-- a state no hardware occupies and no solver enjoys.

Definition at line 316 of file test_engine.py.

◆ test_agreeing_thrust_values_are_not_flagged()

None test_engine.test_agreeing_thrust_values_are_not_flagged ( tmp_path)
A warning that fires on healthy input teaches people to skim past it.

Definition at line 606 of file test_engine.py.

References _config_with().

◆ test_an_unknown_injector_type_is_refused_not_guessed()

None test_engine.test_an_unknown_injector_type_is_refused_not_guessed ( )
A wrong area is a wrong mass flow, and everything after it looks fine.

Definition at line 155 of file test_engine.py.

References impinging_config().

◆ test_an_unknown_propellant_is_refused_with_a_suggestion()

None test_engine.test_an_unknown_propellant_is_refused_with_a_suggestion ( )

Definition at line 148 of file test_engine.py.

References impinging_config().

◆ test_cd_follows_the_engine_design_correlation()

None test_engine.test_cd_follows_the_engine_design_correlation ( )
Must agree with EngineDesign's own answer or the two model different hardware.

Definition at line 231 of file test_engine.py.

References impinging_config(), max, and min.

◆ test_cd_is_clamped_at_both_ends()

None test_engine.test_cd_is_clamped_at_both_ends ( )

Definition at line 242 of file test_engine.py.

References impinging_config().

◆ test_cd_rises_with_flow()

None test_engine.test_cd_rises_with_flow ( )
Low-Re Cd is materially below its high-Re value, which matters at startup.

Definition at line 254 of file test_engine.py.

References impinging_config().

◆ test_cea_table_reproduces_real_combustion()

None test_engine.test_cea_table_reproduces_real_combustion ( )

Definition at line 345 of file test_engine.py.

◆ test_chamber_at_altitude_takes_a_different_floor()

None test_engine.test_chamber_at_altitude_takes_a_different_floor ( )

Definition at line 332 of file test_engine.py.

◆ test_chamber_fill_time_is_milliseconds()

None test_engine.test_chamber_fill_time_is_milliseconds ( )
Why the chamber is quasi-steady: it responds 1000x faster than the feed.

Definition at line 337 of file test_engine.py.

◆ test_chamber_pressure_is_mdot_cstar_over_throat()

None test_engine.test_chamber_pressure_is_mdot_cstar_over_throat ( )

Definition at line 308 of file test_engine.py.

◆ test_chamber_temperature_moves_with_mixture_ratio()

None test_engine.test_chamber_temperature_moves_with_mixture_ratio ( )
The output that makes O/F drift visible instead of merely tracked.

Definition at line 384 of file test_engine.py.

◆ test_coaxial_uses_core_ports_and_an_outer_annulus()

None test_engine.test_coaxial_uses_core_ports_and_an_outer_annulus ( )

Definition at line 206 of file test_engine.py.

◆ test_cstar_peaks_below_the_stoichiometric_ratio()

None test_engine.test_cstar_peaks_below_the_stoichiometric_ratio ( )
A real physical shape, not a monotone fit: LOX/CH4 peaks near O/F 2.8.

Definition at line 357 of file test_engine.py.

References max.

◆ test_ethalox_cstar_peaks_where_the_optimiser_put_the_mixture_ratio()

None test_engine.test_ethalox_cstar_peaks_where_the_optimiser_put_the_mixture_ratio ( )
A cross-check between the two tools, not a restatement of one of them.

The config asks for ``optimal_of_ratio: 1.65``. Reading c* straight off the
CEA table the optimiser used, the peak should land there — and if it does
not, one of the two is looking at the wrong propellant pair.

Definition at line 464 of file test_engine.py.

References max.

◆ test_ethalox_injector_stiffness_is_in_the_design_band()

None test_engine.test_ethalox_injector_stiffness_is_in_the_design_band ( )
The config asks for 20–30% injector stiffness on both legs.

Definition at line 482 of file test_engine.py.

◆ test_every_shipped_config_imports()

None test_engine.test_every_shipped_config_imports ( )
A schema drift in EngineDesign should break here, loudly.

Definition at line 113 of file test_engine.py.

◆ test_impinging_area_is_n_round_jets()

None test_engine.test_impinging_area_is_n_round_jets ( )

Definition at line 176 of file test_engine.py.

References impinging_config().

◆ test_import_from_a_parsed_config()

None test_engine.test_import_from_a_parsed_config ( )

Definition at line 129 of file test_engine.py.

References impinging_config().

◆ test_injector_dp_is_symmetric_and_quadratic()

None test_engine.test_injector_dp_is_symmetric_and_quadratic ( )

Definition at line 277 of file test_engine.py.

References impinging_config().

◆ test_injector_leg_follows_the_orifice_relation()

None test_engine.test_injector_leg_follows_the_orifice_relation ( )

Definition at line 266 of file test_engine.py.

References impinging_config().

◆ test_injector_stiffness_at_the_design_point_is_sane()

None test_engine.test_injector_stiffness_at_the_design_point_is_sane ( )
A sanity check on the imported areas, in the units a designer thinks in.

Definition at line 287 of file test_engine.py.

References impinging_config().

◆ test_injector_types_are_registered_not_hardcoded()

None test_engine.test_injector_types_are_registered_not_hardcoded ( )

Definition at line 219 of file test_engine.py.

◆ test_leaving_the_table_is_reported_not_absorbed()

None test_engine.test_leaving_the_table_is_reported_not_absorbed ( )
A clamped c* looks like a physical plateau on a plot. It is a table edge.

Definition at line 368 of file test_engine.py.

References table.contains().

◆ test_pintle_uses_orifices_on_one_side_and_an_annulus_on_the_other()

None test_engine.test_pintle_uses_orifices_on_one_side_and_an_annulus_on_the_other ( )
The asymmetry is the trap: one formula applied to both is silently wrong.

Definition at line 185 of file test_engine.py.

◆ test_propellant_aliases_cover_both_naming_conventions()

None test_engine.test_propellant_aliases_cover_both_naming_conventions ( )

Definition at line 163 of file test_engine.py.

◆ test_the_chamber_loop_absorbs_part_of_an_upstream_change()

None test_engine.test_the_chamber_loop_absorbs_part_of_an_upstream_change ( )
Why a pressure-fed engine is stable in the large.

Raise the feed pressure and chamber pressure rises, but by *less*, because
the rise eats into the injector's own pressure difference. If chamber
pressure tracked feed pressure one-for-one there would be no loop.

Definition at line 397 of file test_engine.py.

References max.

◆ test_the_current_vehicle_engine_imports()

None test_engine.test_the_current_vehicle_engine_imports ( )
LOX/ethanol, impinging doublet. The engine actually being built.

Definition at line 448 of file test_engine.py.

◆ test_the_geometry_cd_model_is_honoured_when_the_config_asks_for_it()

None test_engine.test_the_geometry_cd_model_is_honoured_when_the_config_asks_for_it ( )
`use_geometry_cd` is on in this config, so hole size moves Cd_inf.

Definition at line 547 of file test_engine.py.

◆ test_thrust_falls_back_when_no_target_is_stated()

None test_engine.test_thrust_falls_back_when_no_target_is_stated ( tmp_path)

Definition at line 599 of file test_engine.py.

References _config_with().

◆ test_thrust_resolves_like_mixture_ratio_and_chamber_pressure()

None test_engine.test_thrust_resolves_like_mixture_ratio_and_chamber_pressure ( tmp_path)
Intent wins for all three, or the rule is not a rule.

`chamber_geometry.design_thrust` is the last optimiser run's achievement;
`design_requirements.target_thrust` is what was asked for. The importer
already preferred intent for O/F and Pc and read thrust bare, so the shipped
ethalox config imported as 7000 N against a delivered 7200 N -- silently.

Definition at line 584 of file test_engine.py.

References _config_with().

Variable Documentation

◆ ENGINE_DESIGN

str test_engine.ENGINE_DESIGN = Path(__file__).resolve().parents[3] / "EngineDesign"

Definition at line 43 of file test_engine.py.

◆ ETHALOX

str test_engine.ETHALOX = ENGINE_DESIGN / "configs" / "ethalox_doublet_7000N.yaml"

Definition at line 438 of file test_engine.py.

◆ ETHALOX_CACHE

str test_engine.ETHALOX_CACHE = ENGINE_DESIGN / "output" / "cache" / "cea_cache_LOX_Ethanol_3D.npz"

Definition at line 439 of file test_engine.py.

◆ needs_cea

test_engine.needs_cea
Initial value:
1= pytest.mark.skipif(
2 not REAL_CACHE.exists(), reason="EngineDesign CEA cache not present"
3)

Definition at line 50 of file test_engine.py.

◆ needs_engine_design

test_engine.needs_engine_design
Initial value:
1= pytest.mark.skipif(
2 not REAL_CONFIG.exists(), reason="EngineDesign configs not present"
3)

Definition at line 47 of file test_engine.py.

◆ needs_ethalox

test_engine.needs_ethalox
Initial value:
1= pytest.mark.skipif(
2 not ETHALOX.exists() or not ETHALOX_CACHE.exists(),
3 reason="the ethalox config or its CEA cache is not present",
4)

Definition at line 441 of file test_engine.py.

◆ REAL_CACHE

str test_engine.REAL_CACHE = ENGINE_DESIGN / "output" / "cache" / "cea_cache_LOX_CH4_3D.npz"

Definition at line 45 of file test_engine.py.

◆ REAL_CONFIG

str test_engine.REAL_CONFIG = ENGINE_DESIGN / "configs" / "impinging_lox_ch4_8000N_optimal.yaml"

Definition at line 44 of file test_engine.py.