mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-25 20:45:35 -04:00
Replacing old slab_mg example model with new one that uses a library that follows the library standard. Also had to update tests accordingly.
This commit is contained in:
parent
c7fa8c05ce
commit
c1652bbdec
25 changed files with 359 additions and 675 deletions
|
|
@ -1,3 +1,5 @@
|
|||
from numbers import Integral
|
||||
|
||||
import numpy as np
|
||||
|
||||
import openmc
|
||||
|
|
@ -538,20 +540,20 @@ def pwr_assembly():
|
|||
return model
|
||||
|
||||
|
||||
def slab_mg(reps=None, as_macro=True):
|
||||
"""Create a one-group, 1D slab model.
|
||||
def slab_mg(num_regions=1, mat_names=None, mgxslib_name='2g.h5'):
|
||||
"""Create a 1D slab model.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
reps : list, optional
|
||||
List of angular representations. Each item corresponds to materials and
|
||||
dictates the angular representation of the multi-group cross
|
||||
sections---isotropic ('iso') or angle-dependent ('ang'), and if Legendre
|
||||
scattering or tabular scattering ('mu') is used. Thus, items can be
|
||||
'ang', 'ang_mu', 'iso', or 'iso_mu'.
|
||||
num_regions : int, optional
|
||||
Number of regions in the problem, each with a unique MGXS dataset.
|
||||
Defaults to 1.
|
||||
|
||||
as_macro : bool, optional
|
||||
Whether :class:`openmc.Macroscopic` is used
|
||||
mat_names : Iterable of str, optional
|
||||
List of the material names to use; defaults to ['mat_1', 'mat_2',...].
|
||||
|
||||
mgxslib_name : str, optional
|
||||
MGXS Library file to use; defaults to '2g.h5'.
|
||||
|
||||
Returns
|
||||
-------
|
||||
|
|
@ -559,71 +561,82 @@ def slab_mg(reps=None, as_macro=True):
|
|||
One-group, 1D slab model
|
||||
|
||||
"""
|
||||
|
||||
openmc.check_type('num_regions', num_regions, Integral)
|
||||
openmc.check_greater_than('num_regions', num_regions, 0)
|
||||
if mat_names is not None:
|
||||
openmc.check_length('mat_names', mat_names, num_regions)
|
||||
openmc.check_iterable_type('mat_names', mat_names, str)
|
||||
else:
|
||||
mat_names = []
|
||||
for i in range(num_regions):
|
||||
mat_names.append('mat_' + str(i + 1))
|
||||
|
||||
# # Make Materials
|
||||
materials_file = openmc.Materials()
|
||||
macros = []
|
||||
mats = []
|
||||
for i in range(len(mat_names)):
|
||||
macros.append(openmc.Macroscopic('mat_' + str(i + 1)))
|
||||
mats.append(openmc.Material(name=mat_names[i]))
|
||||
mats[-1].set_density('macro', 1.0)
|
||||
mats[-1].add_macroscopic(macros[-1])
|
||||
|
||||
materials_file += mats
|
||||
|
||||
materials_file.cross_sections = mgxslib_name
|
||||
|
||||
# # Make Geometry
|
||||
rad_outer = 929.45
|
||||
# Set a cell boundary to exist for every material above (exclude the 0)
|
||||
rads = np.linspace(0., rad_outer, len(mats) + 1, endpoint=True)[1:]
|
||||
|
||||
# Instantiate Universe
|
||||
root = openmc.Universe(universe_id=0, name='root universe')
|
||||
cells = []
|
||||
|
||||
surfs = []
|
||||
surfs.append(openmc.XPlane(x0=0., boundary_type='reflective'))
|
||||
for r, rad in enumerate(rads):
|
||||
if r == len(rads) - 1:
|
||||
surfs.append(openmc.XPlane(x0=rad, boundary_type='vacuum'))
|
||||
else:
|
||||
surfs.append(openmc.XPlane(x0=rad))
|
||||
|
||||
# Instantiate Cells
|
||||
cells = []
|
||||
for c in range(len(surfs) - 1):
|
||||
cells.append(openmc.Cell())
|
||||
cells[-1].region = (+surfs[c] & -surfs[c + 1])
|
||||
cells[-1].fill = mats[c]
|
||||
|
||||
# Register Cells with Universe
|
||||
root.add_cells(cells)
|
||||
|
||||
# Instantiate a Geometry, register the root Universe, and export to XML
|
||||
geometry_file = openmc.Geometry(root)
|
||||
|
||||
# # Make Settings
|
||||
# Instantiate a Settings object, set all runtime parameters
|
||||
settings_file = openmc.Settings()
|
||||
settings_file.energy_mode = "multi-group"
|
||||
settings_file.tabular_legendre = {'enable': False}
|
||||
settings_file.batches = 10
|
||||
settings_file.inactive = 5
|
||||
settings_file.particles = 1000
|
||||
|
||||
# Build source distribution
|
||||
INF = 1000.
|
||||
bounds = [0., -INF, -INF, rads[0], INF, INF]
|
||||
uniform_dist = openmc.stats.Box(bounds[:3], bounds[3:])
|
||||
settings_file.source = openmc.source.Source(space=uniform_dist)
|
||||
|
||||
settings_file.output = {'summary': False}
|
||||
|
||||
model = openmc.model.Model()
|
||||
|
||||
# Define materials needed for 1D/1G slab problem
|
||||
mat_names = ['uo2', 'clad', 'lwtr']
|
||||
mgxs_reps = ['ang', 'ang_mu', 'iso', 'iso_mu']
|
||||
|
||||
if reps is None:
|
||||
reps = mgxs_reps
|
||||
|
||||
xs = []
|
||||
i = 0
|
||||
for mat in mat_names:
|
||||
for rep in reps:
|
||||
i += 1
|
||||
name = mat + '_' + rep
|
||||
xs.append(name)
|
||||
if as_macro:
|
||||
m = openmc.Material(name=str(i))
|
||||
m.set_density('macro', 1.)
|
||||
m.add_macroscopic(name)
|
||||
else:
|
||||
m = openmc.Material(name=str(i))
|
||||
m.set_density('atom/b-cm', 1.)
|
||||
m.add_nuclide(name, 1.0, 'ao')
|
||||
model.materials.append(m)
|
||||
|
||||
# Define the materials file
|
||||
model.xs_data = xs
|
||||
model.materials.cross_sections = "../../1d_mgxs.h5"
|
||||
|
||||
# Define surfaces.
|
||||
# Assembly/Problem Boundary
|
||||
left = openmc.XPlane(x0=0.0, boundary_type='reflective')
|
||||
right = openmc.XPlane(x0=10.0, boundary_type='reflective')
|
||||
bottom = openmc.YPlane(y0=0.0, boundary_type='reflective')
|
||||
top = openmc.YPlane(y0=10.0, boundary_type='reflective')
|
||||
|
||||
# for each material add a plane
|
||||
planes = [openmc.ZPlane(z0=0.0, boundary_type='reflective')]
|
||||
dz = round(5. / float(len(model.materials)), 4)
|
||||
for i in range(len(model.materials) - 1):
|
||||
planes.append(openmc.ZPlane(z0=dz * float(i + 1)))
|
||||
planes.append(openmc.ZPlane(z0=5.0, boundary_type='reflective'))
|
||||
|
||||
# Define cells for each material
|
||||
model.geometry.root_universe = openmc.Universe(name='root universe')
|
||||
xy = +left & -right & +bottom & -top
|
||||
for i, mat in enumerate(model.materials):
|
||||
c = openmc.Cell(fill=mat, region=xy & +planes[i] & -planes[i + 1])
|
||||
model.geometry.root_universe.add_cell(c)
|
||||
|
||||
model.settings.batches = 10
|
||||
model.settings.inactive = 5
|
||||
model.settings.particles = 100
|
||||
model.settings.source = openmc.Source(space=openmc.stats.Box(
|
||||
[0.0, 0.0, 0.0], [10.0, 10.0, 5.]))
|
||||
model.settings.energy_mode = "multi-group"
|
||||
|
||||
plot = openmc.Plot()
|
||||
plot.filename = 'mat'
|
||||
plot.origin = (5.0, 5.0, 2.5)
|
||||
plot.width = (2.5, 2.5)
|
||||
plot.basis = 'xz'
|
||||
plot.pixels = (3000, 3000)
|
||||
plot.color_by = 'material'
|
||||
model.plots.append(plot)
|
||||
model.geometry = geometry_file
|
||||
model.materials = materials_file
|
||||
model.settings = settings_file
|
||||
model.xs_data = macros
|
||||
|
||||
return model
|
||||
|
|
|
|||
BIN
tests/1d_mgxs.h5
BIN
tests/1d_mgxs.h5
Binary file not shown.
|
|
@ -1,97 +0,0 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<geometry>
|
||||
<cell id="1" material="1" region="1 -2 3 -4 5 -6" universe="1" />
|
||||
<cell id="2" material="2" region="1 -2 3 -4 6 -7" universe="1" />
|
||||
<cell id="3" material="3" region="1 -2 3 -4 7 -8" universe="1" />
|
||||
<cell id="4" material="4" region="1 -2 3 -4 8 -9" universe="1" />
|
||||
<cell id="5" material="5" region="1 -2 3 -4 9 -10" universe="1" />
|
||||
<cell id="6" material="6" region="1 -2 3 -4 10 -11" universe="1" />
|
||||
<cell id="7" material="7" region="1 -2 3 -4 11 -12" universe="1" />
|
||||
<cell id="8" material="8" region="1 -2 3 -4 12 -13" universe="1" />
|
||||
<cell id="9" material="9" region="1 -2 3 -4 13 -14" universe="1" />
|
||||
<cell id="10" material="10" region="1 -2 3 -4 14 -15" universe="1" />
|
||||
<cell id="11" material="11" region="1 -2 3 -4 15 -16" universe="1" />
|
||||
<cell id="12" material="12" region="1 -2 3 -4 16 -17" universe="1" />
|
||||
<surface boundary="reflective" coeffs="0.0" id="1" type="x-plane" />
|
||||
<surface boundary="reflective" coeffs="10.0" id="2" type="x-plane" />
|
||||
<surface boundary="reflective" coeffs="0.0" id="3" type="y-plane" />
|
||||
<surface boundary="reflective" coeffs="10.0" id="4" type="y-plane" />
|
||||
<surface boundary="reflective" coeffs="0.0" id="5" type="z-plane" />
|
||||
<surface coeffs="0.4167" id="6" type="z-plane" />
|
||||
<surface coeffs="0.8334" id="7" type="z-plane" />
|
||||
<surface coeffs="1.2501" id="8" type="z-plane" />
|
||||
<surface coeffs="1.6668" id="9" type="z-plane" />
|
||||
<surface coeffs="2.0835" id="10" type="z-plane" />
|
||||
<surface coeffs="2.5002" id="11" type="z-plane" />
|
||||
<surface coeffs="2.9169" id="12" type="z-plane" />
|
||||
<surface coeffs="3.3336" id="13" type="z-plane" />
|
||||
<surface coeffs="3.7503" id="14" type="z-plane" />
|
||||
<surface coeffs="4.167" id="15" type="z-plane" />
|
||||
<surface coeffs="4.5837" id="16" type="z-plane" />
|
||||
<surface boundary="reflective" coeffs="5.0" id="17" type="z-plane" />
|
||||
</geometry>
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<materials>
|
||||
<cross_sections>../../1d_mgxs.h5</cross_sections>
|
||||
<material id="1" name="1">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="uo2_ang" />
|
||||
</material>
|
||||
<material id="2" name="2">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="uo2_ang_mu" />
|
||||
</material>
|
||||
<material id="3" name="3">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="uo2_iso" />
|
||||
</material>
|
||||
<material id="4" name="4">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="uo2_iso_mu" />
|
||||
</material>
|
||||
<material id="5" name="5">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="clad_ang" />
|
||||
</material>
|
||||
<material id="6" name="6">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="clad_ang_mu" />
|
||||
</material>
|
||||
<material id="7" name="7">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="clad_iso" />
|
||||
</material>
|
||||
<material id="8" name="8">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="clad_iso_mu" />
|
||||
</material>
|
||||
<material id="9" name="9">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="lwtr_ang" />
|
||||
</material>
|
||||
<material id="10" name="10">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="lwtr_ang_mu" />
|
||||
</material>
|
||||
<material id="11" name="11">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="lwtr_iso" />
|
||||
</material>
|
||||
<material id="12" name="12">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="lwtr_iso_mu" />
|
||||
</material>
|
||||
</materials>
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<settings>
|
||||
<run_mode>eigenvalue</run_mode>
|
||||
<particles>100</particles>
|
||||
<batches>10</batches>
|
||||
<inactive>5</inactive>
|
||||
<source strength="1.0">
|
||||
<space type="box">
|
||||
<parameters>0.0 0.0 0.0 10.0 10.0 5.0</parameters>
|
||||
</space>
|
||||
</source>
|
||||
<energy_mode>multi-group</energy_mode>
|
||||
</settings>
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
k-combined:
|
||||
1.073147E+00 1.602384E-02
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
from openmc.examples import slab_mg
|
||||
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
|
||||
def test_mg_basic():
|
||||
model = slab_mg()
|
||||
harness = PyAPITestHarness('statepoint.10.h5', model)
|
||||
harness.main()
|
||||
|
|
@ -3,6 +3,7 @@ import os
|
|||
import numpy as np
|
||||
|
||||
import openmc
|
||||
from openmc.examples import slab_mg
|
||||
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
|
|
@ -73,86 +74,6 @@ def create_library():
|
|||
mg_cross_sections_file.export_to_hdf5('2g.h5')
|
||||
|
||||
|
||||
def create_model():
|
||||
create_library()
|
||||
|
||||
# # Make Materials
|
||||
materials_file = openmc.Materials()
|
||||
|
||||
mat_names = ['base leg', 'base tab', 'base hist', 'base matrix', 'base ang']
|
||||
macros = []
|
||||
mats = []
|
||||
for i in range(len(mat_names)):
|
||||
macros.append(openmc.Macroscopic('mat_' + str(i + 1)))
|
||||
mats.append(openmc.Material(name=mat_names[i]))
|
||||
mats[-1].set_density('macro', 1.0)
|
||||
mats[-1].add_macroscopic(macros[-1])
|
||||
|
||||
# Add in the microscopic data
|
||||
mats.append(openmc.Material(name='micro'))
|
||||
mats[-1].set_density("sum")
|
||||
mats[-1].add_nuclide("mat_1", 0.5)
|
||||
mats[-1].add_nuclide("mat_6", 0.5)
|
||||
|
||||
materials_file += mats
|
||||
|
||||
materials_file.cross_sections = '2g.h5'
|
||||
|
||||
# # Make Geometry
|
||||
rad_outer = 929.45
|
||||
# Set a cell boundary to exist for every material above (exclude the 0)
|
||||
rads = np.linspace(0., rad_outer, len(mats) + 1, endpoint=True)[1:]
|
||||
|
||||
# Instantiate Universe
|
||||
root = openmc.Universe(universe_id=0, name='root universe')
|
||||
cells = []
|
||||
|
||||
surfs = []
|
||||
surfs.append(openmc.XPlane(x0=0., boundary_type='reflective'))
|
||||
for r, rad in enumerate(rads):
|
||||
if r == len(rads) - 1:
|
||||
surfs.append(openmc.XPlane(x0=rad, boundary_type='vacuum'))
|
||||
else:
|
||||
surfs.append(openmc.XPlane(x0=rad))
|
||||
|
||||
# Instantiate Cells
|
||||
cells = []
|
||||
for c in range(len(surfs) - 1):
|
||||
cells.append(openmc.Cell())
|
||||
cells[-1].region = (+surfs[c] & -surfs[c + 1])
|
||||
cells[-1].fill = mats[c]
|
||||
|
||||
# Register Cells with Universe
|
||||
root.add_cells(cells)
|
||||
|
||||
# Instantiate a Geometry, register the root Universe, and export to XML
|
||||
geometry_file = openmc.Geometry(root)
|
||||
|
||||
# # Make Settings
|
||||
# Instantiate a Settings object, set all runtime parameters
|
||||
settings_file = openmc.Settings()
|
||||
settings_file.energy_mode = "multi-group"
|
||||
settings_file.tabular_legendre = {'enable': False}
|
||||
settings_file.batches = 10
|
||||
settings_file.inactive = 5
|
||||
settings_file.particles = 1000
|
||||
|
||||
# Build source distribution
|
||||
INF = 1000.
|
||||
bounds = [0., -INF, -INF, rads[0], INF, INF]
|
||||
uniform_dist = openmc.stats.Box(bounds[:3], bounds[3:])
|
||||
settings_file.source = openmc.source.Source(space=uniform_dist)
|
||||
|
||||
settings_file.output = {'summary': False}
|
||||
|
||||
model = openmc.model.Model()
|
||||
model.geometry = geometry_file
|
||||
model.materials = materials_file
|
||||
model.settings = settings_file
|
||||
|
||||
return model
|
||||
|
||||
|
||||
class MGXSTestHarness(PyAPITestHarness):
|
||||
def _cleanup(self):
|
||||
super()._cleanup()
|
||||
|
|
@ -162,6 +83,15 @@ class MGXSTestHarness(PyAPITestHarness):
|
|||
|
||||
|
||||
def test_mg_benchmark():
|
||||
model = create_model()
|
||||
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()
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import os
|
|||
import numpy as np
|
||||
|
||||
import openmc
|
||||
from openmc.examples import slab_mg
|
||||
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
|
|
@ -71,7 +72,8 @@ def create_library():
|
|||
mat_4 = openmc.XSdata('mat_4', groups)
|
||||
mat_4.order = 1
|
||||
mat_4.num_delayed_groups = 2
|
||||
mat_4.set_prompt_nu_fission(one_m_beta * np.outer(np.multiply(nu, fiss), chi))
|
||||
mat_4.set_prompt_nu_fission(one_m_beta *
|
||||
np.outer(np.multiply(nu, fiss), chi))
|
||||
delay_nu_fiss = np.zeros((n_dg, groups.num_groups, groups.num_groups))
|
||||
for dg in range(n_dg):
|
||||
for g in range(groups.num_groups):
|
||||
|
|
@ -87,80 +89,6 @@ def create_library():
|
|||
mg_cross_sections_file.export_to_hdf5('2g.h5')
|
||||
|
||||
|
||||
def create_model():
|
||||
create_library()
|
||||
|
||||
# # Make Materials
|
||||
materials_file = openmc.Materials()
|
||||
|
||||
mat_names = ['vec beta', 'vec no beta', 'matrix beta', 'matrix no beta']
|
||||
macros = []
|
||||
mats = []
|
||||
for i in range(len(mat_names)):
|
||||
macros.append(openmc.Macroscopic('mat_' + str(i + 1)))
|
||||
mats.append(openmc.Material(name=mat_names[i]))
|
||||
mats[-1].set_density('macro', 1.0)
|
||||
mats[-1].add_macroscopic(macros[-1])
|
||||
|
||||
materials_file += mats
|
||||
|
||||
materials_file.cross_sections = '2g.h5'
|
||||
|
||||
# # Make Geometry
|
||||
rad_outer = 929.45
|
||||
# Set a cell boundary to exist for every material above (exclude the 0)
|
||||
rads = np.linspace(0., rad_outer, len(mats) + 1, endpoint=True)[1:]
|
||||
|
||||
# Instantiate Universe
|
||||
root = openmc.Universe(universe_id=0, name='root universe')
|
||||
cells = []
|
||||
|
||||
surfs = []
|
||||
surfs.append(openmc.XPlane(x0=0., boundary_type='reflective'))
|
||||
for r, rad in enumerate(rads):
|
||||
if r == len(rads) - 1:
|
||||
surfs.append(openmc.XPlane(x0=rad, boundary_type='vacuum'))
|
||||
else:
|
||||
surfs.append(openmc.XPlane(x0=rad))
|
||||
|
||||
# Instantiate Cells
|
||||
cells = []
|
||||
for c in range(len(surfs) - 1):
|
||||
cells.append(openmc.Cell())
|
||||
cells[-1].region = (+surfs[c] & -surfs[c + 1])
|
||||
cells[-1].fill = mats[c]
|
||||
|
||||
# Register Cells with Universe
|
||||
root.add_cells(cells)
|
||||
|
||||
# Instantiate a Geometry, register the root Universe, and export to XML
|
||||
geometry_file = openmc.Geometry(root)
|
||||
|
||||
# # Make Settings
|
||||
# Instantiate a Settings object, set all runtime parameters
|
||||
settings_file = openmc.Settings()
|
||||
settings_file.energy_mode = "multi-group"
|
||||
settings_file.tabular_legendre = {'enable': False}
|
||||
settings_file.batches = 10
|
||||
settings_file.inactive = 5
|
||||
settings_file.particles = 1000
|
||||
|
||||
# Build source distribution
|
||||
INF = 1000.
|
||||
bounds = [0., -INF, -INF, rads[0], INF, INF]
|
||||
uniform_dist = openmc.stats.Box(bounds[:3], bounds[3:])
|
||||
settings_file.source = openmc.source.Source(space=uniform_dist)
|
||||
|
||||
settings_file.output = {'summary': False}
|
||||
|
||||
model = openmc.model.Model()
|
||||
model.geometry = geometry_file
|
||||
model.materials = materials_file
|
||||
model.settings = settings_file
|
||||
|
||||
return model
|
||||
|
||||
|
||||
class MGXSTestHarness(PyAPITestHarness):
|
||||
def _cleanup(self):
|
||||
super()._cleanup()
|
||||
|
|
@ -170,6 +98,9 @@ class MGXSTestHarness(PyAPITestHarness):
|
|||
|
||||
|
||||
def test_mg_benchmark():
|
||||
model = create_model()
|
||||
create_library()
|
||||
model = slab_mg(num_regions=4, mat_names=['vec beta', 'vec no beta',
|
||||
'matrix beta', 'matrix no beta'])
|
||||
|
||||
harness = PyAPITestHarness('statepoint.10.h5', model)
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ def build_mgxs_library(convert):
|
|||
# Instantiate the energy group data
|
||||
groups = openmc.mgxs.EnergyGroups(group_edges=[1e-5, 0.625, 20.0e6])
|
||||
|
||||
# Instantiate the 7-group (C5G7) cross section data
|
||||
# Instantiate the 2-group (C5G7) cross section data
|
||||
uo2_xsdata = openmc.XSdata('UO2', groups)
|
||||
uo2_xsdata.order = 2
|
||||
uo2_xsdata.set_total([2., 2.])
|
||||
|
|
|
|||
|
|
@ -1,44 +1,31 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<geometry>
|
||||
<cell id="1" material="1" region="1 -2 3 -4 5 -6" universe="1" />
|
||||
<cell id="2" material="2" region="1 -2 3 -4 6 -7" universe="1" />
|
||||
<cell id="3" material="3" region="1 -2 3 -4 7 -8" universe="1" />
|
||||
<cell id="1" material="1" region="1 -2" universe="0" />
|
||||
<surface boundary="reflective" coeffs="0.0" id="1" type="x-plane" />
|
||||
<surface boundary="reflective" coeffs="10.0" id="2" type="x-plane" />
|
||||
<surface boundary="reflective" coeffs="0.0" id="3" type="y-plane" />
|
||||
<surface boundary="reflective" coeffs="10.0" id="4" type="y-plane" />
|
||||
<surface boundary="reflective" coeffs="0.0" id="5" type="z-plane" />
|
||||
<surface coeffs="1.6667" id="6" type="z-plane" />
|
||||
<surface coeffs="3.3334" id="7" type="z-plane" />
|
||||
<surface boundary="reflective" coeffs="5.0" id="8" type="z-plane" />
|
||||
<surface boundary="vacuum" coeffs="929.45" id="2" type="x-plane" />
|
||||
</geometry>
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<materials>
|
||||
<cross_sections>../../1d_mgxs.h5</cross_sections>
|
||||
<material id="1" name="1">
|
||||
<cross_sections>2g.h5</cross_sections>
|
||||
<material id="1" name="mat_1">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="uo2_iso" />
|
||||
</material>
|
||||
<material id="2" name="2">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="clad_iso" />
|
||||
</material>
|
||||
<material id="3" name="3">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="lwtr_iso" />
|
||||
<macroscopic name="mat_1" />
|
||||
</material>
|
||||
</materials>
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<settings>
|
||||
<run_mode>eigenvalue</run_mode>
|
||||
<particles>100</particles>
|
||||
<particles>1000</particles>
|
||||
<batches>10</batches>
|
||||
<inactive>5</inactive>
|
||||
<source strength="1.0">
|
||||
<space type="box">
|
||||
<parameters>0.0 0.0 0.0 10.0 10.0 5.0</parameters>
|
||||
<parameters>0.0 -1000.0 -1000.0 929.45 1000.0 1000.0</parameters>
|
||||
</space>
|
||||
</source>
|
||||
<output>
|
||||
<summary>false</summary>
|
||||
</output>
|
||||
<energy_mode>multi-group</energy_mode>
|
||||
<tabular_legendre>
|
||||
<enable>false</enable>
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
k-combined:
|
||||
1.110122E+00 2.549637E-02
|
||||
9.934975E-01 2.679669E-02
|
||||
|
|
|
|||
|
|
@ -1,10 +1,54 @@
|
|||
import os
|
||||
|
||||
import numpy as np
|
||||
|
||||
import openmc
|
||||
from openmc.examples import slab_mg
|
||||
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
|
||||
def create_library():
|
||||
# Instantiate the energy group data and file object
|
||||
groups = openmc.mgxs.EnergyGroups(group_edges=[0.0, 0.625, 20.0e6])
|
||||
|
||||
mg_cross_sections_file = openmc.MGXSLibrary(groups)
|
||||
|
||||
# Make the base, isotropic data
|
||||
nu = [2.50, 2.50]
|
||||
fiss = np.array([0.002817, 0.097])
|
||||
capture = [0.008708, 0.02518]
|
||||
absorption = np.add(capture, fiss)
|
||||
scatter = np.array(
|
||||
[[[0.31980, 0.06694], [0.004555, -0.0003972]],
|
||||
[[0.00000, 0.00000], [0.424100, 0.05439000]]])
|
||||
total = [0.33588, 0.54628]
|
||||
chi = [1., 0.]
|
||||
|
||||
mat_1 = openmc.XSdata('mat_1', groups)
|
||||
mat_1.order = 1
|
||||
mat_1.set_nu_fission(np.multiply(nu, fiss))
|
||||
mat_1.set_absorption(absorption)
|
||||
mat_1.set_scatter_matrix(scatter)
|
||||
mat_1.set_total(total)
|
||||
mat_1.set_chi(chi)
|
||||
mg_cross_sections_file.add_xsdata(mat_1)
|
||||
|
||||
# Write the file
|
||||
mg_cross_sections_file.export_to_hdf5('2g.h5')
|
||||
|
||||
|
||||
class MGXSTestHarness(PyAPITestHarness):
|
||||
def _cleanup(self):
|
||||
super()._cleanup()
|
||||
f = '2g.h5'
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
||||
|
||||
def test_mg_legendre():
|
||||
model = slab_mg(reps=['iso'])
|
||||
create_library()
|
||||
model = slab_mg()
|
||||
model.settings.tabular_legendre = {'enable': False}
|
||||
|
||||
harness = PyAPITestHarness('statepoint.10.h5', model)
|
||||
|
|
|
|||
|
|
@ -1,44 +1,34 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<geometry>
|
||||
<cell id="1" material="1" region="1 -2 3 -4 5 -6" universe="1" />
|
||||
<cell id="2" material="2" region="1 -2 3 -4 6 -7" universe="1" />
|
||||
<cell id="3" material="3" region="1 -2 3 -4 7 -8" universe="1" />
|
||||
<cell id="1" material="1" region="1 -2" universe="0" />
|
||||
<surface boundary="reflective" coeffs="0.0" id="1" type="x-plane" />
|
||||
<surface boundary="reflective" coeffs="10.0" id="2" type="x-plane" />
|
||||
<surface boundary="reflective" coeffs="0.0" id="3" type="y-plane" />
|
||||
<surface boundary="reflective" coeffs="10.0" id="4" type="y-plane" />
|
||||
<surface boundary="reflective" coeffs="0.0" id="5" type="z-plane" />
|
||||
<surface coeffs="1.6667" id="6" type="z-plane" />
|
||||
<surface coeffs="3.3334" id="7" type="z-plane" />
|
||||
<surface boundary="reflective" coeffs="5.0" id="8" type="z-plane" />
|
||||
<surface boundary="vacuum" coeffs="929.45" id="2" type="x-plane" />
|
||||
</geometry>
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<materials>
|
||||
<cross_sections>../../1d_mgxs.h5</cross_sections>
|
||||
<material id="1" name="1">
|
||||
<cross_sections>2g.h5</cross_sections>
|
||||
<material id="1" name="mat_1">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="uo2_iso" />
|
||||
</material>
|
||||
<material id="2" name="2">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="clad_iso" />
|
||||
</material>
|
||||
<material id="3" name="3">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="lwtr_iso" />
|
||||
<macroscopic name="mat_1" />
|
||||
</material>
|
||||
</materials>
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<settings>
|
||||
<run_mode>eigenvalue</run_mode>
|
||||
<particles>100</particles>
|
||||
<particles>1000</particles>
|
||||
<batches>10</batches>
|
||||
<inactive>5</inactive>
|
||||
<source strength="1.0">
|
||||
<space type="box">
|
||||
<parameters>0.0 0.0 0.0 10.0 10.0 5.0</parameters>
|
||||
<parameters>0.0 -1000.0 -1000.0 929.45 1000.0 1000.0</parameters>
|
||||
</space>
|
||||
</source>
|
||||
<output>
|
||||
<summary>false</summary>
|
||||
</output>
|
||||
<energy_mode>multi-group</energy_mode>
|
||||
<max_order>1</max_order>
|
||||
<tabular_legendre>
|
||||
<enable>false</enable>
|
||||
</tabular_legendre>
|
||||
</settings>
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
k-combined:
|
||||
1.074551E+00 1.871525E-02
|
||||
9.934975E-01 2.679669E-02
|
||||
|
|
|
|||
|
|
@ -1,10 +1,55 @@
|
|||
import os
|
||||
|
||||
import numpy as np
|
||||
|
||||
import openmc
|
||||
from openmc.examples import slab_mg
|
||||
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
|
||||
def create_library():
|
||||
# Instantiate the energy group data and file object
|
||||
groups = openmc.mgxs.EnergyGroups(group_edges=[0.0, 0.625, 20.0e6])
|
||||
|
||||
mg_cross_sections_file = openmc.MGXSLibrary(groups)
|
||||
|
||||
# Make the base, isotropic data
|
||||
nu = [2.50, 2.50]
|
||||
fiss = np.array([0.002817, 0.097])
|
||||
capture = [0.008708, 0.02518]
|
||||
absorption = np.add(capture, fiss)
|
||||
scatter = np.array(
|
||||
[[[0.31980, 0.06694, 0.003], [0.004555, -0.0003972, 0.00002]],
|
||||
[[0.00000, 0.00000, 0.000], [0.424100, 0.05439000, 0.0025]]])
|
||||
total = [0.33588, 0.54628]
|
||||
chi = [1., 0.]
|
||||
|
||||
mat_1 = openmc.XSdata('mat_1', groups)
|
||||
mat_1.order = 2
|
||||
mat_1.set_nu_fission(np.multiply(nu, fiss))
|
||||
mat_1.set_absorption(absorption)
|
||||
mat_1.set_scatter_matrix(scatter)
|
||||
mat_1.set_total(total)
|
||||
mat_1.set_chi(chi)
|
||||
mg_cross_sections_file.add_xsdata(mat_1)
|
||||
|
||||
# Write the file
|
||||
mg_cross_sections_file.export_to_hdf5('2g.h5')
|
||||
|
||||
|
||||
class MGXSTestHarness(PyAPITestHarness):
|
||||
def _cleanup(self):
|
||||
super()._cleanup()
|
||||
f = '2g.h5'
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
||||
|
||||
def test_mg_max_order():
|
||||
model = slab_mg(reps=['iso'])
|
||||
create_library()
|
||||
model = slab_mg()
|
||||
model.settings.max_order = 1
|
||||
|
||||
harness = PyAPITestHarness('statepoint.10.h5', model)
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,97 +0,0 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<geometry>
|
||||
<cell id="1" material="1" region="1 -2 3 -4 5 -6" universe="1" />
|
||||
<cell id="2" material="2" region="1 -2 3 -4 6 -7" universe="1" />
|
||||
<cell id="3" material="3" region="1 -2 3 -4 7 -8" universe="1" />
|
||||
<cell id="4" material="4" region="1 -2 3 -4 8 -9" universe="1" />
|
||||
<cell id="5" material="5" region="1 -2 3 -4 9 -10" universe="1" />
|
||||
<cell id="6" material="6" region="1 -2 3 -4 10 -11" universe="1" />
|
||||
<cell id="7" material="7" region="1 -2 3 -4 11 -12" universe="1" />
|
||||
<cell id="8" material="8" region="1 -2 3 -4 12 -13" universe="1" />
|
||||
<cell id="9" material="9" region="1 -2 3 -4 13 -14" universe="1" />
|
||||
<cell id="10" material="10" region="1 -2 3 -4 14 -15" universe="1" />
|
||||
<cell id="11" material="11" region="1 -2 3 -4 15 -16" universe="1" />
|
||||
<cell id="12" material="12" region="1 -2 3 -4 16 -17" universe="1" />
|
||||
<surface boundary="reflective" coeffs="0.0" id="1" type="x-plane" />
|
||||
<surface boundary="reflective" coeffs="10.0" id="2" type="x-plane" />
|
||||
<surface boundary="reflective" coeffs="0.0" id="3" type="y-plane" />
|
||||
<surface boundary="reflective" coeffs="10.0" id="4" type="y-plane" />
|
||||
<surface boundary="reflective" coeffs="0.0" id="5" type="z-plane" />
|
||||
<surface coeffs="0.4167" id="6" type="z-plane" />
|
||||
<surface coeffs="0.8334" id="7" type="z-plane" />
|
||||
<surface coeffs="1.2501" id="8" type="z-plane" />
|
||||
<surface coeffs="1.6668" id="9" type="z-plane" />
|
||||
<surface coeffs="2.0835" id="10" type="z-plane" />
|
||||
<surface coeffs="2.5002" id="11" type="z-plane" />
|
||||
<surface coeffs="2.9169" id="12" type="z-plane" />
|
||||
<surface coeffs="3.3336" id="13" type="z-plane" />
|
||||
<surface coeffs="3.7503" id="14" type="z-plane" />
|
||||
<surface coeffs="4.167" id="15" type="z-plane" />
|
||||
<surface coeffs="4.5837" id="16" type="z-plane" />
|
||||
<surface boundary="reflective" coeffs="5.0" id="17" type="z-plane" />
|
||||
</geometry>
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<materials>
|
||||
<cross_sections>../../1d_mgxs.h5</cross_sections>
|
||||
<material id="1" name="1">
|
||||
<density units="atom/b-cm" value="1.0" />
|
||||
<nuclide ao="1.0" name="uo2_ang" />
|
||||
</material>
|
||||
<material id="2" name="2">
|
||||
<density units="atom/b-cm" value="1.0" />
|
||||
<nuclide ao="1.0" name="uo2_ang_mu" />
|
||||
</material>
|
||||
<material id="3" name="3">
|
||||
<density units="atom/b-cm" value="1.0" />
|
||||
<nuclide ao="1.0" name="uo2_iso" />
|
||||
</material>
|
||||
<material id="4" name="4">
|
||||
<density units="atom/b-cm" value="1.0" />
|
||||
<nuclide ao="1.0" name="uo2_iso_mu" />
|
||||
</material>
|
||||
<material id="5" name="5">
|
||||
<density units="atom/b-cm" value="1.0" />
|
||||
<nuclide ao="1.0" name="clad_ang" />
|
||||
</material>
|
||||
<material id="6" name="6">
|
||||
<density units="atom/b-cm" value="1.0" />
|
||||
<nuclide ao="1.0" name="clad_ang_mu" />
|
||||
</material>
|
||||
<material id="7" name="7">
|
||||
<density units="atom/b-cm" value="1.0" />
|
||||
<nuclide ao="1.0" name="clad_iso" />
|
||||
</material>
|
||||
<material id="8" name="8">
|
||||
<density units="atom/b-cm" value="1.0" />
|
||||
<nuclide ao="1.0" name="clad_iso_mu" />
|
||||
</material>
|
||||
<material id="9" name="9">
|
||||
<density units="atom/b-cm" value="1.0" />
|
||||
<nuclide ao="1.0" name="lwtr_ang" />
|
||||
</material>
|
||||
<material id="10" name="10">
|
||||
<density units="atom/b-cm" value="1.0" />
|
||||
<nuclide ao="1.0" name="lwtr_ang_mu" />
|
||||
</material>
|
||||
<material id="11" name="11">
|
||||
<density units="atom/b-cm" value="1.0" />
|
||||
<nuclide ao="1.0" name="lwtr_iso" />
|
||||
</material>
|
||||
<material id="12" name="12">
|
||||
<density units="atom/b-cm" value="1.0" />
|
||||
<nuclide ao="1.0" name="lwtr_iso_mu" />
|
||||
</material>
|
||||
</materials>
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<settings>
|
||||
<run_mode>eigenvalue</run_mode>
|
||||
<particles>100</particles>
|
||||
<batches>10</batches>
|
||||
<inactive>5</inactive>
|
||||
<source strength="1.0">
|
||||
<space type="box">
|
||||
<parameters>0.0 0.0 0.0 10.0 10.0 5.0</parameters>
|
||||
</space>
|
||||
</source>
|
||||
<energy_mode>multi-group</energy_mode>
|
||||
</settings>
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
k-combined:
|
||||
1.073147E+00 1.602384E-02
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
from openmc.examples import slab_mg
|
||||
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
|
||||
def test_mg_nuclide():
|
||||
model = slab_mg(as_macro=False)
|
||||
harness = PyAPITestHarness('statepoint.10.h5', model)
|
||||
harness.main()
|
||||
|
|
@ -1,98 +1,34 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<geometry>
|
||||
<cell id="1" material="1" region="1 -2 3 -4 5 -6" universe="1" />
|
||||
<cell id="2" material="2" region="1 -2 3 -4 6 -7" universe="1" />
|
||||
<cell id="3" material="3" region="1 -2 3 -4 7 -8" universe="1" />
|
||||
<cell id="4" material="4" region="1 -2 3 -4 8 -9" universe="1" />
|
||||
<cell id="5" material="5" region="1 -2 3 -4 9 -10" universe="1" />
|
||||
<cell id="6" material="6" region="1 -2 3 -4 10 -11" universe="1" />
|
||||
<cell id="7" material="7" region="1 -2 3 -4 11 -12" universe="1" />
|
||||
<cell id="8" material="8" region="1 -2 3 -4 12 -13" universe="1" />
|
||||
<cell id="9" material="9" region="1 -2 3 -4 13 -14" universe="1" />
|
||||
<cell id="10" material="10" region="1 -2 3 -4 14 -15" universe="1" />
|
||||
<cell id="11" material="11" region="1 -2 3 -4 15 -16" universe="1" />
|
||||
<cell id="12" material="12" region="1 -2 3 -4 16 -17" universe="1" />
|
||||
<cell id="1" material="1" region="1 -2" universe="0" />
|
||||
<surface boundary="reflective" coeffs="0.0" id="1" type="x-plane" />
|
||||
<surface boundary="reflective" coeffs="10.0" id="2" type="x-plane" />
|
||||
<surface boundary="reflective" coeffs="0.0" id="3" type="y-plane" />
|
||||
<surface boundary="reflective" coeffs="10.0" id="4" type="y-plane" />
|
||||
<surface boundary="reflective" coeffs="0.0" id="5" type="z-plane" />
|
||||
<surface coeffs="0.4167" id="6" type="z-plane" />
|
||||
<surface coeffs="0.8334" id="7" type="z-plane" />
|
||||
<surface coeffs="1.2501" id="8" type="z-plane" />
|
||||
<surface coeffs="1.6668" id="9" type="z-plane" />
|
||||
<surface coeffs="2.0835" id="10" type="z-plane" />
|
||||
<surface coeffs="2.5002" id="11" type="z-plane" />
|
||||
<surface coeffs="2.9169" id="12" type="z-plane" />
|
||||
<surface coeffs="3.3336" id="13" type="z-plane" />
|
||||
<surface coeffs="3.7503" id="14" type="z-plane" />
|
||||
<surface coeffs="4.167" id="15" type="z-plane" />
|
||||
<surface coeffs="4.5837" id="16" type="z-plane" />
|
||||
<surface boundary="reflective" coeffs="5.0" id="17" type="z-plane" />
|
||||
<surface boundary="vacuum" coeffs="929.45" id="2" type="x-plane" />
|
||||
</geometry>
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<materials>
|
||||
<cross_sections>../../1d_mgxs.h5</cross_sections>
|
||||
<material id="1" name="1">
|
||||
<cross_sections>2g.h5</cross_sections>
|
||||
<material id="1" name="mat_1">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="uo2_ang" />
|
||||
</material>
|
||||
<material id="2" name="2">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="uo2_ang_mu" />
|
||||
</material>
|
||||
<material id="3" name="3">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="uo2_iso" />
|
||||
</material>
|
||||
<material id="4" name="4">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="uo2_iso_mu" />
|
||||
</material>
|
||||
<material id="5" name="5">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="clad_ang" />
|
||||
</material>
|
||||
<material id="6" name="6">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="clad_ang_mu" />
|
||||
</material>
|
||||
<material id="7" name="7">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="clad_iso" />
|
||||
</material>
|
||||
<material id="8" name="8">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="clad_iso_mu" />
|
||||
</material>
|
||||
<material id="9" name="9">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="lwtr_ang" />
|
||||
</material>
|
||||
<material id="10" name="10">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="lwtr_ang_mu" />
|
||||
</material>
|
||||
<material id="11" name="11">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="lwtr_iso" />
|
||||
</material>
|
||||
<material id="12" name="12">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="lwtr_iso_mu" />
|
||||
<macroscopic name="mat_1" />
|
||||
</material>
|
||||
</materials>
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<settings>
|
||||
<run_mode>eigenvalue</run_mode>
|
||||
<particles>100</particles>
|
||||
<particles>1000</particles>
|
||||
<batches>10</batches>
|
||||
<inactive>5</inactive>
|
||||
<source strength="1.0">
|
||||
<space type="box">
|
||||
<parameters>0.0 0.0 0.0 10.0 10.0 5.0</parameters>
|
||||
<parameters>0.0 -1000.0 -1000.0 929.45 1000.0 1000.0</parameters>
|
||||
</space>
|
||||
</source>
|
||||
<output>
|
||||
<summary>false</summary>
|
||||
</output>
|
||||
<energy_mode>multi-group</energy_mode>
|
||||
<survival_biasing>true</survival_biasing>
|
||||
<tabular_legendre>
|
||||
<enable>false</enable>
|
||||
</tabular_legendre>
|
||||
</settings>
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
k-combined:
|
||||
1.080832E+00 1.336780E-02
|
||||
9.979905E-01 6.207495E-03
|
||||
|
|
|
|||
|
|
@ -1,10 +1,55 @@
|
|||
import os
|
||||
|
||||
import numpy as np
|
||||
|
||||
import openmc
|
||||
from openmc.examples import slab_mg
|
||||
|
||||
from tests.testing_harness import PyAPITestHarness
|
||||
|
||||
|
||||
def create_library():
|
||||
# Instantiate the energy group data and file object
|
||||
groups = openmc.mgxs.EnergyGroups(group_edges=[0.0, 0.625, 20.0e6])
|
||||
|
||||
mg_cross_sections_file = openmc.MGXSLibrary(groups)
|
||||
|
||||
# Make the base, isotropic data
|
||||
nu = [2.50, 2.50]
|
||||
fiss = np.array([0.002817, 0.097])
|
||||
capture = [0.008708, 0.02518]
|
||||
absorption = np.add(capture, fiss)
|
||||
scatter = np.array(
|
||||
[[[0.31980, 0.06694], [0.004555, -0.0003972]],
|
||||
[[0.00000, 0.00000], [0.424100, 0.05439000]]])
|
||||
total = [0.33588, 0.54628]
|
||||
chi = [1., 0.]
|
||||
|
||||
mat_1 = openmc.XSdata('mat_1', groups)
|
||||
mat_1.order = 1
|
||||
mat_1.set_nu_fission(np.multiply(nu, fiss))
|
||||
mat_1.set_absorption(absorption)
|
||||
mat_1.set_scatter_matrix(scatter)
|
||||
mat_1.set_total(total)
|
||||
mat_1.set_chi(chi)
|
||||
mg_cross_sections_file.add_xsdata(mat_1)
|
||||
|
||||
# Write the file
|
||||
mg_cross_sections_file.export_to_hdf5('2g.h5')
|
||||
|
||||
|
||||
class MGXSTestHarness(PyAPITestHarness):
|
||||
def _cleanup(self):
|
||||
super()._cleanup()
|
||||
f = '2g.h5'
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
||||
|
||||
def test_mg_survival_biasing():
|
||||
create_library()
|
||||
model = slab_mg()
|
||||
model.settings.survival_biasing = True
|
||||
|
||||
harness = PyAPITestHarness('statepoint.10.h5', model)
|
||||
harness.main()
|
||||
|
|
|
|||
|
|
@ -1,112 +1,48 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<geometry>
|
||||
<cell id="1" material="1" region="1 -2 3 -4 5 -6" universe="1" />
|
||||
<cell id="2" material="2" region="1 -2 3 -4 6 -7" universe="1" />
|
||||
<cell id="3" material="3" region="1 -2 3 -4 7 -8" universe="1" />
|
||||
<cell id="4" material="4" region="1 -2 3 -4 8 -9" universe="1" />
|
||||
<cell id="5" material="5" region="1 -2 3 -4 9 -10" universe="1" />
|
||||
<cell id="6" material="6" region="1 -2 3 -4 10 -11" universe="1" />
|
||||
<cell id="7" material="7" region="1 -2 3 -4 11 -12" universe="1" />
|
||||
<cell id="8" material="8" region="1 -2 3 -4 12 -13" universe="1" />
|
||||
<cell id="9" material="9" region="1 -2 3 -4 13 -14" universe="1" />
|
||||
<cell id="10" material="10" region="1 -2 3 -4 14 -15" universe="1" />
|
||||
<cell id="11" material="11" region="1 -2 3 -4 15 -16" universe="1" />
|
||||
<cell id="12" material="12" region="1 -2 3 -4 16 -17" universe="1" />
|
||||
<cell id="1" material="1" region="1 -2" universe="0" />
|
||||
<surface boundary="reflective" coeffs="0.0" id="1" type="x-plane" />
|
||||
<surface boundary="reflective" coeffs="10.0" id="2" type="x-plane" />
|
||||
<surface boundary="reflective" coeffs="0.0" id="3" type="y-plane" />
|
||||
<surface boundary="reflective" coeffs="10.0" id="4" type="y-plane" />
|
||||
<surface boundary="reflective" coeffs="0.0" id="5" type="z-plane" />
|
||||
<surface coeffs="0.4167" id="6" type="z-plane" />
|
||||
<surface coeffs="0.8334" id="7" type="z-plane" />
|
||||
<surface coeffs="1.2501" id="8" type="z-plane" />
|
||||
<surface coeffs="1.6668" id="9" type="z-plane" />
|
||||
<surface coeffs="2.0835" id="10" type="z-plane" />
|
||||
<surface coeffs="2.5002" id="11" type="z-plane" />
|
||||
<surface coeffs="2.9169" id="12" type="z-plane" />
|
||||
<surface coeffs="3.3336" id="13" type="z-plane" />
|
||||
<surface coeffs="3.7503" id="14" type="z-plane" />
|
||||
<surface coeffs="4.167" id="15" type="z-plane" />
|
||||
<surface coeffs="4.5837" id="16" type="z-plane" />
|
||||
<surface boundary="reflective" coeffs="5.0" id="17" type="z-plane" />
|
||||
<surface boundary="vacuum" coeffs="929.45" id="2" type="x-plane" />
|
||||
</geometry>
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<materials>
|
||||
<cross_sections>../../1d_mgxs.h5</cross_sections>
|
||||
<material id="1" name="1">
|
||||
<density units="atom/b-cm" value="1.0" />
|
||||
<nuclide ao="1.0" name="uo2_ang" />
|
||||
</material>
|
||||
<material id="2" name="2">
|
||||
<density units="atom/b-cm" value="1.0" />
|
||||
<nuclide ao="1.0" name="uo2_ang_mu" />
|
||||
</material>
|
||||
<material id="3" name="3">
|
||||
<density units="atom/b-cm" value="1.0" />
|
||||
<nuclide ao="1.0" name="uo2_iso" />
|
||||
</material>
|
||||
<material id="4" name="4">
|
||||
<density units="atom/b-cm" value="1.0" />
|
||||
<nuclide ao="1.0" name="uo2_iso_mu" />
|
||||
</material>
|
||||
<material id="5" name="5">
|
||||
<density units="atom/b-cm" value="1.0" />
|
||||
<nuclide ao="1.0" name="clad_ang" />
|
||||
</material>
|
||||
<material id="6" name="6">
|
||||
<density units="atom/b-cm" value="1.0" />
|
||||
<nuclide ao="1.0" name="clad_ang_mu" />
|
||||
</material>
|
||||
<material id="7" name="7">
|
||||
<density units="atom/b-cm" value="1.0" />
|
||||
<nuclide ao="1.0" name="clad_iso" />
|
||||
</material>
|
||||
<material id="8" name="8">
|
||||
<density units="atom/b-cm" value="1.0" />
|
||||
<nuclide ao="1.0" name="clad_iso_mu" />
|
||||
</material>
|
||||
<material id="9" name="9">
|
||||
<density units="atom/b-cm" value="1.0" />
|
||||
<nuclide ao="1.0" name="lwtr_ang" />
|
||||
</material>
|
||||
<material id="10" name="10">
|
||||
<density units="atom/b-cm" value="1.0" />
|
||||
<nuclide ao="1.0" name="lwtr_ang_mu" />
|
||||
</material>
|
||||
<material id="11" name="11">
|
||||
<density units="atom/b-cm" value="1.0" />
|
||||
<nuclide ao="1.0" name="lwtr_iso" />
|
||||
</material>
|
||||
<material id="12" name="12">
|
||||
<density units="atom/b-cm" value="1.0" />
|
||||
<nuclide ao="1.0" name="lwtr_iso_mu" />
|
||||
<cross_sections>2g.h5</cross_sections>
|
||||
<material id="1" name="mat_1">
|
||||
<density units="macro" value="1.0" />
|
||||
<macroscopic name="mat_1" />
|
||||
</material>
|
||||
</materials>
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<settings>
|
||||
<run_mode>eigenvalue</run_mode>
|
||||
<particles>100</particles>
|
||||
<particles>1000</particles>
|
||||
<batches>10</batches>
|
||||
<inactive>5</inactive>
|
||||
<source strength="1.0">
|
||||
<space type="box">
|
||||
<parameters>0.0 0.0 0.0 10.0 10.0 5.0</parameters>
|
||||
<parameters>0.0 -1000.0 -1000.0 929.45 1000.0 1000.0</parameters>
|
||||
</space>
|
||||
</source>
|
||||
<output>
|
||||
<summary>false</summary>
|
||||
</output>
|
||||
<energy_mode>multi-group</energy_mode>
|
||||
<tabular_legendre>
|
||||
<enable>false</enable>
|
||||
</tabular_legendre>
|
||||
</settings>
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<tallies>
|
||||
<mesh id="1" type="regular">
|
||||
<dimension>1 1 10</dimension>
|
||||
<dimension>10 1 1</dimension>
|
||||
<lower_left>0.0 0.0 0.0</lower_left>
|
||||
<upper_right>10 10 5</upper_right>
|
||||
<upper_right>929.45 1000 1000</upper_right>
|
||||
</mesh>
|
||||
<filter id="5" type="mesh">
|
||||
<bins>1</bins>
|
||||
</filter>
|
||||
<filter id="6" type="material">
|
||||
<bins>1 2 3 4 5 6 7 8 9 10 11 12</bins>
|
||||
<bins>1</bins>
|
||||
</filter>
|
||||
<filter id="1" type="energy">
|
||||
<bins>0.0 20000000.0</bins>
|
||||
|
|
@ -115,10 +51,10 @@
|
|||
<bins>0.0 20000000.0</bins>
|
||||
</filter>
|
||||
<filter id="3" type="energy">
|
||||
<bins>1e-05 0.0635 10.0 100.0 1000.0 500000.0 1000000.0 20000000.0</bins>
|
||||
<bins>0.0 0.625 20000000.0</bins>
|
||||
</filter>
|
||||
<filter id="4" type="energyout">
|
||||
<bins>1e-05 0.0635 10.0 100.0 1000.0 500000.0 1000000.0 20000000.0</bins>
|
||||
<bins>0.0 0.625 20000000.0</bins>
|
||||
</filter>
|
||||
<tally id="1">
|
||||
<filters>5</filters>
|
||||
|
|
@ -170,60 +106,60 @@
|
|||
</tally>
|
||||
<tally id="11">
|
||||
<filters>5</filters>
|
||||
<nuclides>uo2_ang uo2_ang_mu uo2_iso uo2_iso_mu clad_ang clad_ang_mu clad_iso clad_iso_mu lwtr_ang lwtr_ang_mu lwtr_iso lwtr_iso_mu</nuclides>
|
||||
<nuclides>mat_1</nuclides>
|
||||
<scores>total absorption fission nu-fission</scores>
|
||||
<estimator>analog</estimator>
|
||||
</tally>
|
||||
<tally id="12">
|
||||
<filters>5</filters>
|
||||
<nuclides>uo2_ang uo2_ang_mu uo2_iso uo2_iso_mu clad_ang clad_ang_mu clad_iso clad_iso_mu lwtr_ang lwtr_ang_mu lwtr_iso lwtr_iso_mu</nuclides>
|
||||
<nuclides>mat_1</nuclides>
|
||||
<scores>total absorption fission nu-fission</scores>
|
||||
<estimator>tracklength</estimator>
|
||||
</tally>
|
||||
<tally id="13">
|
||||
<filters>6 1</filters>
|
||||
<nuclides>uo2_ang uo2_ang_mu uo2_iso uo2_iso_mu clad_ang clad_ang_mu clad_iso clad_iso_mu lwtr_ang lwtr_ang_mu lwtr_iso lwtr_iso_mu</nuclides>
|
||||
<nuclides>mat_1</nuclides>
|
||||
<scores>total absorption fission nu-fission scatter nu-scatter</scores>
|
||||
<estimator>analog</estimator>
|
||||
</tally>
|
||||
<tally id="14">
|
||||
<filters>6 1</filters>
|
||||
<nuclides>uo2_ang uo2_ang_mu uo2_iso uo2_iso_mu clad_ang clad_ang_mu clad_iso clad_iso_mu lwtr_ang lwtr_ang_mu lwtr_iso lwtr_iso_mu</nuclides>
|
||||
<nuclides>mat_1</nuclides>
|
||||
<scores>total absorption fission nu-fission</scores>
|
||||
<estimator>collision</estimator>
|
||||
</tally>
|
||||
<tally id="15">
|
||||
<filters>6 1</filters>
|
||||
<nuclides>uo2_ang uo2_ang_mu uo2_iso uo2_iso_mu clad_ang clad_ang_mu clad_iso clad_iso_mu lwtr_ang lwtr_ang_mu lwtr_iso lwtr_iso_mu</nuclides>
|
||||
<nuclides>mat_1</nuclides>
|
||||
<scores>total absorption fission nu-fission</scores>
|
||||
<estimator>tracklength</estimator>
|
||||
</tally>
|
||||
<tally id="16">
|
||||
<filters>6 1 2</filters>
|
||||
<nuclides>uo2_ang uo2_ang_mu uo2_iso uo2_iso_mu clad_ang clad_ang_mu clad_iso clad_iso_mu lwtr_ang lwtr_ang_mu lwtr_iso lwtr_iso_mu</nuclides>
|
||||
<nuclides>mat_1</nuclides>
|
||||
<scores>scatter nu-scatter nu-fission</scores>
|
||||
</tally>
|
||||
<tally id="17">
|
||||
<filters>6 3</filters>
|
||||
<nuclides>uo2_ang uo2_ang_mu uo2_iso uo2_iso_mu clad_ang clad_ang_mu clad_iso clad_iso_mu lwtr_ang lwtr_ang_mu lwtr_iso lwtr_iso_mu</nuclides>
|
||||
<nuclides>mat_1</nuclides>
|
||||
<scores>total absorption fission nu-fission scatter nu-scatter</scores>
|
||||
<estimator>analog</estimator>
|
||||
</tally>
|
||||
<tally id="18">
|
||||
<filters>6 3</filters>
|
||||
<nuclides>uo2_ang uo2_ang_mu uo2_iso uo2_iso_mu clad_ang clad_ang_mu clad_iso clad_iso_mu lwtr_ang lwtr_ang_mu lwtr_iso lwtr_iso_mu</nuclides>
|
||||
<nuclides>mat_1</nuclides>
|
||||
<scores>total absorption fission nu-fission</scores>
|
||||
<estimator>collision</estimator>
|
||||
</tally>
|
||||
<tally id="19">
|
||||
<filters>6 3</filters>
|
||||
<nuclides>uo2_ang uo2_ang_mu uo2_iso uo2_iso_mu clad_ang clad_ang_mu clad_iso clad_iso_mu lwtr_ang lwtr_ang_mu lwtr_iso lwtr_iso_mu</nuclides>
|
||||
<nuclides>mat_1</nuclides>
|
||||
<scores>total absorption fission nu-fission</scores>
|
||||
<estimator>tracklength</estimator>
|
||||
</tally>
|
||||
<tally id="20">
|
||||
<filters>6 3 4</filters>
|
||||
<nuclides>uo2_ang uo2_ang_mu uo2_iso uo2_iso_mu clad_ang clad_ang_mu clad_iso clad_iso_mu lwtr_ang lwtr_ang_mu lwtr_iso lwtr_iso_mu</nuclides>
|
||||
<nuclides>mat_1</nuclides>
|
||||
<scores>scatter nu-scatter nu-fission</scores>
|
||||
</tally>
|
||||
</tallies>
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
9183f8b191f2e62334f992acd865d29e3f4e3f871a6df498e280fc4e2d91f2d2d20c732fbd75fa88e2e8c576f86e744f7655af6bb9da66e9b28b1009c8742899
|
||||
41ea1f6b17c58a8141921af2f1d044eda93f3a9bca9463ee023af2e9865da613ace90fc8a25b42edde128ed827182ea9df0fe09d9b7887282d0ec092692cf717
|
||||
|
|
@ -1,23 +1,66 @@
|
|||
import os
|
||||
|
||||
import numpy as np
|
||||
|
||||
import openmc
|
||||
from openmc.examples import slab_mg
|
||||
|
||||
from tests.testing_harness import HashedPyAPITestHarness
|
||||
|
||||
|
||||
def create_library():
|
||||
# Instantiate the energy group data and file object
|
||||
groups = openmc.mgxs.EnergyGroups(group_edges=[0.0, 0.625, 20.0e6])
|
||||
|
||||
mg_cross_sections_file = openmc.MGXSLibrary(groups)
|
||||
|
||||
# Make the base, isotropic data
|
||||
nu = [2.50, 2.50]
|
||||
fiss = np.array([0.002817, 0.097])
|
||||
capture = [0.008708, 0.02518]
|
||||
absorption = np.add(capture, fiss)
|
||||
scatter = np.array(
|
||||
[[[0.31980, 0.06694], [0.004555, -0.0003972]],
|
||||
[[0.00000, 0.00000], [0.424100, 0.05439000]]])
|
||||
total = [0.33588, 0.54628]
|
||||
chi = [1., 0.]
|
||||
|
||||
mat_1 = openmc.XSdata('mat_1', groups)
|
||||
mat_1.order = 1
|
||||
mat_1.set_nu_fission(np.multiply(nu, fiss))
|
||||
mat_1.set_absorption(absorption)
|
||||
mat_1.set_scatter_matrix(scatter)
|
||||
mat_1.set_total(total)
|
||||
mat_1.set_chi(chi)
|
||||
mg_cross_sections_file.add_xsdata(mat_1)
|
||||
|
||||
# Write the file
|
||||
mg_cross_sections_file.export_to_hdf5('2g.h5')
|
||||
|
||||
|
||||
class MGXSTestHarness(HashedPyAPITestHarness):
|
||||
def _cleanup(self):
|
||||
super()._cleanup()
|
||||
f = '2g.h5'
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
||||
|
||||
def test_mg_tallies():
|
||||
model = slab_mg(as_macro=False)
|
||||
create_library()
|
||||
model = slab_mg()
|
||||
|
||||
# Instantiate a tally mesh
|
||||
mesh = openmc.Mesh(mesh_id=1)
|
||||
mesh.type = 'regular'
|
||||
mesh.dimension = [1, 1, 10]
|
||||
mesh.dimension = [10, 1, 1]
|
||||
mesh.lower_left = [0.0, 0.0, 0.0]
|
||||
mesh.upper_right = [10, 10, 5]
|
||||
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 = [1e-5, 0.0635, 10.0, 1.0e2, 1.0e3, 0.5e6, 1.0e6, 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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue