示例#1
0
    def test_shape_construction_and_volume(self):
        """Cuts a vessel cylinder with several different size port cutters."""

        small_ports = paramak.PortCutterRotated(
            polar_coverage_angle=5,
            center_point=(100, 0),
            polar_placement_angle=10,
            max_distance_from_center=1000,
            azimuth_placement_angle=np.linspace(0, 360, 4),
            rotation_angle=10)

        large_ports = paramak.PortCutterRotated(
            polar_coverage_angle=6,
            center_point=(100, 0),
            polar_placement_angle=10,
            azimuth_placement_angle=np.linspace(0, 360, 4),
            max_distance_from_center=1000,
            rotation_angle=10)

        vessel_with_out_ports = paramak.CenterColumnShieldCylinder(
            height=500, inner_radius=200, outer_radius=300)

        vessel_with_small_ports = paramak.CenterColumnShieldCylinder(
            height=500, inner_radius=200, outer_radius=300, cut=small_ports)

        vessel_with_large_ports = paramak.CenterColumnShieldCylinder(
            height=500, inner_radius=200, outer_radius=300, cut=large_ports)

        assert large_ports.volume > small_ports.volume
        assert vessel_with_out_ports.volume > vessel_with_small_ports.volume
        assert vessel_with_small_ports.volume > vessel_with_large_ports.volume
示例#2
0
    def _make_blanket(self):
        self._inboard_blanket = paramak.CenterColumnShieldCylinder(
            height=self._blanket_end_height * 2,
            inner_radius=self._inboard_blanket_start_radius,
            outer_radius=max(self._inboard_firstwall.points)[0],
            rotation_angle=self.rotation_angle,
            cut=self._inboard_firstwall,
        )

        # this takes a single solid from a compound of solids by finding the
        # solid nearest to a point
        # TODO: find alternative
        self._inboard_blanket.solid = self._inboard_blanket.solid.solids(
            cq.selectors.NearestToPointSelector((0, 0, 0)))
        # this is the outboard fused /unioned with the inboard blanket

        self._blanket = paramak.BlanketFP(
            plasma=self._plasma,
            start_angle=90,
            stop_angle=-90,
            offset_from_plasma=self.outer_plasma_gap_radial_thickness +
            self.firstwall_radial_thickness,
            thickness=self.outboard_blanket_radial_thickness,
            rotation_angle=self.rotation_angle,
            stp_filename="blanket.stp",
            stl_filename="blanket.stl",
            name="blanket",
            material_tag="blanket_mat",
            union=self._inboard_blanket,
        )
        return self._blanket
    def _make_outboard_blanket(self):

        self._center_column_cutter = paramak.CenterColumnShieldCylinder(
            # extra 1.5 to ensure overlap,
            height=self._inboard_firstwall_end_height * 2.5,
            inner_radius=0,
            outer_radius=self._inboard_firstwall_end_radius,
            rotation_angle=self.rotation_angle
        )

        self._blanket = paramak.BlanketFP(
            plasma=self._plasma,
            thickness=100.,
            offset_from_plasma=[
                self.inner_plasma_gap_radial_thickness,
                self.plasma_gap_vertical_thickness,
                self.outer_plasma_gap_radial_thickness,
                self.plasma_gap_vertical_thickness,
                self.inner_plasma_gap_radial_thickness],
            start_angle=-180,
            stop_angle=180,
            rotation_angle=self.rotation_angle,
            cut=[self._center_column_cutter]
        )
        return self._blanket
    def _make_divertor(self):
        self._blanket_enveloppe = paramak.BlanketFP(
            plasma=self._plasma,
            thickness=100.,
            offset_from_plasma=[
                self.inner_plasma_gap_radial_thickness,
                self.plasma_gap_vertical_thickness,
                self.outer_plasma_gap_radial_thickness,
                self.plasma_gap_vertical_thickness,
                self.inner_plasma_gap_radial_thickness],
            start_angle=-180,
            stop_angle=180,
            rotation_angle=self.rotation_angle,
            cut=[self._center_column_cutter]
        )

        self._divertor = paramak.CenterColumnShieldCylinder(
            height=self._center_column_shield_end_height *
            2.5,  # extra 0.5 to ensure overlap
            inner_radius=self._divertor_start_radius,
            outer_radius=self._divertor_end_radius,
            rotation_angle=self.rotation_angle,
            stp_filename="divertor.stp",
            stl_filename="divertor.stl",
            name="divertor",
            material_tag="divertor_mat",
            intersect=self._blanket_enveloppe,
        )
        self._blanket.cut.append(self._divertor)
        return self._divertor
示例#5
0
    def test_parametric_component_hash_value(self):
        """creates a parametric component and checks that a cadquery solid with
        a unique hash value is created when .solid is called. checks that the
        same cadquery solid with the same unique hash value is returned when
        shape.solid is called again after no changes have been made to the
        parametric component. checks that a new cadquery solid with a new
        unique hash value is constructed when shape.solid is called after
        changes to the parametric component have been made. checks that the
        hash_value of a parametric component is not updated until a new
        cadquery solid has been created"""

        test_shape = paramak.CenterColumnShieldCylinder(height=100,
                                                        inner_radius=20,
                                                        outer_radius=40)

        assert test_shape.hash_value is None
        assert test_shape.solid is not None
        assert test_shape.hash_value is not None
        initial_hash_value = test_shape.hash_value
        assert test_shape.solid is not None
        assert initial_hash_value == test_shape.hash_value
        test_shape.height = 120
        assert initial_hash_value == test_shape.hash_value
        assert test_shape.solid is not None
        assert initial_hash_value != test_shape.hash_value
示例#6
0
    def _make_coils(self):
        list_of_components = []

        self._inboard_tf_coils = paramak.CenterColumnShieldCylinder(
            height=self._blanket_rear_wall_end_height * 2,
            inner_radius=self._inboard_tf_coils_start_radius,
            outer_radius=self._inboard_tf_coils_end_radius,
            rotation_angle=self.rotation_angle,
            stp_filename="inboard_tf_coils.stp",
            stl_filename="inboard_tf_coils.stl",
            name="inboard_tf_coils",
            material_tag="inboard_tf_coils_mat",
        )
        list_of_components.append(self._inboard_tf_coils)
        if self._tf_info_provided:
            self._tf_coil = paramak.ToroidalFieldCoilCoatHanger(
                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,
                horizontal_length=self._outboard_tf_coils_horizontal_length,
                vertical_length=self._outboard_tf_coils_vertical_height)
            list_of_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',
                    stl_filename='pf_coils.stl',
                    name="pf_coil",
                    material_tag="pf_coil_mat",
                )

                list_of_components.append(self._pf_coil)

                self._pf_coils_casing = paramak.PoloidalFieldCoilCaseSetFC(
                    pf_coils=self._pf_coil,
                    casing_thicknesses=self.pf_coil_case_thickness,
                    rotation_angle=self.rotation_angle,
                    stp_filename='pf_coil_cases.stp',
                    stl_filename='pf_coil_cases.stl',
                    name="pf_coil_case",
                    material_tag="pf_coil_case_mat",
                )

                list_of_components.append(self._pf_coils_casing)

        return list_of_components
示例#7
0
    def _make_divertor(self):

        # # used as an intersect when making the divertor
        self._blanket_fw_rear_wall_envelope = paramak.BlanketFP(
            plasma=self._plasma,
            thickness=self.firstwall_radial_thickness +
            self.blanket_radial_thickness +
            self.blanket_rear_wall_radial_thickness,
            offset_from_plasma=[
                self.major_radius - self.minor_radius,
                self.plasma_gap_vertical_thickness,
                self.outer_plasma_gap_radial_thickness,
                self.plasma_gap_vertical_thickness,
                # self.inner_plasma_gap_radial_thickness],
                self.major_radius - self.minor_radius
            ],
            start_angle=-179,
            stop_angle=179,
            rotation_angle=self.rotation_angle,
        )

        self._divertor = paramak.CenterColumnShieldCylinder(
            height=self._blanket_rear_wall_end_height * 2,
            inner_radius=self._divertor_start_radius,
            outer_radius=self._divertor_end_radius,
            intersect=self._blanket_fw_rear_wall_envelope,
            stp_filename="divertor.stp",
            name="divertor",
            material_tag="divertor_mat",
            rotation_angle=self.rotation_angle)
        self.shapes_and_components.append(self._divertor)

        blanket_cutter = paramak.CenterColumnShieldCylinder(
            height=self._center_column_shield_height *
            1.5,  # extra 0.5 to ensure overlap,
            inner_radius=0,
            outer_radius=self._divertor_end_radius,
            rotation_angle=360)

        self._firstwall.solid = self._firstwall.solid.cut(blanket_cutter.solid)
        self._blanket.solid = self._blanket.solid.cut(blanket_cutter.solid)
        self._blanket_rear_wall.solid = self._blanket_rear_wall.solid.cut(
            blanket_cutter.solid)
        self.shapes_and_components.append(self._firstwall)
        self.shapes_and_components.append(self._blanket)
        self.shapes_and_components.append(self._blanket_rear_wall)
    def test_CenterColumnShieldCylinder_creation(self):
        """creates a CenterColumnShieldCylinder object and checks a solid is created"""

        test_shape = paramak.CenterColumnShieldCylinder(
            height=600, inner_radius=100, outer_radius=200
        )

        assert test_shape.solid is not None
        assert test_shape.volume > 1000
示例#9
0
    def test_CenterColumnShieldCylinder_creation(self):
        """creates a center column shield using the CenterColumnShieldCylinder parametric component and
        checks that a cadquery solid is created"""

        test_shape = paramak.CenterColumnShieldCylinder(height=600,
                                                        inner_radius=100,
                                                        outer_radius=200)

        assert test_shape.solid is not None
        assert test_shape.volume > 1000
示例#10
0
 def test_construction_with_CenterColumnShieldCylinder(self):
     """Makes a firstwall with from a CenterColumnShieldCylinder and checks
     the volume is smaller than the shield"""
     a = paramak.CenterColumnShieldCylinder(height=100,
                                            inner_radius=20,
                                            outer_radius=80)
     b = paramak.InboardFirstwallFCCS(central_column_shield=a,
                                      thickness=20,
                                      rotation_angle=180)
     assert a.solid is not None
     assert b.solid is not None
     assert a.volume > b.volume
示例#11
0
    def _make_blankets_layers(self):

        self._center_column_cutter = paramak.CenterColumnShieldCylinder(
            # extra 0.5 to ensure overlap,
            height=self._center_column_shield_height * 1.5,
            inner_radius=0,
            outer_radius=self._center_column_shield_end_radius,
            rotation_angle=360
        )

        self._firstwall = paramak.BlanketFP(
            plasma=self._plasma,
            thickness=self.firstwall_radial_thickness,
            offset_from_plasma=self.offset_from_plasma,
            start_angle=-180,
            stop_angle=180,
            rotation_angle=self.rotation_angle,
            material_tag="firstwall_mat",
            stp_filename="firstwall.stp",
            stl_filename="firstwall.stl",
            cut=[self._center_column_cutter]
        )

        self._blanket = paramak.BlanketFP(
            plasma=self._plasma,
            thickness=self.blanket_radial_thickness,
            offset_from_plasma=[e + self.firstwall_radial_thickness
                                for e in self.offset_from_plasma],
            start_angle=-180,
            stop_angle=180,
            rotation_angle=self.rotation_angle,
            material_tag="blanket_mat",
            stp_filename="blanket.stp",
            stl_filename="blanket.stl",
            cut=[self._center_column_cutter])

        self._blanket_rear_wall = paramak.BlanketFP(
            plasma=self._plasma,
            thickness=self.blanket_rear_wall_radial_thickness,
            offset_from_plasma=[e + self.firstwall_radial_thickness
                                + self.blanket_radial_thickness
                                for e in self.offset_from_plasma],
            start_angle=-180,
            stop_angle=180,
            rotation_angle=self.rotation_angle,
            material_tag="blanket_rear_wall_mat",
            stp_filename="blanket_rear_wall.stp",
            stl_filename="blanket_rear_wall.stl",
            cut=[self._center_column_cutter],
        )

        return [self._firstwall, self._blanket, self._blanket_rear_wall]
    def create_components(self):

        plasma = paramak.Plasma(major_radius=self.major_radius,
                                minor_radius=self.minor_radius,
                                elongation=self.elongation,
                                triangularity=self.triangularity,
                                rotation_angle=self.rotation_angle)
        plasma.create_solid()

        inboard_firstwall = paramak.BlanketConstantThicknessFP(
            plasma=plasma,
            start_angle=90,
            stop_angle=270,
            offset_from_plasma=self.offset_from_plasma,
            thickness=self.firstwall_thickness,
            rotation_angle=self.rotation_angle,
            stp_filename='inboard_firstwall.stp'
        )

        outboard_firstwall = paramak.BlanketConstantThicknessFP(
            plasma=plasma,
            stop_angle=-70,
            start_angle=70,
            offset_from_plasma=self.offset_from_plasma,
            thickness=self.firstwall_thickness,
            rotation_angle=self.rotation_angle,
            stp_filename='outboard_firstwall.stp'
        )

        # The height of this center column is calculated using CadQuery commands
        center_column_shield = paramak.CenterColumnShieldCylinder(
            height=2*(plasma.high_point[1] + self.offset_from_plasma),
            inner_radius=self.center_column_shield_inner_radius,
            outer_radius=self.center_column_shield_outer_radius,
            rotation_angle=self.rotation_angle,
            # color=centre_column_color,
            stp_filename="center_column_shield.stp",
            material_tag="center_column_material",
        )

        inboard_tf_coils = paramak.InnerTfCoilsCircular(
            height=2*(plasma.high_point[1] + self.offset_from_plasma),
            outer_radius = self.center_column_shield_inner_radius,
            inner_radius = self.inner_bore,
            number_of_coils = self.number_of_tf_coils,
            gap_size=5,
            stp_filename="inboard_tf_coils.stp",
            material_tag="inboard_tf_coils_material",
        )

        self.shapes_and_components = [center_column_shield, plasma, inboard_firstwall,
                                      inboard_tf_coils, outboard_firstwall]
示例#13
0
    def _make_center_column_shield(self):

        self._center_column_shield = paramak.CenterColumnShieldCylinder(
            height=self._blanket_rear_wall_end_height * 2,
            inner_radius=self._center_column_shield_start_radius,
            outer_radius=self._center_column_shield_end_radius,
            rotation_angle=self.rotation_angle,
            stp_filename="center_column_shield.stp",
            stl_filename="center_column_shield.stl",
            name="center_column_shield",
            material_tag="center_column_shield_mat",
        )
        self.shapes_and_components.append(self._center_column_shield)
    def test_volume_CenterColumnShieldCylinder(self):
        """creates a CenterColumnShieldCylinder object and checks that the volume is correct"""

        test_shape = paramak.CenterColumnShieldCylinder(
            rotation_angle=360,
            height=15,
            inner_radius=5,
            outer_radius=10,
            azimuth_placement_angle=0,
        )

        assert test_shape.volume == pytest.approx(3534.29)

        test_shape = paramak.CenterColumnShieldCylinder(
            rotation_angle=180,
            height=15,
            inner_radius=5,
            outer_radius=10,
            azimuth_placement_angle=95,
        )

        assert test_shape.volume == pytest.approx(3534.29 / 2.0)
    def _make_inboard_tf_coils(self):

        self._inboard_tf_coils = paramak.CenterColumnShieldCylinder(
            height=self._blanket_end_height * 2,
            inner_radius=self._inboard_tf_coils_start_radius,
            outer_radius=self._inboard_tf_coils_end_radius,
            rotation_angle=self.rotation_angle,
            stp_filename="inboard_tf_coils.stp",
            stl_filename="inboard_tf_coils.stl",
            name="inboard_tf_coils",
            material_tag="inboard_tf_coils_mat",
        )
        return self._inboard_tf_coils
示例#16
0
    def _make_center_column_shield(self):

        self._center_column_shield = paramak.CenterColumnShieldCylinder(
            height=self._center_column_shield_height,
            inner_radius=self._center_column_shield_start_radius,
            outer_radius=self._center_column_shield_end_radius,
            rotation_angle=self.rotation_angle,
            # color=centre_column_color,
            stp_filename="center_column_shield.stp",
            stl_filename="center_column_shield.stl",
            name="center_column_shield",
            material_tag="center_column_shield_mat",
        )
        return self._center_column_shield
示例#17
0
    def _make_inboard_tf_coils(self):

        # self.shapes_and_components.append(inboard_tf_coils)
        self._inboard_tf_coils = paramak.CenterColumnShieldCylinder(
            height=self._blanket_rear_wall_end_height * 2,
            inner_radius=self._inboard_tf_coils_start_radius,
            outer_radius=self._inboard_tf_coils_end_radius,
            rotation_angle=self.rotation_angle,
            stp_filename="inboard_tf_coils.stp",
            stl_filename="inboard_tf_coils.stl",
            name="inboard_tf_coils",
            material_tag="inboard_tf_coils_mat",
        )
        self.shapes_and_components.append(self._inboard_tf_coils)
示例#18
0
    def test_cut_attribute(self):
        """Creates a firstwall then reset its cut attribute and check that
        the shape isn't affected"""
        a = paramak.CenterColumnShieldCylinder(height=100,
                                               inner_radius=20,
                                               outer_radius=80)
        b = paramak.InboardFirstwallFCCS(central_column_shield=a,
                                         thickness=20,
                                         rotation_angle=180)

        volume_1 = b.volume
        b.cut = None
        volume_2 = b.volume
        assert np.isclose(volume_1, volume_2)
示例#19
0
    def _make_supports(self):

        self._supports = paramak.CenterColumnShieldCylinder(
            height=self._blanket_rear_wall_end_height * 2,
            inner_radius=self._support_start_radius,
            outer_radius=self._support_end_radius,
            rotation_angle=self.rotation_angle,
            stp_filename="supports.stp",
            stl_filename="supports.stl",
            name="supports",
            material_tag="supports_mat",
            intersect=self._blanket,
        )
        self.shapes_and_components.append(self._supports)
示例#20
0
    def _make_divertor(self):

        self._divertor = paramak.CenterColumnShieldCylinder(
            height=self._blanket_rear_wall_end_height * 2,
            inner_radius=self._divertor_start_radius,
            outer_radius=self._divertor_end_radius,
            rotation_angle=self.rotation_angle,
            stp_filename="divertor.stp",
            stl_filename="divertor.stl",
            name="divertor",
            material_tag="divertor_mat",
            intersect=self._firstwall,
        )
        self.shapes_and_components.append(self._divertor)
示例#21
0
    def simulate_cylinder_cask_cad(self, material, source, height,
                                   outer_radius, thickness, batches,
                                   particles):
        """Makes a CAD cask geometry runs a simulation and returns the result"""

        top_cap_cell = paramak.RotateStraightShape(
            stp_filename='top_cap_cell.stp',
            material_tag='test_mat',
            points=[
                (outer_radius, height * 0.5),
                (outer_radius, (height * 0.5) + thickness),
                (0, (height * 0.5) + thickness),
                (0, height * 0.5),
            ],
        )

        bottom_cap_cell = paramak.RotateStraightShape(
            stp_filename='bottom_cap_cell.stp',
            material_tag='test_mat',
            points=[
                (outer_radius, -height * 0.5),
                (outer_radius, (-height * 0.5) - thickness),
                (0, (-height * 0.5) - thickness),
                (0, -height * 0.5),
            ])

        cylinder_cell = paramak.CenterColumnShieldCylinder(
            height=height,
            inner_radius=outer_radius - thickness,
            outer_radius=outer_radius,
            material_tag='test_mat',
        )

        my_geometry = paramak.Reactor(
            [cylinder_cell, bottom_cap_cell, top_cap_cell])

        my_model = paramak.NeutronicsModel(
            geometry=my_geometry,
            source=source,
            simulation_batches=batches,
            simulation_particles_per_batch=particles,
            materials={'test_mat': material},
            cell_tallies=['heating'])

        my_model.simulate(method='pymoab')

        # scaled from MeV to eV
        return my_model.results['test_mat_heating']['MeV per source particle'][
            'result'] * 1e6
示例#22
0
    def _make_divertor(self):

        self._divertor = paramak.CenterColumnShieldCylinder(
            height=self._center_column_shield_end_height *
            2.5,  # extra 0.5 to ensure overlap
            inner_radius=self._divertor_start_radius,
            outer_radius=self._divertor_end_radius,
            rotation_angle=self.rotation_angle,
            stp_filename="divertor.stp",
            stl_filename="divertor.stl",
            name="divertor",
            material_tag="divertor_mat",
            intersect=self._blanket,
        )
        self.shapes_and_components.append(self._divertor)
    def test_export_stp_CenterColumnShieldCylinder(self):
        """checks that export_stp() can export an stp file of a CenterColumnShieldCylinder object"""

        test_shape = paramak.CenterColumnShieldCylinder(
            rotation_angle=360,
            height=15,
            inner_radius=5,
            outer_radius=10,
            azimuth_placement_angle=0,
        )

        os.system("rm center_column_shield.stp")

        test_shape.export_stp("center_column_shield.stp")

        assert Path("center_column_shield.stp").exists() == True

        os.system("rm center_column_shield.stp")
示例#24
0
    def test_export_stp_CenterColumnShieldCylinder(self):
        """creates a CenterColumnShieldCylinder shape and checks that an stp file of the shape
        can be exported using the export_stp method"""

        test_shape = paramak.CenterColumnShieldCylinder(
            rotation_angle=360,
            height=15,
            inner_radius=5,
            outer_radius=10,
            azimuth_placement_angle=0,
        )

        os.system("rm center_column_shield.stp")

        test_shape.export_stp("center_column_shield.stp")

        assert Path("center_column_shield.stp").exists()

        os.system("rm center_column_shield.stp")
示例#25
0
    def _make_inboard_blanket_and_firstwall(self):

        # this is used to cut the inboard blanket and then fused / unioned with
        # the firstwall
        self._inboard_firstwall = paramak.BlanketFP(
            plasma=self._plasma,
            offset_from_plasma=self.inner_plasma_gap_radial_thickness,
            start_angle=90,
            stop_angle=270,
            thickness=self.firstwall_radial_thickness,
            rotation_angle=self.rotation_angle,
        )

        self._inboard_blanket = paramak.CenterColumnShieldCylinder(
            height=self._blanket_end_height * 2,
            inner_radius=self._inboard_blanket_start_radius,
            outer_radius=max(
                [item[0] for item in self._inboard_firstwall.points]),
            rotation_angle=self.rotation_angle,
            cut=self._inboard_firstwall,
        )

        # this takes a single solid from a compound of solids by finding the
        # solid nearest to a point
        self._inboard_blanket.solid = self._inboard_blanket.solid.solids(
            cq.selectors.NearestToPointSelector((0, 0, 0)))

        self._firstwall = paramak.BlanketFP(
            plasma=self._plasma,
            offset_from_plasma=self.outer_plasma_gap_radial_thickness,
            start_angle=90,
            stop_angle=-90,
            thickness=self.firstwall_radial_thickness,
            rotation_angle=self.rotation_angle,
            stp_filename="outboard_firstwall.stp",
            stl_filename="outboard_firstwall.stl",
            name="outboard_firstwall",
            material_tag="firstwall_mat",
            union=self._inboard_firstwall,
        )
def 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 setUp(self):
     self.test_shape = paramak.CenterColumnShieldCylinder(height=600,
                                                          inner_radius=100,
                                                          outer_radius=200)
示例#28
0
    def _make_blankets_layers(self):

        center_column_cutter = paramak.CenterColumnShieldCylinder(
            height=self._center_column_shield_height *
            1.5,  # extra 0.5 to ensure overlap,
            inner_radius=0,
            outer_radius=self._center_column_shield_end_radius,
            rotation_angle=360)

        self._firstwall = paramak.BlanketFP(
            plasma=self._plasma,
            thickness=self.firstwall_radial_thickness,
            offset_from_plasma=[
                self.inner_plasma_gap_radial_thickness,
                self.plasma_gap_vertical_thickness,
                self.outer_plasma_gap_radial_thickness,
                self.plasma_gap_vertical_thickness,
                self.inner_plasma_gap_radial_thickness
            ],
            start_angle=-179,
            stop_angle=179,
            rotation_angle=self.rotation_angle,
            stp_filename="firstwall.stp",
            cut=center_column_cutter)

        self._blanket = paramak.BlanketFP(
            plasma=self._plasma,
            thickness=self.blanket_radial_thickness,
            offset_from_plasma=[
                self.inner_plasma_gap_radial_thickness +
                self.firstwall_radial_thickness,
                self.plasma_gap_vertical_thickness +
                self.firstwall_radial_thickness,
                self.outer_plasma_gap_radial_thickness +
                self.firstwall_radial_thickness,
                self.plasma_gap_vertical_thickness +
                self.firstwall_radial_thickness,
                self.inner_plasma_gap_radial_thickness +
                self.firstwall_radial_thickness
            ],
            start_angle=-179,
            stop_angle=179,
            rotation_angle=self.rotation_angle,
            stp_filename="blanket.stp",
            cut=center_column_cutter)

        self._blanket_rear_wall = paramak.BlanketFP(
            plasma=self._plasma,
            thickness=self.blanket_rear_wall_radial_thickness,
            offset_from_plasma=[
                self.inner_plasma_gap_radial_thickness +
                self.firstwall_radial_thickness +
                self.blanket_radial_thickness,
                self.plasma_gap_vertical_thickness +
                self.firstwall_radial_thickness +
                self.blanket_radial_thickness,
                self.outer_plasma_gap_radial_thickness +
                self.firstwall_radial_thickness +
                self.blanket_radial_thickness,
                self.plasma_gap_vertical_thickness +
                self.firstwall_radial_thickness +
                self.blanket_radial_thickness,
                self.inner_plasma_gap_radial_thickness +
                self.firstwall_radial_thickness + self.blanket_radial_thickness
            ],
            start_angle=-179,
            stop_angle=179,
            rotation_angle=self.rotation_angle,
            stp_filename="blanket_rear_wall.stp",
            cut=center_column_cutter)
示例#29
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
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