对齐PNL0002上游温度并稳定热流体闭合

This commit is contained in:
huojiarong committed 2026-08-11 07:12:52 +00:00
1 parent 6abcc220de
commit 0f73d5b568
5 files changed
+224 -13

No files matched your search

@@ -11,6 +11,8 @@ from app.simulation.components.amesim.flow.orifices import (
)
from app.simulation.components.amesim.flow.pipes import AmesimPnl00r
from app.simulation.components.amesim.flow.pipes import AmesimPnl0001
from app.simulation.components.amesim.flow.pipes import AmesimPnl0002
from app.simulation.components.amesim.junctions.nodes import AmesimPn3Node2
from app.simulation.components.amesim.media.mediums import (
AmesimHeliumPengRobinsonMedium,
)
@@ -142,6 +144,49 @@ class PressureFlowSolverInitializationTests(unittest.TestCase):
)
self.assertAlmostEqual(valve.port_3.m_flow, -valve.port_2.m_flow, places=12)
def test_stream_dependent_pipe_flow_closes_with_junction_mixing_in_one_rhs(self) -> None:
medium = IdealGasMedium()
hot = Cylinder("hot", medium, V=0.1, p0=500_000.0, T0=400.0)
cold = Cylinder("cold", medium, V=0.1, p0=500_000.0, T0=250.0)
sink = Tank("sink", medium, V=0.1, p0=100_000.0, T0=300.0)
hot_line = AmesimPnl00r("hot_line", medium, diam=0.01, le=0.5)
cold_line = AmesimPnl00r("cold_line", medium, diam=0.01, le=0.5)
junction = AmesimPn3Node2("junction")
pipe = AmesimPnl0002(
"pipe",
medium,
diam=0.01,
le=1.0,
p0=200_000.0,
T0=300.0,
)
network = SimulationNetwork("stream-flow-fixed-point")
for component in (
hot,
cold,
sink,
hot_line,
cold_line,
junction,
pipe,
):
network.add_component(component)
network.connect("hot", "port_b", "hot_line", "port_1")
network.connect("hot_line", "port_2", "junction", "port_1")
network.connect("cold", "port_b", "cold_line", "port_1")
network.connect("cold_line", "port_2", "junction", "port_3")
network.connect("junction", "port_2", "pipe", "port_1")
network.connect("pipe", "port_2", "sink", "port_a")
system = GenericFluidSystem(network)
state = system.consistent_initial_state_vector()
first = system.rhs(0.0, state)
second = system.rhs(0.0, state)
self.assertGreater(system.max_thermofluid_iterations, 1)
for first_value, second_value in zip(first, second):
self.assertAlmostEqual(first_value, second_value, places=10)
def test_current_storage_pressure_reseeds_stale_orifice_ports_and_flow(self) -> None:
network, medium, high, low, valve = self._near_equal_pressure_network()
solver = PressureFlowSolver(network, max_evaluations=10)