perf: retain exact flow caches and compiled targets
This commit is contained in:
1 parent
f09dfcf542
commit
22b35b2945
7 files changed
+138
-21
No files matched your search
@@ -77,6 +77,34 @@ class AmesimPnl00rComponentTests(unittest.TestCase):
|
||||
self.assertGreater(pipe.mass_flow(15.3e6 + 0.1, 15.3e6), 0.0)
|
||||
|
||||
|
||||
def test_pressure_drop_inversion_cache_keys_all_property_inputs(self) -> None:
|
||||
pipe = AmesimPnl00r(
|
||||
"pnl_1",
|
||||
self.medium,
|
||||
diam=0.014,
|
||||
le=1.0,
|
||||
rr=0.045 / 14.0,
|
||||
)
|
||||
pipe.port_1.h_outflow = self.medium.specific_enthalpy(300.0)
|
||||
pipe._mass_flow_for_pressure_drop.cache_clear()
|
||||
|
||||
first = pipe.mass_flow(501000.0, 500000.0)
|
||||
after_first = pipe._mass_flow_for_pressure_drop.cache_info()
|
||||
second = pipe.mass_flow(501000.0, 500000.0)
|
||||
after_second = pipe._mass_flow_for_pressure_drop.cache_info()
|
||||
pipe.port_1.h_outflow = self.medium.specific_enthalpy(400.0)
|
||||
third = pipe.mass_flow(501000.0, 500000.0)
|
||||
after_temperature_change = pipe._mass_flow_for_pressure_drop.cache_info()
|
||||
|
||||
self.assertEqual(first, second)
|
||||
self.assertEqual(after_first.misses, 1)
|
||||
self.assertEqual(after_second.hits, after_first.hits + 1)
|
||||
self.assertNotEqual(third, second)
|
||||
self.assertEqual(
|
||||
after_temperature_change.misses,
|
||||
after_second.misses + 1,
|
||||
)
|
||||
|
||||
def test_friction_factor_transitions_from_laminar_to_turbulent(self) -> None:
|
||||
pipe = AmesimPnl00r("pnl_1", self.medium, rr=1e-5)
|
||||
|
||||
|
||||
Reference in new issue
Block a user