Skip to content

Commit 1dc4aa9

Browse files
Add setting to optionally disable atomic relaxation (#3855)
Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
1 parent 908e631 commit 1dc4aa9

12 files changed

Lines changed: 150 additions & 9 deletions

File tree

docs/source/io_formats/settings.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@ Settings Specification -- settings.xml
77
All simulation parameters and miscellaneous options are specified in the
88
settings.xml file.
99

10+
-------------------------------
11+
``<atomic_relaxation>`` Element
12+
-------------------------------
13+
14+
The ``<atomic_relaxation>`` element determines whether the atomic relaxation
15+
cascade, the X-ray fluorescence photons and Auger electrons emitted when an
16+
inner-shell vacancy is filled, is simulated following photoelectric and
17+
incoherent (Compton) scattering interactions. Disabling this can speed up
18+
photon transport calculations where the detailed secondary particle cascade is
19+
not of interest.
20+
21+
*Default*: true
22+
1023
---------------------
1124
``<batches>`` Element
1225
---------------------

docs/source/usersguide/settings.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,13 @@ transport::
604604

605605
settings.photon_transport = True
606606

607+
Atomic relaxation (the cascade of fluorescence photons and Auger electrons
608+
emitted when an inner-shell vacancy is filled) is enabled by default whenever
609+
photon transport is on. It can be disabled using the
610+
:attr:`Settings.atomic_relaxation` attribute::
611+
612+
settings.atomic_relaxation = False
613+
607614
The way in which OpenMC handles secondary charged particles can be specified
608615
with the :attr:`Settings.electron_treatment` attribute. By default, the
609616
:ref:`thick-target bremsstrahlung <ttb>` (TTB) approximation is used to generate

include/openmc/settings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ extern "C" bool output_summary; //!< write summary.h5?
7777
extern bool output_tallies; //!< write tallies.out?
7878
extern bool particle_restart_run; //!< particle restart run?
7979
extern "C" bool photon_transport; //!< photon transport turned on?
80+
extern bool atomic_relaxation; //!< atomic relaxation enabled?
8081
extern "C" bool reduce_tallies; //!< reduce tallies at end of batch?
8182
extern bool res_scat_on; //!< use resonance upscattering method?
8283
extern "C" bool restart_run; //!< restart run?

openmc/settings.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ class Settings:
4141
4242
Attributes
4343
----------
44+
atomic_relaxation : bool
45+
Whether to simulate the atomic relaxation cascade (fluorescence photons
46+
and Auger electrons) following photoelectric and incoherent scattering
47+
interactions.
4448
batches : int
4549
Number of batches to simulate
4650
confidence_intervals : bool
@@ -402,6 +406,7 @@ def __init__(self, **kwargs):
402406
self._confidence_intervals = None
403407
self._electron_treatment = None
404408
self._photon_transport = None
409+
self._atomic_relaxation = None
405410
self._plot_seed = None
406411
self._ptables = None
407412
self._uniform_source_sampling = None
@@ -663,6 +668,15 @@ def electron_treatment(self, electron_treatment: str):
663668
electron_treatment, ['led', 'ttb'])
664669
self._electron_treatment = electron_treatment
665670

671+
@property
672+
def atomic_relaxation(self) -> bool:
673+
return self._atomic_relaxation
674+
675+
@atomic_relaxation.setter
676+
def atomic_relaxation(self, atomic_relaxation: bool):
677+
cv.check_type('atomic relaxation', atomic_relaxation, bool)
678+
self._atomic_relaxation = atomic_relaxation
679+
666680
@property
667681
def ptables(self) -> bool:
668682
return self._ptables
@@ -1631,6 +1645,11 @@ def _create_electron_treatment_subelement(self, root):
16311645
element = ET.SubElement(root, "electron_treatment")
16321646
element.text = str(self._electron_treatment)
16331647

1648+
def _create_atomic_relaxation_subelement(self, root):
1649+
if self._atomic_relaxation is not None:
1650+
element = ET.SubElement(root, "atomic_relaxation")
1651+
element.text = str(self._atomic_relaxation).lower()
1652+
16341653
def _create_photon_transport_subelement(self, root):
16351654
if self._photon_transport is not None:
16361655
element = ET.SubElement(root, "photon_transport")
@@ -2129,6 +2148,11 @@ def _electron_treatment_from_xml_element(self, root):
21292148
if text is not None:
21302149
self.electron_treatment = text
21312150

2151+
def _atomic_relaxation_from_xml_element(self, root):
2152+
text = get_text(root, 'atomic_relaxation')
2153+
if text is not None:
2154+
self.atomic_relaxation = text in ('true', '1')
2155+
21322156
def _energy_mode_from_xml_element(self, root):
21332157
text = get_text(root, 'energy_mode')
21342158
if text is not None:
@@ -2478,6 +2502,7 @@ def to_xml_element(self, mesh_memo=None):
24782502
self._create_collision_track_subelement(element)
24792503
self._create_confidence_intervals(element)
24802504
self._create_electron_treatment_subelement(element)
2505+
self._create_atomic_relaxation_subelement(element)
24812506
self._create_energy_mode_subelement(element)
24822507
self._create_max_order_subelement(element)
24832508
self._create_photon_transport_subelement(element)
@@ -2594,6 +2619,7 @@ def from_xml_element(cls, elem, meshes=None):
25942619
settings._collision_track_from_xml_element(elem)
25952620
settings._confidence_intervals_from_xml_element(elem)
25962621
settings._electron_treatment_from_xml_element(elem)
2622+
settings._atomic_relaxation_from_xml_element(elem)
25972623
settings._energy_mode_from_xml_element(elem)
25982624
settings._max_order_from_xml_element(elem)
25992625
settings._photon_transport_from_xml_element(elem)

src/photon.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,7 @@ PhotonInteraction::PhotonInteraction(hid_t group)
154154

155155
hid_t tgroup = open_group(rgroup, designator.c_str());
156156

157-
// Read binding energy energy and number of electrons if atomic relaxation
158-
// data is present
157+
// Read binding energy if atomic relaxation data is present
159158
if (attribute_exists(tgroup, "binding_energy")) {
160159
has_atomic_relaxation_ = true;
161160
read_attribute(tgroup, "binding_energy", shell.binding_energy);
@@ -174,7 +173,7 @@ PhotonInteraction::PhotonInteraction(hid_t group)
174173
i);
175174
cross_section = tensor::where(xs > 0, tensor::log(xs), 0);
176175

177-
if (object_exists(tgroup, "transitions")) {
176+
if (settings::atomic_relaxation && object_exists(tgroup, "transitions")) {
178177
// Determine dimensions of transitions
179178
dset = open_dataset(tgroup, "transitions");
180179
auto dims = object_shape(dset);
@@ -206,9 +205,8 @@ PhotonInteraction::PhotonInteraction(hid_t group)
206205
// Check the maximum size of the atomic relaxation stack
207206
auto max_size = this->calc_max_stack_size();
208207
if (max_size > MAX_STACK_SIZE && mpi::master) {
209-
warning(fmt::format(
210-
"The subshell vacancy stack in atomic relaxation can grow up to {}, but "
211-
"the stack size limit is set to {}.",
208+
warning(fmt::format("The subshell vacancy stack in atomic relaxation can "
209+
"grow up to {}, but the stack size limit is set to {}.",
212210
max_size, MAX_STACK_SIZE));
213211
}
214212

@@ -231,7 +229,7 @@ PhotonInteraction::PhotonInteraction(hid_t group)
231229

232230
// Map Compton subshell data to atomic relaxation data by finding the
233231
// subshell with the equivalent binding energy
234-
if (has_atomic_relaxation_) {
232+
if (settings::atomic_relaxation && has_atomic_relaxation_) {
235233
auto is_close = [](double a, double b) {
236234
return std::abs(a - b) / a < FP_REL_PRECISION;
237235
};

src/physics.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,8 @@ void sample_photon_reaction(Particle& p)
355355
// Allow electrons to fill orbital and produce Auger electrons and
356356
// fluorescent photons. Since Compton subshell data does not match atomic
357357
// relaxation data, use the mapping between the data to find the subshell
358-
if (i_shell >= 0 && element.subshell_map_[i_shell] >= 0) {
358+
if (settings::atomic_relaxation && i_shell >= 0 &&
359+
element.subshell_map_[i_shell] >= 0) {
359360
element.atomic_relaxation(element.subshell_map_[i_shell], p);
360361
}
361362

@@ -427,7 +428,9 @@ void sample_photon_reaction(Particle& p)
427428

428429
// Allow electrons to fill orbital and produce auger electrons
429430
// and fluorescent photons
430-
element.atomic_relaxation(i_shell, p);
431+
if (settings::atomic_relaxation) {
432+
element.atomic_relaxation(i_shell, p);
433+
}
431434
p.event() = TallyEvent::ABSORB;
432435
p.event_mt() = 533 + shell.index_subshell;
433436
p.wgt() = 0.0;

src/settings.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ bool output_summary {true};
6262
bool output_tallies {true};
6363
bool particle_restart_run {false};
6464
bool photon_transport {false};
65+
bool atomic_relaxation {true};
6566
bool reduce_tallies {true};
6667
bool res_scat_on {false};
6768
bool restart_run {false};
@@ -607,6 +608,11 @@ void read_settings_xml(pugi::xml_node root)
607608
}
608609
}
609610

611+
// Check for atomic relaxation
612+
if (check_for_node(root, "atomic_relaxation")) {
613+
atomic_relaxation = get_node_value_bool(root, "atomic_relaxation");
614+
}
615+
610616
// Number of bins for logarithmic grid
611617
if (check_for_node(root, "log_grid_bins")) {
612618
n_log_bins = std::stoi(get_node_value(root, "log_grid_bins"));

tests/regression_tests/atomic_relaxation/__init__.py

Whitespace-only changes.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?xml version='1.0' encoding='utf-8'?>
2+
<model>
3+
<materials>
4+
<material id="1">
5+
<density value="11.35" units="g/cm3"/>
6+
<nuclide name="Pb208" ao="1.0"/>
7+
</material>
8+
</materials>
9+
<geometry>
10+
<cell id="1" material="1" region="-1" universe="1"/>
11+
<surface id="1" type="sphere" boundary="reflective" coeffs="0.0 0.0 0.0 1000000000.0"/>
12+
</geometry>
13+
<settings>
14+
<run_mode>fixed source</run_mode>
15+
<particles>10000</particles>
16+
<batches>1</batches>
17+
<source type="independent" strength="1.0" particle="photon">
18+
<energy type="discrete">
19+
<parameters>1000000.0 1.0</parameters>
20+
</energy>
21+
</source>
22+
<electron_treatment>led</electron_treatment>
23+
<atomic_relaxation>false</atomic_relaxation>
24+
<photon_transport>true</photon_transport>
25+
</settings>
26+
<tallies>
27+
<filter id="1" type="particle">
28+
<bins>photon electron</bins>
29+
</filter>
30+
<tally id="1">
31+
<filters>1</filters>
32+
<scores>flux heating</scores>
33+
</tally>
34+
</tallies>
35+
</model>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
tally 1:
2+
1.956204E+00
3+
3.826732E+00
4+
7.918768E+04
5+
6.270688E+09
6+
0.000000E+00
7+
0.000000E+00
8+
9.208123E+05
9+
8.478953E+11

0 commit comments

Comments
 (0)