diff --git a/tests/regression_tests/cpp_driver/driver.cpp b/tests/regression_tests/cpp_driver/driver.cpp index 995d91e084..48ed7f3171 100644 --- a/tests/regression_tests/cpp_driver/driver.cpp +++ b/tests/regression_tests/cpp_driver/driver.cpp @@ -6,6 +6,7 @@ #include "openmc/cell.h" #include "openmc/error.h" #include "openmc/geometry.h" +#include "openmc/geometry_aux.h" #include "openmc/message_passing.h" #include "openmc/summary.h" #include "openmc/tallies/filter.h" @@ -31,11 +32,14 @@ int main(int argc, char** argv) { for (auto& entry : openmc::model::cell_map) { cell_indices.push_back(entry.second); } + // enable distribcells offsets for all cells + prepare_distribcell(&cell_indices); // sort to make sure the cell bins appear in the same // order as the test relying on the openmc exe std::sort(cell_indices.begin(), cell_indices.end()); cell_filter->set_cells(cell_indices); + // create a new tally auto tally = Tally::create(); std::vector filters = {cell_filter}; @@ -46,7 +50,7 @@ int main(int argc, char** argv) { // the lattice auto& root_univ = openmc::model::universes[openmc::model::root_universe]; auto& lattice_cell = openmc::model::cells[root_univ->cells_[0]]; - lattice_cell->set_temperature(300, 1, true); + lattice_cell->set_temperature(300.0, 0, true); // check that material-filled cells return no contained cells for (auto& cell : openmc::model::cells) { @@ -56,6 +60,9 @@ int main(int argc, char** argv) { } } + // set a higher temperature for only one of the lattice cells (ID is 4 in the model) + model::cells[model::cell_map[4]]->set_temperature(400.0, 3, true); + // the summary file will be used to check that // temperatures were set correctly so clear // error output can be provided diff --git a/tests/regression_tests/cpp_driver/inputs_true.dat b/tests/regression_tests/cpp_driver/inputs_true.dat index 84efa64672..faa3fa9b1a 100644 --- a/tests/regression_tests/cpp_driver/inputs_true.dat +++ b/tests/regression_tests/cpp_driver/inputs_true.dat @@ -3,14 +3,15 @@ - - + + + 4.0 4.0 2 2 -4.0 -4.0 -1 1 -1 1 +2 2 +2 2 diff --git a/tests/regression_tests/cpp_driver/results_true.dat b/tests/regression_tests/cpp_driver/results_true.dat index 47d47ff6b0..e44b45054a 100644 --- a/tests/regression_tests/cpp_driver/results_true.dat +++ b/tests/regression_tests/cpp_driver/results_true.dat @@ -9,3 +9,5 @@ tally 1: 9.919885E+02 2.174849E+02 5.292948E+03 +2.174849E+02 +5.292948E+03 diff --git a/tests/regression_tests/cpp_driver/test.py b/tests/regression_tests/cpp_driver/test.py index 42f0c2e581..0726e4c6ec 100644 --- a/tests/regression_tests/cpp_driver/test.py +++ b/tests/regression_tests/cpp_driver/test.py @@ -81,11 +81,15 @@ def model(): pincell_univ = openmc.Universe(cells=[fuel, cladding, moderator]) + # insert an additional cell to add another level to the geometry + extra_cell = openmc.Cell(fill=pincell_univ) + extra_univ = openmc.Universe(cells=[extra_cell]) + # lattice lattice = openmc.RectLattice() lattice.pitch = (4.0, 4.0) lattice.lower_left = (-4.0, -4.0) - lattice.universes = [[pincell_univ, pincell_univ], [pincell_univ, pincell_univ]] + lattice.universes = [[extra_univ, extra_univ], [extra_univ, extra_univ]] lattice_region = openmc.model.rectangular_prism(8.0, 8.0, boundary_type='reflective') @@ -130,7 +134,8 @@ class ExternalDriverTestHarness(PyAPITestHarness): for cell in cells.values(): if isinstance(cell.fill, openmc.Material): assert len(cell.temperature) == 4 - assert_allclose(cell.temperature, 300.0) + assert_allclose(cell.temperature[:3], 300.0) + assert_allclose(cell.temperature[-1:], 400.0) def test_cpp_driver(cpp_driver, model):