优化压力流量求解并达到四路性能门槛

This commit is contained in:
huojiarong committed 2026-08-15 11:45:22 +00:00
1 parent 6572defaa4
commit 6a064892e2
20 files changed
+711 -175

No files matched your search

@@ -219,6 +219,25 @@ class PressureFlowSolverInitializationTests(unittest.TestCase):
self.assertAlmostEqual(high.port_b.m_flow, -valve.port_2.m_flow, places=10)
self.assertAlmostEqual(low.port_a.m_flow, -valve.port_3.m_flow, places=10)
def test_compiled_plan_does_not_rebuild_equation_metadata_during_solve(self) -> None:
boundary = AmesimPnpl01("compiled_closed")
boundary.port_1.p = 100_000.0
boundary.port_1.m_flow = 1.0
network = SimulationNetwork("compiled-closed-boundary")
network.add_component(boundary)
solver = PressureFlowSolver(network)
with patch.object(
boundary,
"pressure_flow_equation_residuals",
side_effect=AssertionError("equation metadata rebuilt at runtime"),
):
diagnostics = solver.solve()
self.assertTrue(diagnostics.success)
self.assertEqual(diagnostics.evaluations, 0)
self.assertEqual(boundary.port_1.m_flow, 0.0)
@staticmethod
def _closed_boundary_solver() -> PressureFlowSolver:
boundary = AmesimPnpl01("closed")