diff --git a/pyroll/core/__init__.py b/pyroll/core/__init__.py index 3e2bfbc6..5f686ad7 100644 --- a/pyroll/core/__init__.py +++ b/pyroll/core/__init__.py @@ -12,7 +12,7 @@ from .disk_elements import DiskElementUnit from .config import Config, config -VERSION = "2.1.4" +VERSION = "2.1.5" root_hooks.extend( [ diff --git a/pyroll/core/transport/cooling_pipe.py b/pyroll/core/transport/cooling_pipe.py index 021bfb56..d646bcff 100644 --- a/pyroll/core/transport/cooling_pipe.py +++ b/pyroll/core/transport/cooling_pipe.py @@ -7,15 +7,23 @@ class CoolingPipe(Transport): """Represents a smooth cooling pipe.""" - inner_diameter = Hook[float]() - """Inner diameter of the cooling pipe""" + inner_radius = Hook[float]() + """Inner radius of the cooling pipe.""" - cooling_water_volume_flux = Hook[float]() - """Volume flux of the cooling water""" + cross_section_area = Hook[float]() + """Inner cross section area of the cooling pipe.""" - cooling_water_temperature = Hook[float]() - """Temperature of the cooling water""" + coolant_flow_cross_section = Hook[float]() + """Difference between profile and cooling pipe cross-section.""" + coolant_volume_flux = Hook[float]() + """Volume flux of the coolant.""" + + coolant_velocity = Hook[float]() + """Velocity of the coolant.""" + + coolant_temperature = Hook[float]() + """Temperature of the coolant.""" @property def disk_elements(self) -> List['CoolingPipe.DiskElement']: diff --git a/pyroll/core/transport/hookimpls/__init__.py b/pyroll/core/transport/hookimpls/__init__.py new file mode 100644 index 00000000..e61dbc03 --- /dev/null +++ b/pyroll/core/transport/hookimpls/__init__.py @@ -0,0 +1,2 @@ +from . import transport +from . import cooling_pipe diff --git a/pyroll/core/transport/hookimpls/cooling_pipe.py b/pyroll/core/transport/hookimpls/cooling_pipe.py new file mode 100644 index 00000000..e59ed63c --- /dev/null +++ b/pyroll/core/transport/hookimpls/cooling_pipe.py @@ -0,0 +1,24 @@ +import numpy as np +from ..cooling_pipe import CoolingPipe + + +@CoolingPipe.inner_radius +def inner_radius(self: CoolingPipe): + if self.has_set_or_cached("cross_section_area"): + return np.sqrt(self.cross_section_area / np.pi) + + +@CoolingPipe.cross_section_area +def cross_section_area(self: CoolingPipe): + if self.has_set_or_cached("inner_radius"): + return self.inner_radius ** 2 * np.pi + + +@CoolingPipe.coolant_flow_cross_section +def coolant_flow_cross_section(self: CoolingPipe): + return self.cross_section_area - self.in_profile.cross_section.area + + +@CoolingPipe.coolant_velocity +def coolant_velocity(self: CoolingPipe): + return self.coolant_volume_flux / self.coolant_flow_cross_section diff --git a/pyroll/core/transport/hookimpls.py b/pyroll/core/transport/hookimpls/transport.py similarity index 94% rename from pyroll/core/transport/hookimpls.py rename to pyroll/core/transport/hookimpls/transport.py index 5656f995..28fef6d5 100644 --- a/pyroll/core/transport/hookimpls.py +++ b/pyroll/core/transport/hookimpls/transport.py @@ -1,4 +1,4 @@ -from .transport import Transport +from ..transport import Transport @Transport.OutProfile.strain @@ -31,7 +31,7 @@ def length_from_roll_pass_positions(self: Transport, cycle): if cycle: return None - from ..roll_pass import RollPass + from ...roll_pass import RollPass next_pass = self.next_of(RollPass) prev_pass = self.prev_of(RollPass) diff --git a/tests/cooling_pipe/test_cooling_pipe_values.py b/tests/cooling_pipe/test_cooling_pipe_values.py new file mode 100644 index 00000000..bd3a7758 --- /dev/null +++ b/tests/cooling_pipe/test_cooling_pipe_values.py @@ -0,0 +1,59 @@ +import numpy as np +import pytest +from matplotlib import pyplot as plt +from numpy import pi, isclose, rad2deg + +from pyroll.core import CoolingPipe, PassSequence, Profile + + +def test_cooling_pipe_radius(): + cp = CoolingPipe( + label="Cooling Pipe", + cross_section_area=10, + ) + assert np.isclose(cp.inner_radius, 1.784124) + + +def test_cooling_pipe_area(): + cp = CoolingPipe( + label="Cooling Pipe", + inner_radius=1.784124, + ) + assert np.isclose(cp.cross_section_area, 10) + + +def test_cooling_pipe_coolant_velocity(): + ip = Profile.round( + radius=0.5 + ) + + seq = PassSequence([ + CoolingPipe( + label="Cooling Pipe", + inner_radius=1, + coolant_volume_flux=1, + velocity=1, + length=1 + )]) + + seq.solve(ip) + + assert np.isclose(seq[0].coolant_velocity, 0.42418615) + + +def test_cooling_pipe_coolant_flow_cross_section(): + ip = Profile.round( + radius=0.5 + ) + + seq = PassSequence([ + CoolingPipe( + label="Cooling Pipe", + inner_radius=1, + coolant_volume_flux=1, + velocity=1, + length=1 + )]) + seq.solve(ip) + + assert np.isclose(seq[0].coolant_flow_cross_section, 2.357455)