Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
1709856
fixed z positioning with respect to default workplane
billingsley-john Dec 1, 2020
3c640fe
fixed port cutters with respect to default workplane
billingsley-john Dec 1, 2020
3de73b7
removed z_pos and added center_point
billingsley-john Dec 2, 2020
d8c739f
removed z_pos and added center_point
billingsley-john Dec 2, 2020
687052a
Merge pull request #611 from ukaea/add_center_point
billingsley-john Dec 2, 2020
8948ab5
Automated autopep8 fixes
Dec 2, 2020
c63bcbb
updated tests to use center_point instead of z_pos
billingsley-john Dec 3, 2020
e76844b
added global component for tests and added default parameters test
billingsley-john Dec 3, 2020
5006a96
added global component and default parameter test
billingsley-john Dec 3, 2020
b0fb477
fixed assertions and added relative volume test
billingsley-john Dec 3, 2020
20d8dbb
added absolute volume test
billingsley-john Dec 3, 2020
37e65f9
Automated autopep8 fixes
Dec 3, 2020
a7b8559
added assertion
billingsley-john Dec 3, 2020
36ef2d6
Merge branch 'fix_z_pos' of https://github.com/ukaea/paramak into fix…
billingsley-john Dec 3, 2020
ca7f67e
Automated autopep8 fixes
Dec 3, 2020
76a5965
updated filleting to work in any workplane
billingsley-john Dec 3, 2020
d0c0f13
Merge branch 'fix_z_pos' of https://github.com/ukaea/paramak into fix…
billingsley-john Dec 3, 2020
0bed8a9
added port cutting method
billingsley-john Dec 3, 2020
3ef5e1f
added port arguments to constructor
billingsley-john Dec 3, 2020
43de038
added call to port cutting utility function
billingsley-john Dec 3, 2020
2f72a6d
added utility function import
billingsley-john Dec 3, 2020
1d796ec
renamed incorrect parameter
billingsley-john Dec 3, 2020
28278ea
Automated autopep8 fixes
Dec 3, 2020
9752afa
Merge pull request #613 from ukaea/add_ports_to_ball_reactor
billingsley-john Dec 3, 2020
aaa601f
updated test to use new port cutters
billingsley-john Dec 3, 2020
47f04c2
Automated autopep8 fixes
Dec 3, 2020
79ee675
updated examples to use new ports
billingsley-john Dec 3, 2020
a0ec561
Merge branch 'fix_z_pos' of https://github.com/ukaea/paramak into fix…
billingsley-john Dec 3, 2020
6bba119
moved point at which fillets are added to solid
billingsley-john Dec 3, 2020
28af7b5
added comment
billingsley-john Dec 3, 2020
ce11a96
added numpy to imports
billingsley-john Dec 3, 2020
e2a6ed8
Merge pull request #614 from ukaea/change_port_architecture
billingsley-john Dec 3, 2020
5f8040c
added port parameters to construction
billingsley-john Dec 4, 2020
dc525a2
updated port cutting method to accept one shape and shapes with no cu…
billingsley-john Dec 4, 2020
adbef37
added port cutting to submersion reactor
billingsley-john Dec 4, 2020
177f1f2
updated docstring
billingsley-john Dec 4, 2020
2624948
using insert instead of list concatenation
billingsley-john Dec 4, 2020
ad592cc
Automated autopep8 fixes
Dec 4, 2020
82f6a23
added docstrings for port parameters
billingsley-john Dec 4, 2020
208f45a
Merge branch 'fix_z_pos' of https://github.com/ukaea/paramak into fix…
billingsley-john Dec 4, 2020
c12e2cc
Automated autopep8 fixes
Dec 4, 2020
c4a6346
fixed adding cuts to shapes
billingsley-john Dec 4, 2020
ff00860
fixed port cutter shape returning
billingsley-john Dec 4, 2020
860636c
removed number_of_ports as argument
billingsley-john Dec 4, 2020
cca2a42
Merge pull request #616 from ukaea/port_getters_setters
billingsley-john Dec 4, 2020
524fa33
updated condition for port cutting
billingsley-john Dec 4, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def main():

component = paramak.PortCutterRectangular(
distance=3,
z_pos=0,
center_point=(0, 0),
height=0.2,
width=0.4,
fillet_radius=0.02,
Expand All @@ -344,7 +344,7 @@ def main():

component = paramak.PortCutterCircular(
distance=3,
z_pos=0.25,
center_point=(0.25, 0),
radius=0.1,
# azimuth_placement_angle=[0, 45, 90, 180], # TODO: fix issue #548
azimuth_placement_angle=[0, 45, 90],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ def main():
# makes the middle row of ports
circular_ports = paramak.PortCutterCircular(
distance=5,
z_pos=0,
center_point=(0, 0),
radius=0.2,
azimuth_placement_angle=angles_for_ports
)

# makes the lower row of ports
rectangular_ports = paramak.PortCutterRectangular(
distance=5,
z_pos=-1,
center_point=(-1, 0),
height=0.3,
width=0.4,
fillet_radius=0.08,
Expand Down
13 changes: 6 additions & 7 deletions paramak/parametric_components/port_cutters_circular.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ class PortCutterCircular(ExtrudeCircleShape):
other components (eg. blanket, vessel,..) in order to create ports.

Args:
z_pos (float): Z position (cm) of the port
height (float): height (cm) of the port
width (float): width (cm) of the port
distance (float): extruded distance (cm) of the cutter
center_point ((float, float)): Defaults to (0, 0).
radius (float): radius (cm) of port.
distance (float): extruded distance (cm) of the cutter.
stp_filename (str, optional): defaults to "PortCutterCircular.stp".
stl_filename (str, optional): defaults to "PortCutterCircular.stl".
name (str, optional): defaults to "circular_port_cutter".
Expand All @@ -21,9 +20,9 @@ class PortCutterCircular(ExtrudeCircleShape):

def __init__(
self,
z_pos,
radius,
distance,
center_point=(0, 0),
workplane="ZY",
rotation_axis="Z",
extrusion_start_offset=1.,
Expand All @@ -47,8 +46,8 @@ def __init__(
**kwargs
)

self.z_pos = z_pos
self.center_point = center_point
self.radius = radius

def find_points(self):
self.points = [(0, self.z_pos)]
self.points = [self.center_point]
28 changes: 18 additions & 10 deletions paramak/parametric_components/port_cutters_rectangular.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ class PortCutterRectangular(ExtrudeStraightShape):
other components (eg. blanket, vessel,..) in order to create ports.

Args:
z_pos (float): Z position (cm) of the port
height (float): height (cm) of the port
width (float): width (cm) of the port
distance (float): extruded distance (cm) of the cutter
center_point ((float, float)): Defaults to (0, 0).
height (float): height (cm) of the port.
width (float): width (cm) of the port.
distance (float): extruded distance (cm) of the cutter.
fillet_radius (float, optional): If not None, radius (cm) of fillets
added to edges orthogonal to the Z direction. Defaults to None.
stp_filename (str, optional): defaults to "PortCutterRectangular.stp".
Expand All @@ -24,10 +24,10 @@ class PortCutterRectangular(ExtrudeStraightShape):

def __init__(
self,
z_pos,
height,
width,
distance,
center_point=(0, 0),
workplane="ZY",
rotation_axis="Z",
extrusion_start_offset=1.,
Expand All @@ -52,11 +52,11 @@ def __init__(
**kwargs
)

self.z_pos = z_pos
self.center_point = center_point
self.height = height
self.width = width
self.fillet_radius = fillet_radius
self.add_fillet()
# self.add_fillet()

def find_points(self):
points = [
Expand All @@ -65,9 +65,17 @@ def find_points(self):
(self.width / 2, self.height / 2),
(-self.width / 2, self.height / 2),
]
points = [(e[0], e[1] + self.z_pos) for e in points]
points = [(e[0] + self.center_point[0], e[1] +
self.center_point[1]) for e in points]
self.points = points

def add_fillet(self):
def add_fillet(self, solid):
if "X" not in self.workplane:
filleting_edge = "|X"
if "Y" not in self.workplane:
filleting_edge = "|Y"
if "Z" not in self.workplane:
filleting_edge = "|Z"
if self.fillet_radius is not None and self.fillet_radius != 0:
self.solid = self.solid.edges('#Z').fillet(self.fillet_radius)
solid = solid.edges(filleting_edge).fillet(self.fillet_radius)
return solid
57 changes: 57 additions & 0 deletions paramak/parametric_reactors/ball_reactor.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@

import numpy as np
import warnings

import paramak

from paramak.utils import perform_port_cutting


class BallReactor(paramak.Reactor):
"""Creates geometry for a simple ball reactor including a plasma,
Expand Down Expand Up @@ -61,6 +64,26 @@ class BallReactor(paramak.Reactor):
"upper", "lower" or "both". Defaults to "both".
rotation_angle (float): the angle of the sector that is desired.
Defaults to 360.0.
port_type (str, optional): type of port to be cut. Defaults to None.
port_center_point ((float, float), optional): position of port center
point in the workplane given. Defaults to (0, 0).
port_radius (float, optional): radius of circular ports. Defaults to
None.
port_height (float, optional): height of rectangular ports. Defaults
to None.
port_width (float, optional): width of rectangular ports. Defaults to
None.
port_distance (float, optional): extrusion distance of port cutter.
Defaults to None.
port_azimuth_placement_angle (float or list of floats, optional):
azimuthal placement of each port. Defualts to None if no ports
are created. Defaults to list of equally spaced floats between 0
and 360 of length equal to number_of_ports if number_of_ports is
provided but port_azimuth_placement_angle is not.
port_start_radius (float, optional): extrusion start point of port
cutter. Defaults to major_radius.
port_fillet_radius (float, optional): fillet radius of rectangular
ports. Defaults to 0.
"""

def __init__(
Expand Down Expand Up @@ -88,6 +111,16 @@ def __init__(
outboard_tf_coil_poloidal_thickness=None,
divertor_position="both",
rotation_angle=360.0,
port_type=None,
port_center_point=(0, 0),
port_radius=None,
port_height=None,
port_width=None,
port_distance=None,
port_azimuth_placement_angle=None,
port_start_radius=None,
port_fillet_radius=0,
**kwargs
):

super().__init__([])
Expand Down Expand Up @@ -152,6 +185,27 @@ def __init__(
self.plasma_gap_vertical_thickness,
self.major_radius - self.minor_radius]

self.port_type = port_type
self.port_center_point = port_center_point
self.port_radius = port_radius
self.port_height = port_height
self.port_width = port_width
self.port_distance = port_distance
self.port_start_radius = port_start_radius
self.port_azimuth_placement_angle = port_azimuth_placement_angle
self.port_fillet_radius = port_fillet_radius

@property
def port_start_radius(self):
return self._port_start_radius

@port_start_radius.setter
def port_start_radius(self, value):
if value is None:
self._port_start_radius = self.major_radius
else:
self._port_start_radius = value

@property
def pf_coil_radial_thicknesses(self):
return self._pf_coil_radial_thicknesses
Expand Down Expand Up @@ -423,6 +477,9 @@ def _make_blankets_layers(self):
cut=[self._center_column_cutter],
)

self._firstwall, self._blanket, self._blanket_rear_wall = perform_port_cutting(
self, self._firstwall, self._blanket, self._blanket_rear_wall)

return [self._firstwall, self._blanket, self._blanket_rear_wall]

def _make_divertor(self):
Expand Down
70 changes: 67 additions & 3 deletions paramak/parametric_reactors/submersion_reactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import cadquery as cq
import paramak

from paramak.utils import perform_port_cutting


class SubmersionTokamak(paramak.Reactor):
"""Creates geometry for a simple submersion reactor including a plasma,
Expand Down Expand Up @@ -61,6 +63,27 @@ class SubmersionTokamak(paramak.Reactor):
"upper", "lower" or "both". Defaults to "both".
support_position (str, optional): the position of the supports,
"upper", "lower" or "both". Defaults to "both".
port_type (str, optional): type of port to be cut. Defaults to None.
port_center_point ((float, float), optional): position of port center
point in the workplane given. Defaults to (0, 0).
port_radius (float, optional): radius of circular ports. Defaults to
None.
port_height (float, optional): height of rectangular ports. Defaults
to None.
port_width (float, optional): width of rectangular ports. Defaults to
None.
port_distance (float, optional): extrusion distance of port cutter.
Defaults to None.
port_azimuth_placement_angle (float or list of floats, optional):
azimuthal placement of each port. Defualts to None if no ports
are created. Defaults to list of equally spaced floats between 0
and 360 of length equal to number_of_ports if number_of_ports is
provided but port_azimuth_placement_angle is not.
port_start_radius (float, optional): extrusion start point of port
cutter. Defaults to None if no ports are created. Defaults to
major_radius otherwise.
port_fillet_radius (float, optional): fillet radius of rectangular
ports. Defaults to 0.
"""

def __init__(
Expand Down Expand Up @@ -90,6 +113,16 @@ def __init__(
pf_coil_case_thickness=10,
divertor_position="both",
support_position="both",
port_type=None,
port_center_point=(0, 0),
port_radius=None,
port_height=None,
port_width=None,
port_distance=None,
port_azimuth_placement_angle=None,
port_start_radius=None,
port_fillet_radius=0,
**kwargs
):

super().__init__([])
Expand Down Expand Up @@ -147,6 +180,27 @@ def __init__(
(outer_equatorial_point + inner_equatorial_point) / 2
self.minor_radius = self.major_radius - inner_equatorial_point

self.port_type = port_type
self.port_center_point = port_center_point
self.port_radius = port_radius
self.port_height = port_height
self.port_width = port_width
self.port_distance = port_distance
self.port_start_radius = port_start_radius
self.port_azimuth_placement_angle = port_azimuth_placement_angle
self.port_fillet_radius = port_fillet_radius

@property
def port_start_radius(self):
return self._port_start_radius

@port_start_radius.setter
def port_start_radius(self, value):
if value is None:
self._port_start_radius = self.major_radius
else:
self._port_start_radius = value

@property
def pf_coil_radial_thicknesses(self):
return self._pf_coil_radial_thicknesses
Expand Down Expand Up @@ -446,6 +500,7 @@ def _make_firstwall(self):
material_tag="firstwall_mat",
union=self._inboard_firstwall,
)
self._firstwall = perform_port_cutting(self, self._firstwall)
return self._firstwall

def _make_divertor(self):
Expand Down Expand Up @@ -495,8 +550,10 @@ def _make_divertor(self):
name="divertor",
material_tag="divertor_mat"
)

self._firstwall.cut = self._divertor
if self._firstwall.cut is None:
self._firstwall.cut = [self._divertor]
else:
self._firstwall.cut = self._firstwall.cut + [self._divertor]
self._inboard_firstwall.cut = self._divertor
return self._divertor

Expand Down Expand Up @@ -531,6 +588,7 @@ def _make_blanket(self):
material_tag="blanket_mat",
union=self._inboard_blanket,
)
self._blanket = perform_port_cutting(self, self._blanket)
return self._blanket

def _make_supports(self):
Expand Down Expand Up @@ -567,7 +625,10 @@ def _make_supports(self):
material_tag="supports_mat",
intersect=blanket_enveloppe,
)
self._blanket.cut = self._supports
if self._blanket.cut is None:
self._blanket.cut = [self._supports]
else:
self._blanket.cut = self._blanket.cut + [self._supports]

return self._supports

Expand Down Expand Up @@ -634,6 +695,9 @@ def _make_rear_blanket_wall(self):
self._outboard_rear_blanket_wall_lower],
)

self._outboard_rear_blanket_wall = perform_port_cutting(
self, self._outboard_rear_blanket_wall)

return self._outboard_rear_blanket_wall

def _make_coils(self):
Expand Down
5 changes: 5 additions & 0 deletions paramak/parametric_shapes/extruded_mixed_shape.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ def create_solid(self):
distance=extrusion_distance,
both=self.extrude_both)

# used for filleting rectangular port cutter edges
# must be done before azimuthal placement
if hasattr(self, "add_fillet"):
solid = self.add_fillet(solid)

solid = self.rotate_solid(solid)
cutting_wedge = calculate_wedge_cut(self)
solid = self.perform_boolean_operations(solid, wedge_cut=cutting_wedge)
Expand Down
Loading