def test_physical_groups(self): """Creates a blanket using the BlanketFP parametric component and checks that physical groups can be exported using the export_physical_groups method""" outfile = "tests/blanket.json" # 180 coverage, full rotation test_shape = paramak.BlanketFP( 100, stop_angle=180, start_angle=0, ) test_shape.export_physical_groups(outfile) # full coverage, 180 rotation test_shape = paramak.BlanketFP(100, stop_angle=0, start_angle=360, rotation_angle=180) test_shape.export_physical_groups(outfile) # 180 coverage, 180 rotation test_shape = paramak.BlanketFP(100, stop_angle=180, start_angle=0, rotation_angle=180) test_shape.export_physical_groups(outfile) os.system("rm " + outfile)
def _make_firstwall(self): # this is used to cut the inboard blanket and then fused / unioned with # the firstwall self._inboard_firstwall = paramak.BlanketFP( plasma=self._plasma, offset_from_plasma=self.inner_plasma_gap_radial_thickness, start_angle=90, stop_angle=270, thickness=self.firstwall_radial_thickness, rotation_angle=self.rotation_angle, ) self._firstwall = paramak.BlanketFP( plasma=self._plasma, offset_from_plasma=self.outer_plasma_gap_radial_thickness, start_angle=90, stop_angle=-90, thickness=self.firstwall_radial_thickness, rotation_angle=self.rotation_angle, stp_filename="outboard_firstwall.stp", stl_filename="outboard_firstwall.stl", name="outboard_firstwall", material_tag="firstwall_mat", union=self._inboard_firstwall, ) return self._firstwall
def _make_blankets_layers(self): self._center_column_cutter = paramak.CenterColumnShieldCylinder( # extra 0.5 to ensure overlap, height=self._center_column_shield_height * 1.5, inner_radius=0, outer_radius=self._center_column_shield_end_radius, rotation_angle=360 ) self._firstwall = paramak.BlanketFP( plasma=self._plasma, thickness=self.firstwall_radial_thickness, offset_from_plasma=self.offset_from_plasma, start_angle=-180, stop_angle=180, rotation_angle=self.rotation_angle, material_tag="firstwall_mat", stp_filename="firstwall.stp", stl_filename="firstwall.stl", cut=[self._center_column_cutter] ) self._blanket = paramak.BlanketFP( plasma=self._plasma, thickness=self.blanket_radial_thickness, offset_from_plasma=[e + self.firstwall_radial_thickness for e in self.offset_from_plasma], start_angle=-180, stop_angle=180, rotation_angle=self.rotation_angle, material_tag="blanket_mat", stp_filename="blanket.stp", stl_filename="blanket.stl", cut=[self._center_column_cutter]) self._blanket_rear_wall = paramak.BlanketFP( plasma=self._plasma, thickness=self.blanket_rear_wall_radial_thickness, offset_from_plasma=[e + self.firstwall_radial_thickness + self.blanket_radial_thickness for e in self.offset_from_plasma], start_angle=-180, stop_angle=180, rotation_angle=self.rotation_angle, material_tag="blanket_rear_wall_mat", stp_filename="blanket_rear_wall.stp", stl_filename="blanket_rear_wall.stl", cut=[self._center_column_cutter], ) return [self._firstwall, self._blanket, self._blanket_rear_wall]
def _make_divertor(self): fw_enveloppe_inboard = paramak.BlanketFP( plasma=self._plasma, offset_from_plasma=self.inner_plasma_gap_radial_thickness, start_angle=90, stop_angle=270, thickness=self.firstwall_radial_thickness, rotation_angle=self.rotation_angle, ) fw_enveloppe = paramak.BlanketFP( plasma=self._plasma, offset_from_plasma=self.outer_plasma_gap_radial_thickness, start_angle=90, stop_angle=-90, thickness=self.firstwall_radial_thickness, rotation_angle=self.rotation_angle, stp_filename="outboard_firstwall.stp", stl_filename="outboard_firstwall.stl", name="outboard_firstwall", material_tag="firstwall_mat", union=fw_enveloppe_inboard, ) divertor_height = self._blanket_rear_wall_end_height divertor_height_top = divertor_height divertor_height_bottom = -divertor_height if self.divertor_position == "lower": divertor_height_top = 0 elif self.divertor_position == "upper": divertor_height_bottom = 0 self._divertor = paramak.RotateStraightShape( points=[(self._divertor_start_radius, divertor_height_bottom), (self._divertor_end_radius, divertor_height_bottom), (self._divertor_end_radius, divertor_height_top), (self._divertor_start_radius, divertor_height_top)], intersect=fw_enveloppe, rotation_angle=self.rotation_angle, stp_filename="divertor.stp", stl_filename="divertor.stl", name="divertor", material_tag="divertor_mat") self._firstwall.cut = self._divertor self._inboard_firstwall.cut = self._divertor return self._divertor
def _make_blanket(self): self._inboard_blanket = paramak.CenterColumnShieldCylinder( height=self._blanket_end_height * 2, inner_radius=self._inboard_blanket_start_radius, outer_radius=max(self._inboard_firstwall.points)[0], rotation_angle=self.rotation_angle, cut=self._inboard_firstwall, ) # this takes a single solid from a compound of solids by finding the # solid nearest to a point # TODO: find alternative self._inboard_blanket.solid = self._inboard_blanket.solid.solids( cq.selectors.NearestToPointSelector((0, 0, 0))) # this is the outboard fused /unioned with the inboard blanket self._blanket = paramak.BlanketFP( plasma=self._plasma, start_angle=90, stop_angle=-90, offset_from_plasma=self.outer_plasma_gap_radial_thickness + self.firstwall_radial_thickness, thickness=self.outboard_blanket_radial_thickness, rotation_angle=self.rotation_angle, stp_filename="blanket.stp", stl_filename="blanket.stl", name="blanket", material_tag="blanket_mat", union=self._inboard_blanket, ) return self._blanket
def _make_supports(self): blanket_enveloppe = paramak.BlanketFP( plasma=self._plasma, start_angle=90, stop_angle=-90, offset_from_plasma=self.outer_plasma_gap_radial_thickness + self.firstwall_radial_thickness, thickness=self.outboard_blanket_radial_thickness, rotation_angle=self.rotation_angle, union=self._inboard_blanket, ) support_height = self._blanket_rear_wall_end_height support_height_top = support_height support_height_bottom = -support_height if self.support_position == "lower": support_height_top = 0 elif self.support_position == "upper": support_height_bottom = 0 self._supports = paramak.RotateStraightShape( points=[(self._support_start_radius, support_height_bottom), (self._support_end_radius, support_height_bottom), (self._support_end_radius, support_height_top), (self._support_start_radius, support_height_top)], rotation_angle=self.rotation_angle, stp_filename="supports.stp", stl_filename="supports.stl", name="supports", material_tag="supports_mat", intersect=blanket_enveloppe, ) self._blanket.cut = self._supports return self._supports
def _make_outboard_blanket(self): self._center_column_cutter = paramak.CenterColumnShieldCylinder( # extra 1.5 to ensure overlap, height=self._inboard_firstwall_end_height * 2.5, inner_radius=0, outer_radius=self._inboard_firstwall_end_radius, rotation_angle=self.rotation_angle ) self._blanket = paramak.BlanketFP( plasma=self._plasma, thickness=100., offset_from_plasma=[ self.inner_plasma_gap_radial_thickness, self.plasma_gap_vertical_thickness, self.outer_plasma_gap_radial_thickness, self.plasma_gap_vertical_thickness, self.inner_plasma_gap_radial_thickness], start_angle=-180, stop_angle=180, rotation_angle=self.rotation_angle, cut=[self._center_column_cutter] ) return self._blanket
def _make_divertor(self): self._blanket_enveloppe = paramak.BlanketFP( plasma=self._plasma, thickness=100., offset_from_plasma=[ self.inner_plasma_gap_radial_thickness, self.plasma_gap_vertical_thickness, self.outer_plasma_gap_radial_thickness, self.plasma_gap_vertical_thickness, self.inner_plasma_gap_radial_thickness], start_angle=-180, stop_angle=180, rotation_angle=self.rotation_angle, cut=[self._center_column_cutter] ) self._divertor = paramak.CenterColumnShieldCylinder( height=self._center_column_shield_end_height * 2.5, # extra 0.5 to ensure overlap inner_radius=self._divertor_start_radius, outer_radius=self._divertor_end_radius, rotation_angle=self.rotation_angle, stp_filename="divertor.stp", stl_filename="divertor.stl", name="divertor", material_tag="divertor_mat", intersect=self._blanket_enveloppe, ) self._blanket.cut.append(self._divertor) return self._divertor
def _make_divertor(self): if self.divertor_position == "upper": divertor_height = self._blanket_rear_wall_end_height elif self.divertor_position == "lower": divertor_height = -self._blanket_rear_wall_end_height # # used as an intersect when making the divertor self._blanket_fw_rear_wall_envelope = paramak.BlanketFP( plasma=self._plasma, thickness=self.firstwall_radial_thickness + self.blanket_radial_thickness + self.blanket_rear_wall_radial_thickness, offset_from_plasma=[ self.major_radius - self.minor_radius, self.plasma_gap_vertical_thickness, self.outer_plasma_gap_radial_thickness, self.plasma_gap_vertical_thickness, # self.inner_plasma_gap_radial_thickness], self.major_radius - self.minor_radius ], start_angle=-179, stop_angle=179, rotation_angle=self.rotation_angle, ) self._divertor = paramak.RotateStraightShape( points=[(self._divertor_start_radius, 0), (self._divertor_end_radius, 0), (self._divertor_end_radius, divertor_height), (self._divertor_start_radius, divertor_height)], intersect=self._blanket_fw_rear_wall_envelope, stp_filename="divertor.stp", stl_filename="divertor.stl", name="divertor", material_tag="divertor_mat", rotation_angle=self.rotation_angle) self.shapes_and_components.append(self._divertor) blanket_cutter = paramak.RotateStraightShape( points=[(self._divertor_start_radius, 0), (self._divertor_end_radius, 0), (self._divertor_end_radius, divertor_height), (self._divertor_start_radius, divertor_height)], stp_filename="divertor.stp", stl_filename="divertor.stl", name="divertor", material_tag="divertor_mat", rotation_angle=self.rotation_angle) self._firstwall.solid = self._firstwall.solid.cut(blanket_cutter.solid) self._blanket.solid = self._blanket.solid.cut(blanket_cutter.solid) self._blanket_rear_wall.solid = self._blanket_rear_wall.solid.cut( blanket_cutter.solid) self.shapes_and_components.append(self._firstwall) self.shapes_and_components.append(self._blanket) self.shapes_and_components.append(self._blanket_rear_wall)
def _make_rear_blanket_wall(self): self._outboard_rear_blanket_wall_upper = paramak.RotateStraightShape( points=[ (self._center_column_shield_end_radius, self._blanket_rear_wall_start_height), (self._center_column_shield_end_radius, self._blanket_rear_wall_end_height), ( max(self._inboard_firstwall.points)[0], self._blanket_rear_wall_end_height, ), ( max(self._inboard_firstwall.points)[0], self._blanket_rear_wall_start_height, ), ], rotation_angle=self.rotation_angle, ) self._outboard_rear_blanket_wall_lower = paramak.RotateStraightShape( points=[ (self._center_column_shield_end_radius, -self._blanket_rear_wall_start_height), (self._center_column_shield_end_radius, -self._blanket_rear_wall_end_height), ( max(self._inboard_firstwall.points)[0], -self._blanket_rear_wall_end_height, ), ( max(self._inboard_firstwall.points)[0], -self._blanket_rear_wall_start_height, ), ], rotation_angle=self.rotation_angle, ) self._outboard_rear_blanket_wall = paramak.BlanketFP( plasma=self._plasma, start_angle=90, stop_angle=-90, offset_from_plasma=self.outer_plasma_gap_radial_thickness + self.firstwall_radial_thickness + self.outboard_blanket_radial_thickness, thickness=self.blanket_rear_wall_radial_thickness, rotation_angle=self.rotation_angle, stp_filename="outboard_rear_blanket_wall.stp", stl_filename="outboard_rear_blanket_wall.stl", name="outboard_rear_blanket_wall", material_tag="blanket_rear_wall_mat", union=[ self._outboard_rear_blanket_wall_upper, self._outboard_rear_blanket_wall_lower ], ) return self._outboard_rear_blanket_wall
def create_shape(): test_shape = paramak.BlanketFP(major_radius=300, minor_radius=50, triangularity=0.5, elongation=2, thickness=200, stop_angle=360, start_angle=0, rotation_angle=360) test_shape.solid
def test_BlanketFP_physical_groups(self): """creates a blanket using the BlanketFP parametric component and checks that physical groups can be exported using the export_physical_groups method""" test_shape = paramak.BlanketFP( 100, stop_angle=90, start_angle=270, ) test_shape.export_physical_groups("tests/blanket.json")
def setUp(self): self.plasma = paramak.Plasma(major_radius=450, minor_radius=150, triangularity=0.55, elongation=2) self.test_shape = paramak.BlanketFP( thickness=150, start_angle=-90, stop_angle=240, )
def test_different_lengths(): test_shape = paramak.BlanketFP( major_radius=300, minor_radius=50, triangularity=0.5, elongation=2, thickness=100, offset_from_plasma=[[270, 100, 90], [0, 5, 10, 15]], stop_angle=90, start_angle=270, ) test_shape.solid
def _make_inboard_blanket_and_firstwall(self): # this is used to cut the inboard blanket and then fused / unioned with # the firstwall self._inboard_firstwall = paramak.BlanketFP( plasma=self._plasma, offset_from_plasma=self.inner_plasma_gap_radial_thickness, start_angle=90, stop_angle=270, thickness=self.firstwall_radial_thickness, rotation_angle=self.rotation_angle, ) self._inboard_blanket = paramak.CenterColumnShieldCylinder( height=self._blanket_end_height * 2, inner_radius=self._inboard_blanket_start_radius, outer_radius=max( [item[0] for item in self._inboard_firstwall.points]), rotation_angle=self.rotation_angle, cut=self._inboard_firstwall, ) # this takes a single solid from a compound of solids by finding the # solid nearest to a point self._inboard_blanket.solid = self._inboard_blanket.solid.solids( cq.selectors.NearestToPointSelector((0, 0, 0))) self._firstwall = paramak.BlanketFP( plasma=self._plasma, offset_from_plasma=self.outer_plasma_gap_radial_thickness, start_angle=90, stop_angle=-90, thickness=self.firstwall_radial_thickness, rotation_angle=self.rotation_angle, stp_filename="outboard_firstwall.stp", stl_filename="outboard_firstwall.stl", name="outboard_firstwall", material_tag="firstwall_mat", union=self._inboard_firstwall, )
def test_BlanketFP_creation_noplasma(self): """checks that a cadquery solid can be created using the BlanketFP parametric component when no plasma is passed""" test_shape = paramak.BlanketFP(major_radius=300, minor_radius=50, triangularity=0.5, elongation=2, thickness=200, stop_angle=360, start_angle=0, rotation_angle=180) assert test_shape.solid is not None assert test_shape.volume > 1000
def test_BlanketFP_full_cov_stp_export(self): """creates a blanket using the BlanketFP parametric component and checks that an stp file with full coverage can be exported using the export_stp method""" test_shape = paramak.BlanketFP( major_radius=300, minor_radius=50, triangularity=0.5, elongation=2, thickness=200, stop_angle=360, start_angle=0, rotation_angle=180, ) test_shape.export_stp("tests/test_blanket_full_cov")
def test_BlanketFP_creation_variable_thickness_from_2_lists(self): """checks that a cadquery solid can be created using the BlanketFP parametric component when a list of angles and a list of thicknesses are passed""" test_shape = paramak.BlanketFP( major_radius=300, minor_radius=50, triangularity=0.5, elongation=2, thickness=[(270, 90), [10, 30]], stop_angle=90, start_angle=270, ) assert test_shape.solid is not None
def test_BlanketFP_creation_variable_thickness_from_tuple(self): """checks that a cadquery solid can be created using the BlanketFP parametric component when a tuple of thicknesses is passed""" test_shape = paramak.BlanketFP( major_radius=300, minor_radius=50, triangularity=0.5, elongation=2, thickness=(100, 200), stop_angle=90, start_angle=270, ) assert test_shape.solid is not None assert test_shape.volume > 1000
def _make_divertor(self): # # used as an intersect when making the divertor self._blanket_fw_rear_wall_envelope = paramak.BlanketFP( plasma=self._plasma, thickness=self.firstwall_radial_thickness + self.blanket_radial_thickness + self.blanket_rear_wall_radial_thickness, offset_from_plasma=[ self.major_radius - self.minor_radius, self.plasma_gap_vertical_thickness, self.outer_plasma_gap_radial_thickness, self.plasma_gap_vertical_thickness, # self.inner_plasma_gap_radial_thickness], self.major_radius - self.minor_radius ], start_angle=-179, stop_angle=179, rotation_angle=self.rotation_angle, ) self._divertor = paramak.CenterColumnShieldCylinder( height=self._blanket_rear_wall_end_height * 2, inner_radius=self._divertor_start_radius, outer_radius=self._divertor_end_radius, intersect=self._blanket_fw_rear_wall_envelope, stp_filename="divertor.stp", name="divertor", material_tag="divertor_mat", rotation_angle=self.rotation_angle) self.shapes_and_components.append(self._divertor) blanket_cutter = paramak.CenterColumnShieldCylinder( height=self._center_column_shield_height * 1.5, # extra 0.5 to ensure overlap, inner_radius=0, outer_radius=self._divertor_end_radius, rotation_angle=360) self._firstwall.solid = self._firstwall.solid.cut(blanket_cutter.solid) self._blanket.solid = self._blanket.solid.cut(blanket_cutter.solid) self._blanket_rear_wall.solid = self._blanket_rear_wall.solid.cut( blanket_cutter.solid) self.shapes_and_components.append(self._firstwall) self.shapes_and_components.append(self._blanket) self.shapes_and_components.append(self._blanket_rear_wall)
def test_BlanketFP_creation_variable_offset_function(self): """checks that a cadquery solid can be created using the BlanketFP parametric component when a offset function is passed""" def offset(theta): return 100 + 3 * theta test_shape = paramak.BlanketFP(major_radius=300, minor_radius=50, triangularity=0.5, elongation=2, thickness=100, stop_angle=90, start_angle=270, offset_from_plasma=offset) assert test_shape.solid is not None assert test_shape.volume > 1000
def test_overlapping(self): """Creates an overlapping geometry and checks that a warning is raised. """ test_shape = paramak.BlanketFP( major_radius=100, minor_radius=100, triangularity=0.5, elongation=2, thickness=200, stop_angle=360, start_angle=0, ) with warnings.catch_warnings(record=True) as w: warnings.simplefilter("always") assert test_shape.solid is not None assert len(w) == 1
def _make_outboard_blanket(self): # this is the outboard fused /unioned with the inboard blanket self._blanket = paramak.BlanketFP( plasma=self._plasma, start_angle=90, stop_angle=-90, offset_from_plasma=self.outer_plasma_gap_radial_thickness + self.firstwall_radial_thickness, thickness=self.outboard_blanket_radial_thickness, rotation_angle=self.rotation_angle, stp_filename="blanket.stp", stl_filename="blanket.stl", name="blanket", material_tag="blanket_mat", union=self._inboard_blanket, )
def _make_divertor(self): # # used as an intersect when making the divertor self._blanket_fw_rear_wall_envelope = paramak.BlanketFP( plasma=self._plasma, thickness=self.firstwall_radial_thickness + self.blanket_radial_thickness + self.blanket_rear_wall_radial_thickness, offset_from_plasma=self.offset_from_plasma, start_angle=-180, stop_angle=180, rotation_angle=self.rotation_angle, ) divertor_height = self._blanket_rear_wall_end_height * 2 divertor_height_top = divertor_height divertor_height_bottom = -divertor_height if self.divertor_position == "lower": divertor_height_top = 0 elif self.divertor_position == "upper": divertor_height_bottom = 0 self._divertor = paramak.RotateStraightShape( points=[ (self._divertor_start_radius, divertor_height_bottom), (self._divertor_end_radius, divertor_height_bottom), (self._divertor_end_radius, divertor_height_top), (self._divertor_start_radius, divertor_height_top) ], intersect=self._blanket_fw_rear_wall_envelope, stp_filename="divertor.stp", stl_filename="divertor.stl", name="divertor", material_tag="divertor_mat", rotation_angle=self.rotation_angle ) for component in [ self._firstwall, self._blanket, self._blanket_rear_wall]: component.cut.append(self._divertor) return self._divertor
def make_segmented_firstwall(): # makes the firstwall firstwall = paramak.BlanketFP(minor_radius=150, major_radius=450, triangularity=0.55, elongation=2.0, thickness=2, start_angle=270, stop_angle=-90, rotation_angle=10) # segments the firstwall poloidally into 40 equal angle segments segmented_firstwall = paramak.PoloidalSegments( shape_to_segment=firstwall, center_point=(450, 0), # this is the middle of the plasma number_of_segments=40, ) # saves the segmented firstwall as an stp file segmented_firstwall.export_stp('segmented_firstwall.stp')
def test_BlanketFP_creation_plasma(self): """checks that a cadquery solid can be created by passing a plasma to the BlanketFP parametric component""" plasma = paramak.Plasma( major_radius=300, minor_radius=50, triangularity=0.5, elongation=2, ) test_shape = paramak.BlanketFP( plasma=plasma, thickness=200, stop_angle=90, start_angle=270, offset_from_plasma=30, rotation_angle=180, ) assert test_shape.solid is not None assert test_shape.volume > 1000
def main(): rot_angle = 180 all_components = [] plasma = paramak.Plasma( # default parameters rotation_angle=rot_angle, stp_filename="plasma_shape.stp", ) all_components.append(plasma) component = paramak.BlanketFP( plasma=plasma, thickness=100, stop_angle=90, start_angle=-90, offset_from_plasma=30, rotation_angle=rot_angle, stp_filename="blanket_constant_thickness_outboard_plasma.stp", ) all_components.append(component) component = paramak.BlanketCutterStar(height=2000, width=2000, distance=100) all_components.append(component) component = paramak.BlanketFP( plasma=plasma, thickness=100, stop_angle=90, start_angle=250, offset_from_plasma=30, rotation_angle=rot_angle, stp_filename="blanket_constant_thickness_inboard_plasma.stp", ) all_components.append(component) component = paramak.BlanketFP( plasma=plasma, thickness=100, stop_angle=250, start_angle=-90, offset_from_plasma=30, rotation_angle=rot_angle, stp_filename="blanket_constant_thickness_plasma.stp", ) all_components.append(component) CenterColumnShieldCylinder = paramak.CenterColumnShieldCylinder( inner_radius=80, outer_radius=100, height=300, rotation_angle=rot_angle, stp_filename="center_column_shield_cylinder.stp", ) all_components.append(CenterColumnShieldCylinder) component = paramak.InboardFirstwallFCCS( central_column_shield=CenterColumnShieldCylinder, thickness=50, rotation_angle=rot_angle, stp_filename="firstwall_from_center_column_shield_cylinder.stp", ) all_components.append(component) CenterColumnShieldHyperbola = paramak.CenterColumnShieldHyperbola( inner_radius=50, mid_radius=75, outer_radius=100, height=300, rotation_angle=rot_angle, stp_filename="center_column_shield_hyperbola.stp", ) all_components.append(CenterColumnShieldHyperbola) component = paramak.InboardFirstwallFCCS( central_column_shield=CenterColumnShieldHyperbola, thickness=50, rotation_angle=rot_angle, stp_filename="firstwall_from_center_column_shield_hyperbola.stp", ) all_components.append(component) CenterColumnShieldCircular = paramak.CenterColumnShieldCircular( inner_radius=50, mid_radius=75, outer_radius=100, height=300, rotation_angle=rot_angle, stp_filename="center_column_shield_circular.stp", ) all_components.append(CenterColumnShieldCircular) component = paramak.InboardFirstwallFCCS( central_column_shield=CenterColumnShieldCircular, thickness=50, rotation_angle=rot_angle, stp_filename="firstwall_from_center_column_shield_circular.stp", ) all_components.append(component) CenterColumnShieldFlatTopHyperbola = paramak.CenterColumnShieldFlatTopHyperbola( inner_radius=50, mid_radius=75, outer_radius=100, arc_height=220, height=300, rotation_angle=rot_angle, stp_filename="center_column_shield_flat_top_hyperbola.stp", ) all_components.append(CenterColumnShieldFlatTopHyperbola) component = paramak.InboardFirstwallFCCS( central_column_shield=CenterColumnShieldFlatTopHyperbola, thickness=50, rotation_angle=rot_angle, stp_filename= "firstwall_from_center_column_shield_flat_top_hyperbola.stp", ) all_components.append(component) CenterColumnShieldFlatTopCircular = paramak.CenterColumnShieldFlatTopCircular( inner_radius=50, mid_radius=75, outer_radius=100, arc_height=220, height=300, rotation_angle=rot_angle, stp_filename="center_column_shield_flat_top_Circular.stp", ) all_components.append(CenterColumnShieldFlatTopCircular) component = paramak.InboardFirstwallFCCS( central_column_shield=CenterColumnShieldFlatTopCircular, thickness=50, rotation_angle=rot_angle, stp_filename= "firstwall_from_center_column_shield_flat_top_Circular.stp", ) all_components.append(component) CenterColumnShieldPlasmaHyperbola = paramak.CenterColumnShieldPlasmaHyperbola( inner_radius=150, mid_offset=50, edge_offset=40, height=800, rotation_angle=rot_angle, stp_filename="center_column_shield_plasma_hyperbola.stp", ) all_components.append(CenterColumnShieldPlasmaHyperbola) component = paramak.InboardFirstwallFCCS( central_column_shield=CenterColumnShieldPlasmaHyperbola, thickness=50, rotation_angle=rot_angle, stp_filename="firstwall_from_center_column_shield_plasma_hyperbola.stp", ) all_components.append(component) component = paramak.InnerTfCoilsCircular( inner_radius=25, outer_radius=100, number_of_coils=10, gap_size=5, height=300, stp_filename="inner_tf_coils_circular.stp", ) all_components.append(component) component = paramak.InnerTfCoilsFlat( inner_radius=25, outer_radius=100, number_of_coils=10, gap_size=5, height=300, stp_filename="inner_tf_coils_flat.stp", ) all_components.append(component) # this makes 4 pf coil cases pf_coil_set = paramak.PoloidalFieldCoilCaseSet( heights=[10, 10, 20, 20], widths=[10, 10, 20, 40], casing_thicknesses=[5, 5, 10, 10], center_points=[(100, 100), (100, 150), (50, 200), (50, 50)], rotation_angle=rot_angle, stp_filename="pf_coil_case_set.stp") all_components.append(pf_coil_set) # this makes 4 pf coils pf_coil_set = paramak.PoloidalFieldCoilSet(heights=[10, 10, 20, 20], widths=[10, 10, 20, 40], center_points=[(100, 100), (100, 150), (50, 200), (50, 50)], rotation_angle=rot_angle, stp_filename="pf_coil_set.stp") all_components.append(pf_coil_set) # this makes 4 pf coil cases for the 4 pf coils made above component = paramak.PoloidalFieldCoilCaseSetFC( pf_coils=pf_coil_set, casing_thicknesses=[5, 5, 10, 10], rotation_angle=rot_angle, stp_filename="pf_coil_cases_set.stp") all_components.append(component) # this makes 1 pf coils pf_coil = paramak.PoloidalFieldCoil(center_point=(100, 100), height=20, width=20, rotation_angle=rot_angle, stp_filename="poloidal_field_coil.stp") all_components.append(pf_coil) # this makes one PF coil case for the provided pf coil component = paramak.PoloidalFieldCoilCaseSetFC( pf_coils=[pf_coil], casing_thicknesses=[10], rotation_angle=rot_angle, stp_filename="pf_coil_cases_set_fc.stp") all_components.append(component) component = paramak.PoloidalFieldCoilCaseFC( pf_coil=pf_coil, casing_thickness=10, rotation_angle=rot_angle, stp_filename="poloidal_field_coil_case_fc.stp", ) all_components.append(component) component = paramak.PoloidalFieldCoilCase( center_point=(100, 100), coil_height=20, coil_width=20, casing_thickness=10, rotation_angle=rot_angle, stp_filename="poloidal_field_coil_case.stp", ) all_components.append(component) component = paramak.BlanketConstantThicknessArcV( inner_lower_point=(300, -200), inner_mid_point=(500, 0), inner_upper_point=(300, 200), thickness=100, rotation_angle=rot_angle, stp_filename="blanket_arc_v.stp", ) all_components.append(component) component = paramak.BlanketConstantThicknessArcH( inner_lower_point=(300, -200), inner_mid_point=(400, 0), inner_upper_point=(300, 200), thickness=100, rotation_angle=rot_angle, stp_filename="blanket_arc_h.stp", ) all_components.append(component) component = paramak.ToroidalFieldCoilRectangle( horizontal_start_point=(100, 700), vertical_mid_point=(800, 0), thickness=150, distance=60, stp_filename="tf_coil_rectangle.stp", number_of_coils=1, ) all_components.append(component) component = paramak.ToroidalFieldCoilCoatHanger( horizontal_start_point=(200, 500), horizontal_length=400, vertical_mid_point=(700, 50), vertical_length=500, thickness=50, distance=50, stp_filename="toroidal_field_coil_coat_hanger.stp", number_of_coils=1, ) all_components.append(component) component = paramak.ToroidalFieldCoilTripleArc( R1=80, h=200, radii=(70, 100), coverages=(60, 60), thickness=30, distance=30, number_of_coils=1, stp_filename="toroidal_field_coil_triple_arc.stp") all_components.append(component) magnet = paramak.ToroidalFieldCoilPrincetonD( R1=80, R2=300, thickness=30, distance=30, number_of_coils=1, stp_filename="toroidal_field_coil_princeton_d.stp") all_components.append(magnet) component = paramak.ITERtypeDivertor( # default parameters rotation_angle=rot_angle, stp_filename="ITER_type_divertor.stp", ) all_components.append(component) component = paramak.PortCutterRotated(center_point=(450, 0), polar_coverage_angle=20, rotation_angle=10, polar_placement_angle=45, azimuth_placement_angle=0) all_components.append(component) component = paramak.PortCutterRectangular( distance=3, z_pos=0, height=0.2, width=0.4, fillet_radius=0.02, azimuth_placement_angle=[0, 45, 90, 180]) all_components.append(component) component = paramak.PortCutterCircular( distance=3, z_pos=0.25, radius=0.1, # azimuth_placement_angle=[0, 45, 90, 180], # TODO: fix issue #548 azimuth_placement_angle=[0, 45, 90], ) all_components.append(component) component = paramak.VacuumVessel(height=2, inner_radius=1, thickness=0.2, rotation_angle=270) all_components.append(component) component = paramak.CoolantChannelRingStraight( height=200, channel_radius=10, ring_radius=70, number_of_coolant_channels=8, workplane="XY", rotation_axis="Z", stp_filename="coolant_channel_ring_straight.stp", ) all_components.append(component) component = paramak.CoolantChannelRingCurved( height=200, channel_radius=10, ring_radius=70, mid_offset=-20, number_of_coolant_channels=8, workplane="XY", path_workplane="XZ", stp_filename="coolant_channel_ring_curved.stp", force_cross_section=True) all_components.append(component) component = paramak.RotatedIsoscelesTriangle( height=20, base_length=15, pivot_angle=0, pivot_point=(100, 50), rotation_angle=70, workplane='XY', stp_filename='rotated_isosceles_triangle.stp') all_components.append(component) component = paramak.RotatedTrapezoid(length_1=10, length_2=20, length_3=30, pivot_angle=0, pivot_point=(100, 50), rotation_angle=45, stp_filename='rotated_trapezoid.stp') all_components.append(component) component = paramak.PoloidalSegments(number_of_segments=5, center_point=(400, 50)) all_components.append(component) component = paramak.TFCoilCasing(magnet=magnet, inner_offset=10, outer_offset=15, vertical_section_offset=20, distance=40) all_components.append(component) component = paramak.HexagonPin(length_of_side=5, distance=10, center_point=(10, 20)) all_components.append(component) return all_components
def make_demo_blanket(number_of_sections=8, gap_size=15, central_block_width=200): number_of_segments = 8 gap_size = 15. central_block_width = 200 large_dimention = 10000 # used to make large cutting slices offset = (360 / number_of_segments) / 2 # a plasma shape is made and used by the BlanketFP, which builds around # the plasma plasma = paramak.Plasma(elongation=1.59, triangularity=0.33, major_radius=910, minor_radius=290) plasma.solid # makes a block which is used later to make the to parallel gaps segments parallel_outboard_gaps_inner = paramak.ExtrudeStraightShape( points=[ (large_dimention, large_dimention), (large_dimention, -large_dimention), (0, -large_dimention), (0, large_dimention), ], distance=central_block_width, azimuth_placement_angle=np.linspace(0, 360, number_of_segments, endpoint=False)) # makes a larger block which has the smaller block cut away and the result # is two parallel gaps segments parallel_outboard_gaps_outer = paramak.ExtrudeStraightShape( points=[ (large_dimention, large_dimention), (large_dimention, -large_dimention), (0, -large_dimention), (0, large_dimention), ], distance=central_block_width + (gap_size * 2), azimuth_placement_angle=np.linspace(0, 360, number_of_segments, endpoint=False), cut=parallel_outboard_gaps_inner) # this makes a gap that seperates the inboard and outboard blanket inboard_to_outboard_gaps = paramak.ExtrudeStraightShape( points=[ (plasma.high_point[0] - (0.5 * gap_size), plasma.high_point[1]), (plasma.high_point[0] - (0.5 * gap_size), plasma.high_point[1] + 1000), (plasma.high_point[0] + (0.5 * gap_size), plasma.high_point[1] + 1000), (plasma.high_point[0] + (0.5 * gap_size), plasma.high_point[1]), ], distance=math.tan(math.radians(360 / (2 * number_of_segments))) * plasma.high_point[0] * 2, azimuth_placement_angle=np.linspace(0, 360, number_of_segments, endpoint=False)) # this makes the regular gaps (non parallel) gaps on the outboard blanket outboard_gaps = paramak.ExtrudeStraightShape( points=[ (large_dimention, large_dimention), (large_dimention, -large_dimention), (0, -large_dimention), (0, large_dimention), ], distance=gap_size, azimuth_placement_angle=np.linspace(0 + offset, 360 + offset, number_of_segments, endpoint=False)) # makes the outboard blanket with cuts for all the segmentation outboard_blanket = paramak.BlanketFP(plasma=plasma, thickness=100, stop_angle=90, start_angle=-60, offset_from_plasma=30, rotation_angle=360, cut=[ outboard_gaps, parallel_outboard_gaps_outer, inboard_to_outboard_gaps ]) # this makes the regular gaps on the outboard blanket inboard_gaps = paramak.ExtrudeStraightShape( points=[ (large_dimention, large_dimention), (large_dimention, -large_dimention), (0, -large_dimention), (0, large_dimention), ], distance=gap_size, azimuth_placement_angle=np.linspace(0, 360, number_of_segments * 2, endpoint=False)) # makes the inboard blanket with cuts for all the segmentation inboard_blanket = paramak.BlanketFP( plasma=plasma, thickness=100, stop_angle=90, start_angle=260, offset_from_plasma=30, rotation_angle=360, cut=[inboard_gaps, inboard_to_outboard_gaps], union=outboard_blanket) # saves the blanket as an stp file inboard_blanket.export_stp('blanket.stp')
def _make_blankets_layers(self): center_column_cutter = paramak.CenterColumnShieldCylinder( height=self._center_column_shield_height * 1.5, # extra 0.5 to ensure overlap, inner_radius=0, outer_radius=self._center_column_shield_end_radius, rotation_angle=360) self._firstwall = paramak.BlanketFP( plasma=self._plasma, thickness=self.firstwall_radial_thickness, offset_from_plasma=[ self.inner_plasma_gap_radial_thickness, self.plasma_gap_vertical_thickness, self.outer_plasma_gap_radial_thickness, self.plasma_gap_vertical_thickness, self.inner_plasma_gap_radial_thickness ], start_angle=-179, stop_angle=179, rotation_angle=self.rotation_angle, stp_filename="firstwall.stp", cut=center_column_cutter) self._blanket = paramak.BlanketFP( plasma=self._plasma, thickness=self.blanket_radial_thickness, offset_from_plasma=[ self.inner_plasma_gap_radial_thickness + self.firstwall_radial_thickness, self.plasma_gap_vertical_thickness + self.firstwall_radial_thickness, self.outer_plasma_gap_radial_thickness + self.firstwall_radial_thickness, self.plasma_gap_vertical_thickness + self.firstwall_radial_thickness, self.inner_plasma_gap_radial_thickness + self.firstwall_radial_thickness ], start_angle=-179, stop_angle=179, rotation_angle=self.rotation_angle, stp_filename="blanket.stp", cut=center_column_cutter) self._blanket_rear_wall = paramak.BlanketFP( plasma=self._plasma, thickness=self.blanket_rear_wall_radial_thickness, offset_from_plasma=[ self.inner_plasma_gap_radial_thickness + self.firstwall_radial_thickness + self.blanket_radial_thickness, self.plasma_gap_vertical_thickness + self.firstwall_radial_thickness + self.blanket_radial_thickness, self.outer_plasma_gap_radial_thickness + self.firstwall_radial_thickness + self.blanket_radial_thickness, self.plasma_gap_vertical_thickness + self.firstwall_radial_thickness + self.blanket_radial_thickness, self.inner_plasma_gap_radial_thickness + self.firstwall_radial_thickness + self.blanket_radial_thickness ], start_angle=-179, stop_angle=179, rotation_angle=self.rotation_angle, stp_filename="blanket_rear_wall.stp", cut=center_column_cutter)
def _make_component_cuts(self): # the divertor is cut away then the firstwall can be added to the # reactor using CQ operations self._firstwall.solid = self._firstwall.solid.cut(self._divertor.solid) self.shapes_and_components.append(self._firstwall) # cutting the supports away from the blanket self._blanket.solid = self._blanket.solid.cut(self._supports.solid) self.shapes_and_components.append(self._blanket) self._outboard_rear_blanket_wall_upper = paramak.RotateStraightShape( points=[ (self._center_column_shield_end_radius, self._blanket_rear_wall_start_height), (self._center_column_shield_end_radius, self._blanket_rear_wall_end_height), ( max([item[0] for item in self._inboard_firstwall.points]), self._blanket_rear_wall_end_height, ), ( max([item[0] for item in self._inboard_firstwall.points]), self._blanket_rear_wall_start_height, ), ], rotation_angle=self.rotation_angle, ) self._outboard_rear_blanket_wall_lower = paramak.RotateStraightShape( points=[ (self._center_column_shield_end_radius, -self._blanket_rear_wall_start_height), (self._center_column_shield_end_radius, -self._blanket_rear_wall_end_height), ( max([item[0] for item in self._inboard_firstwall.points]), -self._blanket_rear_wall_end_height, ), ( max([item[0] for item in self._inboard_firstwall.points]), -self._blanket_rear_wall_start_height, ), ], rotation_angle=self.rotation_angle, ) self._outboard_rear_blanket_wall = paramak.BlanketFP( plasma=self._plasma, start_angle=90, stop_angle=-90, offset_from_plasma=self.outer_plasma_gap_radial_thickness + self.firstwall_radial_thickness + self.outboard_blanket_radial_thickness, thickness=self.blanket_rear_wall_radial_thickness, rotation_angle=self.rotation_angle, stp_filename="outboard_rear_blanket_wall.stp", stl_filename="outboard_rear_blanket_wall.stl", name="outboard_rear_blanket_wall", material_tag="rear_blanket_wall_mat", union=[ self._outboard_rear_blanket_wall_upper, self._outboard_rear_blanket_wall_lower ], ) self.shapes_and_components.append(self._outboard_rear_blanket_wall) if self._tf_info_provided: self._tf_coil = paramak.ToroidalFieldCoilRectangle( with_inner_leg=False, horizontal_start_point=( self._inboard_tf_coils_start_radius, self._blanket_rear_wall_end_height, ), vertical_mid_point=(self._outboard_tf_coil_start_radius, 0), thickness=self.outboard_tf_coil_radial_thickness, number_of_coils=self.number_of_tf_coils, distance=self.outboard_tf_coil_poloidal_thickness, stp_filename="outboard_tf_coil.stp", stl_filename="outboard_tf_coil.stl", rotation_angle=self.rotation_angle) self.shapes_and_components.append(self._tf_coil) if self._pf_info_provided: self._pf_coil = paramak.PoloidalFieldCoilSet( heights=self.pf_coil_vertical_thicknesses, widths=self.pf_coil_radial_thicknesses, center_points=self._pf_coils_xy_values, rotation_angle=self.rotation_angle, stp_filename='pf_coils.stp', name="pf_coil", material_tag="pf_coil_mat", ) self.shapes_and_components.append(self._pf_coil)