mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-26 21:25:36 -04:00
Fix a number of problems related to photoatomic data
- OpenMC segfaulted when subshell cross sections were missing in HDF5 files - IncidentPhoton.from_ace shouldn't work with mcplib84 and before - Properly set threshold for subshell cross sections from eprdata12/14 - Make sure IncidentPhoton.from_endf works with only photoatomic data
This commit is contained in:
parent
428b8a7690
commit
b79d97d6dd
2 changed files with 18 additions and 3 deletions
|
|
@ -616,17 +616,23 @@ class IncidentPhoton(EqualityMixin):
|
|||
rx = PhotonReaction(mt)
|
||||
data.reactions[mt] = rx
|
||||
|
||||
# Store cross section
|
||||
# Store cross section, determining threshold
|
||||
xs = ace.xss[idx : idx+n_energy].copy()
|
||||
nonzero = (xs != 0.0)
|
||||
xs[nonzero] = np.exp(xs[nonzero])
|
||||
rx.xs = Tabulated1D(energy, xs, [n_energy], [5])
|
||||
threshold = np.where(xs > 0.0)[0][0]
|
||||
rx.xs = Tabulated1D(energy[threshold:], xs[threshold:],
|
||||
[n_energy - threshold], [5])
|
||||
idx += n_energy
|
||||
|
||||
# Copy binding energy
|
||||
shell = _SUBSHELLS[d]
|
||||
e = data.atomic_relaxation.binding_energy[shell]
|
||||
rx.subshell_binding_energy = e
|
||||
else:
|
||||
raise ValueError("ACE table {} does not have subshell data. Only "
|
||||
"newer ACE photoatomic libraries are supported "
|
||||
"(e.g., eprdata14).".format(ace.name))
|
||||
|
||||
# Add bremsstrahlung DCS data
|
||||
data._add_bremsstrahlung()
|
||||
|
|
@ -990,7 +996,11 @@ class IncidentPhoton(EqualityMixin):
|
|||
for mt, rx in self.reactions.items():
|
||||
if mt >= 534 and mt <= 572:
|
||||
shell = _REACTION_NAME[mt][1]
|
||||
e_f = self.atomic_relaxation.energy_fluorescence(shell)
|
||||
relax_data = self.atomic_relaxation
|
||||
if relax_data is not None:
|
||||
e_f = relax_data.energy_fluorescence(shell)
|
||||
else:
|
||||
e_f = 0.0
|
||||
heating_xs += (energy - e_f) * rx.xs(energy)
|
||||
|
||||
heat_rx = PhotonReaction(525)
|
||||
|
|
|
|||
|
|
@ -110,6 +110,11 @@ PhotonInteraction::PhotonInteraction(hid_t group, int i_element)
|
|||
std::vector<std::string> designators;
|
||||
read_attribute(rgroup, "designators", designators);
|
||||
auto n_shell = designators.size();
|
||||
if (n_shell == 0) {
|
||||
throw std::runtime_error{"Photoatomic data for " + name_ +
|
||||
" does not have subshell data."};
|
||||
}
|
||||
|
||||
for (int i = 0; i < n_shell; ++i) {
|
||||
const auto& designator {designators[i]};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue