Finalized check for mesh & made progress on regression test

I had to put domain properties back into the SurfaceMGXS class to perform a checktype on the domain_type.
I updated the regression test mgxs_library_mesh to expect the correct input.
However, now the test fails for a 2-dimensional mesh. In 3D, the Current MGXS fails because it does not contain a 'z' dimension.
Meanwhile, all the other classes contain a 'z' dimension, equal to 1.
I need to figure out why the mesh used by SurfaceMGXS doesn't contain the same information as the other classes, even though it is the same mesh used in all.
This commit is contained in:
Miriam 2020-07-19 04:40:31 +00:00
parent 43456ea2d6
commit 676bcefb1e
2 changed files with 58 additions and 38 deletions

View file

@ -1964,6 +1964,7 @@ class MGXS:
# energy groups such that data is from fast to thermal
if self.domain_type == 'mesh':
mesh_str = 'mesh {0}'.format(self.domain.id)
print("HELLO WORLD", mesh_str)
df.sort_values(by=[(mesh_str, 'x'), (mesh_str, 'y'),
(mesh_str, 'z')] + columns, inplace=True)
else:
@ -5979,16 +5980,33 @@ class SurfaceMGXS(MGXS):
by_nuclide, name)
self._estimator = ['analog']
self._valid_estimators = ['analog']
if domain_type != 'mesh':
msg = 'Unable to compute a SurfaceMGXS for domain type {0} ' \
'which is not a mesh type'.format(domain_type)
raise ValueError(msg)
@property
def scores(self):
return [self.rxn_type]
@property
def domain(self):
return self._domain
@property
def domain_type(self):
return self._domain_type
@domain.setter
def domain(self, domain):
cv.check_type('domain', domain, openmc.RegularMesh)
self._domain = domain
# Assign a domain type
if self.domain_type is None:
self._domain_type = 'mesh'
@domain_type.setter
def domain_type(self, domain_type):
cv.check_value('domain type', domain_type, 'mesh')
self._domain_type = domain_type
@property
def filters(self):
group_edges = self.energy_groups.group_edges
@ -6036,18 +6054,8 @@ class SurfaceMGXS(MGXS):
'linked with a summary file'
raise ValueError(msg)
# Use tally "slicing" to ensure that tallies correspond to our domain
# NOTE: This is important if tally merging was used
if self.domain_type == 'mesh':
filters = []
filter_bins = []
elif self.domain_type != 'distribcell':
filters = [_DOMAIN_TO_FILTER[self.domain_type]]
filter_bins = [(self.domain.id,)]
# Distribcell filters only accept single cell - neglect it when slicing
else:
filters = []
filter_bins = []
filters= []
filter_bins = []
# Clear any tallies previously loaded from a statepoint
if self.loaded_sp:
@ -6126,6 +6134,9 @@ class SurfaceMGXS(MGXS):
subdomain_bins.append(subdomain)
filter_bins.append(tuple(subdomain_bins))
xs = self.xs_tally.get_values(filters=filters,
filter_bins=filter_bins, value=value)
# Construct list of energy group bounds tuples for all requested groups
if not isinstance(groups, str):
cv.check_iterable_type('groups', groups, Integral)

View file

@ -53,7 +53,10 @@
<filter id="28" type="legendre">
<order>3</order>
</filter>
<filter id="65" type="delayedgroup">
<filter id="66" type="meshsurface">
<bins>1</bins>
</filter>
<filter id="69" type="delayedgroup">
<bins>1 2 3 4 5 6</bins>
</filter>
<tally id="1">
@ -363,61 +366,67 @@
<estimator>analog</estimator>
</tally>
<tally id="52">
<filters>66 2</filters>
<nuclides>total</nuclides>
<scores>current</scores>
<estimator>analog</estimator>
</tally>
<tally id="53">
<filters>1 2</filters>
<nuclides>total</nuclides>
<scores>flux</scores>
<estimator>tracklength</estimator>
</tally>
<tally id="53">
<filters>1 65 2</filters>
<tally id="54">
<filters>1 69 2</filters>
<nuclides>total</nuclides>
<scores>delayed-nu-fission</scores>
<estimator>tracklength</estimator>
</tally>
<tally id="54">
<filters>1 65 2</filters>
<nuclides>total</nuclides>
<scores>delayed-nu-fission</scores>
<estimator>analog</estimator>
</tally>
<tally id="55">
<filters>1 65 5</filters>
<filters>1 69 2</filters>
<nuclides>total</nuclides>
<scores>delayed-nu-fission</scores>
<estimator>analog</estimator>
</tally>
<tally id="56">
<filters>1 69 5</filters>
<nuclides>total</nuclides>
<scores>delayed-nu-fission</scores>
<estimator>analog</estimator>
</tally>
<tally id="57">
<filters>1 2</filters>
<nuclides>total</nuclides>
<scores>nu-fission</scores>
<estimator>tracklength</estimator>
</tally>
<tally id="57">
<filters>1 65 2</filters>
<nuclides>total</nuclides>
<scores>delayed-nu-fission</scores>
<estimator>tracklength</estimator>
</tally>
<tally id="58">
<filters>1 65 2</filters>
<filters>1 69 2</filters>
<nuclides>total</nuclides>
<scores>delayed-nu-fission</scores>
<estimator>tracklength</estimator>
</tally>
<tally id="59">
<filters>1 65 2</filters>
<filters>1 69 2</filters>
<nuclides>total</nuclides>
<scores>delayed-nu-fission</scores>
<estimator>tracklength</estimator>
</tally>
<tally id="60">
<filters>1 69 2</filters>
<nuclides>total</nuclides>
<scores>decay-rate</scores>
<estimator>tracklength</estimator>
</tally>
<tally id="60">
<tally id="61">
<filters>1 2</filters>
<nuclides>total</nuclides>
<scores>flux</scores>
<estimator>analog</estimator>
</tally>
<tally id="61">
<filters>1 65 2 5</filters>
<tally id="62">
<filters>1 69 2 5</filters>
<nuclides>total</nuclides>
<scores>delayed-nu-fission</scores>
<estimator>analog</estimator>