添加test_mql pneumatic_96局部参考RHS候选

This commit is contained in:
huojiarong committed 2026-07-29 08:38:37 +00:00
1 parent 71da73ef70
commit a8a68f6dd4
5 files changed
+162 -2

No files matched your search

+64
View File
@@ -490,10 +490,12 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
components: TestMqlPn3P4NodeChamberSegmentComponents,
inlet_node: TestMqlPneumaticBoundaryCondition,
resistance_boundary: TestMqlPneumaticBoundaryCondition,
use_inlet_line_reference_rhs: bool = False,
) -> None:
self.components = components
self.inlet_node = inlet_node
self.resistance_boundary = resistance_boundary
self.use_inlet_line_reference_rhs = use_inlet_line_reference_rhs
def initial_state_vector(self) -> list[float]:
return [
@@ -2086,6 +2088,59 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
chamber.port_a.m_flow = -chamber_to_line_flow
chamber.port_a.h_outflow = chamber_properties.h
@staticmethod
def _pnl0001_reference_enthalpy_derivative(
*,
line: AmesimPnl0001Pipe,
line_properties: ThermodynamicProperties,
port_1_properties: ThermodynamicProperties,
port_1_flow: float,
port_2_properties: ThermodynamicProperties,
port_2_flow: float,
reference_temperature_k: float = 298.15,
) -> VolumeState:
def reference_enthalpy_flow(
*,
port_flow: float,
connected: ThermodynamicProperties,
) -> float:
if port_flow > 0.0:
pressure = connected.p
temperature = connected.T
else:
pressure = line_properties.p
temperature = line_properties.T
return port_flow * line.gas.pressure_reference_enthalpy(
pressure,
temperature,
reference_temperature=reference_temperature_k,
)
mass_derivative = port_1_flow + port_2_flow
heat_flow = (
line.heat_transfer_coefficient
* line.heat_transfer_area
* (line.external_temperature - line_properties.T)
)
enthalpy_flow = reference_enthalpy_flow(
port_flow=port_1_flow,
connected=port_1_properties,
) + reference_enthalpy_flow(
port_flow=port_2_flow,
connected=port_2_properties,
)
reference_offset_flow = (
line.gas.cp * reference_temperature_k - line.gas.cv * line_properties.T
) * mass_derivative
temperature_derivative = (
enthalpy_flow + reference_offset_flow + heat_flow
) / (line.state.m * line.gas.cv)
return VolumeState(
m=mass_derivative,
U=line.gas.cv
* (line.state.m * temperature_derivative + line_properties.T * mass_derivative),
)
@staticmethod
def _primary_chamber_line_derivatives(
*,
@@ -2706,6 +2761,15 @@ class TestMqlPn3P4NodeChamberSegmentClosure:
outlet_node_to_line_flow=snapshot.outlet_node_to_line_flow,
outlet_line_to_chamber_flow=snapshot.outlet_line_to_chamber_flow,
)
if self.use_inlet_line_reference_rhs:
inlet_derivative = self._pnl0001_reference_enthalpy_derivative(
line=self.components.inlet_line,
line_properties=snapshot.inlet_line,
port_1_properties=snapshot.p4_port3_remote_orifice_line_port_1,
port_1_flow=snapshot.inlet_node_to_line_flow,
port_2_properties=snapshot.chamber,
port_2_flow=-snapshot.inlet_line_to_chamber_flow,
)
(
node_line_derivative_1,
node_line_derivative_2,