def test_PoloidalFieldCoilCaseSetFC_with_number_thickness(self):
        """Creates a set of PF coil cases from a list of PF coils with a
        single numerical thicknesses."""

        pf_coils_1 = paramak.PoloidalFieldCoil(height=10,
                                               width=10,
                                               center_point=(100, 100))

        pf_coils_2 = paramak.PoloidalFieldCoil(height=10,
                                               width=10,
                                               center_point=(100, 150))

        pf_coils_3 = paramak.PoloidalFieldCoil(height=20,
                                               width=20,
                                               center_point=(50, 200))

        pf_coils_4 = paramak.PoloidalFieldCoil(height=20,
                                               width=40,
                                               center_point=(50, 50))

        test_shape = paramak.PoloidalFieldCoilCaseSetFC(
            pf_coils=[pf_coils_1, pf_coils_2, pf_coils_3, pf_coils_4],
            casing_thicknesses=10,
        )

        assert test_shape.casing_thicknesses == 10
        assert test_shape.solid is not None
        assert len(test_shape.solid.Solids()) == 4
    def test_PoloidalFieldCoilCaseSetFC_from_list(self):
        """Creates a set of PF coil cases from a list of PF coils"""
        pf_coils_1 = paramak.PoloidalFieldCoil(height=10,
                                               width=10,
                                               center_point=(100, 100),
                                               rotation_angle=180)

        pf_coils_2 = paramak.PoloidalFieldCoil(height=10,
                                               width=10,
                                               center_point=(100, 150),
                                               rotation_angle=180)

        pf_coils_3 = paramak.PoloidalFieldCoil(height=20,
                                               width=20,
                                               center_point=(50, 200),
                                               rotation_angle=180)

        pf_coils_4 = paramak.PoloidalFieldCoil(height=20,
                                               width=40,
                                               center_point=(50, 50),
                                               rotation_angle=180)

        test_shape = paramak.PoloidalFieldCoilCaseSetFC(
            pf_coils=[pf_coils_1, pf_coils_2, pf_coils_3, pf_coils_4],
            casing_thicknesses=[5, 5, 10, 10],
            rotation_angle=180)

        assert test_shape.solid is not None
        assert len(test_shape.solid.Solids()) == 4
Exemplo n.º 3
0
    def test_create_patch_alpha(self):
        """Checks _create_patch returns a patch when alpha is given."""

        test_shape = paramak.PoloidalFieldCoil(center_point=(100, 100),
                                               height=50,
                                               width=50,
                                               color=(0.5, 0.5, 0.5, 0.1))
        assert test_shape._create_patch() is not None
Exemplo n.º 4
0
    def test_trace(self):
        """Test trace method is populated"""

        test_shape = paramak.PoloidalFieldCoil(center_point=(100, 100),
                                               height=50,
                                               width=50,
                                               name="coucou")
        assert test_shape._trace() is not None
    def test_PoloidalFieldCoil_creation(self):
        """creates a PoloidalFieldCoil object and checks a solid is created"""

        test_shape = paramak.PoloidalFieldCoil(
            height=50, width=60, center_point=(1000, 500))

        assert test_shape.solid is not None
        assert test_shape.volume > 1000
    def setUp(self):
        self.pf_coil = paramak.PoloidalFieldCoil(
            height=50, width=60, center_point=(1000, 500)
        )

        self.test_shape = paramak.PoloidalFieldCoilCaseFC(
            pf_coil=self.pf_coil, casing_thickness=5
        )
Exemplo n.º 7
0
        def create_shape():
            test_shape_to_segment = paramak.PoloidalFieldCoil(
                height=100, width=100, center_point=(500, 500))

            paramak.PoloidalSegments(
                shape_to_segment=test_shape_to_segment,
                center_point=(500, 500),
                number_of_segments=22.5,
            )
Exemplo n.º 8
0
    def test_PoloidalFieldCoil_creation(self):
        """creates a pf coil using the PoloidalFieldCoil parametric component
        and checks that a cadquery solid is created"""

        test_shape = paramak.PoloidalFieldCoil(height=50,
                                               width=60,
                                               center_point=(1000, 500))

        assert test_shape.solid is not None
        assert test_shape.volume > 1000
        def test_PoloidalFieldCoilSet_incorrect_lengths():
            """Checks PoloidalFieldCoilSet with the wrong number of casing thicknesses using a list"""
            pf_coils_1 = paramak.PoloidalFieldCoil(height=10,
                                                   width=10,
                                                   center_point=(100, 100),
                                                   rotation_angle=180)

            paramak.PoloidalFieldCoilCaseSetFC(
                pf_coils=[pf_coils_1],
                casing_thicknesses=[5, 5, 10, 10],
                rotation_angle=180).solid
Exemplo n.º 10
0
    def test_PoloidalFieldCoilCaseFC_creation(self):
        """creates a PoloidalFieldCoilCaseFC object and checks a solid is created"""

        pf_coil = paramak.PoloidalFieldCoil(
            height=50, width=60, center_point=(1000, 500))

        test_shape = paramak.PoloidalFieldCoilCaseFC(
            pf_coil=pf_coil, casing_thickness=5)

        assert test_shape.solid is not None
        assert test_shape.volume > 1000
Exemplo n.º 11
0
    def test_volumes_add_up_to_total_volume(self):
        """Checks the volume and volumes attributes are correct types
        and that the volumes sum to equalt the volume."""

        test_shape = paramak.PoloidalFieldCoil(center_point=(100, 100),
                                               height=50,
                                               width=50)

        assert isinstance(test_shape.volume, float)
        assert isinstance(test_shape.volumes, list)
        assert isinstance(test_shape.volumes[0], float)
        assert len(test_shape.volumes) == 1
        assert sum(test_shape.volumes) == pytest.approx(test_shape.volume)
Exemplo n.º 12
0
    def test_PoloidalFieldCoilCaseFC_creation(self):
        """creates a pf coil case using the PoloidalFieldCoilCaseFC parametric component and
        checks that a cadquery solid is created"""

        pf_coil = paramak.PoloidalFieldCoil(height=50,
                                            width=60,
                                            center_point=(1000, 500))

        test_shape = paramak.PoloidalFieldCoilCaseFC(pf_coil=pf_coil,
                                                     casing_thickness=5)

        assert test_shape.solid is not None
        assert test_shape.volume > 1000
Exemplo n.º 13
0
    def test_PoloidalSegments_solid_count2(self):
        """creates a rotated ring and segments it into poloidal sections"""

        test_shape_to_segment = paramak.PoloidalFieldCoil(height=100,
                                                          width=100,
                                                          center_point=(500,
                                                                        500))

        test_shape = paramak.PoloidalSegments(
            shape_to_segment=test_shape_to_segment,
            center_point=(500, 500),
            number_of_segments=22,
        )

        assert test_shape.solid is not None
        assert len(test_shape.solid.Solids()) == 22
Exemplo n.º 14
0
    def test_shape_construction_and_volume(self):
        """Makes cutting cylinders from shapes and checks the
        volume of the cutter shape is larger than the shape it
        encompasses."""

        hoop_shape = paramak.PoloidalFieldCoil(height=20,
                                               width=20,
                                               center_point=(50, 200),
                                               rotation_angle=180)

        cutter = paramak.CuttingWedgeFS(
            shape=hoop_shape,
            azimuth_placement_angle=0,
        )

        assert cutter.volume > hoop_shape.volume
Exemplo n.º 15
0
    def test_areas_add_up_to_total_area(self):
        """Checks the area and areas attributes are correct types
        and that the areas sum to equalt the area."""

        test_shape = paramak.PoloidalFieldCoil(center_point=(100, 100),
                                               height=50,
                                               width=50)

        assert isinstance(test_shape.area, float)
        assert isinstance(test_shape.areas, list)
        assert isinstance(test_shape.areas[0], float)
        assert isinstance(test_shape.areas[1], float)
        assert isinstance(test_shape.areas[2], float)
        assert isinstance(test_shape.areas[3], float)
        assert len(test_shape.areas) == 4
        assert sum(test_shape.areas) == pytest.approx(test_shape.area)
Exemplo n.º 16
0
    def test_solid_count(self):
        """Creates a rotated hollow ring and segments it into poloidal
        sections."""

        pf_coil = paramak.PoloidalFieldCoil(
            height=100,
            width=100,
            center_point=(500, 500)
        )

        test_shape_to_segment = paramak.PoloidalFieldCoilCaseFC(
            pf_coil=pf_coil,
            casing_thickness=100
        )

        test_shape = paramak.PoloidalSegments(
            shape_to_segment=test_shape_to_segment,
            center_point=(500, 500),
            number_of_segments=22,
        )

        assert test_shape.solid is not None
        assert len(test_shape.solid.Solids()) == 22
Exemplo n.º 17
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
Exemplo n.º 18
0
 def setUp(self):
     # this is the shape that gets shelled
     self.test_shape = paramak.PoloidalFieldCoil(height=50,
                                                 width=50,
                                                 rotation_angle=90,
                                                 center_point=(100, 100))
Exemplo n.º 19
0
 def setUp(self):
     self.test_shape = paramak.PoloidalFieldCoil(
         height=50, width=60, center_point=(1000, 500)
     )
def main():

    rot_angle = 180
    all_components = []

    plasma = paramak.Plasma(
        # default parameters
        rotation_angle=rot_angle,
        stp_filename="plasma_shape.stp",
    )
    all_components.append(plasma)

    component = paramak.BlanketFP(
        plasma=plasma,
        thickness=100,
        stop_angle=90,
        start_angle=-90,
        offset_from_plasma=30,
        rotation_angle=rot_angle,
        stp_filename="blanket_constant_thickness_outboard_plasma.stp",
    )
    all_components.append(component)

    component = paramak.BlanketCutterStar(height=2000,
                                          width=2000,
                                          distance=100)
    all_components.append(component)

    component = paramak.BlanketFP(
        plasma=plasma,
        thickness=100,
        stop_angle=90,
        start_angle=250,
        offset_from_plasma=30,
        rotation_angle=rot_angle,
        stp_filename="blanket_constant_thickness_inboard_plasma.stp",
    )
    all_components.append(component)

    component = paramak.BlanketFP(
        plasma=plasma,
        thickness=100,
        stop_angle=250,
        start_angle=-90,
        offset_from_plasma=30,
        rotation_angle=rot_angle,
        stp_filename="blanket_constant_thickness_plasma.stp",
    )
    all_components.append(component)

    CenterColumnShieldCylinder = paramak.CenterColumnShieldCylinder(
        inner_radius=80,
        outer_radius=100,
        height=300,
        rotation_angle=rot_angle,
        stp_filename="center_column_shield_cylinder.stp",
    )
    all_components.append(CenterColumnShieldCylinder)

    component = paramak.InboardFirstwallFCCS(
        central_column_shield=CenterColumnShieldCylinder,
        thickness=50,
        rotation_angle=rot_angle,
        stp_filename="firstwall_from_center_column_shield_cylinder.stp",
    )
    all_components.append(component)

    CenterColumnShieldHyperbola = paramak.CenterColumnShieldHyperbola(
        inner_radius=50,
        mid_radius=75,
        outer_radius=100,
        height=300,
        rotation_angle=rot_angle,
        stp_filename="center_column_shield_hyperbola.stp",
    )
    all_components.append(CenterColumnShieldHyperbola)

    component = paramak.InboardFirstwallFCCS(
        central_column_shield=CenterColumnShieldHyperbola,
        thickness=50,
        rotation_angle=rot_angle,
        stp_filename="firstwall_from_center_column_shield_hyperbola.stp",
    )
    all_components.append(component)

    CenterColumnShieldCircular = paramak.CenterColumnShieldCircular(
        inner_radius=50,
        mid_radius=75,
        outer_radius=100,
        height=300,
        rotation_angle=rot_angle,
        stp_filename="center_column_shield_circular.stp",
    )
    all_components.append(CenterColumnShieldCircular)

    component = paramak.InboardFirstwallFCCS(
        central_column_shield=CenterColumnShieldCircular,
        thickness=50,
        rotation_angle=rot_angle,
        stp_filename="firstwall_from_center_column_shield_circular.stp",
    )
    all_components.append(component)

    CenterColumnShieldFlatTopHyperbola = paramak.CenterColumnShieldFlatTopHyperbola(
        inner_radius=50,
        mid_radius=75,
        outer_radius=100,
        arc_height=220,
        height=300,
        rotation_angle=rot_angle,
        stp_filename="center_column_shield_flat_top_hyperbola.stp",
    )
    all_components.append(CenterColumnShieldFlatTopHyperbola)

    component = paramak.InboardFirstwallFCCS(
        central_column_shield=CenterColumnShieldFlatTopHyperbola,
        thickness=50,
        rotation_angle=rot_angle,
        stp_filename=
        "firstwall_from_center_column_shield_flat_top_hyperbola.stp",
    )
    all_components.append(component)

    CenterColumnShieldFlatTopCircular = paramak.CenterColumnShieldFlatTopCircular(
        inner_radius=50,
        mid_radius=75,
        outer_radius=100,
        arc_height=220,
        height=300,
        rotation_angle=rot_angle,
        stp_filename="center_column_shield_flat_top_Circular.stp",
    )
    all_components.append(CenterColumnShieldFlatTopCircular)

    component = paramak.InboardFirstwallFCCS(
        central_column_shield=CenterColumnShieldFlatTopCircular,
        thickness=50,
        rotation_angle=rot_angle,
        stp_filename=
        "firstwall_from_center_column_shield_flat_top_Circular.stp",
    )
    all_components.append(component)

    CenterColumnShieldPlasmaHyperbola = paramak.CenterColumnShieldPlasmaHyperbola(
        inner_radius=150,
        mid_offset=50,
        edge_offset=40,
        height=800,
        rotation_angle=rot_angle,
        stp_filename="center_column_shield_plasma_hyperbola.stp",
    )
    all_components.append(CenterColumnShieldPlasmaHyperbola)

    component = paramak.InboardFirstwallFCCS(
        central_column_shield=CenterColumnShieldPlasmaHyperbola,
        thickness=50,
        rotation_angle=rot_angle,
        stp_filename="firstwall_from_center_column_shield_plasma_hyperbola.stp",
    )
    all_components.append(component)

    component = paramak.InnerTfCoilsCircular(
        inner_radius=25,
        outer_radius=100,
        number_of_coils=10,
        gap_size=5,
        height=300,
        stp_filename="inner_tf_coils_circular.stp",
    )
    all_components.append(component)

    component = paramak.InnerTfCoilsFlat(
        inner_radius=25,
        outer_radius=100,
        number_of_coils=10,
        gap_size=5,
        height=300,
        stp_filename="inner_tf_coils_flat.stp",
    )
    all_components.append(component)

    # this makes 4 pf coil cases
    pf_coil_set = paramak.PoloidalFieldCoilCaseSet(
        heights=[10, 10, 20, 20],
        widths=[10, 10, 20, 40],
        casing_thicknesses=[5, 5, 10, 10],
        center_points=[(100, 100), (100, 150), (50, 200), (50, 50)],
        rotation_angle=rot_angle,
        stp_filename="pf_coil_case_set.stp")
    all_components.append(pf_coil_set)

    # this makes 4 pf coils
    pf_coil_set = paramak.PoloidalFieldCoilSet(heights=[10, 10, 20, 20],
                                               widths=[10, 10, 20, 40],
                                               center_points=[(100, 100),
                                                              (100, 150),
                                                              (50, 200),
                                                              (50, 50)],
                                               rotation_angle=rot_angle,
                                               stp_filename="pf_coil_set.stp")
    all_components.append(pf_coil_set)

    # this makes 4 pf coil cases for the 4 pf coils made above
    component = paramak.PoloidalFieldCoilCaseSetFC(
        pf_coils=pf_coil_set,
        casing_thicknesses=[5, 5, 10, 10],
        rotation_angle=rot_angle,
        stp_filename="pf_coil_cases_set.stp")
    all_components.append(component)

    # this makes 1 pf coils
    pf_coil = paramak.PoloidalFieldCoil(center_point=(100, 100),
                                        height=20,
                                        width=20,
                                        rotation_angle=rot_angle,
                                        stp_filename="poloidal_field_coil.stp")
    all_components.append(pf_coil)

    # this makes one PF coil case for the provided pf coil
    component = paramak.PoloidalFieldCoilCaseSetFC(
        pf_coils=[pf_coil],
        casing_thicknesses=[10],
        rotation_angle=rot_angle,
        stp_filename="pf_coil_cases_set_fc.stp")
    all_components.append(component)

    component = paramak.PoloidalFieldCoilCaseFC(
        pf_coil=pf_coil,
        casing_thickness=10,
        rotation_angle=rot_angle,
        stp_filename="poloidal_field_coil_case_fc.stp",
    )
    all_components.append(component)

    component = paramak.PoloidalFieldCoilCase(
        center_point=(100, 100),
        coil_height=20,
        coil_width=20,
        casing_thickness=10,
        rotation_angle=rot_angle,
        stp_filename="poloidal_field_coil_case.stp",
    )
    all_components.append(component)

    component = paramak.BlanketConstantThicknessArcV(
        inner_lower_point=(300, -200),
        inner_mid_point=(500, 0),
        inner_upper_point=(300, 200),
        thickness=100,
        rotation_angle=rot_angle,
        stp_filename="blanket_arc_v.stp",
    )
    all_components.append(component)

    component = paramak.BlanketConstantThicknessArcH(
        inner_lower_point=(300, -200),
        inner_mid_point=(400, 0),
        inner_upper_point=(300, 200),
        thickness=100,
        rotation_angle=rot_angle,
        stp_filename="blanket_arc_h.stp",
    )
    all_components.append(component)

    component = paramak.ToroidalFieldCoilRectangle(
        horizontal_start_point=(100, 700),
        vertical_mid_point=(800, 0),
        thickness=150,
        distance=60,
        stp_filename="tf_coil_rectangle.stp",
        number_of_coils=1,
    )
    all_components.append(component)

    component = paramak.ToroidalFieldCoilCoatHanger(
        horizontal_start_point=(200, 500),
        horizontal_length=400,
        vertical_mid_point=(700, 50),
        vertical_length=500,
        thickness=50,
        distance=50,
        stp_filename="toroidal_field_coil_coat_hanger.stp",
        number_of_coils=1,
    )
    all_components.append(component)

    component = paramak.ToroidalFieldCoilTripleArc(
        R1=80,
        h=200,
        radii=(70, 100),
        coverages=(60, 60),
        thickness=30,
        distance=30,
        number_of_coils=1,
        stp_filename="toroidal_field_coil_triple_arc.stp")
    all_components.append(component)

    magnet = paramak.ToroidalFieldCoilPrincetonD(
        R1=80,
        R2=300,
        thickness=30,
        distance=30,
        number_of_coils=1,
        stp_filename="toroidal_field_coil_princeton_d.stp")
    all_components.append(magnet)

    component = paramak.ITERtypeDivertor(
        # default parameters
        rotation_angle=rot_angle,
        stp_filename="ITER_type_divertor.stp",
    )
    all_components.append(component)

    component = paramak.PortCutterRotated(center_point=(450, 0),
                                          polar_coverage_angle=20,
                                          rotation_angle=10,
                                          polar_placement_angle=45,
                                          azimuth_placement_angle=0)
    all_components.append(component)

    component = paramak.PortCutterRectangular(
        distance=3,
        z_pos=0,
        height=0.2,
        width=0.4,
        fillet_radius=0.02,
        azimuth_placement_angle=[0, 45, 90, 180])
    all_components.append(component)

    component = paramak.PortCutterCircular(
        distance=3,
        z_pos=0.25,
        radius=0.1,
        # azimuth_placement_angle=[0, 45, 90, 180], # TODO: fix issue #548
        azimuth_placement_angle=[0, 45, 90],
    )
    all_components.append(component)

    component = paramak.VacuumVessel(height=2,
                                     inner_radius=1,
                                     thickness=0.2,
                                     rotation_angle=270)
    all_components.append(component)

    component = paramak.CoolantChannelRingStraight(
        height=200,
        channel_radius=10,
        ring_radius=70,
        number_of_coolant_channels=8,
        workplane="XY",
        rotation_axis="Z",
        stp_filename="coolant_channel_ring_straight.stp",
    )
    all_components.append(component)

    component = paramak.CoolantChannelRingCurved(
        height=200,
        channel_radius=10,
        ring_radius=70,
        mid_offset=-20,
        number_of_coolant_channels=8,
        workplane="XY",
        path_workplane="XZ",
        stp_filename="coolant_channel_ring_curved.stp",
        force_cross_section=True)
    all_components.append(component)

    component = paramak.RotatedIsoscelesTriangle(
        height=20,
        base_length=15,
        pivot_angle=0,
        pivot_point=(100, 50),
        rotation_angle=70,
        workplane='XY',
        stp_filename='rotated_isosceles_triangle.stp')
    all_components.append(component)

    component = paramak.RotatedTrapezoid(length_1=10,
                                         length_2=20,
                                         length_3=30,
                                         pivot_angle=0,
                                         pivot_point=(100, 50),
                                         rotation_angle=45,
                                         stp_filename='rotated_trapezoid.stp')
    all_components.append(component)

    component = paramak.PoloidalSegments(number_of_segments=5,
                                         center_point=(400, 50))
    all_components.append(component)

    component = paramak.TFCoilCasing(magnet=magnet,
                                     inner_offset=10,
                                     outer_offset=15,
                                     vertical_section_offset=20,
                                     distance=40)
    all_components.append(component)

    component = paramak.HexagonPin(length_of_side=5,
                                   distance=10,
                                   center_point=(10, 20))
    all_components.append(component)

    return all_components
def 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