def test_export_neutronics_description_without_plasma(self): """Creates a Reactor object and checks that the neutronics description is exported to a json file with the correct entires, exluding the optional plasma.""" os.system("rm manifest_test.json") test_shape = paramak.RotateStraightShape( points=[(0, 0), (0, 20), (20, 20)], rotation_angle=360, material_tag="test_material", stp_filename="test.stp", ) test_shape.tet_mesh = "size 60" test_plasma = paramak.Plasma(major_radius=500, minor_radius=100) test_reactor = paramak.Reactor([test_shape, test_plasma]) returned_filename = test_reactor.export_neutronics_description() with open("manifest.json") as json_file: neutronics_description = json.load(json_file) assert returned_filename == "manifest.json" assert Path("manifest.json").exists() is True assert len(neutronics_description) == 2 assert "stp_filename" in neutronics_description[0].keys() assert "material" in neutronics_description[0].keys() assert "tet_mesh" in neutronics_description[0].keys() assert neutronics_description[0]["material"] == "test_material" assert neutronics_description[0]["stp_filename"] == "test.stp" assert neutronics_description[0]["tet_mesh"] == "size 60" assert neutronics_description[1]["material"] == "Graveyard" assert neutronics_description[1]["stp_filename"] == "Graveyard.stp" os.system("rm manifest.json")
def test_plasma_x_points(self): """creates several plasmas with different configurations using the Plasma parametric component and checks the location of the x point for each""" for ( triangularity, elongation, minor_radius, major_radius, vertical_displacement, ) in zip( [-0.7, 0, 0.5], # triangularity [1, 1.5, 2], # elongation [100, 200, 300], # minor radius [300, 400, 600], # major radius [0, -10, 5], ): # displacement for config in ["non-null", "single-null", "double-null"]: # Run test_plasma = paramak.Plasma( configuration=config, triangularity=triangularity, elongation=elongation, minor_radius=minor_radius, major_radius=major_radius, vertical_displacement=vertical_displacement, ) # Expected expected_lower_x_point, expected_upper_x_point = None, None if config == "single-null" or config == "double-null": expected_lower_x_point = (1 - (1 + test_plasma.x_point_shift) * triangularity * minor_radius, - (1 + test_plasma.x_point_shift) * elongation * minor_radius + vertical_displacement, ) if config == "double-null": expected_upper_x_point = ( expected_lower_x_point[0], (1 + test_plasma.x_point_shift) * elongation * minor_radius + vertical_displacement, ) # Check for point, expected_point in zip( [test_plasma.lower_x_point, test_plasma.upper_x_point], [expected_lower_x_point, expected_upper_x_point], ): assert point == expected_point
def test_plasma_relative_volume(self): """Creates plasmas using the Plasma parametric component and checks that the relative volumes of the solids created are correct""" test_plasma = paramak.Plasma() test_plasma_volume = test_plasma.volume test_plasma.rotation_angle = 180 assert test_plasma.volume == pytest.approx(test_plasma_volume * 0.5)
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_export_plasma_source(self): """checks that export_stp() exports plasma stp file""" test_plasma = paramak.Plasma() os.system("rm plasma.stp") test_plasma.export_stp("plasma.stp") assert Path("plasma.stp").exists() == True os.system("rm plasma.stp")
def _make_plasma(self): plasma = paramak.Plasma( major_radius=self.major_radius, minor_radius=self.minor_radius, elongation=self.elongation, triangularity=self.triangularity, rotation_angle=self.rotation_angle, ) self._plasma = plasma return self._plasma
def test_export_plasma_source(self): """Creates a plasma using the Plasma parametric component and checks a stp file of the shape can be exported using the export_stp method.""" test_plasma = paramak.Plasma() os.system("rm plasma.stp") test_plasma.export_stp("plasma.stp") assert Path("plasma.stp").exists() os.system("rm plasma.stp")
def create_components(self): plasma = paramak.Plasma(major_radius=self.major_radius, minor_radius=self.minor_radius, elongation=self.elongation, triangularity=self.triangularity, rotation_angle=self.rotation_angle) plasma.create_solid() inboard_firstwall = paramak.BlanketConstantThicknessFP( plasma=plasma, start_angle=90, stop_angle=270, offset_from_plasma=self.offset_from_plasma, thickness=self.firstwall_thickness, rotation_angle=self.rotation_angle, stp_filename='inboard_firstwall.stp' ) outboard_firstwall = paramak.BlanketConstantThicknessFP( plasma=plasma, stop_angle=-70, start_angle=70, offset_from_plasma=self.offset_from_plasma, thickness=self.firstwall_thickness, rotation_angle=self.rotation_angle, stp_filename='outboard_firstwall.stp' ) # The height of this center column is calculated using CadQuery commands center_column_shield = paramak.CenterColumnShieldCylinder( height=2*(plasma.high_point[1] + self.offset_from_plasma), inner_radius=self.center_column_shield_inner_radius, outer_radius=self.center_column_shield_outer_radius, rotation_angle=self.rotation_angle, # color=centre_column_color, stp_filename="center_column_shield.stp", material_tag="center_column_material", ) inboard_tf_coils = paramak.InnerTfCoilsCircular( height=2*(plasma.high_point[1] + self.offset_from_plasma), outer_radius = self.center_column_shield_inner_radius, inner_radius = self.inner_bore, number_of_coils = self.number_of_tf_coils, gap_size=5, stp_filename="inboard_tf_coils.stp", material_tag="inboard_tf_coils_material", ) self.shapes_and_components = [center_column_shield, plasma, inboard_firstwall, inboard_tf_coils, outboard_firstwall]
def _make_plasma(self): plasma = paramak.Plasma( major_radius=self.major_radius, minor_radius=self.minor_radius, elongation=self.elongation, triangularity=self.triangularity, rotation_angle=self.rotation_angle, stl_filename="plasma.stl", ) plasma.create_solid() self.shapes_and_components.append(plasma) self._plasma = plasma
def test_plasma_x_points(self): """Checks the location of the x point for various plasma configurations """ triangularity = -0.7 elongation = 1.6 minor_radius = 200 major_radius = 600 for triangularity, elongation, minor_radius, major_radius in zip( [-0.7, 0, 0.5], # triangularity [1, 1.5, 2], # elongation [100, 200, 300], # minor radius [300, 400, 600]): # major radius for config in ["non-null", "single-null", "double-null"]: # Run test_plasma = paramak.Plasma( configuration=config, triangularity=triangularity, elongation=elongation, minor_radius=minor_radius, major_radius=major_radius) # Expected expected_lower_x_point, expected_upper_x_point = None, None if config == "single-null" or \ config == "double-null": expected_lower_x_point = ( 1-(1+test_plasma.x_point_shift)*triangularity * minor_radius, (1+test_plasma.x_point_shift)*elongation * minor_radius ) if config == "double-null": expected_upper_x_point = ( expected_lower_x_point[0], -expected_lower_x_point[1] ) # Check for point, expected_point in zip( [test_plasma.lower_x_point, test_plasma.upper_x_point], [expected_lower_x_point, expected_upper_x_point]): assert point == expected_point
def test_BlanketConstantThicknessFP_creation_plasma(self): """creates blanket from parametric shape and checks a solid is created""" plasma = paramak.Plasma( major_radius=300, minor_radius=50, triangularity=0.5, elongation=2, ) test_shape = paramak.BlanketConstantThicknessFP( plasma=plasma, thickness=200, stop_angle=90, start_angle=270, offset_from_plasma=30, ) assert test_shape.solid is not None assert test_shape.volume > 1000
def test_plasma_points_of_interest(self): test_plasma = paramak.Plasma(vertical_displacement=2) assert test_plasma.high_point == ( test_plasma.major_radius - test_plasma.triangularity * test_plasma.minor_radius, test_plasma.elongation * test_plasma.minor_radius + test_plasma.vertical_displacement, ) assert test_plasma.low_point == ( test_plasma.major_radius - test_plasma.triangularity * test_plasma.minor_radius, -test_plasma.elongation * test_plasma.minor_radius + test_plasma.vertical_displacement, ) assert test_plasma.outer_equatorial_point == ( test_plasma.major_radius + test_plasma.minor_radius, test_plasma.vertical_displacement) assert test_plasma.inner_equatorial_point == ( test_plasma.major_radius - test_plasma.minor_radius, test_plasma.vertical_displacement)
def test_plasma_attributes(self): """creates a plasma object and checks its attributes""" test_plasma = paramak.Plasma() assert type(test_plasma.elongation) == float def test_plasma_elongation_min_setting(): """checks ValueError is raised when an elongation < 0 is specified""" test_plasma.elongation = -1 self.assertRaises(ValueError, test_plasma_elongation_min_setting) def test_plasma_elongation_max_setting(): """checks ValueError is raised when an elongation > 4 is specified""" test_plasma.elongation = 400 self.assertRaises(ValueError, test_plasma_elongation_max_setting)
def make_plasma(major_radius, minor_radius, triangularity, elongation, name, color): """Creates a plasma object from argument inputs""" plasma = paramak.Plasma(major_radius=major_radius, minor_radius=minor_radius, triangularity=triangularity, elongation=elongation) plasma.name = "plasma" plasma.stp_filename = name + ".stp" plasma.single_null = True plasma.color = color plasma.rotation_angle = 180 plasma.find_points() plasma.export_2d_image(name + ".png") plasma.export_html(name + ".html") plasma.export_stp(name + ".stp") plasma.create_solid() return plasma
def test_plasma_attributes(self): """creates a plasma object using the Plasma parametric component and checks that its attributes can be set correctly""" test_plasma = paramak.Plasma() assert isinstance(test_plasma.elongation, float) def test_plasma_elongation_min_setting(): """checks ValueError is raised when an elongation < 0 is specified""" test_plasma.elongation = -1 self.assertRaises(ValueError, test_plasma_elongation_min_setting) def test_plasma_elongation_max_setting(): """checks ValueError is raised when an elongation > 4 is specified""" test_plasma.elongation = 400 self.assertRaises(ValueError, test_plasma_elongation_max_setting)
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 test_create_limits(self): """Creates a Shape object and checks that the create_limits function returns the expected values for x_min, x_max, z_min and z_max.""" test_shape = paramak.Shape() test_shape.points = [ (0, 0), (0, 10), (0, 20), (10, 20), (20, 20), (20, 10), (20, 0), (10, 0), ] assert test_shape.create_limits() == (0.0, 20.0, 0.0, 20.0) # test with a component which has a find_points method test_shape2 = paramak.Plasma() test_shape2.create_limits() assert test_shape2.x_min is not None
def test_plasma_attributes(self): """Creates a plasma object using the Plasma parametric component and checks that its attributes can be set correctly.""" test_plasma = paramak.Plasma() assert isinstance(test_plasma.elongation, float) def test_plasma_elongation_min_setting(): """checks ValueError is raised when an elongation < 0 is specified""" test_plasma.elongation = -1 self.assertRaises(ValueError, test_plasma_elongation_min_setting) def test_plasma_elongation_max_setting(): """checks ValueError is raised when an elongation > 4 is specified""" test_plasma.elongation = 400 self.assertRaises(ValueError, test_plasma_elongation_max_setting) def minor_radius_out_of_range(): """checks ValueError is raised when an minor_radius < 1 is specified""" test_plasma.minor_radius = 0.5 self.assertRaises(ValueError, minor_radius_out_of_range) def major_radius_out_of_range(): """checks ValueError is raised when an manor_radius < 1 is specified""" test_plasma.major_radius = 0.5 self.assertRaises(ValueError, major_radius_out_of_range)
def main(): outer_most_x = 900 blanket_height = 300 plasma = paramak.Plasma() plasma.major_radius = 250 plasma.minor_radius = 100 plasma.triangularity = 0.5 plasma.elongation = 2.5 plasma.rotation_angle = 180 centre_column = paramak.RotateMixedShape(points=[ (74.6, 687.0, "straight"), (171.0, 687.0, "straight"), (171.0, 459.9232, "spline"), (108.001, 249.9402, "spline"), (92.8995, 0, "spline"), (108.001, -249.9402, "spline"), (171.0, -459.9232, "straight"), (171.0, -687.0, "straight"), (74.6, -687.0, "straight"), ]) centre_column.stp_filename = "centre_column.stp" centre_column.rotation_angle = 180 blanket = paramak.RotateMixedShape(points=[ (325.4528, blanket_height, "straight"), (outer_most_x, blanket_height, "straight"), (outer_most_x, -blanket_height, "straight"), (325.4528, -blanket_height, "spline"), (389.9263, -138.1335, "spline"), (404.5108, 0, "spline"), (389.9263, 138.1335, "spline"), ]) blanket.stp_filename = "blanket.stp" blanket.rotation_angle = 180 firstwall = paramak.RotateMixedShape(points=[ (322.9528, blanket_height, "straight"), (325.4528, blanket_height, "spline"), (389.9263, 138.1335, "spline"), (404.5108, 0, "spline"), (389.9263, -138.1335, "spline"), (325.4528, -blanket_height, "straight"), (322.9528, -blanket_height, "spline"), (387.4263, -138.1335, "spline"), (402.0108, 0, "spline"), (387.4263, 138.1335, "spline"), ]) firstwall.stp_filename = "firstwall.stp" firstwall.rotation_angle = 180 divertor_bottom = paramak.RotateMixedShape(points=[ (192.4782, -447.204, "spline"), (272.4957, -370.5, "spline"), (322.9528, -blanket_height, "straight"), (outer_most_x, -blanket_height, "straight"), (outer_most_x, -687.0, "straight"), (171.0, -687.0, "straight"), (171.0, -459.9232, "spline"), (218.8746, -513.3484, "spline"), (362.4986, -602.3905, "straight"), (372.5012, -580.5742, "spline"), (237.48395, -497.21782, "spline"), ]) divertor_bottom.stp_filename = "divertor_bottom.stp" divertor_bottom.rotation_angle = 180 divertor_top = paramak.RotateMixedShape(points=[ (192.4782, 447.204, "spline"), (272.4957, 370.5, "spline"), (322.9528, blanket_height, "straight"), (outer_most_x, blanket_height, "straight"), (outer_most_x, 687.0, "straight"), (171.0, 687.0, "straight"), (171.0, 459.9232, "spline"), (218.8746, 513.3484, "spline"), (362.4986, 602.3905, "straight"), (372.5012, 580.5742, "spline"), (237.48395, 497.21782, "spline"), ]) divertor_top.stp_filename = "divertor_top.stp" divertor_top.rotation_angle = 180 core = paramak.RotateStraightShape( points=[(0, 687.0), (74.6, 687.0), (74.6, -687.0), (0, -687.0)]) core.stp_filename = "core.stp" core.rotation_angle = 180 # initiates a reactor object myreactor = paramak.Reactor([ plasma, blanket, core, divertor_top, divertor_bottom, firstwall, centre_column ]) myreactor.export_stp(output_folder="can_reactor_from_parameters") myreactor.export_html(filename="can_reactor_from_parameters/reactor.html")
def main(rotation_angle=180): inboard_pf_coils = paramak.PoloidalFieldCoilSet( center_points=[ (53.5, -169.58), (53.5, -118.43), (53.5, -46.54), (53.5, 46.54), (53.5, 118.43), (53.5, 169.58), ], heights=[ 41.5, 40.5, 82.95, 82.95, 40.5, 41.5, ], widths=[27.7, 27.7, 27.7, 27.7, 27.7, 27.7], rotation_angle=rotation_angle, stp_filename='inboard_pf_coils.stp') outboard_pf_coils = paramak.PoloidalFieldCoilSet( center_points=[ (86, 230), (86, -230), (164, 241), (164, -241), (263, 222), (263, -222), (373, 131), (373, -131), ], widths=[ 32, 32, 50, 50, 43, 43, 48, 48, ], heights=[ 40, 40, 30, 30, 28, 28, 37, 37, ], rotation_angle=rotation_angle, stp_filename='outboard_pf_coils.stp') div_coils = paramak.PoloidalFieldCoilSet(center_points=[ (207, 144), (207, 125), (207, -144), (207, -125), ], widths=[15, 15, 15, 15], heights=[15, 15, 15, 15], rotation_angle=rotation_angle, stp_filename='div_coils.stp') vs_coils = paramak.PoloidalFieldCoilSet(center_points=[ (240, 70), (240, -70), ], widths=[10, 10], heights=[10, 10], rotation_angle=rotation_angle, stp_filename='vs_coils.stp') EFCCu_coils_1 = paramak.RotateStraightShape( points=[ (235.56581986143186, -127.64976958525347), (240.1847575057737, -121.19815668202767), (246.65127020785218, -125.80645161290323), (242.0323325635104, -132.25806451612902), ], rotation_angle=rotation_angle, stp_filename='EFCCu_coils_1.stp') EFCCu_coils_2 = paramak.RotateStraightShape( points=[ (262.3556581986143, -90.78341013824888), (266.97459584295615, -84.33179723502303), (273.44110854503464, -88.94009216589859), (268.82217090069287, -94.47004608294935), ], rotation_angle=rotation_angle, stp_filename='EFCCu_coils_2.stp') EFCCu_coils_3 = paramak.RotateStraightShape( points=[ (281.7551963048499, -71.42857142857144), (289.1454965357968, -71.42857142857144), (289.1454965357968, -78.80184331797238), (281.7551963048499, -78.80184331797238), ], rotation_angle=rotation_angle, stp_filename='EFCCu_coils_3.stp') EFCCu_coils_4 = paramak.RotateStraightShape( points=[ (235.56581986143186, 127.64976958525347), (240.1847575057737, 121.19815668202767), (246.65127020785218, 125.80645161290323), (242.0323325635104, 132.25806451612902), ], rotation_angle=rotation_angle, stp_filename='EFCCu_coils_4.stp') EFCCu_coils_5 = paramak.RotateStraightShape( points=[ (262.3556581986143, 90.78341013824888), (266.97459584295615, 84.33179723502303), (273.44110854503464, 88.94009216589859), (268.82217090069287, 94.47004608294935), ], rotation_angle=rotation_angle, stp_filename='EFCCu_coils_5.stp') EFCCu_coils_6 = paramak.RotateStraightShape( points=[ (281.7551963048499, 71.42857142857144), (289.1454965357968, 71.42857142857144), (289.1454965357968, 78.80184331797238), (281.7551963048499, 78.80184331797238), ], rotation_angle=rotation_angle, stp_filename='EFCCu_coils_6.stp') plasma = paramak.Plasma( major_radius=185, minor_radius=57 - 6, # 3 is a small ofset to avoid overlaps triangularity=0.31, elongation=1.97, rotation_angle=rotation_angle, stp_filename='plasma.stp', ) antenna = paramak.RotateMixedShape(points=[ (263.2794457274827, 46.5437788018433, 'straight'), (263.2794457274827, -46.54377880184336, 'straight'), (231.87066974595842, -46.54377880184336, 'spline'), (243.87990762124713, 0, 'spline'), (231.87066974595842, 46.5437788018433, 'straight'), ], rotation_angle=rotation_angle, stp_filename='antenna.stp') tf_coil = paramak.ToroidalFieldCoilPrincetonD( R1=105, R2=339, thickness=33, distance=33, number_of_coils=12, rotation_angle=rotation_angle, stp_filename='tf_coil.stp') vac_vessel = paramak.RotateStraightShape(points=[ (117.32101616628177, 126.72811059907835), (163.51039260969978, 170.04608294930875), (181.98614318706697, 171.88940092165896), (196.76674364896073, 169.12442396313364), (196.76674364896073, 115.66820276497694), (236.4896073903002, 114.74654377880185), (273.44110854503464, 65.89861751152074), (272.51732101616625, -65.89861751152074), (236.4896073903002, -115.66820276497697), (196.76674364896073, -115.66820276497697), (196.76674364896073, -169.12442396313367), (181.98614318706697, -172.81105990783408), (163.51039260969978, -170.04608294930875), (117.32101616628177, -126.72811059907832), (117.32101616628177, 123.04147465437785), (123.78752886836028, 123.04147465437785), (123.78752886836028, -123.963133640553), (165.3579676674365, -162.67281105990781), (181.98614318706697, -164.5161290322581), (190.3002309468822, -162.67281105990781), (190.3002309468822, -112.90322580645159), (193.99538106235568, -109.21658986175117), (232.7944572748268, -109.21658986175117), (266.97459584295615, -63.13364055299536), (266.05080831408776, 62.21198156682027), (232.7944572748268, 109.21658986175115), (193.99538106235568, 109.21658986175115), (190.3002309468822, 111.98156682027647), (190.3002309468822, 162.67281105990784), (181.98614318706697, 164.51612903225805), (165.3579676674365, 162.67281105990784), (123.78752886836028, 123.04147465437785), (117.32101616628177, 123.04147465437785), ], rotation_angle=rotation_angle, stp_filename='vacvessel.stp') inner_vessel = paramak.RotateMixedShape( points=[ (269.7459584295612, -46.54377880184336, 'straight'), (231.87066974595842, -46.5437788018433, 'spline'), (223.55658198614316, -62.21198156682027, 'spline'), (207.85219399538107, -80.64516129032262, 'spline'), (166.28175519630486, -115.66820276497697, 'spline'), (164.43418013856814, -119.35483870967744, 'spline'), (164.43418013856814, -122.11981566820276, 'straight'), (173.67205542725173, -140.5529953917051, 'straight'), (184.75750577367205, -140.5529953917051, 'straight'), (184.75750577367205, -158.98617511520735, 'straight'), (181.98614318706697, -159.9078341013825, 'straight'), (147.80600461893764, -118.43317972350235, 'straight'), (129.33025404157044, -123.04147465437785, 'straight'), (145.95842956120094, -111.05990783410135, 'straight'), (126.55889145496536, -50.23041474654377, 'straight'), (127.48267898383372, 50.23041474654377, 'straight'), (145.95842956120094, 110.13824884792626, 'straight'), (128.40646651270208, 123.04147465437785, 'straight'), (147.80600461893764, 117.51152073732717, 'straight'), (181.98614318706697, 159.90783410138246, 'straight'), (185.6812933025404, 158.98617511520735, 'straight'), (184.75750577367205, 140.55299539170505, 'straight'), (172.74826789838338, 140.55299539170505, 'spline'), (164.43418013856814, 121.19815668202764, 'spline'), (164.43418013856814, 118.43317972350229, 'spline'), (165.3579676674365, 115.66820276497694, 'spline'), (173.67205542725173, 111.05990783410135, 'spline'), (207.85219399538107, 80.64516129032256, 'spline'), (220.7852193995381, 66.82027649769586, 'spline'), (231.87066974595842, 46.5437788018433, 'spline'), (268.82217090069287, 46.5437788018433, 'straight'), (268.82217090069287, 63.13364055299536, 'straight'), (233.71824480369514, 111.98156682027647, 'straight'), (193.99538106235568, 112.90322580645159, 'straight'), (192.14780600461893, 164.51612903225805, 'straight'), (163.51039260969978, 166.35944700460828, 'straight'), (121.93995381062356, 123.96313364055297, 'straight'), (121.0161662817552, -125.80645161290323, 'straight'), (163.51039260969978, -166.35944700460834, 'straight'), (192.14780600461893, -166.35944700460834, 'straight'), (193.99538106235568, -112.90322580645159, 'straight'), (234.64203233256353, -111.9815668202765, 'straight'), (269.7459584295612, -63.13364055299536, 'straight'), ], rotation_angle=rotation_angle, stp_filename='inner_vessel.stp', cut=[vac_vessel, vs_coils, antenna]) sparc = paramak.Reactor([ inboard_pf_coils, outboard_pf_coils, plasma, antenna, vs_coils, inner_vessel, tf_coil, EFCCu_coils_1, EFCCu_coils_2, EFCCu_coils_3, EFCCu_coils_4, EFCCu_coils_5, EFCCu_coils_6, vac_vessel, div_coils ]) sparc.export_stp() sparc.export_svg('htc_reactor.svg') sparc.export_html('htc_reactor.html')
def main(number_of_sections=8, gap_size=15, central_block_width=200): number_of_segments = 8 gap_size = 15. central_block_width = 200 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 # this makes a cutter shape that is used to make the blanket bananna # segment that has parallel sides parallel_outboard_gaps_outer = paramak.BlanketCutterParallels( thickness=gap_size, azimuth_placement_angle=np.linspace(0, 360, number_of_segments, endpoint=False), gap_size=central_block_width) # 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.BlanketCutterStar( 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.BlanketCutterStar( 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 create_components(self): shapes_or_components = [] plasma = paramak.Plasma(major_radius=self.major_radius, minor_radius=self.minor_radius, elongation=self.elongation, triangularity=self.triangularity, rotation_angle=self.rotation_angle) plasma.create_solid() shapes_or_components.append(plasma) # this is the radial build sequence, where one componet stops and another starts inner_bore_start_radius = 0 inner_bore_end_radius = inner_bore_start_radius + self.inner_bore_radial_thickness inboard_tf_coils_start_radius = inner_bore_end_radius inboard_tf_coils_end_radius = inboard_tf_coils_start_radius + self.inboard_tf_leg_radial_thickness center_column_shield_start_radius = inboard_tf_coils_end_radius center_column_shield_end_radius = center_column_shield_start_radius + self.center_column_shield_radial_thickness divertor_start_radius = center_column_shield_end_radius divertor_end_radius = center_column_shield_end_radius + self.divertor_radial_thickness firstwall_start_radius = center_column_shield_end_radius \ + self.inner_plasma_gap_radial_thickness \ + self.plasma_radial_thickness \ + self.outer_plasma_gap_radial_thickness firstwall_end_radius = firstwall_start_radius + self.firstwall_radial_thickness blanket_start_radius = firstwall_end_radius blanket_end_radius = blanket_start_radius + self.blanket_radial_thickness blanket_read_wall_start_radius = blanket_end_radius blanket_read_wall_end_radius = blanket_read_wall_start_radius + self.blanket_rear_wall_radial_thickness #this is the vertical build sequence, componets build on each other in a similar manner to the radial build divertor_start_height = plasma.high_point[ 1] + self.outer_plasma_gap_radial_thickness # make it the same hight as fw, blanket, rw divertor_end_height = divertor_start_height + self.firstwall_radial_thickness + self.blanket_radial_thickness + self.blanket_rear_wall_radial_thickness firstwall_start_height = divertor_start_height firstwall_end_height = firstwall_start_height + self.firstwall_radial_thickness blanket_start_height = firstwall_end_height blanket_end_height = blanket_start_height + self.blanket_radial_thickness blanket_rear_wall_start_height = blanket_end_height blanket_rear_wall_end_height = blanket_rear_wall_start_height + self.blanket_rear_wall_radial_thickness tf_coil_height = blanket_rear_wall_end_height center_column_shield_height = blanket_rear_wall_end_height * 2 if self.pf_coil_vertical_thicknesses != None and self.pf_coil_radial_thicknesses != None and self.pf_coil_to_rear_blanket_radial_gap != None: number_of_pf_coils = len(self.pf_coil_vertical_thicknesses) y_position_step = (2 * (blanket_rear_wall_end_height + self.pf_coil_to_rear_blanket_radial_gap)) / ( number_of_pf_coils + 1) pf_coils_y_values = [] pf_coils_x_values = [] # adds in coils with equal spacing strategy, should be updated to allow user positions for i in range(number_of_pf_coils): y_value = blanket_rear_wall_end_height + self.pf_coil_to_rear_blanket_radial_gap - y_position_step * ( i + 1) x_value = blanket_read_wall_end_radius + self.pf_coil_to_rear_blanket_radial_gap + \ 0.5*self.pf_coil_radial_thicknesses[i] pf_coils_y_values.append(y_value) pf_coils_x_values.append(x_value) pf_coil_start_radius = blanket_read_wall_end_radius + self.pf_coil_to_rear_blanket_radial_gap pf_coil_end_radius = pf_coil_start_radius + max( self.pf_coil_radial_thicknesses) if self.pf_coil_to_tf_coil_radial_gap != None and self.tf_coil_radial_thickness != None: tf_coil_start_radius = pf_coil_end_radius + self.pf_coil_to_rear_blanket_radial_gap tf_coil_end_radius = tf_coil_start_radius + self.tf_coil_radial_thickness if self.rotation_angle < 360: max_high = 3 * center_column_shield_height max_width = 3 * blanket_read_wall_end_radius cutting_slice = paramak.RotateStraightShape( points=[ (0, max_high), (max_width, max_high), (max_width, -max_high), (0, -max_high), ], rotation_angle=360 - self.rotation_angle, azimuth_placement_angle=360 - self.rotation_angle) else: cutting_slice = None # shapes_or_components.append(inboard_tf_coils) inboard_tf_coils = paramak.CenterColumnShieldCylinder( height=tf_coil_height * 2, inner_radius=inboard_tf_coils_start_radius, outer_radius=inboard_tf_coils_end_radius, rotation_angle=self.rotation_angle, # color=centre_column_color, stp_filename="inboard_tf_coils.stp", name="inboard_tf_coils", material_tag="inboard_tf_coils_mat", ) shapes_or_components.append(inboard_tf_coils) center_column_shield = paramak.CenterColumnShieldCylinder( height=center_column_shield_height, inner_radius=center_column_shield_start_radius, outer_radius=center_column_shield_end_radius, rotation_angle=self.rotation_angle, # color=centre_column_color, stp_filename="center_column_shield.stp", name="center_column_shield", material_tag="center_column_shield_mat", ) shapes_or_components.append(center_column_shield) space_for_divertor = plasma.high_point[ 0] - center_column_shield_end_radius #add blanket if the divertor doesn't take up all the space if space_for_divertor > self.divertor_radial_thickness: print( 'making extra blanket as there is space between the divertor and existing blanket' ) extra_blanket_upper = paramak.RotateStraightShape( points=[ (divertor_end_radius, blanket_start_height), (divertor_end_radius, blanket_end_height), (plasma.high_point[0], blanket_end_height), (plasma.high_point[0], blanket_start_height), ], rotation_angle=self.rotation_angle, stp_filename='extra_blanket_upper.stp', name='extra_blanket_upper', material_tag='blanket_mat') shapes_or_components.append(extra_blanket_upper) extra_firstwall_upper = paramak.RotateStraightShape( points=[ (divertor_end_radius, firstwall_start_height), (divertor_end_radius, firstwall_end_height), (plasma.high_point[0], firstwall_end_height), (plasma.high_point[0], firstwall_start_height), ], rotation_angle=self.rotation_angle, stp_filename='extra_firstwall_upper.stp', name='extra_firstwall_upper', material_tag='firstwall_mat') shapes_or_components.append(extra_firstwall_upper) extra_blanket_rear_wall_upper = paramak.RotateStraightShape( points=[ (divertor_end_radius, blanket_rear_wall_start_height), (divertor_end_radius, blanket_rear_wall_end_height), (plasma.high_point[0], blanket_rear_wall_end_height), (plasma.high_point[0], blanket_rear_wall_start_height), ], rotation_angle=self.rotation_angle, stp_filename='extra_blanket_rear_wall_upper.stp', name='extra_blanket_rear_wall_upper', material_tag='blanket_rear_wall_mat') shapes_or_components.append(extra_blanket_rear_wall_upper) extra_blanket_lower = paramak.RotateStraightShape( points=[ (divertor_end_radius, -blanket_start_height), (divertor_end_radius, -blanket_end_height), (plasma.high_point[0], -blanket_end_height), (plasma.high_point[0], -blanket_start_height), ], rotation_angle=self.rotation_angle, stp_filename='extra_blanket_lower.stp', name='extra_blanket_lower', material_tag='blanket_mat') shapes_or_components.append(extra_blanket_lower) extra_firstwall_lower = paramak.RotateStraightShape( points=[ (divertor_end_radius, -firstwall_start_height), (divertor_end_radius, -firstwall_end_height), (plasma.high_point[0], -firstwall_end_height), (plasma.high_point[0], -firstwall_start_height), ], rotation_angle=self.rotation_angle, stp_filename='extra_firstwall_lower.stp', name='extra_firstwall_lower', material_tag='firstwall_mat') shapes_or_components.append(extra_firstwall_lower) extra_blanket_rear_wall_lower = paramak.RotateStraightShape( points=[ (divertor_end_radius, -blanket_rear_wall_start_height), (divertor_end_radius, -blanket_rear_wall_end_height), (plasma.high_point[0], -blanket_rear_wall_end_height), (plasma.high_point[0], -blanket_rear_wall_start_height), ], rotation_angle=self.rotation_angle, stp_filename='extra_blanket_rear_wall_lower.stp', name='extra_blanket_rear_wall_lower', material_tag='blanket_rear_wall_mat') shapes_or_components.append(extra_blanket_rear_wall_lower) divertor_upper_part = paramak.RotateStraightShape( points=[ (divertor_start_radius, divertor_end_height), (divertor_start_radius, divertor_start_height), (divertor_end_radius, divertor_start_height), (divertor_end_radius, divertor_end_height), ], stp_filename='divertor_upper.stp', name='divertor_upper', rotation_angle=self.rotation_angle, material_tag='divertor_mat') shapes_or_components.append(divertor_upper_part) # negative signs used as this is in the negative side of the Z axis divertor_lower_part = paramak.RotateStraightShape( points=[ (divertor_start_radius, -divertor_end_height), (divertor_start_radius, -divertor_start_height), (divertor_end_radius, -divertor_start_height), (divertor_end_radius, -divertor_end_height), ], stp_filename='divertor_lower.stp', name='divertor_lower', rotation_angle=self.rotation_angle, material_tag='divertor_mat') shapes_or_components.append(divertor_lower_part) # curve divertor arround if it is larger than the horitonal space provided elif self.divertor_radial_thickness > space_for_divertor: length_of_curved_section = self.divertor_radial_thickness - space_for_divertor center_point, radius = paramak.utils.find_center_point_of_circle( point1=(firstwall_start_radius, 0), point2=(plasma.high_point[0], firstwall_start_height), point3=(plasma.low_point[0], -firstwall_start_height)) circumference = 2. * math.pi * radius rotation_angle = (length_of_curved_section * 2 * math.pi) / circumference new_point_x1, new_point_y1 = paramak.utils.rotate( center_point, (plasma.high_point[0], firstwall_start_height), -rotation_angle / 2.) new_point_x2, new_point_y2 = paramak.utils.rotate( center_point, (plasma.high_point[0], firstwall_start_height), -rotation_angle) new_point_x3, new_point_y3 = paramak.utils.rotate( center_point, (plasma.high_point[0], blanket_rear_wall_end_height), -rotation_angle) new_point_x4, new_point_y4 = paramak.utils.rotate( center_point, (plasma.high_point[0], blanket_rear_wall_end_height), -rotation_angle / 2.) divertor_upper_part = paramak.RotateMixedShape( points=[ (divertor_start_radius, divertor_end_height, 'straight'), (divertor_start_radius, divertor_start_height, 'straight'), (divertor_start_radius + space_for_divertor, divertor_start_height, 'circle'), (new_point_x1, new_point_y1, 'circle'), (new_point_x2, new_point_y2, 'straight'), (new_point_x3, new_point_y3, 'circle'), (new_point_x4, new_point_y4, 'circle'), (divertor_start_radius + space_for_divertor, divertor_end_height, 'straight'), ], stp_filename='divertor_upper.stp', name='divertor_upper', rotation_angle=self.rotation_angle, material_tag='divertor_mat') shapes_or_components.append(divertor_upper_part) # negative signs used as this is in the negative side of the Z axis divertor_lower_part = paramak.RotateMixedShape( points=[ (divertor_start_radius, -divertor_end_height, 'straight'), (divertor_start_radius, -divertor_start_height, 'straight'), (divertor_start_radius + space_for_divertor, -divertor_start_height, 'circle'), (new_point_x1, -new_point_y1, 'circle'), (new_point_x2, -new_point_y2, 'straight'), (new_point_x3, -new_point_y3, 'circle'), (new_point_x4, -new_point_y4, 'circle'), (divertor_start_radius + space_for_divertor, -divertor_end_height, 'straight'), ], stp_filename='divertor_lower.stp', name='divertor_lower', rotation_angle=self.rotation_angle, material_tag='divertor_mat') shapes_or_components.append(divertor_lower_part) elif self.divertor_radial_thickness == space_for_divertor: divertor_upper_part = paramak.RotateMixedShape( points=[ (divertor_start_radius, divertor_end_height, 'straight'), (divertor_start_radius, divertor_start_height, 'straight'), (divertor_start_radius + space_for_divertor, divertor_start_height, 'straight'), (divertor_start_radius + space_for_divertor, divertor_end_height, 'straight'), ], stp_filename='divertor_upper.stp', name='divertor_upper', rotation_angle=self.rotation_angle, material_tag='divertor_mat') shapes_or_components.append(divertor_upper_part) # negative signs used as this is in the negative side of the Z axis divertor_lower_part = paramak.RotateMixedShape( points=[ (divertor_start_radius, -divertor_end_height, 'straight'), (divertor_start_radius, -divertor_start_height, 'straight'), (divertor_start_radius + space_for_divertor, -divertor_start_height, 'straight'), (divertor_start_radius + space_for_divertor, -divertor_end_height, 'straight'), ], stp_filename='divertor_lower.stp', name='divertor_lower', rotation_angle=self.rotation_angle, material_tag='divertor_mat') shapes_or_components.append(divertor_lower_part) firstwall = paramak.BlanketConstantThicknessArcV( inner_mid_point=(firstwall_start_radius, 0), inner_upper_point=(plasma.high_point[0], firstwall_start_height), inner_lower_point=(plasma.low_point[0], -firstwall_start_height), thickness=self.firstwall_radial_thickness, rotation_angle=self.rotation_angle, stp_filename='firstwall.stp', name='firstwall', material_tag='firstwall_mat', cut=[divertor_lower_part, divertor_upper_part]) shapes_or_components.append(firstwall) blanket = paramak.BlanketConstantThicknessArcV( inner_mid_point=(blanket_start_radius, 0), inner_upper_point=(plasma.high_point[0], blanket_start_height), inner_lower_point=(plasma.low_point[0], -blanket_start_height), thickness=self.blanket_radial_thickness, rotation_angle=self.rotation_angle, stp_filename='blanket.stp', name='blanket', material_tag='blanket_mat', cut=[divertor_lower_part, divertor_upper_part]) shapes_or_components.append(blanket) blanket_rear_casing = paramak.BlanketConstantThicknessArcV( inner_mid_point=(blanket_read_wall_start_radius, 0), inner_upper_point=(plasma.high_point[0], blanket_rear_wall_start_height), inner_lower_point=(plasma.low_point[0], -blanket_rear_wall_start_height), thickness=self.blanket_rear_wall_radial_thickness, rotation_angle=self.rotation_angle, stp_filename='blanket_rear_wall.stp', name='blanket_rear_wall', material_tag='blanket_rear_wall_mat', cut=[divertor_lower_part, divertor_upper_part]) shapes_or_components.append(blanket_rear_casing) if self.pf_coil_vertical_thicknesses != None and self.pf_coil_radial_thicknesses != None and self.pf_coil_to_rear_blanket_radial_gap != None: for i, (rt, vt, y_value, x_value) in enumerate( zip( self.pf_coil_radial_thicknesses, self.pf_coil_vertical_thicknesses, pf_coils_y_values, pf_coils_x_values, )): pf_coil = paramak.PoloidalFieldCoil( width=rt, height=vt, center_point=(x_value, y_value), rotation_angle=self.rotation_angle, stp_filename='pf_coil_' + str(i) + '.stp', name='pf_coil', material_tag='pf_coil_mat') shapes_or_components.append(pf_coil) if self.pf_coil_to_tf_coil_radial_gap != None and self.tf_coil_radial_thickness != None: tf_coil = paramak.ToroidalFieldCoilRectangle( inner_upper_point=(inboard_tf_coils_start_radius, tf_coil_height), inner_lower_point=(inboard_tf_coils_start_radius, -tf_coil_height), inner_mid_point=(tf_coil_start_radius, 0), thickness=self.tf_coil_radial_thickness, number_of_coils=self.number_of_tf_coils, distance=self.tf_coil_poloidal_thickness, cut=cutting_slice) shapes_or_components.append(tf_coil) self.shapes_and_components = shapes_or_components
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.BlanketConstantThicknessFP( plasma=plasma, thickness=100, stop_angle=90, start_angle=-90, offset_from_plasma=30, rotation_angle=180, stp_filename='blanket_constant_thickness_outboard_plasma.stp') all_components.append(component) component = paramak.BlanketConstantThicknessFP( plasma=plasma, thickness=100, stop_angle=90, start_angle=250, offset_from_plasma=30, rotation_angle=180, stp_filename='blanket_constant_thickness_inboard_plasma.stp') all_components.append(component) component = paramak.BlanketConstantThicknessFP( plasma=plasma, thickness=100, stop_angle=250, start_angle=-90, offset_from_plasma=30, rotation_angle=180, stp_filename='blanket_constant_thickness_plasma.stp') all_components.append(component) component = paramak.ToroidalFieldCoilCoatHanger( horizontal_start_point=(200, 500), horizontal_length=400, vertical_start_point=(700, 50), vertical_length=500, thickness=50, distance=50, stp_filename='toroidal_field_coil_coat_hanger.stp', number_of_coils=5) all_components.append(component) component = paramak.CenterColumnShieldCylinder( inner_radius=80, outer_radius=100, height=300, rotation_angle=rot_angle, stp_filename='center_column_shield_cylinder.stp') all_components.append(component) component = 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(component) component = 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(component) component = 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(component) component = 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(component) component = 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(component) # # component = paramak.DivertorBlock( # major_radius = 800, # minor_radius = 400, # triangularity = 1.2, # elongation = 0.9, # thickness = 50, # offset_from_plasma = 20, # start # ) 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) 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) 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( inner_upper_point=(100, 700), inner_mid_point=(800, 0), inner_lower_point=(100, -700), thickness=150, distance=60, stp_filename='tf_coil_rectangle.stp', number_of_coils=6) all_components.append(component) component = paramak.ITERtypeDivertor( # default parameters rotation_angle=rot_angle, stp_filename='ITER_type_divertor.stp') all_components.append(component) return all_components
def main(): plasma = paramak.Plasma( major_radius=250, minor_radius=100, triangularity=0.5, elongation=2.5, rotation_angle=180, ) centre_column = paramak.RotateMixedShape(rotation_angle=180, points=[ (74.6, 687.0, "straight"), (171.0, 687.0, "straight"), (171.0, 459.9232, "spline"), (108.001, 249.9402, "spline"), (92.8995, 0, "spline"), (108.001, -249.9402, "spline"), (171.0, -459.9232, "straight"), (171.0, -687.0, "straight"), (74.6, -687.0, "straight"), ]) centre_column.stp_filename = "centre_column.stp" centre_column.stl_filename = "centre_column.stl" blanket = paramak.RotateMixedShape(rotation_angle=180, points=[ (325.4886, 300.5, "straight"), (538.4886, 300.5, "straight"), (538.4886, -300.5, "straight"), (325.4528, -300.5, "spline"), (389.9263, -138.1335, "spline"), (404.5108, 0, "spline"), (389.9263, 138.1335, "spline"), ]) blanket.stp_filename = "blanket.stp" blanket.stl_filename = "blanket.stl" firstwall = paramak.RotateMixedShape(rotation_angle=180, points=[ (322.9528, 300.5, "straight"), (325.4528, 300.5, "spline"), (389.9263, 138.1335, "spline"), (404.5108, 0, "spline"), (389.9263, -138.1335, "spline"), (325.4528, -300.5, "straight"), (322.9528, -300.5, "spline"), (387.4263, -138.1335, "spline"), (402.0108, 0, "spline"), (387.4263, 138.1335, "spline"), ]) firstwall.stp_filename = "firstwall.stp" firstwall.stl_filename = "firstwall.stl" divertor_bottom = paramak.RotateMixedShape( rotation_angle=180, points=[ (192.4782, -447.204, "spline"), (272.4957, -370.5, "spline"), (322.9528, -300.5, "straight"), (538.4886, -300.5, "straight"), (538.4886, -687.0, "straight"), (171.0, -687.0, "straight"), (171.0, -459.9232, "spline"), (218.8746, -513.3484, "spline"), (362.4986, -602.3905, "straight"), (372.5012, -580.5742, "spline"), (237.48395, -497.21782, "spline"), ]) divertor_bottom.stp_filename = "divertor_bottom.stp" divertor_bottom.stl_filename = "divertor_bottom.stl" divertor_top = paramak.RotateMixedShape(rotation_angle=180, points=[ (192.4782, 447.204, "spline"), (272.4957, 370.5, "spline"), (322.9528, 300.5, "straight"), (538.4886, 300.5, "straight"), (538.4886, 687.0, "straight"), (171.0, 687.0, "straight"), (171.0, 459.9232, "spline"), (218.8746, 513.3484, "spline"), (362.4986, 602.3905, "straight"), (372.5012, 580.5742, "spline"), (237.48395, 497.21782, "spline"), ]) divertor_top.stp_filename = "divertor_top.stp" divertor_top.stl_filename = "divertor_top.stl" core = paramak.RotateStraightShape(rotation_angle=180, points=[(0, 687.0), (74.6, 687.0), (74.6, -687.0), (0, -687.0)]) core.stp_filename = "core.stp" core.stl_filename = "core.stl" myreactor = paramak.Reactor([ plasma, blanket, core, divertor_top, divertor_bottom, firstwall, centre_column ]) myreactor.export_stp(output_folder="can_reactor_from_points") myreactor.export_stl(output_folder="can_reactor_from_points") myreactor.export_html("can_reactor_from_points/reactor.html")
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')