added pin cell input set and converted test_mgxs_library_ce_to_mg to use it.

This commit is contained in:
Adam Nelson 2016-05-29 13:47:17 -04:00
parent 2a786f090d
commit 326cf4f84c
4 changed files with 108 additions and 6 deletions

View file

@ -570,6 +570,105 @@ class InputSet(object):
self.plots.add_plot(plot)
class PinCellInputSet(object):
def __init__(self):
self.settings = openmc.Settings()
self.materials = openmc.Materials()
self.geometry = openmc.Geometry()
self.tallies = None
self.plots = None
def export(self):
self.settings.export_to_xml()
self.materials.export_to_xml()
self.geometry.export_to_xml()
if self.tallies is not None: self.tallies.export_to_xml()
if self.plots is not None: self.plots.export_to_xml()
def build_default_materials_and_geometry(self):
# Define materials.
fuel = openmc.Material(name='Fuel')
fuel.set_density('g/cm3', 10.29769)
fuel.add_nuclide("U-234", 4.4843e-6)
fuel.add_nuclide("U-235", 5.5815e-4)
fuel.add_nuclide("U-238", 2.2408e-2)
fuel.add_nuclide("O-16", 4.5829e-2)
clad = openmc.Material(name='Cladding')
clad.set_density('g/cm3', 6.55)
clad.add_nuclide("Zr-90", 2.1827e-2)
clad.add_nuclide("Zr-91", 4.7600e-3)
clad.add_nuclide("Zr-92", 7.2758e-3)
clad.add_nuclide("Zr-94", 7.3734e-3)
clad.add_nuclide("Zr-96", 1.1879e-3)
hot_water = openmc.Material(name='Hot borated water')
hot_water.set_density('g/cm3', 0.740582)
hot_water.add_nuclide("H-1", 4.9457e-2)
hot_water.add_nuclide("O-16", 2.4672e-2)
hot_water.add_nuclide("B-10", 8.0042e-6)
hot_water.add_nuclide("B-11", 3.2218e-5)
hot_water.add_s_alpha_beta('HH2O', '71t')
# Define the materials file.
self.materials.default_xs = '71c'
self.materials += (fuel, clad, hot_water)
# Instantiate ZCylinder surfaces
fuel_or = openmc.ZCylinder(x0=0, y0=0, R=0.39218, name='Fuel OR')
clad_or = openmc.ZCylinder(x0=0, y0=0, R=0.45720, name='Clad OR')
left = openmc.XPlane(x0=-0.63, name='left')
right = openmc.XPlane(x0=0.63, name='right')
bottom = openmc.YPlane(y0=-0.63, name='bottom')
top = openmc.YPlane(y0=0.63, name='top')
left.boundary_type = 'reflective'
right.boundary_type = 'reflective'
top.boundary_type = 'reflective'
bottom.boundary_type = 'reflective'
# Instantiate Cells
fuel_pin = openmc.Cell(name='cell 1')
cladding = openmc.Cell(name='cell 3')
water = openmc.Cell(name='cell 2')
# Use surface half-spaces to define regions
fuel_pin.region = -fuel_or
cladding.region = +fuel_or & -clad_or
water.region = +clad_or & +left & -right & +bottom & -top
# Register Materials with Cells
fuel_pin.fill = fuel
cladding.fill = clad
water.fill = hot_water
# Instantiate Universe
root = openmc.Universe(universe_id=0, name='root universe')
# Register Cells with Universe
root.add_cells([fuel_pin, cladding, water])
# Instantiate a Geometry, register the root Universe, and export to XML
self.geometry.root_universe = root
def build_default_settings(self):
self.settings.batches = 10
self.settings.inactive = 5
self.settings.particles = 100
self.settings.source = Source(space=Box([-0.63, -0.63, -1],
[0.63, 0.63, 1],
only_fissionable=True))
def build_defualt_plots(self):
plot = openmc.Plot()
plot.filename = 'mat'
plot.origin = (0.0, 0.0, 0)
plot.width = (1.26, 1.26)
plot.pixels = (300, 300)
plot.color = 'mat'
self.plots.add_plot(plot)
class MGInputSet(InputSet):
def build_default_materials_and_geometry(self):
# Define materials needed for 1D/1G slab problem

View file

@ -1 +1 @@
f6442195628d3e6acd714d1ac123310a8c463ce6e76de2149783e4d9f2485752b53155f78bd9ae5e886b5f4717ef7c66b71959344051ea7f53b79148d59fe609
2db36402006f1aec10d484836303d5d804516ea9945f0508e610994b255185cb7f42dc3ed27dfd93355018d187100332011e921391059f83d3a5fda85e80d789

View file

@ -1,2 +1,2 @@
k-combined:
1.006931E+00 3.262911E-03
1.094839E+00 1.203524E-02

View file

@ -6,12 +6,15 @@ import glob
import hashlib
sys.path.insert(0, os.pardir)
from testing_harness import PyAPITestHarness
from input_set import PinCellInputSet
import openmc
import openmc.mgxs
class MGXSTestHarness(PyAPITestHarness):
def _build_inputs(self):
# Set the input set to use the pincell model
self._input_set = PinCellInputSet()
# Generate inputs using parent class routine
super(MGXSTestHarness, self)._build_inputs()
@ -19,10 +22,10 @@ class MGXSTestHarness(PyAPITestHarness):
# The openmc.mgxs module needs a summary.h5 file
self._input_set.settings.output = {'summary': True}
# Use a larger history count to get some scores in every material
self._input_set.settings.batches = 50
self._input_set.settings.inactive = 10
self._input_set.settings.particles = 1000
self._sp_name = './statepoint.50.h5'
# self._input_set.settings.batches = 50
# self._input_set.settings.inactive = 10
# self._input_set.settings.particles = 1000
# self._sp_name = './statepoint.50.h5'
# Rewrite file
self._input_set.settings.export_to_xml()