Replace Python numerical kernels with native C execution
This commit is contained in:
1 parent
48da6be21c
commit
3b38f73fe0
227 files changed
+16801
-75499
No files matched your search
@@ -144,39 +144,6 @@ class AmesimPnrp17Tests(unittest.TestCase):
|
||||
),
|
||||
)
|
||||
|
||||
def test_component_equations_match_pnrp17_geometry_and_signs(self) -> None:
|
||||
medium = IdealGasMedium()
|
||||
piston = AmesimPnrp17(
|
||||
"piston_1",
|
||||
medium,
|
||||
gi=0.0,
|
||||
dp=0.2,
|
||||
dr=0.1,
|
||||
x0=0.05,
|
||||
)
|
||||
piston.port_1.p = 300000.0
|
||||
piston.port_2.x = piston.port_5.x = 0.3
|
||||
piston.port_2.v = piston.port_5.v = 0.4
|
||||
piston.port_3.x = piston.port_4.x = 0.1
|
||||
piston.port_3.v = piston.port_4.v = -0.2
|
||||
pressure_force = piston.pressure_force
|
||||
piston.port_5.f = 10.0
|
||||
piston.port_2.f = -pressure_force - piston.port_5.f
|
||||
piston.port_4.f = 20.0
|
||||
piston.port_3.f = pressure_force - piston.port_4.f
|
||||
|
||||
expected_area = pi * (0.2**2 - 0.1**2) / 4.0
|
||||
self.assertAlmostEqual(piston.effective_area, expected_area)
|
||||
self.assertAlmostEqual(piston.chamber_length, 0.25)
|
||||
self.assertAlmostEqual(piston.chamber_volume, expected_area * 0.25)
|
||||
self.assertAlmostEqual(piston.chamber_volume_flow, expected_area * 0.6)
|
||||
for residual in piston.pressure_flow_equation_residuals():
|
||||
self.assertAlmostEqual(residual.value, 0.0, msg=residual.id)
|
||||
|
||||
self.assertEqual(
|
||||
piston.pneumatic_volume_outputs(),
|
||||
{"port_1": (piston.chamber_volume, piston.chamber_volume_flow)},
|
||||
)
|
||||
|
||||
def test_rod_diameter_cannot_exceed_piston_diameter(self) -> None:
|
||||
with self.assertRaisesRegex(ValueError, "dr must not exceed"):
|
||||
@@ -207,11 +174,6 @@ class AmesimPnrp17Tests(unittest.TestCase):
|
||||
self.assertAlmostEqual(chamber_value, 0.01 + piston_value, places=10)
|
||||
self.assertGreater(result["series"]["piston_mass.x"][-1], 0.0)
|
||||
self.assertLess(result["series"]["cylinder_mass.x"][-1], 0.0)
|
||||
self.assertGreater(result["diagnostics"]["pneumaticVolume"]["propagations"], 0)
|
||||
self.assertEqual(
|
||||
result["diagnostics"]["pneumaticVolume"]["last"]["outputPorts"],
|
||||
["piston_1.port_1"],
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in new issue
Block a user