Added support to openmc.library for angular representations

This commit is contained in:
Adam Nelson 2017-01-08 20:55:09 -05:00
parent 39d9c25ae7
commit 4914dddf4c
2 changed files with 83 additions and 25 deletions

View file

@ -71,6 +71,10 @@ class Library(object):
:attr:`ScatterMatrixXS.scatter_format` is 'histogram'. (default is 16)
energy_groups : openmc.mgxs.EnergyGroups
Energy group structure for energy condensation
num_polar : None or Integral
Number of equi-width polar angles for angle discretization
num_azimuthal : None or Integral
Number of equi-width azimuthal angles for angle discretization
num_delayed_groups : int
Number of delayed groups
estimator : str or None
@ -107,6 +111,8 @@ class Library(object):
self._domain_type = None
self._domains = 'all'
self._energy_groups = None
self._num_polar = None
self._num_azimuthal = None
self._num_delayed_groups = 0
self._correction = 'P0'
self._scatter_format = 'legendre'
@ -144,6 +150,8 @@ class Library(object):
clone._legendre_order = self.legendre_order
clone._histogram_bins = self.histogram_bins
clone._energy_groups = copy.deepcopy(self.energy_groups, memo)
clone._num_polar = self.num_polar
clone._num_azimuthal = self.num_azimuthal
clone._num_delayed_groups = self.num_delayed_groups
clone._tally_trigger = copy.deepcopy(self.tally_trigger, memo)
clone._all_mgxs = copy.deepcopy(self.all_mgxs)
@ -213,6 +221,14 @@ class Library(object):
def energy_groups(self):
return self._energy_groups
@property
def num_polar(self):
return self._num_polar
@property
def num_azimuthal(self):
return self._num_azimuthal
@property
def num_delayed_groups(self):
return self._num_delayed_groups
@ -344,6 +360,18 @@ class Library(object):
cv.check_type('energy groups', energy_groups, openmc.mgxs.EnergyGroups)
self._energy_groups = energy_groups
@num_polar.setter
def num_polar(self, num_polar):
if num_polar:
cv.check_type('num_polar', num_polar, Integral)
self._num_polar = num_polar
@num_azimuthal.setter
def num_azimuthal(self, num_azimuthal):
if num_azimuthal:
cv.check_type('num_azimuthal', num_azimuthal, Integral)
self._num_azimuthal = num_azimuthal
@num_delayed_groups.setter
def num_delayed_groups(self, num_delayed_groups):
@ -472,7 +500,9 @@ class Library(object):
if mgxs_type in openmc.mgxs.MDGXS_TYPES:
mgxs = openmc.mgxs.MDGXS.get_mgxs(mgxs_type, name=self.name)
else:
mgxs = openmc.mgxs.MGXS.get_mgxs(mgxs_type, name=self.name)
mgxs = openmc.mgxs.MGXS.get_mgxs(
mgxs_type, name=self.name, num_polar=self.num_polar,
num_azimuthal=self.num_azimuthal)
mgxs.domain = domain
mgxs.domain_type = self.domain_type
@ -953,12 +983,14 @@ class Library(object):
name = xsdata_name
if nuclide != 'total':
name += '_' + nuclide
xsdata = openmc.XSdata(name, self.energy_groups)
if self.num_polar or self.num_azimuthal:
representation = 'angle'
else:
representation = 'isotropic'
xsdata = openmc.XSdata(name, self.energy_groups,
representation=representation)
xsdata.num_delayed_groups = self.num_delayed_groups
# Right now only isotropic weighting is supported
self.representation = 'isotropic'
if nuclide != 'total':
xsdata.atomic_weight_ratio = self._nuclides[nuclide][1]

View file

@ -511,7 +511,8 @@ class MGXS(object):
@staticmethod
def get_mgxs(mgxs_type, domain=None, domain_type=None,
energy_groups=None, by_nuclide=False, name=''):
energy_groups=None, by_nuclide=False, name='', num_polar=None,
num_azimuthal=None):
"""Return a MGXS subclass object for some energy group structure within
some spatial domain for some reaction type.
@ -534,6 +535,12 @@ class MGXS(object):
name : str, optional
Name of the multi-group cross section. Used as a label to identify
tallies in OpenMC 'tallies.xml' file. Defaults to the empty string.
num_polar : Integral, optional
Number of equi-width polar angles for angle discretization;
defaults to no discretization
num_azimuthal : Integral, optional
Number of equi-width azimuthal angles for angle discretization;
defaults to no discretization
Returns
-------
@ -546,43 +553,62 @@ class MGXS(object):
cv.check_value('mgxs_type', mgxs_type, MGXS_TYPES)
if mgxs_type == 'total':
mgxs = TotalXS(domain, domain_type, energy_groups)
mgxs = TotalXS(domain, domain_type, energy_groups, num_polar,
num_azimuthal)
elif mgxs_type == 'transport':
mgxs = TransportXS(domain, domain_type, energy_groups)
mgxs = TransportXS(domain, domain_type, energy_groups, num_polar,
num_azimuthal)
elif mgxs_type == 'nu-transport':
mgxs = NuTransportXS(domain, domain_type, energy_groups)
mgxs = NuTransportXS(domain, domain_type, energy_groups, num_polar,
num_azimuthal)
elif mgxs_type == 'absorption':
mgxs = AbsorptionXS(domain, domain_type, energy_groups)
mgxs = AbsorptionXS(domain, domain_type, energy_groups, num_polar,
num_azimuthal)
elif mgxs_type == 'capture':
mgxs = CaptureXS(domain, domain_type, energy_groups)
mgxs = CaptureXS(domain, domain_type, energy_groups, num_polar,
num_azimuthal)
elif mgxs_type == 'fission':
mgxs = FissionXS(domain, domain_type, energy_groups)
mgxs = FissionXS(domain, domain_type, energy_groups, num_polar,
num_azimuthal)
elif mgxs_type == 'nu-fission':
mgxs = NuFissionXS(domain, domain_type, energy_groups)
mgxs = NuFissionXS(domain, domain_type, energy_groups, num_polar,
num_azimuthal)
elif mgxs_type == 'kappa-fission':
mgxs = KappaFissionXS(domain, domain_type, energy_groups)
mgxs = KappaFissionXS(domain, domain_type, energy_groups,
num_polar, num_azimuthal)
elif mgxs_type == 'scatter':
mgxs = ScatterXS(domain, domain_type, energy_groups)
mgxs = ScatterXS(domain, domain_type, energy_groups, num_polar,
num_azimuthal)
elif mgxs_type == 'nu-scatter':
mgxs = NuScatterXS(domain, domain_type, energy_groups)
mgxs = NuScatterXS(domain, domain_type, energy_groups, num_polar,
num_azimuthal)
elif mgxs_type == 'scatter matrix':
mgxs = ScatterMatrixXS(domain, domain_type, energy_groups)
mgxs = ScatterMatrixXS(domain, domain_type, energy_groups,
num_polar, num_azimuthal)
elif mgxs_type == 'nu-scatter matrix':
mgxs = NuScatterMatrixXS(domain, domain_type, energy_groups)
mgxs = NuScatterMatrixXS(domain, domain_type, energy_groups,
num_polar, num_azimuthal)
elif mgxs_type == 'multiplicity matrix':
mgxs = MultiplicityMatrixXS(domain, domain_type, energy_groups)
mgxs = MultiplicityMatrixXS(domain, domain_type, energy_groups,
num_polar, num_azimuthal)
elif mgxs_type == 'nu-fission matrix':
mgxs = NuFissionMatrixXS(domain, domain_type, energy_groups)
mgxs = NuFissionMatrixXS(domain, domain_type, energy_groups,
num_polar, num_azimuthal)
elif mgxs_type == 'chi':
mgxs = Chi(domain, domain_type, energy_groups)
mgxs = Chi(domain, domain_type, energy_groups, num_polar,
num_azimuthal)
elif mgxs_type == 'chi-prompt':
mgxs = ChiPrompt(domain, domain_type, energy_groups)
mgxs = ChiPrompt(domain, domain_type, energy_groups, num_polar,
num_azimuthal)
elif mgxs_type == 'inverse-velocity':
mgxs = InverseVelocity(domain, domain_type, energy_groups)
mgxs = InverseVelocity(domain, domain_type, energy_groups,
num_polar, num_azimuthal)
elif mgxs_type == 'prompt-nu-fission':
mgxs = PromptNuFissionXS(domain, domain_type, energy_groups)
mgxs = PromptNuFissionXS(domain, domain_type, energy_groups,
num_polar, num_azimuthal)
elif mgxs_type == 'prompt-nu-fission matrix':
mgxs = PromptNuFissionMatrixXS(domain, domain_type, energy_groups)
mgxs = PromptNuFissionMatrixXS(domain, domain_type, energy_groups,
num_polar, num_azimuthal)
mgxs.by_nuclide = by_nuclide
mgxs.name = name