Add check for presence of atomic relaxation data in PhotonInteraction

This commit is contained in:
Paul Romano 2022-11-29 16:21:47 -06:00
parent a601088e8b
commit b66d9e0a90
3 changed files with 18 additions and 3 deletions

View file

@ -100,6 +100,9 @@ public:
// Bremsstrahlung scaled DCS
xt::xtensor<double, 2> dcs_;
// Whether atomic relaxation data is present
bool has_atomic_relaxation_ {false};
// Constant data
static constexpr int MAX_STACK_SIZE =
7; //!< maximum possible size of atomic relaxation stack

View file

@ -13,7 +13,7 @@ from scipy.interpolate import CubicSpline
import openmc.checkvalue as cv
from openmc.mixin import EqualityMixin
from . import HDF5_VERSION
from . import HDF5_VERSION, HDF5_VERSION_MAJOR
from .ace import Table, get_metadata, get_table
from .data import ATOMIC_SYMBOL, EV_PER_MEV
from .endf import Evaluation, get_head_record, get_tab1_record, get_list_record
@ -143,6 +143,8 @@ class AtomicRelaxation(EqualityMixin):
Dictionary indicating the number of electrons in a subshell when neutral
(values) for given subshells (keys). The subshells should be given as
strings, e.g., 'K', 'L1', 'L2', etc.
subshells : list
List of subshells as strings, e.g. ``['K', 'L1', ...]``
transitions : pandas.DataFrame
Dictionary indicating allowed transitions and their probabilities
(values) for given subshells (keys). The subshells should be given as

View file

@ -156,8 +156,14 @@ PhotonInteraction::PhotonInteraction(hid_t group)
// Read binding energy and number of electrons
hid_t tgroup = open_group(rgroup, designator.c_str());
read_attribute(tgroup, "binding_energy", shell.binding_energy);
read_attribute(tgroup, "num_electrons", shell.n_electrons);
// Read binding energy energy and number of electrons if atomic relaxation
// data is present
if (attribute_exists(tgroup, "binding_energy")) {
has_atomic_relaxation_ = true;
read_attribute(tgroup, "binding_energy", shell.binding_energy);
read_attribute(tgroup, "num_electrons", shell.n_electrons);
}
// Read subshell cross section
xt::xtensor<double, 1> xs;
@ -757,6 +763,10 @@ void PhotonInteraction::pair_production(double alpha, double* E_electron,
void PhotonInteraction::atomic_relaxation(int i_shell, Particle& p) const
{
// Return if no atomic relaxation data is present
if (!has_atomic_relaxation_)
return;
// Stack for unprocessed holes left by transitioning electrons
int n_holes = 0;
array<int, MAX_STACK_SIZE> holes;