示例#1
0
        def test_stl_filename_duplication_rotate_mixed():
            """Checks ValueError is raised when RotateMixedShapes with
            duplicate stl filenames are added."""

            test_shape = paramak.RotateMixedShape(
                points=[(0, 0, "straight"), (0, 20, "straight"), (20, 20, "straight")],
                stl_filename="filename.stl",
            )
            test_shape2 = paramak.RotateMixedShape(
                points=[(0, 0, "straight"), (0, 20, "straight"), (20, 20, "straight")],
                stl_filename="filename.stl",
            )
            test_shape.rotation_angle = 360
            test_shape.create_solid()
            my_reactor = paramak.Reactor([test_shape, test_shape2])
            my_reactor.export_stl()
示例#2
0
def make_cad_model_with_paramak():
    """
    Makes a reactor object from two parametric
    shapes. Exports the neutronics description
    and stp files for the reactor
    """

    width = 500

    # creates a parametric shape
    pf_coil = paramak.RotateStraightShape(points=[(width, width), (550, width),
                                                  (550, 550), (500, 550)],
                                          stp_filename='pf_coil.stp',
                                          material_tag='pf_coil_material')

    pf_coil.export_html('test.html')

    # creates another parametric shape
    blanket = paramak.RotateMixedShape(
        points=[(538, 305, "straight"), (538, -305, "straight"),
                (322, -305, "spline"), (470, 0, "spline"),
                (322, 305, "straight")],
        rotation_angle=40,
        azimuth_placement_angle=[0, 45, 90, 135, 180, 225, 270, 315],
        stp_filename='blanket.stp',
        material_tag='blanket_material')
    blanket.solid

    # creates a reactor object from the two components
    my_reactor = paramak.Reactor([blanket, pf_coil])

    # exports neutronics description and stp files
    my_reactor.export_neutronics_description()
    my_reactor.export_stp()
def main(filename="blanket_from_points.stp"):

    blanket = paramak.RotateMixedShape(rotation_angle=180,
                                       points=[
                                           (538, 305, "straight"),
                                           (538, -305, "straight"),
                                           (322, -305, "spline"),
                                           (470, 0, "spline"),
                                           (322, 305, "straight"),
                                       ])

    blanket.export_stp(filename=filename)
示例#4
0
def main():

    height = 700
    blanket_rear = 400
    blanket_front = 300
    blanket_mid_point = 350

    blanket = paramak.RotateMixedShape(points=[
        (blanket_rear, height / 2.0, "straight"),
        (blanket_rear, -height / 2.0, "straight"),
        (blanket_front, -height / 2.0, "spline"),
        (blanket_mid_point, 0, "spline"),
        (blanket_front, height / 2.0, "straight"),
    ])

    blanket.rotation_angle = 180
    blanket.export_stp("blanket_from_parameters.stp")
def main():

    # rotate examples

    # this makes a rectangle and rotates it to make a solid
    rotated_straights = paramak.RotateStraightShape(rotation_angle=180,
                                                    points=[(400, 100),
                                                            (400, 200),
                                                            (600, 200),
                                                            (600, 100)])
    rotated_straights.export_stp("rotated_straights.stp")
    rotated_straights.export_html("rotated_straights.html")

    # this makes a banana shape and rotates it to make a solid
    rotated_spline = paramak.RotateSplineShape(rotation_angle=180,
                                               points=[
                                                   (500, 0),
                                                   (500, -20),
                                                   (400, -300),
                                                   (300, -300),
                                                   (400, 0),
                                                   (300, 300),
                                                   (400, 300),
                                                   (500, 20),
                                               ])
    rotated_spline.export_stp("rotated_spline.stp")
    rotated_spline.export_html("rotated_spline.html")

    # this makes a shape with straight, spline and circular edges and rotates
    # it to make a solid
    rotated_mixed = paramak.RotateMixedShape(rotation_angle=180,
                                             points=[
                                                 (100, 0, "straight"),
                                                 (200, 0, "circle"),
                                                 (250, 50, "circle"),
                                                 (200, 100, "straight"),
                                                 (150, 100, "spline"),
                                                 (140, 75, "spline"),
                                                 (110, 45, "spline"),
                                             ])
    rotated_mixed.export_stp("rotated_mixed.stp")
    rotated_mixed.export_html("rotated_mixed.html")

    # this makes a circular shape and rotates it to make a solid
    rotated_circle = paramak.RotateCircleShape(rotation_angle=180,
                                               points=[(50, 0)],
                                               radius=5,
                                               workplane="XZ")
    rotated_circle.export_stp("rotated_circle.stp")
    rotated_circle.export_html("rotated_circle.html")

    # extrude examples

    # this makes a banana shape with straight edges and rotates it to make a
    # solid
    extruded_straight = paramak.ExtrudeStraightShape(distance=200,
                                                     points=[
                                                         (300, -300),
                                                         (400, 0),
                                                         (300, 300),
                                                         (400, 300),
                                                         (500, 0),
                                                         (400, -300),
                                                     ])
    extruded_straight.export_stp("extruded_straight.stp")
    extruded_straight.export_html("extruded_straight.html")

    # this makes a banana shape and rotates it to make a solid
    extruded_spline = paramak.ExtrudeSplineShape(distance=200,
                                                 points=[
                                                     (500, 0),
                                                     (500, -20),
                                                     (400, -300),
                                                     (300, -300),
                                                     (400, 0),
                                                     (300, 300),
                                                     (400, 300),
                                                     (500, 20),
                                                 ])
    extruded_spline.export_stp("extruded_spline.stp")
    extruded_spline.export_html("extruded_spline.html")

    # this makes a banana shape straight top and bottom edges and extrudes it
    # to make a solid
    extruded_mixed = paramak.ExtrudeMixedShape(
        distance=100,
        points=[
            (100, 0, "straight"),
            (200, 0, "circle"),
            (250, 50, "circle"),
            (200, 100, "straight"),
            (150, 100, "spline"),
            (140, 75, "spline"),
            (110, 45, "spline"),
        ],
    )
    extruded_mixed.export_stp("extruded_mixed.stp")
    extruded_mixed.export_html("extruded_mixed.html")

    # this makes a circular shape and extrudes it to make a solid
    extruded_circle = paramak.ExtrudeCircleShape(points=[(20, 0)],
                                                 radius=20,
                                                 distance=200)
    extruded_circle.export_stp("extruded_circle.stp")
    extruded_circle.export_html("extruded_circle.html")

    # sweep examples

    # this makes a banana shape with straight edges and sweeps it along a
    # spline to make a solid
    sweep_straight = paramak.SweepStraightShape(points=[(-150, 300),
                                                        (-50, 300), (50, 0),
                                                        (-50, -300),
                                                        (-150, -300),
                                                        (-50, 0)],
                                                path_points=[(50, 0),
                                                             (150, 400),
                                                             (400, 500),
                                                             (650, 600),
                                                             (750, 1000)],
                                                workplane="XY",
                                                path_workplane="XZ")
    sweep_straight.export_stp("sweep_straight.stp")
    sweep_straight.export_html("sweep_straight.html")

    # this makes a banana shape with spline edges and sweeps it along a spline
    # to make a solid
    sweep_spline = paramak.SweepSplineShape(points=[(50, 0), (50, -20),
                                                    (-50, -300), (-150, -300),
                                                    (-50, 0), (-150, 300),
                                                    (-50, 300), (50, 20)],
                                            path_points=[(50, 0), (150, 400),
                                                         (400, 500),
                                                         (650, 600),
                                                         (750, 1000)],
                                            workplane="XY",
                                            path_workplane="XZ")
    sweep_spline.export_stp("sweep_spline.stp")
    sweep_spline.export_html("sweep_spline.html")

    # this makes a shape with straight, spline and circular edges and sweeps
    # it along a spline to make a solid
    sweep_mixed = paramak.SweepMixedShape(points=[(-80, -50, "straight"),
                                                  (20, -50, "circle"),
                                                  (70, 0, "circle"),
                                                  (20, 50, "straight"),
                                                  (-30, 50, "spline"),
                                                  (-40, 25, "spline"),
                                                  (-70, -5, "spline")],
                                          path_points=[(50, 0), (150, 400),
                                                       (400, 500), (650, 600),
                                                       (750, 1000)],
                                          workplane="XY",
                                          path_workplane="XZ")
    sweep_mixed.export_stp("sweep_mixed.stp")
    sweep_mixed.export_html("sweep_mixed.html")

    # this makes a circular shape and sweeps it to make a solid
    sweep_circle = paramak.SweepCircleShape(radius=40,
                                            path_points=[(50, 0), (150, 400),
                                                         (400, 500),
                                                         (650, 600),
                                                         (750, 1000)],
                                            workplane="XY",
                                            path_workplane="XZ")
    sweep_circle.export_stp("sweep_circle.stp")
    sweep_circle.export_html("sweep_circle.html")
示例#6
0
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')
示例#7
0
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")
示例#8
0
def main():

    # rotate examples

    # this makes a rectangle and rotates it to make a solid
    rotated_straights = paramak.RotateStraightShape(
        points=[(400, 100), (400, 200), (600, 200), (600, 100)])
    rotated_straights.rotation_angle = 180
    rotated_straights.export_stp("rotated_straights.stp")
    rotated_straights.export_html("rotated_straights.html")

    # this makes a banana shape and rotates it to make a solid
    rotated_spline = paramak.RotateSplineShape(points=[
        (500, 0),
        (500, -20),
        (400, -300),
        (300, -300),
        (400, 0),
        (300, 300),
        (400, 300),
        (500, 20),
    ])
    rotated_spline.rotation_angle = 180
    rotated_spline.export_stp("rotated_spline.stp")
    rotated_spline.export_html("rotated_spline.html")

    # this makes a shape with straight, spline and circular edges and rotates it to make a solid
    rotated_mixed = paramak.RotateMixedShape(points=[
        (100, 0, 'straight'),
        (200, 0, 'circle'),
        (250, 50, 'circle'),
        (200, 100, 'straight'),
        (150, 100, 'spline'),
        (140, 75, 'spline'),
        (110, 45, 'spline'),
    ])
    rotated_mixed.rotation_angle = 180
    rotated_mixed.export_stp("rotated_mixed.stp")
    rotated_mixed.export_html("rotated_mixed.html")

    # this makes a circular shape and rotates it to make a solid
    rotated_circle = paramak.RotateCircleShape(points=[(50, 0)],
                                               radius=5,
                                               workplane="XZ")
    rotated_circle.rotation_angle = 180
    rotated_circle.export_stp("rotated_circle.stp")
    rotated_circle.export_html("rotated_circle.html")

    # extrude examples

    # this makes a banana shape with straight edges and rotates it to make a solid
    extruded_straight = paramak.ExtrudeStraightShape(
        points=[
            (300, -300),
            (400, 0),
            (300, 300),
            (400, 300),
            (500, 0),
            (400, -300),
        ],
        distance=200,
    )
    extruded_straight.export_stp("extruded_straight.stp")
    extruded_straight.export_html("extruded_straight.html")

    # this makes a banana shape and rotates it to make a solid
    extruded_spline = paramak.ExtrudeSplineShape(
        points=[
            (500, 0),
            (500, -20),
            (400, -300),
            (300, -300),
            (400, 0),
            (300, 300),
            (400, 300),
            (500, 20),
        ],
        distance=200,
    )
    extruded_spline.export_stp("extruded_spline.stp")
    extruded_spline.export_html("extruded_spline.html")

    # this makes a banana shape straight top and bottom edges and extrudes it to make a solid
    extruded_mixed = paramak.ExtrudeMixedShape(
        points=[
            (100, 0, 'straight'),
            (200, 0, 'circle'),
            (250, 50, 'circle'),
            (200, 100, 'straight'),
            (150, 100, 'spline'),
            (140, 75, 'spline'),
            (110, 45, 'spline'),
        ],
        distance=100,
    )
    extruded_mixed.export_stp("extruded_mixed.stp")
    extruded_mixed.export_html("extruded_mixed.html")

    # this makes a circular shape and extrudes it to make a solid
    extruded_circle = paramak.ExtrudeCircleShape(points=[(20, 0)],
                                                 radius=20,
                                                 distance=200)
    extruded_circle.export_stp("extruded_circle.stp")
    extruded_circle.export_html("extruded_circle.html")
示例#9
0
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")
示例#10
0
    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