mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 13:45:36 -04:00
Update test inputs
This commit is contained in:
parent
b9a5a069af
commit
de84f3989b
7 changed files with 46 additions and 46 deletions
|
|
@ -410,7 +410,10 @@ class StatePoint(object):
|
|||
subsubbase = '{0}{1}'.format(subbase, j)
|
||||
new_filter = openmc.Filter.from_hdf5(self._f[subsubbase])
|
||||
if isinstance(new_filter, openmc.MeshFilter):
|
||||
new_filter.mesh = self.meshes[new_filter.bins[0]]
|
||||
mesh_ids = self._f['tallies/meshes/ids'].value
|
||||
mesh_keys = self._f['tallies/meshes/keys'].value
|
||||
key = mesh_keys[mesh_ids == new_filter.bins[0]][0]
|
||||
new_filter.mesh = self.meshes[key]
|
||||
tally.filters.append(new_filter)
|
||||
|
||||
# Read Nuclide bins
|
||||
|
|
|
|||
|
|
@ -700,8 +700,8 @@ class Tally(object):
|
|||
return False
|
||||
|
||||
# Return False if only one tally has a delayed group filter
|
||||
tally1_dg = self.contains_filter('delayedgroup')
|
||||
tally2_dg = other.contains_filter('delayedgroup')
|
||||
tally1_dg = self.contains_filter(openmc.filter.DelayedGroupFilter)
|
||||
tally2_dg = other.contains_filter(openmc.filter.DelayedGroupFilter)
|
||||
if sum([tally1_dg, tally2_dg]) == 1:
|
||||
return False
|
||||
|
||||
|
|
@ -1070,8 +1070,8 @@ class Tally(object):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
filter_type : str
|
||||
Type of the filter, e.g. 'mesh'
|
||||
filter_type : openmc.filter.FilterMeta
|
||||
Type of the filter, e.g. MeshFilter
|
||||
|
||||
Returns
|
||||
-------
|
||||
|
|
@ -1085,7 +1085,7 @@ class Tally(object):
|
|||
|
||||
# Look through all of this Tally's Filters for the type requested
|
||||
for test_filter in self.filters:
|
||||
if test_filter.type == filter_type:
|
||||
if isinstance(test_filter, filter_type):
|
||||
filter_found = True
|
||||
break
|
||||
|
||||
|
|
@ -2869,9 +2869,9 @@ class Tally(object):
|
|||
scores : list of str
|
||||
A list of one or more score strings
|
||||
(e.g., ['absorption', 'nu-fission']; default is [])
|
||||
filters : list of str
|
||||
A list of filter type strings
|
||||
(e.g., ['mesh', 'energy']; default is [])
|
||||
filters : Iterable of openmc.filter.FilterMeta
|
||||
An iterable of filter types
|
||||
(e.g., [MeshFilter, EnergyFilter]; default is [])
|
||||
filter_bins : list of Iterables
|
||||
A list of tuples of filter bins corresponding to the filter_types
|
||||
parameter (e.g., [(1,), ((0., 0.625e-6),)]; default is []). Each
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class AsymmetricLatticeTestHarness(PyAPITestHarness):
|
|||
self._input_set.geometry.root_universe = root_univ
|
||||
|
||||
# Initialize a "distribcell" filter for the fuel pin cell
|
||||
distrib_filter = openmc.Filter(type='distribcell', bins=[27])
|
||||
distrib_filter = openmc.DistribcellFilter(27)
|
||||
|
||||
# Initialize the tallies
|
||||
tally = openmc.Tally(name='distribcell tally', tally_id=27)
|
||||
|
|
|
|||
|
|
@ -17,14 +17,12 @@ class MGTalliesTestHarness(PyAPITestHarness):
|
|||
mesh.upper_right = [21.42, 21.42, 100.0]
|
||||
|
||||
# Instantiate some tally filters
|
||||
energy_filter = openmc.Filter(type='energy',
|
||||
bins=[0.0, 20.0])
|
||||
energyout_filter = openmc.Filter(type='energyout',
|
||||
bins=[0.0, 20.0])
|
||||
mesh_filter = openmc.Filter()
|
||||
energy_filter = openmc.EnergyFilter([0.0, 20.0])
|
||||
energyout_filter = openmc.EnergyoutFilter([0.0, 20.0])
|
||||
mesh_filter = openmc.MeshFilter(mesh.id)
|
||||
mesh_filter.mesh = mesh
|
||||
|
||||
mat_filter = openmc.Filter(type='material', bins=[1,2,3])
|
||||
mat_filter = openmc.MaterialFilter([1,2,3])
|
||||
|
||||
tally1 = openmc.Tally(tally_id=1)
|
||||
tally1.filters = [mesh_filter]
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@ import os
|
|||
import sys
|
||||
sys.path.insert(0, os.pardir)
|
||||
from testing_harness import PyAPITestHarness
|
||||
from openmc import Filter, Mesh, Tally, Tallies
|
||||
from openmc.filter import *
|
||||
from openmc import Mesh, Tally, Tallies
|
||||
from openmc.source import Source
|
||||
from openmc.stats import Box
|
||||
|
||||
|
|
@ -21,7 +22,7 @@ class TalliesTestHarness(PyAPITestHarness):
|
|||
[-160, -160, -183], [160, 160, 183]))
|
||||
|
||||
azimuthal_bins = (-3.1416, -1.8850, -0.6283, 0.6283, 1.8850, 3.1416)
|
||||
azimuthal_filter1 = Filter(type='azimuthal', bins=azimuthal_bins)
|
||||
azimuthal_filter1 = AzimuthalFilter(azimuthal_bins)
|
||||
azimuthal_tally1 = Tally()
|
||||
azimuthal_tally1.filters = [azimuthal_filter1]
|
||||
azimuthal_tally1.scores = ['flux']
|
||||
|
|
@ -32,7 +33,7 @@ class TalliesTestHarness(PyAPITestHarness):
|
|||
azimuthal_tally2.scores = ['flux']
|
||||
azimuthal_tally2.estimator = 'analog'
|
||||
|
||||
azimuthal_filter2 = Filter(type='azimuthal', bins=(5,))
|
||||
azimuthal_filter2 = AzimuthalFilter(5)
|
||||
azimuthal_tally3 = Tally()
|
||||
azimuthal_tally3.filters = [azimuthal_filter2]
|
||||
azimuthal_tally3.scores = ['flux']
|
||||
|
|
@ -42,7 +43,7 @@ class TalliesTestHarness(PyAPITestHarness):
|
|||
mesh_2x2.lower_left = [-182.07, -182.07]
|
||||
mesh_2x2.upper_right = [182.07, 182.07]
|
||||
mesh_2x2.dimension = [2, 2]
|
||||
mesh_filter = Filter(type='mesh')
|
||||
mesh_filter = MeshFilter(mesh_2x2.id)
|
||||
mesh_filter.mesh = mesh_2x2
|
||||
azimuthal_tally4 = Tally()
|
||||
azimuthal_tally4.filters = [azimuthal_filter2, mesh_filter]
|
||||
|
|
@ -50,20 +51,20 @@ class TalliesTestHarness(PyAPITestHarness):
|
|||
azimuthal_tally4.estimator = 'tracklength'
|
||||
|
||||
cellborn_tally = Tally()
|
||||
cellborn_tally.filters = [Filter(type='cellborn', bins=(10, 21, 22, 23))]
|
||||
cellborn_tally.filters = [CellbornFilter((10, 21, 22, 23))]
|
||||
cellborn_tally.scores = ['total']
|
||||
|
||||
dg_tally = Tally()
|
||||
dg_tally.filters = [Filter(type='delayedgroup', bins=(1, 2, 3, 4, 5, 6))]
|
||||
dg_tally.filters = [DelayedGroupFilter((1, 2, 3, 4, 5, 6))]
|
||||
dg_tally.scores = ['delayed-nu-fission']
|
||||
|
||||
four_groups = (0.0, 0.253e-6, 1.0e-3, 1.0, 20.0)
|
||||
energy_filter = Filter(type='energy', bins=four_groups)
|
||||
energy_filter = EnergyFilter(four_groups)
|
||||
energy_tally = Tally()
|
||||
energy_tally.filters = [energy_filter]
|
||||
energy_tally.scores = ['total']
|
||||
|
||||
energyout_filter = Filter(type='energyout', bins=four_groups)
|
||||
energyout_filter = EnergyoutFilter(four_groups)
|
||||
energyout_tally = Tally()
|
||||
energyout_tally.filters = [energyout_filter]
|
||||
energyout_tally.scores = ['scatter']
|
||||
|
|
@ -73,14 +74,14 @@ class TalliesTestHarness(PyAPITestHarness):
|
|||
transfer_tally.scores = ['scatter', 'nu-fission']
|
||||
|
||||
material_tally = Tally()
|
||||
material_tally.filters = [Filter(type='material', bins=(1, 2, 3, 4))]
|
||||
material_tally.filters = [MaterialFilter((1, 2, 3, 4))]
|
||||
material_tally.scores = ['total']
|
||||
|
||||
mu_tally1 = Tally()
|
||||
mu_tally1.filters = [Filter(type='mu', bins=(-1.0, -0.5, 0.0, 0.5, 1.0))]
|
||||
mu_tally1.filters = [MuFilter((-1.0, -0.5, 0.0, 0.5, 1.0))]
|
||||
mu_tally1.scores = ['scatter', 'nu-scatter']
|
||||
|
||||
mu_filter = Filter(type='mu', bins=(5,))
|
||||
mu_filter = MuFilter(5)
|
||||
mu_tally2 = Tally()
|
||||
mu_tally2.filters = [mu_filter]
|
||||
mu_tally2.scores = ['scatter', 'nu-scatter']
|
||||
|
|
@ -90,7 +91,7 @@ class TalliesTestHarness(PyAPITestHarness):
|
|||
mu_tally3.scores = ['scatter', 'nu-scatter']
|
||||
|
||||
polar_bins = (0.0, 0.6283, 1.2566, 1.8850, 2.5132, 3.1416)
|
||||
polar_filter = Filter(type='polar', bins=polar_bins)
|
||||
polar_filter = PolarFilter(polar_bins)
|
||||
polar_tally1 = Tally()
|
||||
polar_tally1.filters = [polar_filter]
|
||||
polar_tally1.scores = ['flux']
|
||||
|
|
@ -101,7 +102,7 @@ class TalliesTestHarness(PyAPITestHarness):
|
|||
polar_tally2.scores = ['flux']
|
||||
polar_tally2.estimator = 'analog'
|
||||
|
||||
polar_filter2 = Filter(type='polar', bins=(5,))
|
||||
polar_filter2 = PolarFilter((5,))
|
||||
polar_tally3 = Tally()
|
||||
polar_tally3.filters = [polar_filter2]
|
||||
polar_tally3.scores = ['flux']
|
||||
|
|
@ -113,11 +114,10 @@ class TalliesTestHarness(PyAPITestHarness):
|
|||
polar_tally4.estimator = 'tracklength'
|
||||
|
||||
universe_tally = Tally()
|
||||
universe_tally.filters = [
|
||||
Filter(type='universe', bins=(1, 2, 3, 4, 6, 8))]
|
||||
universe_tally.filters = [UniverseFilter((1, 2, 3, 4, 6, 8))]
|
||||
universe_tally.scores = ['total']
|
||||
|
||||
cell_filter = Filter(type='cell', bins=(10, 21, 22, 23, 60))
|
||||
cell_filter = CellFilter((10, 21, 22, 23, 60))
|
||||
score_tallies = [Tally(), Tally(), Tally()]
|
||||
for t in score_tallies:
|
||||
t.filters = [cell_filter]
|
||||
|
|
@ -130,7 +130,7 @@ class TalliesTestHarness(PyAPITestHarness):
|
|||
score_tallies[1].estimator = 'analog'
|
||||
score_tallies[2].estimator = 'collision'
|
||||
|
||||
cell_filter2 = Filter(type='cell', bins=(21, 22, 23, 27, 28, 29, 60))
|
||||
cell_filter2 = CellFilter((21, 22, 23, 27, 28, 29, 60))
|
||||
flux_tallies = [Tally() for i in range(4)]
|
||||
for t in flux_tallies:
|
||||
t.filters = [cell_filter2]
|
||||
|
|
|
|||
|
|
@ -31,11 +31,10 @@ class TallyArithmeticTestHarness(PyAPITestHarness):
|
|||
mesh.upper_right = [160.0, 160.0, 183.0]
|
||||
|
||||
# Initialize the filters
|
||||
energy_filter = openmc.Filter(type='energy', bins=(0.0, 0.253e-6,
|
||||
1.0e-3, 1.0, 20.0))
|
||||
material_filter = openmc.Filter(type='material', bins=(1, 3))
|
||||
distrib_filter = openmc.Filter(type='distribcell', bins=(60))
|
||||
mesh_filter = openmc.Filter(type='mesh')
|
||||
energy_filter = openmc.EnergyFilter((0.0, 0.253e-6, 1.0e-3, 1.0, 20.0))
|
||||
material_filter = openmc.MaterialFilter((1, 3))
|
||||
distrib_filter = openmc.DistribcellFilter(60)
|
||||
mesh_filter = openmc.MeshFilter(mesh.id)
|
||||
mesh_filter.mesh = mesh
|
||||
|
||||
# Initialized the tallies
|
||||
|
|
|
|||
|
|
@ -27,20 +27,20 @@ class TallySliceMergeTestHarness(PyAPITestHarness):
|
|||
|
||||
# Define filters for energy and spatial domain
|
||||
|
||||
low_energy = openmc.Filter(type='energy', bins=[0., 0.625e-6])
|
||||
high_energy = openmc.Filter(type='energy', bins=[0.625e-6, 20.])
|
||||
low_energy = openmc.EnergyFilter([0., 0.625e-6])
|
||||
high_energy = openmc.EnergyFilter([0.625e-6, 20.])
|
||||
merged_energies = low_energy.merge(high_energy)
|
||||
|
||||
cell_21 = openmc.Filter(type='cell', bins=[21])
|
||||
cell_27 = openmc.Filter(type='cell', bins=[27])
|
||||
distribcell_filter = openmc.Filter(type='distribcell', bins=[21])
|
||||
cell_21 = openmc.CellFilter(21)
|
||||
cell_27 = openmc.CellFilter(27)
|
||||
distribcell_filter = openmc.DistribcellFilter(21)
|
||||
|
||||
mesh = openmc.Mesh(name='mesh')
|
||||
mesh.type = 'regular'
|
||||
mesh.dimension = [2, 2]
|
||||
mesh.lower_left = [-50., -50.]
|
||||
mesh.upper_right = [+50., +50.]
|
||||
mesh_filter = openmc.Filter(type='mesh', bins=[mesh.id])
|
||||
mesh_filter = openmc.MeshFilter(mesh.id)
|
||||
mesh_filter.mesh = mesh
|
||||
|
||||
self.cell_filters = [cell_21, cell_27]
|
||||
|
|
@ -105,12 +105,12 @@ class TallySliceMergeTestHarness(PyAPITestHarness):
|
|||
|
||||
# Slice the tallies by cell filter bins
|
||||
cell_filter_prod = itertools.product(tallies, self.cell_filters)
|
||||
tallies = map(lambda tf: tf[0].get_slice(filters=[tf[1].type],
|
||||
tallies = map(lambda tf: tf[0].get_slice(filters=[type(tf[1])],
|
||||
filter_bins=[tf[1].get_bin(0)]), cell_filter_prod)
|
||||
|
||||
# Slice the tallies by energy filter bins
|
||||
energy_filter_prod = itertools.product(tallies, self.energy_filters)
|
||||
tallies = map(lambda tf: tf[0].get_slice(filters=[tf[1].type],
|
||||
tallies = map(lambda tf: tf[0].get_slice(filters=[type(tf[1])],
|
||||
filter_bins=[(tf[1].get_bin(0),)]), energy_filter_prod)
|
||||
|
||||
# Slice the tallies by nuclide
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue