mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-26 21:25:36 -04:00
Updated openmc-ace-to-hdf5 to generate the libraries for us and fixed bugs as found when developing that script. Also updated the Format description in nuclear_data.rst
This commit is contained in:
parent
3b65dde0fd
commit
63b3c6dbd0
5 changed files with 55 additions and 39 deletions
|
|
@ -16,7 +16,7 @@ Incident Neutron Data
|
|||
- **metastable** (*int*) -- Metastable state (0=ground, 1=first
|
||||
excited, etc.)
|
||||
- **atomic_weight_ratio** (*double*) -- Mass in units of neutron masses
|
||||
- **temperature** (*double*) -- Temperature in MeV
|
||||
- **kTs** (*double[]*) -- Temperatures (in MeV) contained in the library
|
||||
- **n_reaction** (*int*) -- Number of reactions
|
||||
|
||||
:Datasets: - **energy** (*double[]*) -- Energy points at which cross sections are tabulated
|
||||
|
|
@ -26,13 +26,20 @@ Incident Neutron Data
|
|||
:Attributes: - **mt** (*int*) -- ENDF MT reaction number
|
||||
- **label** (*char[]*) -- Name of the reaction
|
||||
- **Q_value** (*double*) -- Q value in MeV
|
||||
- **threshold_idx** (*int*) -- Index on the energy grid that the
|
||||
reaction threshold corresponds to
|
||||
- **center_of_mass** (*int*) -- Whether the reference frame for
|
||||
scattering is center-of-mass (1) or laboratory (0)
|
||||
- **n_product** (*int*) -- Number of reaction products
|
||||
|
||||
:Datasets: - **xs** (*double[]*) -- Cross section values tabulated against the nuclide energy grid
|
||||
**/<nuclide name>/reactions/reaction_<mt>/<TTTK>/**
|
||||
|
||||
<TTTK> is the temperature in Kelvin, rounded to the nearest integer, of the
|
||||
temperature-dependent data set. For example, the data set corresponding to
|
||||
300 Kelvin would be located at `300K`.
|
||||
|
||||
:Attributes: - **threshold_idx** (*int*) -- Index on the energy grid that the
|
||||
reaction threshold corresponds to for temperature TTT (in Kelvin)
|
||||
|
||||
:Datasets: - **xs** (*double[]*) -- Cross section values tabulated against the nuclide energy grid for temperature TTT (in Kelvin)
|
||||
|
||||
**/<nuclide name>/reactions/reaction_<mt>/product_<j>/**
|
||||
|
||||
|
|
@ -92,32 +99,39 @@ Thermal Neutron Scattering Data
|
|||
**/<thermal name>/**
|
||||
|
||||
:Attributes: - **atomic_weight_ratio** (*double*) -- Mass in units of neutron masses
|
||||
- **temperature** (*double*) -- Temperature in MeV
|
||||
- **kTs** (*double[]*) -- Temperatures (in MeV) contained in the library
|
||||
- **zaids** (*int[]*) -- ZAID identifiers for which the thermal
|
||||
scattering data applies to
|
||||
|
||||
**/<thermal name>/elastic/**
|
||||
|
||||
:Datasets: - **xs** (:ref:`tabulated <1d_tabulated>`) -- Thermal inelastic
|
||||
scattering cross section
|
||||
- **mu_out** (*double[][]*) -- Distribution of outgoing energies
|
||||
and angles for coherent elastic scattering
|
||||
|
||||
**/<thermal name>/inelastic/**
|
||||
|
||||
:Attributes:
|
||||
- **secondary_mode** (*char[]*) -- Indicates how the inelastic
|
||||
outgoing angle-energy distributions are represented ('equal',
|
||||
'skewed', or 'continuous').
|
||||
|
||||
**/<thermal name>/elastic/<TTTK>/**
|
||||
|
||||
<TTTK> is the temperature in Kelvin, rounded to the nearest integer, of the
|
||||
temperature-dependent data set. For example, the data set corresponding to
|
||||
300 Kelvin would be located at `300K`.
|
||||
|
||||
:Datasets: - **xs** (:ref:`tabulated <1d_tabulated>`) -- Thermal inelastic
|
||||
scattering cross section
|
||||
scattering cross section for temperature TTT (in Kelvin)
|
||||
- **mu_out** (*double[][]*) -- Distribution of outgoing energies
|
||||
and angles for coherent elastic scattering for temperature TTT
|
||||
(in Kelvin)
|
||||
|
||||
**/<thermal name>/inelastic/<TTTK>/**
|
||||
|
||||
<TTTK> is the temperature in Kelvin, rounded to the nearest integer, of the
|
||||
temperature-dependent data set. For example, the data set corresponding to
|
||||
300 Kelvin would be located at `300K`.
|
||||
|
||||
:Datasets: - **xs** (:ref:`tabulated <1d_tabulated>`) -- Thermal inelastic
|
||||
scattering cross section for temperature TTT (in Kelvin)
|
||||
- **energy_out** (*double[][]*) -- Distribution of outgoing
|
||||
energies for each incoming energy. Only present if secondary mode
|
||||
is not continuous.
|
||||
energies for each incoming energy for temperature TTT (in Kelvin).
|
||||
Only present if secondary mode is not continuous.
|
||||
- **mu_out** (*double[][][]*) -- Distribution of scattering cosines
|
||||
for each pair of incoming and outgoing energies. Only present if
|
||||
secondary mode is not continuous.
|
||||
for each pair of incoming and outgoing energies. for temperature
|
||||
TTT (in Kelvin). Only present if secondary mode is not continuous.
|
||||
|
||||
If the secondary mode is continuous, the outgoing energy-angle distribution is
|
||||
given as a :ref:`correlated angle-energy distribution
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ class IncidentNeutron(EqualityMixin):
|
|||
self.metastable = metastable
|
||||
self.atomic_weight_ratio = atomic_weight_ratio
|
||||
self.kTs = kTs
|
||||
self.temperatures = ["{0:.1f}K".format(kT_to_K(kT)) for kT in kTs]
|
||||
self.temperatures = [str(int(round(kT_to_K(kT)))) + "K" for kT in kTs]
|
||||
self.energy = {}
|
||||
self._fission_energy = None
|
||||
self.reactions = OrderedDict()
|
||||
|
|
@ -300,7 +300,7 @@ class IncidentNeutron(EqualityMixin):
|
|||
if ace.temperature not in self.kTs:
|
||||
if name == self.name:
|
||||
# Add temperature and kTs
|
||||
strT = "{0:.1f}K".format(kT_to_K(ace.temperature))
|
||||
strT = str(int(round(kT_to_K(ace.temperature)))) + "K"
|
||||
self.temperatures.append(strT)
|
||||
self.kTs.append(ace.temperature)
|
||||
# Read energy grid
|
||||
|
|
@ -458,7 +458,7 @@ class IncidentNeutron(EqualityMixin):
|
|||
metastable = group.attrs['metastable']
|
||||
atomic_weight_ratio = group.attrs['atomic_weight_ratio']
|
||||
kTs = group.attrs['kTs'].tolist()
|
||||
temperatures = ["{0:.1f}K".format(kT_to_K(kT)) for kT in kTs]
|
||||
temperatures = [str(int(round(kT_to_K(kT)))) + "K" for kT in kTs]
|
||||
|
||||
data = cls(name, atomic_number, mass_number, metastable,
|
||||
atomic_weight_ratio, kTs)
|
||||
|
|
@ -544,7 +544,8 @@ class IncidentNeutron(EqualityMixin):
|
|||
|
||||
# Assign temperature to the running list
|
||||
kTs = [ace.temperature]
|
||||
temperatures = ["{0:.1f}K".format(kT_to_K(ace.temperature))]
|
||||
|
||||
temperatures = [str(int(round(kT_to_K(ace.temperature)))) + "K"]
|
||||
|
||||
# If mass number hasn't been specified, make an educated guess
|
||||
zaid, xs = ace.name.split('.')
|
||||
|
|
|
|||
|
|
@ -488,7 +488,7 @@ class Reaction(EqualityMixin):
|
|||
|
||||
# Convert data temperature to a "300.0K" number for indexing
|
||||
# temperature data
|
||||
strT = "{0:.1f}K".format(kT_to_K(ace.temperature))
|
||||
strT = str(int(round(kT_to_K(ace.temperature)))) + "K"
|
||||
|
||||
if i_reaction > 0:
|
||||
mt = int(ace.xss[ace.jxs[3] + i_reaction - 1])
|
||||
|
|
|
|||
|
|
@ -92,7 +92,6 @@ class CoherentElastic(EqualityMixin):
|
|||
idx = np.searchsorted(self.bragg_edges, E)
|
||||
return self.factors[idx] / E
|
||||
|
||||
|
||||
def __len__(self):
|
||||
return len(self.bragg_edges)
|
||||
|
||||
|
|
@ -192,7 +191,7 @@ class ThermalScattering(EqualityMixin):
|
|||
self.name = name
|
||||
self.atomic_weight_ratio = atomic_weight_ratio
|
||||
self.kTs = kTs
|
||||
self.temperatures = ["{0:.1f}K".format(kT_to_K(kT)) for kT in kTs]
|
||||
self.temperatures = [str(int(round(kT_to_K(kT)))) + "K" for kT in kTs]
|
||||
self.elastic_xs = {}
|
||||
self.elastic_mu_out = {}
|
||||
self.inelastic_xs = {}
|
||||
|
|
@ -303,7 +302,7 @@ class ThermalScattering(EqualityMixin):
|
|||
if ace.temperature not in self.kTs:
|
||||
if name == self.name:
|
||||
# Add temperature and kTs
|
||||
strT = "{0:.1f}K".format(kT_to_K(ace.temperature))
|
||||
strT = str(int(round(kT_to_K(ace.temperature)))) + "K"
|
||||
self.temperatures.append(strT)
|
||||
self.kTs.append(ace.temperature)
|
||||
|
||||
|
|
@ -438,7 +437,7 @@ class ThermalScattering(EqualityMixin):
|
|||
name = group.name[1:]
|
||||
atomic_weight_ratio = group.attrs['atomic_weight_ratio']
|
||||
kTs = group.attrs['kTs'].tolist()
|
||||
temperatures = ["{0:.1f}K".format(kT_to_K(kT)) for kT in kTs]
|
||||
temperatures = [str(int(round(kT_to_K(kT)))) + "K" for kT in kTs]
|
||||
|
||||
table = cls(name, atomic_weight_ratio, kTs)
|
||||
table.zaids = group.attrs['zaids']
|
||||
|
|
@ -526,7 +525,7 @@ class ThermalScattering(EqualityMixin):
|
|||
|
||||
# Assign temperature to the running list
|
||||
kTs = [ace.temperature]
|
||||
temperatures = ["{0:.1f}K".format(kT_to_K(ace.temperature))]
|
||||
temperatures = [str(int(round(kT_to_K(ace.temperature)))) + "K"]
|
||||
|
||||
table = cls(name, ace.atomic_weight_ratio, kTs)
|
||||
|
||||
|
|
|
|||
|
|
@ -130,14 +130,12 @@ for filename in ace_libraries:
|
|||
if xs.endswith('c'):
|
||||
# Continuous-energy neutron data
|
||||
if name not in nuclides:
|
||||
neutron = openmc.data.IncidentNeutron.from_ace(
|
||||
try:
|
||||
neutron = openmc.data.IncidentNeutron.from_ace(
|
||||
table, args.metastable)
|
||||
# try:
|
||||
# neutron = openmc.data.IncidentNeutron.from_ace(
|
||||
# table, args.metastable)
|
||||
# except Exception as e:
|
||||
# print('Failed to convert {}: {}'.format(table.name, e))
|
||||
# continue
|
||||
except Exception as e:
|
||||
print('Failed to convert {}: {}'.format(table.name, e))
|
||||
continue
|
||||
|
||||
# Fission energy release data, if available
|
||||
if args.fission_energy_release is not None:
|
||||
|
|
@ -172,7 +170,11 @@ for filename in ace_libraries:
|
|||
elif xs.endswith('t'):
|
||||
# Thermal scattering data
|
||||
if name not in nuclides:
|
||||
thermal = openmc.data.ThermalScattering.from_ace(table)
|
||||
try:
|
||||
thermal = openmc.data.ThermalScattering.from_ace(table)
|
||||
except Exception as e:
|
||||
print('Failed to convert {}: {}'.format(table.name, e))
|
||||
continue
|
||||
print('Converting {} (ACE) to {} (HDF5)'.format(table.name,
|
||||
thermal.name))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue