mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-26 05:05:30 -04:00
Increased MG mode test coverage from 63% to 74%.
This commit is contained in:
parent
b005aace7e
commit
c1dd7df7dd
14 changed files with 819 additions and 3094 deletions
|
|
@ -1865,7 +1865,7 @@ module mgxs_header
|
|||
|
||||
integer :: iazi, ipol, t
|
||||
|
||||
t = this % index_temp
|
||||
t = this % index_temp
|
||||
|
||||
if (present(uvw)) then
|
||||
call find_angle(this % polar, this % azimuthal, uvw, iazi, ipol)
|
||||
|
|
|
|||
|
|
@ -1149,6 +1149,8 @@ contains
|
|||
! Do same for nucxs, point it to the microscopic nuclide data of interest
|
||||
if (i_nuclide > 0) then
|
||||
nucxs => nuclides_MG(i_nuclide) % obj
|
||||
! And since we haven't calculated this temperature index yet, do so now
|
||||
call nucxs % find_temperature(p % sqrtkT)
|
||||
end if
|
||||
|
||||
i = 0
|
||||
|
|
|
|||
|
|
@ -728,60 +728,59 @@ class AssemblyInputSet(object):
|
|||
|
||||
|
||||
class MGInputSet(InputSet):
|
||||
def build_default_materials_and_geometry(self):
|
||||
def build_default_materials_and_geometry(self, reps=None, as_macro=True):
|
||||
# Define materials needed for 1D/1G slab problem
|
||||
uo2_data = openmc.Macroscopic('uo2_iso')
|
||||
uo2 = openmc.Material(name='UO2', material_id=1)
|
||||
uo2.set_density('macro', 1.0)
|
||||
uo2.add_macroscopic(uo2_data)
|
||||
mat_names = ['uo2', 'clad', 'lwtr']
|
||||
mgxs_reps = ['ang', 'ang_mu', 'iso', 'iso_mu']
|
||||
|
||||
clad_data = openmc.Macroscopic('clad_ang_mu')
|
||||
clad = openmc.Material(name='Clad', material_id=2)
|
||||
clad.set_density('macro', 1.0)
|
||||
clad.add_macroscopic(clad_data)
|
||||
if reps is None:
|
||||
reps = mgxs_reps
|
||||
|
||||
water_data = openmc.Macroscopic('lwtr_iso_mu')
|
||||
water = openmc.Material(name='LWTR', material_id=3)
|
||||
water.set_density('macro', 1.0)
|
||||
water.add_macroscopic(water_data)
|
||||
xs = []
|
||||
mats = []
|
||||
i = 0
|
||||
for mat in mat_names:
|
||||
for rep in reps:
|
||||
i += 1
|
||||
if as_macro:
|
||||
xs.append(openmc.Macroscopic(mat + '_' + rep))
|
||||
mats.append(openmc.Material(name=str(i)))
|
||||
mats[-1].set_density('macro', 1.)
|
||||
mats[-1].add_macroscopic(xs[-1])
|
||||
else:
|
||||
xs.append(openmc.Nuclide(mat + '_' + rep))
|
||||
mats.append(openmc.Material(name=str(i)))
|
||||
mats[-1].set_density('atom/b-cm', 1.)
|
||||
mats[-1].add_nuclide(xs[-1].name, 1.0, 'ao')
|
||||
|
||||
# Define the materials file.
|
||||
self.materials += (uo2, clad, water)
|
||||
self.xs_data = xs
|
||||
self.materials += mats
|
||||
|
||||
# Define surfaces.
|
||||
|
||||
# Assembly/Problem Boundary
|
||||
left = openmc.XPlane(x0=0.0, surface_id=200,
|
||||
boundary_type='reflective')
|
||||
right = openmc.XPlane(x0=10.0, surface_id=201,
|
||||
boundary_type='reflective')
|
||||
bottom = openmc.YPlane(y0=0.0, surface_id=300,
|
||||
boundary_type='reflective')
|
||||
top = openmc.YPlane(y0=10.0, surface_id=301,
|
||||
boundary_type='reflective')
|
||||
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 = 5. / float(len(mats))
|
||||
for i in range(len(mats) - 1):
|
||||
planes.append(openmc.ZPlane(z0=dz * (i + 1)))
|
||||
planes.append(openmc.ZPlane(z0=5.0, boundary_type='reflective'))
|
||||
|
||||
down = openmc.ZPlane(z0=0.0, surface_id=0,
|
||||
boundary_type='reflective')
|
||||
fuel_clad_intfc = openmc.ZPlane(z0=2.0, surface_id=1)
|
||||
clad_lwtr_intfc = openmc.ZPlane(z0=2.4, surface_id=2)
|
||||
up = openmc.ZPlane(z0=5.0, surface_id=3,
|
||||
boundary_type='reflective')
|
||||
|
||||
# Define cells
|
||||
c1 = openmc.Cell(cell_id=1)
|
||||
c1.region = +left & -right & +bottom & -top & +down & -fuel_clad_intfc
|
||||
c1.fill = uo2
|
||||
c2 = openmc.Cell(cell_id=2)
|
||||
c2.region = +left & -right & +bottom & -top & +fuel_clad_intfc & -clad_lwtr_intfc
|
||||
c2.fill = clad
|
||||
c3 = openmc.Cell(cell_id=3)
|
||||
c3.region = +left & -right & +bottom & -top & +clad_lwtr_intfc & -up
|
||||
c3.fill = water
|
||||
# Define cells for each material
|
||||
cells = []
|
||||
xy = +left & -right & +bottom & -top
|
||||
for i, mat in enumerate(mats):
|
||||
cells.append(openmc.Cell())
|
||||
cells[-1].region = xy & +planes[i] & -planes[i + 1]
|
||||
cells[-1].fill = mat
|
||||
|
||||
# Define root universe.
|
||||
root = openmc.Universe(universe_id=0, name='root universe')
|
||||
|
||||
root.add_cells((c1, c2, c3))
|
||||
root.add_cells(cells)
|
||||
|
||||
# Assign root universe to geometry
|
||||
self.geometry.root_universe = root
|
||||
|
|
@ -791,7 +790,7 @@ class MGInputSet(InputSet):
|
|||
self.settings.inactive = 5
|
||||
self.settings.particles = 100
|
||||
self.settings.source = Source(space=Box([0.0, 0.0, 0.0],
|
||||
[10.0, 10.0, 2.0]))
|
||||
[10.0, 10.0, 5.]))
|
||||
self.settings.energy_mode = "multi-group"
|
||||
self.settings.cross_sections = "../1d_mgxs.h5"
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
002fff0d8ba33340c9039f7650ece41bd26324d2e5c2816acc232adb298ae9dbd0873c5e28520df33ebe5af4c58e2ad338547ca337b2b42f53d255bff1ae314b
|
||||
c657f05432d9668f56e671a463ba08aed47103a33072d3f893146ff24fce6711ec41ba49c7d14a70b076cccb9a526375a4d8c1241e64e8167b8e0e876ae6655c
|
||||
|
|
@ -1,2 +1,2 @@
|
|||
k-combined:
|
||||
1.047136E+00 2.765964E-02
|
||||
1.034509E+00 4.099331E-02
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
8752d3167989d876c6f29b4b1ca7eed4b91793d8579c92de85633fd90235c67d63ee76d49081006047e0078f6f86eb6e3420c1f8fe44564e7a1fb62e828587d0
|
||||
b4adeb6b98d1d6310484c6623dde61ccfb02e0b8b9422c60d94cb65e556f3e2744c94cb3661a94aa365964acb463a6bd93cddf2dd954bfc36e316335b4a058f3
|
||||
|
|
@ -1,2 +1,2 @@
|
|||
k-combined:
|
||||
1.102093E+00 4.962190E-02
|
||||
1.099449E+00 1.956787E-02
|
||||
|
|
|
|||
|
|
@ -2,83 +2,26 @@
|
|||
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, os.pardir)
|
||||
from testing_harness import TestHarness, PyAPITestHarness
|
||||
from testing_harness import PyAPITestHarness
|
||||
from input_set import MGInputSet
|
||||
import openmc
|
||||
|
||||
class MGNuclideInputSet(MGInputSet):
|
||||
def build_default_materials_and_geometry(self):
|
||||
# Define materials needed for 1D/1G slab problem
|
||||
uo2_data = openmc.Macroscopic('uo2_iso')
|
||||
uo2 = openmc.Material(name='UO2', material_id=1)
|
||||
uo2.set_density('macro', 1.0)
|
||||
uo2.add_macroscopic(uo2_data)
|
||||
|
||||
clad_data = openmc.Macroscopic('clad_iso')
|
||||
clad = openmc.Material(name='Clad', material_id=2)
|
||||
clad.set_density('macro', 1.0)
|
||||
clad.add_macroscopic(clad_data)
|
||||
|
||||
water_data = openmc.Macroscopic('lwtr_iso')
|
||||
water = openmc.Material(name='LWTR', material_id=3)
|
||||
water.set_density('macro', 1.0)
|
||||
water.add_macroscopic(water_data)
|
||||
|
||||
# Define the materials file.
|
||||
self.materials += (uo2, clad, water)
|
||||
|
||||
# Define surfaces.
|
||||
|
||||
# Assembly/Problem Boundary
|
||||
left = openmc.XPlane(x0=0.0, surface_id=200,
|
||||
boundary_type='reflective')
|
||||
right = openmc.XPlane(x0=10.0, surface_id=201,
|
||||
boundary_type='reflective')
|
||||
bottom = openmc.YPlane(y0=0.0, surface_id=300,
|
||||
boundary_type='reflective')
|
||||
top = openmc.YPlane(y0=10.0, surface_id=301,
|
||||
boundary_type='reflective')
|
||||
|
||||
down = openmc.ZPlane(z0=0.0, surface_id=0,
|
||||
boundary_type='reflective')
|
||||
fuel_clad_intfc = openmc.ZPlane(z0=2.0, surface_id=1)
|
||||
clad_lwtr_intfc = openmc.ZPlane(z0=2.4, surface_id=2)
|
||||
up = openmc.ZPlane(z0=5.0, surface_id=3,
|
||||
boundary_type='reflective')
|
||||
|
||||
# Define cells
|
||||
c1 = openmc.Cell(cell_id=1)
|
||||
c1.region = +left & -right & +bottom & -top & +down & -fuel_clad_intfc
|
||||
c1.fill = uo2
|
||||
c2 = openmc.Cell(cell_id=2)
|
||||
c2.region = +left & -right & +bottom & -top & +fuel_clad_intfc & -clad_lwtr_intfc
|
||||
c2.fill = clad
|
||||
c3 = openmc.Cell(cell_id=3)
|
||||
c3.region = +left & -right & +bottom & -top & +clad_lwtr_intfc & -up
|
||||
c3.fill = water
|
||||
|
||||
# Define root universe.
|
||||
root = openmc.Universe(universe_id=0, name='root universe')
|
||||
|
||||
root.add_cells((c1,c2,c3))
|
||||
|
||||
# Define the geometry file.
|
||||
geometry = openmc.Geometry()
|
||||
geometry.root_universe = root
|
||||
|
||||
self.geometry = geometry
|
||||
|
||||
class MGMaxOrderTestHarness(PyAPITestHarness):
|
||||
def __init__(self, statepoint_name, tallies_present, mg=False):
|
||||
PyAPITestHarness.__init__(self, statepoint_name, tallies_present)
|
||||
self._input_set = MGNuclideInputSet()
|
||||
self._input_set = MGInputSet()
|
||||
|
||||
def _build_inputs(self):
|
||||
"""Write input XML files."""
|
||||
reps = ['iso']
|
||||
self._input_set.build_default_materials_and_geometry(reps=reps)
|
||||
self._input_set.build_default_settings()
|
||||
# Set P1 scattering
|
||||
self._input_set.settings.max_order = 1
|
||||
# Call standard input build
|
||||
super(MGMaxOrderTestHarness, self)._build_inputs()
|
||||
self._input_set.export()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
harness = MGMaxOrderTestHarness('statepoint.10.*', False, mg=True)
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
10b64fa97cc4feb1b1b8ba401b25b68ab682aba55ad4303a76a9a293ae79cdfff2f65d74310eb917da0aac243c24713d91eafae7ec5f0c4ae535d49fc928a869
|
||||
130e51d00cd4c00be14b4e722c285ef5725f7f7a25361f48524dc51bb70c0869149adb839199915fe6193273cb957414c073be2a9fda3ed03754967571b73f68
|
||||
|
|
@ -1,2 +1,2 @@
|
|||
k-combined:
|
||||
1.047136E+00 2.765964E-02
|
||||
1.034509E+00 4.099331E-02
|
||||
|
|
|
|||
|
|
@ -2,81 +2,22 @@
|
|||
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, os.pardir)
|
||||
from testing_harness import TestHarness, PyAPITestHarness
|
||||
from testing_harness import PyAPITestHarness
|
||||
from input_set import MGInputSet
|
||||
import openmc
|
||||
|
||||
class MGNuclideInputSet(MGInputSet):
|
||||
def build_default_materials_and_geometry(self):
|
||||
# Define materials needed for 1D/1G slab problem
|
||||
# This time do using nuclide, not macroscopic
|
||||
uo2 = openmc.Material(name='UO2', material_id=1)
|
||||
uo2.set_density('sum', 1.0)
|
||||
uo2.add_nuclide("uo2_iso", 1.0)
|
||||
|
||||
clad = openmc.Material(name='Clad', material_id=2)
|
||||
clad.set_density('sum', 1.0)
|
||||
clad.add_nuclide("clad_ang_mu", 1.0)
|
||||
|
||||
# water_data = openmc.Nuclide('lwtr_iso_mu', '71c')
|
||||
water = openmc.Material(name='LWTR', material_id=3)
|
||||
water.set_density('sum', 1.0)
|
||||
water.add_nuclide("lwtr_iso_mu", 1.0)
|
||||
|
||||
# Define the materials file.
|
||||
self.materials.default_xs = '71c'
|
||||
self.materials += (uo2, clad, water)
|
||||
|
||||
# Define surfaces.
|
||||
|
||||
# Assembly/Problem Boundary
|
||||
left = openmc.XPlane(x0=0.0, surface_id=200,
|
||||
boundary_type='reflective')
|
||||
right = openmc.XPlane(x0=10.0, surface_id=201,
|
||||
boundary_type='reflective')
|
||||
bottom = openmc.YPlane(y0=0.0, surface_id=300,
|
||||
boundary_type='reflective')
|
||||
top = openmc.YPlane(y0=10.0, surface_id=301,
|
||||
boundary_type='reflective')
|
||||
|
||||
down = openmc.ZPlane(z0=0.0, surface_id=0,
|
||||
boundary_type='reflective')
|
||||
fuel_clad_intfc = openmc.ZPlane(z0=2.0, surface_id=1)
|
||||
clad_lwtr_intfc = openmc.ZPlane(z0=2.4, surface_id=2)
|
||||
up = openmc.ZPlane(z0=5.0, surface_id=3,
|
||||
boundary_type='reflective')
|
||||
|
||||
# Define cells
|
||||
c1 = openmc.Cell(cell_id=1)
|
||||
c1.region = +left & -right & +bottom & -top & +down & -fuel_clad_intfc
|
||||
c1.fill = uo2
|
||||
c2 = openmc.Cell(cell_id=2)
|
||||
c2.region = +left & -right & +bottom & -top & +fuel_clad_intfc & -clad_lwtr_intfc
|
||||
c2.fill = clad
|
||||
c3 = openmc.Cell(cell_id=3)
|
||||
c3.region = +left & -right & +bottom & -top & +clad_lwtr_intfc & -up
|
||||
c3.fill = water
|
||||
|
||||
# Define root universe.
|
||||
root = openmc.Universe(universe_id=0, name='root universe')
|
||||
|
||||
root.add_cells((c1,c2,c3))
|
||||
|
||||
# Define the geometry file.
|
||||
geometry = openmc.Geometry()
|
||||
geometry.root_universe = root
|
||||
|
||||
self.geometry = geometry
|
||||
|
||||
class MGNuclideTestHarness(PyAPITestHarness):
|
||||
def __init__(self, statepoint_name, tallies_present, mg=False):
|
||||
PyAPITestHarness.__init__(self, statepoint_name, tallies_present)
|
||||
self._input_set = MGNuclideInputSet()
|
||||
self._input_set = MGInputSet()
|
||||
|
||||
def _build_inputs(self):
|
||||
super(MGNuclideTestHarness, self)._build_inputs()
|
||||
|
||||
"""Write input XML files."""
|
||||
self._input_set.build_default_materials_and_geometry(as_macro=False)
|
||||
self._input_set.build_default_settings()
|
||||
self._input_set.export()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
615fe0688980afc02bc11f41ac065b9479d2f6618acf6d20fcb91cd78209aed1d8fbaf73b06f153368a16aa90249d6d3ce06f840d9071a40b2118d36178fd84f
|
||||
051fcc001b79dc016d74e339348e75d1dab0338f3246643fb0032a928dd3660574543e23a6f428ee3b1b174e7e5a9aa64b27a795fa42c80068d13e98cf42a294
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -9,32 +9,66 @@ import openmc
|
|||
|
||||
class MGTalliesTestHarness(PyAPITestHarness):
|
||||
def _build_inputs(self):
|
||||
"""Write input XML files."""
|
||||
self._input_set.build_default_materials_and_geometry(as_macro=True)
|
||||
self._input_set.build_default_settings()
|
||||
|
||||
# Instantiate a tally mesh
|
||||
mesh = openmc.Mesh(mesh_id=1)
|
||||
mesh.type = 'regular'
|
||||
mesh.dimension = [17, 17, 1]
|
||||
mesh.dimension = [1, 1, 10]
|
||||
mesh.lower_left = [0.0, 0.0, 0.0]
|
||||
mesh.upper_right = [21.42, 21.42, 100.0]
|
||||
mesh.upper_right = [10, 10, 5]
|
||||
|
||||
# Instantiate some tally filters
|
||||
energy_filter = openmc.EnergyFilter([0.0, 20.0])
|
||||
energyout_filter = openmc.EnergyoutFilter([0.0, 20.0])
|
||||
mesh_filter = openmc.MeshFilter(mesh)
|
||||
|
||||
mat_filter = openmc.MaterialFilter([1,2,3])
|
||||
mat_ids = [mat.id for mat in self._input_set.materials]
|
||||
mat_filter = openmc.MaterialFilter(mat_ids)
|
||||
|
||||
tally1 = openmc.Tally(tally_id=1)
|
||||
tally1.filters = [mesh_filter]
|
||||
tally1.scores = ['total', 'absorption', 'flux',
|
||||
'fission', 'nu-fission']
|
||||
tallies = []
|
||||
|
||||
tally2 = openmc.Tally(tally_id=2)
|
||||
tally2.filters = [mat_filter, energy_filter, energyout_filter]
|
||||
tally2.scores = ['scatter', 'nu-scatter']
|
||||
tallies.append(openmc.Tally())
|
||||
tallies[-1].filters = [mesh_filter]
|
||||
tallies[-1].estimator = 'analog'
|
||||
tallies[-1].scores = ['total', 'absorption', 'flux',
|
||||
'fission', 'nu-fission']
|
||||
|
||||
self._input_set.tallies = openmc.Tallies([tally1, tally2])
|
||||
tallies.append(openmc.Tally())
|
||||
tallies[-1].filters = [mesh_filter]
|
||||
tallies[-1].estimator = 'tracklength'
|
||||
tallies[-1].scores = ['total', 'absorption', 'flux',
|
||||
'fission', 'nu-fission']
|
||||
|
||||
super(MGTalliesTestHarness, self)._build_inputs()
|
||||
tallies.append(openmc.Tally())
|
||||
tallies[-1].filters = [mat_filter, energy_filter]
|
||||
tallies[-1].estimator = 'analog'
|
||||
tallies[-1].scores = ['total', 'absorption', 'flux',
|
||||
'fission', 'nu-fission', 'scatter',
|
||||
'nu-scatter']
|
||||
|
||||
tallies.append(openmc.Tally())
|
||||
tallies[-1].filters = [mat_filter, energy_filter]
|
||||
tallies[-1].estimator = 'collision'
|
||||
tallies[-1].scores = ['total', 'absorption', 'flux',
|
||||
'fission', 'nu-fission']
|
||||
|
||||
tallies.append(openmc.Tally())
|
||||
tallies[-1].filters = [mat_filter, energy_filter]
|
||||
tallies[-1].estimator = 'tracklength'
|
||||
tallies[-1].scores = ['total', 'absorption', 'flux',
|
||||
'fission', 'nu-fission', 'scatter']
|
||||
|
||||
tallies.append(openmc.Tally())
|
||||
tallies[-1].filters = [mat_filter, energy_filter,
|
||||
energyout_filter]
|
||||
tallies[-1].scores = ['scatter', 'nu-scatter', 'nu-fission']
|
||||
|
||||
self._input_set.tallies = openmc.Tallies(tallies)
|
||||
|
||||
self._input_set.export()
|
||||
|
||||
def _cleanup(self):
|
||||
super(MGTalliesTestHarness, self)._cleanup()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue