Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Determine whether nuclides are fissionable in volume calc mode #3047

Merged
merged 3 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/nuclide.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,19 @@ Nuclide::Nuclide(hid_t group, const vector<double>& temperature)
read_attribute(group, "atomic_weight_ratio", awr_);

if (settings::run_mode == RunMode::VOLUME) {
// Determine whether nuclide is fissionable and then exit
int mt;
hid_t rxs_group = open_group(group, "reactions");
for (auto name : group_names(rxs_group)) {
if (starts_with(name, "reaction_")) {
hid_t rx_group = open_group(rxs_group, name.c_str());
read_attribute(rx_group, "mt", mt);
if (is_fission(mt)) {
fissionable_ = true;
break;
}
}
}
return;
}

Expand Down
8 changes: 7 additions & 1 deletion tests/unit_tests/test_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,8 @@ def test_sample_external_source(run_in_tmpdir, mpi_intracomm):
model.settings.source = openmc.IndependentSource(
space=openmc.stats.Box([-5., -5., -5.], [5., 5., 5.]),
angle=openmc.stats.Monodirectional((0., 0., 1.)),
energy=openmc.stats.Discrete([1.0e5], [1.0])
energy=openmc.stats.Discrete([1.0e5], [1.0]),
constraints={'fissionable': True}
)
model.settings.particles = 1000
model.settings.batches = 10
Expand Down Expand Up @@ -993,3 +994,8 @@ def test_sample_external_source(run_in_tmpdir, mpi_intracomm):
assert p1.wgt == p2.wgt

openmc.lib.finalize()

# Make sure sampling works in volume calculation mode
openmc.lib.init(["-c"])
openmc.lib.sample_external_source(100)
openmc.lib.finalize()