コード例 #1
0
 def incorrect_simulation_batches_to_small():
     """Sets simulation batch below 2 which should raise an error"""
     paramak.NeutronicsModel(
         geometry=self.my_shape,
         source=self.source,
         materials={'center_column_shield_mat': 'eurofer'},
         simulation_batches=1)
コード例 #2
0
 def incorrect_merge_tolerance_too_small():
     """Set merge_tolerance as a negative number which should raise an error"""
     paramak.NeutronicsModel(
         geometry=self.my_shape,
         source=self.source,
         materials={'center_column_shield_mat': 'eurofer'},
         merge_tolerance=-3)
コード例 #3
0
 def incorrect_simulation_particles_per_batch_wrong_type():
     """Sets simulation_particles_per_batch below 2 which should raise an error"""
     paramak.NeutronicsModel(
         geometry=self.my_shape,
         source=self.source,
         materials={'center_column_shield_mat': 'eurofer'},
         simulation_particles_per_batch='one')
コード例 #4
0
 def incorrect_merge_tolerance():
     """Set merge_tolerance as a string which should raise an error"""
     paramak.NeutronicsModel(
         geometry=self.my_shape,
         source=self.source,
         materials={'center_column_shield_mat': 'eurofer'},
         merge_tolerance='coucou')
コード例 #5
0
    def test_neutronics_component_3d_and_2d_mesh_simulation(self):
        """Makes a neutronics model and simulates with a 3D and 2D mesh tally
        and checks that the vtk and png files are produced. This checks the
        mesh ID values don't overlap"""

        os.system('rm *.h5')

        # converts the geometry into a neutronics geometry
        my_model = paramak.NeutronicsModel(
            geometry=self.my_shape,
            source=self.source,
            materials={'center_column_shield_mat': 'Be'},
            mesh_tally_3d=['heating'],
            mesh_tally_2d=['heating'],
            simulation_batches=2,
            simulation_particles_per_batch=2
        )

        # performs an openmc simulation on the model
        output_filename = my_model.simulate(method='pymoab')
        results = openmc.StatePoint(output_filename)
        assert len(results.meshes) == 4  # one 3D and three 2D
        assert len(results.tallies.items()) == 4  # one 3D and three 2D

        assert Path(output_filename).exists() is True
        assert Path('heating_on_3D_mesh.vtk').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
コード例 #6
0
    def test_neutronics_component_2d_mesh_simulation(self):
        """Makes a neutronics model and simulates with a 2D mesh tally"""

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

        # converts the geometry into a neutronics geometry
        my_model = paramak.NeutronicsModel(
            geometry=self.my_shape,
            source=self.source,
            materials={'center_column_shield_mat': 'Be'},
            mesh_tally_2d=['heating'],
            simulation_batches=2,
            simulation_particles_per_batch=2
        )

        # performs an openmc simulation on the model
        output_filename = my_model.simulate(method='pymoab')

        results = openmc.StatePoint(output_filename)
        assert len(results.meshes) == 3
        assert len(results.tallies.items()) == 3

        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
コード例 #7
0
    def test_cell_tally_output_file_creation(self):
        """Performs a neutronics simulation and checks the cell tally output
        file is created and named correctly"""

        os.system('rm custom_name.json')
        os.system('rm results.json')

        test_mat = openmc.Material()
        test_mat.add_element('Fe', 1.0)
        test_mat.set_density(units='g/cm3', density=4.2)

        # converts the geometry into a neutronics geometry
        # this simulation has no tally to test this edge case
        my_model = paramak.NeutronicsModel(
            geometry=self.my_shape,
            source=self.source,
            materials={'center_column_shield_mat': test_mat},
            simulation_batches=2,
            simulation_particles_per_batch=2
        )

        # performs an openmc simulation on the model
        output_filename = my_model.simulate(
            method='pymoab',
            cell_tally_results_filename='custom_name.json'
        )

        assert output_filename.name == 'statepoint.2.h5'
        assert Path('custom_name.json').exists() is True

        output_filename = my_model.simulate(
            method='pymoab',
        )
        assert Path('results.json').exists() is True
コード例 #8
0
def main():
    my_shape = paramak.CenterColumnShieldHyperbola(
        height=500,
        inner_radius=50,
        mid_radius=60,
        outer_radius=100,
        material_tag='center_column_shield_mat')

    # makes the openmc neutron source at x,y,z 0, 0, 0 with isotropic
    # directions
    source = openmc.Source()
    source.space = openmc.stats.Point((0, 0, 0))
    source.energy = openmc.stats.Discrete([14e6], [1])
    source.angle = openmc.stats.Isotropic()

    # converts the geometry into a neutronics geometry
    my_model = paramak.NeutronicsModel(
        geometry=my_shape,
        source=source,
        materials={'center_column_shield_mat': 'Be'},
        cell_tallies=['(n,Xa)', '(n,Xt)', '(n,Xp)'],
        mesh_tally_3d=['(n,Xa)', '(n,Xt)', '(n,Xp)'],
        mesh_tally_2d=['(n,Xa)', '(n,Xt)', '(n,Xp)'],
        simulation_batches=10,
        simulation_particles_per_batch=200)

    # performs an openmc simulation on the model
    my_model.simulate(method='pymoab')

    # this extracts the values from the results dictionary
    print(my_model.results)
コード例 #9
0
 def incorrect_materials():
     """Set a material as a string which should raise an error"""
     paramak.NeutronicsModel(
         geometry=self.my_shape,
         source=self.source,
         materials='coucou',
     )
コード例 #10
0
    def test_neutronics_component_simulation_with_openmc_mat(self):
        """Makes a neutronics model and simulates with a cell tally"""

        test_mat = openmc.Material()
        test_mat.add_element('Fe', 1.0)
        test_mat.set_density(units='g/cm3', density=4.2)

        # converts the geometry into a neutronics geometry
        my_model = paramak.NeutronicsModel(
            geometry=self.my_shape,
            source=self.source,
            materials={'center_column_shield_mat': test_mat},
            cell_tallies=['heating'],
            simulation_batches=2,
            simulation_particles_per_batch=2
        )

        # performs an openmc simulation on the model
        output_filename = my_model.simulate(
            method='pymoab',
        )

        assert output_filename.name == 'statepoint.2.h5'

        results = openmc.StatePoint(output_filename)
        assert len(results.tallies.items()) == 1

        # extracts the heat from the results dictionary
        heat = my_model.results['center_column_shield_mat_heating']['Watts']['result']
        assert heat > 0
コード例 #11
0
    def test_neutronics_component_3d_mesh_simulation(self):
        """Makes a neutronics model and simulates with a 3D mesh tally and
        checks that the vtk file is produced"""

        os.system('rm *.h5')

        # converts the geometry into a neutronics geometry
        my_model = paramak.NeutronicsModel(
            geometry=self.my_shape,
            source=self.source,
            materials={'center_column_shield_mat': 'Be'},
            mesh_tally_3d=['heating', '(n,Xt)'],
            simulation_batches=2,
            simulation_particles_per_batch=2
        )

        # performs an openmc simulation on the model
        output_filename = my_model.simulate(method='pymoab')

        results = openmc.StatePoint(output_filename)
        assert len(results.meshes) == 1
        assert len(results.tallies.items()) == 2

        assert Path(output_filename).exists() is True
        assert Path('heating_on_3D_mesh.vtk').exists() is True
        assert Path('n-Xt_on_3D_mesh.vtk').exists() is True
コード例 #12
0
    def test_reactor_from_shapes_cell_tallies(self):
        """Makes a reactor from two shapes, then mades a neutronics model
        and tests the TBR simulation value"""

        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
            },
            cell_tallies=['TBR', 'heating', 'flux'],
            simulation_batches=2,
            simulation_particles_per_batch=10,
        )

        # starts the neutronics simulation using trelis
        neutronics_model.simulate(verbose=False, method='pymoab')
コード例 #13
0
 def incorrect_mesh_tally_3d_type():
     """Set a mesh_tally_3d that is the wrong type which should raise an error"""
     paramak.NeutronicsModel(
         geometry=self.my_shape,
         source=self.source,
         materials={'center_column_shield_mat': 'eurofer'},
         mesh_tally_3d=1,
     )
コード例 #14
0
 def incorrect_mesh_tally_3d():
     """Set a mesh_tally_3d that is not accepted which should raise an error"""
     paramak.NeutronicsModel(
         geometry=self.my_shape,
         source=self.source,
         materials={'center_column_shield_mat': 'eurofer'},
         mesh_tally_3d=['coucou'],
     )
コード例 #15
0
        def incorrect_materials_type():
            """Sets a material as an int which should raise an error"""
            test_model = paramak.NeutronicsModel(
                geometry=self.my_shape,
                source=self.source,
                materials={'center_column_shield_mat': 23},
            )

            test_model.create_materials()
コード例 #16
0
        def missing_dagmc_not_watertight_file():
            """Sets faceting_tolerance as a string which should raise an error"""
            test_model = paramak.NeutronicsModel(
                geometry=self.my_shape,
                source=self.source,
                materials={'center_column_shield_mat': 'eurofer'},
            )

            test_model._make_watertight()
コード例 #17
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']
コード例 #18
0
def make_model_and_simulate():
    simulation_values = []
    for mid_radius in [60, 70, 80]:

        # makes the component with a few different size mid radius values
        my_shape = paramak.CenterColumnShieldHyperbola(
            height=500,
            inner_radius=50,
            mid_radius=mid_radius,
            outer_radius=100,
            material_tag='center_column_shield_mat'
        )

        my_shape.export_stp('my_shape' + str(mid_radius) + '.stp')

        # makes the openmc neutron source at x,y,z 0, 0, 0 with isotropic
        # diections
        source = openmc.Source()
        source.space = openmc.stats.Point((0, 0, 0))
        source.angle = openmc.stats.Isotropic()

        # converts the geometry into a neutronics geometry
        my_model = paramak.NeutronicsModel(
            geometry=my_shape,
            source=source,
            materials={'center_column_shield_mat': 'eurofer'},
            cell_tallies=['heating', 'TBR'],
            mesh_tally_2d=['heating'],
            mesh_tally_3d=['heating'],
            simulation_batches=10,  # should be increased for more accurate result
            simulation_particles_per_batch=10  # settings are low to reduce time required
        )

        # performs an openmc simulation on the model
        my_model.simulate(method='pymoab')

        # extracts the heat from the results dictionary
        heat = my_model.results['center_column_shield_mat_heating']['Watts']['result']

        # adds the heat and the mid radius value to a list
        simulation_values.append((mid_radius, heat))

    # plots the simualtion results vs the mid_radius used for the simulation
    plt.plot(
        [i[0] for i in simulation_values],
        [i[1] for i in simulation_values],
        '-p'
    )

    # adds labels to the graph
    plt.title("heating vs thickness")
    plt.xlabel("thickness (cm)")
    plt.ylabel("heating (watts)")

    plt.savefig('heating_vs_thickness.svg')
    plt.show()
コード例 #19
0
    def test_merge_tolerance_setting_and_getting(self):
        """Makes a neutronics model and checks the default merge_tolerance"""

        # converts the geometry into a neutronics geometry
        my_model = paramak.NeutronicsModel(
            geometry=self.my_shape,
            source=self.source,
            materials={'center_column_shield_mat': 'eurofer'},
        )

        assert my_model.merge_tolerance == 1e-4

        my_model.merge_tolerance = 1e-6
        assert my_model.merge_tolerance == 1e-6
コード例 #20
0
    def test_neutronics_component_cell_simulation_heating(self):
        """Makes a neutronics model and simulates with a cell tally"""

        os.system('rm *.h5')
        mat = openmc.Material()
        mat.add_element('Li', 1)
        mat.set_density('g/cm3', 2.1)

        # converts the geometry into a neutronics geometry
        my_model = paramak.NeutronicsModel(
            geometry=self.my_shape,
            source=self.source,
            materials={'center_column_shield_mat': mat},
            cell_tallies=['heating', 'flux', 'TBR', 'spectra'],
            simulation_batches=2,
            simulation_particles_per_batch=2)

        # performs an openmc simulation on the model
        output_filename = my_model.simulate(method='pymoab')

        results = openmc.StatePoint(output_filename)
        # spectra add two tallies in this case (photons and neutrons)
        # TBR adds two tallies global TBR and material TBR
        assert len(results.tallies.items()) == 6
        assert len(results.meshes) == 0

        # extracts the heat from the results dictionary
        heat = my_model.results['center_column_shield_mat_heating']['Watts'][
            'result']
        flux = my_model.results['center_column_shield_mat_flux'][
            'Flux per source particle']['result']
        mat_tbr = my_model.results['center_column_shield_mat_TBR']['result']
        tbr = my_model.results['TBR']['result']
        spectra_neutrons = my_model.results[
            'center_column_shield_mat_neutron_spectra'][
                'Flux per source particle']['result']
        spectra_photons = my_model.results[
            'center_column_shield_mat_photon_spectra'][
                'Flux per source particle']['result']
        energy = my_model.results['center_column_shield_mat_photon_spectra'][
            'Flux per source particle']['energy']

        assert heat > 0
        assert flux > 0
        assert tbr > 0
        assert mat_tbr > 0
        assert mat_tbr == tbr  # as there is just one shape
        assert len(energy) == 710
        assert len(spectra_neutrons) == 709
        assert len(spectra_photons) == 709
コード例 #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_model_and_simulate():
    """Makes a neutronics Reactor model and simulates the heat deposition"""

    # makes the 3d geometry
    my_reactor = paramak.CenterColumnStudyReactor(
        inner_bore_radial_thickness=20,
        inboard_tf_leg_radial_thickness=50,
        center_column_shield_radial_thickness_mid=50,
        center_column_shield_radial_thickness_upper=100,
        inboard_firstwall_radial_thickness=20,
        divertor_radial_thickness=100,
        inner_plasma_gap_radial_thickness=80,
        plasma_radial_thickness=200,
        outer_plasma_gap_radial_thickness=90,
        elongation=2.75,
        triangularity=0.5,
        plasma_gap_vertical_thickness=40,
        center_column_arc_vertical_thickness=520,
        rotation_angle=360)

    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])

    # creates a neutronics model from the geometry and assigned materials
    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_mat': 'Li4SiO4'
        },
        cell_tallies=['heating'],
        simulation_batches=5,
        simulation_particles_per_batch=1e4,
    )

    # starts the neutronics simulation
    neutronics_model.simulate(method='trelis')

    # prints the results
    print(neutronics_model.results)
コード例 #23
0
    def simulation_with_previous_h5m_file(self):
        """This performs a simulation using previously created h5m file"""

        os.system('rm *.h5m')

        my_model = paramak.NeutronicsModel(
            geometry=self.my_shape,
            source=self.source,
            materials={'center_column_shield_mat': 'WC'},
        )

        my_model.create_neutronics_geometry(method='pymoab')

        my_model.simulate(method=None)

        my_model.results is not None
コード例 #24
0
    def test_batches_and_particles_convert_to_int(self):
        """Makes a neutronics model and simulates with a 3D and 2D mesh tally
        and checks that the vtk and png files are produced. This checks the
        mesh ID values don't overlap"""

        os.system('rm *.h5')

        # converts the geometry into a neutronics geometry
        my_model = paramak.NeutronicsModel(
            geometry=self.my_shape,
            source=self.source,
            materials={'center_column_shield_mat': 'Be'},
            simulation_batches=3.1,
            simulation_particles_per_batch=2.1)

        assert isinstance(my_model.simulation_batches, int)
        assert my_model.simulation_batches == 3
        assert isinstance(my_model.simulation_particles_per_batch, int)
        assert my_model.simulation_particles_per_batch == 2
コード例 #25
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
コード例 #26
0
        def test_incorrect_method():
            """Makes a BallReactor neutronics model and simulates the TBR"""

            # makes the neutronics material
            neutronics_model = paramak.NeutronicsModel(
                geometry=self.my_reactor,
                source=self.source,
                materials={
                    'inboard_tf_coils_mat': 'copper',
                    'center_column_shield_mat': 'WC',
                    'divertor_mat': 'eurofer',
                    'firstwall_mat': 'eurofer',
                    'blanket_mat': 'FLiNaK',  # used as O18 is not in nndc nuc data
                    'blanket_rear_wall_mat': 'eurofer'},
                cell_tallies=['TBR', 'flux', 'heating'],
                simulation_batches=42,
                simulation_particles_per_batch=84,
            )

            neutronics_model.create_neutronics_geometry(method='incorrect')
コード例 #27
0
    def test_neutronics_model_attributes(self):
        """Makes a BallReactor neutronics model and simulates the TBR"""

        # makes the neutronics material
        neutronics_model = paramak.NeutronicsModel(
            geometry=self.my_reactor,
            source=openmc.Source(),
            materials={
                'inboard_tf_coils_mat': 'copper',
                'center_column_shield_mat': 'WC',
                'divertor_mat': 'eurofer',
                'firstwall_mat': 'eurofer',
                'blanket_mat':
                self.blanket_material,  # use of homogenised material
                'blanket_rear_wall_mat': 'eurofer'
            },
            cell_tallies=['TBR', 'flux', 'heating'],
            simulation_batches=42,
            simulation_particles_per_batch=84,
        )

        assert neutronics_model.geometry == self.my_reactor

        assert neutronics_model.materials == {
            'inboard_tf_coils_mat': 'copper',
            'center_column_shield_mat': 'WC',
            'divertor_mat': 'eurofer',
            'firstwall_mat': 'eurofer',
            'blanket_mat': self.blanket_material,
            'blanket_rear_wall_mat': 'eurofer'
        }

        assert neutronics_model.cell_tallies == ['TBR', 'flux', 'heating']

        assert neutronics_model.simulation_batches == 42
        assert isinstance(neutronics_model.simulation_batches, int)

        assert neutronics_model.simulation_particles_per_batch == 84
        assert isinstance(neutronics_model.simulation_particles_per_batch, int)
コード例 #28
0
    def test_neutronics_component_simulation_with_nmm(self):
        """Makes a neutronics model and simulates with a cell tally"""

        test_mat = nmm.Material('Be')

        # converts the geometry into a neutronics geometry
        my_model = paramak.NeutronicsModel(
            geometry=self.my_shape,
            source=self.source,
            materials={'center_column_shield_mat': test_mat},
            cell_tallies=['heating'],
            simulation_batches=2,
            simulation_particles_per_batch=2
        )

        # performs an openmc simulation on the model
        output_filename = my_model.simulate(method='pymoab')

        results = openmc.StatePoint(output_filename)
        assert len(results.tallies.items()) == 1

        # extracts the heat from the results dictionary
        heat = my_model.results['center_column_shield_mat_heating']['Watts']['result']
        assert heat > 0
コード例 #29
0
def make_model_and_simulate():
    """Makes a neutronics Reactor model and simulates the TBR with specified materials"""

    # based on
    # http://www.euro-fusionscipub.org/wp-content/uploads/WPBBCP16_15535_submitted.pdf
    firstwall_radial_thickness = 3.0
    firstwall_armour_material = "tungsten"
    firstwall_coolant_material = "He"
    firstwall_structural_material = "eurofer"
    firstwall_armour_fraction = 0.106305
    firstwall_coolant_fraction = 0.333507
    firstwall_coolant_temperature_C = 400
    firstwall_coolant_pressure_Pa = 8e6
    firstwall_structural_fraction = 0.560188

    firstwall_material = nmm.MultiMaterial(
        material_tag="firstwall_mat",
        materials=[
            nmm.Material(
                material_name=firstwall_coolant_material,
                temperature_in_C=firstwall_coolant_temperature_C,
                pressure_in_Pa=firstwall_coolant_pressure_Pa,
            ),
            nmm.Material(material_name=firstwall_structural_material),
            nmm.Material(material_name=firstwall_armour_material),
        ],
        fracs=[
            firstwall_coolant_fraction,
            firstwall_structural_fraction,
            firstwall_armour_fraction,
        ],
        percent_type="vo")

    # based on
    # https://www.sciencedirect.com/science/article/pii/S2352179118300437
    blanket_rear_wall_coolant_material = "H2O"
    blanket_rear_wall_structural_material = "eurofer"
    blanket_rear_wall_coolant_fraction = 0.3
    blanket_rear_wall_structural_fraction = 0.7
    blanket_rear_wall_coolant_temperature_C = 200
    blanket_rear_wall_coolant_pressure_Pa = 1e6

    blanket_rear_wall_material = nmm.MultiMaterial(
        material_tag="blanket_rear_wall_mat",
        materials=[
            nmm.Material(
                material_name=blanket_rear_wall_coolant_material,
                temperature_in_C=blanket_rear_wall_coolant_temperature_C,
                pressure_in_Pa=blanket_rear_wall_coolant_pressure_Pa,
            ),
            nmm.Material(material_name=blanket_rear_wall_structural_material),
        ],
        fracs=[
            blanket_rear_wall_coolant_fraction,
            blanket_rear_wall_structural_fraction,
        ],
        percent_type="vo")

    # based on
    # https://www.sciencedirect.com/science/article/pii/S2352179118300437
    blanket_lithium6_enrichment_percent = 60
    blanket_breeder_material = "Li4SiO4"
    blanket_coolant_material = "He"
    blanket_multiplier_material = "Be"
    blanket_structural_material = "eurofer"
    blanket_breeder_fraction = 0.15
    blanket_coolant_fraction = 0.05
    blanket_multiplier_fraction = 0.6
    blanket_structural_fraction = 0.2
    blanket_breeder_packing_fraction = 0.64
    blanket_multiplier_packing_fraction = 0.64
    blanket_coolant_temperature_C = 500
    blanket_coolant_pressure_Pa = 1e6
    blanket_breeder_temperature_C = 600
    blanket_breeder_pressure_Pa = 8e6

    blanket_material = nmm.MultiMaterial(
        material_tag="blanket_mat",
        materials=[
            nmm.Material(
                material_name=blanket_coolant_material,
                temperature_in_C=blanket_coolant_temperature_C,
                pressure_in_Pa=blanket_coolant_pressure_Pa,
            ),
            nmm.Material(material_name=blanket_structural_material),
            nmm.Material(
                material_name=blanket_multiplier_material,
                packing_fraction=blanket_multiplier_packing_fraction,
            ),
            nmm.Material(
                material_name=blanket_breeder_material,
                enrichment=blanket_lithium6_enrichment_percent,
                packing_fraction=blanket_breeder_packing_fraction,
                temperature_in_C=blanket_breeder_temperature_C,
                pressure_in_Pa=blanket_breeder_pressure_Pa,
            ),
        ],
        fracs=[
            blanket_coolant_fraction,
            blanket_structural_fraction,
            blanket_multiplier_fraction,
            blanket_breeder_fraction,
        ],
        percent_type="vo")

    # based on
    # https://www.sciencedirect.com/science/article/pii/S2352179118300437
    divertor_coolant_fraction = 0.57195798876
    divertor_structural_fraction = 0.42804201123
    divertor_coolant_material = "H2O"
    divertor_structural_material = "tungsten"
    divertor_coolant_temperature_C = 150
    divertor_coolant_pressure_Pa = 5e6

    divertor_material = nmm.MultiMaterial(
        material_tag="divertor_mat",
        materials=[
            nmm.Material(
                material_name=divertor_coolant_material,
                temperature_in_C=divertor_coolant_temperature_C,
                pressure_in_Pa=divertor_coolant_pressure_Pa,
            ),
            nmm.Material(material_name=divertor_structural_material),
        ],
        fracs=[divertor_coolant_fraction, divertor_structural_fraction],
        percent_type="vo")

    # based on
    # https://pdfs.semanticscholar.org/95fa/4dae7d82af89adf711b97e75a241051c7129.pdf
    center_column_shield_coolant_fraction = 0.13
    center_column_shield_structural_fraction = 0.57
    center_column_shield_coolant_material = "H2O"
    center_column_shield_structural_material = "tungsten"
    center_column_shield_coolant_temperature_C = 150
    center_column_shield_coolant_pressure_Pa = 5e6

    center_column_shield_material = nmm.MultiMaterial(
        material_tag="center_column_shield_mat",
        materials=[
            nmm.Material(
                material_name=center_column_shield_coolant_material,
                temperature_in_C=center_column_shield_coolant_temperature_C,
                pressure_in_Pa=center_column_shield_coolant_pressure_Pa,
            ),
            nmm.Material(
                material_name=center_column_shield_structural_material),
        ],
        fracs=[
            center_column_shield_coolant_fraction,
            center_column_shield_structural_fraction,
        ],
        percent_type="vo")

    # based on
    # https://pdfs.semanticscholar.org/95fa/4dae7d82af89adf711b97e75a241051c7129.pdf
    inboard_tf_coils_conductor_fraction = 0.57
    inboard_tf_coils_coolant_fraction = 0.05
    inboard_tf_coils_structure_fraction = 0.38
    inboard_tf_coils_conductor_material = "copper"
    inboard_tf_coils_coolant_material = "He"
    inboard_tf_coils_structure_material = "SS_316L_N_IG"
    inboard_tf_coils_coolant_temperature_C = 30
    inboard_tf_coils_coolant_pressure_Pa = 8e6

    inboard_tf_coils_material = nmm.MultiMaterial(
        material_tag="inboard_tf_coils_mat",
        materials=[
            nmm.Material(
                material_name=inboard_tf_coils_coolant_material,
                temperature_in_C=inboard_tf_coils_coolant_temperature_C,
                pressure_in_Pa=inboard_tf_coils_coolant_pressure_Pa,
            ),
            nmm.Material(material_name=inboard_tf_coils_conductor_material),
            nmm.Material(material_name=inboard_tf_coils_structure_material),
        ],
        fracs=[
            inboard_tf_coils_coolant_fraction,
            inboard_tf_coils_conductor_fraction,
            inboard_tf_coils_structure_fraction,
        ],
        percent_type="vo")

    # makes the 3d geometry
    my_reactor = paramak.BallReactor(
        inner_bore_radial_thickness=1,
        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=firstwall_radial_thickness,
        # http://www.euro-fusionscipub.org/wp-content/uploads/WPBBCP16_15535_submitted.pdf
        blanket_radial_thickness=100,
        blanket_rear_wall_radial_thickness=3,
        elongation=2.75,
        triangularity=0.5,
        number_of_tf_coils=16,
        rotation_angle=360,
    )

    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 material
    neutronics_model = paramak.NeutronicsModel(
        geometry=my_reactor,
        source=source,
        materials={
            'inboard_tf_coils_mat': inboard_tf_coils_material,
            'center_column_shield_mat': center_column_shield_material,
            'divertor_mat': divertor_material,
            'firstwall_mat': firstwall_material,
            'blanket_mat': blanket_material,
            'blanket_rear_wall_mat': blanket_rear_wall_material
        },
        cell_tallies=['TBR'],
        simulation_batches=5,
        simulation_particles_per_batch=1e4,
    )

    # starts the neutronics simulation
    neutronics_model.simulate(method='trelis')

    # prints the simulation results to screen
    print('TBR', neutronics_model.results['TBR'])
コード例 #30
0
    inner_radius=50,
    mid_radius=60,
    outer_radius=100,
    material_tag='center_column_shield_mat')

# makes the openmc neutron source at x,y,z 0, 0, 0 with isotropic directions
source = openmc.Source()
source.space = openmc.stats.Point((0, 0, 0))
source.energy = openmc.stats.Discrete([14e6], [1])
source.angle = openmc.stats.Isotropic()

# converts the geometry into a neutronics geometry
my_model = paramak.NeutronicsModel(
    geometry=my_shape,
    source=source,
    materials={'center_column_shield_mat': 'Be'},
    cell_tallies=['heating', 'flux', 'TBR', 'spectra'],
    simulation_batches=10,
    simulation_particles_per_batch=200)

# performs an openmc simulation on the model
output_filename = my_model.simulate(method='pymoab')

# this extracts the values from the results dictionary
energy_bins = my_model.results['center_column_shield_mat_photon_spectra'][
    'Flux per source particle']['energy']
neutron_spectra = my_model.results['center_column_shield_mat_neutron_spectra'][
    'Flux per source particle']['result']
photon_spectra = my_model.results['center_column_shield_mat_photon_spectra'][
    'Flux per source particle']['result']