some cleaning up

This commit is contained in:
Adam Nelson 2016-08-06 06:59:17 -04:00
parent 2025306f9a
commit 5c6280b206
2 changed files with 31 additions and 55 deletions

View file

@ -866,49 +866,57 @@ class Library(object):
xsdata.zaid = self._nuclides[nuclide][0]
xsdata.awr = self._nuclides[nuclide][1]
if subdomain is None:
subdomain_val = 'all'
else:
subdomain_val = [subdomain]
# Now get xs data itself
if 'nu-transport' in self.mgxs_types and self.correction == 'P0':
mymgxs = self.get_mgxs(domain, 'nu-transport')
xsdata.set_total_mgxs(mymgxs, xs_type=xs_type, nuclide=[nuclide])
xsdata.set_total_mgxs(mymgxs, xs_type=xs_type, nuclide=[nuclide],
subdomains=subdomain_val)
elif 'total' in self.mgxs_types:
mymgxs = self.get_mgxs(domain, 'total')
xsdata.set_total_mgxs(mymgxs, xs_type=xs_type, nuclide=[nuclide],
subdomain=subdomain)
subdomain=subdomain_val)
if 'absorption' in self.mgxs_types:
mymgxs = self.get_mgxs(domain, 'absorption')
xsdata.set_absorption_mgxs(mymgxs, xs_type=xs_type,
nuclide=[nuclide], subdomain=subdomain)
nuclide=[nuclide],
subdomain=subdomain_val)
if 'fission' in self.mgxs_types:
mymgxs = self.get_mgxs(domain, 'fission')
xsdata.set_fission_mgxs(mymgxs, xs_type=xs_type,
nuclide=[nuclide], subdomain=subdomain)
nuclide=[nuclide], subdomain=subdomain_val)
if 'kappa-fission' in self.mgxs_types:
mymgxs = self.get_mgxs(domain, 'kappa-fission')
xsdata.set_kappa_fission_mgxs(mymgxs, xs_type=xs_type,
nuclide=[nuclide],
subdomain=subdomain)
subdomain=subdomain_val)
# For chi and nu-fission we can either have only a nu-fission matrix
# provided, or vectors of chi and nu-fission provided
if 'nu-fission matrix' in self.mgxs_types:
mymgxs = self.get_mgxs(domain, 'nu-fission matrix')
xsdata.set_nu_fission_mgxs(mymgxs, xs_type=xs_type,
nuclide=[nuclide], subdomain=subdomain)
nuclide=[nuclide],
subdomain=subdomain_val)
else:
if 'chi' in self.mgxs_types:
mymgxs = self.get_mgxs(domain, 'chi')
xsdata.set_chi_mgxs(mymgxs, xs_type=xs_type, nuclide=[nuclide],
subdomain=subdomain)
subdomain=subdomain_val)
if 'nu-fission' in self.mgxs_types:
mymgxs = self.get_mgxs(domain, 'nu-fission')
xsdata.set_nu_fission_mgxs(mymgxs, xs_type=xs_type,
nuclide=[nuclide],
subdomain=subdomain)
subdomain=subdomain_val)
# If multiplicity matrix is available, prefer that
if 'multiplicity matrix' in self.mgxs_types:
mymgxs = self.get_mgxs(domain, 'multiplicity matrix')
xsdata.set_multiplicity_mgxs(mymgxs, xs_type=xs_type,
nuclide=[nuclide],
subdomain=subdomain)
subdomain=subdomain_val)
using_multiplicity = True
# multiplicity wil fall back to using scatter and nu-scatter
elif ((('scatter matrix' in self.mgxs_types) and
@ -917,7 +925,7 @@ class Library(object):
nuscatt_mgxs = self.get_mgxs(domain, 'nu-scatter matrix')
xsdata.set_multiplicity_mgxs(nuscatt_mgxs, scatt_mgxs,
xs_type=xs_type, nuclide=[nuclide],
subdomain=subdomain)
subdomain=subdomain_val)
using_multiplicity = True
else:
using_multiplicity = False
@ -925,12 +933,13 @@ class Library(object):
if using_multiplicity:
nuscatt_mgxs = self.get_mgxs(domain, 'nu-scatter matrix')
xsdata.set_scatter_mgxs(nuscatt_mgxs, xs_type=xs_type,
nuclide=[nuclide], subdomain=subdomain)
nuclide=[nuclide], subdomain=subdomain_val)
else:
if 'nu-scatter matrix' in self.mgxs_types:
nuscatt_mgxs = self.get_mgxs(domain, 'nu-scatter matrix')
xsdata.set_scatter_mgxs(nuscatt_mgxs, xs_type=xs_type,
nuclide=[nuclide], subdomain=subdomain)
nuclide=[nuclide],
subdomain=subdomain_val)
# Since we are not using multiplicity, then
# scattering multiplication (nu-scatter) must be

View file

@ -604,7 +604,7 @@ class XSdata(object):
self._fissionable = True
def set_total_mgxs(self, total, nuclide='total', xs_type='macro',
subdomain=None):
subdomain='all'):
"""This method allows for an openmc.mgxs.TotalXS or
openmc.mgxs.TransportXS to be used to set the total cross section
for this XSdata object.
@ -636,14 +636,10 @@ class XSdata(object):
check_value('energy_groups', total.energy_groups, [self.energy_groups])
check_value('domain_type', total.domain_type,
['universe', 'cell', 'material', 'mesh'])
if subdomain is None:
subdomain_val = None
else:
subdomain_val = [subdomain]
if self.representation is 'isotropic':
self._total = total.get_xs(nuclides=nuclide, xs_type=xs_type,
subdomains=subdomain_val)
subdomains=subdomain)
elif self.representation is 'angle':
msg = 'Angular-Dependent MGXS have not yet been implemented'
raise ValueError(msg)
@ -680,15 +676,11 @@ class XSdata(object):
[self.energy_groups])
check_value('domain_type', absorption.domain_type,
['universe', 'cell', 'material', 'mesh'])
if subdomain is None:
subdomain_val = None
else:
subdomain_val = [subdomain]
if self.representation is 'isotropic':
self._absorption = absorption.get_xs(nuclides=nuclide,
xs_type=xs_type,
subdomains=subdomain_val)
subdomains=subdomain)
elif self.representation is 'angle':
msg = 'Angular-Dependent MGXS have not yet been implemented'
raise ValueError(msg)
@ -725,15 +717,11 @@ class XSdata(object):
[self.energy_groups])
check_value('domain_type', fission.domain_type,
['universe', 'cell', 'material', 'mesh'])
if subdomain is None:
subdomain_val = None
else:
subdomain_val = [subdomain]
if self.representation is 'isotropic':
self._fission = fission.get_xs(nuclides=nuclide,
xs_type=xs_type,
subdomains=subdomain_val)
subdomains=subdomain)
elif self.representation is 'angle':
msg = 'Angular-Dependent MGXS have not yet been implemented'
raise ValueError(msg)
@ -771,15 +759,11 @@ class XSdata(object):
[self.energy_groups])
check_value('domain_type', nu_fission.domain_type,
['universe', 'cell', 'material', 'mesh'])
if subdomain is None:
subdomain_val = None
else:
subdomain_val = [subdomain]
if self.representation is 'isotropic':
self._nu_fission = nu_fission.get_xs(nuclides=nuclide,
xs_type=xs_type,
subdomains=subdomain_val)
subdomains=subdomain)
elif self.representation is 'angle':
msg = 'Angular-Dependent MGXS have not yet been implemented'
raise ValueError(msg)
@ -825,15 +809,11 @@ class XSdata(object):
[self.energy_groups])
check_value('domain_type', k_fission.domain_type,
['universe', 'cell', 'material', 'mesh'])
if subdomain is None:
subdomain_val = None
else:
subdomain_val = [subdomain]
if self.representation is 'isotropic':
self._kappa_fission = k_fission.get_xs(nuclides=nuclide,
xs_type=xs_type,
subdomains=subdomain_val)
subdomains=subdomain)
elif self.representation is 'angle':
msg = 'Angular-Dependent MGXS have not yet been implemented'
raise ValueError(msg)
@ -874,14 +854,10 @@ class XSdata(object):
check_value('energy_groups', chi.energy_groups, [self.energy_groups])
check_value('domain_type', chi.domain_type,
['universe', 'cell', 'material', 'mesh'])
if subdomain is None:
subdomain_val = None
else:
subdomain_val = [subdomain]
if self.representation is 'isotropic':
self._chi = chi.get_xs(nuclides=nuclide,
xs_type=xs_type, subdomains=subdomain_val)
xs_type=xs_type, subdomains=subdomain)
elif self.representation is 'angle':
msg = 'Angular-Dependent MGXS have not yet been implemented'
raise ValueError(msg)
@ -940,11 +916,6 @@ class XSdata(object):
check_value('legendre_order', scatter.legendre_order,
[self.order])
if subdomain is None:
subdomain_val = None
else:
subdomain_val = [subdomain]
if self.representation is 'isotropic':
# Get the scattering orders in the outermost dimension
self._scatter = np.zeros((self.num_orders,
@ -953,7 +924,7 @@ class XSdata(object):
for moment in range(self.num_orders):
self._scatter[moment, :, :] = \
scatter.get_xs(nuclides=nuclide, xs_type=xs_type,
moment=moment, subdomains=subdomain_val)
moment=moment, subdomains=subdomain)
elif self.representation is 'angle':
msg = 'Angular-Dependent MGXS have not yet been implemented'
@ -1013,21 +984,17 @@ class XSdata(object):
[self.energy_groups])
check_value('domain_type', scatter.domain_type,
['universe', 'cell', 'material', 'mesh'])
if subdomain is None:
subdomain_val = None
else:
subdomain_val = [subdomain]
if self.representation is 'isotropic':
nuscatt = nuscatter.get_xs(nuclides=nuclide,
xs_type=xs_type, moment=0,
subdomains=subdomain_val)
subdomains=subdomain)
if isinstance(nuscatter, openmc.mgxs.MultiplicityMatrixXS):
self._multiplicity = nuscatt
else:
scatt = scatter.get_xs(nuclides=nuclide,
xs_type=xs_type, moment=0,
subdomains=subdomain_val)
subdomains=subdomain)
self._multiplicity = np.divide(nuscatt, scatt)
elif self.representation is 'angle':
msg = 'Angular-Dependent MGXS have not yet been implemented'