Remove unused table types in openmc.data.ace

This commit is contained in:
Paul Romano 2016-05-13 22:09:36 -05:00
parent 68e5a093aa
commit 9230203efb

View file

@ -1856,371 +1856,6 @@ class Reaction(object):
return rxn
class DosimetryTable(Table):
def __init__(self, name, atomic_weight_ratio, temperature):
super(DosimetryTable, self).__init__(
name, atomic_weight_ratio, temperature)
def __repr__(self):
if hasattr(self, 'name'):
return "<ACE Dosimetry Table: {0}>".format(self.name)
else:
return "<ACE Dosimetry Table>"
class NeutronDiscreteTable(Table):
def __init__(self, name, atomic_weight_ratio, temperature):
super(NeutronDiscreteTable, self).__init__(
name, atomic_weight_ratio, temperature)
def __repr__(self):
if hasattr(self, 'name'):
return "<ACE Discrete-E Neutron Table: {0}>".format(self.name)
else:
return "<ACE Discrete-E Neutron Table>"
class NeutronMGTable(Table):
def __init__(self, name, atomic_weight_ratio, temperature):
super(NeutronMGTable, self).__init__(
name, atomic_weight_ratio, temperature)
def __repr__(self):
if hasattr(self, 'name'):
return "<ACE Multigroup Neutron Table: {0}>".format(self.name)
else:
return "<ACE Multigroup Neutron Table>"
class PhotoatomicTable(Table):
def __init__(self, name, atomic_weight_ratio, temperature):
super(PhotoatomicTable, self).__init__(
name, atomic_weight_ratio, temperature)
def __repr__(self):
if hasattr(self, 'name'):
return "<ACE Continuous-E Photoatomic Table: {0}>".format(self.name)
else:
return "<ACE Continuous-E Photoatomic Table>"
def _read_all(self):
self._read_eszg()
self._read_jinc()
self._read_jcoh()
self._read_heating()
self._read_compton_data()
def _read_eszg(self):
# Determine number of energies on common energy grid
n_energies = self._nxs[3]
# Read cross sections
idx = self._jxs[1]
data = np.asarray(self._xss[idx:idx + 5*n_energies])
data.shape = (5, n_energies)
self.energy = data[0]
self.incoherent = data[1]
self.coherent = data[2]
self.photoelectric = data[3]
self.pairproduction = data[4]
def _read_jinc(self):
# Read incoherent scattering function
idx = self._jxs[2]
self.incoherent_scattering = self._xss[idx:idx + 21]
def _read_jcoh(self):
# Read coherent form factors and integrated coherent form factors
idx = self._jxs[3]
self.int_coherent_form_factors = self._xss[idx:idx + 55]
self.coherent_form_factors = self._xss[idx + 55:idx + 2*55]
def _read_jflo(self):
raise NotImplementedError
def _read_heating(self):
idx = self._jxs[5]
self.avg_heating = self._xss[idx:idx + self._nxs[3]]
def _read_compton_data(self):
# Determine number of Compton profiles
n_shells = self._nxs[5]
if n_shells > 0:
# Number of electrons per shell
idx = self._jxs[6]
self.electrons_per_shell = np.asarray(
self._xss[idx:idx + n_shells], dtype=int)
# Binding energy per shell
idx = self._jxs[7]
self.binding_energy_per_shell = self._xss[idx:idx + n_shells]
# Probability of interaction per shell
idx = self._jxs[8]
self.probability_per_shell = self._xss[idx:idx + n_shells]
# Initialize arrays for Compton profile data
self.compton_profile_interp = np.zeros(n_shells)
self.compton_profile_momentum = []
self.compton_profile_pdf = []
self.compton_profile_cdf = []
for i in range(n_shells):
# Get locator for SWD block
loca = int(self._xss[self._jxs[9] + i])
idx = self._jxs[10] + loca - 1
# Get interpolation parameter and number of momentum entries
self.compton_profile_interp[i] = int(self._xss[idx])
n_momentum = int(self._xss[idx + 1])
idx += 2
# Get momentum entries, PDF, and CDF
data = self._xss[idx:idx + 3*n_momentum]
data.shape = (3, n_momentum)
self.compton_profile_momentum.append(data[0])
self.compton_profile_pdf.append(data[1])
self.compton_profile_cdf.append(data[2])
class PhotoatomicMGTable(Table):
def __init__(self, name, atomic_weight_ratio, temperature):
super(PhotoatomicMGTable, self).__init__(
name, atomic_weight_ratio, temperature)
def __repr__(self):
if hasattr(self, 'name'):
return "<ACE Multigroup Photoatomic Table: {0}>".format(self.name)
else:
return "<ACE Multigroup Photoatomic Table>"
class ElectronTable(Table):
def __init__(self, name, atomic_weight_ratio, temperature):
super(ElectronTable, self).__init__(
name, atomic_weight_ratio, temperature)
def __repr__(self):
if hasattr(self, 'name'):
return "<ACE Electron Table: {0}>".format(self.name)
else:
return "<ACE Electron Table>"
class PhotonuclearTable(Table):
def __init__(self, name, atomic_weight_ratio, temperature):
super(PhotonuclearTable, self).__init__(
name, atomic_weight_ratio, temperature)
self.reactions = OrderedDict()
def __repr__(self):
if hasattr(self, 'name'):
return "<ACE Photonuclear Table: {0}>".format(self.name)
else:
return "<ACE Photonuclear Table>"
def _read_all(self):
self._read_basic()
self._read_cross_sections()
self._read_secondaries()
self._read_angular_distributions()
self._read_energy_distributions()
def _read_basic(self):
n_energies = self._nxs[3]
# Read energy mesh
idx = self._jxs[1]
self.energy = self._xss[idx:idx + n_energies]
# Read total cross section
idx = self._jxs[2]
self.total_xs = self._xss[idx:idx + n_energies]
# Read non-elastic and elastic cross section
if self._jxs[4] > 0:
idx = self._jxs[3]
self.non_elastic_xs = self._xss[idx:idx + n_energies]
idx = self._jxs[4]
self.elastic_xs = self._xss[idx:idx + n_energies]
else:
self.non_elastic_xs = self.total_xs.copy()
self.elastic_xs = np.zeros(n_energies)
# Read heating numbers
idx = self._jxs[5]
if idx > 0:
self.heating_number = self._xss[idx:idx + n_energies]
else:
self.heating_number = np.zeros(n_energies)
def _read_cross_sections(self):
# Determine number of reactions
n_reactions = self._nxs[4]
# Read list of MT numbers and Q values
mts = np.asarray(self._xss[self._jxs[6]:self._jxs[6] +
n_reactions], dtype=int)
qvalues = np.asarray(self._xss[self._jxs[7]:self._jxs[7] +
n_reactions])
# Create reactions in dictionary
reactions = [(mt, Reaction(mt, self)) for mt in mts]
self.reactions.update(reactions)
for i, rx in enumerate(self.reactions.values()):
# Copy Q values
rx.Q_value = qvalues[i]
# Determine starting index on energy grid and number of energies
idx = self._jxs[9] + int(self._xss[self._jxs[8] + i]) - 1
rx.threshold_idx = int(self._xss[idx])
n_energies = int(self._xss[idx + 1])
energy = self.energy[rx.threshold_idx:rx.threshold_idx + n_energies]
idx += 2
# Read reaction cross setion
xs = self._xss[idx:idx + n_energies]
rx.xs = Tabulated1D(energy, xs, [], [])
def _read_secondaries(self):
names = {1: 'neutron', 2: 'photon', 3: 'electron',
9: 'proton', 31: 'deuteron', 32: 'triton',
33: 'helium3', 34: 'alpha'}
n_particles = self._nxs[5]
n_entries = self._nxs[7]
idx = self._jxs[10]
ixs = np.asarray(self._xss[idx:idx + n_particles*n_entries], dtype=int)
ixs.shape = (n_particles, n_entries)
self.ixs = ixs.transpose()
self.particles = []
for j in range(n_particles):
# Create dictionary for particle
particle = {}
self.particles.append(particle)
# Get secondary particle type/name
particle['ipt'] = self.ixs[0, j]
particle['name'] = names[particle['ipt']]
# Number of reactions that produce secondary particle
n_producing = self.ixs[1, j]
# Particle-production cross section
idx = self.ixs[2, j]
particle['ie_production'] = int(self._xss[idx])
ne = int(self._xss[idx + 1])
idx += 2
particle['production'] = self._xss[idx:idx + ne]
# Average heating numbers
idx = self.ixs[3, j]
particle['ie_heating'] = int(self._xss[idx])
ne = int(self._xss[idx + 1])
idx += 2
particle['heating_number'] = self._xss[idx:idx + ne]
# MTs of particle production reactions
idx = self.ixs[4, j]
particle['mt_producing'] = np.asarray(
self._xss[idx:idx + n_producing], dtype=int)
# Coordinate system of reaction producing secondary particle
idx = self.ixs[5, j]
particle['center_of_mass'] = [i < 0 for i in
self._xss[idx:idx + n_producing]]
# Reaction yields
particle['yield'] = {}
for k in range(n_producing):
# Create dictionary for yield data
yieldData = {}
# Read reaction yield data for a single MT
idx = self.ixs[7, j] + int(self._xss[self.ixs[6, j] + k]) - 1
yieldData['mftype'] = int(self._xss[idx])
idx += 1
if yieldData['mftype'] in (6, 12, 16):
# Yield data from ENDF File 6 or 12
mtmult = int(self._xss[idx])
assert mtmult == particle['mt_producing'][k]
# Read yield as function of energy
yieldData['multiplicity'] = _get_tabulated_1d(
self._xss, idx + 1)
elif yieldData['mftype'] == 13:
# Production cross section for corresponding MT
yieldData['ie'] = int(self._xss[idx])
ne = int(self._xss[idx + 1])
idx += 2
yieldData['cross_section'] = self._xss[idx:idx + ne]
# Add reaction yield data to dictionary
mt = particle['mt_producing'][k]
particle['yield'][mt] = yieldData
def _read_angular_distributions(self):
for j, particle in enumerate(self.particles):
# Create dictionary for angular distributions
angular_dists = {}
particle['angular_distribution'] = angular_dists
for k, mt in enumerate(particle['mt_producing']):
landp = int(self._xss[self.ixs[8, j] + k])
# check if angular distribution data exists
if landp == -1:
# Angular distribution data are specified through the
# DLWP block
continue
elif landp == 0:
# No angular distribution data are given for this
# reaction, isotropic scattering is assumed
ie = self.reactions[mt].threshold_idx
ne = len(self.reactions[mt].sigma)
angular_dists[mt] = AngularDistribution.isotropic(
np.array([self.energy[ie], self.energy[ie + ne - 1]]))
continue
idx = self.ixs[9, j] + landp - 1
angular_dists[mt] = AngularDistribution()
angular_dists[mt].read(self._xss, idx, self.ixs[9, j])
def _read_energy_distributions(self):
for j, particle in enumerate(self.particles):
# Create dictionary for energy distributions
energy_dists = {}
particle['energy_distribution'] = energy_dists
for k, mt in enumerate(particle['mt_producing']):
# Determine locator for kth energy distribution
ldlwp = int(self._xss[self.ixs[10, j] + k])
# Read energy distribution data
energy_dists[mt] = self._get_energy_distribution(
self.ixs[11, j], ldlwp)
table_types = {
"c": NeutronTable,
"t": SabTable,
"y": DosimetryTable,
"d": NeutronDiscreteTable,
"p": PhotoatomicTable,
"m": NeutronMGTable,
"g": PhotoatomicMGTable,
"e": ElectronTable,
"u": PhotonuclearTable}
"t": SabTable}