mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 13:45:36 -04:00
Updated Python API MultiGroupXS.load_from_statepoint(...) to properly handle tally slicing of distribcell tallies
This commit is contained in:
parent
a0d1c3b7c5
commit
eb96e9dbdc
5 changed files with 50 additions and 568 deletions
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,11 @@
|
|||
====================================
|
||||
Multi-Group Cross Section Generation
|
||||
====================================
|
||||
|
||||
.. only:: html
|
||||
|
||||
.. notebook:: multi-group-cross-sections.ipynb
|
||||
|
||||
.. only:: latex
|
||||
|
||||
IPython notebooks must be viewed in the online HTML documentation.
|
||||
|
|
@ -65,6 +65,7 @@ on a given module or class.
|
|||
examples/post-processing
|
||||
examples/pandas-dataframes
|
||||
examples/tally-arithmetic
|
||||
examples/multi-group-cross-sections
|
||||
|
||||
.. _Jupyter: https://jupyter.org/
|
||||
.. _NumPy: http://www.numpy.org/
|
||||
|
|
|
|||
|
|
@ -441,14 +441,24 @@ class MultiGroupXS(object):
|
|||
# Create Tallies to search for in StatePoint
|
||||
self.create_tallies()
|
||||
|
||||
# Use tally "slicing" to ensure that tallies correspond to our domain
|
||||
# NOTE: This is important if tally merging was used
|
||||
if self.domain_type != 'distribcell':
|
||||
filters = [self.domain_type]
|
||||
filter_bins = [(self.domain.id,)]
|
||||
# Distribcell filters only accept single cell - neglect it when slicing
|
||||
else:
|
||||
filters = []
|
||||
filter_bins = []
|
||||
|
||||
# Find, slice and store Tallies from StatePoint
|
||||
# The tally slicing is needed if tally merging was used
|
||||
for tally_type, tally in self.tallies.items():
|
||||
sp_tally = statepoint.get_tally(tally.scores, tally.filters,
|
||||
tally.nuclides,
|
||||
estimator=tally.estimator)
|
||||
sp_tally = sp_tally.get_slice(tally.scores, [self.domain_type],
|
||||
[(self.domain.id,)], tally.nuclides)
|
||||
sp_tally = sp_tally.get_slice(tally.scores, filters,
|
||||
filter_bins, tally.nuclides)
|
||||
self.tallies[tally_type] = sp_tally
|
||||
|
||||
def get_xs(self, groups='all', subdomains='all', nuclides='all',
|
||||
|
|
|
|||
|
|
@ -2366,7 +2366,8 @@ class Tally(object):
|
|||
if filter_type in ['energy', 'energyout']:
|
||||
bin_indices.extend([bin_index, bin_index+1])
|
||||
elif filter_type == 'distribcell':
|
||||
bin_indices.append(0)
|
||||
indices = [(bin,) for bin in range(filter.num_bins)]
|
||||
bin_indices.extend(indices)
|
||||
else:
|
||||
bin_indices.append(bin_index)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue