Example #1
0
    def test_export_2d_image(self):
        """creates a Reactor object and checks that a png file of the reactor
        with the correct filename can be exported using the export_2d_image method"""

        os.system("rm 2d_test_image.png")
        test_shape = paramak.RotateStraightShape(points=[(0, 0), (0,
                                                                  20), (20,
                                                                        20)])
        test_shape.rotation_angle = 360
        test_reactor = paramak.Reactor([test_shape])
        returned_filename = test_reactor.export_2d_image(
            filename="2d_test_image.png")

        assert Path(returned_filename).exists() is True
        os.system("rm 2d_test_image.png")
Example #2
0
    def test_export_2d_image(self):
        """checks that export_2d_image() exports a png file with \
                the correct filename"""

        os.system("rm 2d_test_image.png")
        test_shape = paramak.RotateStraightShape(points=[(0, 0), (0,
                                                                  20), (20,
                                                                        20)])
        test_shape.rotation_angle = 360
        test_reactor = paramak.Reactor([test_shape])
        returned_filename = test_reactor.export_2d_image(
            filename="2d_test_image.png")

        assert Path(returned_filename).exists() is True
        os.system("rm 2d_test_image.png")
Example #3
0
 def test_adding_multiple_shape_with_stp_filename_to_reactor(self):
     """adds a shape to the reactor and checks that the stp_filename
     property works as designed"""
     test_shape = paramak.RotateStraightShape(points=[(0, 0), (0, 20),
                                                      (20, 20)],
                                              stp_filename='filename.stp')
     test_shape2 = paramak.RotateSplineShape(points=[(0, 0), (0, 20),
                                                     (20, 20)],
                                             stp_filename='filename2.stp')
     test_shape.rotation_angle = 360
     test_shape.create_solid()
     test_reactor = paramak.Reactor([test_shape, test_shape2])
     assert len(test_reactor.stp_filenames) == 2
     assert test_reactor.stp_filenames[0] == 'filename.stp'
     assert test_reactor.stp_filenames[1] == 'filename2.stp'
Example #4
0
 def test_adding_multiple_shapes_with_material_tag_to_reactor(self):
     """adds a shape to the reactor and checks that the material_tag
     property works as designed"""
     test_shape = paramak.RotateStraightShape(points=[(0, 0), (0, 20),
                                                      (20, 20)],
                                              material_tag='mat1')
     test_shape2 = paramak.RotateSplineShape(points=[(0, 0), (0, 20),
                                                     (20, 20)],
                                             material_tag='mat2')
     test_shape.rotation_angle = 360
     test_shape.create_solid()
     test_reactor = paramak.Reactor([test_shape, test_shape2])
     assert len(test_reactor.material_tags) == 2
     assert test_reactor.material_tags[0] == 'mat1'
     assert test_reactor.material_tags[1] == 'mat2'
    def test_export_h5m_without_extension(self):
        """Tests that the code appends .h5m to the end of the filename"""

        os.system('rm out.h5m')
        test_shape = paramak.RotateStraightShape(points=[(0, 0), (0, 20),
                                                         (20, 20)],
                                                 material_tag='mat1')
        test_shape2 = paramak.RotateSplineShape(points=[(0, 0), (0, 20),
                                                        (20, 20)],
                                                material_tag='mat2')
        test_shape.rotation_angle = 360
        test_reactor = paramak.Reactor([test_shape, test_shape2])
        test_reactor.export_h5m(filename='out', tolerance=0.01)
        assert Path("out.h5m").exists() is True
        os.system('rm out.h5m')
Example #6
0
    def test_exported_svg_files_exist_no_extension(self):
        """creates a Reactor object with one shape and checks that an svg file
        of the reactor can be exported to a specified location using the export_svg
        method"""

        test_shape = paramak.RotateStraightShape(
            points=[(0, 0), (0, 20), (20, 20)])
        test_shape.rotation_angle = 360
        os.system("rm test_svg_image.svg")
        test_reactor = paramak.Reactor([test_shape])

        test_reactor.export_svg("test_svg_image")

        assert Path("test_svg_image.svg").exists() is True
        os.system("rm test_svg_image.svg")
Example #7
0
    def test_Graveyard_exists_solid_is_None(self):
        """creates a Reactor object with one shape and checks that a graveyard
        can be produced using the make_graveyard method when the solid
        attribute of the shape is None"""

        test_shape = paramak.RotateStraightShape(points=[(0, 0), (0,
                                                                  20), (20,
                                                                        20)])
        test_shape.rotation_angle = 360
        test_shape.create_solid()
        test_reactor = paramak.Reactor([test_shape])
        test_reactor.shapes_and_components[0].solid = None
        test_reactor.make_graveyard()

        assert isinstance(test_reactor.graveyard, paramak.Shape)
Example #8
0
    def test_exported_svg_files_exist(self):
        """checks that export_stp() creates stp file in the \
                specified location"""

        test_shape = paramak.RotateStraightShape(points=[(0, 0), (0,
                                                                  20), (20,
                                                                        20)])
        test_shape.rotation_angle = 360
        os.system("rm test_svg_image.svg")
        test_reactor = paramak.Reactor([test_shape])

        test_reactor.export_svg("test_svg_image.svg")

        assert Path("test_svg_image.svg").exists() is True
        os.system("rm test_svg_image.svg")
Example #9
0
    def test_adding_multiple_shapes_with_material_tag_to_reactor(self):
        """Checks that multiple shape objects can be added to a Reactor object
        with the correct material tag properties."""

        test_shape = paramak.RotateStraightShape(points=[(0, 0), (0, 20),
                                                         (20, 20)],
                                                 material_tag="mat1")
        test_shape2 = paramak.RotateSplineShape(points=[(0, 0), (0, 20),
                                                        (20, 20)],
                                                material_tag="mat2")
        test_shape.rotation_angle = 360
        test_shape.create_solid()
        test_reactor = paramak.Reactor([test_shape, test_shape2])
        assert len(test_reactor.material_tags) == 2
        assert "mat1" in test_reactor.material_tags
        assert "mat2" in test_reactor.material_tags
Example #10
0
    def test_graveyard_error(self):
        test_shape = paramak.RotateStraightShape(
            points=[(0, 0), (0, 20), (20, 20)])
        test_reactor = paramak.Reactor([test_shape])

        def str_graveyard_offset():
            test_reactor.graveyard_offset = 'coucou'
        self.assertRaises(TypeError, str_graveyard_offset)

        def negative_graveyard_offset():
            test_reactor.graveyard_offset = -2
        self.assertRaises(ValueError, negative_graveyard_offset)

        def list_graveyard_offset():
            test_reactor.graveyard_offset = [1.2]
        self.assertRaises(TypeError, list_graveyard_offset)
Example #11
0
    def test_adding_multiple_shape_with_stp_filename_to_reactor(self):
        """Checks that multiple shape objects can be added to a Reactor object
        with the correct stp filename properties."""

        test_shape = paramak.RotateStraightShape(points=[(0, 0), (0, 20),
                                                         (20, 20)],
                                                 stp_filename="filename.stp")
        test_shape2 = paramak.RotateSplineShape(points=[(0, 0), (0, 20),
                                                        (20, 20)],
                                                stp_filename="filename2.stp")
        test_shape.rotation_angle = 360
        test_shape.create_solid()
        test_reactor = paramak.Reactor([test_shape, test_shape2])
        assert len(test_reactor.stp_filenames) == 2
        assert test_reactor.stp_filenames[0] == "filename.stp"
        assert test_reactor.stp_filenames[1] == "filename2.stp"
Example #12
0
        def test_stl_filename_duplication_rotate_mixed():
            """Checks ValueError is raised when RotateMixedShapes with
            duplicate stl filenames are added."""

            test_shape = paramak.RotateMixedShape(
                points=[(0, 0, "straight"), (0, 20, "straight"), (20, 20, "straight")],
                stl_filename="filename.stl",
            )
            test_shape2 = paramak.RotateMixedShape(
                points=[(0, 0, "straight"), (0, 20, "straight"), (20, 20, "straight")],
                stl_filename="filename.stl",
            )
            test_shape.rotation_angle = 360
            test_shape.create_solid()
            my_reactor = paramak.Reactor([test_shape, test_shape2])
            my_reactor.export_stl()
Example #13
0
    def test_export_neutronics_without_extension(self):
        """checks a json file is created if filename has no extension"""

        os.system("rm manifest_test.json")
        test_shape = paramak.RotateStraightShape(points=[(0, 0), (0,
                                                                  20), (20,
                                                                        20)])
        test_shape.rotation_angle = 360
        test_shape.material_tag = "test_material"
        test_shape.stp_filename = "test.stp"
        test_shape.tet_mesh = "size 60"
        test_reactor = paramak.Reactor([test_shape])
        returned_filename = test_reactor.export_neutronics_description(
            filename="manifest_test")
        assert returned_filename == "manifest_test.json"
        assert Path("manifest_test.json").exists() is True
        os.system("rm manifest_test.json")
Example #14
0
        def test_stl_filename_duplication_Extrude_Circle():
            """checks ValueError is raised when ExtrudeCircleShapes with duplicate
            stl filenames are added"""

            test_shape = paramak.ExtrudeCircleShape(
                points=[(20, 20)],
                radius=10,
                distance=10,
                stl_filename="filename.stl")
            test_shape2 = paramak.ExtrudeCircleShape(
                points=[(20, 20)],
                radius=10,
                distance=10,
                stl_filename="filename.stl")
            test_shape.rotation_angle = 360
            test_shape.create_solid()
            my_reactor = paramak.Reactor([test_shape, test_shape2])
            my_reactor.export_stl()
Example #15
0
    def test_export_html(self):
        """creates a Reactor object and checks that a html file of the reactor with
        the correct filename can be exported using the export_html method"""

        os.system("rm test_html.html")
        test_shape = paramak.RotateStraightShape(points=[(0, 0), (0,
                                                                  20), (20,
                                                                        20)])
        test_shape.rotation_angle = 360
        test_reactor = paramak.Reactor([test_shape])
        test_reactor.export_html(filename="test_html.html")

        assert Path("test_html.html").exists() is True
        os.system("rm test_html.html")
        test_reactor.export_html(filename="test_html")

        assert Path("test_html.html").exists() is True
        os.system("rm test_html.html")
Example #16
0
        def test_stl_filename_duplication_Extrude_spline():
            """Checks ValueError is raised when ExtrudeSplineShapes with
            duplicate stl filenames are added."""

            test_shape = paramak.ExtrudeSplineShape(
                points=[(0, 0), (0, 20), (20, 20)],
                distance=10,
                stl_filename="filename.stl",
            )
            test_shape2 = paramak.ExtrudeSplineShape(
                points=[(0, 0), (0, 20), (20, 20)],
                distance=10,
                stl_filename="filename.stl",
            )
            test_shape.rotation_angle = 360
            test_shape.create_solid()
            my_reactor = paramak.Reactor([test_shape, test_shape2])
            my_reactor.export_stl()
Example #17
0
    def test_export_neutronics_description_with_plasma(self):
        """Creates a Reactor object and checks that the neutronics description
        is exported to a json file with the correct entries, including the
        optional plasma."""

        os.system("rm manifest_test.json")

        test_shape = paramak.RotateStraightShape(
            points=[(0, 0), (0, 20), (20, 20)],
            rotation_angle=360,
            material_tag="test_material",
            stp_filename="test.stp",
        )
        test_shape.tet_mesh = "size 60"
        test_plasma = paramak.Plasma(
            major_radius=500,
            minor_radius=100,
            stp_filename="plasma.stp",
            material_tag="DT_plasma",
        )
        test_reactor = paramak.Reactor([test_shape, test_plasma])
        returned_filename = test_reactor.export_neutronics_description(
            include_plasma=True
        )
        with open("manifest.json") as json_file:
            neutronics_description = json.load(json_file)

        assert returned_filename == "manifest.json"
        assert Path("manifest.json").exists() is True
        assert len(neutronics_description) == 3
        assert "stp_filename" in neutronics_description[0].keys()
        assert "material" in neutronics_description[0].keys()
        assert "tet_mesh" in neutronics_description[0].keys()
        assert "stp_filename" in neutronics_description[1].keys()
        assert "material" in neutronics_description[1].keys()
        assert "tet_mesh" not in neutronics_description[1].keys()
        assert neutronics_description[0]["material"] == "test_material"
        assert neutronics_description[0]["stp_filename"] == "test.stp"
        assert neutronics_description[0]["tet_mesh"] == "size 60"
        assert neutronics_description[1]["material"] == "DT_plasma"
        assert neutronics_description[1]["stp_filename"] == "plasma.stp"
        assert neutronics_description[2]["material"] == "Graveyard"
        assert neutronics_description[2]["stp_filename"] == "Graveyard.stp"
        os.system("rm manifest.json")
Example #18
0
    def test_export_graveyard_offset(self):
        """checks that the graveyard can be exported with the correct default parameters
        and that these parameters can be changed"""

        test_shape = paramak.RotateStraightShape(
            points=[(0, 0), (0, 20), (20, 20)])
        os.system("rm Graveyard.stp")
        test_reactor = paramak.Reactor([test_shape])
        test_reactor.export_graveyard()
        assert test_reactor.graveyard_offset == 100
        graveyard_volume_1 = test_reactor.graveyard.volume

        test_reactor.export_graveyard(graveyard_offset=50)
        assert test_reactor.graveyard.volume < graveyard_volume_1
        graveyard_volume_2 = test_reactor.graveyard.volume

        test_reactor.export_graveyard(graveyard_offset=200)
        assert test_reactor.graveyard.volume > graveyard_volume_1
        assert test_reactor.graveyard.volume > graveyard_volume_2
Example #19
0
    def test_neutronics_description_without_plasma(self):
        """Creates a Reactor object and checks that the neutronics description
        is exported with the correct material_tag and stp_filename."""

        test_shape = paramak.RotateStraightShape(
            points=[(0, 0), (0, 20), (20, 20)])
        test_shape.rotation_angle = 360
        test_shape.material_tag = "test_material"
        test_shape.stp_filename = "test.stp"
        test_reactor = paramak.Reactor([test_shape])
        neutronics_description = test_reactor.neutronics_description()

        assert len(neutronics_description) == 2
        assert "stp_filename" in neutronics_description[0].keys()
        assert "material" in neutronics_description[0].keys()
        assert neutronics_description[0]["material"] == "test_material"
        assert neutronics_description[0]["stp_filename"] == "test.stp"
        assert neutronics_description[1]["material"] == "Graveyard"
        assert neutronics_description[1]["stp_filename"] == "Graveyard.stp"
Example #20
0
    def test_exported_graveyard_creates_stp_file(self):
        """checks that export_graveyard() creates stp file in the \
                specified location"""

        test_shape = paramak.RotateStraightShape(points=[(0, 0), (0,
                                                                  20), (20,
                                                                        20)])
        test_shape.rotation_angle = 360
        os.system("rm my_graveyard.stp")
        os.system("rm Graveyard.stp")
        test_shape.stp_filename = "test_shape.stp"
        test_reactor = paramak.Reactor([test_shape])

        test_reactor.export_graveyard()
        test_reactor.export_graveyard(filename="my_graveyard.stp")

        for filepath in ["Graveyard.stp", "my_graveyard.stp"]:
            assert Path(filepath).exists() is True
            os.system("rm " + filepath)
Example #21
0
    def test_reactor_from_shapes_2d_mesh_tallies(self):
        """Makes a reactor from two shapes, then mades a neutronics model
        and tests the TBR simulation value"""

        os.system('rm *_on_2D_mesh_*.png')

        test_shape = paramak.RotateStraightShape(
            points=[(0, 0), (0, 20), (20, 20)],
            material_tag='mat1',
        )
        test_shape2 = paramak.RotateSplineShape(
            points=[(100, 100), (100, -100), (200, -100), (200, 100)],
            material_tag='blanket_mat',
            rotation_angle=180
        )

        test_reactor = paramak.Reactor([test_shape, test_shape2])

        neutronics_model = paramak.NeutronicsModel(
            geometry=test_reactor,
            source=self.source,
            materials={
                'mat1': 'copper',
                'blanket_mat': 'FLiNaK',  # used as O18 is not in nndc nuc data
            },
            mesh_tally_2d=['(n,Xt)', 'heating', 'flux'],
            simulation_batches=2,
            simulation_particles_per_batch=10,
        )

        # starts the neutronics simulation using trelis
        neutronics_model.simulate(verbose=False, method='pymoab')

        assert Path("n-Xt_on_2D_mesh_xz.png").exists() is True
        assert Path("n-Xt_on_2D_mesh_xy.png").exists() is True
        assert Path("n-Xt_on_2D_mesh_yz.png").exists() is True
        assert Path("heating_on_2D_mesh_xz.png").exists() is True
        assert Path("heating_on_2D_mesh_xy.png").exists() is True
        assert Path("heating_on_2D_mesh_yz.png").exists() is True
        assert Path("flux_on_2D_mesh_xz.png").exists() is True
        assert Path("flux_on_2D_mesh_xy.png").exists() is True
        assert Path("flux_on_2D_mesh_yz.png").exists() is True
Example #22
0
    def test_exported_stl_files_exist(self):
        """creates a Reactor object with one shape and checks that a stl file
        of the reactor can be exported to a specified location using the
        export_stl method"""

        test_shape = paramak.RotateStraightShape(
            points=[(0, 0), (0, 20), (20, 20)])
        test_shape.rotation_angle = 360
        os.system("rm test_reactor/test_shape.stl")
        os.system("rm test_reactor/Graveyard.stl")
        test_shape.stl_filename = "test_shape.stl"
        test_reactor = paramak.Reactor([test_shape])

        test_reactor.export_stl(output_folder="test_reactor")

        for filepath in [
            "test_reactor/test_shape.stl",
                "test_reactor/Graveyard.stl"]:
            assert Path(filepath).exists() is True
            os.system("rm " + filepath)
Example #23
0
    def test_export_graveyard(self):
        """creates a Reactor object with one shape and checks that a graveyard
        can be exported to a specified location using the make_graveyard method"""

        test_shape = paramak.RotateStraightShape(
            points=[(0, 0), (0, 20), (20, 20)])
        test_shape.rotation_angle = 360
        os.system("rm my_graveyard.stp")
        os.system("rm Graveyard.stp")
        test_shape.stp_filename = "test_shape.stp"
        test_reactor = paramak.Reactor([test_shape])

        test_reactor.export_graveyard()
        test_reactor.export_graveyard(filename="my_graveyard.stp")

        for filepath in ["Graveyard.stp", "my_graveyard.stp"]:
            assert Path(filepath).exists() is True
            os.system("rm " + filepath)

        assert test_reactor.graveyard is not None
        assert test_reactor.graveyard.__class__.__name__ == "HollowCube"
def make_cad_model_with_paramak():
    """
    Makes a reactor object from two parametric
    shapes. Exports the neutronics description
    and stp files for the reactor
    """

    width = 500

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

    pf_coil.export_html("test.html")

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

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

    # exports neutronics description and stp files
    my_reactor.export_neutronics_description()
    my_reactor.export_stp()
Example #25
0
def main(rotation_angle=180):

    inboard_pf_coils = paramak.PoloidalFieldCoilSet(
        center_points=[
            (53.5, -169.58),
            (53.5, -118.43),
            (53.5, -46.54),
            (53.5, 46.54),
            (53.5, 118.43),
            (53.5, 169.58),
        ],
        heights=[
            41.5,
            40.5,
            82.95,
            82.95,
            40.5,
            41.5,
        ],
        widths=[27.7, 27.7, 27.7, 27.7, 27.7, 27.7],
        rotation_angle=rotation_angle,
        stp_filename='inboard_pf_coils.stp')

    outboard_pf_coils = paramak.PoloidalFieldCoilSet(
        center_points=[
            (86, 230),
            (86, -230),
            (164, 241),
            (164, -241),
            (263, 222),
            (263, -222),
            (373, 131),
            (373, -131),
        ],
        widths=[
            32,
            32,
            50,
            50,
            43,
            43,
            48,
            48,
        ],
        heights=[
            40,
            40,
            30,
            30,
            28,
            28,
            37,
            37,
        ],
        rotation_angle=rotation_angle,
        stp_filename='outboard_pf_coils.stp')

    div_coils = paramak.PoloidalFieldCoilSet(center_points=[
        (207, 144),
        (207, 125),
        (207, -144),
        (207, -125),
    ],
                                             widths=[15, 15, 15, 15],
                                             heights=[15, 15, 15, 15],
                                             rotation_angle=rotation_angle,
                                             stp_filename='div_coils.stp')

    vs_coils = paramak.PoloidalFieldCoilSet(center_points=[
        (240, 70),
        (240, -70),
    ],
                                            widths=[10, 10],
                                            heights=[10, 10],
                                            rotation_angle=rotation_angle,
                                            stp_filename='vs_coils.stp')

    EFCCu_coils_1 = paramak.RotateStraightShape(
        points=[
            (235.56581986143186, -127.64976958525347),
            (240.1847575057737, -121.19815668202767),
            (246.65127020785218, -125.80645161290323),
            (242.0323325635104, -132.25806451612902),
        ],
        rotation_angle=rotation_angle,
        stp_filename='EFCCu_coils_1.stp')
    EFCCu_coils_2 = paramak.RotateStraightShape(
        points=[
            (262.3556581986143, -90.78341013824888),
            (266.97459584295615, -84.33179723502303),
            (273.44110854503464, -88.94009216589859),
            (268.82217090069287, -94.47004608294935),
        ],
        rotation_angle=rotation_angle,
        stp_filename='EFCCu_coils_2.stp')
    EFCCu_coils_3 = paramak.RotateStraightShape(
        points=[
            (281.7551963048499, -71.42857142857144),
            (289.1454965357968, -71.42857142857144),
            (289.1454965357968, -78.80184331797238),
            (281.7551963048499, -78.80184331797238),
        ],
        rotation_angle=rotation_angle,
        stp_filename='EFCCu_coils_3.stp')

    EFCCu_coils_4 = paramak.RotateStraightShape(
        points=[
            (235.56581986143186, 127.64976958525347),
            (240.1847575057737, 121.19815668202767),
            (246.65127020785218, 125.80645161290323),
            (242.0323325635104, 132.25806451612902),
        ],
        rotation_angle=rotation_angle,
        stp_filename='EFCCu_coils_4.stp')
    EFCCu_coils_5 = paramak.RotateStraightShape(
        points=[
            (262.3556581986143, 90.78341013824888),
            (266.97459584295615, 84.33179723502303),
            (273.44110854503464, 88.94009216589859),
            (268.82217090069287, 94.47004608294935),
        ],
        rotation_angle=rotation_angle,
        stp_filename='EFCCu_coils_5.stp')
    EFCCu_coils_6 = paramak.RotateStraightShape(
        points=[
            (281.7551963048499, 71.42857142857144),
            (289.1454965357968, 71.42857142857144),
            (289.1454965357968, 78.80184331797238),
            (281.7551963048499, 78.80184331797238),
        ],
        rotation_angle=rotation_angle,
        stp_filename='EFCCu_coils_6.stp')

    plasma = paramak.Plasma(
        major_radius=185,
        minor_radius=57 - 6,  # 3 is a small ofset to avoid overlaps
        triangularity=0.31,
        elongation=1.97,
        rotation_angle=rotation_angle,
        stp_filename='plasma.stp',
    )

    antenna = paramak.RotateMixedShape(points=[
        (263.2794457274827, 46.5437788018433, 'straight'),
        (263.2794457274827, -46.54377880184336, 'straight'),
        (231.87066974595842, -46.54377880184336, 'spline'),
        (243.87990762124713, 0, 'spline'),
        (231.87066974595842, 46.5437788018433, 'straight'),
    ],
                                       rotation_angle=rotation_angle,
                                       stp_filename='antenna.stp')

    tf_coil = paramak.ToroidalFieldCoilPrincetonD(
        R1=105,
        R2=339,
        thickness=33,
        distance=33,
        number_of_coils=12,
        rotation_angle=rotation_angle,
        stp_filename='tf_coil.stp')

    vac_vessel = paramak.RotateStraightShape(points=[
        (117.32101616628177, 126.72811059907835),
        (163.51039260969978, 170.04608294930875),
        (181.98614318706697, 171.88940092165896),
        (196.76674364896073, 169.12442396313364),
        (196.76674364896073, 115.66820276497694),
        (236.4896073903002, 114.74654377880185),
        (273.44110854503464, 65.89861751152074),
        (272.51732101616625, -65.89861751152074),
        (236.4896073903002, -115.66820276497697),
        (196.76674364896073, -115.66820276497697),
        (196.76674364896073, -169.12442396313367),
        (181.98614318706697, -172.81105990783408),
        (163.51039260969978, -170.04608294930875),
        (117.32101616628177, -126.72811059907832),
        (117.32101616628177, 123.04147465437785),
        (123.78752886836028, 123.04147465437785),
        (123.78752886836028, -123.963133640553),
        (165.3579676674365, -162.67281105990781),
        (181.98614318706697, -164.5161290322581),
        (190.3002309468822, -162.67281105990781),
        (190.3002309468822, -112.90322580645159),
        (193.99538106235568, -109.21658986175117),
        (232.7944572748268, -109.21658986175117),
        (266.97459584295615, -63.13364055299536),
        (266.05080831408776, 62.21198156682027),
        (232.7944572748268, 109.21658986175115),
        (193.99538106235568, 109.21658986175115),
        (190.3002309468822, 111.98156682027647),
        (190.3002309468822, 162.67281105990784),
        (181.98614318706697, 164.51612903225805),
        (165.3579676674365, 162.67281105990784),
        (123.78752886836028, 123.04147465437785),
        (117.32101616628177, 123.04147465437785),
    ],
                                             rotation_angle=rotation_angle,
                                             stp_filename='vacvessel.stp')

    inner_vessel = paramak.RotateMixedShape(
        points=[
            (269.7459584295612, -46.54377880184336, 'straight'),
            (231.87066974595842, -46.5437788018433, 'spline'),
            (223.55658198614316, -62.21198156682027, 'spline'),
            (207.85219399538107, -80.64516129032262, 'spline'),
            (166.28175519630486, -115.66820276497697, 'spline'),
            (164.43418013856814, -119.35483870967744, 'spline'),
            (164.43418013856814, -122.11981566820276, 'straight'),
            (173.67205542725173, -140.5529953917051, 'straight'),
            (184.75750577367205, -140.5529953917051, 'straight'),
            (184.75750577367205, -158.98617511520735, 'straight'),
            (181.98614318706697, -159.9078341013825, 'straight'),
            (147.80600461893764, -118.43317972350235, 'straight'),
            (129.33025404157044, -123.04147465437785, 'straight'),
            (145.95842956120094, -111.05990783410135, 'straight'),
            (126.55889145496536, -50.23041474654377, 'straight'),
            (127.48267898383372, 50.23041474654377, 'straight'),
            (145.95842956120094, 110.13824884792626, 'straight'),
            (128.40646651270208, 123.04147465437785, 'straight'),
            (147.80600461893764, 117.51152073732717, 'straight'),
            (181.98614318706697, 159.90783410138246, 'straight'),
            (185.6812933025404, 158.98617511520735, 'straight'),
            (184.75750577367205, 140.55299539170505, 'straight'),
            (172.74826789838338, 140.55299539170505, 'spline'),
            (164.43418013856814, 121.19815668202764, 'spline'),
            (164.43418013856814, 118.43317972350229, 'spline'),
            (165.3579676674365, 115.66820276497694, 'spline'),
            (173.67205542725173, 111.05990783410135, 'spline'),
            (207.85219399538107, 80.64516129032256, 'spline'),
            (220.7852193995381, 66.82027649769586, 'spline'),
            (231.87066974595842, 46.5437788018433, 'spline'),
            (268.82217090069287, 46.5437788018433, 'straight'),
            (268.82217090069287, 63.13364055299536, 'straight'),
            (233.71824480369514, 111.98156682027647, 'straight'),
            (193.99538106235568, 112.90322580645159, 'straight'),
            (192.14780600461893, 164.51612903225805, 'straight'),
            (163.51039260969978, 166.35944700460828, 'straight'),
            (121.93995381062356, 123.96313364055297, 'straight'),
            (121.0161662817552, -125.80645161290323, 'straight'),
            (163.51039260969978, -166.35944700460834, 'straight'),
            (192.14780600461893, -166.35944700460834, 'straight'),
            (193.99538106235568, -112.90322580645159, 'straight'),
            (234.64203233256353, -111.9815668202765, 'straight'),
            (269.7459584295612, -63.13364055299536, 'straight'),
        ],
        rotation_angle=rotation_angle,
        stp_filename='inner_vessel.stp',
        cut=[vac_vessel, vs_coils, antenna])

    sparc = paramak.Reactor([
        inboard_pf_coils, outboard_pf_coils, plasma, antenna, vs_coils,
        inner_vessel, tf_coil, EFCCu_coils_1, EFCCu_coils_2, EFCCu_coils_3,
        EFCCu_coils_4, EFCCu_coils_5, EFCCu_coils_6, vac_vessel, div_coils
    ])

    sparc.export_stp()
    sparc.export_svg('htc_reactor.svg')
    sparc.export_html('htc_reactor.html')
Example #26
0
def main():

    plasma = paramak.Plasma(
        major_radius=250,
        minor_radius=100,
        triangularity=0.5,
        elongation=2.5,
        rotation_angle=180,
    )

    centre_column = paramak.RotateMixedShape(rotation_angle=180,
                                             points=[
                                                 (74.6, 687.0, "straight"),
                                                 (171.0, 687.0, "straight"),
                                                 (171.0, 459.9232, "spline"),
                                                 (108.001, 249.9402, "spline"),
                                                 (92.8995, 0, "spline"),
                                                 (108.001, -249.9402,
                                                  "spline"),
                                                 (171.0, -459.9232,
                                                  "straight"),
                                                 (171.0, -687.0, "straight"),
                                                 (74.6, -687.0, "straight"),
                                             ])
    centre_column.stp_filename = "centre_column.stp"
    centre_column.stl_filename = "centre_column.stl"

    blanket = paramak.RotateMixedShape(rotation_angle=180,
                                       points=[
                                           (325.4886, 300.5, "straight"),
                                           (538.4886, 300.5, "straight"),
                                           (538.4886, -300.5, "straight"),
                                           (325.4528, -300.5, "spline"),
                                           (389.9263, -138.1335, "spline"),
                                           (404.5108, 0, "spline"),
                                           (389.9263, 138.1335, "spline"),
                                       ])
    blanket.stp_filename = "blanket.stp"
    blanket.stl_filename = "blanket.stl"

    firstwall = paramak.RotateMixedShape(rotation_angle=180,
                                         points=[
                                             (322.9528, 300.5, "straight"),
                                             (325.4528, 300.5, "spline"),
                                             (389.9263, 138.1335, "spline"),
                                             (404.5108, 0, "spline"),
                                             (389.9263, -138.1335, "spline"),
                                             (325.4528, -300.5, "straight"),
                                             (322.9528, -300.5, "spline"),
                                             (387.4263, -138.1335, "spline"),
                                             (402.0108, 0, "spline"),
                                             (387.4263, 138.1335, "spline"),
                                         ])
    firstwall.stp_filename = "firstwall.stp"
    firstwall.stl_filename = "firstwall.stl"

    divertor_bottom = paramak.RotateMixedShape(
        rotation_angle=180,
        points=[
            (192.4782, -447.204, "spline"),
            (272.4957, -370.5, "spline"),
            (322.9528, -300.5, "straight"),
            (538.4886, -300.5, "straight"),
            (538.4886, -687.0, "straight"),
            (171.0, -687.0, "straight"),
            (171.0, -459.9232, "spline"),
            (218.8746, -513.3484, "spline"),
            (362.4986, -602.3905, "straight"),
            (372.5012, -580.5742, "spline"),
            (237.48395, -497.21782, "spline"),
        ])
    divertor_bottom.stp_filename = "divertor_bottom.stp"
    divertor_bottom.stl_filename = "divertor_bottom.stl"

    divertor_top = paramak.RotateMixedShape(rotation_angle=180,
                                            points=[
                                                (192.4782, 447.204, "spline"),
                                                (272.4957, 370.5, "spline"),
                                                (322.9528, 300.5, "straight"),
                                                (538.4886, 300.5, "straight"),
                                                (538.4886, 687.0, "straight"),
                                                (171.0, 687.0, "straight"),
                                                (171.0, 459.9232, "spline"),
                                                (218.8746, 513.3484, "spline"),
                                                (362.4986, 602.3905,
                                                 "straight"),
                                                (372.5012, 580.5742, "spline"),
                                                (237.48395, 497.21782,
                                                 "spline"),
                                            ])
    divertor_top.stp_filename = "divertor_top.stp"
    divertor_top.stl_filename = "divertor_top.stl"

    core = paramak.RotateStraightShape(rotation_angle=180,
                                       points=[(0, 687.0), (74.6, 687.0),
                                               (74.6, -687.0), (0, -687.0)])
    core.stp_filename = "core.stp"
    core.stl_filename = "core.stl"

    myreactor = paramak.Reactor([
        plasma, blanket, core, divertor_top, divertor_bottom, firstwall,
        centre_column
    ])

    myreactor.export_stp(output_folder="can_reactor_from_points")
    myreactor.export_stl(output_folder="can_reactor_from_points")
    myreactor.export_html("can_reactor_from_points/reactor.html")
Example #27
0
def main():

    outer_most_x = 900
    blanket_height = 300

    plasma = paramak.Plasma()
    plasma.major_radius = 250
    plasma.minor_radius = 100
    plasma.triangularity = 0.5
    plasma.elongation = 2.5
    plasma.rotation_angle = 180

    centre_column = paramak.RotateMixedShape(points=[
        (74.6, 687.0, "straight"),
        (171.0, 687.0, "straight"),
        (171.0, 459.9232, "spline"),
        (108.001, 249.9402, "spline"),
        (92.8995, 0, "spline"),
        (108.001, -249.9402, "spline"),
        (171.0, -459.9232, "straight"),
        (171.0, -687.0, "straight"),
        (74.6, -687.0, "straight"),
    ])
    centre_column.stp_filename = "centre_column.stp"
    centre_column.rotation_angle = 180

    blanket = paramak.RotateMixedShape(points=[
        (325.4528, blanket_height, "straight"),
        (outer_most_x, blanket_height, "straight"),
        (outer_most_x, -blanket_height, "straight"),
        (325.4528, -blanket_height, "spline"),
        (389.9263, -138.1335, "spline"),
        (404.5108, 0, "spline"),
        (389.9263, 138.1335, "spline"),
    ])
    blanket.stp_filename = "blanket.stp"
    blanket.rotation_angle = 180

    firstwall = paramak.RotateMixedShape(points=[
        (322.9528, blanket_height, "straight"),
        (325.4528, blanket_height, "spline"),
        (389.9263, 138.1335, "spline"),
        (404.5108, 0, "spline"),
        (389.9263, -138.1335, "spline"),
        (325.4528, -blanket_height, "straight"),
        (322.9528, -blanket_height, "spline"),
        (387.4263, -138.1335, "spline"),
        (402.0108, 0, "spline"),
        (387.4263, 138.1335, "spline"),
    ])
    firstwall.stp_filename = "firstwall.stp"
    firstwall.rotation_angle = 180

    divertor_bottom = paramak.RotateMixedShape(points=[
        (192.4782, -447.204, "spline"),
        (272.4957, -370.5, "spline"),
        (322.9528, -blanket_height, "straight"),
        (outer_most_x, -blanket_height, "straight"),
        (outer_most_x, -687.0, "straight"),
        (171.0, -687.0, "straight"),
        (171.0, -459.9232, "spline"),
        (218.8746, -513.3484, "spline"),
        (362.4986, -602.3905, "straight"),
        (372.5012, -580.5742, "spline"),
        (237.48395, -497.21782, "spline"),
    ])
    divertor_bottom.stp_filename = "divertor_bottom.stp"
    divertor_bottom.rotation_angle = 180

    divertor_top = paramak.RotateMixedShape(points=[
        (192.4782, 447.204, "spline"),
        (272.4957, 370.5, "spline"),
        (322.9528, blanket_height, "straight"),
        (outer_most_x, blanket_height, "straight"),
        (outer_most_x, 687.0, "straight"),
        (171.0, 687.0, "straight"),
        (171.0, 459.9232, "spline"),
        (218.8746, 513.3484, "spline"),
        (362.4986, 602.3905, "straight"),
        (372.5012, 580.5742, "spline"),
        (237.48395, 497.21782, "spline"),
    ])
    divertor_top.stp_filename = "divertor_top.stp"
    divertor_top.rotation_angle = 180

    core = paramak.RotateStraightShape(
        points=[(0, 687.0), (74.6, 687.0), (74.6, -687.0), (0, -687.0)])
    core.stp_filename = "core.stp"
    core.rotation_angle = 180

    # initiates a reactor object
    myreactor = paramak.Reactor([
        plasma, blanket, core, divertor_top, divertor_bottom, firstwall,
        centre_column
    ])

    myreactor.export_stp(output_folder="can_reactor_from_parameters")
    myreactor.export_html(filename="can_reactor_from_parameters/reactor.html")
Example #28
0
 def incorrect_shapes_and_components():
     paramak.Reactor(test_shape)
Example #29
0
    def setUp(self):
        test_shape = paramak.RotateStraightShape(points=[(0, 0), (0,
                                                                  20), (20,
                                                                        20)])

        self.test_reactor = paramak.Reactor([test_shape])
Example #30
0
    def test_reactor_creation_with_default_properties(self):
        """creates a Reactor object and checks that it has no default properties"""

        test_reactor = paramak.Reactor([])

        assert test_reactor is not None