mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Distribcell paths now handled by StatePoint.link_with_summary(...) routine in Python API
This commit is contained in:
parent
d3e786e46e
commit
67f9cfe1c7
4 changed files with 33 additions and 5 deletions
|
|
@ -45,6 +45,9 @@ class Filter(object):
|
|||
stride : Integral
|
||||
The number of filter, nuclide and score bins within each of this
|
||||
filter's bins.
|
||||
distribcell_paths : list of str
|
||||
The paths traversed through the CSG tree to reach each distribcell
|
||||
instance (for 'distribcell' filters only)
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -56,6 +59,7 @@ class Filter(object):
|
|||
self._bins = None
|
||||
self._mesh = None
|
||||
self._stride = None
|
||||
self._distribcell_paths = None
|
||||
|
||||
if type is not None:
|
||||
self.type = type
|
||||
|
|
@ -152,6 +156,10 @@ class Filter(object):
|
|||
def stride(self):
|
||||
return self._stride
|
||||
|
||||
@property
|
||||
def distribcell_paths(self):
|
||||
return self._distribcell_paths
|
||||
|
||||
@type.setter
|
||||
def type(self, type):
|
||||
if type is None:
|
||||
|
|
@ -246,6 +254,11 @@ class Filter(object):
|
|||
|
||||
self._stride = stride
|
||||
|
||||
@distribcell_paths.setter
|
||||
def distribcell_paths(self, distribcell_paths):
|
||||
cv.check_iterable_type('distribcell_paths', distribcell_paths, str)
|
||||
self._distribcell_paths = distribcell_paths
|
||||
|
||||
def can_merge(self, other):
|
||||
"""Determine if filter can be merged with another.
|
||||
|
||||
|
|
|
|||
|
|
@ -609,11 +609,13 @@ class StatePoint(object):
|
|||
raise ValueError(msg)
|
||||
|
||||
for tally_id, tally in self.tallies.items():
|
||||
# Get the Tally name from the summary file
|
||||
tally.name = summary.tallies[tally_id].name
|
||||
summary_tally = summary.tallies[tally_id]
|
||||
tally.name = summary_tally.name
|
||||
tally.with_summary = True
|
||||
|
||||
for tally_filter in tally.filters:
|
||||
summary_filter = summary_tally.find_filter(tally_filter.type)
|
||||
|
||||
if tally_filter.type == 'surface':
|
||||
surface_ids = []
|
||||
for bin in tally_filter.bins:
|
||||
|
|
@ -626,6 +628,10 @@ class StatePoint(object):
|
|||
distribcell_ids.append(summary.cells[bin].id)
|
||||
tally_filter.bins = distribcell_ids
|
||||
|
||||
if tally_filter.type == 'distribcell':
|
||||
tally_filter.distribcell_paths = \
|
||||
summary_filter.distribcell_paths
|
||||
|
||||
if tally_filter.type == 'universe':
|
||||
universe_ids = []
|
||||
for bin in tally_filter.bins:
|
||||
|
|
|
|||
|
|
@ -562,6 +562,11 @@ class Summary(object):
|
|||
new_filter = openmc.Filter(filter_type, bins)
|
||||
new_filter.num_bins = num_bins
|
||||
|
||||
# Read in distribcell paths
|
||||
if filter_type == 'distribcell':
|
||||
new_filter.distribcell_paths = \
|
||||
self._f['{0}/paths'.format(subsubbase)][...]
|
||||
|
||||
# Add Filter to the Tally
|
||||
tally.filters.append(new_filter)
|
||||
|
||||
|
|
|
|||
|
|
@ -595,11 +595,15 @@ contains
|
|||
t%filters(j)%type == FILTER_POLAR .or. &
|
||||
t%filters(j)%type == FILTER_AZIMUTHAL) then
|
||||
call write_dataset(filter_group, "bins", t%filters(j)%real_bins)
|
||||
else
|
||||
call write_dataset(filter_group, "bins", t%filters(j)%int_bins)
|
||||
end if
|
||||
|
||||
! Write paths to reach each distribcell instance
|
||||
else if (t%filters(j)%type == FILTER_DISTRIBCELL) then
|
||||
if (t%filters(j)%type == FILTER_DISTRIBCELL) then
|
||||
! Allocate array of strings for each distribcell path
|
||||
allocate(paths(t % filters(j) % n_bins))
|
||||
|
||||
! Store path for each distribcell instance
|
||||
do k = 1, t % filters(j) % n_bins
|
||||
path = ''
|
||||
|
|
@ -608,10 +612,10 @@ contains
|
|||
universes(BASE_UNIVERSE), k, offset, path)
|
||||
paths(k) = path
|
||||
end do
|
||||
|
||||
! Write array of distribcell paths to summary file
|
||||
call write_dataset(filter_group, "paths", paths)
|
||||
deallocate(paths)
|
||||
else
|
||||
call write_dataset(filter_group, "bins", t%filters(j)%int_bins)
|
||||
end if
|
||||
|
||||
! Write name of type
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue