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

Functions

object _pipe (str cid, float length, float bore_mm=7.75, **Param extra)
object _valve (str cid, float cv)
Network _series_network ()
None test_a_series_network_solves_and_conserves_mass ()
None test_the_pressure_drops_sum_to_what_was_available ()
None test_each_branch_drop_matches_its_component (object monkeypatch)
None test_a_parallel_split_divides_flow_by_resistance ()
None test_a_demand_is_met_from_the_branches_feeding_it ()
None test_flow_reverses_when_the_pressure_gradient_does ()
None test_it_reproduces_engine_designs_lumped_k_feed_loss ()
Network _ladder_network (int stages)
None test_a_forty_node_dual_branch_network_solves_quickly ()
None test_mass_residuals_are_reported_on_every_run ()
None test_the_report_shows_where_the_pressure_went ()
None test_the_result_records_the_stack_that_produced_it ()
None test_a_network_with_no_fixed_pressure_is_refused ()
None test_a_network_that_is_only_a_stub_still_has_an_answer ()
None test_a_network_with_no_branches_at_all_is_still_refused ()
None test_structural_problems_are_reported_together ()
None test_a_branch_to_a_missing_node_is_refused_at_construction ()
None test_a_failed_solve_can_be_inspected_instead_of_raised ()
None test_design_violations_survive_into_the_result ()
None test_a_shut_valve_is_reported_as_regularised_not_hidden ()
Network _teed_network ()
None test_a_solve_without_its_report_is_the_same_solve ()
None test_the_stub_memo_follows_the_wiring ()
Network _regulated_vent ()
None test_the_report_describes_the_signals_the_solve_ran_with ()
None test_a_choked_branch_is_listed_as_choked ()

Variables

 M = Provenance.MANUFACTURER
float PSI = 6894.757293168361

Detailed Description

The steady network solve: does it get the right answer, and know when it hasn't?

Phase 04's exit criteria live here. The one that matters most is not accuracy
but *honesty about* accuracy: a Newton solve will happily converge on a system
that does not conserve mass, and that failure looks exactly like success. Mass
residuals are therefore checked on every solve, not sampled.

The physics is not re-validated here -- Phase 03 did that against closed forms
and definitions. What is checked is that the solver reproduces those component
answers when it assembles them into a network, which is a different claim and
the one that can break.

Function Documentation

◆ _ladder_network()

Network test_solve_steady._ladder_network ( int stages)
protected
A dual-branch ladder: two parallel runs cross-linked at every stage.

Definition at line 194 of file test_solve_steady.py.

References _pipe().

Referenced by test_a_forty_node_dual_branch_network_solves_quickly().

◆ _pipe()

◆ _regulated_vent()

Network test_solve_steady._regulated_vent ( )
protected
Bottle -> dome-loaded regulator -> part-open valve -> atmosphere.

Definition at line 433 of file test_solve_steady.py.

References _valve().

Referenced by test_the_report_describes_the_signals_the_solve_ran_with().

◆ _series_network()

◆ _teed_network()

Network test_solve_steady._teed_network ( )
protected
The series network with a tee: a second line to a second injector, and
a capped stub off the middle node.

Definition at line 385 of file test_solve_steady.py.

References _pipe(), and _series_network().

Referenced by test_a_solve_without_its_report_is_the_same_solve(), and test_the_stub_memo_follows_the_wiring().

◆ _valve()

object test_solve_steady._valve ( str cid,
float cv )
protected

◆ test_a_branch_to_a_missing_node_is_refused_at_construction()

None test_solve_steady.test_a_branch_to_a_missing_node_is_refused_at_construction ( )

Definition at line 319 of file test_solve_steady.py.

References _pipe().

◆ test_a_choked_branch_is_listed_as_choked()

None test_solve_steady.test_a_choked_branch_is_listed_as_choked ( )
``choked_branches`` was built and never handed to the result.

Definition at line 482 of file test_solve_steady.py.

References _valve().

◆ test_a_demand_is_met_from_the_branches_feeding_it()

None test_solve_steady.test_a_demand_is_met_from_the_branches_feeding_it ( )
How an engine's appetite enters a feed-system solve.

Definition at line 133 of file test_solve_steady.py.

References _pipe().

◆ test_a_failed_solve_can_be_inspected_instead_of_raised()

None test_solve_steady.test_a_failed_solve_can_be_inspected_instead_of_raised ( )
What a parameter sweep wants: keep going, record the failure.

Definition at line 326 of file test_solve_steady.py.

References _series_network().

◆ test_a_forty_node_dual_branch_network_solves_quickly()

None test_solve_steady.test_a_forty_node_dual_branch_network_solves_quickly ( )
Phase 04's performance criterion.

Forty-odd nodes, two parallel runs with cross-links, in well under 100 ms.
The budget matters because Phase 07 marches this solve thousands of times
and Phase 15's optimizer will call it far more than that.

Definition at line 216 of file test_solve_steady.py.

References _ladder_network().

◆ test_a_network_that_is_only_a_stub_still_has_an_answer()

None test_solve_steady.test_a_network_that_is_only_a_stub_still_has_an_answer ( )
A tank feeding one capped line and nothing else.

Everything prunes to stubs, so there is nothing to iterate on -- but that is
not the same as there being no answer. Nothing flows, and the capped line
sits at the tank's pressure. This used to raise, and that was wrong for the
case that matters most: a stand with its whole panel shut prunes to exactly
this shape, and it is where a stand spends most of its life. Refusing to
describe it made the most ordinary state on the pad an error.

Definition at line 275 of file test_solve_steady.py.

References _pipe().

◆ test_a_network_with_no_branches_at_all_is_still_refused()

None test_solve_steady.test_a_network_with_no_branches_at_all_is_still_refused ( )
The genuinely empty case stays an error -- there is no system here.

Definition at line 297 of file test_solve_steady.py.

◆ test_a_network_with_no_fixed_pressure_is_refused()

None test_solve_steady.test_a_network_with_no_fixed_pressure_is_refused ( )
No reference pressure means every pressure is arbitrary.

Definition at line 264 of file test_solve_steady.py.

References _pipe().

◆ test_a_parallel_split_divides_flow_by_resistance()

None test_solve_steady.test_a_parallel_split_divides_flow_by_resistance ( )
Two paths between the same nodes: the easier one takes more.

Mass balance at the split is what makes this non-trivial -- the solver has
to find the division rather than being told it.

Definition at line 113 of file test_solve_steady.py.

References _pipe().

◆ test_a_series_network_solves_and_conserves_mass()

None test_solve_steady.test_a_series_network_solves_and_conserves_mass ( )

Definition at line 68 of file test_solve_steady.py.

References _series_network().

◆ test_a_shut_valve_is_reported_as_regularised_not_hidden()

None test_solve_steady.test_a_shut_valve_is_reported_as_regularised_not_hidden ( )
The derivative floor is a named regularisation, and it says when it acted.

A quadratic loss has zero slope at zero flow, so a shut branch would make
the Jacobian singular. The floor keeps the solve possible; reporting it
keeps it from ever being silently load-bearing.

Definition at line 362 of file test_solve_steady.py.

References _pipe().

◆ test_a_solve_without_its_report_is_the_same_solve()

None test_solve_steady.test_a_solve_without_its_report_is_the_same_solve ( )
A live session asks for no per-branch report (``report=False``): the
pressures, flows and mass residuals are the same numbers, and the residuals
are each node's net inflow.

Definition at line 396 of file test_solve_steady.py.

References _teed_network().

◆ test_design_violations_survive_into_the_result()

None test_solve_steady.test_design_violations_survive_into_the_result ( )
A bend inside its limit does not stop the solve, and is still reported.

Definition at line 338 of file test_solve_steady.py.

◆ test_each_branch_drop_matches_its_component()

None test_solve_steady.test_each_branch_drop_matches_its_component ( object monkeypatch)
The network's answer agrees with the component evaluated alone.

This is the bridge between Phase 03's validation and Phase 04's assembly:
the solve is only as good as the components, and this checks the solver is
not quietly transforming them on the way through.

Definition at line 97 of file test_solve_steady.py.

References _series_network().

◆ test_flow_reverses_when_the_pressure_gradient_does()

None test_solve_steady.test_flow_reverses_when_the_pressure_gradient_does ( )
Upstream and downstream are labels, not constraints.

Definition at line 146 of file test_solve_steady.py.

References _pipe().

◆ test_it_reproduces_engine_designs_lumped_k_feed_loss()

None test_solve_steady.test_it_reproduces_engine_designs_lumped_k_feed_loss ( )
Phase 04's parity criterion, against the code this replaces.

EngineDesign's ``feed_loss.delta_p_feed`` is ``K_eff . rho v^2 / 2`` over a
single lumped coefficient. A zero-length pipe carrying only ``K_minor`` is
exactly that, so the two must agree to machine precision -- and when the
steady solver lands in EngineDesign, this is the test that says the
replacement is faithful.

Definition at line 161 of file test_solve_steady.py.

◆ test_mass_residuals_are_reported_on_every_run()

None test_solve_steady.test_mass_residuals_are_reported_on_every_run ( )
Not sampled, not optional. A converged solve that does not conserve
mass has found the wrong answer confidently, and that is the failure that
looks like success.

Definition at line 234 of file test_solve_steady.py.

References _series_network().

◆ test_structural_problems_are_reported_together()

None test_solve_steady.test_structural_problems_are_reported_together ( )

Definition at line 306 of file test_solve_steady.py.

References _pipe().

◆ test_the_pressure_drops_sum_to_what_was_available()

None test_solve_steady.test_the_pressure_drops_sum_to_what_was_available ( )
The whole point of a pressure ladder: nothing goes missing.

Tank minus injector is fixed by the boundary conditions, so the components
between them must account for exactly that much and no more.

Definition at line 83 of file test_solve_steady.py.

References _series_network().

◆ test_the_report_describes_the_signals_the_solve_ran_with()

None test_solve_steady.test_the_report_describes_the_signals_the_solve_ran_with ( )
Diagnostics re-evaluate each branch at the answer. They used to do it
with no signals: a dome-loaded regulator reported its drawn 400 psia
setpoint and a zero dome while it held 530 psia, and a valve commanded to
30 % reported itself fully open with a 14 psi drop against an actual 516.

Definition at line 461 of file test_solve_steady.py.

References _regulated_vent().

◆ test_the_report_shows_where_the_pressure_went()

None test_solve_steady.test_the_report_shows_where_the_pressure_went ( )

Definition at line 243 of file test_solve_steady.py.

References _series_network().

◆ test_the_result_records_the_stack_that_produced_it()

None test_solve_steady.test_the_result_records_the_stack_that_produced_it ( )
Correlations and equations of state are not frozen between releases.

Definition at line 254 of file test_solve_steady.py.

References _series_network().

◆ test_the_stub_memo_follows_the_wiring()

None test_solve_steady.test_the_stub_memo_follows_the_wiring ( )
Dead ends are remembered per shut set, but a branch moved to another node
is a different network.

Definition at line 416 of file test_solve_steady.py.

References _teed_network().

Variable Documentation

◆ M

test_solve_steady.M = Provenance.MANUFACTURER

Definition at line 30 of file test_solve_steady.py.

◆ PSI

float test_solve_steady.PSI = 6894.757293168361

Definition at line 430 of file test_solve_steady.py.