Пример #1
0
def main():

    my_reactor = paramak.SubmersionTokamak(
        inner_bore_radial_thickness=30,
        inboard_tf_leg_radial_thickness=30,
        center_column_shield_radial_thickness=30,
        divertor_radial_thickness=80,
        inner_plasma_gap_radial_thickness=50,
        plasma_radial_thickness=200,
        outer_plasma_gap_radial_thickness=50,
        firstwall_radial_thickness=30,
        blanket_rear_wall_radial_thickness=30,
        number_of_tf_coils=16,
        rotation_angle=180,
        support_radial_thickness=50,
        inboard_blanket_radial_thickness=30,
        outboard_blanket_radial_thickness=30,
        plasma_high_point=(200, 150),
        pf_coil_radial_thicknesses=[30, 30, 30, 30],
        pf_coil_vertical_thicknesses=[30, 30, 30, 30],
        pf_coil_to_tf_coil_radial_gap=50,
        outboard_tf_coil_radial_thickness=30,
        outboard_tf_coil_poloidal_thickness=30,
        tf_coil_to_rear_blanket_radial_gap=20,
    )

    my_reactor.export_stp()

    my_reactor.export_neutronics_description()
Пример #2
0
    def test_SubmersionTokamak_with_tf_and_pf_coils_creation(self):
        """creates a submersion reactor with tf and pf coils using the
        Submersion Tokamak parametric reactor and checks that the correct
        number of components are created"""

        test_reactor = paramak.SubmersionTokamak(
            inner_bore_radial_thickness=25,
            inboard_tf_leg_radial_thickness=50,
            center_column_shield_radial_thickness=50,
            inboard_blanket_radial_thickness=50,
            firstwall_radial_thickness=50,
            inner_plasma_gap_radial_thickness=70,
            plasma_radial_thickness=300,
            outer_plasma_gap_radial_thickness=70,
            outboard_blanket_radial_thickness=200,
            blanket_rear_wall_radial_thickness=50,
            divertor_radial_thickness=50,
            plasma_high_point=(50 + 50 + 50 + 100 + 100, 350),
            support_radial_thickness=150,
            outboard_tf_coil_radial_thickness=50,
            tf_coil_to_rear_blanket_radial_gap=50,
            outboard_tf_coil_poloidal_thickness=70,
            pf_coil_vertical_thicknesses=[50, 50, 50, 50, 50],
            pf_coil_radial_thicknesses=[40, 40, 40, 40, 40],
            pf_coil_to_tf_coil_radial_gap=50,
            number_of_tf_coils=4,
            rotation_angle=359,
        )
        assert len(test_reactor.shapes_and_components) == 10
Пример #3
0
    def test_SubmersionTokamak_svg_creation(self):
        """creates a submersion reactor using the SubmersionTokamak parametric
        reactor and checks that an svg file of the reactor can be exported
        using the export_svg method"""

        os.system("rm test_SubmersionTokamak_image.svg")

        test_reactor = paramak.SubmersionTokamak(
            inner_bore_radial_thickness=25,
            inboard_tf_leg_radial_thickness=50,
            center_column_shield_radial_thickness=50,
            inboard_blanket_radial_thickness=100,
            firstwall_radial_thickness=50,
            inner_plasma_gap_radial_thickness=70,
            plasma_radial_thickness=300,
            divertor_radial_thickness=100,
            outer_plasma_gap_radial_thickness=70,
            outboard_blanket_radial_thickness=200,
            blanket_rear_wall_radial_thickness=50,
            support_radial_thickness=150,
            plasma_high_point=(50 + 50 + 50 + 100 + 50 + 50 + 100, 350),
            rotation_angle=359,
        )
        test_reactor.export_svg("test_SubmersionTokamak_image.svg")

        assert Path("test_SubmersionTokamak_image.svg").exists() is True
        os.system("rm test_SubmersionTokamak_image.svg")
Пример #4
0
def make_model_and_simulate(temperature):
    """Makes a neutronics Reactor model and simulates the flux"""

    # makes the 3d geometry from input parameters
    my_reactor = paramak.SubmersionTokamak(
        inner_bore_radial_thickness=30,
        inboard_tf_leg_radial_thickness=30,
        center_column_shield_radial_thickness=30,
        divertor_radial_thickness=80,
        inner_plasma_gap_radial_thickness=50,
        plasma_radial_thickness=200,
        outer_plasma_gap_radial_thickness=50,
        firstwall_radial_thickness=30,
        blanket_rear_wall_radial_thickness=30,
        rotation_angle=180,
        support_radial_thickness=50,
        inboard_blanket_radial_thickness=30,
        outboard_blanket_radial_thickness=30,
        elongation=2.75,
        triangularity=0.5,
    )

    # this can just be set as a string as temperature is needed for this
    # material
    flibe = nmm.Material('FLiBe', temperature_in_C=temperature)

    source = openmc.Source()
    # sets the location of the source to x=0 y=0 z=0
    source.space = openmc.stats.Point((my_reactor.major_radius, 0, 0))
    # sets the direction to isotropic
    source.angle = openmc.stats.Isotropic()
    # sets the energy distribution to 100% 14MeV neutrons
    source.energy = openmc.stats.Discrete([14e6], [1])

    # makes the neutronics model from the geometry and material allocations
    neutronics_model = paramak.NeutronicsModel(
        geometry=my_reactor,
        source=source,
        materials={
            'inboard_tf_coils_mat': 'eurofer',
            'center_column_shield_mat': 'eurofer',
            'divertor_mat': 'eurofer',
            'firstwall_mat': 'eurofer',
            'blanket_rear_wall_mat': 'eurofer',
            'blanket_mat': flibe,
            'supports_mat': 'eurofer'
        },
        cell_tallies=['TBR'],
        simulation_batches=5,
        simulation_particles_per_batch=1e4,
        faceting_tolerance=1e-4,
        merge_tolerance=1e-4)

    # simulate the neutronics model
    neutronics_model.simulate(method='trelis')
    return neutronics_model.results['TBR']
Пример #5
0
def rotate_single_reactor(number_of_images=100):
    """Makes a single reactor and exports and svg image with different view
    angles. Combines the svg images into a gif animation."""

    # allows the projection angle for the svg to be found via interpolation
    angle_finder = interp1d([0, number_of_images], [2.4021, 6.])

    my_reactor = paramak.SubmersionTokamak(
        inner_bore_radial_thickness=30,
        inboard_tf_leg_radial_thickness=30,
        center_column_shield_radial_thickness=30,
        divertor_radial_thickness=80,
        inner_plasma_gap_radial_thickness=50,
        plasma_radial_thickness=200,
        outer_plasma_gap_radial_thickness=50,
        firstwall_radial_thickness=30,
        blanket_rear_wall_radial_thickness=30,
        number_of_tf_coils=16,
        rotation_angle=180,
        support_radial_thickness=90,
        inboard_blanket_radial_thickness=30,
        outboard_blanket_radial_thickness=30,
        elongation=2.00,
        triangularity=0.50,
        pf_coil_radial_thicknesses=[30, 30, 30, 30],
        pf_coil_vertical_thicknesses=[30, 30, 30, 30],
        pf_coil_to_tf_coil_radial_gap=50,
        outboard_tf_coil_radial_thickness=30,
        outboard_tf_coil_poloidal_thickness=30,
        tf_coil_to_rear_blanket_radial_gap=20,
    )

    for i in range(number_of_images):

        # uses the rotation angle (in radians) to find new x, y points
        x_vec, y_vec = paramak.utils.rotate([0, 0], [1, 0], angle_finder(i))
        projectionDir = (x_vec, y_vec, 0)

        my_reactor.export_svg(
            filename="rotation_" + str(i).zfill(4) + ".svg",
            projectionDir=projectionDir,
            showHidden=False,
            height=200,
            width=300,
            marginTop=27,
            marginLeft=35,
            strokeWidth=3.5
        )

        print("made", str(i + 1), "models out of", str(number_of_images))

    subprocess.check_call(
        ["convert", "-delay", "15", "rotation_*.svg", "rotated.gif"])

    print("animation file made as saved as rotated.gif")
Пример #6
0
    def test_SubmersionTokamak_with_tf_and_pf_coils_stp_creation(self):
        """creates a submersion reactor with tf and pf coils using the
        SubmersionTokamak parametric reactor and checks that stp files of all
        components can be exported using the export_stp method"""

        os.system("rm -r tf_pf_SubmersionTokamak")

        test_reactor = paramak.SubmersionTokamak(
            inner_bore_radial_thickness=25,
            inboard_tf_leg_radial_thickness=50,
            center_column_shield_radial_thickness=50,
            inboard_blanket_radial_thickness=50,
            firstwall_radial_thickness=50,
            inner_plasma_gap_radial_thickness=70,
            plasma_radial_thickness=300,
            outer_plasma_gap_radial_thickness=70,
            outboard_blanket_radial_thickness=200,
            blanket_rear_wall_radial_thickness=50,
            divertor_radial_thickness=50,
            plasma_high_point=(50 + 50 + 50 + 100 + 100, 350),
            support_radial_thickness=150,
            outboard_tf_coil_radial_thickness=50,
            tf_coil_to_rear_blanket_radial_gap=50,
            outboard_tf_coil_poloidal_thickness=70,
            pf_coil_vertical_thicknesses=[50, 50, 50, 50, 50],
            pf_coil_radial_thicknesses=[40, 40, 40, 40, 40],
            pf_coil_to_tf_coil_radial_gap=50,
            number_of_tf_coils=4,
            rotation_angle=359,
        )
        test_reactor.export_stp("tf_pf_SubmersionTokamak")

        output_filenames = [
            "tf_pf_SubmersionTokamak/inboard_tf_coils.stp",
            "tf_pf_SubmersionTokamak/center_column_shield.stp",
            "tf_pf_SubmersionTokamak/plasma.stp",
            "tf_pf_SubmersionTokamak/divertor.stp",
            "tf_pf_SubmersionTokamak/outboard_firstwall.stp",
            "tf_pf_SubmersionTokamak/supports.stp",
            "tf_pf_SubmersionTokamak/blanket.stp",
            "tf_pf_SubmersionTokamak/outboard_rear_blanket_wall.stp",
            "tf_pf_SubmersionTokamak/Graveyard.stp",
        ]

        for output_filename in output_filenames:
            assert Path(output_filename).exists() is True
        os.system("rm -r tf_pf_SubmersionTokamak")
Пример #7
0
 def setUp(self):
     self.test_reactor = paramak.SubmersionTokamak(
         inner_bore_radial_thickness=10,
         inboard_tf_leg_radial_thickness=30,
         center_column_shield_radial_thickness=60,
         divertor_radial_thickness=50,
         inner_plasma_gap_radial_thickness=30,
         plasma_radial_thickness=300,
         outer_plasma_gap_radial_thickness=30,
         firstwall_radial_thickness=30,
         blanket_rear_wall_radial_thickness=30,
         number_of_tf_coils=16,
         support_radial_thickness=20,
         inboard_blanket_radial_thickness=20,
         outboard_blanket_radial_thickness=20,
         elongation=2.3,
         triangularity=0.45,
         rotation_angle=359,
     )
Пример #8
0
 def warning_trigger():
     try:
         paramak.SubmersionTokamak(
             inner_bore_radial_thickness=25,
             inboard_tf_leg_radial_thickness=50,
             center_column_shield_radial_thickness=50,
             inboard_blanket_radial_thickness=100,
             firstwall_radial_thickness=50,
             inner_plasma_gap_radial_thickness=70,
             plasma_radial_thickness=300,
             divertor_radial_thickness=100,
             outer_plasma_gap_radial_thickness=70,
             outboard_blanket_radial_thickness=200,
             blanket_rear_wall_radial_thickness=50,
             support_radial_thickness=150,
             plasma_high_point=(50 + 50 + 50 + 100 + 50 + 50 + 100,
                                350),
             rotation_angle=360,
         )
     except BaseException:
         pass
Пример #9
0
    def test_minimal_SubmersionTokamak_creation(self):
        """creates a submersion reactor using the SubmersionTokamak parametric
        reactor and checks that the correct number of components are created"""

        test_reactor = paramak.SubmersionTokamak(
            inner_bore_radial_thickness=25,
            inboard_tf_leg_radial_thickness=50,
            center_column_shield_radial_thickness=50,
            inboard_blanket_radial_thickness=100,
            firstwall_radial_thickness=50,
            inner_plasma_gap_radial_thickness=70,
            plasma_radial_thickness=300,
            divertor_radial_thickness=100,
            outer_plasma_gap_radial_thickness=70,
            outboard_blanket_radial_thickness=200,
            blanket_rear_wall_radial_thickness=50,
            support_radial_thickness=150,
            plasma_high_point=(50 + 50 + 50 + 100 + 50 + 50 + 100, 350),
            rotation_angle=359,
        )

        assert len(test_reactor.shapes_and_components) == 8
Пример #10
0
def make_submersion(outputs=['stp', 'neutronics', 'svg', 'stl', 'html']):

    my_reactor = paramak.SubmersionTokamak(
        inner_bore_radial_thickness=30,
        inboard_tf_leg_radial_thickness=30,
        center_column_shield_radial_thickness=30,
        divertor_radial_thickness=80,
        inner_plasma_gap_radial_thickness=50,
        plasma_radial_thickness=200,
        outer_plasma_gap_radial_thickness=50,
        firstwall_radial_thickness=30,
        blanket_rear_wall_radial_thickness=30,
        number_of_tf_coils=16,
        rotation_angle=180,
        support_radial_thickness=90,
        inboard_blanket_radial_thickness=30,
        outboard_blanket_radial_thickness=30,
        elongation=2.00,
        triangularity=0.50,
        pf_coil_radial_thicknesses=[30, 30, 30, 30],
        pf_coil_vertical_thicknesses=[30, 30, 30, 30],
        pf_coil_to_tf_coil_radial_gap=50,
        outboard_tf_coil_radial_thickness=30,
        outboard_tf_coil_poloidal_thickness=30,
        tf_coil_to_rear_blanket_radial_gap=20,
    )

    if 'stp' in outputs:
        my_reactor.export_stp(output_folder='SubmersionTokamak')
    if 'neutronics' in outputs:
        my_reactor.export_neutronics_description(
            'SubmersionTokamak/manifest.json')
    if 'svg' in outputs:
        my_reactor.export_svg('SubmersionTokamak/reactor.svg')
    if 'stl' in outputs:
        my_reactor.export_stl(output_folder='SubmersionTokamak')
    if 'html' in outputs:
        my_reactor.export_html('SubmersionTokamak/reactor.html')
Пример #11
0
def main():

    all_reactors = []

    my_reactor = paramak.BallReactor(
        inner_bore_radial_thickness=50,
        inboard_tf_leg_radial_thickness=50,
        center_column_shield_radial_thickness=50,
        divertor_radial_thickness=100,
        inner_plasma_gap_radial_thickness=50,
        plasma_radial_thickness=200,
        outer_plasma_gap_radial_thickness=50,
        firstwall_radial_thickness=50,
        blanket_radial_thickness=100,
        blanket_rear_wall_radial_thickness=50,
        elongation=2,
        triangularity=0.55,
        number_of_tf_coils=16,
        rotation_angle=180,
    )
    my_reactor.name = "BallReactor"
    all_reactors.append(my_reactor)

    my_reactor = paramak.BallReactor(
        inner_bore_radial_thickness=50,
        inboard_tf_leg_radial_thickness=50,
        center_column_shield_radial_thickness=50,
        divertor_radial_thickness=100,
        inner_plasma_gap_radial_thickness=50,
        plasma_radial_thickness=200,
        outer_plasma_gap_radial_thickness=50,
        firstwall_radial_thickness=50,
        blanket_radial_thickness=100,
        blanket_rear_wall_radial_thickness=50,
        elongation=2,
        triangularity=0.55,
        number_of_tf_coils=16,
        rotation_angle=180,
        pf_coil_radial_thicknesses=[50, 50, 50, 50],
        pf_coil_vertical_thicknesses=[50, 50, 50, 50],
        pf_coil_to_rear_blanket_radial_gap=50,
        pf_coil_to_tf_coil_radial_gap=50,
        outboard_tf_coil_radial_thickness=100,
        outboard_tf_coil_poloidal_thickness=50,
    )
    my_reactor.name = "BallReactor_with_pf_tf_coils"
    all_reactors.append(my_reactor)

    my_reactor = paramak.SingleNullBallReactor(
        inner_bore_radial_thickness=50,
        inboard_tf_leg_radial_thickness=50,
        center_column_shield_radial_thickness=50,
        divertor_radial_thickness=100,
        inner_plasma_gap_radial_thickness=50,
        plasma_radial_thickness=200,
        outer_plasma_gap_radial_thickness=50,
        firstwall_radial_thickness=50,
        blanket_radial_thickness=100,
        blanket_rear_wall_radial_thickness=50,
        elongation=2,
        triangularity=0.55,
        number_of_tf_coils=16,
        rotation_angle=180,
        pf_coil_radial_thicknesses=[50, 50, 50, 50],
        pf_coil_vertical_thicknesses=[50, 50, 50, 50],
        pf_coil_to_rear_blanket_radial_gap=50,
        pf_coil_to_tf_coil_radial_gap=50,
        outboard_tf_coil_radial_thickness=100,
        outboard_tf_coil_poloidal_thickness=50,
        divertor_position="lower")

    my_reactor.name = "SingleNullBallReactor_with_pf_tf_coils"
    all_reactors.append(my_reactor)

    my_reactor = paramak.SubmersionTokamak(
        inner_bore_radial_thickness=25,
        inboard_tf_leg_radial_thickness=50,
        center_column_shield_radial_thickness=50,
        inboard_blanket_radial_thickness=50,
        firstwall_radial_thickness=50,
        inner_plasma_gap_radial_thickness=70,
        plasma_radial_thickness=300,
        outer_plasma_gap_radial_thickness=70,
        outboard_blanket_radial_thickness=200,
        blanket_rear_wall_radial_thickness=50,
        divertor_radial_thickness=50,
        plasma_high_point=(50 + 50 + 50 + 100 + 100, 350),
        rotation_angle=180,
        support_radial_thickness=150,
        outboard_tf_coil_radial_thickness=50,
    )

    my_reactor.name = "SubmersionTokamak"
    all_reactors.append(my_reactor)

    my_reactor = paramak.SubmersionTokamak(
        inner_bore_radial_thickness=25,
        inboard_tf_leg_radial_thickness=50,
        center_column_shield_radial_thickness=50,
        inboard_blanket_radial_thickness=50,
        firstwall_radial_thickness=50,
        inner_plasma_gap_radial_thickness=70,
        plasma_radial_thickness=300,
        outer_plasma_gap_radial_thickness=70,
        outboard_blanket_radial_thickness=200,
        blanket_rear_wall_radial_thickness=50,
        divertor_radial_thickness=50,
        plasma_high_point=(50 + 50 + 50 + 100 + 100, 350),
        rotation_angle=180,
        support_radial_thickness=150,
        outboard_tf_coil_radial_thickness=50,
        tf_coil_to_rear_blanket_radial_gap=50,
        outboard_tf_coil_poloidal_thickness=70,
        pf_coil_vertical_thicknesses=[50, 50, 50, 50, 50],
        pf_coil_radial_thicknesses=[40, 40, 40, 40, 40],
        pf_coil_to_tf_coil_radial_gap=50,
        number_of_tf_coils=16,
    )

    my_reactor.name = "SubmersionTokamak_with_pf_tf_coils"
    all_reactors.append(my_reactor)

    my_reactor = paramak.SingleNullSubmersionTokamak(
        inner_bore_radial_thickness=10,
        inboard_tf_leg_radial_thickness=30,
        center_column_shield_radial_thickness=60,
        divertor_radial_thickness=50,
        inner_plasma_gap_radial_thickness=30,
        plasma_radial_thickness=300,
        outer_plasma_gap_radial_thickness=30,
        firstwall_radial_thickness=30,
        blanket_rear_wall_radial_thickness=30,
        number_of_tf_coils=16,
        rotation_angle=180,
        support_radial_thickness=20,
        inboard_blanket_radial_thickness=20,
        outboard_blanket_radial_thickness=20,
        plasma_high_point=(200, 200),
        divertor_position="upper",
        support_position="upper")

    my_reactor.name = "SingleNullSubmersionTokamak"
    all_reactors.append(my_reactor)

    my_reactor = paramak.SingleNullSubmersionTokamak(
        inner_bore_radial_thickness=10,
        inboard_tf_leg_radial_thickness=30,
        center_column_shield_radial_thickness=60,
        divertor_radial_thickness=50,
        inner_plasma_gap_radial_thickness=30,
        plasma_radial_thickness=300,
        outer_plasma_gap_radial_thickness=30,
        firstwall_radial_thickness=30,
        blanket_rear_wall_radial_thickness=30,
        number_of_tf_coils=16,
        rotation_angle=180,
        support_radial_thickness=20,
        inboard_blanket_radial_thickness=20,
        outboard_blanket_radial_thickness=20,
        plasma_high_point=(200, 200),
        pf_coil_radial_thicknesses=[50, 50, 50, 50],
        pf_coil_vertical_thicknesses=[50, 50, 50, 50],
        pf_coil_to_tf_coil_radial_gap=50,
        outboard_tf_coil_radial_thickness=100,
        outboard_tf_coil_poloidal_thickness=50,
        tf_coil_to_rear_blanket_radial_gap=20,
        divertor_position="upper",
        support_position="upper")

    my_reactor.name = "SingleNullSubmersionTokamak_with_pf_tf_coils"
    all_reactors.append(my_reactor)

    return all_reactors