Exemple #1
0
 def setUp(self):
     self.test_shape = paramak.ToroidalFieldCoilRectangle(
         horizontal_start_point=(100, 700),
         vertical_mid_point=(800, 0),
         thickness=50,
         distance=30,
         number_of_coils=1,
         with_inner_leg=True)
    def test_ToroidalFieldCoilRectangle_creation(self):
        """creates a ToroidalFieldCoilRectangle object and checks a solid is created"""

        test_shape = paramak.ToroidalFieldCoilRectangle(
                        inner_upper_point=(100,700),
                        inner_mid_point=(800,0),
                        inner_lower_point=(100,-700),
                        thickness=150,
                        distance=50,
                        number_of_coils=8)
        assert test_shape.solid is not None
        assert test_shape.volume > 1000
    def test_ToroidalFieldCoilRectangle_creation(self):
        """creates a tf coil using the ToroidalFieldCoilRectangle parametric
        component and checks that a cadquery solid is created"""

        test_shape = paramak.ToroidalFieldCoilRectangle(
            horizontal_start_point=(100, 700),
            vertical_mid_point=(800, 0),
            thickness=150,
            distance=50,
            number_of_coils=8,
        )
        assert test_shape.solid is not None
        assert test_shape.volume > 1000
    def test_ToroidalFieldCoilRectangle_rotation_angle(self):
        """creates a tf coil with a rotation_angle < 360 and checks that the correct
        cut is performed and the volume is correct"""

        test_shape = paramak.ToroidalFieldCoilRectangle(
            horizontal_start_point=(100, 700),
            vertical_mid_point=(800, 0),
            with_inner_leg=False,
            thickness=50,
            distance=50,
            number_of_coils=8,
        )
        test_volume = test_shape.volume

        test_shape.rotation_angle = 180

        assert test_shape.volume == pytest.approx(test_volume * 0.5)
Exemple #5
0
    def _make_component_cuts(self):

        if (self.pf_coil_vertical_thicknesses is not None
                and self.pf_coil_radial_thicknesses is not None
                and self.pf_coil_to_rear_blanket_radial_gap is not None):

            self._pf_coil = paramak.PoloidalFieldCoilSet(
                heights=self.pf_coil_vertical_thicknesses,
                widths=self.pf_coil_radial_thicknesses,
                center_points=self._pf_coils_xy_values,
                rotation_angle=self.rotation_angle,
                stp_filename='pf_coils.stp',
                stl_filename='pf_coils.stl',
                name="pf_coil",
                material_tag="pf_coil_mat",
            )

            self.shapes_and_components.append(self._pf_coil)

            if (self.pf_coil_to_tf_coil_radial_gap is not None
                    and self.outboard_tf_coil_radial_thickness is not None):

                self._tf_coil = paramak.ToroidalFieldCoilRectangle(
                    with_inner_leg=False,
                    horizontal_start_point=(
                        self._inboard_tf_coils_start_radius,
                        self._tf_coil_height),
                    vertical_mid_point=(self._tf_coil_start_radius, 0),
                    thickness=self.outboard_tf_coil_radial_thickness,
                    number_of_coils=self.number_of_tf_coils,
                    distance=self.outboard_tf_coil_poloidal_thickness,
                    stp_filename="tf_coil.stp",
                    name="tf_coil",
                    material_tag="tf_coil_mat",
                    stl_filename="tf_coil.stl",
                    rotation_angle=self.rotation_angle)

                self.shapes_and_components.append(self._tf_coil)
Exemple #6
0
    def _make_tf_coils(self):
        comp = []
        if (self.pf_coil_to_tf_coil_radial_gap,
                self.outboard_tf_coil_radial_thickness) != (None, None):

            self._tf_coil = paramak.ToroidalFieldCoilRectangle(
                with_inner_leg=False,
                horizontal_start_point=(
                    self._inboard_tf_coils_start_radius,
                    self._tf_coil_height),
                vertical_mid_point=(
                    self._tf_coil_start_radius, 0),
                thickness=self.outboard_tf_coil_radial_thickness,
                number_of_coils=self.number_of_tf_coils,
                distance=self.outboard_tf_coil_poloidal_thickness,
                stp_filename="tf_coil.stp",
                name="tf_coil",
                material_tag="tf_coil_mat",
                stl_filename="tf_coil.stl",
                rotation_angle=self.rotation_angle
            )
            comp = [self._tf_coil]
        return comp
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
Exemple #8
0
    def _make_component_cuts(self):

        # the divertor is cut away then the firstwall can be added to the
        # reactor using CQ operations
        self._firstwall.solid = self._firstwall.solid.cut(self._divertor.solid)
        self.shapes_and_components.append(self._firstwall)

        # cutting the supports away from the blanket
        self._blanket.solid = self._blanket.solid.cut(self._supports.solid)
        self.shapes_and_components.append(self._blanket)

        self._outboard_rear_blanket_wall_upper = paramak.RotateStraightShape(
            points=[
                (self._center_column_shield_end_radius,
                 self._blanket_rear_wall_start_height),
                (self._center_column_shield_end_radius,
                 self._blanket_rear_wall_end_height),
                (
                    max([item[0] for item in self._inboard_firstwall.points]),
                    self._blanket_rear_wall_end_height,
                ),
                (
                    max([item[0] for item in self._inboard_firstwall.points]),
                    self._blanket_rear_wall_start_height,
                ),
            ],
            rotation_angle=self.rotation_angle,
        )

        self._outboard_rear_blanket_wall_lower = paramak.RotateStraightShape(
            points=[
                (self._center_column_shield_end_radius,
                 -self._blanket_rear_wall_start_height),
                (self._center_column_shield_end_radius,
                 -self._blanket_rear_wall_end_height),
                (
                    max([item[0] for item in self._inboard_firstwall.points]),
                    -self._blanket_rear_wall_end_height,
                ),
                (
                    max([item[0] for item in self._inboard_firstwall.points]),
                    -self._blanket_rear_wall_start_height,
                ),
            ],
            rotation_angle=self.rotation_angle,
        )

        self._outboard_rear_blanket_wall = paramak.BlanketFP(
            plasma=self._plasma,
            start_angle=90,
            stop_angle=-90,
            offset_from_plasma=self.outer_plasma_gap_radial_thickness +
            self.firstwall_radial_thickness +
            self.outboard_blanket_radial_thickness,
            thickness=self.blanket_rear_wall_radial_thickness,
            rotation_angle=self.rotation_angle,
            stp_filename="outboard_rear_blanket_wall.stp",
            stl_filename="outboard_rear_blanket_wall.stl",
            name="outboard_rear_blanket_wall",
            material_tag="rear_blanket_wall_mat",
            union=[
                self._outboard_rear_blanket_wall_upper,
                self._outboard_rear_blanket_wall_lower
            ],
        )

        self.shapes_and_components.append(self._outboard_rear_blanket_wall)

        if self._tf_info_provided:
            self._tf_coil = paramak.ToroidalFieldCoilRectangle(
                with_inner_leg=False,
                horizontal_start_point=(
                    self._inboard_tf_coils_start_radius,
                    self._blanket_rear_wall_end_height,
                ),
                vertical_mid_point=(self._outboard_tf_coil_start_radius, 0),
                thickness=self.outboard_tf_coil_radial_thickness,
                number_of_coils=self.number_of_tf_coils,
                distance=self.outboard_tf_coil_poloidal_thickness,
                stp_filename="outboard_tf_coil.stp",
                stl_filename="outboard_tf_coil.stl",
                rotation_angle=self.rotation_angle)
            self.shapes_and_components.append(self._tf_coil)

            if self._pf_info_provided:

                self._pf_coil = paramak.PoloidalFieldCoilSet(
                    heights=self.pf_coil_vertical_thicknesses,
                    widths=self.pf_coil_radial_thicknesses,
                    center_points=self._pf_coils_xy_values,
                    rotation_angle=self.rotation_angle,
                    stp_filename='pf_coils.stp',
                    name="pf_coil",
                    material_tag="pf_coil_mat",
                )

                self.shapes_and_components.append(self._pf_coil)
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
Exemple #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