コード例 #1
0
ファイル: test.py プロジェクト: MauriDeb/Desarrollo_OpenMC
def test_mg_max_order():
    create_library()
    model = slab_mg()
    model.settings.max_order = 1

    harness = PyAPITestHarness('statepoint.10.h5', model)
    harness.main()
コード例 #2
0
def test_mg_survival_biasing():
    create_library()
    model = slab_mg()
    model.settings.survival_biasing = True

    harness = PyAPITestHarness('statepoint.10.h5', model)
    harness.main()
コード例 #3
0
def test_mg_basic_delayed():
    create_library()
    model = slab_mg(num_regions=6,
                    mat_names=[
                        'vec beta', 'vec no beta', 'matrix beta',
                        'matrix no beta', 'vec group beta', 'matrix group beta'
                    ])

    harness = PyAPITestHarness('statepoint.10.h5', model)
    harness.main()
コード例 #4
0
def test_mg_basic():
    create_library()
    mat_names = [
        'base leg', 'base tab', 'base hist', 'base matrix', 'base ang', 'micro'
    ]
    model = slab_mg(num_regions=6, mat_names=mat_names)
    # Modify the last material to be a microscopic combination of nuclides
    model.materials[-1] = openmc.Material(name='micro', material_id=6)
    model.materials[-1].set_density("sum")
    model.materials[-1].add_nuclide("mat_1", 0.5)
    model.materials[-1].add_nuclide("mat_6", 0.5)

    harness = PyAPITestHarness('statepoint.10.h5', model)
    harness.main()
コード例 #5
0
#!/usr/bin/env python

import os
import sys
sys.path.insert(0, os.pardir)
from testing_harness import PyAPITestHarness
from openmc.examples import slab_mg

if __name__ == '__main__':
    model = slab_mg()
    model.settings.survival_biasing = True
    harness = PyAPITestHarness('statepoint.10.h5', model)
    harness.main()
コード例 #6
0
#!/usr/bin/env python

import os
import sys
sys.path.insert(0, os.pardir)
from testing_harness import PyAPITestHarness
from openmc.examples import slab_mg


if __name__ == '__main__':
    model = slab_mg()
    model.settings.survival_biasing = True
    harness = PyAPITestHarness('statepoint.10.h5', model)
    harness.main()
コード例 #7
0
ファイル: test_mg_tallies.py プロジェクト: zzdbirdsfly/openmc
#!/usr/bin/env python

import os
import sys
sys.path.insert(0, os.pardir)
from testing_harness import HashedPyAPITestHarness
import openmc
from openmc.examples import slab_mg


if __name__ == '__main__':
    model = slab_mg(as_macro=False)

    # Instantiate a tally mesh
    mesh = openmc.Mesh(mesh_id=1)
    mesh.type = 'regular'
    mesh.dimension = [1, 1, 10]
    mesh.lower_left = [0.0, 0.0, 0.0]
    mesh.upper_right = [10, 10, 5]

    # Instantiate some tally filters
    energy_filter = openmc.EnergyFilter([0.0, 20.0e6])
    energyout_filter = openmc.EnergyoutFilter([0.0, 20.0e6])
    energies = [1e-5, 0.0635, 10.0, 1.0e2, 1.0e3, 0.5e6, 1.0e6, 20.0e6]
    matching_energy_filter = openmc.EnergyFilter(energies)
    matching_eout_filter = openmc.EnergyoutFilter(energies)
    mesh_filter = openmc.MeshFilter(mesh)

    mat_filter = openmc.MaterialFilter(model.materials)

    nuclides = model.xs_data
コード例 #8
0
#!/usr/bin/env python

import os
import sys

sys.path.insert(0, os.pardir)
from testing_harness import PyAPITestHarness
from openmc.examples import slab_mg

if __name__ == '__main__':
    model = slab_mg(reps=['iso'])
    model.settings.tabular_legendre = {'enable': False}

    harness = PyAPITestHarness('statepoint.10.h5', model)
    harness.main()
コード例 #9
0
ファイル: test_mg_max_order.py プロジェクト: biegelk/openmc
#!/usr/bin/env python

import os
import sys

sys.path.insert(0, os.pardir)
from testing_harness import PyAPITestHarness
from openmc.examples import slab_mg


if __name__ == '__main__':
    model = slab_mg(reps=['iso'])
    model.settings.max_order = 1
    harness = PyAPITestHarness('statepoint.10.h5', model)
    harness.main()
コード例 #10
0
def test_mg_tallies():
    create_library()
    model = slab_mg()

    # Instantiate a tally mesh
    mesh = openmc.RegularMesh(mesh_id=1)
    mesh.dimension = [10, 1, 1]
    mesh.lower_left = [0.0, 0.0, 0.0]
    mesh.upper_right = [929.45, 1000, 1000]

    # Instantiate some tally filters
    energy_filter = openmc.EnergyFilter([0.0, 20.0e6])
    energyout_filter = openmc.EnergyoutFilter([0.0, 20.0e6])
    energies = [0.0, 0.625, 20.0e6]
    matching_energy_filter = openmc.EnergyFilter(energies)
    matching_eout_filter = openmc.EnergyoutFilter(energies)
    mesh_filter = openmc.MeshFilter(mesh)

    mat_filter = openmc.MaterialFilter(model.materials)

    nuclides = model.xs_data

    scores_with_nuclides = [
        'total', 'absorption', 'fission', 'nu-fission', 'inverse-velocity',
        'prompt-nu-fission', 'delayed-nu-fission', 'kappa-fission', 'events',
        'decay-rate'
    ]
    scores_without_nuclides = scores_with_nuclides + ['flux']

    for do_nuclides, scores in ((False, scores_without_nuclides),
                                (True, scores_with_nuclides)):
        t = openmc.Tally()
        t.filters = [mesh_filter]
        t.estimator = 'analog'
        t.scores = scores
        if do_nuclides:
            t.nuclides = nuclides
        model.tallies.append(t)

        t = openmc.Tally()
        t.filters = [mesh_filter]
        t.estimator = 'tracklength'
        t.scores = scores
        if do_nuclides:
            t.nuclides = nuclides
        model.tallies.append(t)

        # Impose energy bins that dont match the MG structure and those
        # that do
        for match_energy_bins in [False, True]:
            if match_energy_bins:
                e_filter = matching_energy_filter
                eout_filter = matching_eout_filter
            else:
                e_filter = energy_filter
                eout_filter = energyout_filter

            t = openmc.Tally()
            t.filters = [mat_filter, e_filter]
            t.estimator = 'analog'
            t.scores = scores + ['scatter', 'nu-scatter']
            if do_nuclides:
                t.nuclides = nuclides
            model.tallies.append(t)

            t = openmc.Tally()
            t.filters = [mat_filter, e_filter]
            t.estimator = 'collision'
            t.scores = scores
            if do_nuclides:
                t.nuclides = nuclides
            model.tallies.append(t)

            t = openmc.Tally()
            t.filters = [mat_filter, e_filter]
            t.estimator = 'tracklength'
            t.scores = scores
            if do_nuclides:
                t.nuclides = nuclides
            model.tallies.append(t)

            t = openmc.Tally()
            t.filters = [mat_filter, e_filter, eout_filter]
            t.scores = ['scatter', 'nu-scatter', 'nu-fission']
            if do_nuclides:
                t.nuclides = nuclides
            model.tallies.append(t)

    harness = MGXSTestHarness('statepoint.10.h5', model)
    harness.main()