diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 877ec6833..6fc130947 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,12 +75,18 @@ jobs: LIBMESH: ${{ matrix.libmesh }} NPY_DISABLE_CPU_FEATURES: "AVX512F AVX512_SKX" OPENBLAS_NUM_THREADS: 1 + PYTEST_ADDOPTS: --cov=openmc --cov-report=lcov:coverage-python.lcov # libfabric complains about fork() as a result of using Python multiprocessing. # We can work around it with RDMAV_FORK_SAFE=1 in libfabric < 1.13 and with # FI_EFA_FORK_SAFE=1 in more recent versions. RDMAV_FORK_SAFE: 1 steps: + - name: Setup cmake + uses: jwlawson/actions-setup-cmake@v2 + with: + cmake-version: '3.31' + - name: Checkout repository uses: actions/checkout@v4 with: @@ -148,7 +154,7 @@ jobs: path: | ~/nndc_hdf5 ~/endf-b-vii.1 - key: ${{ runner.os }}-build-xs-cache + key: ${{ runner.os }}-build-xs-cache-${{ hashFiles(format('{0}/tools/ci/download-xs.sh', github.workspace)) }} - name: before shell: bash @@ -166,11 +172,38 @@ jobs: uses: mxschmitt/action-tmate@v3 timeout-minutes: 10 - - name: after_success + - name: Generate C++ coverage (gcovr) shell: bash run: | - cpp-coveralls -i src -i include -e src/external --exclude-pattern "/usr/*" --dump cpp_cov.json - coveralls --merge=cpp_cov.json --service=github + # Produce LCOV directly from gcov data in the build tree + gcovr \ + --root "$GITHUB_WORKSPACE" \ + --object-directory "$GITHUB_WORKSPACE/build" \ + --filter "$GITHUB_WORKSPACE/src" \ + --filter "$GITHUB_WORKSPACE/include" \ + --exclude "$GITHUB_WORKSPACE/src/external/.*" \ + --exclude "$GITHUB_WORKSPACE/src/include/openmc/external/.*" \ + --gcov-ignore-errors source_not_found \ + --gcov-ignore-errors output_error \ + --gcov-ignore-parse-errors suspicious_hits.warn \ + --merge-mode-functions=separate \ + --print-summary \ + --lcov -o coverage-cpp.lcov || true + + - name: Merge C++ and Python coverage + shell: bash + run: | + # Merge C++ and Python LCOV into a single file for upload + cat coverage-cpp.lcov coverage-python.lcov > coverage.lcov + + - name: Upload coverage to Coveralls + if: ${{ hashFiles('coverage.lcov') != '' }} + uses: coverallsapp/github-action@v2 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + parallel: true + flag-name: C++ and Python + path-to-lcov: coverage.lcov finish: needs: main @@ -179,5 +212,5 @@ jobs: - name: Coveralls Finished uses: coverallsapp/github-action@v2 with: - github-token: ${{ secrets.github_token }} + github-token: ${{ secrets.GITHUB_TOKEN }} parallel-finished: true diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 000000000..32e30213a --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,280 @@ +# OpenMC AI Coding Agent Instructions + +## Project Overview + +OpenMC is a Monte Carlo particle transport code for simulating nuclear reactors, +fusion devices, or other systems with neutron/photon radiation. It's a hybrid +C++17/Python codebase where: +- **C++ core** (`src/`, `include/openmc/`) handles the computationally intensive transport simulation +- **Python API** (`openmc/`) provides user-facing model building, post-processing, and depletion capabilities +- **C API bindings** (`openmc/lib/`) wrap the C++ library via ctypes for runtime control + +## Architecture & Key Components + +### C++ Component Structure +- **Global vectors of unique_ptrs**: Core objects like `model::cells`, `model::universes`, `nuclides` are stored as `vector>` in nested namespaces (`openmc::model`, `openmc::simulation`, `openmc::settings`, `openmc::data`) +- **Custom container types**: OpenMC provides its own `vector`, `array`, `unique_ptr`, and `make_unique` in the `openmc::` namespace (defined in `vector.h`, `array.h`, `memory.h`). These are currently typedefs to `std::` equivalents but may become custom implementations for accelerator support. Always use `openmc::vector`, not `std::vector`. +- **Geometry systems**: + - **CSG (default)**: Arbitrarily complex Constructive Solid Geometry using `Surface`, `Region`, `Cell`, `Universe`, `Lattice` + - **DAGMC**: CAD-based geometry via Direct Accelerated Geometry Monte Carlo (optional, requires `OPENMC_USE_DAGMC`) + - **Unstructured mesh**: libMesh-based geometry (optional, requires `OPENMC_USE_LIBMESH`) +- **Particle tracking**: `Particle` class with `GeometryState` manages particle transport through geometry +- **Tallies**: Score quantities during simulation via `Filter` and `Tally` objects +- **Random ray solver**: Alternative deterministic method in `src/random_ray/` +- **Optional features**: DAGMC (CAD geometry), libMesh (unstructured mesh), MPI, all controlled by `#ifdef OPENMC_MPI`, etc. + +### Python Component Structure +- **ID management**: All geometry objects (Cell, Surface, Material, etc.) inherit from `IDManagerMixin` which auto-assigns unique integer IDs and tracks them via class-level `used_ids` and `next_id` +- **Input validation**: Extensive use of `openmc.checkvalue` module functions (`check_type`, `check_value`, `check_length`) for all setters +- **XML I/O**: Most classes implement `to_xml_element()` and `from_xml_element()` for serialization to OpenMC's XML input format +- **HDF5 output**: Post-simulation data in statepoint files read via `openmc.StatePoint` +- **Depletion**: `openmc.deplete` implements burnup via operator-splitting with various integrators (Predictor, CECM, etc.) +- **Nuclear Data**: `openmc.data` provides programmatic access to nuclear data files (ENDF, ACE, HDF5) + +## Critical Build & Test Workflows + +### Build Dependencies +- **C++17 compiler**: GCC, Clang, or Intel +- **CMake** (3.16+): Required for configuring and building the C++ library +- **HDF5**: Required for cross section data and output file formats +- **libpng**: Used for generating visualization when OpenMC is run in plotting mode + +Without CMake and HDF5, OpenMC cannot be compiled. + +### Building the C++ Library +```bash +# Configure with CMake (from build/ directory) +cmake .. -DOPENMC_USE_MPI=ON -DOPENMC_USE_OPENMP=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo + +# Available CMake options (all default OFF except OPENMC_USE_OPENMP and OPENMC_BUILD_TESTS): +# -DOPENMC_USE_OPENMP=ON/OFF # OpenMP parallelism +# -DOPENMC_USE_MPI=ON/OFF # MPI support +# -DOPENMC_USE_DAGMC=ON/OFF # CAD geometry support +# -DOPENMC_USE_LIBMESH=ON/OFF # Unstructured mesh +# -DOPENMC_ENABLE_PROFILE=ON/OFF # Profiling flags +# -DOPENMC_ENABLE_COVERAGE=ON/OFF # Coverage analysis + +# Build +make -j + +# C++ unit tests (uses Catch2) +ctest +``` + +### Python Development +```bash +# Install in development mode (requires building C++ library first) +pip install -e . + +# Python tests (uses pytest) +pytest tests/unit_tests/ # Fast unit tests +pytest tests/regression_tests/ # Full regression suite (requires nuclear data) +``` + +### Nuclear Data Setup (CRITICAL for Running OpenMC) +Most tests require the NNDC HDF5 nuclear cross-section library. + +**Important**: Check if `OPENMC_CROSS_SECTIONS` is already set in the user's +environment before downloading, as many users already have nuclear data +installed. Though do note that if this variable is present that it may point to +different cross section data and that the NNDC data is required for tests to +pass. + +**If not already configured, download and setup:** +```bash +# Download NNDC HDF5 cross section library (~800 MB compressed) +wget -q -O - https://anl.box.com/shared/static/teaup95cqv8s9nn56hfn7ku8mmelr95p.xz | tar -C $HOME -xJ + +# Set environment variable (add to ~/.bashrc or ~/.zshrc for persistence) +export OPENMC_CROSS_SECTIONS=$HOME/nndc_hdf5/cross_sections.xml +``` + +**Alternative**: Use the provided download script (checks if data exists before downloading): +```bash +bash tools/ci/download-xs.sh # Downloads both NNDC HDF5 and ENDF/B-VII.1 data +``` + +Without this data, regression tests will fail with "No cross_sections.xml file +found" errors, or, in the case that alternative cross section data is configured +the tests will execute but will not pass. The `cross_sections.xml` file is an +index listing paths to individual HDF5 nuclear data files for each nuclide. + +## Testing Expectations + +### Environment Requirements + + - **Data**: As described above, OpenMC's test suite requires OpenMC to be configured with NNDC data. + - **OpenMP Settings**: OpenMC's tests may fail is more than two OpenMP threads are used. The environment variable `OMP_NUM_THREADS=2` should be set to avoid sporadic test failures. + - **Executable configuration**: The OpenMC executable should compiled with debug symbols enabled. + +### C++ Tests +Located in `tests/cpp_unit_tests/`, use Catch2 framework. Run via `ctest` after building with `-DOPENMC_BUILD_TESTS=ON`. + +### Python Unit Tests +Located in `tests/unit_tests/`, these are fast, standalone tests that verify Python API functionality without running full simulations. Use standard pytest patterns: + +**Categories**: +- **API validation**: Test object creation, property setters/getters, XML serialization (e.g., `test_material.py`, `test_cell.py`, `test_source.py`) +- **Data processing**: Test nuclear data handling, cross sections, depletion chains (e.g., `test_data_neutron.py`, `test_deplete_chain.py`) +- **Library bindings**: Test `openmc.lib` ctypes interface with `model.init_lib()`/`model.finalize_lib()` (e.g., `test_lib.py`) +- **Geometry operations**: Test bounding boxes, containment, lattice generation (e.g., `test_bounding_box.py`, `test_lattice.py`) + +**Common patterns**: +- Use fixtures from `tests/unit_tests/conftest.py` (e.g., `uo2`, `water`, `sphere_model`) +- Test invalid inputs with `pytest.raises(ValueError)` or `pytest.raises(TypeError)` +- Use `run_in_tmpdir` fixture for tests that create files +- Tests with `openmc.lib` require calling `model.init_lib()` in try/finally with `model.finalize_lib()` + +**Example**: +```python +def test_material_properties(): + m = openmc.Material() + m.add_nuclide('U235', 1.0) + assert 'U235' in m.nuclides + + with pytest.raises(TypeError): + m.add_nuclide('H1', '1.0') # Invalid type +``` + +Unit tests should be fast. For tests requiring simulation output, use regression tests instead. + +### Python Regression Tests +Regression tests compare OpenMC output against reference data. **Prefer using existing models from `openmc.examples` or those found in tests/unit_tests/conftest.py** (like `pwr_pin_cell()`, `pwr_assembly()`, `slab_mg()`) rather than building from scratch. + +**Test Harness Types** (in `tests/testing_harness.py`): +- **PyAPITestHarness**: Standard harness for Python API tests. Compares `inputs_true.dat` (XML hash) and `results_true.dat` (statepoint k-eff and tally values). Requires `model.xml` generation. +- **HashedPyAPITestHarness**: Like PyAPITestHarness but hashes the results for compact comparison +- **TolerantPyAPITestHarness**: For tests with floating-point non-associativity (e.g., random ray solver with single precision). Uses relative tolerance comparisons. +- **WeightWindowPyAPITestHarness**: Compares weight window bounds from `weight_windows.h5` +- **CollisionTrackTestHarness**: Compares collision track data from `collision_track.h5` against `collision_track_true.h5` +- **TestHarness**: Base harness for XML-based tests (no Python model building) +- **PlotTestHarness**: Compares plot output files (PNG or voxel HDF5) +- **CMFDTestHarness**: Specialized for CMFD acceleration tests +- **ParticleRestartTestHarness**: Tests particle restart functionality + +Almost all cases use either `PyAPITestHarness` or `HashedPyAPITestHarness` + +**Example Test**: +```python +from openmc.examples import pwr_pin_cell +from tests.testing_harness import PyAPITestHarness + +def test_my_feature(): + model = pwr_pin_cell() + model.settings.particles = 1000 # Modify to exercise feature + harness = PyAPITestHarness('statepoint.10.h5', model) + harness.main() +``` + +**Workflow**: Create `test.py` and `__init__.py` in `tests/regression_tests/my_test/`, run `pytest --update` to generate reference files (`inputs_true.dat`, `results_true.dat`, etc.), then verify with `pytest` without `--update`. Test results should be generated with a debug build (`-DCMAKE_BUILD_TYPE=Debug`) + +**Critical**: When modifying OpenMC code, regenerate affected test references with `pytest --update` and commit updated reference files. + +### Test Configuration + +`pytest.ini` sets: `python_files = test*.py`, `python_classes = NoThanks` (disables class-based test collection). + +### Testing Options + +For builds of OpenMC with MPI enabled, the `--mpi` flag should be passed to the test suite to ensure that appropriate tests are executed using two MPI processes. + +The entire test suite can be executed with OpenMC running in event-based mode (instead of the default history-based mode) by providing the `--event` flag to the `pytest` command. + +## Cross-Language Boundaries + +The C API (defined in `include/openmc/capi.h`) exposes C++ functionality to Python via ctypes bindings in `openmc/lib/`. Example: +```cpp +// C++ API in capi.h +extern "C" int openmc_run(); + +// Python binding in openmc/lib/core.py +_dll.openmc_run.restype = c_int +def run(): + _dll.openmc_run() +``` + +When modifying C++ public APIs, update corresponding ctypes signatures in `openmc/lib/*.py`. + +## Code Style & Conventions + +### C++ Style (enforced by .clang-format) + OpenMC generally tries to follow C++ core guidelines where possible + (https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines) and follow + modern C++ practices (e.g. RAII) whenever possible. + +- **Naming**: + - Classes: `CamelCase` (e.g., `HexLattice`) + - Functions/methods: `snake_case` (e.g., `get_indices`) + - Variables: `snake_case` with trailing underscore for class members (e.g., `n_particles_`, `energy_`) + - Constants: `UPPER_SNAKE_CASE` (e.g., `SQRT_PI`) +- **Namespaces**: All code in `openmc::` namespace, global state in sub-namespaces +- **Include order**: Related header first, then C/C++ stdlib, third-party libs, local headers +- **Comments**: C++-style (`//`) only, never C-style (`/* */`) +- **Standard**: C++17 features allowed +- **Formatting**: Run `clang-format` (version 15) before committing; install via `tools/dev/install-commit-hooks.sh` + +### Python Style +- **PEP8** compliant +- **Docstrings**: numpydoc format for all public functions/methods +- **Type hints**: Use sparingly, primarily for complex signatures +- **Path handling**: Use `pathlib.Path` for filesystem operations, accept `str | os.PathLike` in function arguments +- **Dependencies**: Core dependencies only (numpy, scipy, h5py, pandas, matplotlib, lxml, ipython, uncertainties, setuptools, endf). Other packages must be optional +- **Python version**: Minimum 3.11 (as of Nov 2025) + +### ID Management Pattern (Python) +When creating geometry objects, IDs can be auto-assigned or explicit: +```python +# Auto-assigned ID +cell = openmc.Cell() # Gets next available ID + +# Explicit ID +cell = openmc.Cell(id=10) # Warning if ID already used + +# Reset all IDs (useful in test fixtures) +openmc.reset_auto_ids() +``` + +### Input Validation Pattern (Python) +All setters use checkvalue functions: +```python +import openmc.checkvalue as cv + +@property +def temperature(self): + return self._temperature + +@temperature.setter +def temperature(self, temp): + cv.check_type('temperature', temp, Real) + cv.check_greater_than('temperature', temp, 0.0) + self._temperature = temp +``` + +### Working with HDF5 Files +C++ uses custom HDF5 wrappers in `src/hdf5_interface.cpp`. Python uses h5py directly. Statepoint format version is `VERSION_STATEPOINT` in `include/openmc/constants.h`. + +### Conditional Compilation +Check for optional features: +```cpp +#ifdef OPENMC_MPI + // MPI-specific code +#endif + +#ifdef OPENMC_DAGMC + // DAGMC-specific code +#endif +``` + +## Documentation + +- **User docs**: Sphinx documentation in `docs/source/` hosted at https://docs.openmc.org +- **C++ docs**: Doxygen-style comments with `\brief`, `\param` tags +- **Python docs**: numpydoc format docstrings + +## Common Pitfalls + +1. **Forgetting nuclear data**: Tests fail without `OPENMC_CROSS_SECTIONS` environment variable +2. **ID conflicts**: Python objects with duplicate IDs trigger `IDWarning`, use `reset_auto_ids()` between tests +3. **MPI builds**: Code must work with and without MPI; use `#ifdef OPENMC_MPI` guards +4. **Path handling**: Use `pathlib.Path` in new Python code, not `os.path` +5. **Clang-format version**: CI uses version 15; other versions may produce different formatting diff --git a/CITATION.cff b/CITATION.cff new file mode 100644 index 000000000..ab27d89b8 --- /dev/null +++ b/CITATION.cff @@ -0,0 +1,68 @@ +cff-version: 1.2.0 +message: "If you use this software, please cite it as below." +title: OpenMC +authors: +- family-names: Romano + given-names: Paul K. + orcid: "https://orcid.org/0000-0002-1147-045X" +- family-names: Shriwise + given-names: Patrick C. + orcid: "https://orcid.org/0000-0002-3979-7665" +- family-names: Shimwell + given-names: Jonathan + orcid: "https://orcid.org/0000-0001-6909-0946" +- family-names: Harper + given-names: Sterling +- family-names: Boyd + given-names: Will +- family-names: Nelson + given-names: Adam G. + orcid: "https://orcid.org/0000-0002-3614-0676" +- family-names: Tramm + given-names: John R. + orcid: "https://orcid.org/0000-0002-5397-4402" +- family-names: Ridley + given-names: Gavin + orcid: "https://orcid.org/0000-0003-1635-8042" +- family-names: Johnson + given-names: Andrew + orcid: "https://orcid.org/0000-0003-2125-8775" +- family-names: Peterson + given-names: Ethan E. + orcid: "https://orcid.org/0000-0002-5694-7194" +- family-names: Herman + given-names: Bryan R. +preferred-citation: + authors: + - family-names: Romano + given-names: Paul K. + orcid: "https://orcid.org/0000-0002-1147-045X" + - family-names: Horelik + given-names: Nicholas E. + - family-names: Herman + given-names: Bryan R. + - family-names: Nelson + given-names: Adam G. + orcid: "https://orcid.org/0000-0002-3614-0676" + - family-names: Forget + given-names: Benoit + orcid: "https://orcid.org/0000-0003-1459-7672" + - family-names: Smith + given-names: Kord + contact: + - family-names: Romano + given-names: Paul K. + orcid: "https://orcid.org/0000-0002-1147-045X" + doi: 10.1016/j.anucene.2014.07.048 + issn: 0306-4549 + volume: 82 + journal: Annals of Nuclear Energy + publisher: + name: Elsevier + start: 90 + end: 97 + year: 2015 + month: 8 + title: "OpenMC: A state-of-the-art Monte Carlo code for research and development" + type: article + url: "https://doi.org/10.1016/j.anucene.2014.07.048" diff --git a/CMakeLists.txt b/CMakeLists.txt index 461abe508..87b8789d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,8 +36,8 @@ option(OPENMC_ENABLE_COVERAGE "Compile with coverage analysis flags" option(OPENMC_USE_DAGMC "Enable support for DAGMC (CAD) geometry" OFF) option(OPENMC_USE_LIBMESH "Enable support for libMesh unstructured mesh tallies" OFF) option(OPENMC_USE_MPI "Enable MPI" OFF) -option(OPENMC_USE_MCPL "Enable MCPL" OFF) option(OPENMC_USE_UWUW "Enable UWUW" OFF) +option(OPENMC_FORCE_VENDORED_LIBS "Explicitly use submodules defined in 'vendor'" OFF) message(STATUS "OPENMC_USE_OPENMP ${OPENMC_USE_OPENMP}") message(STATUS "OPENMC_BUILD_TESTS ${OPENMC_BUILD_TESTS}") @@ -46,8 +46,8 @@ message(STATUS "OPENMC_ENABLE_COVERAGE ${OPENMC_ENABLE_COVERAGE}") message(STATUS "OPENMC_USE_DAGMC ${OPENMC_USE_DAGMC}") message(STATUS "OPENMC_USE_LIBMESH ${OPENMC_USE_LIBMESH}") message(STATUS "OPENMC_USE_MPI ${OPENMC_USE_MPI}") -message(STATUS "OPENMC_USE_MCPL ${OPENMC_USE_MCPL}") message(STATUS "OPENMC_USE_UWUW ${OPENMC_USE_UWUW}") +message(STATUS "OPENMC_FORCE_VENDORED_LIBS ${OPENMC_FORCE_VENDORED_LIBS}") # Warnings for deprecated options foreach(OLD_OPT IN ITEMS "openmp" "profile" "coverage" "dagmc" "libmesh") @@ -189,15 +189,6 @@ if(${HDF5_VERSION} VERSION_GREATER_EQUAL 1.12.0) list(APPEND cxxflags -DH5Oget_info_by_idx_vers=1 -DH5O_info_t_vers=1) endif() -#=============================================================================== -# MCPL -#=============================================================================== - -if (OPENMC_USE_MCPL) - find_package(MCPL REQUIRED) - message(STATUS "Found MCPL: ${MCPL_DIR} (found version \"${MCPL_VERSION}\")") -endif() - #=============================================================================== # Set compile/link flags based on which compiler is being used #=============================================================================== @@ -249,31 +240,47 @@ endif() # pugixml library #=============================================================================== -find_package_write_status(pugixml) -if (NOT pugixml_FOUND) +if(OPENMC_FORCE_VENDORED_LIBS) add_subdirectory(vendor/pugixml) set_target_properties(pugixml PROPERTIES CXX_STANDARD 14 CXX_EXTENSIONS OFF) +else() + find_package_write_status(pugixml) + if (NOT pugixml_FOUND) + add_subdirectory(vendor/pugixml) + set_target_properties(pugixml PROPERTIES CXX_STANDARD 14 CXX_EXTENSIONS OFF) + endif() endif() #=============================================================================== # {fmt} library #=============================================================================== -find_package_write_status(fmt) -if (NOT fmt_FOUND) +if(OPENMC_FORCE_VENDORED_LIBS) set(FMT_INSTALL ON CACHE BOOL "Generate the install target.") add_subdirectory(vendor/fmt) +else() + find_package_write_status(fmt) + if (NOT fmt_FOUND) + set(FMT_INSTALL ON CACHE BOOL "Generate the install target.") + add_subdirectory(vendor/fmt) + endif() endif() #=============================================================================== # xtensor header-only library #=============================================================================== -find_package_write_status(xtensor) -if (NOT xtensor_FOUND) +if(OPENMC_FORCE_VENDORED_LIBS) add_subdirectory(vendor/xtl) set(xtl_DIR ${CMAKE_CURRENT_BINARY_DIR}/vendor/xtl) add_subdirectory(vendor/xtensor) +else() + find_package_write_status(xtensor) + if (NOT xtensor_FOUND) + add_subdirectory(vendor/xtl) + set(xtl_DIR ${CMAKE_CURRENT_BINARY_DIR}/vendor/xtl) + add_subdirectory(vendor/xtensor) + endif() endif() #=============================================================================== @@ -281,9 +288,13 @@ endif() #=============================================================================== if(OPENMC_BUILD_TESTS) - find_package_write_status(Catch2) - if (NOT Catch2_FOUND) + if (OPENMC_FORCE_VENDORED_LIBS) add_subdirectory(vendor/Catch2) + else() + find_package_write_status(Catch2) + if (NOT Catch2_FOUND) + add_subdirectory(vendor/Catch2) + endif() endif() endif() @@ -327,6 +338,7 @@ list(APPEND libopenmc_SOURCES src/cell.cpp src/chain.cpp src/cmfd_solver.cpp + src/collision_track.cpp src/cross_sections.cpp src/dagmc.cpp src/distribution.cpp @@ -343,6 +355,7 @@ list(APPEND libopenmc_SOURCES src/geometry.cpp src/geometry_aux.cpp src/hdf5_interface.cpp + src/ifp.cpp src/initialize.cpp src/lattice.cpp src/material.cpp @@ -406,6 +419,7 @@ list(APPEND libopenmc_SOURCES src/tallies/filter_materialfrom.cpp src/tallies/filter_mesh.cpp src/tallies/filter_meshborn.cpp + src/tallies/filter_meshmaterial.cpp src/tallies/filter_meshsurface.cpp src/tallies/filter_mu.cpp src/tallies/filter_musurface.cpp @@ -417,6 +431,7 @@ list(APPEND libopenmc_SOURCES src/tallies/filter_surface.cpp src/tallies/filter_time.cpp src/tallies/filter_universe.cpp + src/tallies/filter_weight.cpp src/tallies/filter_zernike.cpp src/tallies/tally.cpp src/tallies/tally_scoring.cpp @@ -489,11 +504,11 @@ else() endif() if(OPENMC_USE_DAGMC) - target_compile_definitions(libopenmc PRIVATE DAGMC) + target_compile_definitions(libopenmc PRIVATE OPENMC_DAGMC_ENABLED) target_link_libraries(libopenmc dagmc-shared) if(OPENMC_USE_UWUW) - target_compile_definitions(libopenmc PRIVATE OPENMC_UWUW) + target_compile_definitions(libopenmc PRIVATE OPENMC_UWUW_ENABLED) target_link_libraries(libopenmc uwuw-shared) endif() elseif(OPENMC_USE_UWUW) @@ -502,7 +517,7 @@ elseif(OPENMC_USE_UWUW) endif() if(OPENMC_USE_LIBMESH) - target_compile_definitions(libopenmc PRIVATE LIBMESH) + target_compile_definitions(libopenmc PRIVATE OPENMC_LIBMESH_ENABLED) target_link_libraries(libopenmc PkgConfig::LIBMESH) endif() @@ -525,11 +540,6 @@ if (OPENMC_BUILD_TESTS) add_subdirectory(tests/cpp_unit_tests) endif() -if (OPENMC_USE_MCPL) - target_compile_definitions(libopenmc PUBLIC OPENMC_MCPL) - target_link_libraries(libopenmc MCPL::mcpl) -endif() - #=============================================================================== # Log build info that this executable can report later #=============================================================================== diff --git a/Dockerfile b/Dockerfile index 1ae615a50..a163a2810 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,7 +24,7 @@ ARG compile_cores=1 ARG build_dagmc=off ARG build_libmesh=off -FROM debian:bookworm-slim AS dependencies +FROM ubuntu:24.04 AS dependencies ARG compile_cores ARG build_dagmc @@ -96,6 +96,7 @@ RUN if [ "$build_dagmc" = "on" ]; then \ # Install addition packages required for DAGMC apt-get -y install libeigen3-dev libnetcdf-dev libtbb-dev libglfw3-dev \ && pip install --upgrade numpy \ + && pip install --no-cache-dir setuptools cython \ # Clone and install EMBREE && mkdir -p $HOME/EMBREE && cd $HOME/EMBREE \ && git clone --single-branch -b ${EMBREE_TAG} --depth 1 ${EMBREE_REPO} \ diff --git a/cmake/Modules/GetVersionFromGit.cmake b/cmake/Modules/GetVersionFromGit.cmake index 42b3725f2..3736955ff 100644 --- a/cmake/Modules/GetVersionFromGit.cmake +++ b/cmake/Modules/GetVersionFromGit.cmake @@ -37,11 +37,17 @@ if(EXISTS "${CMAKE_SOURCE_DIR}/.git" AND GIT_FOUND) WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE VERSION_STRING OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET ) - # If no tags are found, instruct user to fetch them + # If no tags are found, set version to 0 and show a warning if(VERSION_STRING STREQUAL "") - message(FATAL_ERROR "No git tags found. Run 'git fetch --tags' and try again.") + set(VERSION_STRING "0.0.0") + message(WARNING + "No git tags found. Version set to 0.0.0.\n" + "Run 'git fetch --tags' to ensure proper versioning.\n" + "For more information, see OpenMC developer documentation." + ) endif() # Extract the commit hash diff --git a/cmake/OpenMCConfig.cmake.in b/cmake/OpenMCConfig.cmake.in index 5cab4790a..837a39c78 100644 --- a/cmake/OpenMCConfig.cmake.in +++ b/cmake/OpenMCConfig.cmake.in @@ -1,9 +1,12 @@ get_filename_component(OpenMC_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" DIRECTORY) -find_package(fmt REQUIRED HINTS ${OpenMC_CMAKE_DIR}/../fmt) -find_package(pugixml REQUIRED HINTS ${OpenMC_CMAKE_DIR}/../pugixml) -find_package(xtl REQUIRED HINTS ${OpenMC_CMAKE_DIR}/../xtl) -find_package(xtensor REQUIRED HINTS ${OpenMC_CMAKE_DIR}/../xtensor) +# Compute the install prefix from this file's location +get_filename_component(_OPENMC_PREFIX "${OpenMC_CMAKE_DIR}/../../.." ABSOLUTE) + +find_package(fmt CONFIG REQUIRED HINTS ${_OPENMC_PREFIX}) +find_package(pugixml CONFIG REQUIRED HINTS ${_OPENMC_PREFIX}) +find_package(xtl CONFIG REQUIRED HINTS ${_OPENMC_PREFIX}) +find_package(xtensor CONFIG REQUIRED HINTS ${_OPENMC_PREFIX}) if(@OPENMC_USE_DAGMC@) find_package(DAGMC REQUIRED HINTS @DAGMC_DIR@) endif() @@ -29,10 +32,6 @@ if(@OPENMC_USE_OPENMP@) find_package(OpenMP REQUIRED) endif() -if(@OPENMC_USE_MCPL@) - find_package(MCPL REQUIRED) -endif() - if(@OPENMC_USE_UWUW@ AND NOT ${DAGMC_BUILD_UWUW}) message(FATAL_ERROR "UWUW is enabled in OpenMC but the DAGMC installation discovered was not configured with UWUW.") endif() diff --git a/docs/source/_images/sphere-mesh-vtk.png b/docs/source/_images/sphere-mesh-vtk.png new file mode 100644 index 000000000..73b412bdd Binary files /dev/null and b/docs/source/_images/sphere-mesh-vtk.png differ diff --git a/docs/source/capi/index.rst b/docs/source/capi/index.rst index d9ac0d1e0..2583d51df 100644 --- a/docs/source/capi/index.rst +++ b/docs/source/capi/index.rst @@ -84,6 +84,17 @@ Functions :return: Return status (negative if an error occurred) :rtype: int +.. c:function:: int openmc_cell_get_density(int32_t index, const int32_t* instance, double* density) + + Get the density of a cell + + :param int32_t index: Index in the cells array + :param int32_t* instance: Which instance of the cell. If a null pointer is passed, the density + multiplier of the first instance is returned. + :param double* density: Density of the cell in [g/cm3] + :return: Return status (negative if an error occurred) + :rtype: int + .. c:function:: int openmc_cell_set_fill(int32_t index, int type, int32_t n, const int32_t* indices) Set the fill for a cell @@ -113,8 +124,22 @@ Functions :param double T: Temperature in Kelvin :param instance: Which instance of the cell. To set the temperature for all instances, pass a null pointer. - :param set_contained: If the cell is not filled by a material, whether to set the temperatures - of all filled cells + :param bool set_contained: If the cell is not filled by a material, whether + to set the temperatures of all filled cells + :type instance: const int32_t* + :return: Return status (negative if an error occurred) + :rtype: int + +.. c:function:: int openmc_cell_set_density(index index, double density, const int32_t* instance, bool set_contained) + + Set the density of a cell. + + :param int32_t index: Index in the cells array + :param double density: Density of the cell in [g/cm3] + :param instance: Which instance of the cell. To set the density multiplier for all + instances, pass a null pointer. + :param bool set_contained: If the cell is not filled by a material, whether + to set the density multiplier of all filled cells :type instance: const int32_t* :return: Return status (negative if an error occurred) :rtype: int diff --git a/docs/source/conf.py b/docs/source/conf.py index 8aeff5cdc..826c20022 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -121,9 +121,7 @@ pygments_style = 'tango' # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages -import sphinx_rtd_theme html_theme = 'sphinx_rtd_theme' -html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] html_baseurl = "https://docs.openmc.org/en/stable/" html_logo = '_images/openmc_logo.png' diff --git a/docs/source/devguide/policies.rst b/docs/source/devguide/policies.rst index 2cf319987..3644ae822 100644 --- a/docs/source/devguide/policies.rst +++ b/docs/source/devguide/policies.rst @@ -21,8 +21,8 @@ C++ code in OpenMC must conform to the most recent C++ standard that is fully supported in the `version of the gcc compiler `_ that is distributed with the oldest version of Ubuntu that is still within its `standard support period -`_. Ubuntu 20.04 LTS will be supported -through April 2025 and is distributed with gcc 9.3.0, which fully supports the +`_. Ubuntu 22.04 LTS will be supported +through April 2027 and is distributed with gcc 11.4.0, which fully supports the C++17 standard. -------------------- @@ -31,5 +31,5 @@ CMake Version Policy Similar to the C++ standard policy, the minimum supported version of CMake corresponds to whatever version is distributed with the oldest version of Ubuntu -still within its standard support period. Ubuntu 20.04 LTS is distributed with -CMake 3.16. +still within its standard support period. Ubuntu 22.04 LTS is distributed with +CMake 3.22. diff --git a/docs/source/devguide/workflow.rst b/docs/source/devguide/workflow.rst index d600c236f..c49326a20 100644 --- a/docs/source/devguide/workflow.rst +++ b/docs/source/devguide/workflow.rst @@ -91,6 +91,30 @@ features and bug fixes. The general steps for contributing are as follows: 6. After the pull request has been thoroughly vetted, it is merged back into the *develop* branch of openmc-dev/openmc. +Setting Up Upstream Tracking (Required for Versioning) +------------------------------------------------------ + +By default, your fork **does not** include tags from the upstream OpenMC repository. +OpenMC relies on `git describe --tags` for versioning in source builds, and missing tags can lead +to incorrect version detection (i.e., ``0.0.0``). To ensure proper versioning, follow these steps: + +1. **Add the Upstream Repository** + This allows you to fetch updates from the main OpenMC repository. + + .. code-block:: sh + + git remote add upstream https://github.com/openmc-dev/openmc.git + +2. **Fetch and Push Tags** + Retrieve tags from the upstream repository and update your fork: + + .. code-block:: sh + + git fetch --tags upstream + git push --tags origin + +This ensures that both your **local** and **remote** fork have the correct versioning information. + Private Development ------------------- diff --git a/docs/source/io_formats/collision_track.rst b/docs/source/io_formats/collision_track.rst new file mode 100644 index 000000000..a36459754 --- /dev/null +++ b/docs/source/io_formats/collision_track.rst @@ -0,0 +1,46 @@ +.. _io_collision_track: + +=========================== +Collision Track File Format +=========================== + +When collision tracking is enabled with ``mcpl=false`` (the default), OpenMC +writes binary data to an HDF5 file named ``collision_track.h5``. The same data +may also be written after each batch when multiple files are requested +(``collision_track.N.h5``) or when the run is performed in parallel. The file +contains the information needed to reconstruct each recorded collision. + +The current revision of the collision track file format is 1.0. + +**/** + +:Attributes: + - **filetype** (*char[]*) -- String indicating the type of file. + For collision-track files the value is ``"collision_track"``. + +:Datasets: + + - **collision_track_bank** (Compound type) -- Collision information + for each stored event. Each entry in the dataset corresponds to one + collision and contains the following fields: + + - ``r`` (*double[3]*) -- Position of the collision in [cm]. + - ``u`` (*double[3]*) -- Direction unit vector immediately after the collision. + - ``E`` (*double*) -- Incident particle energy before the collision in [eV]. + - ``dE`` (*double*) -- Energy loss over the collision (:math:`E_\text{before} - E_\text{after}`) in [eV]. + - ``time`` (*double*) -- Time of the collision in [s]. + - ``wgt`` (*double*) -- Particle weight at the collision. + - ``event_mt`` (*int*) -- ENDF MT number identifying the reaction. + - ``delayed_group`` (*int*) -- Delayed neutron group index (non-zero for delayed events). + - ``cell_id`` (*int*) -- ID of the cell in which the collision occurred. + - ``nuclide_id`` (*int*) -- ZA identifier of the nuclide (ZZZAAAM format). + - ``material_id`` (*int*) -- ID of the material containing the collision site. + - ``universe_id`` (*int*) -- ID of the universe containing the collision site. + - ``n_collision`` (*int*) -- Collision counter for the particle history. + - ``particle`` (*int*) -- Particle type (0=neutron, 1=photon, 2=electron, 3=positron). + - ``parent_id`` (*int64*) -- Unique ID of the parent particle. + - ``progeny_id`` (*int64*) -- Progeny ID of the particle. + +In an MPI run, OpenMC writes the combined dataset by gathering collision-track +entries from all ranks before flushing them to disk, so the final file appears +as though it were produced serially. diff --git a/docs/source/io_formats/depletion_chain.rst b/docs/source/io_formats/depletion_chain.rst index 89c76525f..74413e7b6 100644 --- a/docs/source/io_formats/depletion_chain.rst +++ b/docs/source/io_formats/depletion_chain.rst @@ -56,6 +56,27 @@ attributes: .. _io_chain_reaction: +-------------------- +```` Element +-------------------- + +The ```` element represents photon and electron sources associated with +the decay of a nuclide and contains information to construct an +:class:`openmc.stats.Univariate` object that represents this emission as an +energy distribution. This element has the following attributes: + + :type: + The type of :class:`openmc.stats.Univariate` source term. + + :particle: + The type of particle emitted, e.g., 'photon' or 'electron' + + :parameters: + The parameters of the source term, e.g., for a + :class:`openmc.stats.Discrete` source, the energies (in [eV]) at which the + particles are emitted and their relative intensities in [Bq/atom] (in other + words, decay constants). + ---------------------- ```` Element ---------------------- diff --git a/docs/source/io_formats/depletion_results.rst b/docs/source/io_formats/depletion_results.rst index 7035fc9c9..b2a726dad 100644 --- a/docs/source/io_formats/depletion_results.rst +++ b/docs/source/io_formats/depletion_results.rst @@ -4,7 +4,7 @@ Depletion Results File Format ============================= -The current version of the depletion results file format is 1.1. +The current version of the depletion results file format is 1.2. **/** @@ -12,22 +12,20 @@ The current version of the depletion results file format is 1.1. - **version** (*int[2]*) -- Major and minor version of the statepoint file format. -:Datasets: - **eigenvalues** (*double[][][2]*) -- k-eigenvalues at each - time/stage. This array has shape (number of timesteps, number of - stages, value). The last axis contains the eigenvalue and the - associated uncertainty - - **number** (*double[][][][]*) -- Total number of atoms. This array - has shape (number of timesteps, number of stages, number of +:Datasets: - **eigenvalues** (*double[][2]*) -- k-eigenvalues at each timestep. + This array has shape (number of timesteps, 2). The second axis + contains the eigenvalue and its associated uncertainty. + - **number** (*double[][][]*) -- Total number of atoms at each + timestep. This array has shape (number of timesteps, number of materials, number of nuclides). - - **reaction rates** (*double[][][][][]*) -- Reaction rates used to - build depletion matrices. This array has shape (number of - timesteps, number of stages, number of materials, number of - nuclides, number of reactions). + - **reaction rates** (*double[][][][]*) -- Reaction rates at each + timestep. This array has shape (number of timesteps, number of + materials, number of nuclides, number of reactions). Only stored if + write_rates=True. - **time** (*double[][2]*) -- Time in [s] at beginning/end of each step. - - **source_rate** (*double[][]*) -- Power in [W] or source rate in - [neutron/sec]. This array has shape (number of timesteps, number - of stages). + - **source_rate** (*double[]*) -- Power in [W] or source rate in + [neutron/sec] for each timestep. - **depletion time** (*double[]*) -- Average process time in [s] spent depleting a material across all burnable materials and, if applicable, MPI processes. diff --git a/docs/source/io_formats/geometry.rst b/docs/source/io_formats/geometry.rst index 6d0a37a24..cef3bb79c 100644 --- a/docs/source/io_formats/geometry.rst +++ b/docs/source/io_formats/geometry.rst @@ -38,11 +38,9 @@ Each ```` element can have the following attributes or sub-elements: :boundary: The boundary condition for the surface. This can be "transmission", - "vacuum", "reflective", or "periodic". Periodic boundary conditions can - only be applied to x-, y-, and z-planes. Only axis-aligned periodicity is - supported, i.e., x-planes can only be paired with x-planes. Specify which - planes are periodic and the code will automatically identify which planes - are paired together. + "vacuum", "reflective", or "periodic". Specify which planes are + periodic and the code will automatically identify which planes are + paired together. *Default*: "transmission" @@ -318,9 +316,10 @@ the following attributes or sub-elements: *Default*: None :orientation: - The orientation of the hexagonal lattice. The string "x" indicates that two - sides of the lattice are parallel to the x-axis, whereas the string "y" - indicates that two sides are parallel to the y-axis. + The orientation of the hexagonal lattice. The string "x" indicates that each + lattice element has two faces that are perpendicular to the x-axis, whereas + the string "y" indicates that each lattice element has two faces that are + perpendicular to the y-axis. *Default*: "y" diff --git a/docs/source/io_formats/index.rst b/docs/source/io_formats/index.rst index 4bbaa961a..5b4efea66 100644 --- a/docs/source/io_formats/index.rst +++ b/docs/source/io_formats/index.rst @@ -44,6 +44,7 @@ Output Files statepoint source + collision_track summary properties depletion_results diff --git a/docs/source/io_formats/properties.rst b/docs/source/io_formats/properties.rst index 5030e78f3..4cc5da379 100644 --- a/docs/source/io_formats/properties.rst +++ b/docs/source/io_formats/properties.rst @@ -4,7 +4,7 @@ Properties File Format ====================== -The current version of the properties file format is 1.0. +The current version of the properties file format is 1.1. **/** @@ -25,6 +25,7 @@ The current version of the properties file format is 1.0. **/geometry/cells/cell /** :Datasets: - **temperature** (*double[]*) -- Temperature of the cell in [K]. + - **density** (*double[]*) -- Density of the cell in [g/cm3]. **/materials/** diff --git a/docs/source/io_formats/settings.rst b/docs/source/io_formats/settings.rst index a59d08049..b986a526a 100644 --- a/docs/source/io_formats/settings.rst +++ b/docs/source/io_formats/settings.rst @@ -20,6 +20,85 @@ source neutrons. *Default*: None +----------------------------- +```` Element +----------------------------- + +The ```` element indicates to track information about particle +collisions based on a set of criteria and store these events in a file named +``collision_track.h5``. This file records details such as the position of the +interaction, direction of the incoming particle, incident energy and deposited +energy, weight, time of the interaction, and the delayed neutron group (0 for +prompt neutrons). Additional information such as the cell ID, material ID, +universe ID, nuclide ZAID, particle type, and event MT number are also stored. +Users can specify one or more criterion to filter collisions. If no criteria are +specified, it defaults to tracking all collisions across the model. + +.. warning:: + Storing all collisions can be very memory intensive. For more targeted + tracking, users can employ a variety of parameters such as ``cell_ids``, + ``reactions``, ``universe_ids``, ``material_ids``, ``nuclides``, and + ``deposited_E_threshold`` to refine the selection of particle interactions + to be banked. + +This element can contain one or more of the following attributes or +sub-elements: + + :max_collisions: + An integer indicating the maximum number of collisions to be banked per file. + + *Default*: 1000 + + :max_collision_track_files: + An integer indicating the number of collision_track files to be used. + + *Default*: 1 + + :mcpl: + An optional boolean to enable MCPL_-format instead of the native HDF5-based + format. If activated, the output file name and type is changed to + ``collision_track.mcpl``. + + *Default*: false + + .. _MCPL: https://mctools.github.io/mcpl/mcpl.pdf + + :cell_ids: + A list of integers representing cell IDs to define specific cells in which + collisions are to be banked. + + *Default*: None + + :universe_ids: + A list of integers representing the universe IDs to define specific + universes in which collisions are to be banked. + + *Default*: None + + :material_ids: + A list of integers representing the material IDs to define specific + materials in which collisions are to be banked. + + *Default*: None + + :nuclides: + A list of strings representing the nuclide, to define specific + define specific target nuclide collisions to be banked. + + *Default*: None + + :reactions: + A list of integers representing the ENDF-6 format MT numbers or strings + (e.g. (n,fission)) to define specific reaction types to be banked. + + *Default*: None + + :deposited_E_threshold: + A float defining the minimum deposited energy per collision (in eV) to + trigger banking. + + *Default*: 0.0 + ---------------------------------- ```` Element ---------------------------------- @@ -178,6 +257,16 @@ history-based parallelism. *Default*: false +-------------------------------- +```` Element +-------------------------------- + +The ```` element specifies the energy multiplier, expressed +in units of :math:`kT`, that determines when the free gas scattering approach is +used for elastic scattering. Values must be positive. + + *Default*: 400.0 + ----------------------------------- ```` Element ----------------------------------- @@ -488,6 +577,14 @@ found in the :ref:`random ray user guide `. :type: The type of the domain. Can be ``material``, ``cell``, or ``universe``. + :diagonal_stabilization_rho: + The rho factor for use with diagonal stabilization. This technique is + applied when negative diagonal (in-group) elements are detected in + the scattering matrix of input MGXS data, which is a common feature + of transport corrected MGXS data. + + *Default*: 1.0 + ---------------------------------- ```` Element ---------------------------------- @@ -747,13 +844,18 @@ attributes/sub-elements: relative source strength of each mesh element or each point in the cloud. :volume_normalized: - For "mesh" spatial distrubtions, this optional boolean element specifies + For "mesh" spatial distributions, this optional boolean element specifies whether the vector of relative strengths should be multiplied by the mesh element volume. This is most common if the strengths represent a source per unit volume. *Default*: false + :bias: + For "mesh" and "cloud" spatial distributions, this optional element + specifies floating point values corresponding to alternative probabilities + for each value/component to use for biased sampling. + :angle: An element specifying the angular distribution of source sites. This element has the following attributes: @@ -786,6 +888,10 @@ attributes/sub-elements: are those of a univariate probability distribution (see the description in :ref:`univariate`). + :bias: + For "isotropic" angular distributions, this optional element specifies a + "mu-phi" angular distribution used for biased sampling. + :energy: An element specifying the energy distribution of source sites. The necessary sub-elements/attributes are those of a univariate probability distribution @@ -809,6 +915,10 @@ attributes/sub-elements: mesh element and follows the format for :ref:`source_element`. The number of ```` sub-elements should correspond to the number of mesh elements. + .. note:: Biased sampling can be applied to the spatial and energy distributions + of a source by using the ```` sub-element (see + :ref:`univariate` for details on how to specify bias distributions). + :constraints: This sub-element indicates the presence of constraints on sampled source sites (see :ref:`usersguide_source_constraints` for details). It may have @@ -901,13 +1011,36 @@ variable and whose sub-elements/attributes are as follows: *Default*: histogram :pair: - For a "mixture" distribution, this element provides a distribution and its corresponding probability. + For a "mixture" distribution, this element provides a distribution and its + corresponding probability. :probability: - An attribute or ``pair`` that provides the probability of a univariate distribution within a "mixture" distribution. + An attribute or ``pair`` that provides the probability of a univariate + distribution within a "mixture" distribution. :dist: - This sub-element of a ``pair`` element provides information on the corresponding univariate distribution. + This sub-element of a ``pair`` element provides information on the + corresponding univariate distribution. + +:bias: + This optional element specifies a biased distribution for importance sampling. + For continuous distributions, the ``bias`` element should contain another + univariate distribution with the same support (interval) as the parent + distribution. For discrete distributions, the ``bias`` element should contain + floating point values corresponding to alternative probabilities for each + value/component to be used for biased sampling. + + *Default*: None + +--------------------------------------- +```` Element +--------------------------------------- + +The ```` element specifies the minimum fraction of +external source sites that must be accepted when applying rejection sampling +based on constraints. + + *Default*: 0.05 ------------------------- ```` Element diff --git a/docs/source/io_formats/statepoint.rst b/docs/source/io_formats/statepoint.rst index 3b1031769..2309643dc 100644 --- a/docs/source/io_formats/statepoint.rst +++ b/docs/source/io_formats/statepoint.rst @@ -149,6 +149,8 @@ The current version of the statepoint file format is 18.1. tallies will have a value of 0 unless otherwise instructed. - **multiply_density** (*int*) -- Flag indicating whether reaction rates should be multiplied by atom density (1) or not (0). + - **higher_moments** (*int*) -- Flag indicating whether + higher-order tally moments are enabled (1) or not (0). :Datasets: - **n_realizations** (*int*) -- Number of realizations. - **n_filters** (*int*) -- Number of filters used. diff --git a/docs/source/io_formats/summary.rst b/docs/source/io_formats/summary.rst index 7d3ab94d9..64ca68b9c 100644 --- a/docs/source/io_formats/summary.rst +++ b/docs/source/io_formats/summary.rst @@ -4,7 +4,7 @@ Summary File Format =================== -The current version of the summary file format is 6.0. +The current version of the summary file format is 6.1. **/** @@ -38,6 +38,7 @@ The current version of the summary file format is 6.0. is an array if the cell uses distributed materials, otherwise it is a scalar. - **temperature** (*double[]*) -- Temperature of the cell in Kelvin. + - **density** (*double[]*) -- Density of the cell in [g/cm3]. - **translation** (*double[3]*) -- Translation applied to the fill universe. This dataset is present only if fill_type is set to 'universe'. diff --git a/docs/source/methods/charged_particles_physics.rst b/docs/source/methods/charged_particles_physics.rst new file mode 100644 index 000000000..5d763074f --- /dev/null +++ b/docs/source/methods/charged_particles_physics.rst @@ -0,0 +1,362 @@ +.. _methods_charged_particle_physics: + +======================== +Charged Particle Physics +======================== + +OpenMC neglects the spatial transport of charged particles (electrons and +positrons), assuming they deposit all their energy locally and produce +bremsstrahlung photons at their birth location. This approximation, called +thick-target bremsstrahlung (TTB) approximation is justified by the fact that +charged particles have much shorter stopping ranges compared to neutrons and +photons, especially in high-density materials. + +----------------------------- +Charged Particle Interactions +----------------------------- + +Bremsstrahlung +-------------- + +When a charged particle is decelerated in the field of an atom, some of its +kinetic energy is converted into electromagnetic radiation known as +bremsstrahlung, or 'braking radiation'. In each event, an electron or positron +with kinetic energy :math:`T` generates a photon with an energy :math:`E` +between :math:`0` and :math:`T`. Bremsstrahlung is described by a cross section +that is differential in photon energy, in the direction of the emitted photon, +and in the final direction of the charged particle. However, in Monte Carlo +simulations it is typical to integrate over the angular variables to obtain a +single differential cross section with respect to photon energy, which is often +expressed in the form + +.. math:: + :label: bremsstrahlung-dcs + + \frac{d\sigma_{\text{br}}}{dE} = \frac{Z^2}{\beta^2} \frac{1}{E} + \chi(Z, T, \kappa), + +where :math:`\kappa = E/T` is the reduced photon energy and :math:`\chi(Z, T, +\kappa)` is the scaled bremsstrahlung cross section, which is experimentally +measured. + +Because electrons are attracted to atomic nuclei whereas positrons are +repulsed, the cross section for positrons is smaller, though it approaches that +of electrons in the high energy limit. To obtain the positron cross section, we +multiply :eq:`bremsstrahlung-dcs` by the :math:`\kappa`-independent factor used +in Salvat_, + +.. math:: + :label: positron-factor + + \begin{aligned} + F_{\text{p}}(Z,T) = + & 1 - \text{exp}(-1.2359\times 10^{-1}t + 6.1274\times 10^{-2}t^2 - 3.1516\times 10^{-2}t^3 \\ + & + 7.7446\times 10^{-3}t^4 - 1.0595\times 10^{-3}t^5 + 7.0568\times 10^{-5}t^6 \\ + & - 1.8080\times 10^{-6}t^7), + \end{aligned} + +where + +.. math:: + :label: positron-factor-t + + t = \ln\left(1 + \frac{10^6}{Z^2}\frac{T}{\text{m}_\text{e}c^2} \right). + +:math:`F_{\text{p}}(Z,T)` is the ratio of the radiative stopping powers for +positrons and electrons. Stopping power describes the average energy loss per +unit path length of a charged particle as it passes through matter: + +.. math:: + :label: stopping-power + + -\frac{dT}{ds} = n \int E \frac{d\sigma}{dE} dE \equiv S(T), + +where :math:`n` is the number density of the material and :math:`d\sigma/dE` is +the cross section differential in energy loss. The total stopping power +:math:`S(T)` can be separated into two components: the radiative stopping +power :math:`S_{\text{rad}}(T)`, which refers to energy loss due to +bremsstrahlung, and the collision stopping power :math:`S_{\text{col}}(T)`, +which refers to the energy loss due to inelastic collisions with bound +electrons in the material that result in ionization and excitation. The +radiative stopping power for electrons is given by + +.. math:: + :label: radiative-stopping-power + + S_{\text{rad}}(T) = n \frac{Z^2}{\beta^2} T \int_0^1 \chi(Z,T,\kappa) + d\kappa. + + +To obtain the radiative stopping power for positrons, +:eq:`radiative-stopping-power` is multiplied by :eq:`positron-factor`. + +While the models for photon interactions with matter described above can safely +assume interactions occur with free atoms, sampling the target atom based on +the macroscopic cross sections, molecular effects cannot necessarily be +disregarded for charged particle treatment. For compounds and mixtures, the +bremsstrahlung cross section is calculated using Bragg's additivity rule as + +.. math:: + :label: material-bremsstrahlung-dcs + + \frac{d\sigma_{\text{br}}}{dE} = \frac{1}{\beta^2 E} \sum_i \gamma_i Z^2_i + \chi(Z_i, T, \kappa), + +where the sum is over the constituent elements and :math:`\gamma_i` is the +atomic fraction of the :math:`i`-th element. Similarly, the radiative stopping +power is calculated using Bragg's additivity rule as + +.. math:: + :label: material-radiative-stopping-power + + S_{\text{rad}}(T) = \sum_i w_i S_{\text{rad},i}(T), + +where :math:`w_i` is the mass fraction of the :math:`i`-th element and +:math:`S_{\text{rad},i}(T)` is found for element :math:`i` using +:eq:`radiative-stopping-power`. The collision stopping power, however, is a +function of certain quantities such as the mean excitation energy :math:`I` and +the density effect correction :math:`\delta_F` that depend on molecular +properties. These quantities cannot simply be summed over constituent elements +in a compound, but should instead be calculated for the material. The Bethe +formula can be used to find the collision stopping power of the material: + +.. math:: + :label: material-collision-stopping-power + + S_{\text{col}}(T) = \frac{2 \pi r_e^2 m_e c^2}{\beta^2} N_A \frac{Z}{A_M} + [\ln(T^2/I^2) + \ln(1 + \tau/2) + F(\tau) - \delta_F(T)], + +where :math:`N_A` is Avogadro's number, :math:`A_M` is the molar mass, +:math:`\tau = T/m_e`, and :math:`F(\tau)` depends on the particle type. For +electrons, + +.. math:: + :label: F-electron + + F_{-}(\tau) = (1 - \beta^2)[1 + \tau^2/8 - (2\tau + 1) \ln2], + +while for positrons + +.. math:: + :label: F-positron + + F_{+}(\tau) = 2\ln2 - (\beta^2/12)[23 + 14/(\tau + 2) + 10/(\tau + 2)^2 + + 4/(\tau + 2)^3]. + +The density effect correction :math:`\delta_F` takes into account the reduction +of the collision stopping power due to the polarization of the material the +charged particle is passing through by the electric field of the particle. +It can be evaluated using the method described by Sternheimer_, where the +equation for :math:`\delta_F` is + +.. math:: + :label: density-effect-correction + + \delta_F(\beta) = \sum_{i=1}^n f_i \ln[(l_i^2 + l^2)/l_i^2] - + l^2(1-\beta^2). + +Here, :math:`f_i` is the oscillator strength of the :math:`i`-th transition, +given by :math:`f_i = n_i/Z`, where :math:`n_i` is the number of electrons in +the :math:`i`-th subshell. The frequency :math:`l` is the solution of the +equation + +.. math:: + :label: density-effect-l + + \frac{1}{\beta^2} - 1 = \sum_{i=1}^{n} \frac{f_i}{\bar{\nu}_i^2 + l^2}, + +where :math:`\bar{v}_i` is defined as + +.. math:: + :label: density-effect-nubar + + \bar{\nu}_i = h\nu_i \rho / h\nu_p. + +The plasma energy :math:`h\nu_p` of the medium is given by + +.. math:: + :label: plasma-frequency + + h\nu_p = \sqrt{\frac{(hc)^2 r_e \rho_m N_A Z}{\pi A}}, + +where :math:`A` is the atomic weight and :math:`\rho_m` is the density of the +material. In :eq:`density-effect-nubar`, :math:`h\nu_i` is the oscillator +energy, and :math:`\rho` is an adjustment factor introduced to give agreement +between the experimental values of the oscillator energies and the mean +excitation energy. The :math:`l_i` in :eq:`density-effect-correction` are +defined as + +.. math:: + :label: density-effect-li + + \begin{aligned} + l_i &= (\bar{\nu}_i^2 + 2/3f_i)^{1/2} ~~~~&\text{for}~~ \bar{\nu}_i > 0 \\ + l_n &= f_n^{1/2} ~~~~&\text{for}~~ \bar{\nu}_n = 0, + \end{aligned} + +where the second case applies to conduction electrons. For a conductor, +:math:`f_n` is given by :math:`n_c/Z`, where :math:`n_c` is the effective +number of conduction electrons, and :math:`v_n = 0`. The adjustment factor +:math:`\rho` is determined using the equation for the mean excitation energy: + +.. math:: + :label: mean-excitation-energy + + \ln I = \sum_{i=1}^{n-1} f_i \ln[(h\nu_i\rho)^2 + 2/3f_i(h\nu_p)^2]^{1/2} + + f_n \ln (h\nu_pf_n^{1/2}). + +.. _ttb: + + +Thick-Target Bremsstrahlung Approximation ++++++++++++++++++++++++++++++++++++++++++ + +Since charged particles lose their energy on a much shorter distance scale than +neutral particles, not much error should be introduced by neglecting to +transport electrons. However, the bremsstrahlung emitted from high energy +electrons and positrons can travel far from the interaction site. Thus, even +without a full electron transport mode it is necessary to model bremsstrahlung. +We use a thick-target bremsstrahlung (TTB) approximation based on the models in +Salvat_ and Kaltiaisenaho_ for generating bremsstrahlung photons, which assumes +the charged particle loses all its energy in a single homogeneous material +region. + +To model bremsstrahlung using the TTB approximation, we need to know the number +of photons emitted by the charged particle and the energy distribution of the +photons. These quantities can be calculated using the continuous slowing down +approximation (CSDA). The CSDA assumes charged particles lose energy +continuously along their trajectory with a rate of energy loss equal to the +total stopping power, ignoring fluctuations in the energy loss. The +approximation is useful for expressing average quantities that describe how +charged particles slow down in matter. For example, the CSDA range approximates +the average path length a charged particle travels as it slows to rest: + +.. math:: + :label: csda-range + + R(T) = \int^T_0 \frac{dT'}{S(T')}. + +Actual path lengths will fluctuate around :math:`R(T)`. The average number of +photons emitted per unit path length is given by the inverse bremsstrahlung +mean free path: + +.. math:: + :label: inverse-bremsstrahlung-mfp + + \lambda_{\text{br}}^{-1}(T,E_{\text{cut}}) + = n\int_{E_{\text{cut}}}^T\frac{d\sigma_{\text{br}}}{dE}dE + = n\frac{Z^2}{\beta^2}\int_{\kappa_{\text{cut}}}^1\frac{1}{\kappa} + \chi(Z,T,\kappa)d\kappa. + +The lower limit of the integral in :eq:`inverse-bremsstrahlung-mfp` is non-zero +because the bremsstrahlung differential cross section diverges for small photon +energies but is finite for photon energies above some cutoff energy +:math:`E_{\text{cut}}`. The mean free path +:math:`\lambda_{\text{br}}^{-1}(T,E_{\text{cut}})` is used to calculate the +photon number yield, defined as the average number of photons emitted with +energy greater than :math:`E_{\text{cut}}` as the charged particle slows down +from energy :math:`T` to :math:`E_{\text{cut}}`. The photon number yield is +given by + +.. math:: + :label: photon-number-yield + + Y(T,E_{\text{cut}}) = \int^{R(T)}_{R(E_{\text{cut}})} + \lambda_{\text{br}}^{-1}(T',E_{\text{cut}})ds = \int_{E_{\text{cut}}}^T + \frac{\lambda_{\text{br}}^{-1}(T',E_{\text{cut}})}{S(T')}dT'. + +:math:`Y(T,E_{\text{cut}})` can be used to construct the energy spectrum of +bremsstrahlung photons: the number of photons created with energy between +:math:`E_1` and :math:`E_2` by a charged particle with initial kinetic energy +:math:`T` as it comes to rest is given by :math:`Y(T,E_1) - Y(T,E_2)`. + +To simulate the emission of bremsstrahlung photons, the total stopping power +and bremsstrahlung differential cross section for positrons and electrons must +be calculated for a given material using :eq:`material-bremsstrahlung-dcs` and +:eq:`material-radiative-stopping-power`. These quantities are used to build the +tabulated bremsstrahlung energy PDF and CDF for that material for each incident +energy :math:`T_k` on the energy grid. The following algorithm is then applied +to sample the photon energies: + +1. For an incident charged particle with energy :math:`T`, sample the number of + emitted photons as + + .. math:: + + N = \lfloor Y(T,E_{\text{cut}}) + \xi_1 \rfloor. + +2. Rather than interpolate the PDF between indices :math:`k` and :math:`k+1` + for which :math:`T_k < T < T_{k+1}`, which is computationally expensive, use + the composition method and sample from the PDF at either :math:`k` or + :math:`k+1`. Using linear interpolation on a logarithmic scale, the PDF can + be expressed as + + .. math:: + + p_{\text{br}}(T,E) = \pi_k p_{\text{br}}(T_k,E) + \pi_{k+1} + p_{\text{br}}(T_{k+1},E), + + where the interpolation weights are + + .. math:: + + \pi_k = \frac{\ln T_{k+1} - \ln T}{\ln T_{k+1} - \ln T_k},~~~ + \pi_{k+1} = \frac{\ln T - \ln T_k}{\ln T_{k+1} - \ln T_k}. + + Sample either the index :math:`i = k` or :math:`i = k+1` according to the + point probabilities :math:`\pi_{k}` and :math:`\pi_{k+1}`. + +3. Determine the maximum value of the CDF :math:`P_{\text{br,max}}`. + +3. Sample the photon energies using the inverse transform method with the + tabulated CDF :math:`P_{\text{br}}(T_i, E)` i.e., + + .. math:: + + E = E_j \left[ (1 + a_j) \frac{\xi_2 P_{\text{br,max}} - + P_{\text{br}}(T_i, E_j)} {E_j p_{\text{br}}(T_i, E_j)} + 1 + \right]^{\frac{1}{1 + a_j}} + + where the interpolation factor :math:`a_j` is given by + + .. math:: + + a_j = \frac{\ln p_{\text{br}}(T_i,E_{j+1}) - \ln p_{\text{br}}(T_i,E_j)} + {\ln E_{j+1} - \ln E_j} + + and :math:`P_{\text{br}}(T_i, E_j) \le \xi_2 P_{\text{br,max}} \le + P_{\text{br}}(T_i, E_{j+1})`. + +We ignore the range of the electron or positron, i.e., the bremsstrahlung +photons are produced in the same location that the charged particle was +created. The direction of the photons is assumed to be the same as the +direction of the incident charged particle, which is a reasonable approximation +at higher energies when the bremsstrahlung radiation is emitted at small +angles. + + +Electron-Positron Annihilation +------------------------------ + +When a positron collides with an electron, both particles are annihilated and +generally two photons with equal energy are created. If the kinetic energy of +the positron is high enough, the two photons can have different energies, and +the higher-energy photon is emitted preferentially in the direction of flight +of the positron. It is also possible to produce a single photon if the +interaction occurs with a bound electron, and in some cases three (or, rarely, +even more) photons can be emitted. However, the annihilation cross section is +largest for low-energy positrons, and as the positron energy decreases, the +angular distribution of the emitted photons becomes isotropic. + +In OpenMC, we assume the most likely case in which a low-energy positron (which +has already lost most of its energy to bremsstrahlung radiation) interacts with +an electron which is free and at rest. Two photons with energy equal to the +electron rest mass energy :math:`m_e c^2 = 0.511` MeV are emitted isotropically +in opposite directions. + + +.. _Kaltiaisenaho: https://aaltodoc.aalto.fi/bitstream/handle/123456789/21004/master_Kaltiaisenaho_Toni_2016.pdf + +.. _Salvat: https://doi.org/10.1787/32da5043-en + +.. _Sternheimer: https://doi.org/10.1103/PhysRevB.26.6067 diff --git a/docs/source/methods/energy_deposition.rst b/docs/source/methods/energy_deposition.rst index 4675aee3f..c43ee64ac 100644 --- a/docs/source/methods/energy_deposition.rst +++ b/docs/source/methods/energy_deposition.rst @@ -25,19 +25,38 @@ KERMA (Kinetic Energy Release in Materials) [Mack97]_ coefficients for reaction :math:`\times` cross-section (e.g., eV-barn) and can be used much like a reaction cross section for the purpose of tallying energy deposition. -KERMA coefficients can be computed using the energy-balance method with -a nuclear data processing code like NJOY, which performs the following -iteration over all reactions :math:`r` for all isotopes :math:`i` -requested +KERMA coefficients can be computed using the energy-balance method with a +nuclear data processing code like NJOY, which estimates the KERMA coefficients +using the following equation: .. math:: - k_{i, r}(E) = \left(E + Q_{i, r} - \bar{E}_{i, r, n} + k_{i, r}(E) = \left(E + Q_{i, r} - \sum\limits_x \bar{E}_{i, r, x} + \right)\sigma_{i, r}(E), + +where the summation is over each secondary particle type :math:`x`. This +equation states that the energy deposited is equal to the energy of the incident +particle plus the reaction :math:`Q` value less the energy of secondary +particles that are transported away from the reaction site. For neutron +interactions, the energy-balance KERMA coefficient is + +.. math:: + + k_{i, r}(E) = \left(E + Q_{i, r} - \sum\limits_x \bar{E}_{i, r, n} - \bar{E}_{i, r, \gamma}\right)\sigma_{i, r}(E), -removing the energy of neutral particles (neutrons and photons) that are -transported away from the reaction site :math:`\bar{E}`, and the reaction -:math:`Q` value. +where :math:`\bar{E}_{i, r, n}` is the average energy of secondary neutrons and +:math:`\bar{E}_{i, r, \gamma}` is the average energy of secondary photons. For +photon and charged particle interactions the KERMA coefficient is + +.. math:: + :label: energy-balance-photon + + k_{i, r}(E) = \left(E + Q_{i, r} - \sum\limits_x \bar{E}_{i, r, x} + \right)\sigma_{i, r}(E). + +where the :math:`Q` value is zero for all interactions except for pair +production and positron annihilation. ------- Fission @@ -120,7 +139,7 @@ run with :math:`N918` reflecting fission heating computed from NJOY. This modified heating data is stored as the MT=901 reaction and will be scored if ``heating-local`` is included in :attr:`openmc.Tally.scores`. -Coupled neutron-photon transport +Coupled Neutron-Photon Transport -------------------------------- Here, OpenMC instructs ``heatr`` to assume that energy from photons is not @@ -138,6 +157,50 @@ Let :math:`N301` represent the total heating number returned from this This modified heating data is stored as the MT=301 reaction and will be scored if ``heating`` is included in :attr:`openmc.Tally.scores`. +Photons and Charged Particles +----------------------------- + +In OpenMC, energy deposition from photons or charged particles is scored using +the energy balance method based on Equation :eq:`energy-balance-photon`. Special +consideration is given to electrons and positrons as described below. + ++++++++++++++++++ +Charged Particles ++++++++++++++++++ + +OpenMC tracks photons interaction by interaction so the energy deposited in each +collision is easily attributed back to the nuclide and reaction for which the +photon interacted with. Charged particles (electrons and photons) aren't tracked +in the same way. For charged particles, OpenMC assumes that all their energy +(less the energy of bremsstrahlung radiation) is deposited in the material in +which they were born. In this way it is harder to trace how much energy should +be attributed in each nuclide. + +According to the CSDA approximation (see :ref:`ttb`) the energy deposited by a +charged particle with kinetic energy :math:`T` in the :math:`i`-th element can +be calculated as: + +.. math:: + + E_{i} = \int_{0}^{R(T)} w_{i}S_{\text{col,i}} dx + +where :math:`R(T)` is the CSDA range of the charged particle, +:math:`S_{\text{col},i}` is the collision stopping power of the charged particle +in the :math:`i`-th element and :math:`w_i` is the mass fraction of the +:math:`i`-th element. According to the Bethe formula the collision stopping +power of the :math:`i`-th element is proportional to :math:`Z_i/A_i`, so the +fractional collision stopping power from the :math:`i`-th element is: + +.. math:: + + \frac{w_{i}S_{\text{col},i}(T)}{S_{\text{col}}(T)} = + \frac{\frac{w_{i}Z_{i}}{A_{i}}}{\sum_{i}\frac{w_{i}Z_{i}}{A_{i}}} = + \frac{\gamma_i Z_{i}}{\sum_{i}\gamma_i Z_{i}}. + +where :math:`\gamma_i` is the atomic fraction of the :math:`i`-th element. +Therefore, the energy deposited by charged particles should be attributed to +a given element according to its fractional charge density. + ---------- References ---------- diff --git a/docs/source/methods/index.rst b/docs/source/methods/index.rst index 75c421c87..121d04b1d 100644 --- a/docs/source/methods/index.rst +++ b/docs/source/methods/index.rst @@ -14,6 +14,7 @@ Theory and Methodology random_numbers neutron_physics photon_physics + charged_particles_physics tallies eigenvalue depletion @@ -21,4 +22,4 @@ Theory and Methodology parallelization cmfd variance_reduction - random_ray \ No newline at end of file + random_ray diff --git a/docs/source/methods/neutron_physics.rst b/docs/source/methods/neutron_physics.rst index fe8b8ad85..2b797e3db 100644 --- a/docs/source/methods/neutron_physics.rst +++ b/docs/source/methods/neutron_physics.rst @@ -290,7 +290,10 @@ create and store fission sites for the following generation. First, the average number of prompt and delayed neutrons must be determined to decide whether the secondary neutrons will be prompt or delayed. This is important because delayed neutrons have a markedly different spectrum from prompt neutrons, one that has a -lower average energy of emission. The total number of neutrons emitted +lower average energy of emission. Furthermore, in simulations where tracking +time of neutrons is important, we need to consider the emission time delay of +the secondary neutrons, which is dependent on the decay constant of the +delayed neutron precursor. The total number of neutrons emitted :math:`\nu_t` is given as a function of incident energy in the ENDF format. Two representations exist for :math:`\nu_t`. The first is a polynomial of order :math:`N` with coefficients :math:`c_0,c_1,\dots,c_N`. If :math:`\nu_t` has this @@ -306,8 +309,8 @@ interpolation law. The number of prompt neutrons released per fission event :math:`\nu_p` is also given as a function of incident energy and can be specified in a polynomial or tabular format. The number of delayed neutrons released per fission event :math:`\nu_d` can only be specified in a tabular -format. In practice, we only need to determine :math:`nu_t` and -:math:`nu_d`. Once these have been determined, we can calculated the delayed +format. In practice, we only need to determine :math:`\nu_t` and +:math:`\nu_d`. Once these have been determined, we can calculate the delayed neutron fraction .. math:: @@ -335,8 +338,14 @@ neutrons. Otherwise, we produce :math:`\lfloor \nu \rfloor + 1` neutrons. Then, for each fission site produced, we sample the outgoing angle and energy according to the algorithms given in :ref:`sample-angle` and :ref:`sample-energy` respectively. If the neutron is to be born delayed, then -there is an extra step of sampling a delayed neutron precursor group since they -each have an associated secondary energy distribution. +there is an extra step of sampling a delayed neutron precursor group to get the +associated secondary energy distribution and the decay constant +:math:`\lambda`, which is needed to sample the emission delay time :math:`t_d`: + +.. math:: + :label: sample-delay-time + + t_d = -\frac{\ln \xi}{\lambda}. The sampled outgoing angle and energy of fission neutrons along with the position of the collision site are stored in an array called the fission diff --git a/docs/source/methods/photon_physics.rst b/docs/source/methods/photon_physics.rst index 22d2c7f26..d2bd3ac76 100644 --- a/docs/source/methods/photon_physics.rst +++ b/docs/source/methods/photon_physics.rst @@ -667,342 +667,6 @@ and Auger electrons: 5. Repeat from step 1 for vacancy left by the transition electron. -Electron-Positron Annihilation ------------------------------- - -When a positron collides with an electron, both particles are annihilated and -generally two photons with equal energy are created. If the kinetic energy of -the positron is high enough, the two photons can have different energies, and -the higher-energy photon is emitted preferentially in the direction of flight -of the positron. It is also possible to produce a single photon if the -interaction occurs with a bound electron, and in some cases three (or, rarely, -even more) photons can be emitted. However, the annihilation cross section is -largest for low-energy positrons, and as the positron energy decreases, the -angular distribution of the emitted photons becomes isotropic. - -In OpenMC, we assume the most likely case in which a low-energy positron (which -has already lost most of its energy to bremsstrahlung radiation) interacts with -an electron which is free and at rest. Two photons with energy equal to the -electron rest mass energy :math:`m_e c^2 = 0.511` MeV are emitted isotropically -in opposite directions. - -Bremsstrahlung --------------- - -When a charged particle is decelerated in the field of an atom, some of its -kinetic energy is converted into electromagnetic radiation known as -bremsstrahlung, or 'braking radiation'. In each event, an electron or positron -with kinetic energy :math:`T` generates a photon with an energy :math:`E` -between :math:`0` and :math:`T`. Bremsstrahlung is described by a cross section -that is differential in photon energy, in the direction of the emitted photon, -and in the final direction of the charged particle. However, in Monte Carlo -simulations it is typical to integrate over the angular variables to obtain a -single differential cross section with respect to photon energy, which is often -expressed in the form - -.. math:: - :label: bremsstrahlung-dcs - - \frac{d\sigma_{\text{br}}}{dE} = \frac{Z^2}{\beta^2} \frac{1}{E} - \chi(Z, T, \kappa), - -where :math:`\kappa = E/T` is the reduced photon energy and :math:`\chi(Z, T, -\kappa)` is the scaled bremsstrahlung cross section, which is experimentally -measured. - -Because electrons are attracted to atomic nuclei whereas positrons are -repulsed, the cross section for positrons is smaller, though it approaches that -of electrons in the high energy limit. To obtain the positron cross section, we -multiply :eq:`bremsstrahlung-dcs` by the :math:`\kappa`-independent factor used -in Salvat_, - -.. math:: - :label: positron-factor - - \begin{aligned} - F_{\text{p}}(Z,T) = - & 1 - \text{exp}(-1.2359\times 10^{-1}t + 6.1274\times 10^{-2}t^2 - 3.1516\times 10^{-2}t^3 \\ - & + 7.7446\times 10^{-3}t^4 - 1.0595\times 10^{-3}t^5 + 7.0568\times 10^{-5}t^6 \\ - & - 1.8080\times 10^{-6}t^7), - \end{aligned} - -where - -.. math:: - :label: positron-factor-t - - t = \ln\left(1 + \frac{10^6}{Z^2}\frac{T}{\text{m}_\text{e}c^2} \right). - -:math:`F_{\text{p}}(Z,T)` is the ratio of the radiative stopping powers for -positrons and electrons. Stopping power describes the average energy loss per -unit path length of a charged particle as it passes through matter: - -.. math:: - :label: stopping-power - - -\frac{dT}{ds} = n \int E \frac{d\sigma}{dE} dE \equiv S(T), - -where :math:`n` is the number density of the material and :math:`d\sigma/dE` is -the cross section differential in energy loss. The total stopping power -:math:`S(T)` can be separated into two components: the radiative stopping -power :math:`S_{\text{rad}}(T)`, which refers to energy loss due to -bremsstrahlung, and the collision stopping power :math:`S_{\text{col}}(T)`, -which refers to the energy loss due to inelastic collisions with bound -electrons in the material that result in ionization and excitation. The -radiative stopping power for electrons is given by - -.. math:: - :label: radiative-stopping-power - - S_{\text{rad}}(T) = n \frac{Z^2}{\beta^2} T \int_0^1 \chi(Z,T,\kappa) - d\kappa. - - -To obtain the radiative stopping power for positrons, -:eq:`radiative-stopping-power` is multiplied by :eq:`positron-factor`. - -While the models for photon interactions with matter described above can safely -assume interactions occur with free atoms, sampling the target atom based on -the macroscopic cross sections, molecular effects cannot necessarily be -disregarded for charged particle treatment. For compounds and mixtures, the -bremsstrahlung cross section is calculated using Bragg's additivity rule as - -.. math:: - :label: material-bremsstrahlung-dcs - - \frac{d\sigma_{\text{br}}}{dE} = \frac{1}{\beta^2 E} \sum_i \gamma_i Z^2_i - \chi(Z_i, T, \kappa), - -where the sum is over the constituent elements and :math:`\gamma_i` is the -atomic fraction of the :math:`i`-th element. Similarly, the radiative stopping -power is calculated using Bragg's additivity rule as - -.. math:: - :label: material-radiative-stopping-power - - S_{\text{rad}}(T) = \sum_i w_i S_{\text{rad},i}(T), - -where :math:`w_i` is the mass fraction of the :math:`i`-th element and -:math:`S_{\text{rad},i}(T)` is found for element :math:`i` using -:eq:`radiative-stopping-power`. The collision stopping power, however, is a -function of certain quantities such as the mean excitation energy :math:`I` and -the density effect correction :math:`\delta_F` that depend on molecular -properties. These quantities cannot simply be summed over constituent elements -in a compound, but should instead be calculated for the material. The Bethe -formula can be used to find the collision stopping power of the material: - -.. math:: - :label: material-collision-stopping-power - - S_{\text{col}}(T) = \frac{2 \pi r_e^2 m_e c^2}{\beta^2} N_A \frac{Z}{A_M} - [\ln(T^2/I^2) + \ln(1 + \tau/2) + F(\tau) - \delta_F(T)], - -where :math:`N_A` is Avogadro's number, :math:`A_M` is the molar mass, -:math:`\tau = T/m_e`, and :math:`F(\tau)` depends on the particle type. For -electrons, - -.. math:: - :label: F-electron - - F_{-}(\tau) = (1 - \beta^2)[1 + \tau^2/8 - (2\tau + 1) \ln2], - -while for positrons - -.. math:: - :label: F-positron - - F_{+}(\tau) = 2\ln2 - (\beta^2/12)[23 + 14/(\tau + 2) + 10/(\tau + 2)^2 + - 4/(\tau + 2)^3]. - -The density effect correction :math:`\delta_F` takes into account the reduction -of the collision stopping power due to the polarization of the material the -charged particle is passing through by the electric field of the particle. -It can be evaluated using the method described by Sternheimer_, where the -equation for :math:`\delta_F` is - -.. math:: - :label: density-effect-correction - - \delta_F(\beta) = \sum_{i=1}^n f_i \ln[(l_i^2 + l^2)/l_i^2] - - l^2(1-\beta^2). - -Here, :math:`f_i` is the oscillator strength of the :math:`i`-th transition, -given by :math:`f_i = n_i/Z`, where :math:`n_i` is the number of electrons in -the :math:`i`-th subshell. The frequency :math:`l` is the solution of the -equation - -.. math:: - :label: density-effect-l - - \frac{1}{\beta^2} - 1 = \sum_{i=1}^{n} \frac{f_i}{\bar{\nu}_i^2 + l^2}, - -where :math:`\bar{v}_i` is defined as - -.. math:: - :label: density-effect-nubar - - \bar{\nu}_i = h\nu_i \rho / h\nu_p. - -The plasma energy :math:`h\nu_p` of the medium is given by - -.. math:: - :label: plasma-frequency - - h\nu_p = \sqrt{\frac{(hc)^2 r_e \rho_m N_A Z}{\pi A}}, - -where :math:`A` is the atomic weight and :math:`\rho_m` is the density of the -material. In :eq:`density-effect-nubar`, :math:`h\nu_i` is the oscillator -energy, and :math:`\rho` is an adjustment factor introduced to give agreement -between the experimental values of the oscillator energies and the mean -excitation energy. The :math:`l_i` in :eq:`density-effect-correction` are -defined as - -.. math:: - :label: density-effect-li - - \begin{aligned} - l_i &= (\bar{\nu}_i^2 + 2/3f_i)^{1/2} ~~~~&\text{for}~~ \bar{\nu}_i > 0 \\ - l_n &= f_n^{1/2} ~~~~&\text{for}~~ \bar{\nu}_n = 0, - \end{aligned} - -where the second case applies to conduction electrons. For a conductor, -:math:`f_n` is given by :math:`n_c/Z`, where :math:`n_c` is the effective -number of conduction electrons, and :math:`v_n = 0`. The adjustment factor -:math:`\rho` is determined using the equation for the mean excitation energy: - -.. math:: - :label: mean-excitation-energy - - \ln I = \sum_{i=1}^{n-1} f_i \ln[(h\nu_i\rho)^2 + 2/3f_i(h\nu_p)^2]^{1/2} + - f_n \ln (h\nu_pf_n^{1/2}). - -.. _ttb: - -Thick-Target Bremsstrahlung Approximation -+++++++++++++++++++++++++++++++++++++++++ - -Since charged particles lose their energy on a much shorter distance scale than -neutral particles, not much error should be introduced by neglecting to -transport electrons. However, the bremsstrahlung emitted from high energy -electrons and positrons can travel far from the interaction site. Thus, even -without a full electron transport mode it is necessary to model bremsstrahlung. -We use a thick-target bremsstrahlung (TTB) approximation based on the models in -Salvat_ and Kaltiaisenaho_ for generating bremsstrahlung photons, which assumes -the charged particle loses all its energy in a single homogeneous material -region. - -To model bremsstrahlung using the TTB approximation, we need to know the number -of photons emitted by the charged particle and the energy distribution of the -photons. These quantities can be calculated using the continuous slowing down -approximation (CSDA). The CSDA assumes charged particles lose energy -continuously along their trajectory with a rate of energy loss equal to the -total stopping power, ignoring fluctuations in the energy loss. The -approximation is useful for expressing average quantities that describe how -charged particles slow down in matter. For example, the CSDA range approximates -the average path length a charged particle travels as it slows to rest: - -.. math:: - :label: csda-range - - R(T) = \int^T_0 \frac{dT'}{S(T')}. - -Actual path lengths will fluctuate around :math:`R(T)`. The average number of -photons emitted per unit path length is given by the inverse bremsstrahlung -mean free path: - -.. math:: - :label: inverse-bremsstrahlung-mfp - - \lambda_{\text{br}}^{-1}(T,E_{\text{cut}}) - = n\int_{E_{\text{cut}}}^T\frac{d\sigma_{\text{br}}}{dE}dE - = n\frac{Z^2}{\beta^2}\int_{\kappa_{\text{cut}}}^1\frac{1}{\kappa} - \chi(Z,T,\kappa)d\kappa. - -The lower limit of the integral in :eq:`inverse-bremsstrahlung-mfp` is non-zero -because the bremsstrahlung differential cross section diverges for small photon -energies but is finite for photon energies above some cutoff energy -:math:`E_{\text{cut}}`. The mean free path -:math:`\lambda_{\text{br}}^{-1}(T,E_{\text{cut}})` is used to calculate the -photon number yield, defined as the average number of photons emitted with -energy greater than :math:`E_{\text{cut}}` as the charged particle slows down -from energy :math:`T` to :math:`E_{\text{cut}}`. The photon number yield is -given by - -.. math:: - :label: photon-number-yield - - Y(T,E_{\text{cut}}) = \int^{R(T)}_{R(E_{\text{cut}})} - \lambda_{\text{br}}^{-1}(T',E_{\text{cut}})ds = \int_{E_{\text{cut}}}^T - \frac{\lambda_{\text{br}}^{-1}(T',E_{\text{cut}})}{S(T')}dT'. - -:math:`Y(T,E_{\text{cut}})` can be used to construct the energy spectrum of -bremsstrahlung photons: the number of photons created with energy between -:math:`E_1` and :math:`E_2` by a charged particle with initial kinetic energy -:math:`T` as it comes to rest is given by :math:`Y(T,E_1) - Y(T,E_2)`. - -To simulate the emission of bremsstrahlung photons, the total stopping power -and bremsstrahlung differential cross section for positrons and electrons must -be calculated for a given material using :eq:`material-bremsstrahlung-dcs` and -:eq:`material-radiative-stopping-power`. These quantities are used to build the -tabulated bremsstrahlung energy PDF and CDF for that material for each incident -energy :math:`T_k` on the energy grid. The following algorithm is then applied -to sample the photon energies: - -1. For an incident charged particle with energy :math:`T`, sample the number of - emitted photons as - - .. math:: - - N = \lfloor Y(T,E_{\text{cut}}) + \xi_1 \rfloor. - -2. Rather than interpolate the PDF between indices :math:`k` and :math:`k+1` - for which :math:`T_k < T < T_{k+1}`, which is computationally expensive, use - the composition method and sample from the PDF at either :math:`k` or - :math:`k+1`. Using linear interpolation on a logarithmic scale, the PDF can - be expressed as - - .. math:: - - p_{\text{br}}(T,E) = \pi_k p_{\text{br}}(T_k,E) + \pi_{k+1} - p_{\text{br}}(T_{k+1},E), - - where the interpolation weights are - - .. math:: - - \pi_k = \frac{\ln T_{k+1} - \ln T}{\ln T_{k+1} - \ln T_k},~~~ - \pi_{k+1} = \frac{\ln T - \ln T_k}{\ln T_{k+1} - \ln T_k}. - - Sample either the index :math:`i = k` or :math:`i = k+1` according to the - point probabilities :math:`\pi_{k}` and :math:`\pi_{k+1}`. - -3. Determine the maximum value of the CDF :math:`P_{\text{br,max}}`. - -3. Sample the photon energies using the inverse transform method with the - tabulated CDF :math:`P_{\text{br}}(T_i, E)` i.e., - - .. math:: - - E = E_j \left[ (1 + a_j) \frac{\xi_2 P_{\text{br,max}} - - P_{\text{br}}(T_i, E_j)} {E_j p_{\text{br}}(T_i, E_j)} + 1 - \right]^{\frac{1}{1 + a_j}} - - where the interpolation factor :math:`a_j` is given by - - .. math:: - - a_j = \frac{\ln p_{\text{br}}(T_i,E_{j+1}) - \ln p_{\text{br}}(T_i,E_j)} - {\ln E_{j+1} - \ln E_j} - - and :math:`P_{\text{br}}(T_i, E_j) \le \xi_2 P_{\text{br,max}} \le - P_{\text{br}}(T_i, E_{j+1})`. - -We ignore the range of the electron or positron, i.e., the bremsstrahlung -photons are produced in the same location that the charged particle was -created. The direction of the photons is assumed to be the same as the -direction of the incident charged particle, which is a reasonable approximation -at higher energies when the bremsstrahlung radiation is emitted at small -angles. .. _photon_production: @@ -1070,5 +734,3 @@ emitted photon. .. _Kaltiaisenaho: https://aaltodoc.aalto.fi/bitstream/handle/123456789/21004/master_Kaltiaisenaho_Toni_2016.pdf .. _Salvat: https://doi.org/10.1787/32da5043-en - -.. _Sternheimer: https://doi.org/10.1103/PhysRevB.26.6067 diff --git a/docs/source/methods/random_ray.rst b/docs/source/methods/random_ray.rst index eb22b0544..5e17316aa 100644 --- a/docs/source/methods/random_ray.rst +++ b/docs/source/methods/random_ray.rst @@ -109,9 +109,7 @@ terms on the right hand side. In Equation :eq:`transport`, :math:`\psi` is the angular neutron flux. This parameter represents the total distance traveled by all neutrons in a particular direction inside of a control volume per second, and is often given in units of -:math:`1/(\text{cm}^{2} \text{s})`. As OpenMC does not support time dependence -in the random ray solver mode, we consider the steady state equation, where the -units of flux become :math:`1/\text{cm}^{2}`. The angular direction unit vector, +:math:`1/(\text{cm}^{2} \text{s})`. The angular direction unit vector, :math:`\mathbf{\Omega}`, represents the direction of travel for the neutron. The spatial position vector, :math:`\mathbf{r}`, represents the location within the simulation. The neutron energy, :math:`E`, or speed in continuous space, is @@ -1052,7 +1050,8 @@ random ray and Monte Carlo, however. regions. Thus, in the OpenMC implementation of random ray, particle sources are restricted to being volumetric and isotropic, although different energy spectrums are supported. Fixed sources can be applied to specific materials, - cells, or universes. + cells, or universes. Point sources are "smeared" to fill the volume of the + source region that contains the point source coordinate. - **Inactive batches:** In Monte Carlo, use of a fixed source implies that all batches are active batches, as there is no longer a need to develop a fission diff --git a/docs/source/methods/tallies.rst b/docs/source/methods/tallies.rst index 57e05d84f..27a3f873a 100644 --- a/docs/source/methods/tallies.rst +++ b/docs/source/methods/tallies.rst @@ -387,6 +387,130 @@ of this is that the longer you run a simulation, the better you know your results. Therefore, by running a simulation long enough, it is possible to reduce the stochastic uncertainty to arbitrarily low levels. +Skewness +++++++++ + +The `skewness`_ of a population quantifies the asymmetry of the probability +distribution around its mean. Positive and negative skewness indicate a +longer/heavier right and left tail respectively. Let :math:`x_1,\ldots,x_n` be +the per-realization values for a bin, with sample mean :math:`\bar{x}` and +sample central moments: + +.. math:: + + m_k \;=\; \frac{1}{n}\sum_{i=1}^{n}\bigl(x_i-\bar{x}\bigr)^k. + +OpenMC reports the *adjusted Fisher-Pearson skewness* (defined for :math:`n \ge +3`), which is commonly used in many statistical packages: + +.. math:: + + G_1 \;=\; \frac{\sqrt{n \cdot (n-1)}}{\,n-2\,}\cdot\frac{m_3}{m_2^{3/2}}. + +where :math:`m_2` and :math:`m_3` correspond to the biased sample second and +third central moment respectively. + +Kurtosis +++++++++ + +The `kurtosis`_ of a population quantifies tail weight (also called tailedness) +of the probability distribution relative to a normal distribution. Positive +excess kurtosis indicates *heavier tails* whereas negative excess kurtosis +indicates *lighter tails*. Kurtosis is especially useful for identifying bins +where occasional extreme scores dominate uncertainty. OpenMC reports the +*adjusted excess kurtosis* (defined for :math:`n \ge 4`): + +.. math:: + + G_2 \;=\; \frac{(n-1)}{(n-2)(n-3)} + \left[(n+1)\,\frac{m_4}{m_2^{2}} \;-\; 3(n-1)\right]. + +where :math:`m_2` and :math:`m_4` correspond to the biased sample second and +fourth central moment respectively. For a perfectly normal distribution, the +excess kurtosis is :math:`0`. + +Variance of Variance +++++++++++++++++++++ + +The variance of the variance (also known as the coefficient of variation +squared) measures *stability of the sample variance* :math:`s^2` and, by +extension, the reliability of reported relative errors. High VOV means that +error bars themselves are noisy—often due to heavy tails, skewness, or too few +realizations. + +.. math:: + + VOV = \frac{s^2(s_{\bar{X}}^2)}{s_{\bar{X}}^4 } = \frac{m_4}{m_2^2} - \frac{1}{n} + +where :math:`s_{\bar{X}}^2` is the estimated variance of the mean and +:math:`s^2(s_{\bar{X}}^2)` is the estimated variance in :math:`s_{\bar{X}}^2`. +The MCNP manual suggests a hard threshold such that :math:`VOV < 0.1` to improve +the probability of forming a reliable confidence interval. However, OpenMC does +not enforce an universal cut-off because the suitability of any single threshold +depends strongly on problem specifics (estimator choice, variance-reduction +settings, tally binning, or even effective sample size). + + +Normality Tests (D'Agostino-Pearson) +++++++++++++++++++++++++++++++++++++ + +These normality test verify the hypothesis that fluctuations are *approximately +normal*, a working assumption behind many Monte Carlo diagnostics and +`confidence-interval heuristics`_. Tests are provided for: (i) skewness-only, +(ii) kurtosis-only, and (iii) the *omnibus* combination. OpenMC uses the +finite-sample-adjusted skewness :math:`G_1` and excess kurtosis :math:`G_2` +above to construct standardized normal scores :math:`Z_1` (from :math:`G_1`) and +:math:`Z_2` (from :math:`G_2`) via the D'Agostino-Pearson transformations. The +omnibus statistic is + +.. math:: + + K^2 \;=\; Z_1^{\,2} \;+\; Z_2^{\,2} + \;\sim\; \chi^2_{(2)} \quad \text{under } H_0:\ \text{normality}. + +OpenMC reports :math:`Z_1`, :math:`Z_2`, :math:`K^2`, and their p-values when +prerequisites are met (skewness for :math:`n\ge 3`, kurtosis and omnibus for +:math:`n\ge 4`). Given a user-chosen significance level :math:`\alpha` (default +is :math:`0.05`), reject :math:`H_0` if :math:`\text{p-value}<\alpha`; otherwise +fail to reject. OpenMC leaves the interpretation to the user, who should +consider VOV together with skewness, kurtosis, and normality tests results when +judging whether reported confidence intervals are credible for their application +[#norm-tests]_. + +.. [#norm-tests] + Higher-moments accumulation must be enabled with ``higher_moments = True`` + for running these diagnostics including the skewness, kurtosis, and normality + tests. + +Figure of Merit ++++++++++++++++ + +The figure of merit (FOM) is an indicator that accounts for both the statistical +uncertainty and the execution time and represents how much information is +obtained per unit time in the simulation. The FOM is defined as + +.. math:: + :label: figure_of_merit + + FOM = \frac{1}{r^2 t}, + +where :math:`t` is the total execution time and :math:`r` is the relative error +defined as + +.. math:: + :label: relative_error + + r = \frac{s_{\bar{X}}}{\bar{x}}. + +Based on this definition, one can see that a higher FOM is desirable. The FOM is +useful as a comparative tool. For example, if a variance reduction technique is +being applied to a simulation, the FOM with variance reduction can be compared +to the FOM without variance reduction to ascertain whether the reduction in +variance outweighs the potential increase in execution time (e.g., due to +particle splitting). It is important to note that MCNP reports the FOM using CPU +time (wall-clock time multiplied by the number of threads/cores), whereas OpenMC +reports the FOM using only the wall-clock time :math:`t`. + Confidence Intervals ++++++++++++++++++++ @@ -494,6 +618,8 @@ improve the estimate of the percentile. .. rubric:: References +.. _confidence-interval heuristics: https://doi.org/10.1080/00031305.1990.10475751 + .. _following approximation: https://doi.org/10.1080/03610918708812641 .. _Bessel's correction: https://en.wikipedia.org/wiki/Bessel's_correction @@ -514,6 +640,10 @@ improve the estimate of the percentile. .. _converges in distribution: https://en.wikipedia.org/wiki/Convergence_of_random_variables#Convergence_in_distribution +.. _skewness: https://en.wikipedia.org/wiki/Skewness + +.. _kurtosis: https://en.wikipedia.org/wiki/Kurtosis + .. _confidence intervals: https://en.wikipedia.org/wiki/Confidence_interval .. _Student's t-distribution: https://en.wikipedia.org/wiki/Student%27s_t-distribution diff --git a/docs/source/methods/variance_reduction.rst b/docs/source/methods/variance_reduction.rst index 353ae5077..cdda5ea92 100644 --- a/docs/source/methods/variance_reduction.rst +++ b/docs/source/methods/variance_reduction.rst @@ -22,12 +22,14 @@ not experience a single scoring event, even after billions of analog histories. Variance reduction techniques aim to either flatten the global uncertainty distribution, such that all regions of phase space have a fairly similar uncertainty, or to reduce the uncertainty in specific locations (such as a -detector). There are two strategies available in OpenMC for variance reduction: -the Monte Carlo MAGIC method and the FW-CADIS method. Both strategies work by -developing a weight window mesh that can be utilized by subsequent Monte Carlo -solves to split particles heading towards areas of lower flux densities while -terminating particles in higher flux regions---all while maintaining a fair -game. +detector). There are three strategies available in OpenMC for variance +reduction: weight windows generated via the MAGIC method or the FW-CADIS method, +and source biasing. Both weight windowing strategies work by developing a mesh +that can be utilized by subsequent Monte Carlo solves to split particles heading +towards areas of lower flux densities while terminating particles in higher flux +regions. In contrast, source biasing modifies source site sampling behavior to +preferentially track particles more likely to reach phase space regions of +interest. ------------ MAGIC Method @@ -132,3 +134,71 @@ aware of this. :label: variance_fom \text{FOM} = \frac{1}{\text{Time} \times \sigma^2} + +.. _methods_source_biasing: + +-------------- +Source Biasing +-------------- + +In contrast to the previous two methods that introduce population controls +during transport, source biasing modifies the sampling of the external source +distribution. The basic premise of the technique is that for each spatial, +angular, energy, or time distribution of a source, an additional distribution +can be specified provided that the two share a common support (set of points +where the distribution is nonzero). Samples are then drawn from this "bias" +distribution, which can be chosen to preferentially direct particles towards +phase space regions of interest. In order to avoid biasing the tally results, +however, a weight adjustment is applied to each sampled site as described below. + +Assume that the unbiased probability density function of a random variable +:math:`X:x \rightarrow \mathbb{R}` is given by :math:`f(x)`, but that using the +biased distribution :math:`g(x)` will result in a greater number of particle +trajectories reaching some phase space region of interest. Then a sample +:math:`x_0` may be drawn from :math:`g(x)` while maintaining a fair game, +provided that its weight is adjusted as: + +.. math:: + :label: source_bias + + w = w_0 \times \frac{f(x_0)}{g(x_0)} + +where :math:`w_0` is the weight of an unbiased sample from :math:`f(x)`, +typically unity. + +Returning now to Equation :eq:`source_bias`, the requirement for common support +becomes evident. If :math:`\mathrm{supp} (g)` fully contains but is not +identical to :math:`\mathrm{supp} (f)`, then some samples from :math:`g(x)` will +correspond to points where :math:`f(x) = 0`. Thus these source sites would be +assigned a starting weight of 0, meaning the particles would be killed +immediately upon transport, effectively wasting computation time. Conversely, if +:math:`\mathrm{supp} (g)` is fully contained by but not identical to +:math:`\mathrm{supp} (f)`, the contributions of some regions outside +:math:`\mathrm{supp} (g)` will not be counted towards the integral, potentially +biasing the tally. The weight assigned to such points would be undefined since +:math:`g(x) = \mathbf{0}` at these points. + +When an independent source is sampled in OpenMC, the particle's coordinate in +each variable of phase space :math:`(\mathbf{r},\mathbf{\Omega},E,t)` is +successively drawn from an independent probability distribution. Multiple +variables can be biased, in which case the resultant weight :math:`w` applied to +the particle is the product of the weights assigned from all sampled +distributions: space, angle, energy, and time, as shown in Equation +:eq:`tot_wgt`. + +.. math:: + :label: tot_wgt + + w = w_r \times w_{\Omega} \times w_E \times w_t + +Finally, source biasing and weight windows serve different purposes. Source +biasing changes how particles are born, allowing the initial source sites to be +sampled preferentially from important regions of phase space (space, angle, +energy, and time) with an accompanying weight adjustment. Weight windows, by +contrast, apply population control during transport (splitting and Russian +roulette) to help particles reach and contribute in important regions as they +move through the system. Because particle transport proceeds as usual after a +biased source is sampled, particle attenuation in optically thick regions +outside the source volume will not be affected by source biasing; in such +scenarios, transport biasing techniques such as weight windows are often more +effective. diff --git a/docs/source/pythonapi/base.rst b/docs/source/pythonapi/base.rst index e5b5b17c3..dea8c4427 100644 --- a/docs/source/pythonapi/base.rst +++ b/docs/source/pythonapi/base.rst @@ -37,7 +37,6 @@ Simulation Settings openmc.read_source_file openmc.write_source_file - openmc.wwinp_to_wws Material Specification ---------------------- @@ -129,6 +128,7 @@ Constructing Tallies openmc.SurfaceFilter openmc.MeshFilter openmc.MeshBornFilter + openmc.MeshMaterialFilter openmc.MeshSurfaceFilter openmc.EnergyFilter openmc.EnergyoutFilter @@ -143,21 +143,31 @@ Constructing Tallies openmc.SpatialLegendreFilter openmc.SphericalHarmonicsFilter openmc.TimeFilter + openmc.WeightFilter openmc.ZernikeFilter openmc.ZernikeRadialFilter openmc.ParentNuclideFilter openmc.ParticleFilter - openmc.RegularMesh - openmc.RectilinearMesh - openmc.CylindricalMesh - openmc.SphericalMesh - openmc.UnstructuredMesh openmc.MeshMaterialVolumes openmc.Trigger openmc.TallyDerivative openmc.Tally openmc.Tallies +Meshes +------ + +.. autosummary:: + :toctree: generated + :nosignatures: + :template: myclassinherit.rst + + openmc.RegularMesh + openmc.RectilinearMesh + openmc.CylindricalMesh + openmc.SphericalMesh + openmc.UnstructuredMesh + Geometry Plotting ----------------- @@ -166,7 +176,8 @@ Geometry Plotting :nosignatures: :template: myclass.rst - openmc.Plot + openmc.SlicePlot + openmc.VoxelPlot openmc.WireframeRayTracePlot openmc.SolidRayTracePlot openmc.Plots @@ -206,6 +217,9 @@ Post-processing :nosignatures: :template: myfunction.rst + openmc.read_collision_track_file + openmc.read_collision_track_hdf5 + openmc.read_collision_track_mcpl openmc.voxel_to_vtk The following classes and functions are used for functional expansion reconstruction. @@ -248,8 +262,16 @@ Variance Reduction :template: myclass openmc.WeightWindows + openmc.WeightWindowsList openmc.WeightWindowGenerator + +.. autosummary:: + :toctree: generated + :nosignatures: + :template: myfunction.rst + openmc.hdf5_to_wws + openmc.wwinp_to_wws Coarse Mesh Finite Difference Acceleration diff --git a/docs/source/pythonapi/capi.rst b/docs/source/pythonapi/capi.rst index c8e0e874d..67eca0094 100644 --- a/docs/source/pythonapi/capi.rst +++ b/docs/source/pythonapi/capi.rst @@ -89,8 +89,10 @@ Classes SphericalMesh SurfaceFilter Tally + TemporarySession UniverseFilter UnstructuredMesh + WeightFilter WeightWindows ZernikeFilter ZernikeRadialFilter diff --git a/docs/source/pythonapi/deplete.rst b/docs/source/pythonapi/deplete.rst index 5d02fa6b9..25fcd898f 100644 --- a/docs/source/pythonapi/deplete.rst +++ b/docs/source/pythonapi/deplete.rst @@ -78,20 +78,18 @@ A minimal example for performing depletion would be: >>> import openmc.deplete >>> geometry = openmc.Geometry.from_xml() >>> settings = openmc.Settings.from_xml() - >>> model = openmc.model.Model(geometry, settings) + >>> model = openmc.Model(geometry, settings) # Representation of a depletion chain >>> chain_file = "chain_casl.xml" - >>> operator = openmc.deplete.CoupledOperator( - ... model, chain_file) + >>> operator = openmc.deplete.CoupledOperator(model, chain_file) # Set up 5 time steps of one day each >>> dt = [24 * 60 * 60] * 5 >>> power = 1e6 # constant power of 1 MW # Deplete using mid-point predictor-corrector - >>> cecm = openmc.deplete.CECMIntegrator( - ... operator, dt, power) + >>> cecm = openmc.deplete.CECMIntegrator(operator, dt, power) >>> cecm.integrate() Internal Classes and Functions @@ -208,14 +206,15 @@ total system energy. The :class:`openmc.deplete.IndependentOperator` uses inner classes subclassed from those listed above to perform similar calculations. -The following classes are used to define transfer rates to model continuous -removal or feed of nuclides during depletion. +The following classes are used to define external source rates or transfer rates +to model continuous removal or feed of nuclides during depletion. .. autosummary:: :toctree: generated :nosignatures: :template: myclass.rst + transfer_rates.ExternalSourceRates transfer_rates.TransferRates Intermediate Classes @@ -288,6 +287,16 @@ the following abstract base classes: abc.SIIntegrator abc.DepSystemSolver +R2S Automation +-------------- + +.. autosummary:: + :toctree: generated + :nosignatures: + :template: myclass.rst + + R2SManager + D1S Functions ------------- diff --git a/docs/source/pythonapi/mgxs.rst b/docs/source/pythonapi/mgxs.rst index 392914b36..4141aa0a0 100644 --- a/docs/source/pythonapi/mgxs.rst +++ b/docs/source/pythonapi/mgxs.rst @@ -11,6 +11,16 @@ Module Variables .. autodata:: openmc.mgxs.GROUP_STRUCTURES :annotation: +Functions ++++++++++ + +.. autosummary:: + :toctree: generated + :nosignatures: + :template: myfunction.rst + + openmc.mgxs.convert_flux_groups + Classes +++++++ diff --git a/docs/source/quickinstall.rst b/docs/source/quickinstall.rst index 21526242f..0f887940e 100644 --- a/docs/source/quickinstall.rst +++ b/docs/source/quickinstall.rst @@ -35,6 +35,13 @@ you wish) with OpenMC installed. conda create --name openmc-env openmc conda activate openmc-env +If you are installing on macOS with an Apple silicon ARM-based processor, you +will also need to specify the `--platform` option: + +.. code-block:: sh + + conda create --name openmc-env --platform osx-64 openmc + You are now in a conda environment called `openmc-env` that has OpenMC installed. diff --git a/docs/source/releasenotes/0.15.2.rst b/docs/source/releasenotes/0.15.2.rst new file mode 100644 index 000000000..e72df37d3 --- /dev/null +++ b/docs/source/releasenotes/0.15.2.rst @@ -0,0 +1,20 @@ +==================== +What's New in 0.15.2 +==================== + +.. currentmodule:: openmc + +------- +Summary +------- + +This is a hotfix release to fix an MPI-related bug that was inadvertently +introduced in the prior release. + +--------------------------- +Bug Fixes and Small Changes +--------------------------- + +- Remove errant ``openmc.Settings.random_ray`` check and removed of not useful warning in MG mode (`#3344 `_) +- Throw an error if a spherical harmonics order larger than 10 is provided. (`#3354 `_) +- Correcting the size of the displacement list in the SourceSite MPI interface object (`#3356 `_) diff --git a/docs/source/releasenotes/0.15.3.rst b/docs/source/releasenotes/0.15.3.rst new file mode 100644 index 000000000..c50958104 --- /dev/null +++ b/docs/source/releasenotes/0.15.3.rst @@ -0,0 +1,226 @@ +==================== +What's New in 0.15.3 +==================== + +.. currentmodule:: openmc + +------- +Summary +------- + +This release of OpenMC includes many bug fixes, performance improvements, and +several notable new features. The major highlights of this release include a new +:class:`~openmc.deplete.R2SManager` class that automates the workflow for +rigorous 2-step (R2S) shutdown dose rate calculations, the ability to collect +higher moments for tally results that can be used to test normality, a new +uncertainty-aware criticality search method, a new collision tracking feature +that enables detailed tracking of particle interactions, support for distributed +cell densities, and several new tally filters. The random ray solver also +continues to receive significant updates, including automatic setup +capabilities, improved geometry handling, and better weight window support. +Depletion capabilities have been expanded with thermochemical redox control, +external transfer rates, and improved performance. + +------------------------------------ +Compatibility Notes and Deprecations +------------------------------------ + +MCPL has been changed from a build-time dependency to a runtime optional +dependency, which means OpenMC will attempt to load the MCPL library at +runtime when needed rather than requiring it at build time. + +The ``openmc.mgxs.Library.add_to_tallies_file`` method has been renamed to +:meth:`openmc.mgxs.Library.add_to_tallies`. + +------------ +New Features +------------ + +- A new collision tracking feature enables detailed tracking of particle + interactions (`#3417 `_) +- Added :meth:`~openmc.model.Model.keff_search` method for automated criticality + searches (`#3569 `_) +- Introduced automated workflow for mesh- or cell-based R2S calculations + (`#3508 `_) +- Ability to source electron/positrons directly for charged particle + simulations (`#3404 `_) +- Multi-group capability for kinetics parameter calculations with Iterated + Fission Probability (`#3425 + `_) +- Introduced a new :class:`openmc.MeshMaterialFilter` class (`#3406 + `_) +- Added support for distributed cell densities (`#3546 + `_) +- Implemented a :class:`openmc.WeightWindowsList` class that enables export to + HDF5 (`#3456 `_) +- Added :meth:`openmc.Material.mean_free_path` method (`#3469 + `_) +- Introduced :func:`openmc.lib.TemporarySession` context manager (`#3475 + `_) +- Added material depletion function for tracking individual material depletion + (`#3420 `_) +- Added methods on :class:`~openmc.Material` class for waste disposal rating / + classification (`#3366 `_, + `#3376 `_) +- Support for thermochemical redox control transfer rates in depletion + (`#2783 `_) +- Support for external transfer rates source term in depletion (`#3088 + `_) +- Added combing capability for fission site sampling and delayed neutron + emission time (`#2992 `_) +- Ability to specify reference direction for azimuthal angle in + :class:`~openmc.stats.PolarAzimuthal` distribution (`#3582 + `_) +- Allow spatial constraints on element sources within + :class:`~openmc.MeshSource` (`#3431 + `_) +- Added VTK HDF (.vtkhdf) format support for writing VTK data (`#3252 + `_) +- Implemented filter weight capability (`#3345 + `_) +- Optionally collect higher moments for tallies (`#3363 + `_) +- Several random ray solver enhancements: + + - Random Ray AutoMagic Setup for automatic configuration (`#3351 `_) + - Point source locator for random ray mode (`#3360 `_) + - Support for DAGMC geometries (`#3374 `_) + - Optimized mapping of source regions to tallies (`#3465 `_) + - Base source region refactor (`#3576 `_) + +--------------------------- +Bug Fixes and Small Changes +--------------------------- + +- Add two MPI barriers in R2S workflow (`#3646 `_) +- Fix a few warnings, rename add_to_tallies_file (`#3639 `_) +- Fix typo in DAGMC lost particle test (`#3634 `_) +- Avoid multiprocessing Pool when running depletion tests with MPI (`#3633 `_) +- Support MPI parallelism in R2SManager (`#3632 `_) +- Update documentation for particle tracks (`#3627 `_) +- Adding variance of variance and normality tests for tally statistics (`#3454 `_) +- Avoid divide-by-zero in ``from_multigroup_flux`` when flux is zero (`#3624 `_) +- Write particle states as separate lines in track VTK files (`#3628 `_) +- Reset DAGMC history when reviving from source (`#3601 `_) +- Add energy group structure: SCALE-999 (`#3564 `_) +- Fix bug in normalization of tally results with no_reduce (`#3619 `_) +- Enable nuclide filters with get_decay_photon_energy (`#3614 `_) +- Update ``check_type`` calls to accept both ``str`` and ``os.PathLike`` objects (`#3618 `_) +- Speed up ``apply_time_correction`` by reducing file I/O and deepcopies (`#3617 `_) +- FW-CADIS Disregard Max Realizations Setting (`#3616 `_) +- Random Ray Geometry Debug Mode Fix (`#3615 `_) +- Don't write reaction rates in depletion results by default (`#3609 `_) +- Allow Path objects in MGXSLibrary.export_to_hdf5 (`#3608 `_) +- Clip mixture distributions based on mean times integral (`#3603 `_) +- Allow V0 in atomic_mass function (for ENDF/B-VII.0 data) (`#3607 `_) +- Re-run flaky tests when needed (`#3604 `_) +- Ability to load mesh objects from weight_windows.h5 file (`#3598 `_) +- Switch to using coveralls github action for reporting (`#3594 `_) +- Add user setting for free gas threshold (`#3593 `_) +- Speed up time correction factors (`#3592 `_) +- Fix caching issue when using NCrystal materials (`#3538 `_) +- Fix random ray source region mesh export when using model.export_to_xml() (`#3579 `_) +- Ensure weight_windows_file information is read from XML (`#3587 `_) +- Add missing documentation on in depletion chain file format (`#3590 `_) +- Adding tally filter type option to statepoint get_tally (`#3584 `_) +- Optional separation of mesh-material-volume calc from get_homogenized_materials (`#3581 `_) +- Fix IFP implementation (`#3580 `_) +- Remove several TODOs related to C++17 support (`#3574 `_) +- Fix performance regression in libMesh unstructured mesh tallies (`#3577 `_) +- Update find_package calls in OpenMCConfig.cmake (`#3572 `_) +- Ensure ``n_dimension_`` attribute is set for unstructured meshes (`#3575 `_) +- Allow newer Sphinx version and fix docbuild warnings (`#3571 `_) +- Fixed a bug when combining TimeFilter, MeshFilter, and tracklength estimator (`#3525 `_) +- PowerLaw raises an error if sampling interval contains negative values (`#3542 `_) +- depletion: fix performance of chain matrix construction (`#3567 `_) +- Do not apply boundary conditions when initialized in volume calculation mode (`#3562 `_) +- Bump up tolerance for flaky activation test (`#3560 `_) +- Fixed a bug in plotting cross sections with S(a,b) data (`#3558 `_) +- Change test order to run unit tests first (`#3533 `_) +- adding ecco 33 (`#3556 `_) +- Refactor endf_data to be a fixture (`#3539 `_) +- Revert "fix broken CI" (`#3554 `_) +- fix broken CI (`#3551 `_) +- Leverage particle.move_distance in event advance (`#3544 `_) +- fix tests that accidentaly got broken (`#3543 `_) +- not printing nuclides with 0 percent to terminal (option 2 ) (`#3448 `_) +- Fix a bug in time cutoff behavior (`#3526 `_) +- Avoid duplicate materials written to XML (`#3536 `_) +- Use cached property for openmc.data.Decay.sources (`#3535 `_) +- more helpful error message for dose_coefficients (`#3534 `_) +- Adding 616 group structure (`#3531 `_) +- Remove unused special accessors for tallies (`#3527 `_) +- Consistent XML parsing using functions from _xml module (`#3517 `_) +- Add stat:sum field to MCPL files for proper weight normalization (`#3522 `_) +- Remove reorder_attributes from openmc._xml (`#3519 `_) +- fixed a bug in MeshMaterialFilter.from_volumes (`#3520 `_) +- Fixed a bug in distribcell offsets logic (`#3424 `_) +- Add test for FW-CADIS based WW generation on a DAGMC model (`#3504 `_) +- Fix for Weight Window Scaling Bug (`#3511 `_) +- Fix: ``materials``, ``plots``, and ``tallies`` cannot be passed as lists (`#3513 `_) +- Allow already-initialized openmc.lib in TemporarySession (`#3505 `_) +- Update DAGMC and libMesh precompiler definitions (`#3510 `_) +- Avoid adding ParentNuclideFilter twice when calling prepare_tallies (`#3506 `_) +- Enabling MCPL source files to be read when using surf_source_read (`#3472 `_) +- Boundary info accessors (`#3496 `_) +- automatically finding appropriate dimension when making regular mesh from domain (`#3468 `_) +- Add accessor methods for LocalCoord (`#3494 `_) +- Make MCPL a Runtime Optional Dependency (`#3429 `_) +- Use auto-chunking for StepResult HDF5 writing (`#3498 `_) +- Provide a way to get ID maps from plot parameters on the Model class (`#3481 `_) +- Update OSX install instructions to point to x64 platform (`#3501 `_) +- Update conda install instructions for macOS Apple silicon (`#3488 `_) +- Only show warning if in restart mode (`#3478 `_) +- Add flag to CMakeLists to use submodules instead of searching (`#3480 `_) +- Added citation metadata file (`#3409 `_) +- fix zam parsing (`#3484 `_) +- Support flux collapse method in ``get_microxs_and_flux`` (`#3466 `_) +- Stabilize Adjoint Source (`#3476 `_) +- Refactor and Harden Configuration Management (`#3461 `_) +- Updated Docs to Not Give Specific Python Version Requirement (`#3473 `_) +- Parallelization of Weight Window Update (`#3467 `_) +- Limit Random Ray Weight Window Generation to Final Batch (`#3464 `_) +- Fix Dockerfile DAGMC build (`#3463 `_) +- Fix Weight Window Infinite Loop Bug (`#3457 `_) +- Weight Window Birth Scaling (`#3459 `_) +- Adding checks to geometry.plot to avoid material name overlaps (`#3458 `_) +- Fixing crash when calling Geometry.plot when DAGMCUniverse in geometry (`#3455 `_) +- fixing expansion of elemental Ta bug (`#3443 `_) +- Prevent Adjoint Sources from Trending towards Infinity (`#3449 `_) +- adding plot function to DAGMCUnvierse (`#3451 `_) +- Allow specifying number of equiprobable angles for thermal scattering data generation (`#3346 `_) +- Change Dockerfile from debian:bookworm-slim to ubuntu:24.04 (`#3442 `_) +- Fix Resetting of Auto IDs When Generating MGXS (`#3437 `_) +- Allowing chain_file to be chain object to save reloading time (`#3436 `_) +- update units for flux (`#3441 `_) +- Fix raytrace infinite loop (`#3423 `_) +- Apply Max Number of Events Check to Random Rays (`#3438 `_) +- Add user setting for source rejection fraction (`#3433 `_) +- Adding fix and tests for spherical mesh as spatial distribution (`#3428 `_) +- Random Ray Missed Cell Policy Change for Adjoint Mode (`#3434 `_) +- Random Ray External Source Plotting Fix (`#3430 `_) +- Avoid negative heating values during pair production and bremsstrahlung (`#3426 `_) +- Fix no serialization of periodic_surface_id bug (`#3421 `_) +- Update _get_start_data to always grab the beginning of timestep time (`#3414 `_) +- Fixed a bug in charged particle energy deposition (`#3416 `_) +- Fix bug where the same mesh is written multiple times to settings.xml (`#3418 `_) +- small typo - spelling of Debian (`#3411 `_) +- added test for dagmc geometry plot (`#3375 `_) +- Random Ray Misc Memory Error Fixes (`#3405 `_) +- added type hints to model file (`#3399 `_) +- Apply resolve paths to path values in ``config`` (`#3400 `_) +- Fixing an incorrect computation of CDF of bremsstrahlung photons (`#3396 `_) +- Fix weight modification for uniform source sampling (`#3395 `_) +- Updates to VTK data checks (`#3371 `_) +- Map Compton subshell data to atomic relaxation data (`#3392 `_) +- Skip atomic relaxation if binding energy is larger than photon energy (`#3391 `_) +- Fix extremely large yields from Bremsstrahlung (`#3386 `_) +- corrected tally name in D1S example (`#3383 `_) +- Install MCPL using same build type as OpenMC in CI (`#3388 `_) +- using reduce chain level to remove need for reduce chain (`#3377 `_) +- Fix negative distances from bins_crossed for CylindricalMesh (`#3370 `_) +- Add check for equal value bins in an EnergyFilter (`#3372 `_) +- Fix for Issue Loading MGXS Data Files with LLVM 20 or Newer (`#3368 `_) +- Report plot ID instead of index for unsupported plot types in random ray mode (`#3361 `_) +- Handle Missing Tags in Versioning by Setting Default to 0 (`#3359 `_) +- added kg units to doc string in results class (`#3358 `_) diff --git a/docs/source/releasenotes/index.rst b/docs/source/releasenotes/index.rst index 2927cc458..1292599ba 100644 --- a/docs/source/releasenotes/index.rst +++ b/docs/source/releasenotes/index.rst @@ -7,6 +7,8 @@ Release Notes .. toctree:: :maxdepth: 1 + 0.15.3 + 0.15.2 0.15.1 0.15.0 0.14.0 diff --git a/docs/source/usersguide/data.rst b/docs/source/usersguide/data.rst index 2a9cd36db..8b2938556 100644 --- a/docs/source/usersguide/data.rst +++ b/docs/source/usersguide/data.rst @@ -30,7 +30,8 @@ responsible for specifying one or more of the following: Each of the above files can specified in several ways. In the Python API, a :ref:`runtime configuration variable ` :data:`openmc.config` can be used to specify any of the above and is initialized -using a set of environment variables. +using a set of environment variables. Data configuration paths set in +:data:`openmc.config` will be expanded to absolute paths. .. _usersguide_data_runtime: diff --git a/docs/source/usersguide/decay_sources.rst b/docs/source/usersguide/decay_sources.rst index a228f8e66..398680e74 100644 --- a/docs/source/usersguide/decay_sources.rst +++ b/docs/source/usersguide/decay_sources.rst @@ -6,42 +6,189 @@ Decay Sources Through the :ref:`depletion ` capabilities in OpenMC, it is possible to simulate radiation emitted from the decay of activated materials. -For fusion energy systems, this is commonly done using what is known as the -`rigorous 2-step `_ (R2S) method. -In this method, a neutron transport calculation is used to determine the neutron -flux and reaction rates over a cell- or mesh-based spatial discretization of the -model. Then, the neutron flux in each discrete region is used to predict the -activated material composition using a depletion solver. Finally, a photon -transport calculation with a source based on the activity and energy spectrum of -the activated materials is used to determine a desired physical response (e.g., -a dose rate) at one or more locations of interest. +For fusion energy systems, this is commonly done using either the `rigorous +2-step `_ (R2S) method or the +`direct 1-step `_ (D1S) method. +In the R2S method, a neutron transport calculation is used to determine the +neutron flux and reaction rates over a cell- or mesh-based spatial +discretization of the model. Then, the neutron flux in each discrete region is +used to predict the activated material composition using a depletion solver. +Finally, a photon transport calculation with a source based on the activity and +energy spectrum of the activated materials is used to determine a desired +physical response (e.g., a dose rate) at one or more locations of interest. +OpenMC includes automation for both the R2S and D1S methods as described in the +following sections. -Once a depletion simulation has been completed in OpenMC, the intrinsic decay -source can be determined as follows. First the activated material composition -can be determined using the :class:`openmc.deplete.Results` object. Indexing an -instance of this class with the timestep index returns a -:class:`~openmc.deplete.StepResult` object, which itself has a -:meth:`~openmc.deplete.StepResult.get_material` method. Once the activated -:class:`~openmc.Material` has been obtained, the -:meth:`~openmc.Material.get_decay_photon_energy` method will give the energy -spectrum of the decay photon source. The integral of the spectrum also indicates -the intensity of the source in units of [Bq]. Altogether, the workflow looks as -follows:: +Rigorous 2-Step (R2S) Calculations +================================== +OpenMC includes an :class:`openmc.deplete.R2SManager` class that fully automates +cell- and mesh-based R2S calculations. Before we describe this class, it is +useful to understand the basic mechanics of how an R2S calculation works. +Generally, it involves the following steps: + +1. The :meth:`openmc.deplete.get_microxs_and_flux` function is called to run a + neutron transport calculation that determines fluxes and microscopic cross + sections in each activation region. +2. The :class:`openmc.deplete.IndependentOperator` and + :class:`openmc.deplete.PredictorIntegrator` classes are used to carry out a + depletion (activation) calculation in order to determine predicted material + compositions based on a set of timesteps and source rates. +3. The activated material composition is determined using the + :class:`openmc.deplete.Results` class. Indexing an instance of this class + with the timestep index returns a :class:`~openmc.deplete.StepResult` object, + which itself has a :meth:`~openmc.deplete.StepResult.get_material` method + returning an activated material. +4. The :meth:`openmc.Material.get_decay_photon_energy` method is used to obtain + the energy spectrum of the decay photon source. The integral of the spectrum + also indicates the intensity of the source in units of [Bq]. +5. A new photon source is defined using one of OpenMC's source classes with the + energy distribution set equal to the object returned by the + :meth:`openmc.Material.get_decay_photon_energy` method. The source is then + assigned to a photon :class:`~openmc.Model`. +6. A photon transport calculation is run with ``model.run()``. + +Altogether, the workflow looks as follows:: + + # Run neutron transport calculation + fluxes, micros = openmc.deplete.get_microxs_and_flux(model, domains) + + # Run activation calculation + op = openmc.deplete.IndependentOperator(mats, fluxes, micros) + timesteps = ... + source_rates = ... + integrator = openmc.deplete.Integrator(op, timesteps, source_rates) + integrator.integrate() + + # Get decay photon source at last timestep results = openmc.deplete.Results("depletion_results.h5") - - # Get results at last timestep step = results[-1] - - # Get activated material composition for ID=1 activated_mat = step.get_material('1') - - # Determine photon source photon_energy = activated_mat.get_decay_photon_energy() + photon_source = openmc.IndependentSource( + space=..., + energy=photon_energy, + particle='photon', + strength=photon_energy.integral() + ) -By default, the :meth:`~openmc.Material.get_decay_photon_energy` method will -eliminate spectral lines with very low intensity, but this behavior can be -configured with the ``clip_tolerance`` argument. + # Run photon transport calculation + model.settings.source = photon_source + model.run() + +Note that by default, the :meth:`~openmc.Material.get_decay_photon_energy` +method will eliminate spectral lines with very low intensity, but this behavior +can be configured with the ``clip_tolerance`` argument. + +Cell-based R2S +-------------- + +In practice, users do not need to manually go through each of the steps in an R2S +calculation described above. The :class:`~openmc.deplete.R2SManager` fully +automates the execution of neutron transport, depletion, decay source +generation, and photon transport. For a cell-based R2S calculation, once you +have a :class:`~openmc.Model` that has been defined, simply create an instance +of :class:`~openmc.deplete.R2SManager` by passing the model and a list of cells +to activate:: + + r2s = openmc.deplete.R2SManager(model, [cell1, cell2, cell3]) + +Note that the ``volume`` attribute must be set for any cell that is to be +activated. The :class:`~openmc.deplete.R2SManager` class allows you to +optionally specify a separate photon model; if not given as an argument, it will +create a shallow copy of the original neutron model (available as the +``neutron_model`` attribute) and store it in the ``photon_model`` attribute. We +can use this to define tallies specific to the photon model:: + + dose_tally = openmc.Tally() + ... + r2s.photon_model.tallies = [dose_tally] + +Next, define the timesteps and source rates for the activation calculation:: + + timesteps = [(3.0, 'd'), (5.0, 'h')] + source_rates = [1e12, 0.0] + +In this case, the model is irradiated for 3 days with a source rate of +:math:`10^{12}` neutron/sec and then the source is turned off and the activated +materials are allowed to decay for 5 hours. These parameters should be passed to +the :meth:`~openmc.deplete.R2SManager.run` method to execute the full R2S +calculation. Before we can do that though, for a cell-based calculation, the one +other piece of information that is needed is bounding boxes of the activated +cells:: + + bounding_boxes = { + cell1.id: cell1.bounding_box, + cell2.id: cell2.bounding_box, + cell3.id: cell3.bounding_box + } + +Note that calling the ``bounding_box`` attribute may not work for all +constructive solid geometry regions (for example, a cell that uses a +non-axis-aligned plane). In these cases, the bounding box will need to be +specified manually. Once you have a set of bounding boxes, the R2S calculation +can be run:: + + r2s.run(timesteps, source_rates, bounding_boxes=bounding_boxes) + +If not specified otherwise, a photon transport calculation is run at each time +in the depletion schedule. That means in the case above, we would see three +photon transport calculations. To specify specific times at which photon +transport calculations should be run, pass the ``photon_time_indices`` argument. +For example, if we wanted to run a photon transport calculation only on the last +time (after the 5 hour decay), we would run:: + + r2s.run(timesteps, source_rates, bounding_boxes=bounding_boxes, + photon_time_indices=[2]) + +After an R2S calculation has been run, the :class:`~openmc.deplete.R2SManager` +instance will have a ``results`` dictionary that allows you to directly access +results from each of the steps. It will also write out all the output files into +a directory that is named "r2s_/". The ``output_dir`` argument to the +:meth:`~openmc.deplete.R2SManager.run` method enables you to override the +default output directory name if desired. + +The :meth:`~openmc.deplete.R2SManager.run` method actually runs three +lower-level methods under the hood:: + + r2s.step1_neutron_transport(...) + r2s.step2_activation(...) + r2s.step3_photon_transport(...) + +For users looking for more control over the calculation, these lower-level +methods can be used in lieu of the :meth:`openmc.deplete.R2SManager.run` method. + +Mesh-based R2S +-------------- + +Executing a mesh-based R2S calculation looks nearly identical to the cell-based +R2S workflow described above. The only difference is that instead of passing a +list of cells to the ``domains`` argument of +:class:`~openmc.deplete.R2SManager`, you need to define a mesh object and pass +that instead. This might look like the following:: + + # Define a regular Cartesian mesh + mesh = openmc.RegularMesh() + mesh.lower_left = (-50., -50., 0.) + mesh.upper_right = (50., 50., 75.) + mesh.dimension = (10, 10, 5) + + r2s = openmc.deplete.R2SManager(model, mesh) + +Executing the R2S calculation is then performed by adding photon tallies and +calling the :meth:`~openmc.deplete.R2SManager.run` method with the appropriate +timesteps and source rates. Note that in this case we do not need to define cell +volumes or bounding boxes as is required for a cell-based R2S calculation. +Instead, during the neutron transport step, OpenMC will run a raytracing +calculation to determine material volume fractions within each mesh element +using the :meth:`openmc.MeshBase.material_volumes` method. Arguments to this +method can be customized via the ``mat_vol_kwargs`` argument to the +:meth:`~openmc.deplete.R2SManager.run` method. Most often, this would involve +customizing the number of rays traced to obtain better estimates of volumes. As +an example, if we wanted to run the raytracing calculation with 10 million rays, +we would run:: + + r2s.run(timesteps, source_rates, mat_vol_kwargs={'n_samples': 10_000_000}) Direct 1-Step (D1S) Calculations ================================ @@ -88,5 +235,5 @@ relevant tallies. This can be done with the aid of the dose_tally = sp.get_tally(name='dose tally') # Apply time correction factors - tally = d1s.apply_time_correction(tally, factors, time_index) + tally = d1s.apply_time_correction(dose_tally, factors, time_index) diff --git a/docs/source/usersguide/geometry.rst b/docs/source/usersguide/geometry.rst index 6f14ebfa5..3224d5fff 100644 --- a/docs/source/usersguide/geometry.rst +++ b/docs/source/usersguide/geometry.rst @@ -182,6 +182,8 @@ boundary condition. Periodic boundary conditions can be applied to pairs of planar surfaces. If there are only two periodic surfaces they will be matched automatically. + + Otherwise it is necessary to specify pairs explicitly using the :attr:`Surface.periodic_surface` attribute as in the following example:: @@ -192,7 +194,7 @@ Otherwise it is necessary to specify pairs explicitly using the Both rotational and translational periodic boundary conditions are specified in the same fashion. If both planes have the same normal vector, a translational periodicity is assumed; rotational periodicity is assumed otherwise. Currently, -only rotations about the :math:`z`-axis are supported. +rotations must be about the :math:`x`-, :math:`y`-, or :math:`z`-axis. For a rotational periodic BC, the normal vectors of each surface must point inwards---towards the valid geometry. For example, a :class:`XPlane` and @@ -413,11 +415,11 @@ to help figure out how to place universes:: Note that by default, hexagonal lattices are positioned such that each lattice -element has two faces that are parallel to the :math:`y` axis. As one example, -to create a three-ring lattice centered at the origin with a pitch of 10 cm -where all the lattice elements centered along the :math:`y` axis are filled with -universe ``u`` and the remainder are filled with universe ``q``, the following -code would work:: +element has two faces that are perpendicular to the :math:`y` axis. As one +example, to create a three-ring lattice centered at the origin with a pitch of +10 cm where all the lattice elements centered along the :math:`y` axis are +filled with universe ``u`` and the remainder are filled with universe ``q``, the +following code would work:: hexlat = openmc.HexLattice() hexlat.center = (0, 0) @@ -530,6 +532,89 @@ UWUW and OpenMC material ID space will cause an error. To automatically resolve these ID overlaps, ``auto_ids`` can be set to ``True`` to append the UWUW material IDs to the OpenMC material ID space. + +Material overrides and differentiation +-------------------------------------- + +Programmatic access to DAGMC cell information for material overrides +and differentiation requires synchronization of the DAGMC universe +representation across Python and C-API:: + + model.init_lib() + model.sync_dagmc_universes() + model.finalize_lib() + +Upon completion of these steps, the :attr:`DAGMCUniverse.cells` attribute will +be populated with :class:`DAGMCCell` proxy objects that represent the cells +defined in the DAGMC model. The :class:`DAGMCCell` objects will have +:class:`openmc.Material`'s' applied according to the assignments upon +initialization of the model. These materials can be replaced in the same manner +as :class:`openmc.Cell` objects to override material assignments in the DAGMC +model. + +Depletion with DAGMC geometry +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The synchronization of :class:`openmc.DAGMCUniverse`'s is important for +depletion calculations using DAGMC geometry when materials need to be +differentiated to perform material burnup independently in each DAGMC cell. See +:meth:`openmc.model.Model.differentiate_mats`. + +Material overrides +~~~~~~~~~~~~~~~~~~ + +OpenMC supports overriding material assignments defined inside a DAGMC HDF5 +model so that CAD-assigned materials can be replaced by :class:`openmc.Material` +objects. This is useful when the CAD geometry provides the shape but OpenMC +materials (specific nuclide content, densities, or depletion behavior) are +required. + + +Replacing materials by name +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +If a DAGMC file includes material name tags, you can replace all cells that +reference a particular name with an :class:`openmc.Material` using +:meth:`~openmc.DAGMCUniverse.replace_material_assignment`:: + + import openmc + + dag_univ = openmc.DAGMCUniverse('dagmc.h5m') + + fuel = openmc.Material(name='fuel') + fuel.add_nuclide('U235', 0.05) + fuel.add_nuclide('U238', 0.95) + fuel.set_density('g/cm3', 10.5) + + dag_univ.replace_material_assignment('Fuel', fuel) + +This lets you keep CAD geometry while adopting OpenMC material definitions. + +Per-cell material overrides +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +To assign overrides without initializing :class:`openmc.Model`, the +:meth:`openmc.DAGMCUniverse.add_material_override` method can be used to assign +materials to particular DAGMC cells. The method accepts either an integer cell +ID:: + + dag_univ = openmc.DAGMCUniverse('dagmc.h5m') + + enriched = openmc.Material(name='fuel_enriched') + enriched.add_nuclide('U235', 0.10) + enriched.add_nuclide('U238', 0.90) + enriched.set_density('g/cm3', 10.5) + + dag_univ.add_material_override(1, enriched) + +In the case that the :class:`openmc.DAGMCUniverse` has already been synchronized, +a :class:`openmc.DAGMCCell` object can also be provide to assign the material. + +Overrides are written to the `` element of the +:ref:` ` XML element so the C++ core can apply +them on initialization. + + .. _Direct Accelerated Geometry Monte Carlo: https://svalinn.github.io/DAGMC/ .. _University of Wisconsin Unified Workflow: https://svalinn.github.io/DAGMC/usersguide/uw2.html diff --git a/docs/source/usersguide/index.rst b/docs/source/usersguide/index.rst index aef9b1a1c..5f8e0197e 100644 --- a/docs/source/usersguide/index.rst +++ b/docs/source/usersguide/index.rst @@ -22,6 +22,7 @@ essential aspects of using OpenMC to perform simulations. plots depletion decay_sources + kinetics scripts processing parallel diff --git a/docs/source/usersguide/install.rst b/docs/source/usersguide/install.rst index d294770e0..64d480179 100644 --- a/docs/source/usersguide/install.rst +++ b/docs/source/usersguide/install.rst @@ -35,6 +35,13 @@ you wish) with OpenMC installed. conda create --name openmc-env openmc conda activate openmc-env +If you are installing on macOS with an Apple silicon ARM-based processor, you +will also need to specify the `--platform` option: + +.. code-block:: sh + + conda create --name openmc-env --platform osx-64 openmc + You are now in a conda environment called `openmc-env` that has OpenMC installed. @@ -221,7 +228,7 @@ Prerequisites OpenMC's built-in plotting capabilities use the libpng library to produce compressed PNG files. In the absence of this library, OpenMC will fallback to writing PPM files, which are uncompressed and only supported by select - image viewers. libpng can be installed on Ddebian derivates with:: + image viewers. libpng can be installed on Debian derivates with:: sudo apt install libpng-dev @@ -368,10 +375,6 @@ OPENMC_USE_DAGMC should also be defined as `DAGMC_ROOT` in the CMake configuration command. (Default: off) -OPENMC_USE_MCPL - Turns on support for reading MCPL_ source files and writing MCPL source points - and surface sources. (Default: off) - OPENMC_USE_LIBMESH Enables the use of unstructured mesh tallies with libMesh_. (Default: off) @@ -380,6 +383,11 @@ OPENMC_USE_MPI options, please see the `FindMPI.cmake documentation `_. +OPENMC_FORCE_VENDORED_LIBS + Forces OpenMC to use the submodules located in the vendor directory, as + opposed to searching the system for already installed versions of those + modules. + To set any of these options (e.g., turning on profiling), the following form should be used: @@ -515,10 +523,13 @@ to install the Python package in :ref:`"editable" mode `. Prerequisites ------------- -The Python API works with Python 3.8+. In addition to Python itself, the API -relies on a number of third-party packages. All prerequisites can be installed -using Conda_ (recommended), pip_, or through the package manager in most Linux -distributions. +In addition to Python itself, the OpenMC Python API relies on a number of +third-party packages. All prerequisites can be installed using Conda_ +(recommended), pip_, or through the package manager in most Linux distributions. +The current required Python version and up-to-date list of package dependencies +can be found in the `pyproject.toml `_ +file in the root directory of the OpenMC repository. An overview of these +dependencies is provided below. .. admonition:: Required :class: error diff --git a/docs/source/usersguide/kinetics.rst b/docs/source/usersguide/kinetics.rst new file mode 100644 index 000000000..9024ff822 --- /dev/null +++ b/docs/source/usersguide/kinetics.rst @@ -0,0 +1,133 @@ +.. _kinetics: + +=================== +Kinetics parameters +=================== + +OpenMC has the capability to estimate the following adjoint-weighted effective +generation time :math:`\Lambda_{\text{eff}}` and the effective delayed neutron +fraction :math:`\beta_{\text{eff}}`. These parameters are calculated using the +iterated fission probability (IFP) method [Hurwitz_1964]_ based on a similar +approach as in `Serpent 2 `_. The +implementation in OpenMC is limited to eigenvalue calculations and is described +in more details in [Dorville_2025]_. + +---------------------------------- +Iterated Fission Probability (IFP) +---------------------------------- + +With IFP, additional information needs to be recorded during the simulation +compared to a typical eigenvalue calculation. OpenMC stores an additional +set of values (neutron lifetime or delayed neutron group number for +:math:`\Lambda_{\text{eff}}` or :math:`\beta_{\text{eff}}`, respectively) +for every fission neutron simulated. Each set of values corresponds to +the values that are associated to the :math:`N_{\text{gen}}` direct ancestors +of any given fission neutron. + +:math:`N_{\text{gen}}` is referred to as the number of generations in the +IFP method and corresponds to the number of generations between the birth of +a fission neutron and the time its score is added to the IFP tally. By default, +OpenMC considers 10 generations but this value can be modified by the user via +the ``ifp_n_generation`` settings in the Python API:: + + settings.ifp_n_generation = 5 + +``ifp_n_generation`` should be greater than 0, but should also be lower than +or equal to the number of inactive batches declared for the calculation. +The respect of these constraints is verified by OpenMC before any calculation. + +OpenMC will automatically detect the type of data that needs to be stored based +on the tally scores selected by the user. This guarantees that only information +of interest are stored during a simulation and avoids using extra memory when +only one parameter is needed. The following table shows the tally scores that +are needed to compute kinetics parameters in OpenMC: + +.. table:: **OpenMC tally scores needed to calculate adjoint-weighted kinetics parameters** + :align: center + + =============================== ============================ ========================== ======== + OpenMC tally score \\ Parameter :math:`\Lambda_{\text{eff}}` :math:`\beta_{\text{eff}}` Both + =============================== ============================ ========================== ======== + ``ifp-time-numerator`` X X + ``ifp-beta-numerator`` X X + ``ifp-denominator`` X X X + =============================== ============================ ========================== ======== + +| + +.. note:: Because the memory footprint of additional data is generally non-negligible + with IFP, it is recommended to choose the value for ``ifp_n_generation`` carefully. + For example, using one generation for both kinetics parameters corresponds to store + one additional integer (for the delayed neutron group number used with + :math:`\beta_{\text{eff}}`) and one floating point value (for the neutron lifetime + used with :math:`\Lambda_{\text{eff}}`) for every fission neutron simulated once the + asymptotic regime is reached. + +----------------------------- +Obtaining kinetics parameters +----------------------------- + +The ``Model`` class can be used to automatically generate all IFP tallies using +the Python API with :attr:`openmc.Settings.ifp_n_generation` greater than 0 and +the :meth:`openmc.Model.add_ifp_kinetics_tallies` method:: + + model = openmc.Model(geometry, settings=settings) + model.add_kinetics_parameters_tallies(num_groups=6) # Add 6 precursor groups + +Alternatively, each of the tallies can be manually defined using group-wise or +total :math:`\beta_{\text{eff}}` specified by providing a 6-group +:class:`openmc.DelayedGroupFilter`:: + + beta_tally = openmc.Tally(name="group-beta-score") + beta_tally.scores = ["ifp-beta-numerator"] + + # Add DelayedGroupFilter to enable group-wise tallies + beta_tally.filters = [openmc.DelayedGroupFilter(list(range(1, 7)))] + +Here is an example showing how to declare the three available IFP scores in a +single tally:: + + tally = openmc.Tally(name="ifp-scores") + tally.scores = [ + "ifp-time-numerator", + "ifp-beta-numerator", + "ifp-denominator" + ] + +The effective generation time :math:`\Lambda_{\text{eff}}` is calculated +by dividing the result of the ``ifp-time-numerator`` score by the one obtained +for ``ifp-denominator`` and by the :math:`k_{\text{eff}}` of the simulation: + +.. math:: + :label: lambda_eff + + \Lambda_{\text{eff}} = \frac{S_{\text{ifp-time-numerator}}}{S_{\text{ifp-denominator}} \times k_{\text{eff}}} + +The effective delayed neutron fraction :math:`\beta_{\text{eff}}` is calculated +by dividing the result of the ``ifp-beta-numerator`` score by the one obtained +for ``ifp-denominator``: + +.. math:: + :label: beta_eff + + \beta_{\text{eff}} = \frac{S_{\text{ifp-beta-numerator}}}{S_{\text{ifp-denominator}}} + +The kinetics parameters can be retrieved directly from a statepoint file using +the :meth:`openmc.StatePoint.ifp_results` method:: + + with openmc.StatePoint(output_path) as sp: + generation_time, beta_eff = sp.get_kinetics_parameters() + +.. only:: html + + .. rubric:: References + +.. [Hurwitz_1964] H. Hurwitz Jr., "Naval Reactors Physics Handbook", volume 1, p. 864. + Radkowsky, A. (Ed.), Naval Reactors, Division of Reactor Development, U.S. + Atomic Energy Commission (1964). + +.. [Dorville_2025] J. Dorville, L. Labrie-Cleary, and P. K. Romano, "Implementation + of the Iterated Fission Probability Method in OpenMC to Compute Adjoint-Weighted + Kinetics Parameters", International Conference on Mathematics and Computational + Methods Applied to Nuclear Science and Engineering (M&C 2025), Denver, April 27-30, + 2025. diff --git a/docs/source/usersguide/plots.rst b/docs/source/usersguide/plots.rst index da0c69bdd..b5c29a3e8 100644 --- a/docs/source/usersguide/plots.rst +++ b/docs/source/usersguide/plots.rst @@ -6,13 +6,14 @@ Geometry Visualization .. currentmodule:: openmc -OpenMC is capable of producing two-dimensional slice plots of a geometry as well -as three-dimensional voxel plots using the geometry plotting :ref:`run mode -`. The geometry plotting mode relies on the presence of a -:ref:`plots.xml ` file that indicates what plots should be created. To -create this file, one needs to create one or more :class:`openmc.Plot` -instances, add them to a :class:`openmc.Plots` collection, and then use the -:class:`Plots.export_to_xml` method to write the ``plots.xml`` file. +OpenMC is capable of producing two-dimensional slice plots of a geometry, +three-dimensional voxel plots, and three-dimensional raytrace plots using the +geometry plotting :ref:`run mode `. The geometry plotting +mode relies on the presence of a :ref:`plots.xml ` file that indicates +what plots should be created. To create this file, one needs to create one or +more instances of the various plot classes described below, add them to a +:class:`openmc.Plots` collection, and then use the :class:`Plots.export_to_xml` +method to write the ``plots.xml`` file. ----------- Slice Plots @@ -21,15 +22,14 @@ Slice Plots .. image:: ../_images/atr.png :width: 300px -By default, when an instance of :class:`openmc.Plot` is created, it indicates -that a 2D slice plot should be made. You can specify the origin of the plot -(:attr:`Plot.origin`), the width of the plot in each direction -(:attr:`Plot.width`), the number of pixels to use in each direction -(:attr:`Plot.pixels`), and the basis directions for the plot. For example, to -create a :math:`x` - :math:`z` plot centered at (5.0, 2.0, 3.0) with a width of -(50., 50.) and 400x400 pixels:: +The :class:`openmc.SlicePlot` class indicates that a 2D slice plot should be +made. You can specify the origin of the plot (:attr:`SlicePlot.origin`), the +width of the plot in each direction (:attr:`SlicePlot.width`), the number of +pixels to use in each direction (:attr:`SlicePlot.pixels`), and the basis +directions for the plot. For example, to create a :math:`x` - :math:`z` plot +centered at (5.0, 2.0, 3.0) with a width of (50., 50.) and 400x400 pixels:: - plot = openmc.Plot() + plot = openmc.SlicePlot() plot.basis = 'xz' plot.origin = (5.0, 2.0, 3.0) plot.width = (50., 50.) @@ -47,7 +47,7 @@ that location. By default, a unique color will be assigned to each cell in the geometry. If you want your plot to be colored by material instead, change the -:attr:`Plot.color_by` attribute:: +:attr:`SlicePlot.color_by` attribute:: plot.color_by = 'material' @@ -68,8 +68,8 @@ particular cells/materials should be given colors of your choosing:: Note that colors can be given as RGB tuples or by a string indicating a valid `SVG color `_. -When you're done creating your :class:`openmc.Plot` instances, you need to then -assign them to a :class:`openmc.Plots` collection and export it to XML:: +When you're done creating your :class:`openmc.SlicePlot` instances, you need to +then assign them to a :class:`openmc.Plots` collection and export it to XML:: plots = openmc.Plots([plot1, plot2, plot3]) plots.export_to_xml() @@ -97,13 +97,11 @@ Voxel Plots .. image:: ../_images/3dba.png :width: 200px -The :class:`openmc.Plot` class can also be told to generate a 3D voxel plot -instead of a 2D slice plot. Simply change the :attr:`Plot.type` attribute to -'voxel'. In this case, the :attr:`Plot.width` and :attr:`Plot.pixels` attributes -should be three items long, e.g.:: +The :class:`openmc.VoxelPlot` class enables the generation of a 3D voxel plot +instead of a 2D slice plot. In this case, the :attr:`VoxelPlot.width` and +:attr:`VoxelPlot.pixels` attributes should be three items long, e.g.:: - vox_plot = openmc.Plot() - vox_plot.type = 'voxel' + vox_plot = openmc.VoxelPlot() vox_plot.width = (100., 100., 50.) vox_plot.pixels = (400, 400, 200) diff --git a/docs/source/usersguide/processing.rst b/docs/source/usersguide/processing.rst index 10944b5e2..fe6ab0826 100644 --- a/docs/source/usersguide/processing.rst +++ b/docs/source/usersguide/processing.rst @@ -68,17 +68,17 @@ generation, and particle number of the desired particle. For example, to create a track file for particle 4 of batch 1 and generation 2:: settings = openmc.Settings() - settings.track = (1, 2, 4) + settings.track = [(1, 2, 4)] -To specify multiple particles, the length of the iterable should be a multiple -of three, e.g., if we wanted particles 3 and 4 from batch 1 and generation 2:: +To specify multiple particles, specify a list of tuples, e.g., if we wanted +particles 3 and 4 from batch 1 and generation 2:: - settings.track = (1, 2, 3, 1, 2, 4) + settings.track = [(1, 2, 3), (1, 2, 4)] -After running OpenMC, the working directory will contain a file of the form -"track_(batch #)_(generation #)_(particle #).h5" for each particle tracked. -These track files can be converted into VTK poly data files with the -:class:`openmc.Tracks` class. +After running OpenMC (now, without the ``-t`` argument), the working directory +will contain a file named `tracks.h5`, which contains a collection of particle +tracks. These track files can be converted into VTK poly data files or +matplotlib plots with the :class:`openmc.Tracks` class. ---------------------- Source Site Processing @@ -91,3 +91,82 @@ from a statepoint file, the ``openmc.statepoint`` module can be used. An `example notebook`_ demontrates how to analyze and plot source information. .. _example notebook: https://nbviewer.jupyter.org/github/openmc-dev/openmc-notebooks/blob/main/post-processing.ipynb + +------------------------ +VTK Mesh File Generation +------------------------ + +VTK files of OpenMC meshes can be created using the +:meth:`openmc.Mesh.write_data_to_vtk` method. Data can be applied to the +elements of the resulting mesh from mesh filter objects. This data can be +provided either as a flat array or, in the case of structured meshes +(:class:`~openmc.RegularMesh`, :class:`~openmc.RectilinearMesh`, +:class:`~openmc.CylindricalMesh`, or :class:`SphericalMesh`), the data can be +shaped with dimensions that match the dimensions of the mesh itself. + + +.. image:: ../_images/sphere-mesh-vtk.png + :width: 400px + :align: center + :alt: OpenMC spherical mesh exported to VTK + + +For all mesh types, if a flat data array is provided to the mesh, it is expected +that the data is ordered in the same ordering as the :attr:`openmc.Mesh.indices` +for that mesh object. When providing data directly from a tally, as shown below, +a flat array for a given dataset can be passed directly to this method. + +:: + + # create model above + + # create a mesh tally + mesh = openmc.RegularMesh() + mesh.dimension = [10, 20, 30] + mesh.lower_left = [-5, -10, -15] + mesh.upper_right = [5, 10, 15] + mesh_filter = openmc.MeshFilter(mesh) + tally = openmc.Tally() + tally.filters = [mesh_filter] + tally.scores = ['flux'] + + model.tallies = [tally] + model.run(apply_tally_results=True) + + # provide the data as-is to the method + mesh.write_data_to_vtk('flux.vtk', {'flux-mean': tally.mean}) + +The :class:`~openmc.Tally` object also provides a way to expand the dimensions +of the mesh filter into a meaningful form where indexing the mesh filter +dimensions results in intuitive slicing of structured meshes by setting +``expand_dims=True`` when using :meth:`openmc.Tally.get_reshaped_data`. This +reshaping does cause flat indexing of the data to change, however. As noted +above, provided datasets are allowed to be shaped so long as such datasets have +shapes that match the mesh dimensions. The ability to pass datasets in this way +is useful when additional filters are applied to a tally. The example below +demonstrates such a case for tally with both a :class:`~openmc.MeshFilter` and +:class:`~openmc.EnergyFilter` applied. + +:: + + # create model above + + # create a mesh tally with energy filter + mesh = openmc.RegularMesh() + mesh.dimension = [10, 20, 30] + mesh.lower_left = [-5, -10, -15] + mesh.upper_right = [5, 10, 15] + mesh_filter = openmc.MeshFilter(mesh) + energy_filter = openmc.EnergyFilter([0.0, 1.0, 20.0e6]) + tally = openmc.Tally() + tally.filters = [mesh_filter, energy_filter] + tally.scores = ['flux'] + + model.tallies = [tally] + model.run(apply_tally_results=True) + + # get the data with mesh dimensions expanded, squeeze out length-one dimensions (nuclides, scores) + flux = tally.get_reshaped_data(expand_dims=True).squeeze() # shape: (10, 20, 30, 2) + + # write the lowest energy group to a VTK file + mesh.write_data_to_vtk('flux-group1.vtk', datasets={'flux-mean': flux[..., 0]}) diff --git a/docs/source/usersguide/random_ray.rst b/docs/source/usersguide/random_ray.rst index f28aed784..382381a9e 100644 --- a/docs/source/usersguide/random_ray.rst +++ b/docs/source/usersguide/random_ray.rst @@ -11,6 +11,76 @@ active batches `. However, there are a couple of settings that are unique to the random ray solver and a few areas that the random ray run strategy differs, both of which will be described in this section. +.. _quick_start: + +----------- +Quick Start +----------- + +While this page contains a comprehensive guide to the random ray solver and +its various parameters, the process of converting an existing continuous energy +Monte Carlo model to a random ray model can be largely automated via convenience +functions in OpenMC's Python interface:: + + # Define continuous energy model as normal + model = openmc.Model() + ... + + # Convert model to multigroup (will auto-generate MGXS library if needed) + model.convert_to_multigroup() + + # Convert model to random ray and initialize random ray parameters + # to reasonable defaults based on the specifics of the geometry + model.convert_to_random_ray() + + # (Optional) Overlay source region decomposition mesh to improve fidelity of the + # random ray solver. Adjust 'n' for fidelity vs runtime. + n = 100 + mesh = openmc.RegularMesh() + mesh.dimension = (n, n, n) + mesh.lower_left = model.geometry.bounding_box.lower_left + mesh.upper_right = model.geometry.bounding_box.upper_right + model.settings.random_ray['source_region_meshes'] = [(mesh, [model.geometry.root_universe])] + + # (Optional) Improve fidelity of the random ray solver by enabling linear sources + model.settings.random_ray['source_shape'] = 'linear' + + # (Optional) Increase the number of rays/batch, to reduce uncertainty + model.settings.particles = 500 + +The above strategy first converts the continuous energy model to a multigroup +one using the :meth:`openmc.Model.convert_to_multigroup` method. By default, +this will internally run a coarsely converged continuous energy Monte Carlo +simulation to produce an estimated multigroup macroscopic cross section set for +each material specified in the model, and store this data into a multigroup +cross section library file (``mgxs.h5``) that can be used by the random ray +solver. + +The :meth:`openmc.Model.convert_to_random_ray` method enables random ray mode +and performs an analysis of the model geometry to determine reasonable values +for all required parameters. If default behavior is not satisfactory, the user +can manually adjust the settings in the :attr:`~openmc.Settings.random_ray` +dictionary in the :class:`openmc.Settings` as described in the sections below. + +Finally a few optional steps are shown. The first (recommended) step overlays a +mesh over the geometry to create smaller source regions so that source +resolution improves and the random ray solver becomes more accurate. Varying the +mesh resolution can be used to trade off between accuracy and runtime. +High-fidelity fission reactor simulation may require source region sizes below 1 +cm, while larger fixed source problems with some tolerance for error may be able +to use source regions of 10 or 100 cm. + +We also enable linear sources, which can improve the accuracy of the random ray +solver and/or allow for a much coarser mesh resolution to be overlaid. Finally, +the number of rays per batch is adjusted. The goal here is to ensure that the +source region miss rate is below 1%, which is reported by OpenMC at the end of +the simulation (or before via a warning if it is very high). + +.. warning:: + If using a mesh filter for tallying or weight window generation, ensure that + the same mesh is used for source region decomposition via + ``model.settings.random_ray['source_region_meshes']``. + ------------------------ Enabling Random Ray Mode ------------------------ @@ -557,29 +627,144 @@ variety of problem types (or through a multidimensional parameter sweep of design variables) with only modest errors and at greatly reduced cost as compared to using only continuous energy Monte Carlo. +~~~~~~~~~~~~ +The Easy Way +~~~~~~~~~~~~ + +The easiest way to generate a multigroup cross section library is to use the +:meth:`openmc.Model.convert_to_multigroup` method. This method will +automatically output a multigroup cross section library file (``mgxs.h5``) from +a continuous energy Monte Carlo model and alter the material definitions in the +model to use these multigroup cross sections. An example is given below:: + + # Assume we already have a working continuous energy model + model.convert_to_multigroup( + method="material_wise", + groups="CASMO-2", + nparticles=2000, + overwrite_mgxs_library=False, + mgxs_path="mgxs.h5", + correction=None, + source_energy=None + ) + +The most important parameter to set is the ``method`` parameter, which can be +either "stochastic_slab", "material_wise", or "infinite_medium". An overview +of these methods is given below: + +.. list-table:: Comparison of Automatic MGXS Generation Methods + :header-rows: 1 + :widths: 10 30 30 30 + + * - Method + - Description + - Pros + - Cons + * - ``material_wise`` (default) + - * Higher Fidelity + * Runs a CE simulation with the original geometry and source, tallying + cross sections with a material filter. + - * Typically the most accurate of the three methods + * Accurately captures (averaged over the full problem domain) + both spatial and resonance self shielding effects + - * Potentially slower as the full geometry must be run + * If a material is only present far from the source and doesn't get tallied + to in the CE simulation, the MGXS will be zero for that material. + * - ``stochastic_slab`` + - * Medium Fidelity + * Runs a CE simulation with a greatly simplified geometry, where materials + are randomly assigned to layers in a 1D "stochastic slab sandwich" geometry + - * Still captures resonant self shielding and resonance effects between materials + * Fast due to the simplified geometry + * Able to produce cross section data for all materials, regardless of how + far they are from the source in the original geometry + - * Does not capture most spatial self shielding effects, e.g., no lattice physics. + * - ``infinite_medium`` + - * Lower Fidelity + * Runs one CE simulation per material independently. Each simulation is just + an infinite medium slowing down problem, with an assumed external source term. + - * Simple + - * Poor accuracy (no spatial information, no lattice physics, no resonance effects + between materials) + * May hang if a material has a k-infinity greater than 1.0 + +When selecting a non-default energy group structure, you can manually define +group boundaries or specify the name of a known group structure (a list of which +can be found at :data:`openmc.mgxs.GROUP_STRUCTURES`). The ``nparticles`` +parameter can be adjusted upward to improve the fidelity of the generated cross +section library. The ``correction`` parameter can be set to ``"P0"`` to enable +P0 transport correction. The ``overwrite_mgxs_library`` parameter can be set to +``True`` to overwrite an existing MGXS library file, or ``False`` to skip +generation and use an existing library file. + +.. note:: + MGXS transport correction (via setting the ``correction`` parameter in the + :meth:`openmc.Model.convert_to_multigroup` method to ``"P0"``) may + result in negative in-group scattering cross sections, which can cause + numerical instability. To mitigate this, during a random ray solve OpenMC + will automatically apply + `diagonal stabilization `_ + with a :math:`\rho` default value of 1.0, which can be adjusted with the + ``settings.random_ray['diagonal_stabilization_rho']`` parameter. + +When generating MGXS data with either the ``stochastic_slab`` or +``infinite_medium`` methods, by default the simulation will use a uniform source +distribution spread evenly over all energy groups. This ensures that all energy +groups receive tallies and therefore produce non-zero total multigroup cross +sections. Additionally, the function will convert any sources in the model into +simplified spatial sources that retain the original energy distributions. If +sources are present, they will be used 99% of the time to sample source energies +during MGXS generation. The other 1% of the time, energies will be sampled +uniformly over all energy groups to ensure that all groups receive some tallies. +However, the user may wish to specify a different source energy spectrum (for +instance, if they are using a FileSource, such that the energy distribution +cannot be extracted from the python source object). This can be done by +providing a :class:`openmc.stats.Univariate` distribution as the +``source_energy`` parameter of the :meth:`openmc.Model.convert_to_multigroup` +method. If provided, it will override any sources present in the model and will +be used 99% of the time to sample source energies during MGXS generation. The +other 1% of the time, energies will be sampled uniformly over all energy groups +to ensure that all groups receive some tallies. + +For instance, a D-D fusion simulation may involve a complex file source. In this +case, the user may wish to provide a discrete 2.45 MeV energy source +distribution for MGXS generation as:: + + source_energy = openmc.stats.delta_function(2.45e6) + +Ultimately, the methods described above are all just approximations. +Approximations in the generated MGXS data will fundamentally limit the potential +accuracy of the random ray solver. However, the methods described above are all +useful in that they can provide a good starting point for a random ray +simulation, and if more fidelity is needed the user may wish to follow the +instructions below or experiment with transport correction techniques to improve +the fidelity of the generated MGXS data. + +~~~~~~~~~~~~ +The Hard Way +~~~~~~~~~~~~ + We give here a quick summary of how to produce a multigroup cross section data file (``mgxs.h5``) from a starting point of a typical continuous energy Monte -Carlo input file. Notably, continuous energy input files define materials as a -mixture of nuclides with different densities, whereas multigroup materials are -simply defined by which name they correspond to in a ``mgxs.h5`` library file. +Carlo model. Notably, continuous energy models define materials as a mixture of +nuclides with different densities, whereas multigroup materials are simply +defined by which name they correspond to in a ``mgxs.h5`` library file. To generate the cross section data, we begin with a continuous energy Monte -Carlo input deck and add in the required tallies that will be needed to generate -our library. In this example, we will specify material-wise cross sections and a -two group energy decomposition:: +Carlo model and add in the tallies that are needed to generate our library. In +this example, we will specify material-wise cross sections and a two-group +energy decomposition:: # Define geometry ... - ... geometry = openmc.Geometry() ... - ... # Initialize MGXS library with a finished OpenMC geometry object mgxs_lib = openmc.mgxs.Library(geometry) # Pick energy group structure - groups = openmc.mgxs.EnergyGroups(openmc.mgxs.GROUP_STRUCTURES['CASMO-2']) + groups = openmc.mgxs.EnergyGroups('CASMO-2') mgxs_lib.energy_groups = groups # Disable transport correction @@ -587,7 +772,7 @@ two group energy decomposition:: # Specify needed cross sections for random ray mgxs_lib.mgxs_types = ['total', 'absorption', 'nu-fission', 'fission', - 'nu-scatter matrix', 'multiplicity matrix', 'chi'] + 'nu-scatter matrix', 'multiplicity matrix', 'chi'] # Specify a "cell" domain type for the cross section tally filters mgxs_lib.domain_type = "material" @@ -606,7 +791,7 @@ two group energy decomposition:: # Create a "tallies.xml" file for the MGXS Library tallies = openmc.Tallies() - mgxs_lib.add_to_tallies_file(tallies, merge=True) + mgxs_lib.add_to_tallies(tallies, merge=True) # Export tallies.export_to_xml() @@ -614,13 +799,13 @@ two group energy decomposition:: ... When selecting an energy decomposition, you can manually define group boundaries -or pick out a group structure already known to OpenMC (a list of which can be -found at :class:`openmc.mgxs.GROUP_STRUCTURES`). Once the above input deck has -been run, the resulting statepoint file will contain the needed flux and -reaction rate tally data so that a MGXS library file can be generated. Below is -the postprocessing script needed to generate the ``mgxs.h5`` library file given -a statepoint file (e.g., ``statepoint.100.h5``) file and summary file (e.g., -``summary.h5``) that resulted from running our previous example:: +or specify the name of known group structure (a list of which can be found at +:data:`openmc.mgxs.GROUP_STRUCTURES`). Once the above model has been run, the +resulting statepoint file will contain the needed flux and reaction rate tally +data so that a MGXS library file can be generated. Below is the postprocessing +script needed to generate the ``mgxs.h5`` library file given a statepoint file +(e.g., ``statepoint.100.h5``) file and summary file (e.g., ``summary.h5``) that +resulted from running our previous example:: import openmc @@ -628,10 +813,7 @@ a statepoint file (e.g., ``statepoint.100.h5``) file and summary file (e.g., geom = summary.geometry mats = summary.materials - statepoint_filename = 'statepoint.100.h5' - sp = openmc.StatePoint(statepoint_filename) - - groups = openmc.mgxs.EnergyGroups(openmc.mgxs.GROUP_STRUCTURES['CASMO-2']) + groups = openmc.mgxs.EnergyGroups('CASMO-2') mgxs_lib = openmc.mgxs.Library(geom) mgxs_lib.energy_groups = groups mgxs_lib.correction = None @@ -653,10 +835,10 @@ a statepoint file (e.g., ``statepoint.100.h5``) file and summary file (e.g., # Construct all tallies needed for the multi-group cross section library mgxs_lib.build_library() - mgxs_lib.load_from_statepoint(sp) + with openmc.StatePoint('statepoint.100.h5') as sp: + mgxs_lib.load_from_statepoint(sp) - names = [] - for mat in mgxs_lib.domains: names.append(mat.name) + names = [mat.name for mat in mgxs_lib.domains] # Create a MGXS File which can then be written to disk mgxs_file = mgxs_lib.create_mg_library(xs_type='macro', xsdata_names=names) @@ -665,8 +847,8 @@ a statepoint file (e.g., ``statepoint.100.h5``) file and summary file (e.g., mgxs_file.export_to_hdf5("mgxs.h5") Notably, the postprocessing script needs to match the same -:class:`openmc.mgxs.Library` settings that were used to generate the tallies, -but otherwise is able to discern the rest of the simulation details from the +:class:`openmc.mgxs.Library` settings that were used to generate the tallies but +is otherwise able to discern the rest of the simulation details from the statepoint and summary files. Once the postprocessing script is successfully run, the ``mgxs.h5`` file can be loaded by subsequent runs of OpenMC. @@ -701,11 +883,11 @@ multigroup library instead of defining their isotopic contents, as:: water_data = openmc.Macroscopic('Hot borated water') # Instantiate some Materials and register the appropriate Macroscopic objects - fuel= openmc.Material(name='UO2 (2.4%)') + fuel = openmc.Material(name='UO2 (2.4%)') fuel.set_density('macro', 1.0) fuel.add_macroscopic(fuel_data) - water= openmc.Material(name='Hot borated water') + water = openmc.Material(name='Hot borated water') water.set_density('macro', 1.0) water.add_macroscopic(water_data) @@ -763,9 +945,12 @@ Monte Carlo solver. Currently, all of the following conditions must be met for the particle source to be valid in random ray mode: -- One or more domain ids must be specified that indicate which cells, universes, - or materials the source applies to. This implicitly limits the source type to - being volumetric. This is specified via the ``domains`` constraint placed on the +- Either a point source must be used, or a domain constraint must be specified + that indicates which cells, universes, or materials the source applies to. In + either case, this implicitly limits the source type to being volumetric, as + even in the point source case the source will be "smeared" throughout the + source region that contains the point source coordinate. A source domain is + specified via the ``domains`` constraint placed on the :class:`openmc.IndependentSource` Python class. - The source must be isotropic (default for a source) - The source must use a discrete (i.e., multigroup) energy distribution. The @@ -946,11 +1131,10 @@ given below: tallies.export_to_xml() # Create voxel plot - plot = openmc.Plot() + plot = openmc.VoxelPlot() plot.origin = [0, 0, 0] plot.width = [2*pitch, 2*pitch, 1] plot.pixels = [1000, 1000, 1] - plot.type = 'voxel' # Instantiate a Plots collection and export to XML plots = openmc.Plots([plot]) @@ -1030,11 +1214,10 @@ given below: tallies.export_to_xml() # Create voxel plot - plot = openmc.Plot() + plot = openmc.VoxelPlot() plot.origin = [0, 0, 0] plot.width = [2*pitch, 2*pitch, 1] plot.pixels = [1000, 1000, 1] - plot.type = 'voxel' # Instantiate a Plots collection and export to XML plots = openmc.Plots([plot]) diff --git a/docs/source/usersguide/scripts.rst b/docs/source/usersguide/scripts.rst index 0879d63ef..eb0abeb0d 100644 --- a/docs/source/usersguide/scripts.rst +++ b/docs/source/usersguide/scripts.rst @@ -48,6 +48,7 @@ flags: restart file -s, --threads N Run with *N* OpenMP threads -t, --track Write tracks for all particles (up to max_tracks) +-q, --verbosity V Set the output verbosity to *V* -v, --version Show version information -h, --help Show help message diff --git a/docs/source/usersguide/settings.rst b/docs/source/usersguide/settings.rst index 1b2d4bc1a..b9c693ba1 100644 --- a/docs/source/usersguide/settings.rst +++ b/docs/source/usersguide/settings.rst @@ -272,6 +272,12 @@ option:: settings.source = [src1, src2] settings.uniform_source_sampling = True +Additionally, sampling from an :class:`openmc.IndependentSource` may be biased +for local or global variance reduction by modifying the +:attr:`~openmc.IndependentSource.bias` attribute of each of its four main +distributions. Further discussion of source biasing can be found in +:ref:`source_biasing`. + Finally, the :attr:`IndependentSource.particle` attribute can be used to indicate the source should be composed of particles other than neutrons. For example, the following would generate a photon source:: @@ -756,6 +762,62 @@ instance, whereas the :meth:`openmc.Track.filter` method returns a new track_files = [f"tracks_p{rank}.h5" for rank in range(32)] openmc.Tracks.combine(track_files, "tracks.h5") +Collision Track File +--------------------- + +OpenMC can generate a collision track file that contains detailed collision +information (position, direction, energy, deposited energy, time, weight, cell +ID, material ID, universe ID, nuclide ZAID, particle type, particle delayed +group and particle ID) for each particle collision depending on user-defined +parameters. To invoke this feature, set the +:attr:`~openmc.Settings.collision_track` attribute as shown in this example:: + + settings.collision_track = { + "max_collisions": 300, + "reactions": ["(n,fission)", "(n,2n)"], + "material_ids": [1,2], + "nuclides": ["U238", "O16"], + "cell_ids": [5, 12] + } + +In this example, collision track information is written to the +collision_track.h5 file at the end of the simulation. The file contains +300 recorded collisions that occurred in materials with IDs 1 or 2, involving +fission or (n,2n) reactions on the nuclides U-238 or O-16, within cells +with IDs 5 and 12. +The file can be read using :func:`openmc.read_collision_track_file`. +The example below shows how to extract the data from the collision_track +feature and displays the fields stored in the file: + +>>> data = openmc.read_collision_track_file('collision_track.h5') +>>> data.dtype + dtype([('r', [('x', '`. ray solver. A high level overview of the current workflow for generation of weight windows with FW-CADIS using random ray is given below. -1. Produce approximate multigroup cross section data (stored in a ``mgxs.h5`` - library). There is more information on generating multigroup cross sections - via OpenMC in the :ref:`multigroup materials ` user guide, and a - specific example of generating cross section data for use with random ray in - the :ref:`random ray MGXS guide `. +1. Begin by making a deepy copy of your continuous energy Python model and then + convert the copy to be multigroup and use the random ray transport solver. + The conversion process can largely be automated as described in more detail + in the :ref:`random ray quick start guide `, summarized below:: -2. Make a copy of your continuous energy Python input file. You'll edit the new - file to work in multigroup mode with random ray for producing weight windows. + # Define continuous energy model + ce_model = openmc.pwr_pin_cell() # example, replace with your model -3. Adjust the material definitions in your new multigroup Python file to utilize - the multigroup cross sections instead of nuclide-wise continuous energy data. - There is a specific example of making this conversion in the :ref:`random ray - MGXS guide `. + # Make a copy to convert to multigroup and random ray + model = copy.deepcopy(ce_model) -4. Configure OpenMC to run in random ray mode (by adding several standard random - ray input flags and settings to the :attr:`openmc.Settings.random_ray` - dictionary). More information can be found in the :ref:`Random Ray User - Guide `. + # Convert model to multigroup (will auto-generate MGXS library if needed) + model.convert_to_multigroup() -5. Add in a :class:`~openmc.WeightWindowGenerator` in a similar manner as for + # Convert model to random ray and initialize random ray parameters + # to reasonable defaults based on the specifics of the geometry + model.convert_to_random_ray() + + # (Optional) Overlay source region decomposition mesh to improve fidelity of the + # random ray solver. Adjust 'n' for fidelity vs runtime. + n = 10 + mesh = openmc.RegularMesh() + mesh.dimension = (n, n, n) + mesh.lower_left = model.geometry.bounding_box.lower_left + mesh.upper_right = model.geometry.bounding_box.upper_right + model.settings.random_ray['source_region_meshes'] = [(mesh, [model.geometry.root_universe])] + + # (Optional) Improve fidelity of the random ray solver by enabling linear sources + model.settings.random_ray['source_shape'] = 'linear' + + # (Optional) Increase the number of rays/batch, to reduce uncertainty + model.settings.particles = 500 + + If you need to improve the fidelity of the MGXS library, there is more + information on generating multigroup cross sections via OpenMC in the + :ref:`random ray MGXS guide `. + +2. Add in a :class:`~openmc.WeightWindowGenerator` in a similar manner as for MAGIC generation with Monte Carlo and set the :attr:`method` attribute set to ``"fw_cadis"``:: - # Define weight window spatial mesh - ww_mesh = openmc.RegularMesh() - ww_mesh.dimension = (10, 10, 10) - ww_mesh.lower_left = (0.0, 0.0, 0.0) - ww_mesh.upper_right = (100.0, 100.0, 100.0) - - # Create weight window object and adjust parameters + # Create weight window object and adjust parameters, using the same mesh + # we used for source region decomposition wwg = openmc.WeightWindowGenerator( method='fw_cadis', - mesh=ww_mesh, - max_realizations=settings.batches + mesh=mesh ) # Add generator to openmc.settings object settings.weight_window_generators = wwg - .. warning:: If using FW-CADIS weight window generation, ensure that the selected weight window mesh does not subdivide any source regions in the problem. This can - be ensured by assigning the weight window tally mesh to the root universe so - as to create source region boundaries that conform to the mesh, as in the - example below. + be ensured by using the same mesh for both source region subdivision (i.e., + assigning to ``model.settings.random_ray['source_region_meshes']``) and for + weight window generation. -:: - - root = model.geometry.root_universe - settings.random_ray['source_region_meshes'] = [(ww_mesh, [root])] - -6. When running your multigroup random ray input deck, OpenMC will automatically +3. When running your multigroup random ray input deck, OpenMC will automatically run a forward solve followed by an adjoint solve, with a ``weight_windows.h5`` file generated at the end. The ``weight_windows.h5`` file will contain FW-CADIS generated weight windows. This file can be used in @@ -155,7 +163,7 @@ solver, the Python input just needs to load the h5 file:: settings.weight_window_checkpoints = {'collision': True, 'surface': True} settings.survival_biasing = False - settings.weight_windows = openmc.hdf5_to_wws('weight_windows.h5') + settings.weight_windows_file = "weight_windows.h5" settings.weight_windows_on = True The :class:`~openmc.WeightWindowGenerator` instance is not needed to load an @@ -166,3 +174,148 @@ Weight window mesh information is embedded into the weight window file, so the mesh does not need to be redefined. Monte Carlo solves that load a weight window file as above will utilize weight windows to reduce the variance of the simulation. + +.. _source_biasing: + +-------------- +Source Biasing +-------------- + +In fixed source problems, source biasing provides a means to reduce the variance +on global or localized responses, depending on the biasing scheme. In either +case, the premise of the method is to sample source sites from a biased +distribution that directs a larger fraction of the simulated histories towards +phase space regions of interest than would be found there under analog sampling. +In order to preserve an unbiased estimate of the tally mean, the weight of these +with analog sampling, divided by the probability assigned by the biased +distribution. While the assignment of statistical weights is outlined in the +:ref:`methods section `, this section demonstrates the +implementation of source biasing to problems in OpenMC. + +Source biasing in OpenMC is accomplished by applying a distribution to the +:attr:`bias` attribute of one or more of the univariate or independent +multivariate distributions which make up an :class:`~openmc.IndependentSource` +instance as follows:: + + # First create the biased distribution + biased_dist = openmc.stats.PowerLaw(a=0, b=3, n=3) + + # Construct a new distribution with the bias applied + dist = openmc.stats.PowerLaw(a=0, b=3, n=2, bias=biased_dist) + + # The bias attribute can also be set on an existing "analog" distribution: + sphere_dist = openmc.stats.spherical_uniform(r_outer=3) + sphere_dist.r.bias = biased_dist + +Univariate distributions may be sampled via the Python API, returning the +sample(s) along with the associated weight(s):: + + sample_vec, wgt_vec = dist.sample(n_samples=100) + +Here, if the distribution is unbiased, the weight of each sample will be unity. +Finally, :class:`~openmc.IndependentSource` instances can be constructed with +biased distributions:: + + # Create a source with a biased spatial distribution + source = openmc.IndependentSource(space=sphere_dist) + +During the simulation, source sites are then sampled using the biased +distributions where available and given starting statistical weights +corresponding to the cumulative product of the weights assigned by each +distribution in the source object. Hence multiple source variables (e.g., +direction and energy) may be biased and the resulting source sites will have +their weights adjusted accordingly. + +.. note:: + Combining source biasing with weight windows can be a powerful variance + reduction technique if each is constructed appropriately for the response + of interest. For example, if a source biasing scheme is devised for + variance reduction of a specific localized response, the user may be able + to specify their own weight window structure that results in more efficient + transport than if weight windows were generated by either of OpenMC's + automatic weight window generators, which are intended for global variance + reduction. + +Biased distributions that could result in degenerate weight mappings are not +recommended; this is most commonly seen when biasing the :math:`\phi`-coordinate +of spherical or cylindrical independent multivariate distributions. In such +cases degenerate behavior will be observed at the pole about which :math:`\phi` +is measured, with all values of :math:`\phi` (hence many possible statistical +weights) mapping to the same point for :math:`r=0` or :math:`\mu=0`, and large +weight gradients in the vicinity. In most cases requiring a spherical +independent source, it would be preferable to reorient the reference vector of +the distribution such that biasing could be applied to the +:math:`\mu`-coordinate instead. + +When biasing a distribution, care should also be taken to ensure that both the +unbiased and biased distribution share a common support---that is, every region +of phase space mapped to a nonzero probability density by the unbiased +distribution should likewise map to nonzero probability under the biased +distribution, and vice versa. In OpenMC, this places restrictions on the set of +compatible distributions that may be used to bias sampling of each distribution +type. The following table summarizes the method for each distribution in OpenMC +that permits biased sampling. + +.. list-table:: **Distributions that support biased sampling** + :header-rows: 1 + :widths: 35 65 + + * - Discrete Univariate PDFs + - Biasing Method + * - :class:`openmc.stats.Discrete` + - Apply a vector of alternative probabilities to the :attr:`bias` + attribute + +.. list-table:: + :header-rows: 1 + :widths: 35 65 + + * - Continuous Univariate PDFs + - Biasing Method + * - :class:`openmc.stats.Uniform`, + :class:`openmc.stats.PowerLaw`, + :class:`openmc.stats.Maxwell`, + :class:`openmc.stats.Watt`, + :class:`openmc.stats.Normal`, + :class:`openmc.stats.Tabular` + - Apply a second, unbiased continous univariate PDF to the :attr:`bias` + attribute, ensuring that the :attr:`support` attribute of each + distribution is the same + +.. list-table:: + :header-rows: 1 + :widths: 35 65 + + * - Mixed Univariate PDFs + - Biasing Method + * - :class:`openmc.stats.Mixture` + - May be constructed from multiple biased univariate distributions, or a + second, unbiased continous univariate PDF may be applied to the + :attr:`bias` attribute + +.. list-table:: + :header-rows: 1 + :widths: 35 65 + + * - Discrete Multivariate PDFs + - Biasing Method + * - :class:`openmc.stats.PointCloud`, + :class:`openmc.stats.MeshSpatial` + - Apply a vector of the new relative probabilities of each point or mesh + element under biased sampling to the :attr:`bias` attribute + +.. list-table:: + :header-rows: 1 + :widths: 35 65 + + * - Continuous Multivariate PDFs + - Biasing Method + * - :class:`openmc.stats.CartesianIndependent`, + :class:`openmc.stats.CylindricalIndependent`, + :class:`openmc.stats.SphericalIndependent`, + :class:`openmc.stats.PolarAzimuthal` + - Construct from biased univariate distributions for :attr:`x`, :attr:`y`, + :attr:`z`, etc. + * - :class:`openmc.stats.Isotropic` + - Apply an unbiased :class:`openmc.stats.PolarAzimuthal` to the + :attr:`bias` attribute diff --git a/examples/lattice/hexagonal/build_xml.py b/examples/lattice/hexagonal/build_xml.py index 9485d0aa4..2624e52b4 100644 --- a/examples/lattice/hexagonal/build_xml.py +++ b/examples/lattice/hexagonal/build_xml.py @@ -128,14 +128,14 @@ settings_file.export_to_xml() # Exporting to OpenMC plots.xml file ############################################################################### -plot_xy = openmc.Plot(plot_id=1) +plot_xy = openmc.SlicePlot(plot_id=1) plot_xy.filename = 'plot_xy' plot_xy.origin = [0, 0, 0] plot_xy.width = [6, 6] plot_xy.pixels = [400, 400] plot_xy.color_by = 'material' -plot_yz = openmc.Plot(plot_id=2) +plot_yz = openmc.SlicePlot(plot_id=2) plot_yz.filename = 'plot_yz' plot_yz.basis = 'yz' plot_yz.origin = [0, 0, 0] diff --git a/examples/lattice/nested/build_xml.py b/examples/lattice/nested/build_xml.py index 2db23a46b..a1d9c092d 100644 --- a/examples/lattice/nested/build_xml.py +++ b/examples/lattice/nested/build_xml.py @@ -135,7 +135,7 @@ settings_file.export_to_xml() # Exporting to OpenMC plots.xml file ############################################################################### -plot = openmc.Plot(plot_id=1) +plot = openmc.SlicePlot(plot_id=1) plot.origin = [0, 0, 0] plot.width = [4, 4] plot.pixels = [400, 400] diff --git a/examples/lattice/simple/build_xml.py b/examples/lattice/simple/build_xml.py index 56c466121..44531edd8 100644 --- a/examples/lattice/simple/build_xml.py +++ b/examples/lattice/simple/build_xml.py @@ -128,7 +128,7 @@ settings_file.export_to_xml() # Exporting to OpenMC plots.xml file ############################################################################### -plot = openmc.Plot(plot_id=1) +plot = openmc.SlicePlot(plot_id=1) plot.origin = [0, 0, 0] plot.width = [4, 4] plot.pixels = [400, 400] diff --git a/examples/pincell_pulsed/run_pulse.py b/examples/pincell_pulsed/run_pulse.py new file mode 100644 index 000000000..b6a61ad3d --- /dev/null +++ b/examples/pincell_pulsed/run_pulse.py @@ -0,0 +1,101 @@ +import matplotlib.pyplot as plt +import numpy as np +import openmc + +############################################################################### +# Create materials for the problem + +uo2 = openmc.Material(name="UO2 fuel at 2.4% wt enrichment") +uo2.set_density("g/cm3", 10.29769) +uo2.add_element("U", 1.0, enrichment=2.4) +uo2.add_element("O", 2.0) + +helium = openmc.Material(name="Helium for gap") +helium.set_density("g/cm3", 0.001598) +helium.add_element("He", 2.4044e-4) + +zircaloy = openmc.Material(name="Zircaloy 4") +zircaloy.set_density("g/cm3", 6.55) +zircaloy.add_element("Sn", 0.014, "wo") +zircaloy.add_element("Fe", 0.00165, "wo") +zircaloy.add_element("Cr", 0.001, "wo") +zircaloy.add_element("Zr", 0.98335, "wo") + +borated_water = openmc.Material(name="Borated water") +borated_water.set_density("g/cm3", 0.740582) +borated_water.add_element("B", 2.0e-4) # 3x the original pincell +borated_water.add_element("H", 5.0e-2) +borated_water.add_element("O", 2.4e-2) +borated_water.add_s_alpha_beta("c_H_in_H2O") + +############################################################################### +# Define problem geometry + +# Create cylindrical surfaces +fuel_or = openmc.ZCylinder(r=0.39218, name="Fuel OR") +clad_ir = openmc.ZCylinder(r=0.40005, name="Clad IR") +clad_or = openmc.ZCylinder(r=0.45720, name="Clad OR") + +# Create a region represented as the inside of a rectangular prism +pitch = 1.25984 +box = openmc.model.RectangularPrism(pitch, pitch, boundary_type="reflective") + +# Create cells, mapping materials to regions +fuel = openmc.Cell(fill=uo2, region=-fuel_or) +gap = openmc.Cell(fill=helium, region=+fuel_or & -clad_ir) +clad = openmc.Cell(fill=zircaloy, region=+clad_ir & -clad_or) +water = openmc.Cell(fill=borated_water, region=+clad_or & -box) + +# Create a model and assign geometry +model = openmc.Model() +model.geometry = openmc.Geometry([fuel, gap, clad, water]) + +############################################################################### +# Define problem settings + +# Set the mode +model.settings.run_mode = "fixed source" + +# Indicate how many batches and particles to run +model.settings.batches = 10 +model.settings.particles = 10000 + +# Set time cutoff (we only care about t < 100 seconds, see tally below) +model.settings.cutoff = {"time_neutron": 100} + +# Create the neutron pulse source (by default, isotropic direction, t=0) +space = openmc.stats.Point() # At the origin (0, 0, 0) +energy = openmc.stats.delta_function(14.1e6) # At 14.1 MeV +model.settings.source = openmc.IndependentSource(space=space, energy=energy) + +############################################################################### +# Define tallies + +# Create time filter +t_grid = np.insert(np.logspace(-6, 2, 100), 0, 0.0) +time_filter = openmc.TimeFilter(t_grid) + +# Tally for total neutron density in time +density_tally = openmc.Tally(name="Density") +density_tally.filters = [time_filter] +density_tally.scores = ["inverse-velocity"] + +# Add tallies to model +model.tallies = openmc.Tallies([density_tally]) + + +# Run the model +model.run(apply_tally_results=True) + +# Bin-averaged result +density_mean = density_tally.mean.ravel() / np.diff(t_grid) + +# Plot particle density versus time +fig, ax = plt.subplots() +ax.stairs(density_mean, t_grid) +ax.set_xscale("log") +ax.set_yscale("log") +ax.set_xlabel("Time [s]") +ax.set_ylabel("Total density") +ax.grid() +plt.show() diff --git a/examples/pincell_random_ray/build_xml.py b/examples/pincell_random_ray/build_xml.py index b3dd8020a..5ff4c0082 100644 --- a/examples/pincell_random_ray/build_xml.py +++ b/examples/pincell_random_ray/build_xml.py @@ -192,11 +192,10 @@ tallies.export_to_xml() # Exporting to OpenMC plots.xml file ############################################################################### -plot = openmc.Plot() +plot = openmc.VoxelPlot() plot.origin = [0, 0, 0] plot.width = [pitch, pitch, pitch] plot.pixels = [1000, 1000, 1] -plot.type = 'voxel' # Instantiate a Plots collection and export to XML plots = openmc.Plots([plot]) diff --git a/include/openmc/bank.h b/include/openmc/bank.h index 95386514d..c4e940bc8 100644 --- a/include/openmc/bank.h +++ b/include/openmc/bank.h @@ -20,8 +20,18 @@ extern vector source_bank; extern SharedArray surf_source_bank; +extern SharedArray collision_track_bank; + extern SharedArray fission_bank; +extern vector> ifp_source_delayed_group_bank; + +extern vector> ifp_source_lifetime_bank; + +extern vector> ifp_fission_delayed_group_bank; + +extern vector> ifp_fission_lifetime_bank; + extern vector progeny_per_particle; } // namespace simulation diff --git a/include/openmc/bank_io.h b/include/openmc/bank_io.h new file mode 100644 index 000000000..418ec111f --- /dev/null +++ b/include/openmc/bank_io.h @@ -0,0 +1,105 @@ +#ifndef OPENMC_BANK_IO_H +#define OPENMC_BANK_IO_H + +#include "hdf5.h" + +#include "openmc/message_passing.h" +#include "openmc/span.h" +#include "openmc/vector.h" + +#include + +#ifdef OPENMC_MPI +#include +#endif + +namespace openmc { + +template +void write_bank_dataset( + const char* dataset_name, hid_t group_id, span bank, + const vector& bank_index, hid_t membanktype, hid_t filebanktype +#ifdef OPENMC_MPI + , + MPI_Datatype mpi_dtype +#endif +) +{ + int64_t dims_size = bank_index.back(); + int64_t count_size = bank_index[mpi::rank + 1] - bank_index[mpi::rank]; + +#ifdef PHDF5 + hsize_t dims[] {static_cast(dims_size)}; + hid_t dspace = H5Screate_simple(1, dims, nullptr); + hid_t dset = H5Dcreate(group_id, dataset_name, filebanktype, dspace, + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + hsize_t count[] {static_cast(count_size)}; + hid_t memspace = H5Screate_simple(1, count, nullptr); + + hsize_t start[] {static_cast(bank_index[mpi::rank])}; + H5Sselect_hyperslab(dspace, H5S_SELECT_SET, start, nullptr, count, nullptr); + + hid_t plist = H5Pcreate(H5P_DATASET_XFER); + H5Pset_dxpl_mpio(plist, H5FD_MPIO_COLLECTIVE); + + H5Dwrite(dset, membanktype, memspace, dspace, plist, bank.data()); + + H5Sclose(dspace); + H5Sclose(memspace); + H5Dclose(dset); + H5Pclose(plist); +#else + if (mpi::master) { + hsize_t dims[] {static_cast(dims_size)}; + hid_t dspace = H5Screate_simple(1, dims, nullptr); + hid_t dset = H5Dcreate(group_id, dataset_name, filebanktype, dspace, + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + +#ifdef OPENMC_MPI + vector temp_bank {bank.begin(), bank.end()}; +#endif + + for (int i = 0; i < mpi::n_procs; ++i) { + hsize_t count[] {static_cast(bank_index[i + 1] - bank_index[i])}; + hid_t memspace = H5Screate_simple(1, count, nullptr); + +#ifdef OPENMC_MPI + if (i > 0) { + MPI_Recv(bank.data(), count[0], mpi_dtype, i, i, mpi::intracomm, + MPI_STATUS_IGNORE); + } +#endif + + hid_t dspace_rank = H5Dget_space(dset); + hsize_t start[] {static_cast(bank_index[i])}; + H5Sselect_hyperslab( + dspace_rank, H5S_SELECT_SET, start, nullptr, count, nullptr); + + H5Dwrite( + dset, membanktype, memspace, dspace_rank, H5P_DEFAULT, bank.data()); + + H5Sclose(memspace); + H5Sclose(dspace_rank); + } + + H5Dclose(dset); + +#ifdef OPENMC_MPI + std::copy(temp_bank.begin(), temp_bank.end(), bank.begin()); +#endif + } +#ifdef OPENMC_MPI + else { + if (!bank.empty()) { + MPI_Send( + bank.data(), bank.size(), mpi_dtype, 0, mpi::rank, mpi::intracomm); + } + } +#endif +#endif +} + +} // namespace openmc + +#endif // OPENMC_BANK_IO_H diff --git a/include/openmc/boundary_condition.h b/include/openmc/boundary_condition.h index cd8988162..89bf7ca8b 100644 --- a/include/openmc/boundary_condition.h +++ b/include/openmc/boundary_condition.h @@ -111,6 +111,10 @@ public: std::string type() const override { return "periodic"; } + int i_surf() const { return i_surf_; } + + int j_surf() const { return j_surf_; } + protected: int i_surf_; int j_surf_; @@ -134,18 +138,28 @@ protected: //============================================================================== //! A BC that rotates particles about a global axis. // -//! Currently only rotations about the z-axis are supported. +//! Only rotations about the x, y, and z axes are supported. //============================================================================== class RotationalPeriodicBC : public PeriodicBC { public: - RotationalPeriodicBC(int i_surf, int j_surf); - + enum PeriodicAxis { x, y, z }; + RotationalPeriodicBC(int i_surf, int j_surf, PeriodicAxis axis); + double compute_periodic_rotation( + double rise_1, double run_1, double rise_2, double run_2) const; void handle_particle(Particle& p, const Surface& surf) const override; protected: //! Angle about the axis by which particle coordinates will be rotated double angle_; + //! Do we need to flip surfaces senses when applying the transformation? + bool flip_sense_; + //! Ensure that choice of axes is right handed. axis_1_idx_ corresponds to the + //! independent axis and axis_2_idx_ corresponds to the dependent axis in the + //! 2D plane perpendicular to the planes' axis of rotation + int zero_axis_idx_; + int axis_1_idx_; + int axis_2_idx_; }; } // namespace openmc diff --git a/include/openmc/bounding_box.h b/include/openmc/bounding_box.h index d02d92cb4..4fabe1b70 100644 --- a/include/openmc/bounding_box.h +++ b/include/openmc/bounding_box.h @@ -13,12 +13,19 @@ namespace openmc { //============================================================================== struct BoundingBox { - double xmin = -INFTY; - double xmax = INFTY; - double ymin = -INFTY; - double ymax = INFTY; - double zmin = -INFTY; - double zmax = INFTY; + Position min = {-INFTY, -INFTY, -INFTY}; + Position max = {INFTY, INFTY, INFTY}; + + // Constructors + BoundingBox() = default; + BoundingBox(Position min_, Position max_) : min {min_}, max {max_} {} + + // Static factory methods + static BoundingBox infinite() { return {}; } + static BoundingBox inverted() + { + return {{INFTY, INFTY, INFTY}, {-INFTY, -INFTY, -INFTY}}; + } inline BoundingBox operator&(const BoundingBox& other) { @@ -35,29 +42,26 @@ struct BoundingBox { // intersect operator inline BoundingBox& operator&=(const BoundingBox& other) { - xmin = std::max(xmin, other.xmin); - xmax = std::min(xmax, other.xmax); - ymin = std::max(ymin, other.ymin); - ymax = std::min(ymax, other.ymax); - zmin = std::max(zmin, other.zmin); - zmax = std::min(zmax, other.zmax); + min.x = std::max(min.x, other.min.x); + min.y = std::max(min.y, other.min.y); + min.z = std::max(min.z, other.min.z); + max.x = std::min(max.x, other.max.x); + max.y = std::min(max.y, other.max.y); + max.z = std::min(max.z, other.max.z); return *this; } // union operator inline BoundingBox& operator|=(const BoundingBox& other) { - xmin = std::min(xmin, other.xmin); - xmax = std::max(xmax, other.xmax); - ymin = std::min(ymin, other.ymin); - ymax = std::max(ymax, other.ymax); - zmin = std::min(zmin, other.zmin); - zmax = std::max(zmax, other.zmax); + min.x = std::min(min.x, other.min.x); + min.y = std::min(min.y, other.min.y); + min.z = std::min(min.z, other.min.z); + max.x = std::max(max.x, other.max.x); + max.y = std::max(max.y, other.max.y); + max.z = std::max(max.z, other.max.z); return *this; } - - inline Position min() const { return {xmin, ymin, zmin}; } - inline Position max() const { return {xmax, ymax, zmax}; } }; } // namespace openmc diff --git a/include/openmc/capi.h b/include/openmc/capi.h index 54257d093..d8041ef41 100644 --- a/include/openmc/capi.h +++ b/include/openmc/capi.h @@ -17,6 +17,8 @@ int openmc_cell_get_fill( int openmc_cell_get_id(int32_t index, int32_t* id); int openmc_cell_get_temperature( int32_t index, const int32_t* instance, double* T); +int openmc_cell_get_density( + int32_t index, const int32_t* instance, double* rho); int openmc_cell_get_translation(int32_t index, double xyz[]); int openmc_cell_get_rotation(int32_t index, double rot[], size_t* n); int openmc_cell_get_name(int32_t index, const char** name); @@ -27,6 +29,8 @@ int openmc_cell_set_fill( int openmc_cell_set_id(int32_t index, int32_t id); int openmc_cell_set_temperature( int32_t index, double T, const int32_t* instance, bool set_contained = false); +int openmc_cell_set_density(int32_t index, double rho, const int32_t* instance, + bool set_contained = false); int openmc_cell_set_translation(int32_t index, const double xyz[]); int openmc_cell_set_rotation(int32_t index, const double rot[], size_t rot_len); int openmc_dagmc_universe_get_cell_ids( diff --git a/include/openmc/cell.h b/include/openmc/cell.h index 98709fb33..9dfe2339a 100644 --- a/include/openmc/cell.h +++ b/include/openmc/cell.h @@ -216,6 +216,18 @@ public: //! \return Temperature in [K] double temperature(int32_t instance = -1) const; + //! Get the density multiplier of a cell instance + //! \param[in] instance Instance index. If -1 is given, the density multiplier + //! for the first instance is returned. + //! \return Density multiplier + double density_mult(int32_t instance = -1) const; + + //! Get the density of a cell instance in g/cm3 + //! \param[in] instance Instance index. If -1 is given, the density + //! for the first instance is returned. + //! \return Density in [g/cm3] + double density(int32_t instance = -1) const; + //! Set the temperature of a cell instance //! \param[in] T Temperature in [K] //! \param[in] instance Instance index. If -1 is given, the temperature for @@ -226,6 +238,18 @@ public: void set_temperature( double T, int32_t instance = -1, bool set_contained = false); + //! Set the density of a cell instance + //! \param[in] density Density [g/cm3] + //! \param[in] instance Instance index. If -1 is given, the density + //! for all instances is set. + //! \param[in] set_contained If this cell is not filled with a material, + //! collect all contained cells with material fills and set their + //! densities. + void set_density( + double density, int32_t instance = -1, bool set_contained = false); + + int32_t n_instances() const; + //! Set the rotation matrix of a cell instance //! \param[in] rot The rotation matrix of length 3 or 9 void set_rotation(const vector& rot); @@ -312,12 +336,11 @@ public: //---------------------------------------------------------------------------- // Data members - int32_t id_; //!< Unique ID - std::string name_; //!< User-defined name - Fill type_; //!< Material, universe, or lattice - int32_t universe_; //!< Universe # this cell is in - int32_t fill_; //!< Universe # filling this cell - int32_t n_instances_ {0}; //!< Number of instances of this cell + int32_t id_; //!< Unique ID + std::string name_; //!< User-defined name + Fill type_; //!< Material, universe, or lattice + int32_t universe_; //!< Universe # this cell is in + int32_t fill_; //!< Universe # filling this cell //! \brief Index corresponding to this cell in distribcell arrays int distribcell_index_ {C_NONE}; @@ -333,6 +356,9 @@ public: //! T. The units are sqrt(eV). vector sqrtkT_; + //! \brief Unitless density multiplier(s) within this cell. + vector density_mult_; + //! \brief Neighboring cells in the same universe. NeighborList neighbors_; diff --git a/include/openmc/collision_track.h b/include/openmc/collision_track.h new file mode 100644 index 000000000..208b8f6e1 --- /dev/null +++ b/include/openmc/collision_track.h @@ -0,0 +1,23 @@ +#ifndef OPENMC_COLLISION_TRACK_H +#define OPENMC_COLLISION_TRACK_H + +#include + +namespace openmc { + +class Particle; + +//! Reserve space in the collision track bank according to user settings. +void collision_track_reserve_bank(); + +//! Write collision track data to disk when the bank is full or the batch ends. +void collision_track_flush_bank(); + +//! Record the current particle as a collision-track entry when applicable. +//! +//! \param particle Particle whose collision should be recorded if eligible +void collision_track_record(Particle& particle); + +} // namespace openmc + +#endif // OPENMC_COLLISION_TRACK_H diff --git a/include/openmc/constants.h b/include/openmc/constants.h index 2a7ce1990..bba260c3a 100644 --- a/include/openmc/constants.h +++ b/include/openmc/constants.h @@ -28,12 +28,13 @@ constexpr int HDF5_VERSION[] {3, 0}; constexpr array VERSION_STATEPOINT {18, 1}; constexpr array VERSION_PARTICLE_RESTART {2, 0}; constexpr array VERSION_TRACK {3, 0}; -constexpr array VERSION_SUMMARY {6, 0}; +constexpr array VERSION_SUMMARY {6, 1}; constexpr array VERSION_VOLUME {1, 0}; constexpr array VERSION_VOXEL {2, 0}; constexpr array VERSION_MGXS_LIBRARY {1, 0}; -constexpr array VERSION_PROPERTIES {1, 0}; +constexpr array VERSION_PROPERTIES {1, 1}; constexpr array VERSION_WEIGHT_WINDOWS {1, 0}; +constexpr array VERSION_COLLISION_TRACK {1, 0}; // ============================================================================ // ADJUSTABLE PARAMETERS @@ -63,6 +64,16 @@ constexpr int MAX_SAMPLE {100000}; // source region in the random ray solver constexpr double MIN_HITS_PER_BATCH {1.5}; +// The minimum flux value to be considered non-zero when computing adjoint +// sources. Positive values below this cutoff will be treated as zero, so as to +// prevent extremely large adjoint source terms from being generated. +constexpr double ZERO_FLUX_CUTOFF {1e-22}; + +// The minimum macroscopic cross section value considered non-void for the +// random ray solver. Materials with any group with a cross section below this +// value will be converted to pure void. +constexpr double MINIMUM_MACRO_XS {1e-6}; + // ============================================================================ // MATH AND PHYSICAL CONSTANTS @@ -281,7 +292,7 @@ enum class MgxsType { // ============================================================================ // TALLY-RELATED CONSTANTS -enum class TallyResult { VALUE, SUM, SUM_SQ, SIZE }; +enum class TallyResult { VALUE, SUM, SUM_SQ, SUM_THIRD, SUM_FOURTH }; enum class TallyType { VOLUME, MESH_SURFACE, SURFACE, PULSE_HEIGHT }; @@ -312,7 +323,10 @@ enum TallyScore { SCORE_FISS_Q_PROMPT = -14, // prompt fission Q-value SCORE_FISS_Q_RECOV = -15, // recoverable fission Q-value SCORE_DECAY_RATE = -16, // delayed neutron precursor decay rate - SCORE_PULSE_HEIGHT = -17 // pulse-height + SCORE_PULSE_HEIGHT = -17, // pulse-height + SCORE_IFP_TIME_NUM = -18, // IFP lifetime numerator + SCORE_IFP_BETA_NUM = -19, // IFP delayed fraction numerator + SCORE_IFP_DENOM = -20 // IFP common denominator }; // Global tally parameters @@ -322,6 +336,9 @@ enum class GlobalTally { K_COLLISION, K_ABSORPTION, K_TRACKLENGTH, LEAKAGE }; // Miscellaneous constexpr int C_NONE {-1}; +// Default value of generation for IFP +constexpr int DEFAULT_IFP_N_GENERATION {10}; + // Interpolation rules enum class Interpolation { histogram = 1, diff --git a/include/openmc/dagmc.h b/include/openmc/dagmc.h index 82ef1b644..0e27402a1 100644 --- a/include/openmc/dagmc.h +++ b/include/openmc/dagmc.h @@ -20,7 +20,7 @@ void check_dagmc_root_univ(); } // namespace openmc -#ifdef DAGMC +#ifdef OPENMC_DAGMC_ENABLED #include "DagMC.hpp" #include "dagmcmetadata.hpp" @@ -216,6 +216,6 @@ int32_t next_cell(int32_t surf, int32_t curr_cell, int32_t univ); } // namespace openmc -#endif // DAGMC +#endif // OPENMC_DAGMC_ENABLED #endif // OPENMC_DAGMC_H diff --git a/include/openmc/distribution.h b/include/openmc/distribution.h index 854cf7d77..80fe70bae 100644 --- a/include/openmc/distribution.h +++ b/include/openmc/distribution.h @@ -15,6 +15,17 @@ namespace openmc { +//============================================================================== +// Helper function for computing importance weights from biased sampling +//============================================================================== + +//! Compute importance weights for biased sampling +//! \param p Unnormalized original probability vector +//! \param b Unnormalized bias probability vector +//! \return Vector of importance weights (p_norm[i] / b_norm[i]) +vector compute_importance_weights( + const vector& p, const vector& b); + //============================================================================== //! Abstract class representing a univariate probability distribution //============================================================================== @@ -22,11 +33,41 @@ namespace openmc { class Distribution { public: virtual ~Distribution() = default; - virtual double sample(uint64_t* seed) const = 0; + + //! Sample a value from the distribution, handling biasing automatically + //! \param seed Pseudorandom number seed pointer + //! \return (sampled value, importance weight) + virtual std::pair sample(uint64_t* seed) const; + + //! Evaluate probability density, f(x), at a point + //! \param x Point to evaluate f(x) + //! \return f(x) + virtual double evaluate(double x) const; //! Return integral of distribution //! \return Integral of distribution virtual double integral() const { return 1.0; }; + + //! Set bias distribution + virtual void set_bias(std::unique_ptr bias) + { + bias_ = std::move(bias); + } + + const Distribution* bias() const { return bias_.get(); } + +protected: + //! Sample a value (unbiased) from the distribution + //! \param seed Pseudorandom number seed pointer + //! \return Sampled value + virtual double sample_unbiased(uint64_t* seed) const = 0; + + //! Read bias distribution from XML + //! \param node XML node that may contain a bias child element + void read_bias_from_xml(pugi::xml_node node); + + // Biasing distribution + unique_ptr bias_; }; using UPtrDist = unique_ptr; @@ -50,7 +91,7 @@ public: //! Sample a value from the distribution //! \param seed Pseudorandom number seed pointer - //! \return Sampled value + //! \return Sampled index size_t sample(uint64_t* seed) const; // Properties @@ -67,7 +108,7 @@ private: //! Normalize distribution so that probabilities sum to unity void normalize(); - //! Initialize alias tables for distribution + //! Initialize alias table for sampling void init_alias(); }; @@ -82,20 +123,30 @@ public: //! Sample a value from the distribution //! \param seed Pseudorandom number seed pointer - //! \return Sampled value - double sample(uint64_t* seed) const override; + //! \return (sampled value, sample weight) + std::pair sample(uint64_t* seed) const override; double integral() const override { return di_.integral(); }; + //! Override set_bias as no-op (bias handled in constructor) + void set_bias(std::unique_ptr bias) override {} + // Properties const vector& x() const { return x_; } const vector& prob() const { return di_.prob(); } const vector& alias() const { return di_.alias(); } + const vector& weight() const { return weight_; } + +protected: + //! Sample a value (unbiased) from the distribution + //! \param seed Pseudorandom number seed pointer + //! \return Sampled value + double sample_unbiased(uint64_t* seed) const override; private: - vector x_; //!< Possible outcomes - DiscreteIndex di_; //!< discrete probability distribution of - //!< outcome indices + vector x_; //!< Possible outcomes + vector weight_; //!< Importance weights (empty if unbiased) + DiscreteIndex di_; //!< Discrete probability distribution of outcome indices }; //============================================================================== @@ -107,14 +158,20 @@ public: explicit Uniform(pugi::xml_node node); Uniform(double a, double b) : a_ {a}, b_ {b} {}; - //! Sample a value from the distribution - //! \param seed Pseudorandom number seed pointer - //! \return Sampled value - double sample(uint64_t* seed) const override; + //! Evaluate probability density, f(x), at a point + //! \param x Point to evaluate f(x) + //! \return f(x) + double evaluate(double x) const override; double a() const { return a_; } double b() const { return b_; } +protected: + //! Sample a value (unbiased) from the distribution + //! \param seed Pseudorandom number seed pointer + //! \return Sampled value + double sample_unbiased(uint64_t* seed) const override; + private: double a_; //!< Lower bound of distribution double b_; //!< Upper bound of distribution @@ -131,15 +188,21 @@ public: : offset_ {std::pow(a, n + 1)}, span_ {std::pow(b, n + 1) - offset_}, ninv_ {1 / (n + 1)} {}; - //! Sample a value from the distribution - //! \param seed Pseudorandom number seed pointer - //! \return Sampled value - double sample(uint64_t* seed) const override; + //! Evaluate probability density, f(x), at a point + //! \param x Point to evaluate f(x) + //! \return f(x) + double evaluate(double x) const override; double a() const { return std::pow(offset_, ninv_); } double b() const { return std::pow(offset_ + span_, ninv_); } double n() const { return 1 / ninv_ - 1; } +protected: + //! Sample a value (unbiased) from the distribution + //! \param seed Pseudorandom number seed pointer + //! \return Sampled value + double sample_unbiased(uint64_t* seed) const override; + private: //! Store processed values in object to allow for faster sampling double offset_; //!< a^(n+1) @@ -156,13 +219,19 @@ public: explicit Maxwell(pugi::xml_node node); Maxwell(double theta) : theta_ {theta} {}; - //! Sample a value from the distribution - //! \param seed Pseudorandom number seed pointer - //! \return Sampled value - double sample(uint64_t* seed) const override; + //! Evaluate probability density, f(x), at a point + //! \param x Point to evaluate f(x) + //! \return f(x) + double evaluate(double x) const override; double theta() const { return theta_; } +protected: + //! Sample a value (unbiased) from the distribution + //! \param seed Pseudorandom number seed pointer + //! \return Sampled value + double sample_unbiased(uint64_t* seed) const override; + private: double theta_; //!< Factor in exponential [eV] }; @@ -176,14 +245,20 @@ public: explicit Watt(pugi::xml_node node); Watt(double a, double b) : a_ {a}, b_ {b} {}; - //! Sample a value from the distribution - //! \param seed Pseudorandom number seed pointer - //! \return Sampled value - double sample(uint64_t* seed) const override; + //! Evaluate probability density, f(x), at a point + //! \param x Point to evaluate f(x) + //! \return f(x) + double evaluate(double x) const override; double a() const { return a_; } double b() const { return b_; } +protected: + //! Sample a value (unbiased) from the distribution + //! \param seed Pseudorandom number seed pointer + //! \return Sampled value + double sample_unbiased(uint64_t* seed) const override; + private: double a_; //!< Factor in exponential [eV] double b_; //!< Factor in square root [1/eV] @@ -200,14 +275,20 @@ public: Normal(double mean_value, double std_dev) : mean_value_ {mean_value}, std_dev_ {std_dev} {}; - //! Sample a value from the distribution - //! \param seed Pseudorandom number seed pointer - //! \return Sampled value - double sample(uint64_t* seed) const override; + //! Evaluate probability density, f(x), at a point + //! \param x Point to evaluate f(x) + //! \return f(x) + double evaluate(double x) const override; double mean_value() const { return mean_value_; } double std_dev() const { return std_dev_; } +protected: + //! Sample a value (unbiased) from the distribution + //! \param seed Pseudorandom number seed pointer + //! \return Sampled value + double sample_unbiased(uint64_t* seed) const override; + private: double mean_value_; //!< middle of distribution [eV] double std_dev_; //!< standard deviation [eV] @@ -223,10 +304,10 @@ public: Tabular(const double* x, const double* p, int n, Interpolation interp, const double* c = nullptr); - //! Sample a value from the distribution - //! \param seed Pseudorandom number seed pointer - //! \return Sampled value - double sample(uint64_t* seed) const override; + //! Evaluate probability density, f(x), at a point + //! \param x Point to evaluate f(x) + //! \return f(x) + double evaluate(double x) const override; // properties vector& x() { return x_; } @@ -235,6 +316,12 @@ public: Interpolation interp() const { return interp_; } double integral() const override { return integral_; }; +protected: + //! Sample a value (unbiased) from the distribution + //! \param seed Pseudorandom number seed pointer + //! \return Sampled value + double sample_unbiased(uint64_t* seed) const override; + private: vector x_; //!< tabulated independent variable vector p_; //!< tabulated probability density @@ -259,13 +346,19 @@ public: explicit Equiprobable(pugi::xml_node node); Equiprobable(const double* x, int n) : x_ {x, x + n} {}; - //! Sample a value from the distribution - //! \param seed Pseudorandom number seed pointer - //! \return Sampled value - double sample(uint64_t* seed) const override; + //! Evaluate probability density, f(x), at a point + //! \param x Point to evaluate f(x) + //! \return f(x) + double evaluate(double x) const override; const vector& x() const { return x_; } +protected: + //! Sample a value (unbiased) from the distribution + //! \param seed Pseudorandom number seed pointer + //! \return Sampled value + double sample_unbiased(uint64_t* seed) const override; + private: vector x_; //! Possible outcomes }; @@ -280,18 +373,25 @@ public: //! Sample a value from the distribution //! \param seed Pseudorandom number seed pointer - //! \return Sampled value - double sample(uint64_t* seed) const override; + //! \return (sampled value, sample weight) + std::pair sample(uint64_t* seed) const override; double integral() const override { return integral_; } -private: - // Storrage for probability + distribution - using DistPair = std::pair; + //! Override set_bias as no-op (bias handled in constructor) + void set_bias(std::unique_ptr bias) override {} - vector - distribution_; //!< sub-distributions + cummulative probabilities - double integral_; //!< integral of distribution +protected: + //! Sample a value (unbiased) from the distribution + //! \param seed Pseudorandom number seed pointer + //! \return Sampled value + double sample_unbiased(uint64_t* seed) const override; + +private: + vector distribution_; //!< Sub-distributions + vector weight_; //!< Importance weights for component selection + DiscreteIndex di_; //!< Discrete probability distribution of indices + double integral_; //!< Integral of distribution }; } // namespace openmc diff --git a/include/openmc/distribution_multi.h b/include/openmc/distribution_multi.h index 9e84d03d5..7b9c2abf8 100644 --- a/include/openmc/distribution_multi.h +++ b/include/openmc/distribution_multi.h @@ -26,8 +26,8 @@ public: //! Sample a direction from the distribution //! \param seed Pseudorandom number seed pointer - //! \return Direction sampled - virtual Direction sample(uint64_t* seed) const = 0; + //! \return (sampled Direction, sample weight) + virtual std::pair sample(uint64_t* seed) const = 0; Direction u_ref_ {0.0, 0.0, 1.0}; //!< reference direction }; @@ -43,14 +43,30 @@ public: //! Sample a direction from the distribution //! \param seed Pseudorandom number seed pointer - //! \return Direction sampled - Direction sample(uint64_t* seed) const override; + //! \return (sampled Direction, sample weight) + std::pair sample(uint64_t* seed) const override; + + //! Sample a direction and return evaluation of the PDF for biased sampling. + //! Note that bias distributions are intended to return unit-weight samples. + //! \param seed Pseudorandom number seed points + //! \return (sampled Direction, value of the PDF at this Direction) + std::pair sample_as_bias(uint64_t* seed) const; // Observing pointers Distribution* mu() const { return mu_.get(); } Distribution* phi() const { return phi_.get(); } private: + //! Common sampling implementation + //! \param seed Pseudorandom number seed pointer + //! \param return_pdf If true, return PDF evaluation; if false, return + //! importance weight + //! \return (sampled Direction, weight or PDF value) + std::pair sample_impl( + uint64_t* seed, bool return_pdf) const; + + Direction v_ref_ {1.0, 0.0, 0.0}; //!< reference direction + Direction w_ref_; UPtrDist mu_; //!< Distribution of polar angle UPtrDist phi_; //!< Distribution of azimuthal angle }; @@ -64,11 +80,24 @@ Direction isotropic_direction(uint64_t* seed); class Isotropic : public UnitSphereDistribution { public: Isotropic() {}; + explicit Isotropic(pugi::xml_node node); //! Sample a direction from the distribution //! \param seed Pseudorandom number seed pointer - //! \return Sampled direction - Direction sample(uint64_t* seed) const override; + //! \return (sampled direction, sample weight) + std::pair sample(uint64_t* seed) const override; + + // Set or get bias distribution + void set_bias(std::unique_ptr bias) + { + bias_ = std::move(bias); + } + + const PolarAzimuthal* bias() const { return bias_.get(); } + +protected: + // Biasing distribution + unique_ptr bias_; }; //============================================================================== @@ -83,8 +112,8 @@ public: //! Sample a direction from the distribution //! \param seed Pseudorandom number seed pointer - //! \return Sampled direction - Direction sample(uint64_t* seed) const override; + //! \return (sampled direction, sample weight) + std::pair sample(uint64_t* seed) const override; }; using UPtrAngle = unique_ptr; diff --git a/include/openmc/distribution_spatial.h b/include/openmc/distribution_spatial.h index 9c3bc743f..26f106fca 100644 --- a/include/openmc/distribution_spatial.h +++ b/include/openmc/distribution_spatial.h @@ -19,7 +19,9 @@ public: virtual ~SpatialDistribution() = default; //! Sample a position from the distribution - virtual Position sample(uint64_t* seed) const = 0; + //! \param seed Pseudorandom number seed pointer + //! \return Sampled (position, importance weight) + virtual std::pair sample(uint64_t* seed) const = 0; static unique_ptr create(pugi::xml_node node); }; @@ -34,8 +36,8 @@ public: //! Sample a position from the distribution //! \param seed Pseudorandom number seed pointer - //! \return Sampled position - Position sample(uint64_t* seed) const override; + //! \return Sampled (position, importance weight) + std::pair sample(uint64_t* seed) const override; // Observer pointers Distribution* x() const { return x_.get(); } @@ -58,8 +60,8 @@ public: //! Sample a position from the distribution //! \param seed Pseudorandom number seed pointer - //! \return Sampled position - Position sample(uint64_t* seed) const override; + //! \return Sampled (position, importance weight) + std::pair sample(uint64_t* seed) const override; Distribution* r() const { return r_.get(); } Distribution* phi() const { return phi_.get(); } @@ -83,8 +85,8 @@ public: //! Sample a position from the distribution //! \param seed Pseudorandom number seed pointer - //! \return Sampled position - Position sample(uint64_t* seed) const override; + //! \return Sampled (position, importance weight) + std::pair sample(uint64_t* seed) const override; Distribution* r() const { return r_.get(); } Distribution* cos_theta() const { return cos_theta_.get(); } @@ -109,8 +111,8 @@ public: //! Sample a position from the distribution //! \param seed Pseudorandom number seed pointer - //! \return Sampled position - Position sample(uint64_t* seed) const override; + //! \return Sampled (position, importance weight) + std::pair sample(uint64_t* seed) const override; //! Sample the mesh for an element and position within that element //! \param seed Pseudorandom number seed pointer @@ -133,8 +135,8 @@ public: private: int32_t mesh_idx_ {C_NONE}; - DiscreteIndex elem_idx_dist_; //!< Distribution of - //!< mesh element indices + DiscreteIndex elem_idx_dist_; //!< Distribution of mesh element indices + vector weight_; //!< Importance weights (empty if unbiased) }; //============================================================================== @@ -149,12 +151,13 @@ public: //! Sample a position from the distribution //! \param seed Pseudorandom number seed pointer - //! \return Sampled position - Position sample(uint64_t* seed) const override; + //! \return Sampled (position, importance weight) + std::pair sample(uint64_t* seed) const override; private: std::vector point_cloud_; DiscreteIndex point_idx_dist_; //!< Distribution of Position indices + vector weight_; //!< Importance weights (empty if unbiased) }; //============================================================================== @@ -167,8 +170,8 @@ public: //! Sample a position from the distribution //! \param seed Pseudorandom number seed pointer - //! \return Sampled position - Position sample(uint64_t* seed) const override; + //! \return Sampled (position, importance weight) + std::pair sample(uint64_t* seed) const override; // Properties bool only_fissionable() const { return only_fissionable_; } @@ -193,8 +196,8 @@ public: //! Sample a position from the distribution //! \param seed Pseudorandom number seed pointer - //! \return Sampled position - Position sample(uint64_t* seed) const override; + //! \return Sampled (position, importance weight) + std::pair sample(uint64_t* seed) const override; Position r() const { return r_; } diff --git a/include/openmc/geometry_aux.h b/include/openmc/geometry_aux.h index 0c870c9fb..4dafdea5c 100644 --- a/include/openmc/geometry_aux.h +++ b/include/openmc/geometry_aux.h @@ -15,8 +15,6 @@ namespace openmc { namespace model { -extern std::unordered_map> - universe_cell_counts; extern std::unordered_map universe_level_counts; } // namespace model @@ -39,6 +37,12 @@ void adjust_indices(); void assign_temperatures(); +//============================================================================== +//! Finalize densities (compute density multipliers). +//============================================================================== + +void finalize_cell_densities(); + //============================================================================== //! \brief Obtain a list of temperatures that each nuclide/thermal scattering //! table appears at in the model. Later, this list is used to determine the @@ -80,15 +84,13 @@ void prepare_distribcell( const std::vector* user_distribcells = nullptr); //============================================================================== -//! Recursively search through the geometry and count cell instances. +//! Recursively search through the geometry and count universe instances. //! -//! This function will update the Cell::n_instances value for each cell in the -//! geometry. -//! \param univ_indx The index of the universe to begin searching from (probably -//! the root universe). +//! This function will update Universe.n_instances_ for each +//! universe in the geometry. //============================================================================== -void count_cell_instances(int32_t univ_indx); +void count_universe_instances(); //============================================================================== //! Recursively search through universes and count universe instances. diff --git a/include/openmc/hdf5_interface.h b/include/openmc/hdf5_interface.h index 0092c08f8..28b0d2b11 100644 --- a/include/openmc/hdf5_interface.h +++ b/include/openmc/hdf5_interface.h @@ -100,8 +100,8 @@ void read_llong(hid_t obj_id, const char* name, long long* buffer, bool indep); void read_string( hid_t obj_id, const char* name, size_t slen, char* buffer, bool indep); -void read_tally_results( - hid_t group_id, hsize_t n_filter, hsize_t n_score, double* results); +void read_tally_results(hid_t group_id, hsize_t n_filter, hsize_t n_score, + hsize_t n_results, double* results); void write_attr_double(hid_t obj_id, int ndim, const hsize_t* dims, const char* name, const double* buffer); void write_attr_int(hid_t obj_id, int ndim, const hsize_t* dims, @@ -114,9 +114,9 @@ void write_int(hid_t group_id, int ndim, const hsize_t* dims, const char* name, void write_llong(hid_t group_id, int ndim, const hsize_t* dims, const char* name, const long long* buffer, bool indep); void write_string(hid_t group_id, int ndim, const hsize_t* dims, size_t slen, - const char* name, char const* buffer, bool indep); -void write_tally_results( - hid_t group_id, hsize_t n_filter, hsize_t n_score, const double* results); + const char* name, const char* buffer, bool indep); +void write_tally_results(hid_t group_id, hsize_t n_filter, hsize_t n_score, + hsize_t n_results, const double* results); } // extern "C" //============================================================================== diff --git a/include/openmc/ifp.h b/include/openmc/ifp.h new file mode 100644 index 000000000..01904d13c --- /dev/null +++ b/include/openmc/ifp.h @@ -0,0 +1,187 @@ +#ifndef OPENMC_IFP_H +#define OPENMC_IFP_H + +#include "openmc/message_passing.h" +#include "openmc/particle.h" +#include "openmc/particle_data.h" +#include "openmc/settings.h" + +namespace openmc { + +//! Check the value of the IFP parameter for beta effective or both. +//! +//! \return true if "BetaEffective" or "Both", false otherwise. +bool is_beta_effective_or_both(); + +//! Check the value of the IFP parameter for generation time or both. +//! +//! \return true if "GenerationTime" or "Both", false otherwise. +bool is_generation_time_or_both(); + +//! Resize IFP vectors +//! +//! \param[in,out] delayed_groups List of delayed group numbers +//! \param[in,out] lifetimes List of lifetimes +//! \param[in] n Dimension to resize vectors +template +void resize_ifp_data(vector& delayed_groups, vector& lifetimes, int64_t n) +{ + if (is_beta_effective_or_both()) { + delayed_groups.resize(n); + } + if (is_generation_time_or_both()) { + lifetimes.resize(n); + } +} + +//! Update a list of values by adding a new value if the size +//! of the list can accomodate the new value or by shifting all +//! values to the left (removing the first value of the list +//! and adding the new value at the end of the list). +//! +//! \param[in] value Value to add to the list +//! \param[in] data Initial version of the list +//! \return Updated list +template +vector _ifp(const T& value, const vector& data) +{ + vector updated; + size_t source_idx = data.size(); + + if (source_idx < settings::ifp_n_generation) { + updated.resize(source_idx + 1); + for (size_t i = 0; i < source_idx; i++) { + updated[i] = data[i]; + } + updated[source_idx] = value; + } else if (source_idx == settings::ifp_n_generation) { + updated.resize(source_idx); + for (size_t i = 0; i < source_idx - 1; i++) { + updated[i] = data[i + 1]; + } + updated[source_idx - 1] = value; + } + return updated; +} + +//! \brief Iterated Fission Probability (IFP) method. +//! +//! Add the IFP information in the IFP banks using the same index +//! as the one used to append the fission site to the fission bank. +//! The information stored are the delayed group number and lifetime +//! of the neutron that created the fission event. +//! Multithreading protection is guaranteed by the index returned by the +//! thread_safe_append call in physics.cpp. +//! +//! \param[in] p Particle +//! \param[in] idx Bank index from the thread_safe_append call in physics.cpp +void ifp(const Particle& p, int64_t idx); + +//! Resize the IFP banks used in the simulation +void resize_simulation_ifp_banks(); + +//! Retrieve IFP data from the IFP fission banks. +//! +//! \param[in] i_bank Index in the fission banks +//! \param[in,out] delayed_groups Delayed group numbers +//! \param[in,out] lifetimes Lifetimes lists +void copy_ifp_data_from_fission_banks( + int i_bank, vector& delayed_groups, vector& lifetimes); + +#ifdef OPENMC_MPI + +//! Deserialization information for transfer of IFP data using MPI +struct DeserializationInfo { + int64_t index_local; //!< local index + int64_t n; //!< number of sites sent +}; + +//! Broadcast the number of generation determined by the size of the first +//! element on the first processor. +//! +//! \param[in] n_generation Number of generations +//! \param[in] delayed_groups List of delayed group numbers lists +//! \param[in] lifetimes List of lifetimes lists +void broadcast_ifp_n_generation(int& n_generation, + const vector>& delayed_groups, + const vector>& lifetimes); + +//! Send IFP data using MPI. +//! +//! \param[in] idx Index of the first site +//! \param[in] n Number of sites to send +//! \param[in] n_generation Number of generations +//! \param[in] neighbor Index of the neighboring processor +//! \param[in] requests MPI requests +//! \param[in] delayed_groups List of delayed group numbers lists +//! \param[out] send_delayed_groups Delayed group numbers buffer +//! \param[in] lifetimes List of lifetimes lists +//! \param[out] send_lifetimes Lifetimes buffer +void send_ifp_info(int64_t idx, int64_t n, int n_generation, int neighbor, + vector& requests, const vector>& delayed_groups, + vector& send_delayed_groups, const vector>& lifetimes, + vector& send_lifetimes); + +//! Receive IFP data using MPI. +//! +//! \param[in] idx Index of the first site +//! \param[in] n Number of sites to receive +//! \param[in] n_generation Number of generations +//! \param[in] neighbor Index of the neighboring processor +//! \param[in] requests MPI requests +//! \param[in] delayed_groups List of delayed group numbers +//! \param[in] lifetimes List of lifetimes +//! \param[out] deserialization Information to deserialize the received data +void receive_ifp_data(int64_t idx, int64_t n, int n_generation, int neighbor, + vector& requests, vector& delayed_groups, + vector& lifetimes, vector& deserialization); + +//! Copy partial IFP data from local lists to source banks. +//! +//! \param[in] idx Index of the first site +//! \param[in] n Number of sites to copy +//! \param[in] i_bank Index in the IFP source banks +//! \param[in] delayed_groups List of delayed group numbers lists +//! \param[in] lifetimes List of lifetimes lists +void copy_partial_ifp_data_to_source_banks(int64_t idx, int n, int64_t i_bank, + const vector>& delayed_groups, + const vector>& lifetimes); + +//! Deserialize IFP information received using MPI and store it in +//! the IFP source banks. +//! +//! \param[in] n_generation Number of generations +//! \param[out] deserialization Information to deserialize the received data +//! \param[in] delayed_groups List of delayed group numbers +//! \param[in] lifetimes List of lifetimes +void deserialize_ifp_info(int n_generation, + const vector& deserialization, + const vector& delayed_groups, const vector& lifetimes); + +#endif + +//! Copy IFP temporary vectors to source banks. +//! +//! \param[in] delayed_groups List of delayed group numbers lists +//! \param[in] lifetimes List of lifetimes lists +void copy_complete_ifp_data_to_source_banks( + const vector>& delayed_groups, + const vector>& lifetimes); + +//! Allocate temporary vectors for IFP data. +//! +//! \param[in,out] delayed_groups List of delayed group numbers lists +//! \param[in,out] lifetimes List of delayed group numbers lists +void allocate_temporary_vector_ifp( + vector>& delayed_groups, vector>& lifetimes); + +//! Copy local IFP data to IFP fission banks. +//! +//! \param[in] delayed_groups_ptr Pointer to delayed group numbers +//! \param[in] lifetimes_ptr Pointer to lifetimes +void copy_ifp_data_to_fission_banks( + const vector* delayed_groups_ptr, const vector* lifetimes_ptr); + +} // namespace openmc + +#endif // OPENMC_IFP_H diff --git a/include/openmc/lattice.h b/include/openmc/lattice.h index fb374ab75..f87d28b21 100644 --- a/include/openmc/lattice.h +++ b/include/openmc/lattice.h @@ -76,7 +76,7 @@ public: } //! Populate the distribcell offset tables. - int32_t fill_offset_table(int32_t offset, int32_t target_univ_id, int map, + int32_t fill_offset_table(int32_t target_univ_id, int map, std::unordered_map& univ_count_memo); //! \brief Check lattice indices. diff --git a/include/openmc/material.h b/include/openmc/material.h index 31fab2ae2..e36946c71 100644 --- a/include/openmc/material.h +++ b/include/openmc/material.h @@ -99,6 +99,13 @@ public: //---------------------------------------------------------------------------- // Accessors + //! Get the atom density in [atom/b-cm] + //! \return Density in [atom/b-cm] + double atom_density(int32_t i, double rho_multiplier = 1.0) const + { + return atom_density_(i) * rho_multiplier; + } + //! Get density in [atom/b-cm] //! \return Density in [atom/b-cm] double density() const { return density_; } @@ -107,6 +114,10 @@ public: //! \return Density in [g/cm^3] double density_gpcc() const { return density_gpcc_; } + //! Get charge density in [e/b-cm] + //! \return Charge density in [e/b-cm] + double charge_density() const { return charge_density_; }; + //! Get name //! \return Material name const std::string& name() const { return name_; } @@ -177,6 +188,7 @@ public: xt::xtensor atom_density_; //!< Nuclide atom density in [atom/b-cm] double density_; //!< Total atom density in [atom/b-cm] double density_gpcc_; //!< Total atom density in [g/cm^3] + double charge_density_; //!< Total charge density in [e/b-cm] double volume_ {-1.0}; //!< Volume in [cm^3] vector p0_; //!< Indicate which nuclides are to be treated with //!< iso-in-lab scattering diff --git a/include/openmc/math_functions.h b/include/openmc/math_functions.h index c30ef7558..0d960c33d 100644 --- a/include/openmc/math_functions.h +++ b/include/openmc/math_functions.h @@ -9,6 +9,7 @@ #include #include "openmc/position.h" +#include "openmc/search.h" namespace openmc { @@ -200,5 +201,15 @@ std::complex faddeeva(std::complex z); //! \return Derivative of Faddeeva function evaluated at z std::complex w_derivative(std::complex z, int order); +//! Helper function to get index and interpolation function on an incident +//! energy grid +//! +//! \param energies energy grid +//! \param E incident energy +//! \param i grid index +//! \param f interpolation factor +void get_energy_index( + const vector& energies, double E, int& i, double& f); + } // namespace openmc #endif // OPENMC_MATH_FUNCTIONS_H diff --git a/include/openmc/mcpl_interface.h b/include/openmc/mcpl_interface.h index e5c182280..a9cce3e69 100644 --- a/include/openmc/mcpl_interface.h +++ b/include/openmc/mcpl_interface.h @@ -9,12 +9,6 @@ namespace openmc { -//============================================================================== -// Constants -//============================================================================== - -extern "C" const bool MCPL_ENABLED; - //============================================================================== // Functions //============================================================================== @@ -25,18 +19,46 @@ extern "C" const bool MCPL_ENABLED; //! \return Vector of source sites vector mcpl_source_sites(std::string path); -//! Write an MCPL source file -// +//! Write an MCPL source file with stat:sum metadata +//! +//! This function writes particle data to an MCPL file. For MCPL >= 2.1.0, +//! it includes a stat:sum field (key: "openmc_np1") containing the total +//! number of source particles, which is essential for proper file merging +//! and weight normalization when using MCPL files with McStas/McXtrace. +//! +//! The stat:sum field follows the crash-safety pattern: +//! - Initially set to -1 when opening (indicates incomplete file) +//! - Updated with actual particle count before closing +//! //! \param[in] filename Path to MCPL file //! \param[in] source_bank Vector of SourceSites to write to file for this -//! MPI rank. Note that this can't be const due to -//! it being used as work space by MPI. -//! \param[in] bank_indx Pointer to vector of site index ranges over all -//! MPI ranks. This can be computed by calling -//! calculate_parallel_index_vector on -//! source_bank.size(). +//! MPI rank. +//! \param[in] bank_index Pointer to vector of site index ranges over all +//! MPI ranks. void write_mcpl_source_point(const char* filename, span source_bank, const vector& bank_index); + +//! Write an MCPL collision track file +//! +//! This function writes collision track data to an MCPL file. Additional +//! collision-specific metadata (such as energy deposition, material info, etc.) +//! is stored in the file header as blob data. +//! +//! \param[in] filename Path to MCPL file +//! \param[in] collision_track_bank Vector of CollisionTrackSites to write to +//! file for this MPI rank. +//! \param[in] bank_index Pointer to vector of site index ranges over all +//! MPI ranks. +void write_mcpl_collision_track(const char* filename, + span collision_track_bank, + const vector& bank_index); + +//! Check if MCPL functionality is available +bool is_mcpl_interface_available(); + +//! Initialize the MCPL interface +void initialize_mcpl_interface_if_needed(); + } // namespace openmc #endif // OPENMC_MCPL_INTERFACE_H diff --git a/include/openmc/mesh.h b/include/openmc/mesh.h index 8faf45f1b..7ceb623da 100644 --- a/include/openmc/mesh.h +++ b/include/openmc/mesh.h @@ -19,14 +19,14 @@ #include "openmc/vector.h" #include "openmc/xml_interface.h" -#ifdef DAGMC +#ifdef OPENMC_DAGMC_ENABLED #include "moab/AdaptiveKDTree.hpp" #include "moab/Core.hpp" #include "moab/GeomUtil.hpp" #include "moab/Matrix3.hpp" #endif -#ifdef LIBMESH +#ifdef OPENMC_LIBMESH_ENABLED #include "libmesh/bounding_box.h" #include "libmesh/dof_map.h" #include "libmesh/elem.h" @@ -61,7 +61,7 @@ extern vector> meshes; } // namespace model -#ifdef LIBMESH +#ifdef OPENMC_LIBMESH_ENABLED namespace settings { // used when creating new libMesh::MeshBase instances extern unique_ptr libmesh_init; @@ -132,15 +132,18 @@ public: // Constructors and destructor Mesh() = default; Mesh(pugi::xml_node node); + Mesh(hid_t group); virtual ~Mesh() = default; + // Factory method for creating meshes from either an XML node or HDF5 group + template + static const std::unique_ptr& create( + T dataset, const std::string& mesh_type, const std::string& mesh_library); + // Methods //! Perform any preparation needed to support point location within the mesh virtual void prepare_for_point_location() {}; - //! Update a position to the local coordinates of the mesh - virtual void local_coords(Position& r) const {}; - //! Return a position in the local coordinates of the mesh virtual Position local_coords(const Position& r) const { return r; }; @@ -241,9 +244,7 @@ public: //! \return Bounding box of mesh BoundingBox bounding_box() const { - auto ll = this->lower_left(); - auto ur = this->upper_right(); - return {ll.x, ur.x, ll.y, ur.y, ll.z, ur.z}; + return {this->lower_left(), this->upper_right()}; } virtual Position lower_left() const = 0; @@ -261,6 +262,7 @@ class StructuredMesh : public Mesh { public: StructuredMesh() = default; StructuredMesh(pugi::xml_node node) : Mesh {node} {}; + StructuredMesh(hid_t group) : Mesh {group} {}; virtual ~StructuredMesh() = default; using MeshIndex = std::array; @@ -426,8 +428,7 @@ class PeriodicStructuredMesh : public StructuredMesh { public: PeriodicStructuredMesh() = default; PeriodicStructuredMesh(pugi::xml_node node) : StructuredMesh {node} {}; - - void local_coords(Position& r) const override { r -= origin_; }; + PeriodicStructuredMesh(hid_t group) : StructuredMesh {group} {}; Position local_coords(const Position& r) const override { @@ -447,6 +448,7 @@ public: // Constructors RegularMesh() = default; RegularMesh(pugi::xml_node node); + RegularMesh(hid_t group); // Overridden methods int get_index_in_direction(double r, int i) const override; @@ -486,6 +488,8 @@ public: //! Return the volume for a given mesh index double volume(const MeshIndex& ijk) const override; + int set_grid(); + // Data members double volume_frac_; //!< Volume fraction of each mesh element double element_volume_; //!< Volume of each mesh element @@ -497,6 +501,7 @@ public: // Constructors RectilinearMesh() = default; RectilinearMesh(pugi::xml_node node); + RectilinearMesh(hid_t group); // Overridden methods int get_index_in_direction(double r, int i) const override; @@ -539,6 +544,7 @@ public: // Constructors CylindricalMesh() = default; CylindricalMesh(pugi::xml_node node); + CylindricalMesh(hid_t group); // Overridden methods virtual MeshIndex get_indices(Position r, bool& in_mesh) const override; @@ -603,6 +609,7 @@ public: // Constructors SphericalMesh() = default; SphericalMesh(pugi::xml_node node); + SphericalMesh(hid_t group); // Overridden methods virtual MeshIndex get_indices(Position r, bool& in_mesh) const override; @@ -671,9 +678,9 @@ class UnstructuredMesh : public Mesh { public: // Constructors - UnstructuredMesh() {}; + UnstructuredMesh() { n_dimension_ = 3; }; UnstructuredMesh(pugi::xml_node node); - UnstructuredMesh(const std::string& filename); + UnstructuredMesh(hid_t group); static const std::string mesh_type; virtual std::string get_mesh_type() const override; @@ -773,13 +780,14 @@ private: virtual void initialize() = 0; }; -#ifdef DAGMC +#ifdef OPENMC_DAGMC_ENABLED class MOABMesh : public UnstructuredMesh { public: // Constructors MOABMesh() = default; MOABMesh(pugi::xml_node); + MOABMesh(hid_t group); MOABMesh(const std::string& filename, double length_multiplier = 1.0); MOABMesh(std::shared_ptr external_mbi); @@ -943,12 +951,13 @@ private: #endif -#ifdef LIBMESH +#ifdef OPENMC_LIBMESH_ENABLED class LibMesh : public UnstructuredMesh { public: // Constructors LibMesh(pugi::xml_node node); + LibMesh(hid_t group); LibMesh(const std::string& filename, double length_multiplier = 1.0); LibMesh(libMesh::MeshBase& input_mesh, double length_multiplier = 1.0); @@ -996,25 +1005,26 @@ public: libMesh::MeshBase* mesh_ptr() const { return m_; }; +protected: + // Methods + + //! Translate a bin value to an element reference + virtual const libMesh::Elem& get_element_from_bin(int bin) const; + + //! Translate an element pointer to a bin index + virtual int get_bin_from_element(const libMesh::Elem* elem) const; + + libMesh::MeshBase* m_; //!< pointer to libMesh MeshBase instance, always set + //!< during intialization private: void initialize() override; void set_mesh_pointer_from_filename(const std::string& filename); void build_eqn_sys(); - // Methods - - //! Translate a bin value to an element reference - const libMesh::Elem& get_element_from_bin(int bin) const; - - //! Translate an element pointer to a bin index - int get_bin_from_element(const libMesh::Elem* elem) const; - // Data members unique_ptr unique_m_ = nullptr; //!< pointer to the libMesh MeshBase instance, only used if mesh is //!< created inside OpenMC - libMesh::MeshBase* m_; //!< pointer to libMesh MeshBase instance, always set - //!< during intialization vector> pl_; //!< per-thread point locators unique_ptr @@ -1028,8 +1038,34 @@ private: libMesh::BoundingBox bbox_; //!< bounding box of the mesh libMesh::dof_id_type first_element_id_; //!< id of the first element in the mesh +}; + +class AdaptiveLibMesh : public LibMesh { +public: + // Constructor + AdaptiveLibMesh( + libMesh::MeshBase& input_mesh, double length_multiplier = 1.0); + + // Overridden methods + int n_bins() const override; + + void add_score(const std::string& var_name) override; + + void set_score_data(const std::string& var_name, const vector& values, + const vector& std_dev) override; + + void write(const std::string& filename) const override; + +protected: + // Overridden methods + int get_bin_from_element(const libMesh::Elem* elem) const override; + + const libMesh::Elem& get_element_from_bin(int bin) const override; + +private: + // Data members + const libMesh::dof_id_type num_active_; //!< cached number of active elements - const bool adaptive_; //!< whether this mesh has adaptivity enabled or not std::vector bin_to_elem_map_; //!< mapping bin indices to dof indices for active //!< elements @@ -1048,6 +1084,11 @@ private: //! \param[in] root XML node void read_meshes(pugi::xml_node root); +//! Read meshes from an HDF5 file +// +//! \param[in] group HDF5 group ("meshes" group) +void read_meshes(hid_t group); + //! Write mesh data to an HDF5 group // //! \param[in] group HDF5 group diff --git a/include/openmc/message_passing.h b/include/openmc/message_passing.h index a1641a906..ce993776b 100644 --- a/include/openmc/message_passing.h +++ b/include/openmc/message_passing.h @@ -18,6 +18,7 @@ extern bool master; #ifdef OPENMC_MPI extern MPI_Datatype source_site; +extern MPI_Datatype collision_track_site; extern MPI_Comm intracomm; #endif diff --git a/include/openmc/nuclide.h b/include/openmc/nuclide.h index 329c776d0..60b88a153 100644 --- a/include/openmc/nuclide.h +++ b/include/openmc/nuclide.h @@ -164,8 +164,8 @@ namespace data { // Minimum/maximum transport energy for each particle type. Order corresponds to // that of the ParticleType enum -extern array energy_min; -extern array energy_max; +extern array energy_min; +extern array energy_max; //! Minimum temperature in [K] that nuclide data is available at extern double temperature_min; diff --git a/include/openmc/particle_data.h b/include/openmc/particle_data.h index 15ae57893..fdacfa765 100644 --- a/include/openmc/particle_data.h +++ b/include/openmc/particle_data.h @@ -8,7 +8,7 @@ #include "openmc/tallies/filter_match.h" #include "openmc/vector.h" -#ifdef DAGMC +#ifdef OPENMC_DAGMC_ENABLED #include "DagMC.hpp" #endif @@ -47,7 +47,7 @@ struct SourceSite { double time {0.0}; double wgt {1.0}; int delayed_group {0}; - int surf_id {0}; + int surf_id {SURFACE_NONE}; ParticleType particle; // Extra attributes that don't show up in source written to file @@ -56,6 +56,25 @@ struct SourceSite { int64_t progeny_id; }; +struct CollisionTrackSite { + Position r; + Direction u; + double E; + double dE; + double time {0.0}; + double wgt {1.0}; + int event_mt {0}; + int delayed_group {0}; + int cell_id {0}; + int nuclide_id; + int material_id {0}; + int universe_id {0}; + int n_collision {0}; + ParticleType particle; + int64_t parent_id; + int64_t progeny_id; +}; + //! State of a particle used for particle track files struct TrackState { Position r; //!< Position in [cm] @@ -88,13 +107,37 @@ public: //! clear data from a single coordinate level void reset(); - Position r; //!< particle position - Direction u; //!< particle direction - int cell {-1}; - int universe {-1}; - int lattice {-1}; - array lattice_i {{-1, -1, -1}}; - bool rotated {false}; //!< Is the level rotated? + // accessors + Position& r() { return r_; } + const Position& r() const { return r_; } + + Direction& u() { return u_; } + const Direction& u() const { return u_; } + + int& cell() { return cell_; } + const int& cell() const { return cell_; } + + int& universe() { return universe_; } + const int& universe() const { return universe_; } + + int& lattice() { return lattice_; } + int lattice() const { return lattice_; } + + array& lattice_index() { return lattice_index_; } + const array& lattice_index() const { return lattice_index_; } + + bool& rotated() { return rotated_; } + const bool& rotated() const { return rotated_; } + +private: + // Data members + Position r_; //!< particle position + Direction u_; //!< particle direction + int cell_ {-1}; + int universe_ {-1}; + int lattice_ {-1}; + array lattice_index_ {{-1, -1, -1}}; + bool rotated_ {false}; //!< Is the level rotated? }; //============================================================================== @@ -130,9 +173,10 @@ struct NuclideMicroXS { // Energy and temperature last used to evaluate these cross sections. If // these values have changed, then the cross sections must be re-evaluated. - double last_E {0.0}; //!< Last evaluated energy - double last_sqrtkT {0.0}; //!< Last temperature in sqrt(Boltzmann constant - //!< * temperature (eV)) + double last_E {0.0}; //!< Last evaluated energy + double last_sqrtkT {0.0}; //!< Last temperature in sqrt(Boltzmann constant + //!< * temperature (eV)) + double ncrystal_xs {-1.0}; //!< NCrystal cross section }; //============================================================================== @@ -186,23 +230,41 @@ struct CacheDataMG { // Information about nearest boundary crossing //============================================================================== -struct BoundaryInfo { - double distance {INFINITY}; //!< distance to nearest boundary - int surface { - SURFACE_NONE}; //!< surface token, non-zero if boundary is surface - int coord_level; //!< coordinate level after crossing boundary - array - lattice_translation {}; //!< which way lattice indices will change - +class BoundaryInfo { +public: void reset() { - distance = INFINITY; - surface = SURFACE_NONE; - coord_level = 0; - lattice_translation = {0, 0, 0}; + distance_ = INFINITY; + surface_ = SURFACE_NONE; + coord_level_ = 0; + lattice_translation_ = {0, 0, 0}; } + double& distance() { return distance_; } + const double& distance() const { return distance_; } + + int& surface() { return surface_; } + const int& surface() const { return surface_; } + + int coord_level() const { return coord_level_; } + int& coord_level() { return coord_level_; } + + array& lattice_translation() { return lattice_translation_; } + const array& lattice_translation() const + { + return lattice_translation_; + } + // TODO: off-by-one - int surface_index() const { return std::abs(surface) - 1; } + int surface_index() const { return std::abs(surface()) - 1; } + +private: + // Data members + double distance_ {INFINITY}; //!< distance to nearest boundary + int surface_ { + SURFACE_NONE}; //!< surface token, non-zero if boundary is surface + int coord_level_ {0}; //!< coordinate level after crossing boundary + array lattice_translation_ { + 0, 0, 0}; //!< which way lattice indices will change }; /* @@ -301,20 +363,20 @@ public: const Position& u_last() const { return u_last_; } // Accessors for position in global coordinates - Position& r() { return coord_[0].r; } - const Position& r() const { return coord_[0].r; } + Position& r() { return coord_[0].r(); } + const Position& r() const { return coord_[0].r(); } // Accessors for position in local coordinates - Position& r_local() { return coord_[n_coord_ - 1].r; } - const Position& r_local() const { return coord_[n_coord_ - 1].r; } + Position& r_local() { return coord_[n_coord_ - 1].r(); } + const Position& r_local() const { return coord_[n_coord_ - 1].r(); } // Accessors for direction in global coordinates - Direction& u() { return coord_[0].u; } - const Direction& u() const { return coord_[0].u; } + Direction& u() { return coord_[0].u(); } + const Direction& u() const { return coord_[0].u(); } // Accessors for direction in local coordinates - Direction& u_local() { return coord_[n_coord_ - 1].u; } - const Direction& u_local() const { return coord_[n_coord_ - 1].u; } + Direction& u_local() { return coord_[n_coord_ - 1].u(); } + const Direction& u_local() const { return coord_[n_coord_ - 1].u(); } // Surface token for the surface that the particle is currently on int& surface() { return surface_; } @@ -330,7 +392,7 @@ public: // Boundary information BoundaryInfo& boundary() { return boundary_; } -#ifdef DAGMC +#ifdef OPENMC_DAGMC_ENABLED // DagMC state variables moab::DagMC::RayHistory& history() { return history_; } Direction& last_dir() { return last_dir_; } @@ -347,6 +409,11 @@ public: const double& sqrtkT() const { return sqrtkT_; } double& sqrtkT_last() { return sqrtkT_last_; } + // density multiplier of the current and last cell + double& density_mult() { return density_mult_; } + const double& density_mult() const { return density_mult_; } + double& density_mult_last() { return density_mult_last_; } + private: int64_t id_ {-1}; //!< Unique ID @@ -375,7 +442,10 @@ private: double sqrtkT_ {-1.0}; //!< sqrt(k_Boltzmann * temperature) in eV double sqrtkT_last_ {0.0}; //!< last temperature -#ifdef DAGMC + double density_mult_ {1.0}; //!< density multiplier + double density_mult_last_ {1.0}; //!< last density multiplier + +#ifdef OPENMC_DAGMC_ENABLED moab::DagMC::RayHistory history_; Direction last_dir_; #endif @@ -435,6 +505,7 @@ private: double wgt_ {1.0}; double wgt_born_ {1.0}; + double wgt_ww_born_ {-1.0}; double mu_; double time_ {0.0}; double time_last_ {0.0}; @@ -454,6 +525,9 @@ private: int cell_born_ {-1}; + // Iterated Fission Probability + double lifetime_ {0.0}; //!< neutron lifetime [s] + int n_collision_ {0}; bool write_track_ {false}; @@ -542,6 +616,10 @@ public: double& wgt_born() { return wgt_born_; } double wgt_born() const { return wgt_born_; } + // Weight window value at birth + double& wgt_ww_born() { return wgt_ww_born_; } + const double& wgt_ww_born() const { return wgt_ww_born_; } + // Statistic weight of particle at last collision double& wgt_last() { return wgt_last_; } const double& wgt_last() const { return wgt_last_; } @@ -560,14 +638,20 @@ public: double& time_last() { return time_last_; } const double& time_last() const { return time_last_; } + // Particle lifetime + double& lifetime() { return lifetime_; } + const double& lifetime() const { return lifetime_; } + // What event took place, described in greater detail below TallyEvent& event() { return event_; } const TallyEvent& event() const { return event_; } bool& fission() { return fission_; } // true if implicit fission int& event_nuclide() { return event_nuclide_; } // index of collision nuclide const int& event_nuclide() const { return event_nuclide_; } - int& event_mt() { return event_mt_; } // MT number of collision + int& event_mt() { return event_mt_; } // MT number of collision + const int& event_mt() const { return event_mt_; } int& delayed_group() { return delayed_group_; } // delayed group + const int& delayed_group() const { return delayed_group_; } const int& parent_nuclide() const { return parent_nuclide_; } int& parent_nuclide() { return parent_nuclide_; } // Parent nuclide diff --git a/include/openmc/photon.h b/include/openmc/photon.h index 1fee6c9f5..f6f28a4df 100644 --- a/include/openmc/photon.h +++ b/include/openmc/photon.h @@ -33,7 +33,6 @@ public: int index_subshell; //!< index in SUBSHELLS int threshold; - double n_electrons; double binding_energy; vector transitions; }; @@ -90,6 +89,11 @@ public: xt::xtensor binding_energy_; xt::xtensor electron_pdf_; + // Map subshells from Compton profile data obtained from Biggs et al, + // "Hartree-Fock Compton profiles for the elements" to ENDF/B atomic + // relaxation data + xt::xtensor subshell_map_; + // Stopping power data double I_; // mean excitation energy xt::xtensor n_electrons_; diff --git a/include/openmc/physics.h b/include/openmc/physics.h index f62f43a02..2472d9799 100644 --- a/include/openmc/physics.h +++ b/include/openmc/physics.h @@ -10,13 +10,6 @@ namespace openmc { -//============================================================================== -// Constants -//============================================================================== - -// Monoatomic ideal-gas scattering treatment threshold -constexpr double FREE_GAS_THRESHOLD {400.0}; - //============================================================================== // Non-member functions //============================================================================== diff --git a/include/openmc/plot.h b/include/openmc/plot.h index 69e801c5f..7e27679ea 100644 --- a/include/openmc/plot.h +++ b/include/openmc/plot.h @@ -223,7 +223,7 @@ T SlicePlotBase::get_map() const GeometryState p; p.r() = xyz; p.u() = dir; - p.coord(0).universe = model::root_universe; + p.coord(0).universe() = model::root_universe; int level = slice_level_; int j {}; diff --git a/include/openmc/random_ray/flat_source_domain.h b/include/openmc/random_ray/flat_source_domain.h index 39d87d663..4df4e5d8d 100644 --- a/include/openmc/random_ray/flat_source_domain.h +++ b/include/openmc/random_ray/flat_source_domain.h @@ -27,21 +27,22 @@ public: //---------------------------------------------------------------------------- // Methods - virtual void update_neutron_source(double k_eff); - double compute_k_eff(double k_eff_old) const; + virtual void update_single_neutron_source(SourceRegionHandle& srh); + virtual void update_all_neutron_sources(); + void compute_k_eff(); virtual void normalize_scalar_flux_and_volumes( double total_active_distance_per_iteration); int64_t add_source_to_scalar_flux(); virtual void batch_reset(); - void convert_source_regions_to_tallies(); + void convert_source_regions_to_tallies(int64_t start_sr_id); void reset_tally_volumes(); void random_ray_tally(); virtual void accumulate_iteration_flux(); void output_to_vtk() const; void convert_external_sources(); void count_external_source_regions(); - void set_adjoint_sources(const vector& forward_flux); + void set_adjoint_sources(); void flux_swap(); virtual double evaluate_flux_at_point(Position r, int64_t sr, int g) const; double compute_fixed_source_normalization_factor() const; @@ -54,10 +55,10 @@ public: bool is_target_void); void apply_mesh_to_cell_and_children(int32_t i_cell, int32_t mesh_idx, int32_t target_material_id, bool is_target_void); - void prepare_base_source_regions(); SourceRegionHandle get_subdivided_source_region_handle( - int64_t sr, int mesh_bin, Position r, double dist, Direction u); + SourceRegionKey sr_key, Position r, Direction u); void finalize_discovered_source_regions(); + void apply_transport_stabilization(); int64_t n_source_regions() const { return source_regions_.n_source_regions(); @@ -66,11 +67,18 @@ public: { return source_regions_.n_source_regions() * negroups_; } + int64_t lookup_base_source_region_idx(const GeometryState& p) const; + SourceRegionKey lookup_source_region_key(const GeometryState& p) const; + int64_t lookup_mesh_bin(int64_t sr, Position r) const; + int lookup_mesh_idx(int64_t sr) const; //---------------------------------------------------------------------------- // Static Data members static bool volume_normalized_flux_tallies_; static bool adjoint_; // If the user wants outputs based on the adjoint flux + static double + diagonal_stabilization_rho_; // Adjusts strength of diagonal stabilization + // for transport corrected MGXS data // Static variables to store source region meshes and domains static std::unordered_map>> @@ -82,6 +90,7 @@ public: //---------------------------------------------------------------------------- // Public Data members + double k_eff_ {1.0}; // Eigenvalue bool mapped_all_tallies_ {false}; // If all source regions have been visited int64_t n_external_source_regions_ {0}; // Total number of source regions with @@ -106,14 +115,6 @@ public: // The abstract container holding all source region-specific data SourceRegionContainer source_regions_; - // Base source region container. When source region subdivision via mesh - // is in use, this container holds the original (non-subdivided) material - // filled cell instance source regions. These are useful as they can be - // initialized with external source and mesh domain information ahead of time. - // Then, dynamically discovered source regions can be initialized by cloning - // their base region. - SourceRegionContainer base_source_regions_; - // Parallel hash map holding all source regions discovered during // a single iteration. This is a threadsafe data structure that is cleaned // out after each iteration and stored in the "source_regions_" container. @@ -127,16 +128,36 @@ public: std::unordered_map source_region_map_; + // Map that relates a SourceRegionKey to the external source index. This map + // is used to check if there are any point sources within a subdivided source + // region at the time it is discovered. + std::unordered_map, SourceRegionKey::HashFunctor> + external_point_source_map_; + + // Map that relates a base source region index to the external source index. + // This map is used to check if there are any volumetric sources within a + // subdivided source region at the time it is discovered. + std::unordered_map> external_volumetric_source_map_; + + // Map that relates a base source region index to a mesh index. This map + // is used to check which subdivision mesh is present in a source region. + std::unordered_map mesh_map_; + + // If transport corrected MGXS data is being used, there may be negative + // in-group scattering cross sections that can result in instability in MOC + // and random ray if used naively. This flag enables a stabilization + // technique. + bool is_transport_stabilization_needed_ {false}; + protected: //---------------------------------------------------------------------------- // Methods void apply_external_source_to_source_region( - Discrete* discrete, double strength_factor, int64_t sr); - void apply_external_source_to_cell_instances(int32_t i_cell, - Discrete* discrete, double strength_factor, int target_material_id, - const vector& instances); - void apply_external_source_to_cell_and_children(int32_t i_cell, - Discrete* discrete, double strength_factor, int32_t target_material_id); + int src_idx, SourceRegionHandle& srh); + void apply_external_source_to_cell_instances(int32_t i_cell, int src_idx, + int target_material_id, const vector& instances); + void apply_external_source_to_cell_and_children( + int32_t i_cell, int src_idx, int32_t target_material_id); virtual void set_flux_to_flux_plus_source(int64_t sr, double volume, int g); void set_flux_to_source(int64_t sr, int g); virtual void set_flux_to_old_flux(int64_t sr, int g); @@ -149,6 +170,9 @@ protected: simulation_volume_; // Total physical volume of the simulation domain, as // defined by the 3D box of the random ray source + double + fission_rate_; // The system's fission rate (per cm^3), in eigenvalue mode + // Volumes for each tally and bin/score combination. This intermediate data // structure is used when tallying quantities that must be normalized by // volume (i.e., flux). The vector is index by tally index, while the inner 2D diff --git a/include/openmc/random_ray/linear_source_domain.h b/include/openmc/random_ray/linear_source_domain.h index 67fdd99f8..0098c7820 100644 --- a/include/openmc/random_ray/linear_source_domain.h +++ b/include/openmc/random_ray/linear_source_domain.h @@ -20,7 +20,7 @@ class LinearSourceDomain : public FlatSourceDomain { public: //---------------------------------------------------------------------------- // Methods - void update_neutron_source(double k_eff) override; + void update_single_neutron_source(SourceRegionHandle& srh) override; void normalize_scalar_flux_and_volumes( double total_active_distance_per_iteration) override; diff --git a/include/openmc/random_ray/random_ray.h b/include/openmc/random_ray/random_ray.h index abf2a2688..40c67ef95 100644 --- a/include/openmc/random_ray/random_ray.h +++ b/include/openmc/random_ray/random_ray.h @@ -48,7 +48,6 @@ public: static double distance_active_; // Active ray length static unique_ptr ray_source_; // Starting source for ray sampling static RandomRaySourceShape source_shape_; // Flag for linear source - static bool mesh_subdivision_enabled_; // Flag for mesh subdivision static RandomRaySampleMethod sample_method_; // Flag for sampling method //---------------------------------------------------------------------------- diff --git a/include/openmc/random_ray/random_ray_simulation.h b/include/openmc/random_ray/random_ray_simulation.h index b94e7401b..3dec48bf2 100644 --- a/include/openmc/random_ray/random_ray_simulation.h +++ b/include/openmc/random_ray/random_ray_simulation.h @@ -21,11 +21,7 @@ public: // Methods void compute_segment_correction_factors(); void apply_fixed_sources_and_mesh_domains(); - void prepare_fixed_sources_adjoint(vector& forward_flux, - SourceRegionContainer& forward_source_regions, - SourceRegionContainer& forward_base_source_regions, - std::unordered_map& - forward_source_region_map); + void prepare_fixed_sources_adjoint(); void simulate(); void output_simulation_results() const; void instability_check( @@ -45,9 +41,6 @@ private: // Contains all flat source region data unique_ptr domain_; - // Random ray eigenvalue - double k_eff_ {1.0}; - // Tracks the average FSR miss rate for analysis and reporting double avg_miss_rate_ {0.0}; diff --git a/include/openmc/random_ray/source_region.h b/include/openmc/random_ray/source_region.h index 5c5b31f39..0f5a747ff 100644 --- a/include/openmc/random_ray/source_region.h +++ b/include/openmc/random_ray/source_region.h @@ -308,7 +308,6 @@ public: //---------------------------------------------------------------------------- // Constructors SourceRegion(int negroups, bool is_linear); - SourceRegion(const SourceRegionHandle& handle, int64_t parent_sr); SourceRegion() = default; //---------------------------------------------------------------------------- diff --git a/include/openmc/settings.h b/include/openmc/settings.h index f3aff08b0..b369c99fe 100644 --- a/include/openmc/settings.h +++ b/include/openmc/settings.h @@ -24,6 +24,32 @@ enum class SSWCellType { To, }; +// Type of IFP parameters +enum class IFPParameter { + None, + Both, + BetaEffective, + GenerationTime, +}; + +struct CollisionTrackConfig { + bool mcpl_write {false}; //!< Write collision tracks using MCPL? + std::unordered_set + cell_ids; //!< Cell ids where collisions will be written + std::unordered_set + mt_numbers; //!< MT Numbers where collisions will be written + std::unordered_set + universe_ids; //!< Universe IDs where collisions will be written + std::unordered_set + material_ids; //!< Material IDs where collisions will be written + std::unordered_set + nuclides; //!< Nuclides where collisions will be written + double deposited_energy_threshold {0.0}; //!< Minimum deposited energy [eV] + int64_t max_collisions { + 1000}; //!< Maximum events recorded per collision track file + int64_t max_files {1}; //!< Maximum number of collision track files +}; + //============================================================================== // Global variable declarations //============================================================================== @@ -33,6 +59,7 @@ namespace settings { // Boolean flags extern bool assume_separate; //!< assume tallies are spatially separate? extern bool check_overlaps; //!< check overlaps in geometry? +extern bool collision_track; //!< flag to use collision track feature? extern bool confidence_intervals; //!< use confidence intervals for results? extern bool create_fission_neutrons; //!< create fission neutrons (fixed source)? @@ -42,7 +69,8 @@ extern bool delayed_photon_scaling; //!< Scale fission photon yield to include delayed extern "C" bool entropy_on; //!< calculate Shannon entropy? extern "C" bool - event_based; //!< use event-based mode (instead of history-based) + event_based; //!< use event-based mode (instead of history-based) +extern bool ifp_on; //!< Use IFP for kinetics parameters? extern bool legendre_to_tabular; //!< convert Legendre distributions to tabular? extern bool material_cell_offsets; //!< create material cells offsets? extern "C" bool output_summary; //!< write summary.h5? @@ -112,6 +140,10 @@ extern array energy_cutoff; //!< Energy cutoff in [eV] for each particle type extern array time_cutoff; //!< Time cutoff in [s] for each particle type +extern int + ifp_n_generation; //!< Number of generation for Iterated Fission Probability +extern IFPParameter + ifp_parameter; //!< Parameter to calculate for Iterated Fission Probability extern int legendre_to_tabular_points; //!< number of points to convert Legendres extern int max_order; //!< Maximum Legendre order for multigroup data @@ -132,9 +164,15 @@ extern std::unordered_set statepoint_batch; //!< Batches when state should be written extern std::unordered_set source_write_surf_id; //!< Surface ids where sources will be written +extern CollisionTrackConfig collision_track_config; +extern double source_rejection_fraction; //!< Minimum fraction of source sites + //!< that must be accepted +extern double free_gas_threshold; //!< Threshold multiplier for free gas + //!< scattering treatment extern int max_history_splits; //!< maximum number of particle splits for weight windows +extern int max_secondaries; //!< maximum number of secondaries in the bank extern int64_t ssw_max_particles; //!< maximum number of particles to be //!< banked on surfaces per process extern int64_t ssw_max_files; //!< maximum number of surface source files diff --git a/include/openmc/simulation.h b/include/openmc/simulation.h index 3e4e24e1d..9a6cf1b21 100644 --- a/include/openmc/simulation.h +++ b/include/openmc/simulation.h @@ -22,6 +22,7 @@ constexpr int STATUS_EXIT_ON_TRIGGER {2}; namespace simulation { +extern int ct_current_file; //!< current collision track file index extern "C" int current_batch; //!< current batch extern "C" int current_gen; //!< current fission generation extern "C" bool initialized; //!< has simulation been initialized? diff --git a/include/openmc/source.h b/include/openmc/source.h index 6733eaeff..36c821fc0 100644 --- a/include/openmc/source.h +++ b/include/openmc/source.h @@ -21,10 +21,9 @@ namespace openmc { // Constants //============================================================================== -// Maximum number of external source spatial resamples to encounter before an -// error is thrown. +// Minimum number of external source sites rejected before checking againts the +// source_rejection_fraction constexpr int EXTSRC_REJECT_THRESHOLD {10000}; -constexpr double EXTSRC_REJECT_FRACTION {0.05}; //============================================================================== // Global variables @@ -140,6 +139,9 @@ public: DomainType domain_type() const { return domain_type_; } const std::unordered_set& domain_ids() const { return domain_ids_; } + // Setter for spatial distribution + void set_space(UPtrSpace space) { space_ = std::move(space); } + protected: // Indicates whether derived class already handles constraints bool constraints_applied() const override { return true; } @@ -171,7 +173,7 @@ protected: SourceSite sample(uint64_t* seed) const override; private: - vector sites_; //!< Source sites from a file + vector sites_; //!< Source sites }; //============================================================================== @@ -206,6 +208,23 @@ typedef unique_ptr create_compiled_source_t(std::string parameters); //! Mesh-based source with different distributions for each element //============================================================================== +// Helper class to sample spatial position on a single mesh element +class MeshElementSpatial : public SpatialDistribution { +public: + MeshElementSpatial(int32_t mesh_index, int elem_index) + : mesh_index_(mesh_index), elem_index_(elem_index) + {} + + //! Sample a position from the distribution + //! \param seed Pseudorandom number seed pointer + //! \return (sampled position, importance weight) + std::pair sample(uint64_t* seed) const override; + +private: + int32_t mesh_index_ {C_NONE}; //!< Index in global meshes array + int elem_index_; //! Index of mesh element +}; + class MeshSource : public Source { public: // Constructors @@ -220,18 +239,15 @@ public: double strength() const override { return space_->total_strength(); } // Accessors - const std::unique_ptr& source(int32_t i) const + const unique_ptr& source(int32_t i) const { return sources_.size() == 1 ? sources_[0] : sources_[i]; } -protected: - bool constraints_applied() const override { return true; } - private: // Data members - unique_ptr space_; //!< Mesh spatial - vector> sources_; //!< Source distributions + unique_ptr space_; //!< Mesh spatial + vector> sources_; //!< Source distributions }; //============================================================================== diff --git a/include/openmc/surface.h b/include/openmc/surface.h index 549e8f6ab..2d8580345 100644 --- a/include/openmc/surface.h +++ b/include/openmc/surface.h @@ -2,6 +2,7 @@ #define OPENMC_SURFACE_H #include // For numeric_limits +#include #include #include @@ -378,7 +379,39 @@ public: // Non-member functions //============================================================================== -void read_surfaces(pugi::xml_node node); +//! Read surface definitions from XML and populate the global surfaces vector. +//! +//! This function parses surface elements from the XML input, creates the +//! appropriate surface objects, and identifies periodic surfaces along with +//! their albedo values and sense information. +//! +//! \param node XML node containing surface definitions +//! \param[out] periodic_pairs Set of surface ID pairs representing periodic +//! boundary conditions +//! \param[out] albedo_map Map of surface IDs to albedo values for periodic +//! surfaces +//! \param[out] periodic_sense_map Map of surface IDs to their sense values +//! (used to determine orientation for periodic BCs) +void read_surfaces(pugi::xml_node node, + std::set>& periodic_pairs, + std::unordered_map& albedo_map, + std::unordered_map& periodic_sense_map); + +//! Resolve periodic surface pairs and assign boundary conditions. +//! +//! This function completes the setup of periodic boundary conditions by +//! resolving unpaired periodic surfaces, determining whether each pair +//! represents translational or rotational periodicity based on surface +//! normals, and assigning the appropriate boundary condition objects. +//! +//! \param[inout] periodic_pairs Set of surface ID pairs representing periodic +//! boundary conditions; unpaired entries are resolved +//! \param albedo_map Map of surface IDs to albedo values for periodic surfaces +//! \param periodic_sense_map Map of surface IDs to their sense values (used to +//! determine orientation for periodic BCs) +void prepare_boundary_conditions(std::set>& periodic_pairs, + std::unordered_map& albedo_map, + std::unordered_map& periodic_sense_map); void free_memory_surfaces(); diff --git a/include/openmc/tallies/filter.h b/include/openmc/tallies/filter.h index 3e982d0cf..65098597a 100644 --- a/include/openmc/tallies/filter.h +++ b/include/openmc/tallies/filter.h @@ -33,6 +33,7 @@ enum class FilterType { MATERIALFROM, MESH, MESHBORN, + MESH_MATERIAL, MESH_SURFACE, MU, MUSURFACE, @@ -44,6 +45,7 @@ enum class FilterType { SURFACE, TIME, UNIVERSE, + WEIGHT, ZERNIKE, ZERNIKE_RADIAL }; diff --git a/include/openmc/tallies/filter_mesh.h b/include/openmc/tallies/filter_mesh.h index 2f48b6d4d..c35a477fe 100644 --- a/include/openmc/tallies/filter_mesh.h +++ b/include/openmc/tallies/filter_mesh.h @@ -9,9 +9,9 @@ namespace openmc { //============================================================================== -//! Indexes the location of particle events to a regular mesh. For tracklength -//! tallies, it will produce multiple valid bins and the bin weight will -//! correspond to the fraction of the track length that lies in that bin. +//! Indexes the location of particle events to a mesh. For tracklength tallies, +//! it will produce multiple valid bins and the bin weight will correspond to +//! the fraction of the track length that lies in that bin. //============================================================================== class MeshFilter : public Filter { @@ -51,6 +51,12 @@ public: virtual bool translated() const { return translated_; } + virtual void set_rotation(const vector& rotation); + + virtual const vector& rotation() const { return rotation_; } + + virtual bool rotated() const { return rotated_; } + protected: //---------------------------------------------------------------------------- // Data members @@ -58,6 +64,8 @@ protected: int32_t mesh_; //!< Index of the mesh bool translated_ {false}; //!< Whether or not the filter is translated Position translation_ {0.0, 0.0, 0.0}; //!< Filter translation + bool rotated_ {false}; //!< Whether or not the filter is rotated + vector rotation_; //!< Filter rotation }; } // namespace openmc diff --git a/include/openmc/tallies/filter_meshmaterial.h b/include/openmc/tallies/filter_meshmaterial.h new file mode 100644 index 000000000..42a4edcf0 --- /dev/null +++ b/include/openmc/tallies/filter_meshmaterial.h @@ -0,0 +1,114 @@ +#ifndef OPENMC_TALLIES_FILTER_MESHMATERIAL_H +#define OPENMC_TALLIES_FILTER_MESHMATERIAL_H + +#include +#include +#include +#include + +#include "openmc/position.h" +#include "openmc/random_ray/source_region.h" +#include "openmc/span.h" +#include "openmc/tallies/filter.h" +#include "openmc/vector.h" + +namespace openmc { + +//============================================================================== +//! Helper structs that define a combination of a mesh element index and a +//! material index and a functor for hashing to place in an unordered_map +//============================================================================== + +struct ElementMat { + //! Check for equality + bool operator==(const ElementMat& other) const + { + return index_element == other.index_element && index_mat == other.index_mat; + } + + int32_t index_element; + int32_t index_mat; +}; + +struct ElementMatHash { + std::size_t operator()(const ElementMat& k) const + { + size_t seed = 0; + hash_combine(seed, k.index_element); + hash_combine(seed, k.index_mat); + return seed; + } +}; + +//============================================================================== +//! Indexes the location of particle events to combinations of mesh element +//! index and material. For tracklength tallies, it will produce multiple valid +//! bins and the bin weight will correspond to the fraction of the track length +//! that lies in that bin. +//============================================================================== + +class MeshMaterialFilter : public Filter { +public: + //---------------------------------------------------------------------------- + // Constructors, destructors + + ~MeshMaterialFilter() = default; + + //---------------------------------------------------------------------------- + // Methods + + std::string type_str() const override { return "meshmaterial"; } + FilterType type() const override { return FilterType::MESH_MATERIAL; } + + void from_xml(pugi::xml_node node) override; + + void get_all_bins(const Particle& p, TallyEstimator estimator, + FilterMatch& match) const override; + + void to_statepoint(hid_t filter_group) const override; + + std::string text_label(int bin) const override; + + //---------------------------------------------------------------------------- + // Accessors + + int32_t mesh() const { return mesh_; } + + void set_mesh(int32_t mesh); + + //! Set the bins based on a flat vector of alternating element index and + //! material IDs + void set_bins(span bins); + + //! Set the bins based on a vector of (element, material index) pairs + void set_bins(vector&& bins); + + virtual void set_translation(const Position& translation); + + virtual void set_translation(const double translation[3]); + + virtual const Position& translation() const { return translation_; } + + virtual bool translated() const { return translated_; } + +private: + //---------------------------------------------------------------------------- + // Data members + + int32_t mesh_; //!< Index of the mesh + bool translated_ {false}; //!< Whether or not the filter is translated + Position translation_ {0.0, 0.0, 0.0}; //!< Filter translation + + //! The indices of the mesh element-material combinations binned by this + //! filter. + vector bins_; + + //! The set of materials used in this filter + std::unordered_set materials_; + + //! A map from mesh element-material indices to filter bin indices. + std::unordered_map map_; +}; + +} // namespace openmc +#endif // OPENMC_TALLIES_FILTER_MESHMATERIAL_H diff --git a/include/openmc/tallies/filter_weight.h b/include/openmc/tallies/filter_weight.h new file mode 100644 index 000000000..1fe9d75d3 --- /dev/null +++ b/include/openmc/tallies/filter_weight.h @@ -0,0 +1,51 @@ +#ifndef OPENMC_TALLIES_FILTER_WEIGHT_H +#define OPENMC_TALLIES_FILTER_WEIGHT_H + +#include + +#include "openmc/span.h" +#include "openmc/tallies/filter.h" +#include "openmc/vector.h" + +namespace openmc { + +//============================================================================== +//! Bins the weights of the particles. +//============================================================================== + +class WeightFilter : public Filter { +public: + //---------------------------------------------------------------------------- + // Constructors, destructors + + ~WeightFilter() = default; + + //---------------------------------------------------------------------------- + // Methods + + std::string type_str() const override { return "weight"; } + FilterType type() const override { return FilterType::WEIGHT; } + + void from_xml(pugi::xml_node node) override; + + void get_all_bins(const Particle& p, TallyEstimator estimator, + FilterMatch& match) const override; + + void to_statepoint(hid_t filter_group) const override; + + std::string text_label(int bin) const override; + + //---------------------------------------------------------------------------- + // Accessors + + const vector& bins() const { return bins_; } + void set_bins(span bins); + +protected: + //---------------------------------------------------------------------------- + // Data members + vector bins_; +}; + +} // namespace openmc +#endif // OPENMC_TALLIES_FILTER_WEIGHT_H diff --git a/include/openmc/tallies/tally.h b/include/openmc/tallies/tally.h index 48f678ced..374daff92 100644 --- a/include/openmc/tallies/tally.h +++ b/include/openmc/tallies/tally.h @@ -106,6 +106,8 @@ public: bool writable() const { return writable_; } + bool higher_moments() const { return higher_moments_; } + //---------------------------------------------------------------------------- // Other methods. @@ -169,10 +171,8 @@ public: // We need to have quick access to some filters. The following gives indices // for various filters that could be in the tally or C_NONE if they are not // present. - int energy_filter_ {C_NONE}; int energyout_filter_ {C_NONE}; int delayedgroup_filter_ {C_NONE}; - int cell_filter_ {C_NONE}; vector triggers_; @@ -192,6 +192,9 @@ private: //! Whether to multiply by atom density for reaction rates bool multiply_density_ {true}; + //! Whether to accumulate higher moments (third and fourth) + bool higher_moments_ {false}; + int64_t index_; }; @@ -205,11 +208,14 @@ extern vector> tallies; extern vector active_tallies; extern vector active_analog_tallies; extern vector active_tracklength_tallies; +extern vector active_timed_tracklength_tallies; extern vector active_collision_tallies; extern vector active_meshsurf_tallies; extern vector active_surface_tallies; extern vector active_pulse_height_tallies; extern vector pulse_height_cells; +extern vector time_grid; + } // namespace model namespace simulation { @@ -241,6 +247,13 @@ void read_tallies_xml(pugi::xml_node root); //! batch to a new random variable void accumulate_tallies(); +//! Determine distance to next time boundary +// +//! \param time Current time of particle +//! \param speed Speed of particle +//! \return Distance to next time boundary (or INFTY if none) +double distance_to_time_boundary(double time, double speed); + //! Determine which tallies should be active void setup_active_tallies(); diff --git a/include/openmc/tallies/tally_scoring.h b/include/openmc/tallies/tally_scoring.h index 28f1f1622..c3ab779e6 100644 --- a/include/openmc/tallies/tally_scoring.h +++ b/include/openmc/tallies/tally_scoring.h @@ -91,6 +91,16 @@ void score_analog_tally_mg(Particle& p); //! \param distance The distance in [cm] traveled by the particle void score_tracklength_tally(Particle& p, double distance); +//! Score time filtered tallies using a tracklength estimate of the flux. +// +//! This is triggered at every event (surface crossing, lattice crossing, or +//! collision) and thus cannot be done for tallies that require post-collision +//! information. +// +//! \param p The particle being tracked +//! \param total_distance The distance in [cm] traveled by the particle +void score_timed_tracklength_tally(Particle& p, double total_distance); + //! Score surface or mesh-surface tallies for particle currents. // //! \param p The particle being tracked diff --git a/include/openmc/universe.h b/include/openmc/universe.h index e8fbacfdc..b7450224f 100644 --- a/include/openmc/universe.h +++ b/include/openmc/universe.h @@ -6,7 +6,7 @@ namespace openmc { -#ifdef DAGMC +#ifdef OPENMC_DAGMC_ENABLED class DAGUniverse; #endif @@ -29,6 +29,7 @@ class Universe { public: int32_t id_; //!< Unique ID vector cells_; //!< Cells within this universe + int32_t n_instances_; //!< Number of instances of this universe //! \brief Write universe information to an HDF5 group. //! \param group_id An HDF5 group id. diff --git a/include/openmc/urr.h b/include/openmc/urr.h index 3978c7b86..1e6037158 100644 --- a/include/openmc/urr.h +++ b/include/openmc/urr.h @@ -27,10 +27,10 @@ public: double heating; }; - Interpolation interp_; //!< interpolation type - int inelastic_flag_; //!< inelastic competition flag - int absorption_flag_; //!< other absorption flag - bool multiply_smooth_; //!< multiply by smooth cross section? + Interpolation interp_; //!< interpolation type + int inelastic_flag_; //!< inelastic competition flag + int absorption_flag_; //!< other absorption flag + bool multiply_smooth_; //!< multiply by smooth cross section? vector energy_; //!< incident energies auto n_energy() const { return energy_.size(); } diff --git a/include/openmc/weight_windows.h b/include/openmc/weight_windows.h index 6f2ef0707..763815522 100644 --- a/include/openmc/weight_windows.h +++ b/include/openmc/weight_windows.h @@ -71,6 +71,7 @@ struct WeightWindow { { lower_weight *= factor; upper_weight *= factor; + survival_weight *= factor; } }; diff --git a/man/man1/openmc.1 b/man/man1/openmc.1 index 7826a759a..30e8b2ce4 100644 --- a/man/man1/openmc.1 +++ b/man/man1/openmc.1 @@ -39,6 +39,9 @@ Use \fIN\fP OpenMP threads. .B "\-t\fR, \fP\-\-track" Write tracks for all particles (up to max_tracks). .TP +.BI \-q " V" "\fR,\fP \-\-verbosity" " V" +Set the output verbosity to \fIV\fP. +.TP .B "\-v\fR, \fP\-\-version" Show version information. .TP diff --git a/openmc/__init__.py b/openmc/__init__.py index bb972b4e6..c204929c8 100644 --- a/openmc/__init__.py +++ b/openmc/__init__.py @@ -37,7 +37,7 @@ from openmc.tracks import * from .config import * # Import a few names from the model module -from openmc.model import Model +from openmc.model import Model, SearchResult from . import examples diff --git a/openmc/_sparse_compat.py b/openmc/_sparse_compat.py new file mode 100644 index 000000000..c00777e19 --- /dev/null +++ b/openmc/_sparse_compat.py @@ -0,0 +1,43 @@ +"""Compatibility module for scipy.sparse arrays + +This module provides a compatibility layer for working with scipy.sparse arrays +across different scipy versions. Sparse arrays were introduced gradually in +scipy, with full support arriving in scipy 1.15. This module provides a unified +API that uses sparse arrays when available and falls back to sparse matrices for +older scipy versions. + +For more information on the migration from sparse matrices to sparse arrays, +see: https://docs.scipy.org/doc/scipy/reference/sparse.migration_to_sparray.html +""" + +import scipy +from scipy import sparse as sp + +# Check scipy version for feature availability +_SCIPY_VERSION = tuple(map(int, scipy.__version__.split('.')[:2])) + +if _SCIPY_VERSION >= (1, 15): + # Use sparse arrays + csr_array = sp.csr_array + csc_array = sp.csc_array + dok_array = sp.dok_array + lil_array = sp.lil_array + eye_array = sp.eye_array + block_array = sp.block_array +else: + # Fall back to sparse matrices + csr_array = sp.csr_matrix + csc_array = sp.csc_matrix + dok_array = sp.dok_matrix + lil_array = sp.lil_matrix + eye_array = sp.eye + block_array = sp.bmat + +__all__ = [ + 'csr_array', + 'csc_array', + 'dok_array', + 'lil_array', + 'eye_array', + 'block_array', +] diff --git a/openmc/_xml.py b/openmc/_xml.py index 17389a82f..758d80525 100644 --- a/openmc/_xml.py +++ b/openmc/_xml.py @@ -63,26 +63,9 @@ def get_text(elem, name, default=None): return child.text if child is not None else default -def reorder_attributes(root): - """Sort attributes in XML to preserve pre-Python 3.8 behavior - Parameters - ---------- - root : lxml.etree._Element - Root element - - """ - for el in root.iter(): - attrib = el.attrib - if len(attrib) > 1: - # adjust attribute order, e.g. by sorting - attribs = sorted(attrib.items()) - attrib.clear() - attrib.update(attribs) - - -def get_elem_tuple(elem, name, dtype=int): - """Helper function to get a tuple of values from an elem +def get_elem_list(elem, name, dtype=int): + """Helper function to get a list of values from an elem Parameters ---------- @@ -95,9 +78,9 @@ def get_elem_tuple(elem, name, dtype=int): Returns ------- - tuple of dtype - Data read from the tuple + list of dtype + Data read from the list """ - subelem = elem.find(name) - if subelem is not None: - return tuple([dtype(x) for x in subelem.text.split()]) + text = get_text(elem, name) + if text is not None: + return [dtype(x) for x in text.split()] diff --git a/openmc/cell.py b/openmc/cell.py index cd0573e8b..82a034b1c 100644 --- a/openmc/cell.py +++ b/openmc/cell.py @@ -8,7 +8,7 @@ from uncertainties import UFloat import openmc import openmc.checkvalue as cv -from ._xml import get_text +from ._xml import get_elem_list, get_text from .mixin import IDManagerMixin from .plots import add_plot_params from .region import Region, Complement @@ -72,6 +72,10 @@ class Cell(IDManagerMixin): temperature : float or iterable of float Temperature of the cell in Kelvin. Multiple temperatures can be given to give each distributed cell instance a unique temperature. + density : float or iterable of float + Density of the cell in [g/cm3]. Multiple densities can be given to give + each distributed cell instance a unique density. Densities set here will + override the density set on materials used to fill the cell. translation : Iterable of float If the cell is filled with a universe, this array specifies a vector that is used to translate (shift) the universe. @@ -109,6 +113,7 @@ class Cell(IDManagerMixin): self._rotation = None self._rotation_matrix = None self._temperature = None + self._density = None self._translation = None self._paths = None self._num_instances = None @@ -141,6 +146,7 @@ class Cell(IDManagerMixin): if self.fill_type == 'material': string += '\t{0: <15}=\t{1}\n'.format('Temperature', self.temperature) + string += '\t{0: <15}=\t{1}\n'.format('Density', self.density) string += '{: <16}=\t{}\n'.format('\tTranslation', self.translation) string += '{: <16}=\t{}\n'.format('\tVolume', self.volume) @@ -257,6 +263,30 @@ class Cell(IDManagerMixin): else: self._temperature = temperature + @property + def density(self): + return self._density + + @density.setter + def density(self, density): + # Make sure densities are greater than zero + cv.check_type('cell density', density, (Iterable, Real), none_ok=True) + if isinstance(density, Iterable): + cv.check_type('cell density', density, Iterable, Real) + for rho in density: + cv.check_greater_than('cell density', rho, 0.0, True) + elif isinstance(density, Real): + cv.check_greater_than('cell density', density, 0.0, True) + + # If this cell is filled with a universe or lattice, propagate + # densities to all cells contained. Otherwise, simply assign it. + if self.fill_type in ('universe', 'lattice'): + for c in self.get_all_cells().values(): + if c.fill_type == 'material': + c._density = density + else: + self._density = density + @property def translation(self): return self._translation @@ -525,6 +555,8 @@ class Cell(IDManagerMixin): clone.volume = self.volume if self.temperature is not None: clone.temperature = self.temperature + if self.density is not None: + clone.density = self.density if self.translation is not None: clone.translation = self.translation if self.rotation is not None: @@ -567,10 +599,10 @@ class Cell(IDManagerMixin): .. versionadded:: 0.14.0 """ # Create dummy universe but preserve used_ids - next_id = openmc.Universe.next_id + next_id = openmc.UniverseBase.next_id u = openmc.Universe(cells=[self]) - openmc.Universe.used_ids.remove(u.id) - openmc.Universe.next_id = next_id + openmc.UniverseBase.used_ids.remove(u.id) + openmc.UniverseBase.next_id = next_id return u.plot(*args, **kwargs) def create_xml_subelement(self, xml_element, memo=None): @@ -650,6 +682,12 @@ class Cell(IDManagerMixin): else: element.set("temperature", str(self.temperature)) + if self.density is not None: + if isinstance(self.density, Iterable): + element.set("density", ' '.join(str(t) for t in self.density)) + else: + element.set("density", str(self.density)) + if self.translation is not None: element.set("translation", ' '.join(map(str, self.translation))) @@ -689,9 +727,8 @@ class Cell(IDManagerMixin): c = cls(cell_id, name) # Assign material/distributed materials or fill - mat_text = get_text(elem, 'material') - if mat_text is not None: - mat_ids = mat_text.split() + mat_ids = get_elem_list(elem, 'material', str) + if mat_ids is not None: if len(mat_ids) > 1: c.fill = [materials[i] for i in mat_ids] else: @@ -706,19 +743,21 @@ class Cell(IDManagerMixin): c.region = Region.from_expression(region, surfaces) # Check for other attributes - t = get_text(elem, 'temperature') - if t is not None: - if ' ' in t: - c.temperature = [float(t_i) for t_i in t.split()] + temperature = get_elem_list(elem, 'temperature', float) + if temperature is not None: + if len(temperature) > 1: + c.temperature = temperature else: - c.temperature = float(t) + c.temperature = temperature[0] + density = get_elem_list(elem, 'density', float) + if density is not None: + c.density = density if len(density) > 1 else density[0] v = get_text(elem, 'volume') if v is not None: c.volume = float(v) - for key in ('temperature', 'rotation', 'translation'): - value = get_text(elem, key) - if value is not None: - values = [float(x) for x in value.split()] + for key in ('temperature', 'density', 'rotation', 'translation'): + values = get_elem_list(elem, key, float) + if values is not None: if key == 'rotation' and len(values) == 9: values = np.array(values).reshape(3, 3) setattr(c, key, values) diff --git a/openmc/checkvalue.py b/openmc/checkvalue.py index 4fa205b14..5ff2cf9ac 100644 --- a/openmc/checkvalue.py +++ b/openmc/checkvalue.py @@ -37,7 +37,7 @@ def check_type(name, value, expected_type, expected_iter_type=None, *, none_ok=F [t.__name__ for t in expected_type])) else: msg = (f'Unable to set "{name}" to "{value}" which is not of type "' - f'{expected_type.__name__}"') + f'{expected_type}"') raise TypeError(msg) if expected_iter_type: diff --git a/openmc/cmfd.py b/openmc/cmfd.py index eff6a151f..8595d1e02 100644 --- a/openmc/cmfd.py +++ b/openmc/cmfd.py @@ -25,6 +25,7 @@ import openmc.lib from .checkvalue import (check_type, check_length, check_value, check_greater_than, check_less_than) from .exceptions import OpenMCError +from ._sparse_compat import csr_array # See if mpi4py module can be imported, define have_mpi global variable try: @@ -980,8 +981,7 @@ class CMFDRun: loss_row = self._loss_row loss_col = self._loss_col temp_data = np.ones(len(loss_row)) - temp_loss = sparse.csr_matrix((temp_data, (loss_row, loss_col)), - shape=(n, n)) + temp_loss = csr_array((temp_data, (loss_row, loss_col)), shape=(n, n)) temp_loss.sort_indices() # Pass coremap as 1-d array of 32-bit integers @@ -1585,7 +1585,7 @@ class CMFDRun: # Create csr matrix loss_row = self._loss_row loss_col = self._loss_col - loss = sparse.csr_matrix((data, (loss_row, loss_col)), shape=(n, n)) + loss = csr_array((data, (loss_row, loss_col)), shape=(n, n)) loss.sort_indices() return loss @@ -1612,7 +1612,7 @@ class CMFDRun: # Create csr matrix prod_row = self._prod_row prod_col = self._prod_col - prod = sparse.csr_matrix((data, (prod_row, prod_col)), shape=(n, n)) + prod = csr_array((data, (prod_row, prod_col)), shape=(n, n)) prod.sort_indices() return prod diff --git a/openmc/config.py b/openmc/config.py index ab53ab61b..23d8e23a7 100644 --- a/openmc/config.py +++ b/openmc/config.py @@ -1,8 +1,23 @@ +"""Module for handling global configuration in OpenMC. + +This module exports a single object, `config`, that can be used to control +various settings, primarily paths to data files. It acts like a dictionary but +with special behaviors. + +Examples +-------- +>>> import openmc +>>> openmc.config['cross_sections'] = '/path/to/my/cross_sections.xml' +>>> print(openmc.config) +{'resolve_paths': True, 'cross_sections': PosixPath('/path/to/my/cross_sections.xml')} + +""" from collections.abc import MutableMapping from contextlib import contextmanager import os from pathlib import Path import warnings +from typing import Any, Dict, Iterator from openmc.data import DataLibrary from openmc.data.decay import _DECAY_ENERGY, _DECAY_PHOTON_ENERGY @@ -11,104 +26,193 @@ __all__ = ["config"] class _Config(MutableMapping): - def __init__(self, data=()): - self._mapping = {'resolve_paths': True} + """A configuration dictionary for OpenMC with special handling for path-like values. + + This class enforces valid configuration keys and synchronizes path-related + settings with their corresponding environment variables. + + Attributes + ---------- + cross_sections : pathlib.Path + Path to a cross_sections.xml file. Also sets/unsets the + OPENMC_CROSS_SECTIONS environment variable. + mg_cross_sections : pathlib.Path + Path to a multi-group cross_sections.h5 file. Also sets/unsets + the OPENMC_MG_CROSS_SECTIONS environment variable. + chain_file : pathlib.Path + Path to a depletion chain XML file. Also sets/unsets the + OPENMC_CHAIN_FILE environment variable. Setting or deleting this + clears internal decay data caches. + resolve_paths : bool + If True (default), all paths assigned are resolved to absolute + paths. If False, paths are stored as they are provided. + + """ + _PATH_KEYS: Dict[str, str] = { + 'cross_sections': 'OPENMC_CROSS_SECTIONS', + 'mg_cross_sections': 'OPENMC_MG_CROSS_SECTIONS', + 'chain_file': 'OPENMC_CHAIN_FILE' + } + + def __init__(self, data: dict = ()): + self._mapping: Dict[str, Any] = {'resolve_paths': True} self.update(data) - def __getitem__(self, key): + def __getitem__(self, key: str) -> Any: return self._mapping[key] - def __delitem__(self, key): - del self._mapping[key] - if key == 'cross_sections': - del os.environ['OPENMC_CROSS_SECTIONS'] - elif key == 'mg_cross_sections': - del os.environ['OPENMC_MG_CROSS_SECTIONS'] - elif key == 'chain_file': - del os.environ['OPENMC_CHAIN_FILE'] - # Reset photon source data since it relies on chain file - _DECAY_PHOTON_ENERGY.clear() + def __delitem__(self, key: str): + """Delete a configuration key. - def __setitem__(self, key, value): - if key == 'cross_sections': - # Force environment variable to match - self._set_path(key, value) - os.environ['OPENMC_CROSS_SECTIONS'] = str(value) - elif key == 'mg_cross_sections': - self._set_path(key, value) - os.environ['OPENMC_MG_CROSS_SECTIONS'] = str(value) - elif key == 'chain_file': - self._set_path(key, value) - os.environ['OPENMC_CHAIN_FILE'] = str(value) - # Reset photon source data since it relies on chain file + This also deletes the corresponding environment variable if the key is a + path-like key, and clears decay data caches if 'chain_file' is deleted. + 'resolve_paths' cannot be deleted. + + """ + if key == 'resolve_paths': + raise KeyError("'resolve_paths' cannot be deleted.") + del self._mapping[key] + if key in self._PATH_KEYS: + env_var = self._PATH_KEYS[key] + if env_var in os.environ: + del os.environ[env_var] + if key == 'chain_file': _DECAY_PHOTON_ENERGY.clear() _DECAY_ENERGY.clear() + + def __setitem__(self, key: str, value: Any): + """Set a configuration key and its corresponding value. + + For path-like keys, this method performs several actions: + 1. Resolves the path to an absolute path if `resolve_paths` is True. + 2. Stores the `pathlib.Path` object. + 3. Sets the corresponding environment variable (e.g., OPENMC_CROSS_SECTIONS). + 4. For 'chain_file', clears internal decay data caches. + 5. Issues a `UserWarning` if the final path does not exist. + + """ + if key in self._PATH_KEYS: + p = Path(value) + # Use .get() for robustness, defaulting to True + if self._mapping.get('resolve_paths', True): + stored_path = p.resolve(strict=False) + else: + stored_path = p + + self._mapping[key] = stored_path + os.environ[self._PATH_KEYS[key]] = str(stored_path) + + if key == 'chain_file': + _DECAY_PHOTON_ENERGY.clear() + _DECAY_ENERGY.clear() + + if not stored_path.exists(): + warnings.warn(f"Path '{stored_path}' does not exist.", UserWarning) + elif key == 'resolve_paths': + if not isinstance(value, bool): + raise TypeError("'resolve_paths' must be a boolean.") self._mapping[key] = value else: - raise KeyError(f'Unrecognized config key: {key}. Acceptable keys ' - 'are "cross_sections", "mg_cross_sections", ' - '"chain_file", and "resolve_paths".') + valid_keys = list(self._PATH_KEYS.keys()) + ['resolve_paths'] + raise KeyError( + f"Unrecognized config key: {key}. Acceptable keys are: " + f"{', '.join(repr(k) for k in valid_keys)}." + ) - def __iter__(self): + def __iter__(self) -> Iterator[str]: return iter(self._mapping) - def __len__(self): + def __len__(self) -> int: return len(self._mapping) - def __repr__(self): + def __repr__(self) -> str: return repr(self._mapping) - def _set_path(self, key, value): - self._mapping[key] = p = Path(value) - if not p.exists(): - warnings.warn(f"'{value}' does not exist.") + def clear(self): + """Clear all configuration keys except for 'resolve_paths'. + + This ensures that the path resolution behavior is not accidentally reset + when clearing the configuration. + + """ + # Create a copy of keys to iterate over for safe deletion + keys_to_delete = [k for k in self._mapping if k != 'resolve_paths'] + for key in keys_to_delete: + del self[key] @contextmanager - def patch(self, key, value): - """Temporarily change a value in the configuration. + def patch(self, key: str, value: Any): + """Context manager to temporarily change a configuration value. + + After the `with` block, the configuration is restored to its original + state. Parameters ---------- key : str - Key to change - value : object - New value + The key of the configuration value to change. + value + The new temporary value. + + Examples + -------- + >>> openmc.config['cross_sections'] = 'endf71.xml' + >>> with openmc.config.patch('cross_sections', 'fendl32.xml'): + ... # Code in this block sees the new value + ... print(f"Inside with block: {openmc.config['cross_sections']}") + >>> # Outside the block, the value is restored + >>> print(f"Outside with block: {openmc.config['cross_sections']}") + Inside with block: fendl32.xml + Outside with block: endf71.xml + """ previous_value = self.get(key) self[key] = value - yield - if previous_value is None: - del self[key] + try: + yield + finally: + if previous_value is None: + del self[key] + else: + self[key] = previous_value + + +def _default_config(**kwargs) -> _Config: + """Create a configuration initialized from environment variables. + + This function checks for OPENMC_CROSS_SECTIONS, OPENMC_MG_CROSS_SECTIONS, + and OPENMC_CHAIN_FILE environment variables. It also has logic to find + a chain file within a `cross_sections.xml` file if one is not + explicitly set. + + Returns + ------- + _Config + A new configuration object. + + """ + config = _Config(kwargs) + for key,var in _Config._PATH_KEYS.items(): + if var in os.environ: + config[key] = os.environ[var] + + chain_file = config.get("chain_file") + xs_path = config.get("cross_sections") + if chain_file is None and xs_path is not None and xs_path.exists(): + try: + data = DataLibrary.from_xml(xs_path) + except Exception: + # Let this pass silently if cross_sections.xml can't be parsed + # or if a dependency like lxml is not available. + pass else: - self[key] = previous_value - -def _default_config(): - """Return default configuration""" - config = _Config() - - # Set cross sections using environment variable - if "OPENMC_CROSS_SECTIONS" in os.environ: - config['cross_sections'] = os.environ["OPENMC_CROSS_SECTIONS"] - if "OPENMC_MG_CROSS_SECTIONS" in os.environ: - config['mg_cross_sections'] = os.environ["OPENMC_MG_CROSS_SECTIONS"] - - # Set depletion chain - chain_file = os.environ.get("OPENMC_CHAIN_FILE") - if (chain_file is None and - config.get('cross_sections') is not None and - config['cross_sections'].exists() - ): - # Check for depletion chain in cross_sections.xml - data = DataLibrary.from_xml(config['cross_sections']) - for lib in reversed(data.libraries): - if lib['type'] == 'depletion_chain': - chain_file = lib['path'] - break - if chain_file is not None: - config['chain_file'] = chain_file - + for lib in reversed(data.libraries): + if lib['type'] == 'depletion_chain': + config['chain_file'] = xs_path.parent / lib['path'] + break return config +# Global configuration dictionary for OpenMC settings. config = _default_config() diff --git a/openmc/dagmc.py b/openmc/dagmc.py index 8ab0aaf69..fd4258225 100644 --- a/openmc/dagmc.py +++ b/openmc/dagmc.py @@ -8,11 +8,12 @@ import warnings import openmc import openmc.checkvalue as cv -from ._xml import get_text +from ._xml import get_elem_list, get_text from .checkvalue import check_type, check_value from .surface import _BOUNDARY_TYPES from .bounding_box import BoundingBox from .utility_funcs import input_path +from .plots import add_plot_params class DAGMCUniverse(openmc.UniverseBase): @@ -222,21 +223,19 @@ class DAGMCUniverse(openmc.UniverseBase): @property def material_names(self): - dagmc_file_contents = h5py.File(self.filename) - material_tags_hex = dagmc_file_contents['/tstt/tags/NAME'].get( - 'values') material_tags_ascii = [] - for tag in material_tags_hex: - candidate_tag = tag.tobytes().decode().replace('\x00', '') - # tags might be for temperature or reflective surfaces - if candidate_tag.startswith('mat:'): - # if name ends with _comp remove it, it is not parsed - if candidate_tag.endswith('_comp'): - candidate_tag = candidate_tag[:-5] - # removes first 4 characters as openmc.Material name should be - # set without the 'mat:' part of the tag - material_tags_ascii.append(candidate_tag[4:]) - + with h5py.File(self.filename) as dagmc_file_contents: + material_tags_hex = dagmc_file_contents['/tstt/tags/NAME'].get('values') + for tag in material_tags_hex: + candidate_tag = tag.tobytes().decode().replace('\x00', '') + # tags might be for temperature or reflective surfaces + if candidate_tag.startswith('mat:'): + # if name ends with _comp remove it, it is not parsed + if candidate_tag.endswith('_comp'): + candidate_tag = candidate_tag[:-5] + # removes first 4 characters as openmc.Material name should be + # set without the 'mat:' part of the tag + material_tags_ascii.append(candidate_tag[4:]) return sorted(set(material_tags_ascii)) def _n_geom_elements(self, geom_type): @@ -301,6 +300,8 @@ class DAGMCUniverse(openmc.UniverseBase): dagmc_element = ET.Element('dagmc_universe') dagmc_element.set('id', str(self.id)) + if self.name: + dagmc_element.set('name', self.name) if self.auto_geom_ids: dagmc_element.set('auto_geom_ids', 'true') if self.auto_mat_ids: @@ -467,8 +468,8 @@ class DAGMCUniverse(openmc.UniverseBase): if name is not None: out.name = name - out.auto_geom_ids = bool(elem.get('auto_geom_ids')) - out.auto_mat_ids = bool(elem.get('auto_mat_ids')) + out.auto_geom_ids = bool(get_text(elem, "auto_geom_ids")) + out.auto_mat_ids = bool(get_text(elem, "auto_mat_ids")) el_mat_override = elem.find('material_overrides') if el_mat_override is not None: @@ -479,7 +480,7 @@ class DAGMCUniverse(openmc.UniverseBase): out._material_overrides = {} for elem in el_mat_override.findall('cell_override'): cell_id = int(get_text(elem, 'id')) - mat_ids = get_text(elem, 'material_ids').split(' ') + mat_ids = get_elem_list(elem, "material_ids", str) or [] mat_objs = [mats[mat_id] for mat_id in mat_ids] out._material_overrides[cell_id] = mat_objs @@ -566,6 +567,12 @@ class DAGMCUniverse(openmc.UniverseBase): fill = mats_per_id[dag_cell.fill.id] if dag_cell.fill else None self.add_cell(openmc.DAGMCCell(cell_id=dag_cell_id, fill=fill)) + @add_plot_params + def plot(self, *args, **kwargs): + """Display a slice plot of the DAGMCUniverse. + """ + return openmc.Geometry(self).plot(*args, **kwargs) + class DAGMCCell(openmc.Cell): """A cell class for DAGMC-based geometries. diff --git a/openmc/data/data.py b/openmc/data/data.py index 408adf2e4..5ecadd37b 100644 --- a/openmc/data/data.py +++ b/openmc/data/data.py @@ -94,7 +94,7 @@ NATURAL_ABUNDANCE = { 'Yb174': 0.32025, 'Yb176': 0.12995, 'Lu175': 0.97401, 'Lu176': 0.02599, 'Hf174': 0.0016, 'Hf176': 0.0526, 'Hf177': 0.186, 'Hf178': 0.2728, 'Hf179': 0.1362, - 'Hf180': 0.3508, 'Ta180': 0.0001201, 'Ta181': 0.9998799, + 'Hf180': 0.3508, 'Ta180_m1': 0.0001201, 'Ta181': 0.9998799, 'W180': 0.0012, 'W182': 0.265, 'W183': 0.1431, 'W184': 0.3064, 'W186': 0.2843, 'Re185': 0.374, 'Re187': 0.626, 'Os184': 0.0002, 'Os186': 0.0159, @@ -324,7 +324,7 @@ def atomic_mass(isotope): # isotopes of their element (e.g. C0), calculate the atomic mass as # the sum of the atomic mass times the natural abundance of the isotopes # that make up the element. - for element in ['C', 'Zn', 'Pt', 'Os', 'Tl']: + for element in ['C', 'Zn', 'Pt', 'Os', 'Tl', 'V']: isotope_zero = element.lower() + '0' _ATOMIC_MASS[isotope_zero] = 0. for iso, abundance in isotopes(element): @@ -607,7 +607,7 @@ def zam(name): """ try: - symbol, A, state = _GNDS_NAME_RE.match(name).groups() + symbol, A, state = _GNDS_NAME_RE.fullmatch(name).groups() except AttributeError: raise ValueError(f"'{name}' does not appear to be a nuclide name in " "GNDS format") diff --git a/openmc/data/decay.py b/openmc/data/decay.py index 66acb2212..7cd4bf43d 100644 --- a/openmc/data/decay.py +++ b/openmc/data/decay.py @@ -1,4 +1,5 @@ from collections.abc import Iterable +from functools import cached_property from io import StringIO from math import log import re @@ -12,7 +13,7 @@ import openmc.checkvalue as cv from openmc.exceptions import DataError from openmc.mixin import EqualityMixin from openmc.stats import Discrete, Tabular, Univariate, combine_distributions -from .data import ATOMIC_SYMBOL, ATOMIC_NUMBER +from .data import ATOMIC_NUMBER, gnds_name from .function import INTERPOLATION_SCHEME from .endf import Evaluation, get_head_record, get_list_record, get_tab1_record @@ -125,9 +126,7 @@ class FissionProductYields(EqualityMixin): for j in range(n_products): Z, A = divmod(int(values[4*j]), 1000) isomeric_state = int(values[4*j + 1]) - name = ATOMIC_SYMBOL[Z] + str(A) - if isomeric_state > 0: - name += f'_m{isomeric_state}' + name = gnds_name(Z, A, isomeric_state) yield_j = ufloat(values[4*j + 2], values[4*j + 3]) yields[name] = yield_j @@ -255,10 +254,7 @@ class DecayMode(EqualityMixin): A += delta_A Z += delta_Z - if self._daughter_state > 0: - return f'{ATOMIC_SYMBOL[Z]}{A}_m{self._daughter_state}' - else: - return f'{ATOMIC_SYMBOL[Z]}{A}' + return gnds_name(Z, A, self._daughter_state) @property def parent(self): @@ -339,7 +335,6 @@ class Decay(EqualityMixin): self.modes = [] self.spectra = {} self.average_energies = {} - self._sources = None # Get head record items = get_head_record(file_obj) @@ -348,10 +343,7 @@ class Decay(EqualityMixin): self.nuclide['atomic_number'] = Z self.nuclide['mass_number'] = A self.nuclide['isomeric_state'] = metastable - if metastable > 0: - self.nuclide['name'] = f'{ATOMIC_SYMBOL[Z]}{A}_m{metastable}' - else: - self.nuclide['name'] = f'{ATOMIC_SYMBOL[Z]}{A}' + self.nuclide['name'] = gnds_name(Z, A, metastable) self.nuclide['mass'] = items[1] # AWR self.nuclide['excited_state'] = items[2] # State of the original nuclide self.nuclide['stable'] = (items[4] == 1) # Nucleus stability flag @@ -506,14 +498,9 @@ class Decay(EqualityMixin): """ return cls(ev_or_filename) - @property + @cached_property def sources(self): """Radioactive decay source distributions""" - # If property has been computed already, return it - # TODO: Replace with functools.cached_property when support is Python 3.9+ - if self._sources is not None: - return self._sources - sources = {} name = self.nuclide['name'] decay_constant = self.decay_constant.n @@ -571,8 +558,7 @@ class Decay(EqualityMixin): merged_sources[particle_type] = combine_distributions( dist_list, [1.0]*len(dist_list)) - self._sources = merged_sources - return self._sources + return merged_sources _DECAY_PHOTON_ENERGY = {} @@ -597,7 +583,7 @@ def decay_photon_energy(nuclide: str) -> Univariate | None: openmc.stats.Univariate or None Distribution of energies in [eV] of photons emitted from decay, or None if no photon source exists. Note that the probabilities represent - intensities, given as [Bq]. + intensities, given as [Bq/atom] (in other words, decay constants). """ if not _DECAY_PHOTON_ENERGY: chain_file = openmc.config.get('chain_file') diff --git a/openmc/data/effective_dose/dose.py b/openmc/data/effective_dose/dose.py index c7f458d1c..d49043b0a 100644 --- a/openmc/data/effective_dose/dose.py +++ b/openmc/data/effective_dose/dose.py @@ -82,7 +82,12 @@ def dose_coefficients(particle, geometry='AP', data_source='icrp116'): cv.check_value('data_source', data_source, {'icrp74', 'icrp116'}) if (data_source, particle) not in _FILES: - raise ValueError(f"{particle} has no dose data in data source {data_source}.") + available_particles = sorted({p for (ds, p) in _FILES if ds == data_source}) + msg = ( + f"'{particle}' has no dose data in data source {data_source}. " + f"Available particles for {data_source} are: {available_particles}" + ) + raise ValueError(msg) elif (data_source, particle) not in _DOSE_TABLES: _load_dose_icrp(data_source, particle) diff --git a/openmc/data/library.py b/openmc/data/library.py index a6ce1bbd3..b49757b0d 100644 --- a/openmc/data/library.py +++ b/openmc/data/library.py @@ -5,7 +5,7 @@ import h5py import lxml.etree as ET import openmc -from openmc._xml import clean_indentation, reorder_attributes +from openmc._xml import get_elem_list, get_text, clean_indentation class DataLibrary(list): @@ -132,7 +132,6 @@ class DataLibrary(list): clean_indentation(root) # Write XML file - reorder_attributes(root) # TODO: Remove when support is Python 3.8+ tree = ET.ElementTree(root) tree.write(str(path), xml_declaration=True, encoding='utf-8', method='xml') @@ -173,9 +172,9 @@ class DataLibrary(list): directory = os.path.dirname(path) for lib_element in root.findall('library'): - filename = os.path.join(directory, lib_element.attrib['path']) - filetype = lib_element.attrib['type'] - materials = lib_element.attrib['materials'].split() + filename = os.path.join(directory, get_text(lib_element, "path")) + filetype = get_text(lib_element, "type") + materials = get_elem_list(lib_element, "materials", str) or [] library = {'path': filename, 'type': filetype, 'materials': materials} data.libraries.append(library) @@ -183,7 +182,7 @@ class DataLibrary(list): # get depletion chain data dep_node = root.find("depletion_chain") if dep_node is not None: - filename = os.path.join(directory, dep_node.attrib['path']) + filename = os.path.join(directory, get_text(dep_node, "path")) library = {'path': filename, 'type': 'depletion_chain', 'materials': []} data.libraries.append(library) diff --git a/openmc/data/neutron.py b/openmc/data/neutron.py index 95a3424ea..71927cbed 100644 --- a/openmc/data/neutron.py +++ b/openmc/data/neutron.py @@ -11,7 +11,7 @@ import h5py from . import HDF5_VERSION, HDF5_VERSION_MAJOR from .ace import Library, Table, get_table, get_metadata -from .data import ATOMIC_SYMBOL, K_BOLTZMANN, EV_PER_MEV +from .data import ATOMIC_SYMBOL, K_BOLTZMANN, EV_PER_MEV, gnds_name from .endf import ( Evaluation, SUM_RULES, get_head_record, get_tab1_record, get_evaluations) from .fission_energy import FissionEnergyRelease @@ -678,11 +678,7 @@ class IncidentNeutron(EqualityMixin): temperature = ev.target['temperature'] # Determine name - element = ATOMIC_SYMBOL[atomic_number] - if metastable > 0: - name = f'{element}{mass_number}_m{metastable}' - else: - name = f'{element}{mass_number}' + name = gnds_name(atomic_number, mass_number, metastable) # Instantiate incident neutron data data = cls(name, atomic_number, mass_number, metastable, @@ -769,6 +765,11 @@ class IncidentNeutron(EqualityMixin): for table in lib.tables[1:]: data.add_temperature_from_ace(table) + # Use name based on ENDF evaluation. The name assigned by from_ace + # may be wrong for higher metastable states (e.g., Hf178_m2) + ev = evaluation if evaluation is not None else Evaluation(filename) + data.name = ev.gnds_name + # Add 0K elastic scattering cross section if '0K' not in data.energy: pendf = Evaluation(kwargs['pendf']) @@ -779,7 +780,6 @@ class IncidentNeutron(EqualityMixin): data[2].xs['0K'] = xs # Add fission energy release data - ev = evaluation if evaluation is not None else Evaluation(filename) if (1, 458) in ev.section: data.fission_energy = f = FissionEnergyRelease.from_endf(ev, data) else: diff --git a/openmc/data/njoy.py b/openmc/data/njoy.py index e025cff0d..ddc68cc37 100644 --- a/openmc/data/njoy.py +++ b/openmc/data/njoy.py @@ -15,19 +15,41 @@ import openmc.data # identifiers. ThermalTuple = namedtuple('ThermalTuple', ['name', 'zaids', 'nmix']) _THERMAL_DATA = { + 'c_Ag': ThermalTuple('ag', [47107, 47109], 1), 'c_Al27': ThermalTuple('al27', [13027], 1), 'c_Al_in_Al2O3': ThermalTuple('asap00', [13027], 1), + 'c_Al_in_Y3Al5O12': ThermalTuple('alyag', [13027], 1), + 'c_Au': ThermalTuple('au', [79197], 1), 'c_Be': ThermalTuple('be', [4009], 1), 'c_Be_distinct': ThermalTuple('besd', [4009], 1), 'c_Be_in_BeO': ThermalTuple('bebeo', [4009], 1), 'c_Be_in_Be2C': ThermalTuple('bebe2c', [4009], 1), 'c_Be_in_BeF2': ThermalTuple('bebef2', [4009], 1), 'c_Be_in_FLiBe': ThermalTuple('beflib', [4009], 1), + 'c_BeO': ThermalTuple('beo', [4009, 8016, 8017, 8018], 2), + 'c_Bi': ThermalTuple('bi', [83209], 1), + 'c_Bi_in_Ge3Bi4O12': ThermalTuple('bigbo', [83209], 1), 'c_C6H6': ThermalTuple('benz', [1001, 6000, 6012], 2), 'c_C_in_Be2C': ThermalTuple('cbe2c', [6000, 6012, 6013], 1), 'c_C_in_C5O2H8': ThermalTuple('clucit', [6000, 6012, 6013], 1), 'c_C_in_C8H8': ThermalTuple('cc8h8', [6000, 6012, 6013], 1), + 'c_C_in_C19H16_liquid': ThermalTuple('c19liq', [6000, 6012, 6013], 1), + 'c_C_in_C19H16_solid': ThermalTuple('c19sol', [6000, 6012, 6013], 1), + 'c_C_in_C2H6O_liquid': ThermalTuple('ethliq', [6000, 6012, 6013], 1), + 'c_C_in_C2H6O_solid': ThermalTuple('ethsol', [6000, 6012, 6013], 1), + 'c_C_in_C6H6_liquid': ThermalTuple('benzlq', [6000, 6012, 6013], 1), + 'c_C_in_C6H6_solid': ThermalTuple('benzsl', [6000, 6012, 6013], 1), + 'c_C_in_C7H8_liquid': ThermalTuple('tolliq', [6000, 6012, 6013], 1), + 'c_C_in_C7H8_solid': ThermalTuple('tolsol', [6000, 6012, 6013], 1), + 'c_C_in_C8H10_liquid': ThermalTuple('xylliq', [6000, 6012, 6013], 1), + 'c_C_in_C8H10_solid': ThermalTuple('xylsol', [6000, 6012, 6013], 1), + 'c_C_in_C9H12_liquid': ThermalTuple('mesliq', [6000, 6012, 6013], 1), + 'c_C_in_C9H12_solid': ThermalTuple('messol', [6000, 6012, 6013], 1), 'c_C_in_CF2': ThermalTuple('ccf2', [6000, 6012, 6013], 1), + 'c_C_in_CH2': ThermalTuple('cch2', [6000, 6012, 6013], 1), + 'c_C_in_CH4_liquid': ThermalTuple('cch4lq', [6000, 6012, 6013], 1), + 'c_C_in_CH4_solid': ThermalTuple('cch4sl', [6000, 6012, 6013], 1), + 'c_C_in_Diamond': ThermalTuple('cdiam', [6000, 6012, 6013], 1), 'c_C_in_SiC': ThermalTuple('csic', [6000, 6012, 6013], 1), 'c_C_in_UC_100p': ThermalTuple('cuc100', [6000, 6012, 6013], 1), 'c_C_in_UC_10p': ThermalTuple('cuc10', [6000, 6012, 6013], 1), @@ -36,16 +58,29 @@ _THERMAL_DATA = { 'c_C_in_UC_HALEU': ThermalTuple('cuchal', [6000, 6012, 6013], 1), 'c_C_in_UC_HEU': ThermalTuple('cucheu', [6000, 6012, 6013], 1), 'c_C_in_ZrC': ThermalTuple('czrc', [6000, 6012, 6013], 1), + 'c_Ca': ThermalTuple('ca', [20040, 20042, 20043, 20044, 20046, 20048], 1), 'c_Ca_in_CaH2': ThermalTuple('cacah2', [20040, 20042, 20043, 20044, 20046, 20048], 1), + 'c_Ca_in_CaO2H2': ThermalTuple('cacaoh', [20040, 20042, 20043, 20044, 20046, 20048], 1), + 'c_Cr': ThermalTuple('cr', [24050, 24052, 24053, 24054], 1), + 'c_Cu': ThermalTuple('cu', [29063, 29065], 1), 'c_D_in_7LiD': ThermalTuple('dlid', [1002], 1), 'c_D_in_D2O': ThermalTuple('dd2o', [1002], 1), 'c_D_in_D2O_solid': ThermalTuple('dice', [1002], 1), + 'c_D_in_MgD2': ThermalTuple('dmgd2', [1002], 1), 'c_F_in_Be2': ThermalTuple('fbef2', [9019], 1), 'c_F_in_CF2': ThermalTuple('fcf2', [9019], 1), 'c_F_in_FLiBe': ThermalTuple('fflibe', [9019], 1), 'c_F_in_HF': ThermalTuple('f_hf', [9019], 1), + 'c_F_in_LiF': ThermalTuple('flif', [9019], 1), 'c_F_in_MgF2': ThermalTuple('fmgf2', [9019], 1), 'c_Fe56': ThermalTuple('fe56', [26056], 1), + 'c_Fe_in_Fe_alpha': ThermalTuple('fealph', [26054, 26056, 26057, 26058], 1), + 'c_Fe_in_Fe_gamma': ThermalTuple('fegamm', [26054, 26056, 26057, 26058], 1), + 'c_Ga_in_GaN': ThermalTuple('gagan', [31069, 31071], 1), + 'c_Ga_in_GaSe': ThermalTuple('gagase', [31069, 31071], 1), + 'c_Ge': ThermalTuple('ge', [32070, 32072, 32073, 32074, 32076], 1), + 'c_Ge_in_Ge3Bi4O12': ThermalTuple('gegbo', [32070, 32072, 32073, 32074, 32076], 1), + 'c_Ge_in_GeTe': ThermalTuple('gegete', [32070, 32072, 32073, 32074, 32076], 1), 'c_Graphite': ThermalTuple('graph', [6000, 6012, 6013], 1), 'c_Graphite_10p': ThermalTuple('grph10', [6000, 6012, 6013], 1), 'c_Graphite_20p': ThermalTuple('grph20', [6000, 6012, 6013], 1), @@ -54,7 +89,20 @@ _THERMAL_DATA = { 'c_H_in_7LiH': ThermalTuple('hlih', [1001], 1), 'c_H_in_C5O2H8': ThermalTuple('lucite', [1001], 1), 'c_H_in_C8H8': ThermalTuple('hc8h8', [1001], 1), + 'c_H_in_C19H16_liquid': ThermalTuple('h19liq', [1001], 1), + 'c_H_in_C19H16_solid': ThermalTuple('h19sol', [1001], 1), + 'c_H_in_C2H6O_liquid': ThermalTuple('hetliq', [1001], 1), + 'c_H_in_C2H6O_solid': ThermalTuple('hetsol', [1001], 1), + 'c_H_in_C6H6_liquid': ThermalTuple('hbzliq', [1001], 1), + 'c_H_in_C6H6_solid': ThermalTuple('hbzsol', [1001], 1), + 'c_H_in_C7H8_liquid': ThermalTuple('htlliq', [1001], 1), + 'c_H_in_C7H8_solid': ThermalTuple('htlsol', [1001], 1), + 'c_H_in_C8H10_liquid': ThermalTuple('hxyliq', [1001], 1), + 'c_H_in_C8H10_solid': ThermalTuple('hxysol', [1001], 1), + 'c_H_in_C9H12_liquid': ThermalTuple('hmsliq', [1001], 1), + 'c_H_in_C9H12_solid': ThermalTuple('hmssol', [1001], 1), 'c_H_in_CaH2': ThermalTuple('hcah2', [1001], 1), + 'c_H_in_CaO2H2': ThermalTuple('hcaoh', [1001], 1), 'c_H1_in_CaH2': ThermalTuple('h1cah2', [1001], 1), 'c_H2_in_CaH2': ThermalTuple('h2cah2', [1001], 1), 'c_H_in_CH2': ThermalTuple('hch2', [1001], 1), @@ -64,32 +112,64 @@ _THERMAL_DATA = { 'c_H_in_H2O': ThermalTuple('hh2o', [1001], 1), 'c_H_in_H2O_solid': ThermalTuple('hice', [1001], 1), 'c_H_in_HF': ThermalTuple('hhf', [1001], 1), + 'c_H_in_KOH': ThermalTuple('hkoh', [1001], 1), + 'c_H_in_LiH': ThermalTuple('hlih2', [1001], 1), 'c_H_in_Mesitylene': ThermalTuple('mesi00', [1001], 1), 'c_H_in_ParaffinicOil': ThermalTuple('hparaf', [1001], 1), 'c_H_in_Toluene': ThermalTuple('tol00', [1001], 1), + 'c_H_in_MgH2': ThermalTuple('hmgh2', [1001], 1), + 'c_H_in_MgOH2': ThermalTuple('hmgoh', [1001], 1), + 'c_H_in_NaMgH3': ThermalTuple('hnamg', [1001], 1), + 'c_H_in_NaOH': ThermalTuple('hnaoh', [1001], 1), + 'c_H_in_SrH2': ThermalTuple('hsrh2', [1001], 1), 'c_H_in_UH3': ThermalTuple('huh3', [1001], 1), 'c_H_in_YH2': ThermalTuple('hyh2', [1001], 1), 'c_H_in_ZrH': ThermalTuple('hzrh', [1001], 1), 'c_H_in_ZrH2': ThermalTuple('hzrh2', [1001], 1), 'c_H_in_ZrHx': ThermalTuple('hzrhx', [1001], 1), + 'c_I_in_NaI': ThermalTuple('inai', [53127], 1), + 'c_K': ThermalTuple('k', [19039, 19040, 19041], 1), + 'c_K_in_KOH': ThermalTuple('kkoh', [19039, 19040, 19041], 1), 'c_Li_in_FLiBe': ThermalTuple('liflib', [3006, 3007], 1), 'c_Li_in_7LiD': ThermalTuple('lilid', [3007], 1), 'c_Li_in_7LiH': ThermalTuple('lilih', [3007], 1), + 'c_Li_in_LiF': ThermalTuple('lilif', [3006, 3007], 1), + 'c_Li_in_LiH': ThermalTuple('lilih2', [3006, 3007], 1), 'c_Mg24': ThermalTuple('mg24', [12024], 1), 'c_Mg_in_MgF2': ThermalTuple('mgmgf2', [12024, 12025, 12026], 1), 'c_Mg_in_MgO': ThermalTuple('mgmgo', [12024, 12025, 12026], 1), + 'c_Mg_in_MgD2': ThermalTuple('mgmgd2', [12024, 12025, 12026], 1), + 'c_Mg_in_MgH2': ThermalTuple('mgmgh2', [12024, 12025, 12026], 1), + 'c_Mg_in_MgOH2': ThermalTuple('mgoh2', [12024, 12025, 12026], 1), + 'c_Mg_in_NaMgH3': ThermalTuple('mgnamg', [12024, 12025, 12026], 1), + 'c_Mo': ThermalTuple('mo', [42092, 42094, 42095, 42096, 42097, 42098, 42100], 1), + 'c_N_in_GaN': ThermalTuple('ngan', [7014, 7015], 1), 'c_N_in_UN_100p': ThermalTuple('nun100', [7014, 7015], 1), 'c_N_in_UN_10p': ThermalTuple('nun10', [7014, 7015], 1), 'c_N_in_UN_5p': ThermalTuple('nun5', [7014, 7015], 1), 'c_N_in_UN': ThermalTuple('n-un', [7014, 7015], 1), 'c_N_in_UN_HALEU': ThermalTuple('nunhal', [7014, 7015], 1), 'c_N_in_UN_HEU': ThermalTuple('nunheu', [7014, 7015], 1), + 'c_Na': ThermalTuple('na', [11023], 1), + 'c_Na_in_NaI': ThermalTuple('nanai', [11023], 1), + 'c_Na_in_NaMgH3': ThermalTuple('nanamg', [11023], 1), + 'c_Na_in_NaOH': ThermalTuple('nanaoh', [11023], 1), + 'c_Nb': ThermalTuple('nb', [41093], 1), + 'c_Ni': ThermalTuple('ni', [28058, 28060, 28061, 28062, 28064], 1), 'c_O_in_Al2O3': ThermalTuple('osap00', [8016, 8017, 8018], 1), 'c_O_in_BeO': ThermalTuple('obeo', [8016, 8017, 8018], 1), 'c_O_in_C5O2H8': ThermalTuple('olucit', [8016, 8017, 8018], 1), + 'c_O_in_C2H6O_liquid': ThermalTuple('oetliq', [8016, 8017, 8018], 1), + 'c_O_in_C2H6O_solid': ThermalTuple('oetsol', [8016, 8017, 8018], 1), + 'c_O_in_CaO2H2': ThermalTuple('ocaoh', [8016, 8017, 8018], 1), 'c_O_in_D2O': ThermalTuple('od2o', [8016, 8017, 8018], 1), 'c_O_in_H2O_solid': ThermalTuple('oice', [8016, 8017, 8018], 1), 'c_O_in_MgO': ThermalTuple('omgo', [8016, 8017, 8018], 1), + 'c_O_in_Ge3Bi4O12': ThermalTuple('ogbo', [8016, 8017, 8018], 1), + 'c_O_in_H2O': ThermalTuple('oh2o', [8016, 8017, 8018], 1), + 'c_O_in_KOH': ThermalTuple('okoh', [8016, 8017, 8018], 1), + 'c_O_in_MgOH2': ThermalTuple('omgoh', [8016, 8017, 8018], 1), + 'c_O_in_NaOH': ThermalTuple('onaoh', [8016, 8017, 8018], 1), 'c_O_in_PuO2': ThermalTuple('opuo2', [8016, 8017, 8018], 1), 'c_O_in_SiO2_alpha': ThermalTuple('osio2a', [8016, 8017, 8018], 1), 'c_O_in_UO2_100p': ThermalTuple('ouo200', [8016, 8017, 8018], 1), @@ -98,16 +178,26 @@ _THERMAL_DATA = { 'c_O_in_UO2': ThermalTuple('ouo2', [8016, 8017, 8018], 1), 'c_O_in_UO2_HALEU': ThermalTuple('ouo2hl', [8016, 8017, 8018], 1), 'c_O_in_UO2_HEU': ThermalTuple('ouo2he', [8016, 8017, 8018], 1), + 'c_O_in_Y3Al5O12': ThermalTuple('oyag', [8016, 8017, 8018], 1), 'c_ortho_D': ThermalTuple('orthod', [1002], 1), 'c_ortho_H': ThermalTuple('orthoh', [1001], 1), 'c_para_D': ThermalTuple('parad', [1002], 1), 'c_para_H': ThermalTuple('parah', [1001], 1), + 'c_Pb': ThermalTuple('pb', [82204, 82206, 82207, 82208], 1), + 'c_Pd': ThermalTuple('pd', [46102, 46104, 46105, 46106, 46108, 46110], 1), + 'c_Pt': ThermalTuple('pt', [78190, 78192, 78194, 78195, 78196, 78198], 1), 'c_Pu_in_PuO2': ThermalTuple('puo2', [94239, 94240, 94241, 94242, 94243], 1), 'c_Si28': ThermalTuple('si00', [14028], 1), 'c_Si_in_SiC': ThermalTuple('sisic', [14028, 14029, 14030], 1), 'c_Si_in_SiO2_alpha': ThermalTuple('si_o2a', [14028, 14029, 14030], 1), 'c_SiO2_alpha': ThermalTuple('sio2-a', [8016, 8017, 8018, 14028, 14029, 14030], 3), 'c_SiO2_beta': ThermalTuple('sio2-b', [8016, 8017, 8018, 14028, 14029, 14030], 3), + 'c_S_in_ZnS': ThermalTuple('szns', [16032, 16033, 16034, 16036], 1), + 'c_Se_in_GaSe': ThermalTuple('segase', [34074, 34076, 34077, 34078, 34080, 34082], 1), + 'c_Sn': ThermalTuple('sn', [50112, 50114, 50115, 50116, 50117, 50118, 50119, 50120, 50122, 50124], 1), + 'c_Sr_in_SrH2': ThermalTuple('srsrh2', [38084, 38086, 38087, 38088], 1), + 'c_Te_in_GeTe': ThermalTuple('tegete', [52120, 52122, 52123, 52124, 52125, 52126, 52128, 52130], 1), + 'c_Ti': ThermalTuple('ti', [22046, 22047, 22048, 22049, 22050], 1), 'c_U_metal_100p': ThermalTuple('u-100p', [92233, 92234, 92235, 92236, 92238], 1), 'c_U_metal_10p': ThermalTuple('u-10p', [92233, 92234, 92235, 92236, 92238], 1), 'c_U_metal_5p': ThermalTuple('u-5p', [92233, 92234, 92235, 92236, 92238], 1), @@ -132,7 +222,13 @@ _THERMAL_DATA = { 'c_U_in_UO2': ThermalTuple('uuo2', [92233, 92234, 92235, 92236, 92238], 1), 'c_U_in_UO2_HALEU': ThermalTuple('uo2hal', [92233, 92234, 92235, 92236, 92238], 1), 'c_U_in_UO2_HEU': ThermalTuple('uo2heu', [92233, 92234, 92235, 92236, 92238], 1), + 'c_V': ThermalTuple('v', [23050, 23051], 1), + 'c_W': ThermalTuple('w', [74180, 74182, 74183, 74184, 74186], 1), + 'c_Y_in_Y3Al5O12': ThermalTuple('yyag', [39089], 1), 'c_Y_in_YH2': ThermalTuple('yyh2', [39089], 1), + 'c_Zn': ThermalTuple('zn', [30064, 30066, 30067, 30068, 30070], 1), + 'c_Zn_in_ZnS': ThermalTuple('znzns', [30064, 30066, 30067, 30068, 30070], 1), + 'c_Zr': ThermalTuple('zr', [40090, 40091, 40092, 40094, 40096], 1), 'c_Zr_in_ZrC': ThermalTuple('zrzrc', [40000, 40090, 40091, 40092, 40094, 40096], 1), 'c_Zr_in_ZrH': ThermalTuple('zrzrh', [40000, 40090, 40091, 40092, 40094, 40096], 1), 'c_Zr_in_ZrH2': ThermalTuple('zrzrh2', [40000, 40090, 40091, 40092, 40094, 40096], 1), @@ -201,12 +297,12 @@ acer / %%%%%%%%%%%%%%%%%%%%%%%% Write out in ACE format %%%%%%%%%%%%%%%%%%%%%%%% _THERMAL_TEMPLATE_THERMR = """ thermr / %%%%%%%%%%%%%%%% Add thermal scattering data (free gas) %%%%%%%%%%%%%%% 0 {nthermr1_in} {nthermr1} -0 {mat} 12 {num_temp} 1 0 {iform} 1 221 1/ +0 {mat} {nbin} {num_temp} 1 0 {iform} 1 221 1/ {temps} {error} {energy_max} thermr / %%%%%%%%%%%%%%%% Add thermal scattering data (bound) %%%%%%%%%%%%%%%%%% {nthermal_endf} {nthermr2_in} {nthermr2} -{mat_thermal} {mat} 16 {num_temp} {inelastic} {elastic} {iform} {natom} 222 1/ +{mat_thermal} {mat} {nbin} {num_temp} {inelastic} {elastic} {iform} {natom} 222 1/ {temps} {error} {energy_max} """ @@ -495,7 +591,7 @@ def make_ace(filename, temperatures=None, acer=True, xsdir=None, def make_ace_thermal(filename, filename_thermal, temperatures=None, ace=None, xsdir=None, output_dir=None, error=0.001, iwt=2, evaluation=None, evaluation_thermal=None, - table_name=None, zaids=None, nmix=None, **kwargs): + table_name=None, zaids=None, nmix=None, nbin=16, **kwargs): """Generate thermal scattering ACE file from ENDF files Parameters @@ -532,6 +628,8 @@ def make_ace_thermal(filename, filename_thermal, temperatures=None, ZAIDs that the thermal scattering data applies to nmix : int, optional Number of atom types in mixed moderator + nbin : int, optional + Number of equi-probable angles **kwargs Keyword arguments passed to :func:`openmc.data.njoy.run` @@ -563,7 +661,7 @@ def make_ace_thermal(filename, filename_thermal, temperatures=None, else: with warnings.catch_warnings(record=True) as w: proper_name = openmc.data.get_thermal_name(zsymam_thermal) - if w: + if w or proper_name not in _THERMAL_DATA: raise RuntimeError( f"Thermal scattering material {zsymam_thermal} not " "recognized. Please contact OpenMC developers at " diff --git a/openmc/data/thermal.py b/openmc/data/thermal.py index 4ecc7c040..54e3a7330 100644 --- a/openmc/data/thermal.py +++ b/openmc/data/thermal.py @@ -27,20 +27,41 @@ from .thermal_angle_energy import (CoherentElasticAE, IncoherentElasticAE, _THERMAL_NAMES = { + 'c_Ag': ('ag',), 'c_Al27': ('al', 'al27', 'al-27', '13-al- 27'), 'c_Al_in_Al2O3': ('asap00', 'asap', 'al(al2o3)'), - 'c_Be': ('be', 'be-metal', 'be-met', 'be00', 'be-metal', 'be metal', '4-be'), + 'c_Al_in_Y3Al5O12': ('al(y3al5o1', 'alyag'), + 'c_Au': ('au',), + 'c_Be': ('be', 'be-metal', 'be-met', 'be00', 'be-metal', 'be metal', '4-be', '4-be-'), 'c_BeO': ('beo',), 'c_Be_distinct': ('besd', 'be+sd'), 'c_Be_in_BeO': ('bebeo', 'be-beo', 'be-o', 'be/o', 'bbeo00', 'be(beo)', 'be_beo'), 'c_Be_in_Be2C': ('bebe2c', 'be(be2c)'), 'c_Be_in_BeF2': ('bebef2', 'be in bef2'), 'c_Be_in_FLiBe': ('beflib', 'be(flibe)'), + 'c_Bi': ('83-bi-', 'bi'), + 'c_Bi_in_Ge3Bi4O12': ('bi(ge3bi4o', 'bigbo'), 'c_C6H6': ('benz', 'c6h6', 'benzine'), 'c_C_in_Be2C': ('cbe2c', 'c(be2c)'), + 'c_C_in_C19H16_liquid': ('c(c19h16)l', 'c19liq'), + 'c_C_in_C19H16_solid': ('c(c19h16)s', 'c19sol'), + 'c_C_in_C2H6O_liquid': ('c(c2h6o)l', 'ethliq'), + 'c_C_in_C2H6O_solid': ('c(c2h6o)s', 'ethsol'), 'c_C_in_C5O2H8': ('clucit', 'c(lucite)'), + 'c_C_in_C6H6_liquid': ('c(c6h6)l', 'benzlq'), + 'c_C_in_C6H6_solid': ('c(c6h6)s', 'benzsl'), + 'c_C_in_C7H8_liquid': ('c(c7h8)l', 'tolliq'), + 'c_C_in_C7H8_solid': ('c(c7h8)s', 'tolsol'), 'c_C_in_C8H8': ('cc8h8', 'c(polystyr'), + 'c_C_in_C8H10_liquid': ('c(m-c8h10)l', 'xylliq'), + 'c_C_in_C8H10_solid': ('c(m-c8h10)s', 'xylsol'), + 'c_C_in_C9H12_liquid': ('c(c9h12)l', 'mesliq'), + 'c_C_in_C9H12_solid': ('c(c9h12)s', 'messol'), 'c_C_in_CF2': ('ccf2', 'c(teflon)'), + 'c_C_in_CH2': ('c(c2h4)n r', 'cch2'), + 'c_C_in_CH4_liquid': ('c(ch4)l', 'cch4lq'), + 'c_C_in_CH4_solid': ('c(ch4)s', 'cch4sl'), + 'c_C_in_Diamond': ('c(c-diamon', 'cdiam'), 'c_C_in_SiC': ('csic', 'c-sic', 'c(3c-sic)', 'c_sic'), 'c_C_in_UC_100p': ('cuc100', 'cinuc_100p'), 'c_C_in_UC_10p': ('cuc10', 'cinuc_10p'), @@ -49,16 +70,29 @@ _THERMAL_NAMES = { 'c_C_in_UC_HALEU': ('cuchal', 'cinuc_haleu'), 'c_C_in_UC_HEU': ('cucheu', 'cinuc_heu'), 'c_C_in_ZrC': ('czrc', 'c(zrc)'), + 'c_Ca': ('ca',), 'c_Ca_in_CaH2': ('cah', 'cah00', 'cacah2', 'ca(cah2)', 'ca_cah2'), + 'c_Ca_in_CaO2H2': ('ca(caoh2)', 'cacaoh'), + 'c_Cr': ('cr',), + 'c_Cu': ('cu',), 'c_D_in_7LiD': ('dlid', 'd(7lid)'), 'c_D_in_D2O': ('dd2o', 'd-d2o', 'hwtr', 'hw', 'dhw00', 'd(d2o)'), 'c_D_in_D2O_solid': ('dice',), + 'c_D_in_MgD2': ('d(mgd2)', 'dmgd2'), 'c_F_in_Be2': ('fbef2', 'f in bef2'), 'c_F_in_CF2': ('fcf2', 'f(teflon)'), 'c_F_in_FLiBe': ('fflibe', 'f(flibe)'), 'c_F_in_HF': ('f_hf',), + 'c_F_in_LiF': ('f(lif)', 'flif'), 'c_F_in_MgF2': ('fmgf2', 'f in mgf2'), 'c_Fe56': ('fe', 'fe56', 'fe-56', '26-fe- 56'), + 'c_Fe_in_Fe_alpha': ('fe(fe-alph', 'fealph'), + 'c_Fe_in_Fe_gamma': ('fe(fe-gamm', 'fegamm'), + 'c_Ga_in_GaN': ('ga(gan)', 'gagan'), + 'c_Ga_in_GaSe': ('ga(gase)', 'gagase'), + 'c_Ge': ('ge',), + 'c_Ge_in_Ge3Bi4O12': ('ge(ge3bi4o', 'gegbo'), + 'c_Ge_in_GeTe': ('ge(gete)', 'gegete'), 'c_Graphite': ('graph', 'grph', 'gr', 'gr00', 'graphite'), 'c_Graphite_10p': ('grph10', '10p graphit'), 'c_Graphite_20p': ('grph20', '20 graphite'), @@ -68,41 +102,86 @@ _THERMAL_NAMES = { 'c_H_in_C5O2H8': ('lucite', 'c5o2h8', 'h-luci', 'h(lucite)'), 'c_H_in_C8H8': ('hc8h8', 'h(polystyr'), 'c_H_in_CaH2': ('hcah2', 'hca00', 'h(cah2)'), + 'c_H_in_CaO2H2': ('h(caoh2)', 'hcaoh'), 'c_H1_in_CaH2': ('h1cah2', 'h1_cah2'), 'c_H2_in_CaH2': ('h2cah2', 'h2_cah2'), - 'c_H_in_CH2': ('hch2', 'poly', 'pol', 'h-poly', 'pol00', 'h(ch2)'), - 'c_H_in_CH4_liquid': ('lch4', 'lmeth', 'l-ch4'), - 'c_H_in_CH4_solid': ('sch4', 'smeth', 's-ch4'), + 'c_H_in_C19H16_liquid': ('h(c19h16)l', 'h19liq'), + 'c_H_in_C19H16_solid': ('h(c19h16)s', 'h19sol'), + 'c_H_in_C2H6O_liquid': ('h(c2h6o)l', 'hetliq'), + 'c_H_in_C2H6O_solid': ('h(c2h6o)s', 'hetsol'), + 'c_H_in_C6H6_liquid': ('h(c6h6)l', 'hbzliq'), + 'c_H_in_C6H6_solid': ('h(c6h6)s', 'hbzsol'), + 'c_H_in_C7H8_liquid': ('h(c7h8)l', 'htlliq'), + 'c_H_in_C7H8_solid': ('h(c7h8)s', 'htlsol'), + 'c_H_in_C8H10_liquid': ('h(m-c8h10)l', 'hxyliq'), + 'c_H_in_C8H10_solid': ('h(m-c8h10)s', 'hxysol'), + 'c_H_in_C9H12_liquid': ('h(c9h12)l', 'hmsliq'), + 'c_H_in_C9H12_solid': ('h(c9h12)s', 'hmssol'), + 'c_H_in_CH2': ('hch2', 'poly', 'pol', 'h-poly', 'pol00', 'h(ch2)', 'h(c2h4)n r'), + 'c_H_in_CH4_liquid': ('lch4', 'lmeth', 'l-ch4', 'h(ch4)l'), + 'c_H_in_CH4_solid': ('sch4', 'smeth', 's-ch4', 'h(ch4)s'), 'c_H_in_CH4_solid_phase_II': ('sch4p2',), 'c_H_in_H2O': ('hh2o', 'h-h2o', 'lwtr', 'lw', 'lw00', 'h(h2o)'), 'c_H_in_H2O_solid': ('hice', 'h-ice', 'ice00', 'h(ice-ih)', 'h(ice)'), 'c_H_in_HF': ('hhf', 'h(hf)', 'h_hf'), + 'c_H_in_KOH': ('h(koh)', 'hkoh'), + 'c_H_in_LiH': ('h(lih)', 'hlih2'), 'c_H_in_Mesitylene': ('mesi00', 'mesi', 'mesi-phii'), + 'c_H_in_MgH2': ('h(mgh2)', 'hmgh2'), + 'c_H_in_MgOH2': ('h(mgoh2)', 'hmgoh'), + 'c_H_in_NaMgH3': ('h(namgh3)', 'hnamg'), + 'c_H_in_NaOH': ('h(naoh)', 'hnaoh'), 'c_H_in_ParaffinicOil': ('hparaf', 'h(paraffin', 'h(paraffini'), + 'c_H_in_SrH2': ('h(srh2)', 'hsrh2'), 'c_H_in_Toluene': ('tol00', 'tol', 'tolue-phii'), 'c_H_in_UH3': ('huh3', 'h(uh3)'), 'c_H_in_YH2': ('hyh2', 'h-yh2', 'h(yh2)'), 'c_H_in_ZrH': ('hzrh', 'h-zrh', 'h-zr', 'h/zr', 'hzr', 'hzr00', 'h(zrh)'), - 'c_H_in_ZrH2': ('hzrh2', 'h(zrh2)'), - 'c_H_in_ZrHx': ('hzrhx', 'h(zrhx)'), + 'c_H_in_ZrH2': ('hzrh2', 'h(zrh2)', 'h(zrh2) in'), + 'c_H_in_ZrHx': ('hzrhx', 'h(zrhx)', 'h(zrh15) i'), + 'c_I_in_NaI': ('i(nai)', 'inai'), + 'c_K': ('k',), + 'c_K_in_KOH': ('k(koh)', 'kkoh'), 'c_Li_in_FLiBe': ('liflib', 'li(flibe)'), 'c_Li_in_7LiD': ('lilid', '7li(7lid)'), 'c_Li_in_7LiH': ('lilih', '7li(7lih)'), + 'c_Li_in_LiF': ('li(lif)', 'lilif'), + 'c_Li_in_LiH': ('li(lih)', 'lilih2'), 'c_Mg24': ('mg', 'mg24', 'mg00', '24-mg'), + 'c_Mg_in_MgD2': ('mg(mgd2)', 'mgmgd2'), 'c_Mg_in_MgF2': ('mgmgf2', 'mg in mgf2'), + 'c_Mg_in_MgH2': ('mg(mgh2)', 'mgmgh2'), 'c_Mg_in_MgO': ('mgmgo', 'mg in mgo'), + 'c_Mg_in_MgOH2': ('mg(mgoh2)', 'mgoh2'), + 'c_Mg_in_NaMgH3': ('mg(namgh3)', 'mgnamg'), + 'c_Mo': ('mo',), + 'c_N_in_GaN': ('n(gan)', 'ngan'), 'c_N_in_UN_100p': ('nun100', 'n-un-100p'), 'c_N_in_UN_10p': ('nun10', 'n-un-10p'), 'c_N_in_UN_5p': ('nun5', 'n-un-5p'), 'c_N_in_UN': ('n-un', 'n(un)', 'n(un) l', 'ninun'), 'c_N_in_UN_HALEU': ('nunhal', 'n-un-haleu'), 'c_N_in_UN_HEU': ('nunheu', 'n-un-heu'), + 'c_Na': ('na',), + 'c_Na_in_NaI': ('na(nai)', 'nanai'), + 'c_Na_in_NaMgH3': ('na(namgh3)', 'nanamg'), + 'c_Na_in_NaOH': ('na(naoh)', 'nanaoh'), + 'c_Nb': ('nb',), + 'c_Ni': ('ni',), 'c_O_in_Al2O3': ('osap00', 'osap', 'o(al2o3)'), 'c_O_in_BeO': ('obeo', 'o-beo', 'o-be', 'o/be', 'obeo00', 'o(beo)', 'o_beo'), + 'c_O_in_C2H6O_liquid': ('o(c2h6o)l', 'oetliq'), + 'c_O_in_C2H6O_solid': ('o(c2h6o)s', 'oetsol'), 'c_O_in_C5O2H8': ('olucit', 'o(lucite)'), + 'c_O_in_CaO2H2': ('o(caoh2)', 'ocaoh'), 'c_O_in_D2O': ('od2o', 'o-d2o', 'ohw00', 'o(d2o)'), + 'c_O_in_H2O': ('o(h2o)', 'oh2o'), 'c_O_in_H2O_solid': ('oice', 'o-ice', 'o(ice-ih)'), + 'c_O_in_Ge3Bi4O12': ('o(ge3bi4o1', 'ogbo'), + 'c_O_in_KOH': ('o(koh)', 'okoh'), 'c_O_in_MgO': ('omgo', 'o in mgo'), + 'c_O_in_MgOH2': ('o(mgoh2)', 'omgoh'), + 'c_O_in_NaOH': ('o(naoh)', 'onaoh'), 'c_O_in_PuO2': ('opuo2', 'o in puo2'), 'c_O_in_SiO2_alpha': ('osio2a', 'o_sio2a'), 'c_O_in_UO2_100p': ('ouo200', 'o-uo2-100p'), @@ -111,16 +190,26 @@ _THERMAL_NAMES = { 'c_O_in_UO2': ('ouo2', 'o-uo2', 'o2-u', 'o2/u', 'ouo200', 'o(uo2)'), 'c_O_in_UO2_HALEU': ('ouo2hl', 'ouo2-haleu'), 'c_O_in_UO2_HEU': ('ouo2he', 'o_uo2-heu'), + 'c_O_in_Y3Al5O12': ('o(y3al5o12', 'oyag'), 'c_ortho_D': ('orthod', 'orthoD', 'dortho', 'od200', 'ortod', 'ortho-d'), 'c_ortho_H': ('orthoh', 'orthoH', 'hortho', 'oh200', 'ortoh', 'ortho-h'), 'c_para_D': ('parad', 'paraD', 'dpara', 'pd200', 'para-d'), 'c_para_H': ('parah', 'paraH', 'hpara', 'ph200', 'para-h'), + 'c_Pb': ('pb',), + 'c_Pd': ('pd',), + 'c_Pt': ('pt',), 'c_Pu_in_PuO2': ('puo2', 'pu in puo2'), 'c_Si28': ('si00', 'sili', 'si'), 'c_Si_in_SiC': ('sisic', 'si-sic', 'si(3c-sic)', 'si_sic'), 'c_Si_in_SiO2_alpha': ('si_o2a', 'si_sio2a'), - 'c_SiO2_alpha': ('sio2', 'sio2a', 'sio2alpha'), - 'c_SiO2_beta': ('sio2b', 'sio2beta'), + 'c_SiO2_alpha': ('sio2', 'sio2a', 'sio2alpha', 'sio2-a'), + 'c_SiO2_beta': ('sio2b', 'sio2beta', 'sio2-b'), + 'c_S_in_ZnS': ('s(zns-spha', 'szns'), + 'c_Se_in_GaSe': ('se(gase)', 'segase'), + 'c_Sn': ('sn',), + 'c_Sr_in_SrH2': ('sr(srh2)', 'srsrh2'), + 'c_Te_in_GeTe': ('te(gete)', 'tegete'), + 'c_Ti': ('ti',), 'c_U_metal_100p': ('u-100p',), 'c_U_metal_10p': ('u-10p',), 'c_U_metal_5p': ('u-5p',), @@ -145,11 +234,17 @@ _THERMAL_NAMES = { 'c_U_in_UO2': ('uuo2', 'u-uo2', 'u-o2', 'u/o2', 'uuo200', 'u(uo2)'), 'c_U_in_UO2_HALEU': ('uo2hal', 'uuo2-haleu'), 'c_U_in_UO2_HEU': ('uo2heu', 'u_uo2-heu'), + 'c_V': ('v',), + 'c_W': ('w',), + 'c_Y_in_Y3Al5O12': ('y(y3al5o12', 'yyag'), 'c_Y_in_YH2': ('yyh2', 'y-yh2', 'y(yh2)'), + 'c_Zn': ('zn',), + 'c_Zn_in_ZnS': ('zn(zns-sph', 'znzns'), + 'c_Zr': ('zr',), 'c_Zr_in_ZrC': ('zrzrc', 'zr(zrc)'), 'c_Zr_in_ZrH': ('zrzrh', 'zr-zrh', 'zr-h', 'zr/h', 'zr(zrh)'), - 'c_Zr_in_ZrH2': ('zrzrh2', 'zr(zrh2)'), - 'c_Zr_in_ZrHx': ('zrzrhx', 'zr(zrhx)'), + 'c_Zr_in_ZrH2': ('zrzrh2', 'zr(zrh2)', 'zr(zrh2) i'), + 'c_Zr_in_ZrHx': ('zrzrhx', 'zr(zrhx)', 'zr(zrh15)'), } diff --git a/openmc/deplete/__init__.py b/openmc/deplete/__init__.py index 5e0063c90..9b6e0cc6c 100644 --- a/openmc/deplete/__init__.py +++ b/openmc/deplete/__init__.py @@ -18,6 +18,7 @@ from .results import * from .integrators import * from .transfer_rates import * from .reactivity_control import * +from .r2s import * from . import abc from . import cram from . import helpers diff --git a/openmc/deplete/abc.py b/openmc/deplete/abc.py index 170ddbeb6..9108396f1 100644 --- a/openmc/deplete/abc.py +++ b/openmc/deplete/abc.py @@ -12,6 +12,7 @@ from copy import deepcopy from inspect import signature from numbers import Real, Integral from pathlib import Path +from textwrap import dedent import time from typing import Optional, Union, Sequence from warnings import warn @@ -22,21 +23,22 @@ from uncertainties import ufloat from openmc.checkvalue import check_value, check_type, check_greater_than, PathLike from openmc.mpi import comm from openmc.utility_funcs import change_directory -from openmc import Material +from openmc import Material, Cell from .stepresult import StepResult -from .chain import Chain +from .chain import _get_chain from .results import Results, _SECONDS_PER_MINUTE, _SECONDS_PER_HOUR, \ _SECONDS_PER_DAY, _SECONDS_PER_JULIAN_YEAR from .pool import deplete from .reaction_rates import ReactionRates -from .transfer_rates import TransferRates -from openmc import Material, Cell +from .transfer_rates import TransferRates, ExternalSourceRates from .reactivity_control import ( ReactivityController, CellReactivityController, MaterialReactivityController ) + + __all__ = [ "OperatorResult", "TransportOperator", "ReactionRateHelper", "NormalizationHelper", "FissionYieldHelper", @@ -131,8 +133,8 @@ class TransportOperator(ABC): Parameters ---------- - chain_file : str - Path to the depletion chain XML file + chain_file : PathLike or Chain + Path to the depletion chain XML file or instance of openmc.deplete.Chain. fission_q : dict, optional Dictionary of nuclides and their fission Q values [eV]. If not given, values will be pulled from the ``chain_file``. @@ -150,11 +152,12 @@ class TransportOperator(ABC): The depletion chain information necessary to form matrices and tallies. """ - def __init__(self, chain_file, fission_q=None, prev_results=None): + def __init__(self, chain_file=None, fission_q=None, prev_results=None): self.output_dir = '.' # Read depletion chain - self.chain = Chain.from_xml(chain_file, fission_q) + self.chain = _get_chain(chain_file, fission_q) + if prev_results is None: self.prev_res = None else: @@ -530,7 +533,7 @@ class Integrator(ABC): r"""Abstract class for solving the time-integration for depletion """ - _params = r""" + _params = dedent(r""" Parameters ---------- operator : openmc.deplete.abc.TransportOperator @@ -603,7 +606,7 @@ class Integrator(ABC): User-supplied functions are expected to have the following signature: ``solver(A, n0, t) -> n1`` where - * ``A`` is a :class:`scipy.sparse.csc_matrix` making up the + * ``A`` is a :class:`scipy.sparse.csc_array` making up the depletion matrix * ``n0`` is a 1-D :class:`numpy.ndarray` of initial compositions for a given material in atoms/cm3 @@ -612,14 +615,23 @@ class Integrator(ABC): next time step. Expected to be of the same shape as ``n0`` transfer_rates : openmc.deplete.TransferRates - Instance of TransferRates class to perform continuous transfer during depletion + Transfer rates for the depletion system used to model continuous + removal/feed between materials. + + .. versionadded:: 0.14.0 + external_source_rates : openmc.deplete.ExternalSourceRates + External source rates for the depletion system. + + .. versionadded:: 0.15.3 reactivity_control : openmc.deplete.ReactivityController Instance of ReactivityController class to perform reactivity control during transport-depletion simulation. + Transfer rates for the depletion system used to model continuous + removal/feed between materials. - .. versionadded:: 0.14.0 + .. versionadded:: 0.15.4 - """ + """) def __init__( self, @@ -632,17 +644,7 @@ class Integrator(ABC): solver: str = "cram48", continue_timesteps: bool = False, ): - # Check number of stages previously used - if operator.prev_res is not None: - res = operator.prev_res[-1] - if res.data.shape[0] != self._num_stages: - raise ValueError( - "{} incompatible with previous restart calculation. " - "Previous scheme used {} intermediate solutions, while " - "this uses {}".format( - self.__class__.__name__, res.data.shape[0], - self._num_stages)) - elif continue_timesteps: + if continue_timesteps and operator.prev_res is None: raise ValueError("Continuation run requires passing prev_results.") self.operator = operator self.chain = operator.chain @@ -694,6 +696,7 @@ class Integrator(ABC): self.source_rates = np.asarray(source_rates) self.transfer_rates = None + self.external_source_rates = None self._reactivity_control = None if isinstance(solver, str): @@ -749,11 +752,11 @@ class Integrator(ABC): check_type('reactivity control', reactivity_control, ReactivityController) self._reactivity_control = reactivity_control - def _timed_deplete(self, n, rates, dt, matrix_func=None): + def _timed_deplete(self, n, rates, dt, i=None, matrix_func=None): start = time.time() results = deplete( - self._solver, self.chain, n, rates, dt, matrix_func, - self.transfer_rates) + self._solver, self.chain, n, rates, dt, i, matrix_func, + self.transfer_rates, self.external_source_rates) return time.time() - start, results @abstractmethod @@ -785,12 +788,8 @@ class Integrator(ABC): ------- proc_time : float Time spent in CRAM routines for all materials in [s] - n_list : list of list of numpy.ndarray - Concentrations at each of the intermediate points with - the final concentration as the last element - op_results : list of openmc.deplete.OperatorResult - Eigenvalue and reaction rates from intermediate transport - simulations + n_end : list of numpy.ndarray + Concentrations at end of timestep """ @property @@ -821,19 +820,44 @@ class Integrator(ABC): """Get beginning of step concentrations, reaction rates from restart""" res = self.operator.prev_res[-1] # Depletion methods expect list of arrays - bos_conc = list(res.data[0]) - rates = res.rates[0] - k = ufloat(res.k[0, 0], res.k[0, 1]) + bos_conc = list(res.data) + rates = res.rates + k = ufloat(res.k[0], res.k[1]) if res.source_rate != 0.0: # Scale reaction rates by ratio of source rates rates *= source_rate / res.source_rate return bos_conc, OperatorResult(k, rates) - def _get_start_data(self): + def _get_start_data(self) -> tuple[float, int]: + """ + This function fetches the starting state of a depletion simulation in + terms of the simulation physical time at which to start and the index at + which the depletion simulation should start. When no previous results + exist, the time and index are both zero. When previous results do exist, + it returns the time corresponding to beginning the previous results last + timestep and the index as N-1 where N is the number of previous + StepResults found in the previous Results (as expected from 0-based + indexing). + + Note that the openmc.deplete.Results.time object is a list of float with + [t,t+dt] where t is the beginning of timestep time and t+dt is the end + of timestep time. If the previous results correspond to a simulation + that finished to completeion, it will contain a results in the form of + [t,t], but if a simulation doesn't finish all the given timesteps, it is + the t that is the desired start time, not t+dt. Thus, it is always safe + to take time[0]. + + Returns + ------- + start_time : float + Time at which depletion simulation should start in [s] + index : int + Index at which depletion simulation should start + """ if self.operator.prev_res is None: return 0.0, 0 - return (self.operator.prev_res[-1].time[-1], + return (self.operator.prev_res[-1].time[0], len(self.operator.prev_res) - 1) def _get_bos_from_reactivity_control(self, step_index, bos_conc): @@ -847,7 +871,8 @@ class Integrator(ABC): self, final_step: bool = True, output: bool = True, - path: PathLike = 'depletion_results.h5' + path: PathLike = 'depletion_results.h5', + write_rates: bool = False ): """Perform the entire depletion process across all steps @@ -866,6 +891,11 @@ class Integrator(ABC): Path to file to write. Defaults to 'depletion_results.h5'. .. versionadded:: 0.15.0 + write_rates : bool, optional + Whether reaction rates should be written to the results file for + each step. Defaults to ``False`` to reduce file size. + + .. versionadded:: 0.15.3 """ with change_directory(self.operator.output_dir): n = self.operator.initial_condition() @@ -890,17 +920,23 @@ class Integrator(ABC): else: root = None # Solve Bateman equations over time interval - proc_time, n_list, res_list = self(n, res.rates, dt, source_rate, i) + proc_time, n_end = self(n, res.rates, dt, source_rate, i) - # Insert BOS concentration, transport results - n_list.insert(0, n) - res_list.insert(0, res) - - # Remove actual EOS concentration for next step - n = n_list.pop() - StepResult.save(self.operator, n_list, res_list, [t, t + dt], - source_rate, self._i_res + i, proc_time, root, path) + StepResult.save( + self.operator, + n, + res, + [t, t + dt], + source_rate, + self._i_res + i, + proc_time, + write_rates=write_rates, + root=root, + path=path + ) + # Update for next step + n = n_end t += dt # Final simulation -- in the case that final_step is False, a zero @@ -913,21 +949,32 @@ class Integrator(ABC): n, root = self._get_bos_from_reactivity_control(i+1, n) else: root = None - res_list = [self.operator(n, source_rate if final_step else 0.0)] - StepResult.save(self.operator, [n], res_list, [t, t], - source_rate, self._i_res + len(self), proc_time, root, path) + res_final = self.operator(n, source_rate if final_step else 0.0) + StepResult.save( + self.operator, + n, + res_final, + [t, t], + source_rate, + self._i_res + len(self), + proc_time, + write_rates=write_rates, + root=root, + path=path + ) self.operator.write_bos_data(len(self) + self._i_res) self.operator.finalize() def add_transfer_rate( - self, - material: Union[str, int, Material], - components: Sequence[str], - transfer_rate: float, - transfer_rate_units: str = '1/s', - destination_material: Optional[Union[str, int, Material]] = None - ): + self, + material: str | int | Material, + components: Sequence[str], + transfer_rate: float, + transfer_rate_units: str = '1/s', + timesteps: Sequence[int] | None = None, + destination_material: str | int | Material | None = None + ): """Add transfer rates to depletable material. Parameters @@ -941,18 +988,109 @@ class Integrator(ABC): transfer_rate : float Rate at which elements are transferred. A positive or negative values set removal of feed rates, respectively. - destination_material : openmc.Material or str or int, Optional - Destination material to where nuclides get fed. transfer_rate_units : {'1/s', '1/min', '1/h', '1/d', '1/a'} Units for values specified in the transfer_rate argument. 's' means seconds, 'min' means minutes, 'h' means hours, 'a' means Julian years. + timesteps : list of int, optional + List of timestep indices where to set external source rates. + Defaults to None, which means the external source rate is set for + all timesteps. + destination_material : openmc.Material or str or int, Optional + Destination material to where nuclides get fed. """ if self.transfer_rates is None: - self.transfer_rates = TransferRates(self.operator, self.operator.model) + if hasattr(self.operator, 'model'): + materials = self.operator.model.materials + elif hasattr(self.operator, 'materials'): + materials = self.operator.materials + self.transfer_rates = TransferRates( + self.operator, materials, len(self.timesteps)) - self.transfer_rates.set_transfer_rate(material, components, transfer_rate, - transfer_rate_units, destination_material) + if self.external_source_rates is not None and destination_material: + raise ValueError('Currently is not possible to set a transfer rate ' + 'with destination matrial in combination with ' + 'external source rates.') + + self.transfer_rates.set_transfer_rate( + material, components, transfer_rate, transfer_rate_units, + timesteps, destination_material) + + def add_external_source_rate( + self, + material: str | int | Material, + composition: dict[str, float], + rate: float, + rate_units: str = 'g/s', + timesteps: Sequence[int] | None = None + ): + """Add external source rates to depletable material. + + Parameters + ---------- + material : openmc.Material or str or int + Depletable material + composition : dict of str to float + External source rate composition vector, where key can be an element + or a nuclide and value the corresponding weight percent. + rate : float + External source rate in units of mass per time. A positive or + negative value corresponds to a feed or removal rate, respectively. + units : {'g/s', 'g/min', 'g/h', 'g/d', 'g/a'} + Units for values specified in the `rate` argument. 's' for seconds, + 'min' for minutes, 'h' for hours, 'a' for Julian years. + timesteps : list of int, optional + List of timestep indices where to set external source rates. + Defaults to None, which means the external source rate is set for + all timesteps. + + """ + if self.external_source_rates is None: + if hasattr(self.operator, 'model'): + materials = self.operator.model.materials + elif hasattr(self.operator, 'materials'): + materials = self.operator.materials + self.external_source_rates = ExternalSourceRates( + self.operator, materials, len(self.timesteps)) + + if self.transfer_rates is not None and self.transfer_rates.index_transfer: + raise ValueError('Currently is not possible to set an external ' + 'source rate in combination with transfer rates ' + 'with destination matrial.') + + self.external_source_rates.set_external_source_rate( + material, composition, rate, rate_units, timesteps) + + + def add_redox(self, material, buffer, oxidation_states, timesteps=None): + """Add redox control to depletable material. + + Parameters + ---------- + material : openmc.Material or str or int + Depletable material + buffer : dict + Dictionary of buffer nuclides used to maintain redox balance. Keys + are nuclide names (strings) and values are their respective + fractions (float) that collectively sum to 1. + oxidation_states : dict + User-defined oxidation states for elements. Keys are element symbols + (e.g., 'H', 'He'), and values are their corresponding oxidation + states as integers (e.g., +1, 0). + timesteps : list of int, optional + List of timestep indices where to set external source rates. + Defaults to None, which means the external source rate is set for + all timesteps. + """ + if self.transfer_rates is None: + if hasattr(self.operator, 'model'): + materials = self.operator.model.materials + elif hasattr(self.operator, 'materials'): + materials = self.operator.materials + self.transfer_rates = TransferRates( + self.operator, materials, len(self.timesteps)) + + self.transfer_rates.set_redox(material, buffer, oxidation_states, timesteps) def add_reactivity_control( self, @@ -985,7 +1123,7 @@ class SIIntegrator(Integrator): the number of particles used in initial transport calculation """ - _params = r""" + _params = dedent(r""" Parameters ---------- operator : openmc.deplete.abc.TransportOperator @@ -1063,7 +1201,7 @@ class SIIntegrator(Integrator): User-supplied functions are expected to have the following signature: ``solver(A, n0, t) -> n1`` where - * ``A`` is a :class:`scipy.sparse.csc_matrix` making up the + * ``A`` is a :class:`scipy.sparse.csc_array` making up the depletion matrix * ``n0`` is a 1-D :class:`numpy.ndarray` of initial compositions for a given material in atoms/cm3 @@ -1073,7 +1211,7 @@ class SIIntegrator(Integrator): .. versionadded:: 0.12 - """ + """) def __init__( self, @@ -1105,11 +1243,41 @@ class SIIntegrator(Integrator): self.operator.settings.particles //= self.n_steps return inherited + @abstractmethod + def __call__(self, n, rates, dt, source_rate, i): + """Perform the integration across one time step + + Parameters + ---------- + n : list of numpy.ndarray + List of atom number arrays for each material. Each array has + shape ``(n_nucs,)`` where ``n_nucs`` is the number of nuclides + rates : openmc.deplete.ReactionRates + Reaction rates (from transport operator) + dt : float + Time step in [s] + source_rate : float + Power in [W] or source rate in [neutron/sec] + i : int + Current time step index + + Returns + ------- + proc_time : float + Time spent in transport simulation + n_end : list of numpy.ndarray + Updated atom number densities for each material + op_result : OperatorResult + Eigenvalue and reaction rates resulting from transport simulation + + """ + def integrate( - self, - output: bool = True, - path: PathLike = "depletion_results.h5" - ): + self, + output: bool = True, + path: PathLike = "depletion_results.h5", + write_rates: bool = False + ): """Perform the entire depletion process across all steps Parameters @@ -1120,11 +1288,17 @@ class SIIntegrator(Integrator): Path to file to write. Defaults to 'depletion_results.h5'. .. versionadded:: 0.15.0 + write_rates : bool, optional + Whether reaction rates should be written to the results file for + each step. Defaults to ``False`` to reduce file size. + + .. versionadded:: 0.15.3 """ with change_directory(self.operator.output_dir): n = self.operator.initial_condition() t, self._i_res = self._get_start_data() + res_end = None # Will be set in first iteration for i, (dt, p) in enumerate(self): if output: print(f"[openmc.deplete] t={t} s, dt={dt} s, source={p}") @@ -1134,28 +1308,38 @@ class SIIntegrator(Integrator): n, res = self._get_bos_data_from_operator(i, p, n) else: n, res = self._get_bos_data_from_restart(p, n) - else: - # Pull rates, k from previous iteration w/o - # re-running transport - res = res_list[-1] # defined in previous i iteration - proc_time, n_list, res_list = self(n, res.rates, dt, p, i) + proc_time, n_end, res_end = self(n, res.rates, dt, p, i) - # Insert BOS concentration, transport results - n_list.insert(0, n) - res_list.insert(0, res) - - # Remove actual EOS concentration for next step - n = n_list.pop() - - StepResult.save(self.operator, n_list, res_list, [t, t + dt], - p, self._i_res + i, proc_time, path=path) + StepResult.save( + self.operator, + n, + res, + [t, t + dt], + p, + self._i_res + i, + proc_time, + write_rates=write_rates, + path=path + ) + # Update for next step + n = n_end + res = res_end t += dt # No final simulation for SIE, use last iteration results - StepResult.save(self.operator, [n], [res_list[-1]], [t, t], - p, self._i_res + len(self), proc_time, path=path) + StepResult.save( + self.operator, + n, + res_end, + [t, t], + p, + self._i_res + len(self), + proc_time, + write_rates=write_rates, + path=path + ) self.operator.write_bos_data(self._i_res + len(self)) self.operator.finalize() @@ -1180,7 +1364,7 @@ class DepSystemSolver(ABC): Parameters ---------- - A : scipy.sparse.csc_matrix + A : scipy.sparse.csc_array Sparse transmutation matrix ``A[j, i]`` describing rates at which isotope ``i`` transmutes to isotope ``j`` n0 : numpy.ndarray diff --git a/openmc/deplete/chain.py b/openmc/deplete/chain.py index 4998a2c3d..a835face7 100644 --- a/openmc/deplete/chain.py +++ b/openmc/deplete/chain.py @@ -7,19 +7,23 @@ loaded from an .xml file and all the nuclides are linked together. from io import StringIO from itertools import chain import math +import numpy as np import re from collections import defaultdict, namedtuple from collections.abc import Mapping, Iterable from numbers import Real, Integral +from pathlib import Path from warnings import warn from typing import List import lxml.etree as ET -import scipy.sparse as sp -from openmc.checkvalue import check_type, check_greater_than +from openmc.checkvalue import check_type, check_greater_than, PathLike from openmc.data import gnds_name, zam +from openmc.exceptions import DataError from .nuclide import FissionYieldDistribution, Nuclide +from .._xml import get_text +from .._sparse_compat import csc_array, dok_array import openmc.data @@ -277,7 +281,6 @@ class Chain: """Number of nuclides in chain.""" return len(self.nuclides) - @property def stable_nuclides(self) -> List[Nuclide]: """List of stable nuclides available in the chain""" @@ -297,6 +300,7 @@ class Chain: Nuclide to add """ + _invalidate_chain_cache(self) self.nuclide_dict[nuclide.name] = len(self.nuclides) self.nuclides.append(nuclide) @@ -462,7 +466,6 @@ class Chain: nuclide.add_reaction('fission', None, q_value, 1.0) fissionable = True - if fissionable: if parent in fpy_data: fpy = fpy_data[parent] @@ -552,11 +555,14 @@ class Chain: root = ET.parse(str(filename)) for i, nuclide_elem in enumerate(root.findall('nuclide')): - this_q = fission_q.get(nuclide_elem.get("name")) + this_q = fission_q.get(get_text(nuclide_elem, "name")) nuc = Nuclide.from_xml(nuclide_elem, root, this_q) chain.add_nuclide(nuc) + # Store path of XML file (used for handling cache invalidation) + chain._xml_path = str(Path(filename).resolve()) + return chain def export_to_xml(self, filename): @@ -613,7 +619,7 @@ class Chain: Returns ------- - scipy.sparse.csc_matrix + scipy.sparse.csc_array Sparse matrix representing depletion. See Also @@ -622,9 +628,15 @@ class Chain: """ reactions = set() - # Use DOK matrix as intermediate representation for matrix n = len(self) - matrix = sp.dok_matrix((n, n)) + + # we accumulate indices and value entries for everything and create the matrix + # in one step at the end to avoid expensive index checks scipy otherwise does. + rows, cols, vals = [], [], [] + def setval(i, j, val): + rows.append(i) + cols.append(j) + vals.append(val) if fission_yields is None: fission_yields = self.get_default_fission_yields() @@ -634,7 +646,7 @@ class Chain: if nuc.half_life is not None: decay_constant = math.log(2) / nuc.half_life if decay_constant != 0.0: - matrix[i, i] -= decay_constant + setval(i, i, -decay_constant) # Gain from radioactive decay if nuc.n_decay_modes != 0: @@ -645,19 +657,19 @@ class Chain: if branch_val != 0.0: if target is not None: k = self.nuclide_dict[target] - matrix[k, i] += branch_val + setval(k, i, branch_val) # Produce alphas and protons from decay if 'alpha' in decay_type: k = self.nuclide_dict.get('He4') if k is not None: count = decay_type.count('alpha') - matrix[k, i] += count * branch_val + setval(k, i, count * branch_val) elif 'p' in decay_type: k = self.nuclide_dict.get('H1') if k is not None: count = decay_type.count('p') - matrix[k, i] += count * branch_val + setval(k, i, count * branch_val) if nuc.name in rates.index_nuc: # Extract all reactions for this nuclide in this cell @@ -674,13 +686,13 @@ class Chain: if r_type not in reactions: reactions.add(r_type) if path_rate != 0.0: - matrix[i, i] -= path_rate + setval(i, i, -path_rate) # Gain term; allow for total annihilation for debug purposes if r_type != 'fission': if target is not None and path_rate != 0.0: k = self.nuclide_dict[target] - matrix[k, i] += path_rate * br + setval(k, i, path_rate * br) # Determine light nuclide production, e.g., (n,d) should # produce H2 @@ -688,22 +700,78 @@ class Chain: for light_nuc in light_nucs: k = self.nuclide_dict.get(light_nuc) if k is not None: - matrix[k, i] += path_rate * br + setval(k, i, path_rate * br) else: for product, y in fission_yields[nuc.name].items(): yield_val = y * path_rate if yield_val != 0.0: k = self.nuclide_dict[product] - matrix[k, i] += yield_val + setval(k, i, yield_val) # Clear set of reactions reactions.clear() # Return CSC representation instead of DOK - return matrix.tocsc() + return csc_array((vals, (rows, cols)), shape=(n, n)) - def form_rr_term(self, tr_rates, mats): + def add_redox_term(self, matrix, buffer, oxidation_states): + r"""Adds a redox term to the depletion matrix from data contained in + the matrix itself and a few user-inputs. + + The redox term to add to the buffer nuclide :math:`N_j` can be written + as: + + .. math:: + \frac{dN_j(t)}{dt} = \cdots - \frac{1}{OS_j}\sum_i N_i a_{ij} + \cdot OS_i + + where :math:`OS` is the oxidation states vector and :math:`a_{ij}` the + corresponding term in the Bateman matrix. + + Parameters + ---------- + matrix : scipy.sparse.csc_array + Sparse matrix representing depletion + buffer : dict + Dictionary of buffer nuclides used to maintain anoins net balance. + Keys are nuclide names (strings) and values are their respective + fractions (float) that collectively sum to 1. + oxidation_states : dict + User-defined oxidation states for elements. Keys are element symbols + (e.g., 'H', 'He'), and values are their corresponding oxidation + states as integers (e.g., +1, 0). + Returns + ------- + matrix : scipy.sparse.csc_array + Sparse matrix with redox term added + """ + # Elements list with the same size as self.nuclides + elements = [re.split(r'\d+', nuc.name)[0] for nuc in self.nuclides] + + # Match oxidation states with all elements and add 0 if not data + os = np.array([oxidation_states[elm] if elm in oxidation_states else 0 + for elm in elements]) + + # Buffer idx with nuclide index as value + buffer_idx = {nuc: self.nuclide_dict[nuc] for nuc in buffer} + array = matrix.toarray() + redox_change = np.array([]) + + # calculate the redox array + for i in range(len(self)): + # Net redox impact of reaction: multiply the i-th column of the + # depletion matrix by the oxidation states + redox_change = np.append(redox_change, sum(array[:, i]*os)) + + # Subtract redox vector to the buffer nuclides in the matrix scaling by + # their respective oxidation states + for nuc, idx in buffer_idx.items(): + array[idx] -= redox_change * buffer[nuc] / os[idx] + + return csc_array(array) + + def form_rr_term(self, tr_rates, current_timestep, mats): """Function to form the transfer rate term matrices. .. versionadded:: 0.14.0 @@ -712,6 +780,8 @@ class Chain: ---------- tr_rates : openmc.deplete.TransferRates Instance of openmc.deplete.TransferRates + current_timestep : int + Current timestep index mats : string or two-tuple of strings Two cases are possible: @@ -730,42 +800,84 @@ class Chain: Returns ------- - scipy.sparse.csc_matrix + scipy.sparse.csc_array Sparse matrix representing transfer term. """ # Use DOK as intermediate representation n = len(self) - matrix = sp.dok_matrix((n, n)) + matrix = dok_array((n, n)) for i, nuc in enumerate(self.nuclides): elm = re.split(r'\d+', nuc.name)[0] - # Build transfer terms matrices + # Build transfer terms (nuclide transfer only) if isinstance(mats, str): mat = mats - components = tr_rates.get_components(mat) + components = tr_rates.get_components(mat, current_timestep) + if not components: + break if elm in components: - matrix[i, i] = sum(tr_rates.get_transfer_rate(mat, elm)) + matrix[i, i] = sum( + tr_rates.get_external_rate(mat, elm, current_timestep)) elif nuc.name in components: - matrix[i, i] = sum(tr_rates.get_transfer_rate(mat, nuc.name)) + matrix[i, i] = sum( + tr_rates.get_external_rate(mat, nuc.name, current_timestep)) else: matrix[i, i] = 0.0 - #Build transfer terms matrices + + # Build transfer terms (transfer from one material into another) elif isinstance(mats, tuple): dest_mat, mat = mats - if dest_mat in tr_rates.get_destination_material(mat, elm): - dest_mat_idx = tr_rates.get_destination_material(mat, elm).index(dest_mat) - matrix[i, i] = tr_rates.get_transfer_rate(mat, elm)[dest_mat_idx] - elif dest_mat in tr_rates.get_destination_material(mat, nuc.name): - dest_mat_idx = tr_rates.get_destination_material(mat, nuc.name).index(dest_mat) - matrix[i, i] = tr_rates.get_transfer_rate(mat, nuc.name)[dest_mat_idx] + components = tr_rates.get_components(mat, current_timestep, dest_mat) + if elm in components: + matrix[i, i] = tr_rates.get_external_rate( + mat, elm, current_timestep, dest_mat)[0] + elif nuc.name in components: + matrix[i, i] = tr_rates.get_external_rate( + mat, nuc.name, current_timestep, dest_mat)[0] else: matrix[i, i] = 0.0 - #Nothing else is allowed # Return CSC instead of DOK return matrix.tocsc() + def form_ext_source_term(self, ext_source_rates, current_timestep, mat): + """Function to form the external source rate term vectors. + + .. versionadded:: 0.15.3 + + Parameters + ---------- + ext_source_rates : openmc.deplete.ExternalSourceRates + Instance of openmc.deplete.ExternalSourceRates + current_timestep : int + Current timestep index + mat : string + Material id + + Returns + ------- + scipy.sparse.csc_array + Sparse vector representing external source term. + + """ + if not ext_source_rates.get_components(mat, current_timestep): + return + # Use DOK as intermediate representation + n = len(self) + vector = dok_array((n, 1)) + + for i, nuc in enumerate(self.nuclides): + # Build source term vector + if nuc.name in ext_source_rates.get_components(mat, current_timestep): + vector[i] = sum(ext_source_rates.get_external_rate( + mat, nuc.name, current_timestep)) + else: + vector[i] = 0.0 + + # Return CSC instead of DOK + return vector.tocsc() + def get_branch_ratios(self, reaction="(n,gamma)"): """Return a dictionary with reaction branching ratios @@ -843,7 +955,7 @@ class Chain: -------- :meth:`get_branch_ratios` """ - + _invalidate_chain_cache(self) # Store some useful information through the validation stage sums = {} @@ -982,6 +1094,7 @@ class Chain: @fission_yields.setter def fission_yields(self, yields): + _invalidate_chain_cache(self) if yields is not None: if isinstance(yields, Mapping): yields = [yields] @@ -1202,3 +1315,65 @@ class Chain: found.update(isotopes) return found + + +# A global cache for Chain objects +_CHAIN_CACHE = {} + + +def _get_chain( + chain_file: PathLike | Chain | None = None, + fission_q: dict | None = None +) -> Chain: + """Get a depletion chain from a file or the runtime configuration. + + Parameters + ---------- + chain_file : PathLike or Chain, optional + Path to depletion chain XML file, a Chain instance, or None to use + the file specified in ``openmc.config['chain_file']``. + fission_q : dict, optional + Dictionary of nuclides and their fission Q values [eV]. If not given, + values will be pulled from the ``chain_file``. + + Returns + ------- + Chain + Depletion chain instance. + """ + # If chain_file is already a Chain, return it directly + if isinstance(chain_file, Chain): + return chain_file + + # Resolve chain_file based on config if None + if chain_file is None: + chain_file = openmc.config.get('chain_file') + if 'chain_file' not in openmc.config: + raise DataError( + "No depletion chain specified and could not find depletion " + "chain in openmc.config['chain_file']" + ) + elif not isinstance(chain_file, PathLike): + raise TypeError("chain_file must be path-like, a Chain, or None") + + # Determine the key for the cache, which consists of the absolute path, the + # file modification time, the file size, and the fission Q values. + chain_path = Path(chain_file).resolve() + stat_result = chain_path.stat() + fq_tuple = tuple(sorted(fission_q.items())) if fission_q else () + key = (chain_path, stat_result.st_mtime, stat_result.st_size, fq_tuple) + + # Check the global cache. If not cached, load the chain from XML and store + global _CHAIN_CACHE + if key not in _CHAIN_CACHE: + _CHAIN_CACHE[key] = Chain.from_xml(chain_path, fission_q) + return _CHAIN_CACHE[key] + + +def _invalidate_chain_cache(chain): + """Invalidate the cache for a specific Chain (when it is modifed).""" + if hasattr(chain, '_xml_path'): + # Remove all entries with the same path as self._xml_path + for key in list(_CHAIN_CACHE.keys()): + if str(key[0]) == chain._xml_path: + del _CHAIN_CACHE[key] diff --git a/openmc/deplete/coupled_operator.py b/openmc/deplete/coupled_operator.py index 17af935f4..34bb28b49 100644 --- a/openmc/deplete/coupled_operator.py +++ b/openmc/deplete/coupled_operator.py @@ -102,9 +102,9 @@ class CoupledOperator(OpenMCOperator): ---------- model : openmc.model.Model OpenMC model object - chain_file : str, optional - Path to the depletion chain XML file. Defaults to - ``openmc.config['chain_file']``. + chain_file : PathLike or Chain, optional + Path to the depletion chain XML file or instance of openmc.deplete.Chain. + Defaults to ``openmc.config['chain_file']``. prev_results : Results, optional Results from a previous depletion calculation. If this argument is specified, the depletion calculation will start from the latest state @@ -154,15 +154,9 @@ class CoupledOperator(OpenMCOperator): options. .. versionadded:: 0.12.1 - reduce_chain : bool, optional - If True, use :meth:`openmc.deplete.Chain.reduce` to reduce the - depletion chain up to ``reduce_chain_level``. - - .. versionadded:: 0.12 reduce_chain_level : int, optional - Depth of the search when reducing the depletion chain. Only used - if ``reduce_chain`` evaluates to true. The default value of - ``None`` implies no limit on the depth. + Depth of the search when reducing the depletion chain. The default + value of ``None`` implies no limit on the depth. .. versionadded:: 0.12 diff_volume_method : str @@ -214,7 +208,7 @@ class CoupledOperator(OpenMCOperator): normalization_mode="fission-q", fission_q=None, fission_yield_mode="constant", fission_yield_opts=None, reaction_rate_mode="direct", reaction_rate_opts=None, - reduce_chain=False, reduce_chain_level=None): + reduce_chain_level=None): # check for old call to constructor if isinstance(model, openmc.Geometry): @@ -270,7 +264,6 @@ class CoupledOperator(OpenMCOperator): diff_volume_method=diff_volume_method, fission_q=fission_q, helper_kwargs=helper_kwargs, - reduce_chain=reduce_chain, reduce_chain_level=reduce_chain_level) def _differentiate_burnable_mats(self): diff --git a/openmc/deplete/cram.py b/openmc/deplete/cram.py index 53de83bb6..cecc388f4 100644 --- a/openmc/deplete/cram.py +++ b/openmc/deplete/cram.py @@ -6,11 +6,11 @@ Implements two different forms of CRAM for use in openmc.deplete. import numbers import numpy as np -import scipy.sparse as sp import scipy.sparse.linalg as sla from openmc.checkvalue import check_type, check_length from .abc import DepSystemSolver +from .._sparse_compat import csc_array, eye_array __all__ = ["CRAM16", "CRAM48", "Cram16Solver", "Cram48Solver", "IPFCramSolver"] @@ -60,7 +60,7 @@ class IPFCramSolver(DepSystemSolver): Parameters ---------- - A : scipy.sparse.csr_matrix + A : scipy.sparse.csc_array Sparse transmutation matrix ``A[j, i]`` desribing rates at which isotope ``i`` transmutes to isotope ``j`` n0 : numpy.ndarray @@ -75,9 +75,9 @@ class IPFCramSolver(DepSystemSolver): Final compositions after ``dt`` """ - A = dt * sp.csc_matrix(A, dtype=np.float64) + A = dt * csc_array(A, dtype=np.float64) y = n0.copy() - ident = sp.eye(A.shape[0], format='csc') + ident = eye_array(A.shape[0], format='csc') for alpha, theta in zip(self.alpha, self.theta): y += 2*np.real(alpha*sla.spsolve(A - theta*ident, y)) return y * self.alpha0 diff --git a/openmc/deplete/d1s.py b/openmc/deplete/d1s.py index 8f6bffa86..bc99fc42d 100644 --- a/openmc/deplete/d1s.py +++ b/openmc/deplete/d1s.py @@ -5,7 +5,7 @@ shutdown dose rate calculations. """ -from copy import deepcopy +from copy import copy from typing import Sequence from math import log, prod @@ -14,19 +14,20 @@ import numpy as np import openmc from openmc.data import half_life from .abc import _normalize_timesteps -from .chain import Chain +from .chain import Chain, _get_chain +from ..checkvalue import PathLike -def get_radionuclides(model: openmc.Model, chain_file: str | None = None) -> list[str]: +def get_radionuclides(model: openmc.Model, chain_file: PathLike | Chain | None = None) -> list[str]: """Determine all radionuclides that can be produced during D1S. Parameters ---------- model : openmc.Model Model that should be used for determining what nuclides are present - chain_file : str, optional - Which chain file to use for inspecting decay data. If None is passed, - defaults to ``openmc.config['chain_file']`` + chain_file : PathLike | Chain + Path to the depletion chain XML file or instance of openmc.deplete.Chain. + Used for inspecting decay data. Defaults to ``openmc.config['chain_file']`` Returns ------- @@ -39,9 +40,7 @@ def get_radionuclides(model: openmc.Model, chain_file: str | None = None) -> lis for nuc in mat.get_nuclides()} # Load chain file - if chain_file is None: - chain_file = openmc.config['chain_file'] - chain = Chain.from_xml(chain_file) + chain = _get_chain(chain_file) radionuclides = set() for nuclide in chain.nuclides: @@ -109,14 +108,15 @@ def time_correction_factors( # Create a 2D array for the time correction factors h = np.zeros((n_timesteps, n_nuclides)) - for i, (dt, rate) in enumerate(zip(timesteps, source_rates)): - # Precompute the exponential terms. Since (1 - exp(-x)) is susceptible to - # roundoff error, use expm1 instead (which computes exp(x) - 1) - g = np.exp(-decay_rate*dt) - one_minus_g = -np.expm1(-decay_rate*dt) + # Precompute all exponential terms with same shape as h + decay_dt = decay_rate[np.newaxis, :] * timesteps[:, np.newaxis] + g = np.exp(-decay_dt) + one_minus_g = -np.expm1(-decay_dt) + # Apply recurrence relation step by step + for i in range(len(timesteps)): # Eq. (4) in doi:10.1016/j.fusengdes.2019.111399 - h[i + 1] = rate*one_minus_g + h[i]*g + h[i + 1] = source_rates[i] * one_minus_g[i] + h[i] * g[i] return {nuclides[i]: h[:, i] for i in range(n_nuclides)} @@ -141,7 +141,9 @@ def apply_time_correction( time_correction_factors : dict Time correction factors as returned by :func:`time_correction_factors` index : int, optional - Index to use for the correction factors + Index of the time of interest. If N timesteps are provided in + :func:`time_correction_factors`, there are N + 1 times to select from. + The default is -1 which corresponds to the final time. sum_nuclides : bool Whether to sum over the parent nuclides @@ -162,8 +164,12 @@ def apply_time_correction( radionuclides = [str(x) for x in tally.filters[i_filter].bins] tcf = np.array([time_correction_factors[x][index] for x in radionuclides]) - # Create copy of tally - new_tally = deepcopy(tally) + # Force tally results to be read and std_dev to be computed + tally.std_dev + + # Create shallow copy of tally + new_tally = copy(tally) + new_tally._filters = copy(tally._filters) # Determine number of bins in other filters n_bins_before = prod([f.num_bins for f in tally.filters[:i_filter]]) @@ -175,32 +181,33 @@ def apply_time_correction( shape = (n_bins_before, n_radionuclides, n_bins_after, n_nuclides, n_scores) tally_sum = new_tally.sum.reshape(shape) tally_sum_sq = new_tally.sum_sq.reshape(shape) + tally_mean = new_tally.mean.reshape(shape) + tally_std_dev = new_tally.std_dev.reshape(shape) # Apply TCF, broadcasting to the correct dimensions tcf.shape = (1, -1, 1, 1, 1) new_tally._sum = tally_sum * tcf new_tally._sum_sq = tally_sum_sq * (tcf*tcf) - new_tally._mean = None - new_tally._std_dev = None + new_tally._mean = tally_mean * tcf + new_tally._std_dev = tally_std_dev * tcf shape = (-1, n_nuclides, n_scores) if sum_nuclides: - # Query the mean and standard deviation - mean = new_tally.mean - std_dev = new_tally.std_dev - # Sum over parent nuclides (note that when combining different bins for # parent nuclide, we can't work directly on sum_sq) - new_tally._mean = mean.sum(axis=1).reshape(shape) - new_tally._std_dev = np.linalg.norm(std_dev, axis=1).reshape(shape) + new_tally._mean = new_tally.mean.sum(axis=1).reshape(shape) + new_tally._std_dev = np.linalg.norm(new_tally.std_dev, axis=1).reshape(shape) new_tally._derived = True # Remove ParentNuclideFilter new_tally.filters.pop(i_filter) else: + # Change shape back to (filter combinations, nuclides, scores) new_tally._sum.shape = shape new_tally._sum_sq.shape = shape + new_tally._mean.shape = shape + new_tally._std_dev.shape = shape return new_tally @@ -242,7 +249,7 @@ def prepare_tallies( for f in tally.filters: if isinstance(f, openmc.ParticleFilter): if list(f.bins) == ['photon']: - tally.filters.append(filter) + if not tally.contains_filter(openmc.ParentNuclideFilter): + tally.filters.append(filter) break - return nuclides diff --git a/openmc/deplete/independent_operator.py b/openmc/deplete/independent_operator.py index 333ead0f8..c192907cf 100644 --- a/openmc/deplete/independent_operator.py +++ b/openmc/deplete/independent_operator.py @@ -50,9 +50,9 @@ class IndependentOperator(OpenMCOperator): Cross sections in [b] for each domain. If the :class:`~openmc.deplete.MicroXS` object is empty, a decay-only calculation will be run. - chain_file : str - Path to the depletion chain XML file. Defaults to - ``openmc.config['chain_file']``. + chain_file : PathLike or Chain, optional + Path to the depletion chain XML file or instance of openmc.deplete.Chain. + Defaults to ``openmc.config['chain_file']``. keff : 2-tuple of float, optional keff eigenvalue and uncertainty from transport calculation. prev_results : Results, optional @@ -66,13 +66,9 @@ class IndependentOperator(OpenMCOperator): Dictionary of nuclides and their fission Q values [eV]. If not given, values will be pulled from the ``chain_file``. Only applicable if ``"normalization_mode" == "fission-q"``. - reduce_chain : bool, optional - If True, use :meth:`openmc.deplete.Chain.reduce` to reduce the depletion - chain up to ``reduce_chain_level``. reduce_chain_level : int, optional - Depth of the search when reducing the depletion chain. Only used if - ``reduce_chain`` evaluates to true. The default value of ``None`` - implies no limit on the depth. + Depth of the search when reducing the depletion chain. The default + value of ``None`` implies no limit on the depth. fission_yield_opts : dict of str to option, optional Optional arguments to pass to the :class:`openmc.deplete.helpers.FissionYieldHelper` object. Will be @@ -119,7 +115,6 @@ class IndependentOperator(OpenMCOperator): normalization_mode='fission-q', fission_q=None, prev_results=None, - reduce_chain=False, reduce_chain_level=None, fission_yield_opts=None): # Validate micro-xs parameters @@ -157,7 +152,6 @@ class IndependentOperator(OpenMCOperator): prev_results=prev_results, fission_q=fission_q, helper_kwargs=helper_kwargs, - reduce_chain=reduce_chain, reduce_chain_level=reduce_chain_level) @classmethod @@ -170,7 +164,6 @@ class IndependentOperator(OpenMCOperator): normalization_mode='fission-q', fission_q=None, prev_results=None, - reduce_chain=False, reduce_chain_level=None, fission_yield_opts=None): """ @@ -186,9 +179,9 @@ class IndependentOperator(OpenMCOperator): micro_xs : MicroXS Cross sections in [b]. If the :class:`~openmc.deplete.MicroXS` object is empty, a decay-only calculation will be run. - chain_file : str, optional - Path to the depletion chain XML file. Defaults to - ``openmc.config['chain_file']``. + chain_file : PathLike or Chain, optional + Path to the depletion chain XML file or instance of + openmc.deplete.Chain. Defaults to ``openmc.config['chain_file']``. nuc_units : {'atom/cm3', 'atom/b-cm'}, optional Units for nuclide concentration. keff : 2-tuple of float, optional @@ -206,13 +199,9 @@ class IndependentOperator(OpenMCOperator): applicable if ``"normalization_mode" == "fission-q"``. prev_results : Results, optional Results from a previous depletion calculation. - reduce_chain : bool, optional - If True, use :meth:`openmc.deplete.Chain.reduce` to reduce the - depletion chain up to ``reduce_chain_level``. Default is False. reduce_chain_level : int, optional - Depth of the search when reducing the depletion chain. Only used - if ``reduce_chain`` evaluates to true. The default value of - ``None`` implies no limit on the depth. + Depth of the search when reducing the depletion chain. The default + value of ``None`` implies no limit on the depth. fission_yield_opts : dict of str to option, optional Optional arguments to pass to the :class:`openmc.deplete.helpers.FissionYieldHelper` class. Will be @@ -232,7 +221,6 @@ class IndependentOperator(OpenMCOperator): normalization_mode=normalization_mode, fission_q=fission_q, prev_results=prev_results, - reduce_chain=reduce_chain, reduce_chain_level=reduce_chain_level, fission_yield_opts=fission_yield_opts) @@ -285,7 +273,7 @@ class IndependentOperator(OpenMCOperator): Returns ------- nuclides : set of str - Set of nuclide names that have cross secton data + Set of nuclide names that have cross section data """ return set(cross_sections[0].nuclides) diff --git a/openmc/deplete/integrators.py b/openmc/deplete/integrators.py index 50810c88a..25e64cb2e 100644 --- a/openmc/deplete/integrators.py +++ b/openmc/deplete/integrators.py @@ -22,7 +22,6 @@ class PredictorIntegrator(Integrator): .. math:: \mathbf{n}_{i+1} = \exp\left(h\mathbf{A}(\mathbf{n}_i) \right) \mathbf{n}_i - """ _num_stages = 1 @@ -40,22 +39,19 @@ class PredictorIntegrator(Integrator): Time in [s] for the entire depletion interval source_rate : float Power in [W] or source rate in [neutron/sec] - _i : int or None - Iteration index. Not used + _i : int, optional + Current iteration count. Not used Returns ------- proc_time : float Time spent in CRAM routines for all materials in [s] - n_list : list of list of numpy.ndarray + n_end : list of numpy.ndarray Concentrations at end of interval - op_results : empty list - Kept for consistency with API. No intermediate calls to operator - with predictor """ - proc_time, n_end = self._timed_deplete(n, rates, dt) - return proc_time, [n_end], [] + proc_time, n_end = self._timed_deplete(n, rates, dt, _i) + return proc_time, n_end @add_params @@ -99,21 +95,18 @@ class CECMIntegrator(Integrator): ------- proc_time : float Time spent in CRAM routines for all materials in [s] - n_list : list of list of numpy.ndarray - Concentrations at each of the intermediate points with - the final concentration as the last element - op_results : list of openmc.deplete.OperatorResult - Eigenvalue and reaction rates from transport simulations + n_end : list of numpy.ndarray + Concentrations at end of interval """ # deplete across first half of interval - time0, n_middle = self._timed_deplete(n, rates, dt / 2) + time0, n_middle = self._timed_deplete(n, rates, dt / 2, _i) res_middle = self.operator(n_middle, source_rate) # deplete across entire interval with BOS concentrations, # MOS reaction rates - time1, n_end = self._timed_deplete(n, res_middle.rates, dt) + time1, n_end = self._timed_deplete(n, res_middle.rates, dt, _i) - return time0 + time1, [n_middle, n_end], [res_middle] + return time0 + time1, n_end @add_params @@ -163,39 +156,33 @@ class CF4Integrator(Integrator): ------- proc_time : float Time spent in CRAM routines for all materials in [s] - n_list : list of numpy.ndarray - Concentrations at each of the intermediate points with - the final concentration as the last element - op_results : list of openmc.deplete.OperatorResult - Eigenvalue and reaction rates from intermediate transport - simulations + n_end : list of numpy.ndarray + Concentrations at end of interval """ # Step 1: deplete with matrix 1/2*A(y0) time1, n_eos1 = self._timed_deplete( - n_bos, bos_rates, dt, matrix_func=cf4_f1) + n_bos, bos_rates, dt, _i, matrix_func=cf4_f1) res1 = self.operator(n_eos1, source_rate) # Step 2: deplete with matrix 1/2*A(y1) time2, n_eos2 = self._timed_deplete( - n_bos, res1.rates, dt, matrix_func=cf4_f1) + n_bos, res1.rates, dt, _i, matrix_func=cf4_f1) res2 = self.operator(n_eos2, source_rate) # Step 3: deplete with matrix -1/2*A(y0)+A(y2) list_rates = list(zip(bos_rates, res2.rates)) time3, n_eos3 = self._timed_deplete( - n_eos1, list_rates, dt, matrix_func=cf4_f2) + n_eos1, list_rates, dt, _i, matrix_func=cf4_f2) res3 = self.operator(n_eos3, source_rate) # Step 4: deplete with two matrix exponentials list_rates = list(zip(bos_rates, res1.rates, res2.rates, res3.rates)) time4, n_inter = self._timed_deplete( - n_bos, list_rates, dt, matrix_func=cf4_f3) + n_bos, list_rates, dt, _i, matrix_func=cf4_f3) time5, n_eos5 = self._timed_deplete( - n_inter, list_rates, dt, matrix_func=cf4_f4) + n_inter, list_rates, dt, _i, matrix_func=cf4_f4) - return (time1 + time2 + time3 + time4 + time5, - [n_eos1, n_eos2, n_eos3, n_eos5], - [res1, res2, res3]) + return time1 + time2 + time3 + time4 + time5, n_eos5 @add_params @@ -241,27 +228,23 @@ class CELIIntegrator(Integrator): ------- proc_time : float Time spent in CRAM routines for all materials in [s] - n_list : list of list of numpy.ndarray - Concentrations at each of the intermediate points with - the final concentration as the last element - op_results : list of openmc.deplete.OperatorResult - Eigenvalue and reaction rates from intermediate transport - simulation + n_end : list of numpy.ndarray + Concentrations at end of interval """ # deplete to end using BOS rates - proc_time, n_ce = self._timed_deplete(n_bos, rates, dt) + proc_time, n_ce = self._timed_deplete(n_bos, rates, dt, _i) res_ce = self.operator(n_ce, source_rate) # deplete using two matrix exponentials list_rates = list(zip(rates, res_ce.rates)) time_le1, n_inter = self._timed_deplete( - n_bos, list_rates, dt, matrix_func=celi_f1) + n_bos, list_rates, dt, _i, matrix_func=celi_f1) time_le2, n_end = self._timed_deplete( - n_inter, list_rates, dt, matrix_func=celi_f2) + n_inter, list_rates, dt, _i, matrix_func=celi_f2) - return proc_time + time_le1 + time_le1, [n_ce, n_end], [res_ce] + return proc_time + time_le1 + time_le2, n_end @add_params @@ -307,31 +290,27 @@ class EPCRK4Integrator(Integrator): ------- proc_time : float Time spent in CRAM routines for all materials in [s] - n_list : list of list of numpy.ndarray - Concentrations at each of the intermediate points with - the final concentration as the last element - op_results : list of openmc.deplete.OperatorResult - Eigenvalue and reaction rates from intermediate transport - simulations + n_end : list of numpy.ndarray + Concentrations at end of interval """ # Step 1: deplete with matrix A(y0) / 2 - time1, n1 = self._timed_deplete(n, rates, dt, matrix_func=rk4_f1) + time1, n1 = self._timed_deplete(n, rates, dt, _i, matrix_func=rk4_f1) res1 = self.operator(n1, source_rate) # Step 2: deplete with matrix A(y1) / 2 - time2, n2 = self._timed_deplete(n, res1.rates, dt, matrix_func=rk4_f1) + time2, n2 = self._timed_deplete(n, res1.rates, dt, _i, matrix_func=rk4_f1) res2 = self.operator(n2, source_rate) # Step 3: deplete with matrix A(y2) - time3, n3 = self._timed_deplete(n, res2.rates, dt) + time3, n3 = self._timed_deplete(n, res2.rates, dt, _i) res3 = self.operator(n3, source_rate) # Step 4: deplete with matrix built from weighted rates list_rates = list(zip(rates, res1.rates, res2.rates, res3.rates)) - time4, n4 = self._timed_deplete(n, list_rates, dt, matrix_func=rk4_f4) + time4, n4 = self._timed_deplete(n, list_rates, dt, _i, matrix_func=rk4_f4) - return (time1 + time2 + time3 + time4, [n1, n2, n3, n4], [res1, res2, res3]) + return time1 + time2 + time3 + time4, n4 @add_params @@ -389,12 +368,8 @@ class LEQIIntegrator(Integrator): ------- proc_time : float Time spent in CRAM routines for all materials in [s] - n_list : list of list of numpy.ndarray - Concentrations at each of the intermediate points with - the final concentration as the last element - op_results : list of openmc.deplete.OperatorResult - Eigenvalue and reaction rates from intermediate transport - simulation + n_end : list of numpy.ndarray + Concentrations at end of interval """ if i == 0: if self._i_res < 1: # need at least previous transport solution @@ -403,7 +378,7 @@ class LEQIIntegrator(Integrator): self, n_bos, bos_rates, dt, source_rate, i) prev_res = self.operator.prev_res[-2] prev_dt = self.timesteps[i] - prev_res.time[0] - self._prev_rates = prev_res.rates[0] + self._prev_rates = prev_res.rates else: prev_dt = self.timesteps[i - 1] @@ -414,9 +389,9 @@ class LEQIIntegrator(Integrator): self._prev_rates, bos_res.rates, repeat(prev_dt), repeat(dt))) time1, n_inter = self._timed_deplete( - n_bos, le_inputs, dt, matrix_func=leqi_f1) + n_bos, le_inputs, dt, i, matrix_func=leqi_f1) time2, n_eos0 = self._timed_deplete( - n_inter, le_inputs, dt, matrix_func=leqi_f2) + n_inter, le_inputs, dt, i, matrix_func=leqi_f2) res_inter = self.operator(n_eos0, source_rate) @@ -425,16 +400,14 @@ class LEQIIntegrator(Integrator): repeat(prev_dt), repeat(dt))) time3, n_inter = self._timed_deplete( - n_bos, qi_inputs, dt, matrix_func=leqi_f3) + n_bos, qi_inputs, dt, i, matrix_func=leqi_f3) time4, n_eos1 = self._timed_deplete( - n_inter, qi_inputs, dt, matrix_func=leqi_f4) + n_inter, qi_inputs, dt, i, matrix_func=leqi_f4) # store updated rates self._prev_rates = copy.deepcopy(bos_res.rates) - return ( - time1 + time2 + time3 + time4, [n_eos0, n_eos1], - [bos_res, res_inter]) + return time1 + time2 + time3 + time4, n_eos1 @add_params @@ -471,14 +444,13 @@ class SICELIIntegrator(SIIntegrator): ------- proc_time : float Time spent in CRAM routines for all materials in [s] - n_bos_list : list of list of numpy.ndarray - Concentrations at each of the intermediate points with - the final concentration as the last element - op_results : list of openmc.deplete.OperatorResult + n_end : list of numpy.ndarray + Concentrations at end of interval + op_result : openmc.deplete.OperatorResult Eigenvalue and reaction rates from intermediate transport simulations """ - proc_time, n_eos = self._timed_deplete(n_bos, bos_rates, dt) + proc_time, n_eos = self._timed_deplete(n_bos, bos_rates, dt, _i) n_inter = copy.deepcopy(n_eos) # Begin iteration @@ -494,13 +466,13 @@ class SICELIIntegrator(SIIntegrator): list_rates = list(zip(bos_rates, res_bar.rates)) time1, n_inter = self._timed_deplete( - n_bos, list_rates, dt, matrix_func=celi_f1) + n_bos, list_rates, dt, _i, matrix_func=celi_f1) time2, n_inter = self._timed_deplete( - n_inter, list_rates, dt, matrix_func=celi_f2) + n_inter, list_rates, dt, _i, matrix_func=celi_f2) proc_time += time1 + time2 # end iteration - return proc_time, [n_eos, n_inter], [res_bar] + return proc_time, n_inter, res_bar @add_params @@ -537,10 +509,9 @@ class SILEQIIntegrator(SIIntegrator): ------- proc_time : float Time spent in CRAM routines for all materials in [s] - n_list : list of list of numpy.ndarray - Concentrations at each of the intermediate points with - the final concentration as the last element - op_results : list of openmc.deplete.OperatorResult + n_end : list of numpy.ndarray + Concentrations at end of interval + op_result : openmc.deplete.OperatorResult Eigenvalue and reaction rates from intermediate transport simulation """ @@ -552,7 +523,7 @@ class SILEQIIntegrator(SIIntegrator): self, n_bos, bos_rates, dt, source_rate, i) prev_res = self.operator.prev_res[-2] prev_dt = self.timesteps[i] - prev_res.time[0] - self._prev_rates = prev_res.rates[0] + self._prev_rates = prev_res.rates else: prev_dt = self.timesteps[i - 1] @@ -560,9 +531,9 @@ class SILEQIIntegrator(SIIntegrator): inputs = list(zip(self._prev_rates, bos_rates, repeat(prev_dt), repeat(dt))) proc_time, n_inter = self._timed_deplete( - n_bos, inputs, dt, matrix_func=leqi_f1) + n_bos, inputs, dt, i, matrix_func=leqi_f1) time1, n_eos = self._timed_deplete( - n_inter, inputs, dt, matrix_func=leqi_f2) + n_inter, inputs, dt, i, matrix_func=leqi_f2) proc_time += time1 n_inter = copy.deepcopy(n_eos) @@ -580,12 +551,15 @@ class SILEQIIntegrator(SIIntegrator): inputs = list(zip(self._prev_rates, bos_rates, res_bar.rates, repeat(prev_dt), repeat(dt))) time1, n_inter = self._timed_deplete( - n_bos, inputs, dt, matrix_func=leqi_f3) + n_bos, inputs, dt, i, matrix_func=leqi_f3) time2, n_inter = self._timed_deplete( - n_inter, inputs, dt, matrix_func=leqi_f4) + n_inter, inputs, dt, i, matrix_func=leqi_f4) proc_time += time1 + time2 - return proc_time, [n_eos, n_inter], [res_bar] + # Store updated rates for next step + self._prev_rates = copy.deepcopy(bos_rates) + + return proc_time, n_inter, res_bar integrator_by_name = { diff --git a/openmc/deplete/microxs.py b/openmc/deplete/microxs.py index bbe9b2a43..879a2d4ee 100644 --- a/openmc/deplete/microxs.py +++ b/openmc/deplete/microxs.py @@ -5,21 +5,23 @@ IndependentOperator class for depletion. """ from __future__ import annotations -from collections.abc import Iterable, Sequence +from collections.abc import Sequence +import shutil from tempfile import TemporaryDirectory +from typing import Union, TypeAlias, Self +import h5py import pandas as pd import numpy as np from openmc.checkvalue import check_type, check_value, check_iterable_type, PathLike -from openmc.exceptions import DataError -from openmc.utility_funcs import change_directory from openmc import StatePoint from openmc.mgxs import GROUP_STRUCTURES from openmc.data import REACTION_MT import openmc -from .chain import Chain, REACTIONS +from .chain import Chain, REACTIONS, _get_chain from .coupled_operator import _find_cross_sections, _get_nuclides_with_data +from ..utility_funcs import h5py_file_or_group import openmc.lib from openmc.mpi import comm @@ -28,36 +30,46 @@ _valid_rxns.append('fission') _valid_rxns.append('damage-energy') -def _resolve_chain_file_path(chain_file: str | None): - if chain_file is None: - chain_file = openmc.config.get('chain_file') - if 'chain_file' not in openmc.config: - raise DataError( - "No depletion chain specified and could not find depletion " - "chain in openmc.config['chain_file']" - ) - return chain_file +# TODO: Replace with type statement when support is Python 3.12+ +DomainTypes: TypeAlias = Union[ + Sequence[openmc.Material], + Sequence[openmc.Cell], + Sequence[openmc.Universe], + openmc.MeshBase, + openmc.Filter +] def get_microxs_and_flux( - model: openmc.Model, - domains, - nuclides: Iterable[str] | None = None, - reactions: Iterable[str] | None = None, - energies: Iterable[float] | str | None = None, - chain_file: PathLike | None = None, - run_kwargs=None - ) -> tuple[list[np.ndarray], list[MicroXS]]: - """Generate a microscopic cross sections and flux from a Model + model: openmc.Model, + domains: DomainTypes, + nuclides: Sequence[str] | None = None, + reactions: Sequence[str] | None = None, + energies: Sequence[float] | str | None = None, + reaction_rate_mode: str = 'direct', + chain_file: PathLike | Chain | None = None, + path_statepoint: PathLike | None = None, + path_input: PathLike | None = None, + run_kwargs=None +) -> tuple[list[np.ndarray], list[MicroXS]]: + """Generate microscopic cross sections and fluxes for multiple domains. + + This function runs a neutron transport solve to obtain the flux and reaction + rates in the specified domains and computes multigroup microscopic cross + sections that can be used in depletion calculations with the + :class:`~openmc.deplete.IndependentOperator` class. .. versionadded:: 0.14.0 + .. versionchanged:: 0.15.3 + Added `reaction_rate_mode`, `path_statepoint`, `path_input` arguments. + Parameters ---------- model : openmc.Model OpenMC model object. Must contain geometry, materials, and settings. - domains : list of openmc.Material or openmc.Cell or openmc.Universe, or openmc.MeshBase - Domains in which to tally reaction rates. + domains : list of openmc.Material or openmc.Cell or openmc.Universe, or openmc.MeshBase, or openmc.Filter + Domains in which to tally reaction rates, or a spatial tally filter. nuclides : list of str Nuclides to get cross sections for. If not specified, all burnable nuclides from the depletion chain file are used. @@ -65,12 +77,26 @@ def get_microxs_and_flux( Reactions to get cross sections for. If not specified, all neutron reactions listed in the depletion chain file are used. energies : iterable of float or str - Energy group boundaries in [eV] or the name of the group structure - chain_file : str, optional - Path to the depletion chain XML file that will be used in depletion - simulation. Used to determine cross sections for materials not + Energy group boundaries in [eV] or the name of the group structure. + If left as None energies will default to [0.0, 100e6] + reaction_rate_mode : {"direct", "flux"}, optional + Indicate how reaction rates should be calculated. The "direct" method + tallies reaction rates directly. The "flux" method tallies a multigroup + flux spectrum and then collapses multigroup reaction rates after a + transport solve (with an option to tally some reaction rates directly). + chain_file : PathLike or Chain, optional + Path to the depletion chain XML file or an instance of + openmc.deplete.Chain. Used to determine cross sections for materials not present in the inital composition. Defaults to ``openmc.config['chain_file']``. + path_statepoint : path-like, optional + Path to write the statepoint file from the neutron transport solve to. + By default, The statepoint file is written to a temporary directory and + is not kept. + path_input : path-like, optional + Path to write the model XML file from the neutron transport solve to. + By default, the model XML file is written to a temporary directory and + not kept. run_kwargs : dict, optional Keyword arguments passed to :meth:`openmc.Model.run` @@ -81,13 +107,18 @@ def get_microxs_and_flux( list of MicroXS Cross section data in [b] for each domain + See Also + -------- + openmc.deplete.IndependentOperator + """ + check_value('reaction_rate_mode', reaction_rate_mode, {'direct', 'flux'}) + # Save any original tallies on the model - original_tallies = model.tallies + original_tallies = list(model.tallies) # Determine what reactions and nuclides are available in chain - chain_file = _resolve_chain_file_path(chain_file) - chain = Chain.from_xml(chain_file) + chain = _get_chain(chain_file) if reactions is None: reactions = chain.reactions if not nuclides: @@ -98,12 +129,15 @@ def get_microxs_and_flux( # Set up the reaction rate and flux tallies if energies is None: - energy_filter = openmc.EnergyFilter([0.0, 100.0e6]) - elif isinstance(energies, str): + energies = [0.0, 100.0e6] + if isinstance(energies, str): energy_filter = openmc.EnergyFilter.from_group_structure(energies) else: energy_filter = openmc.EnergyFilter(energies) - if isinstance(domains, openmc.MeshBase): + + if isinstance(domains, openmc.Filter): + domain_filter = domains + elif isinstance(domains, openmc.MeshBase): domain_filter = openmc.MeshFilter(domains) elif isinstance(domains[0], openmc.Material): domain_filter = openmc.MaterialFilter(domains) @@ -114,16 +148,18 @@ def get_microxs_and_flux( else: raise ValueError(f"Unsupported domain type: {type(domains[0])}") - rr_tally = openmc.Tally(name='MicroXS RR') - rr_tally.filters = [domain_filter, energy_filter] - rr_tally.nuclides = nuclides - rr_tally.multiply_density = False - rr_tally.scores = reactions - flux_tally = openmc.Tally(name='MicroXS flux') flux_tally.filters = [domain_filter, energy_filter] flux_tally.scores = ['flux'] - model.tallies = openmc.Tallies([rr_tally, flux_tally]) + model.tallies = [flux_tally] + + if reaction_rate_mode == 'direct': + rr_tally = openmc.Tally(name='MicroXS RR') + rr_tally.filters = [domain_filter, energy_filter] + rr_tally.nuclides = nuclides + rr_tally.multiply_density = False + rr_tally.scores = reactions + model.tallies.append(rr_tally) if openmc.lib.is_initialized: openmc.lib.finalize() @@ -134,43 +170,73 @@ def get_microxs_and_flux( # Reinitialize with tallies openmc.lib.init(intracomm=comm) - # create temporary run with TemporaryDirectory() as temp_dir: - if run_kwargs is None: - run_kwargs = {} - else: - run_kwargs = dict(run_kwargs) - run_kwargs.setdefault('cwd', temp_dir) + # Indicate to run in temporary directory unless being executed through + # openmc.lib, in which case we don't need to specify the cwd + run_kwargs = dict(run_kwargs) if run_kwargs else {} + if not openmc.lib.is_initialized: + run_kwargs.setdefault('cwd', temp_dir) + + # Run transport simulation and synchronize statepoint_path = model.run(**run_kwargs) + comm.barrier() if comm.rank == 0: - with StatePoint(statepoint_path) as sp: + # Move the statepoint file if it is being saved to a specific path + if path_statepoint is not None: + shutil.move(statepoint_path, path_statepoint) + statepoint_path = path_statepoint + + # Export the model to path_input if provided + if path_input is not None: + model.export_to_model_xml(path_input) + + # Broadcast updated statepoint path to all ranks + statepoint_path = comm.bcast(statepoint_path) + + # Read in tally results (on all ranks) + with StatePoint(statepoint_path) as sp: + if reaction_rate_mode == 'direct': rr_tally = sp.tallies[rr_tally.id] rr_tally._read_results() - flux_tally = sp.tallies[flux_tally.id] - flux_tally._read_results() + flux_tally = sp.tallies[flux_tally.id] + flux_tally._read_results() - rr_tally = comm.bcast(rr_tally) - flux_tally = comm.bcast(flux_tally) - # Get reaction rates and flux values - reaction_rates = rr_tally.get_reshaped_data() # (domains, groups, nuclides, reactions) + # Get flux values and make energy groups last dimension flux = flux_tally.get_reshaped_data() # (domains, groups, 1, 1) - - # Make energy groups last dimension - reaction_rates = np.moveaxis(reaction_rates, 1, -1) # (domains, nuclides, reactions, groups) flux = np.moveaxis(flux, 1, -1) # (domains, 1, 1, groups) - # Divide RR by flux to get microscopic cross sections - xs = np.empty_like(reaction_rates) # (domains, nuclides, reactions, groups) - d, _, _, g = np.nonzero(flux) - xs[d, ..., g] = reaction_rates[d, ..., g] / flux[d, :, :, g] + # Create list where each item corresponds to one domain + fluxes = list(flux.squeeze((1, 2))) + + if reaction_rate_mode == 'direct': + # Get reaction rates + reaction_rates = rr_tally.get_reshaped_data() # (domains, groups, nuclides, reactions) + + # Make energy groups last dimension + reaction_rates = np.moveaxis(reaction_rates, 1, -1) # (domains, nuclides, reactions, groups) + + # Divide RR by flux to get microscopic cross sections. The indexing + # ensures that only non-zero flux values are used, and broadcasting is + # applied to align the shapes of reaction_rates and flux for division. + xs = np.empty_like(reaction_rates) # (domains, nuclides, reactions, groups) + d, _, _, g = np.nonzero(flux) + xs[d, ..., g] = reaction_rates[d, ..., g] / flux[d, :, :, g] + + # Create lists where each item corresponds to one domain + micros = [MicroXS(xs_i, nuclides, reactions) for xs_i in xs] + else: + micros = [MicroXS.from_multigroup_flux( + energies=energies, + multigroup_flux=flux_i, + chain_file=chain_file, + nuclides=nuclides, + reactions=reactions + ) for flux_i in fluxes] # Reset tallies model.tallies = original_tallies - # Create lists where each item corresponds to one domain - fluxes = list(flux.squeeze((1, 2))) - micros = [MicroXS(xs_i, nuclides, reactions) for xs_i in xs] return fluxes, micros @@ -234,17 +300,21 @@ class MicroXS: sections available. MicroXS entry will be 0 if the nuclide cross section is not found. + It is recommended to make repeated calls to this method within a context + manager using the :class:`openmc.lib.TemporarySession` class to avoid + re-initializing OpenMC and loading cross sections each time. + .. versionadded:: 0.15.0 Parameters ---------- energies : iterable of float or str Energy group boundaries in [eV] or the name of the group structure - multi_group_flux : iterable of float + multigroup_flux : iterable of float Energy-dependent multigroup flux values - chain_file : str, optional - Path to the depletion chain XML file that will be used in depletion - simulation. Defaults to ``openmc.config['chain_file']``. + chain_file : PathLike or Chain, optional + Path to the depletion chain XML file or an instance of + openmc.deplete.Chain. Defaults to ``openmc.config['chain_file']``. temperature : int, optional Temperature for cross section evaluation in [K]. nuclides : list of str, optional @@ -275,9 +345,7 @@ class MicroXS: if len(multigroup_flux) != len(energies) - 1: raise ValueError('Length of flux array should be len(energies)-1') - chain_file_path = _resolve_chain_file_path(chain_file) - chain = Chain.from_xml(chain_file_path) - + chain = _get_chain(chain_file) cross_sections = _find_cross_sections(model=None) nuclides_with_data = _get_nuclides_with_data(cross_sections) @@ -292,44 +360,28 @@ class MicroXS: reactions = chain.reactions mts = [REACTION_MT[name] for name in reactions] - # Normalize multigroup flux - multigroup_flux = np.array(multigroup_flux) - multigroup_flux /= multigroup_flux.sum() - # Create 3D array for microscopic cross sections microxs_arr = np.zeros((len(nuclides), len(mts), 1)) - # Create a material with all nuclides - mat_all_nucs = openmc.Material() - for nuc in nuclides: - if nuc in nuclides_with_data: - mat_all_nucs.add_nuclide(nuc, 1.0) - mat_all_nucs.set_density("atom/b-cm", 1.0) + # If flux is zero, safely return zero cross sections + multigroup_flux = np.array(multigroup_flux) + if (flux_sum := multigroup_flux.sum()) == 0.0: + return cls(microxs_arr, nuclides, reactions) - # Create simple model containing the above material - surf1 = openmc.Sphere(boundary_type="vacuum") - surf1_cell = openmc.Cell(fill=mat_all_nucs, region=-surf1) - model = openmc.Model() - model.geometry = openmc.Geometry([surf1_cell]) - model.settings = openmc.Settings( - particles=1, batches=1, output={'summary': False}) + # Normalize multigroup flux + multigroup_flux /= flux_sum - with change_directory(tmpdir=True): - # Export model within temporary directory - model.export_to_model_xml() - - with openmc.lib.run_in_memory(**init_kwargs): - # For each nuclide and reaction, compute the flux-averaged - # cross section - for nuc_index, nuc in enumerate(nuclides): - if nuc not in nuclides_with_data: - continue - lib_nuc = openmc.lib.nuclides[nuc] - for mt_index, mt in enumerate(mts): - xs = lib_nuc.collapse_rate( - mt, temperature, energies, multigroup_flux - ) - microxs_arr[nuc_index, mt_index, 0] = xs + # Compute microscopic cross sections within a temporary session + with openmc.lib.TemporarySession(**init_kwargs): + # For each nuclide and reaction, compute the flux-averaged xs + for nuc_index, nuc in enumerate(nuclides): + if nuc not in nuclides_with_data: + continue + lib_nuc = openmc.lib.load_nuclide(nuc) + for mt_index, mt in enumerate(mts): + microxs_arr[nuc_index, mt_index, 0] = lib_nuc.collapse_rate( + mt, temperature, energies, multigroup_flux + ) return cls(microxs_arr, nuclides, reactions) @@ -350,8 +402,7 @@ class MicroXS: MicroXS """ - if 'float_precision' not in kwargs: - kwargs['float_precision'] = 'round_trip' + kwargs.setdefault('float_precision', 'round_trip') df = pd.read_csv(csv_file, **kwargs) df.set_index(['nuclides', 'reactions', 'groups'], inplace=True) @@ -386,3 +437,96 @@ class MicroXS: ) df = pd.DataFrame({'xs': self.data.flatten()}, index=multi_index) df.to_csv(*args, **kwargs) + + def to_hdf5(self, group_or_filename: h5py.Group | PathLike, **kwargs): + """Export microscopic cross section data to HDF5 format + + Parameters + ---------- + group_or_filename : h5py.Group or path-like + HDF5 group or filename to write to + kwargs : dict, optional + Keyword arguments to pass to :meth:`h5py.Group.create_dataset`. + Defaults to {'compression': 'lzf'}. + + """ + kwargs.setdefault('compression', 'lzf') + + with h5py_file_or_group(group_or_filename, 'w') as group: + # Store cross section data as 3D dataset + group.create_dataset('data', data=self.data, **kwargs) + + # Store metadata as datasets using string encoding + group.create_dataset('nuclides', data=np.array(self.nuclides, dtype='S')) + group.create_dataset('reactions', data=np.array(self.reactions, dtype='S')) + + @classmethod + def from_hdf5(cls, group_or_filename: h5py.Group | PathLike) -> Self: + """Load data from an HDF5 file + + Parameters + ---------- + group_or_filename : h5py.Group or str or PathLike + HDF5 group or path to HDF5 file. If given as an h5py.Group, the + data is read from that group. If given as a string, it is assumed + to be the filename for the HDF5 file. + + Returns + ------- + MicroXS + """ + + with h5py_file_or_group(group_or_filename, 'r') as group: + # Read data from HDF5 group + data = group['data'][:] + nuclides = [nuc.decode('utf-8') for nuc in group['nuclides'][:]] + reactions = [rxn.decode('utf-8') for rxn in group['reactions'][:]] + + return cls(data, nuclides, reactions) + + +def write_microxs_hdf5( + micros: Sequence[MicroXS], + filename: PathLike, + names: Sequence[str] | None = None, + **kwargs +): + """Write multiple MicroXS objects to an HDF5 file + + Parameters + ---------- + micros : list of MicroXS + List of MicroXS objects + filename : PathLike + Output HDF5 filename + names : list of str, optional + Names for each MicroXS object. If None, uses 'domain_0', 'domain_1', + etc. + **kwargs + Additional keyword arguments passed to :meth:`h5py.Group.create_dataset` + """ + if names is None: + names = [f'domain_{i}' for i in range(len(micros))] + + # Open file once and write all domains using group interface + with h5py.File(filename, 'w') as f: + for microxs, name in zip(micros, names): + group = f.create_group(name) + microxs.to_hdf5(group, **kwargs) + + +def read_microxs_hdf5(filename: PathLike) -> dict[str, MicroXS]: + """Read multiple MicroXS objects from an HDF5 file + + Parameters + ---------- + filename : path-like + HDF5 filename + + Returns + ------- + dict + Dictionary mapping domain names to MicroXS objects + """ + with h5py.File(filename, 'r') as f: + return {name: MicroXS.from_hdf5(group) for name, group in f.items()} diff --git a/openmc/deplete/nuclide.py b/openmc/deplete/nuclide.py index 60e3e5317..958814834 100644 --- a/openmc/deplete/nuclide.py +++ b/openmc/deplete/nuclide.py @@ -14,6 +14,7 @@ import numpy as np from openmc.checkvalue import check_type from openmc.stats import Univariate +from .._xml import get_elem_list, get_text __all__ = [ "DecayTuple", "ReactionTuple", "Nuclide", "FissionYield", @@ -225,38 +226,39 @@ class Nuclide: """ nuc = cls() - nuc.name = element.get('name') + nuc.name = get_text(element, "name") # Check for half-life - if 'half_life' in element.attrib: - nuc.half_life = float(element.get('half_life')) - nuc.decay_energy = float(element.get('decay_energy', '0')) + half_life = get_text(element, "half_life") + if half_life is not None: + nuc.half_life = float(half_life) + nuc.decay_energy = float(get_text(element, "decay_energy", 0.0)) # Check for decay paths for decay_elem in element.iter('decay'): - d_type = decay_elem.get('type') - target = decay_elem.get('target') + d_type = get_text(decay_elem, "type") + target = get_text(decay_elem, "target") if target is not None and target.lower() == "nothing": target = None - branching_ratio = float(decay_elem.get('branching_ratio')) + branching_ratio = float(get_text(decay_elem, "branching_ratio")) nuc.decay_modes.append(DecayTuple(d_type, target, branching_ratio)) # Check for sources for src_elem in element.iter('source'): - particle = src_elem.get('particle') + particle = get_text(src_elem, "particle") distribution = Univariate.from_xml_element(src_elem) nuc.sources[particle] = distribution # Check for reaction paths for reaction_elem in element.iter('reaction'): - r_type = reaction_elem.get('type') - Q = float(reaction_elem.get('Q', '0')) - branching_ratio = float(reaction_elem.get('branching_ratio', '1')) + r_type = get_text(reaction_elem, "type") + Q = float(get_text(reaction_elem, "Q", 0.0)) + branching_ratio = float(get_text(reaction_elem, "branching_ratio", 1.0)) # If the type is not fission, get target and Q value, otherwise # just set null values if r_type != 'fission': - target = reaction_elem.get('target') + target = get_text(reaction_elem, "target") if target is not None and target.lower() == "nothing": target = None else: @@ -271,7 +273,7 @@ class Nuclide: fpy_elem = element.find('neutron_fission_yields') if fpy_elem is not None: # Check for use of FPY from other nuclide - parent = fpy_elem.get('parent') + parent = get_text(fpy_elem, "parent") if parent is not None: assert root is not None fpy_elem = root.find( @@ -529,9 +531,9 @@ class FissionYieldDistribution(Mapping): """ all_yields = {} for yield_elem in element.iter("fission_yields"): - energy = float(yield_elem.get("energy")) - products = yield_elem.find("products").text.split() - yields = map(float, yield_elem.find("data").text.split()) + energy = float(get_text(yield_elem, "energy")) + products = get_elem_list(yield_elem, "products", str) or [] + yields = get_elem_list(yield_elem, "data", float) or [] # Get a map of products to their corresponding yield all_yields[energy] = dict(zip(products, yields)) diff --git a/openmc/deplete/openmc_operator.py b/openmc/deplete/openmc_operator.py index 64cb0a7e5..2d7694093 100644 --- a/openmc/deplete/openmc_operator.py +++ b/openmc/deplete/openmc_operator.py @@ -11,7 +11,7 @@ from warnings import warn import numpy as np import openmc -from openmc.checkvalue import check_value +from openmc.checkvalue import check_value, check_type, check_greater_than from openmc.exceptions import DataError from openmc.mpi import comm from .abc import TransportOperator, OperatorResult @@ -36,9 +36,9 @@ class OpenMCOperator(TransportOperator): cross_sections : str or list of MicroXS Path to continuous energy cross section library, or list of objects containing cross sections. - chain_file : str, optional - Path to the depletion chain XML file. Defaults to - openmc.config['chain_file']. + chain_file : PathLike or Chain, optional + Path to the depletion chain XML file or instance of openmc.deplete.Chain. + Defaults to ``openmc.config['chain_file']``. prev_results : Results, optional Results from a previous depletion calculation. If this argument is specified, the depletion calculation will start from the latest state @@ -49,13 +49,9 @@ class OpenMCOperator(TransportOperator): Dictionary of nuclides and their fission Q values [eV]. helper_kwargs : dict Keyword arguments for helper classes - reduce_chain : bool, optional - If True, use :meth:`openmc.deplete.Chain.reduce()` to reduce the - depletion chain up to ``reduce_chain_level``. reduce_chain_level : int, optional - Depth of the search when reducing the depletion chain. Only used - if ``reduce_chain`` evaluates to true. The default value of - ``None`` implies no limit on the depth. + Depth of the search when reducing the depletion chain. The default + value of ``None`` implies no limit on the depth. diff_volume_method : str Specifies how the volumes of the new materials should be found. Default @@ -107,7 +103,6 @@ class OpenMCOperator(TransportOperator): diff_volume_method='divide equally', fission_q=None, helper_kwargs=None, - reduce_chain=False, reduce_chain_level=None): # If chain file was not specified, try to get it from global config @@ -126,10 +121,13 @@ class OpenMCOperator(TransportOperator): check_value('diff volume method', diff_volume_method, {'divide equally', 'match cell'}) + if reduce_chain_level: + check_type('reduce_chain_level', reduce_chain_level, int) + check_greater_than('reduce_chain_level', reduce_chain_level, 0) self.diff_volume_method = diff_volume_method # Reduce the chain to only those nuclides present - if reduce_chain: + if reduce_chain_level is not None: init_nuclides = set() for material in self.materials: if not material.depletable: diff --git a/openmc/deplete/pool.py b/openmc/deplete/pool.py index 27ecaa4dd..58f90894b 100644 --- a/openmc/deplete/pool.py +++ b/openmc/deplete/pool.py @@ -5,10 +5,11 @@ Provided to avoid some circular imports from itertools import repeat, starmap from multiprocessing import Pool -from scipy.sparse import bmat import numpy as np +from scipy.sparse import hstack from openmc.mpi import comm +from .._sparse_compat import block_array # Configurable switch that enables / disables the use of # multiprocessing routines during depletion @@ -40,8 +41,8 @@ def _distribute(items): return items[j:j + chunk_size] j += chunk_size -def deplete(func, chain, n, rates, dt, matrix_func=None, transfer_rates=None, - *matrix_args): +def deplete(func, chain, n, rates, dt, current_timestep=None, matrix_func=None, + transfer_rates=None, external_source_rates=None, *matrix_args): """Deplete materials using given reaction rates for a specified time Parameters @@ -58,15 +59,21 @@ def deplete(func, chain, n, rates, dt, matrix_func=None, transfer_rates=None, Reaction rates (from transport operator) dt : float Time in [s] to deplete for + current_timestep : int + Current timestep index maxtrix_func : callable, optional Function to form the depletion matrix after calling ``matrix_func(chain, rates, fission_yields)``, where ``fission_yields = {parent: {product: yield_frac}}`` Expected to return the depletion matrix required by ``func`` transfer_rates : openmc.deplete.TransferRates, Optional - Object to perform continuous reprocessing. + Transfer rates for continuous removal/feed. .. versionadded:: 0.14.0 + external_source_rates : openmc.deplete.ExternalSourceRates, Optional + External source rates for continuous removal/feed. + + .. versionadded:: 0.15.3 matrix_args: Any, optional Additional arguments passed to matrix_func @@ -93,15 +100,24 @@ def deplete(func, chain, n, rates, dt, matrix_func=None, transfer_rates=None, matrices = map(matrix_func, repeat(chain), rates, fission_yields, *matrix_args) - if transfer_rates is not None: + if (transfer_rates is not None and + current_timestep in transfer_rates.external_timesteps): # Calculate transfer rate terms as diagonal matrices transfers = map(chain.form_rr_term, repeat(transfer_rates), - transfer_rates.local_mats) + repeat(current_timestep), transfer_rates.local_mats) + # Subtract transfer rate terms from Bateman matrices matrices = [matrix - transfer for (matrix, transfer) in zip(matrices, transfers)] - if len(transfer_rates.index_transfer) > 0: + if transfer_rates.redox: + for mat_idx, mat_id in enumerate(transfer_rates.local_mats): + if mat_id in transfer_rates.redox: + matrices[mat_idx] = chain.add_redox_term(matrices[mat_idx], + transfer_rates.redox[mat_id][0], + transfer_rates.redox[mat_id][1]) + + if current_timestep in transfer_rates.index_transfer: # Gather all on comm.rank 0 matrices = comm.gather(matrices) n = comm.gather(n) @@ -112,10 +128,18 @@ def deplete(func, chain, n, rates, dt, matrix_func=None, transfer_rates=None, n = [n_elm for n_mat in n for n_elm in n_mat] # Calculate transfer rate terms as diagonal matrices - transfer_pair = { - mat_pair: chain.form_rr_term(transfer_rates, mat_pair) - for mat_pair in transfer_rates.index_transfer - } + transfer_pair = {} + for mat_pair in transfer_rates.index_transfer[current_timestep]: + transfer_matrix = chain.form_rr_term(transfer_rates, + current_timestep, + mat_pair) + + # check if destination material has a redox control + if mat_pair[0] in transfer_rates.redox: + transfer_matrix = chain.add_redox_term(transfer_matrix, + transfer_rates.redox[mat_pair[0]][0], + transfer_rates.redox[mat_pair[0]][1]) + transfer_pair[mat_pair] = transfer_matrix # Combine all matrices together in a single matrix of matrices # to be solved in one go @@ -129,14 +153,14 @@ def deplete(func, chain, n, rates, dt, matrix_func=None, transfer_rates=None, if row == col: # Fill the diagonals with the Bateman matrices cols.append(matrices[row]) - elif mat_pair in transfer_rates.index_transfer: + elif mat_pair in transfer_rates.index_transfer[current_timestep]: # Fill the off-diagonals with the transfer pair matrices cols.append(transfer_pair[mat_pair]) else: cols.append(None) rows.append(cols) - matrix = bmat(rows) + matrix = block_array(rows) # Concatenate vectors of nuclides in one n_multi = np.concatenate(n) @@ -155,6 +179,25 @@ def deplete(func, chain, n, rates, dt, matrix_func=None, transfer_rates=None, return n_result + if (external_source_rates is not None and + current_timestep in external_source_rates.external_timesteps): + # Calculate external source term vectors + sources = map(chain.form_ext_source_term, repeat(external_source_rates), + repeat(current_timestep), external_source_rates.local_mats) + + # stack vector column at the end of the matrix + matrices = [ + hstack([matrix, source]) + for matrix, source in zip(matrices, sources) + ] + + # Add a last row of zeroes to the matrices and append 1 to the last row + # of the nuclide vectors + for i, matrix in enumerate(matrices): + if not np.equal(*matrix.shape): + matrix.resize(matrix.shape[1], matrix.shape[1]) + n[i] = np.append(n[i], 1.0) + inputs = zip(matrices, n, repeat(dt)) if USE_MULTIPROCESSING: @@ -163,4 +206,10 @@ def deplete(func, chain, n, rates, dt, matrix_func=None, transfer_rates=None, else: n_result = list(starmap(func, inputs)) + # Remove extra value at the end of the nuclide vectors + if (external_source_rates is not None and + current_timestep in external_source_rates.external_timesteps): + external_source_rates.reformat_nuclide_vectors(n) + external_source_rates.reformat_nuclide_vectors(n_result) + return n_result diff --git a/openmc/deplete/r2s.py b/openmc/deplete/r2s.py new file mode 100644 index 000000000..97277cbda --- /dev/null +++ b/openmc/deplete/r2s.py @@ -0,0 +1,693 @@ +from __future__ import annotations +from collections.abc import Sequence +import copy +from datetime import datetime +import json +from pathlib import Path + +import numpy as np +import openmc +from . import IndependentOperator, PredictorIntegrator +from .microxs import get_microxs_and_flux, write_microxs_hdf5, read_microxs_hdf5 +from .results import Results +from ..checkvalue import PathLike +from ..mpi import comm +from openmc.lib import TemporarySession +from openmc.utility_funcs import change_directory + + +def get_activation_materials( + model: openmc.Model, mmv: openmc.MeshMaterialVolumes +) -> openmc.Materials: + """Get a list of activation materials for each mesh element/material. + + When performing a mesh-based R2S calculation, a unique material is needed + for each activation region, which is a combination of a mesh element and a + material within that mesh element. This function generates a list of such + materials, each with a unique name and volume corresponding to the mesh + element and material. + + Parameters + ---------- + model : openmc.Model + The full model containing the geometry and materials. + mmv : openmc.MeshMaterialVolumes + The mesh material volumes object containing the materials and their + volumes for each mesh element. + + Returns + ------- + openmc.Materials + A list of materials, each corresponding to a unique mesh element and + material combination. + + """ + # Get the material ID, volume, and element index for each element-material + # combination + mat_ids = mmv._materials[mmv._materials > -1] + volumes = mmv._volumes[mmv._materials > -1] + elems, _ = np.where(mmv._materials > -1) + + # Get all materials in the model + material_dict = model._get_all_materials() + + # Create a new activation material for each element-material combination + materials = openmc.Materials() + for elem, mat_id, vol in zip(elems, mat_ids, volumes): + mat = material_dict[mat_id] + new_mat = mat.clone() + new_mat.depletable = True + new_mat.name = f'Element {elem}, Material {mat_id}' + new_mat.volume = vol + materials.append(new_mat) + + return materials + + +class R2SManager: + """Manager for Rigorous 2-Step (R2S) method calculations. + + This class is responsible for managing the materials and sources needed for + mesh-based or cell-based R2S calculations. It provides methods to get + activation materials and decay photon sources based on the mesh/cells and + materials in the OpenMC model. + + This class supports the use of a different models for the neutron and photon + transport calculation. However, for cell-based calculations, it assumes that + the only changes in the model are material assignments. For mesh-based + calculations, it checks material assignments in the photon model and any + element--material combinations that don't appear in the photon model are + skipped. + + Parameters + ---------- + neutron_model : openmc.Model + The OpenMC model to use for neutron transport. + domains : openmc.MeshBase or Sequence[openmc.Cell] + The mesh or a sequence of cells that represent the spatial units over + which the R2S calculation will be performed. + photon_model : openmc.Model, optional + The OpenMC model to use for photon transport calculations. If None, a + shallow copy of the neutron_model will be created and used. + + Attributes + ---------- + domains : openmc.MeshBase or Sequence[openmc.Cell] + The mesh or a sequence of cells that represent the spatial units over + which the R2S calculation will be performed. + neutron_model : openmc.Model + The OpenMC model used for neutron transport. + photon_model : openmc.Model + The OpenMC model used for photon transport calculations. + method : {'mesh-based', 'cell-based'} + Indicates whether the R2S calculation uses mesh elements ('mesh-based') + as the spatial discetization or a list of a cells ('cell-based'). + results : dict + A dictionary that stores results from the R2S calculation. + + """ + def __init__( + self, + neutron_model: openmc.Model, + domains: openmc.MeshBase | Sequence[openmc.Cell], + photon_model: openmc.Model | None = None, + ): + self.neutron_model = neutron_model + if photon_model is None: + # Create a shallow copy of the neutron model for photon transport + self.photon_model = openmc.Model( + geometry=copy.copy(neutron_model.geometry), + materials=copy.copy(neutron_model.materials), + settings=copy.copy(neutron_model.settings), + tallies=copy.copy(neutron_model.tallies), + plots=copy.copy(neutron_model.plots), + ) + else: + self.photon_model = photon_model + if isinstance(domains, openmc.MeshBase): + self.method = 'mesh-based' + else: + self.method = 'cell-based' + self.domains = domains + self.results = {} + + def run( + self, + timesteps: Sequence[float] | Sequence[tuple[float, str]], + source_rates: float | Sequence[float], + timestep_units: str = 's', + photon_time_indices: Sequence[int] | None = None, + output_dir: PathLike | None = None, + bounding_boxes: dict[int, openmc.BoundingBox] | None = None, + chain_file: PathLike | None = None, + micro_kwargs: dict | None = None, + mat_vol_kwargs: dict | None = None, + run_kwargs: dict | None = None, + operator_kwargs: dict | None = None, + ): + """Run the R2S calculation. + + Parameters + ---------- + timesteps : Sequence[float] or Sequence[tuple[float, str]] + Sequence of timesteps. Note that values are not cumulative. The + units are specified by the `timestep_units` argument when + `timesteps` is an iterable of float. Alternatively, units can be + specified for each step by passing an iterable of (value, unit) + tuples. + source_rates : float or Sequence[float] + Source rate in [neutron/sec] for each interval in `timesteps`. + timestep_units : {'s', 'min', 'h', 'd', 'a'}, optional + Units for values specified in the `timesteps` argument when passing + float values. 's' means seconds, 'min' means minutes, 'h' means + hours, 'd' means days, and 'a' means years (Julian). + photon_time_indices : Sequence[int], optional + Sequence of time indices at which photon transport should be run; + represented as indices into the array of times formed by the + timesteps. For example, if two timesteps are specified, the array of + times would contain three entries, and [2] would indicate computing + photon results at the last time. A value of None indicates to run + photon transport for each time. + output_dir : PathLike, optional + Path to directory where R2S calculation outputs will be saved. If + not provided, a timestamped directory 'r2s_YYYY-MM-DDTHH-MM-SS' is + created. Subdirectories will be created for the neutron transport, + activation, and photon transport steps. + bounding_boxes : dict[int, openmc.BoundingBox], optional + Dictionary mapping cell IDs to bounding boxes used for spatial + source sampling in cell-based R2S calculations. Required if method + is 'cell-based'. + chain_file : PathLike, optional + Path to the depletion chain XML file to use during activation. If + not provided, the default configured chain file will be used. + micro_kwargs : dict, optional + Additional keyword arguments passed to + :func:`openmc.deplete.get_microxs_and_flux` during the neutron + transport step. + mat_vol_kwargs : dict, optional + Additional keyword arguments passed to + :meth:`openmc.MeshBase.material_volumes`. + run_kwargs : dict, optional + Additional keyword arguments passed to :meth:`openmc.Model.run` + during the neutron and photon transport step. By default, output is + disabled. + operator_kwargs : dict, optional + Additional keyword arguments passed to + :class:`openmc.deplete.IndependentOperator`. + + Returns + ------- + Path + Path to the output directory containing all calculation results + """ + + if output_dir is None: + # Create timestamped output directory and broadcast to all ranks for + # consistency (different ranks may have slightly different times) + stamp = datetime.now().strftime('%Y-%m-%dT%H-%M-%S') + output_dir = Path(comm.bcast(f'r2s_{stamp}')) + + # Set run_kwargs for the neutron transport step + if micro_kwargs is None: + micro_kwargs = {} + if run_kwargs is None: + run_kwargs = {} + if operator_kwargs is None: + operator_kwargs = {} + run_kwargs.setdefault('output', False) + micro_kwargs.setdefault('run_kwargs', run_kwargs) + # If a chain file is provided, prefer it for steps 1 and 2 + if chain_file is not None: + micro_kwargs.setdefault('chain_file', chain_file) + operator_kwargs.setdefault('chain_file', chain_file) + + self.step1_neutron_transport( + output_dir / 'neutron_transport', mat_vol_kwargs, micro_kwargs + ) + self.step2_activation( + timesteps, source_rates, timestep_units, output_dir / 'activation', + operator_kwargs=operator_kwargs + ) + self.step3_photon_transport( + photon_time_indices, bounding_boxes, output_dir / 'photon_transport', + mat_vol_kwargs=mat_vol_kwargs, run_kwargs=run_kwargs + ) + + return output_dir + + def step1_neutron_transport( + self, + output_dir: PathLike = "neutron_transport", + mat_vol_kwargs: dict | None = None, + micro_kwargs: dict | None = None + ): + """Run the neutron transport step. + + This step computes the material volume fractions on the mesh, creates a + mesh-material filter, and retrieves the fluxes and microscopic cross + sections for each mesh/material combination. This step will populate the + 'fluxes' and 'micros' keys in the results dictionary. For a mesh-based + calculation, it will also populate the 'mesh_material_volumes' key. + + Parameters + ---------- + output_dir : PathLike, optional + The directory where the results will be saved. + mat_vol_kwargs : dict, optional + Additional keyword arguments based to + :meth:`openmc.MeshBase.material_volumes`. + micro_kwargs : dict, optional + Additional keyword arguments passed to + :func:`openmc.deplete.get_microxs_and_flux`. + + """ + + output_dir = Path(output_dir).resolve() + output_dir.mkdir(parents=True, exist_ok=True) + + if self.method == 'mesh-based': + # Compute material volume fractions on the mesh + if mat_vol_kwargs is None: + mat_vol_kwargs = {} + self.results['mesh_material_volumes'] = mmv = comm.bcast( + self.domains.material_volumes(self.neutron_model, **mat_vol_kwargs)) + + # Save results to file + if comm.rank == 0: + mmv.save(output_dir / 'mesh_material_volumes.npz') + + # Create mesh-material filter based on what combos were found + domains = openmc.MeshMaterialFilter.from_volumes(self.domains, mmv) + else: + domains: Sequence[openmc.Cell] = self.domains + + # Check to make sure that each cell is filled with a material and + # that the volume has been set + + # TODO: If volumes are not set, run volume calculation for cells + for cell in domains: + if cell.fill is None: + raise ValueError( + f"Cell {cell.id} is not filled with a materials. " + "Please set the fill material for each cell before " + "running the R2S calculation." + ) + if cell.volume is None: + raise ValueError( + f"Cell {cell.id} does not have a volume set. " + "Please set the volume for each cell before running " + "the R2S calculation." + ) + + # Set default keyword arguments for microxs and flux calculation + if micro_kwargs is None: + micro_kwargs = {} + micro_kwargs.setdefault('path_statepoint', output_dir / 'statepoint.h5') + micro_kwargs.setdefault('path_input', output_dir / 'model.xml') + + # Run neutron transport and get fluxes and micros. Run via openmc.lib to + # maintain a consistent parallelism strategy with the activation step. + with TemporarySession(): + self.results['fluxes'], self.results['micros'] = get_microxs_and_flux( + self.neutron_model, domains, **micro_kwargs) + + # Save flux and micros to file + if comm.rank == 0: + np.save(output_dir / 'fluxes.npy', self.results['fluxes']) + write_microxs_hdf5(self.results['micros'], output_dir / 'micros.h5') + + def step2_activation( + self, + timesteps: Sequence[float] | Sequence[tuple[float, str]], + source_rates: float | Sequence[float], + timestep_units: str = 's', + output_dir: PathLike = 'activation', + operator_kwargs: dict | None = None, + ): + """Run the activation step. + + This step creates a unique copy of each activation material based on the + mesh elements or cells, then solves the depletion equations for each + material using the fluxes and microscopic cross sections obtained in the + neutron transport step. This step will populate the 'depletion_results' + and 'activation_materials' keys in the results dictionary. + + Parameters + ---------- + timesteps : Sequence[float] or Sequence[tuple[float, str]] + Sequence of timesteps. Note that values are not cumulative. The + units are specified by the `timestep_units` argument when + `timesteps` is an iterable of float. Alternatively, units can be + specified for each step by passing an iterable of (value, unit) + tuples. + source_rates : float | Sequence[float] + Source rate in [neutron/sec] for each interval in `timesteps`. + timestep_units : {'s', 'min', 'h', 'd', 'a'}, optional + Units for values specified in the `timesteps` argument when passing + float values. 's' means seconds, 'min' means minutes, 'h' means + hours, 'd' means days, and 'a' means years (Julian). + output_dir : PathLike, optional + Path to directory where activation calculation outputs will be + saved. + operator_kwargs : dict, optional + Additional keyword arguments passed to + :class:`openmc.deplete.IndependentOperator`. + """ + + if self.method == 'mesh-based': + # Get unique material for each (mesh, material) combination + mmv = self.results['mesh_material_volumes'] + self.results['activation_materials'] = get_activation_materials(self.neutron_model, mmv) + else: + # Create unique material for each cell + activation_mats = openmc.Materials() + for cell in self.domains: + mat = cell.fill.clone() + mat.name = f'Cell {cell.id}' + mat.depletable = True + mat.volume = cell.volume + activation_mats.append(mat) + self.results['activation_materials'] = activation_mats + + # Save activation materials to file + output_dir = Path(output_dir) + output_dir.mkdir(parents=True, exist_ok=True) + self.results['activation_materials'].export_to_xml( + output_dir / 'materials.xml') + + # Create depletion operator for the activation materials + if operator_kwargs is None: + operator_kwargs = {} + operator_kwargs.setdefault('normalization_mode', 'source-rate') + op = IndependentOperator( + self.results['activation_materials'], + self.results['fluxes'], + self.results['micros'], + **operator_kwargs + ) + + # Create time integrator and solve depletion equations + integrator = PredictorIntegrator( + op, timesteps, source_rates=source_rates, timestep_units=timestep_units + ) + output_path = output_dir / 'depletion_results.h5' + integrator.integrate(final_step=False, path=output_path) + comm.barrier() + + # Get depletion results + self.results['depletion_results'] = Results(output_path) + + def step3_photon_transport( + self, + time_indices: Sequence[int] | None = None, + bounding_boxes: dict[int, openmc.BoundingBox] | None = None, + output_dir: PathLike = 'photon_transport', + mat_vol_kwargs: dict | None = None, + run_kwargs: dict | None = None, + ): + """Run the photon transport step. + + This step performs photon transport calculations using decay photon + sources created from the activated materials. For each specified time, + it creates appropriate photon sources and runs a transport calculation. + In mesh-based mode, the sources are created using the mesh material + volumes, while in cell-based mode, they are created using bounding boxes + for each cell. This step will populate the 'photon_tallies' key in the + results dictionary. + + Parameters + ---------- + time_indices : Sequence[int], optional + Sequence of time indices at which photon transport should be run; + represented as indices into the array of times formed by the + timesteps. For example, if two timesteps are specified, the array of + times would contain three entries, and [2] would indicate computing + photon results at the last time. A value of None indicates to run + photon transport for each time. + bounding_boxes : dict[int, openmc.BoundingBox], optional + Dictionary mapping cell IDs to bounding boxes used for spatial + source sampling in cell-based R2S calculations. Required if method + is 'cell-based'. + output_dir : PathLike, optional + Path to directory where photon transport outputs will be saved. + mat_vol_kwargs : dict, optional + Additional keyword arguments passed to + :meth:`openmc.MeshBase.material_volumes`. + run_kwargs : dict, optional + Additional keyword arguments passed to :meth:`openmc.Model.run` + during the photon transport step. By default, output is disabled. + """ + + # TODO: Automatically determine bounding box for each cell + if bounding_boxes is None and self.method == 'cell-based': + raise ValueError("bounding_boxes must be provided for cell-based " + "R2S calculations.") + + # Set default run arguments if not provided + if run_kwargs is None: + run_kwargs = {} + run_kwargs.setdefault('output', False) + + # Write out JSON file with tally IDs that can be used for loading + # results + output_dir = Path(output_dir) + output_dir.mkdir(parents=True, exist_ok=True) + + # Get default time indices if not provided + if time_indices is None: + n_steps = len(self.results['depletion_results']) + time_indices = list(range(n_steps)) + + # Check whether the photon model is different + neutron_univ = self.neutron_model.geometry.root_universe + photon_univ = self.photon_model.geometry.root_universe + different_photon_model = (neutron_univ != photon_univ) + + # For mesh-based calculations, compute material volume fractions for the + # photon model if it is different from the neutron model to account for + # potential material changes + if self.method == 'mesh-based' and different_photon_model: + self.results['mesh_material_volumes_photon'] = photon_mmv = comm.bcast( + self.domains.material_volumes(self.photon_model, **mat_vol_kwargs)) + + # Save photon MMV results to file + if comm.rank == 0: + photon_mmv.save(output_dir / 'mesh_material_volumes.npz') + + if comm.rank == 0: + tally_ids = [tally.id for tally in self.photon_model.tallies] + with open(output_dir / 'tally_ids.json', 'w') as f: + json.dump(tally_ids, f) + + self.results['photon_tallies'] = {} + + # Get dictionary of cells in the photon model + if different_photon_model: + photon_cells = self.photon_model.geometry.get_all_cells() + + for time_index in time_indices: + # Create decay photon source + if self.method == 'mesh-based': + self.photon_model.settings.source = \ + self.get_decay_photon_source_mesh(time_index) + else: + sources = [] + results = self.results['depletion_results'] + for cell, original_mat in zip(self.domains, self.results['activation_materials']): + # Skip if the cell is not in the photon model or the + # material has changed + if different_photon_model: + if cell.id not in photon_cells or \ + cell.fill.id != photon_cells[cell.id].fill.id: + continue + + # Get bounding box for the cell + bounding_box = bounding_boxes[cell.id] + + # Get activated material composition + activated_mat = results[time_index].get_material(str(original_mat.id)) + + # Create decay photon source source + space = openmc.stats.Box(*bounding_box) + energy = activated_mat.get_decay_photon_energy() + strength = energy.integral() if energy is not None else 0.0 + source = openmc.IndependentSource( + space=space, + energy=energy, + particle='photon', + strength=strength, + constraints={'domains': [cell]} + ) + sources.append(source) + self.photon_model.settings.source = sources + + # Convert time_index (which may be negative) to a normal index + if time_index < 0: + time_index = len(self.results['depletion_results']) + time_index + + # Run photon transport calculation + photon_dir = Path(output_dir) / f'time_{time_index}' + with TemporarySession(self.photon_model, cwd=photon_dir): + statepoint_path = self.photon_model.run(**run_kwargs) + + # Store tally results + with openmc.StatePoint(statepoint_path) as sp: + self.results['photon_tallies'][time_index] = [ + sp.tallies[tally.id] for tally in self.photon_model.tallies + ] + + def get_decay_photon_source_mesh( + self, + time_index: int = -1 + ) -> list[openmc.MeshSource]: + """Create decay photon source for a mesh-based calculation. + + This function creates N :class:`MeshSource` objects where N is the + maximum number of unique materials that appears in a single mesh + element. For each mesh element-material combination, and + IndependentSource instance is created with a spatial constraint limited + the sampled decay photons to the correct region. + + When the photon transport model is different from the neutron model, the + photon MeshMaterialVolumes is used to determine whether an (element, + material) combination exists in the photon model. + + Parameters + ---------- + time_index : int, optional + Time index for the decay photon source. Default is -1 (last time). + + Returns + ------- + list of openmc.MeshSource + A list of MeshSource objects, each containing IndependentSource + instances for the decay photons in the corresponding mesh element. + + """ + mat_dict = self.neutron_model._get_all_materials() + + # Some MeshSource objects will have empty positions; create a "null source" + # that is used for this case + null_source = openmc.IndependentSource(particle='photon', strength=0.0) + + # List to hold sources for each MeshSource (length = N) + source_lists = [] + + # Index in the overall list of activated materials + index_mat = 0 + + # Get various results from previous steps + mat_vols = self.results['mesh_material_volumes'] + materials = self.results['activation_materials'] + results = self.results['depletion_results'] + photon_mat_vols = self.results.get('mesh_material_volumes_photon') + + # Total number of mesh elements + n_elements = mat_vols.num_elements + + for index_elem in range(n_elements): + # Determine which materials exist in the photon model for this element + if photon_mat_vols is not None: + photon_materials = { + mat_id + for mat_id, _ in photon_mat_vols.by_element(index_elem) + if mat_id is not None + } + + for j, (mat_id, _) in enumerate(mat_vols.by_element(index_elem)): + # Skip void volume + if mat_id is None: + continue + + # Skip if this material doesn't exist in photon model + if photon_mat_vols is not None and mat_id not in photon_materials: + index_mat += 1 + continue + + # Check whether a new MeshSource object is needed + if j >= len(source_lists): + source_lists.append([null_source]*n_elements) + + # Get activated material composition + original_mat = materials[index_mat] + activated_mat = results[time_index].get_material(str(original_mat.id)) + + # Create decay photon source source + energy = activated_mat.get_decay_photon_energy() + if energy is not None: + strength = energy.integral() + source_lists[j][index_elem] = openmc.IndependentSource( + energy=energy, + particle='photon', + strength=strength, + constraints={'domains': [mat_dict[mat_id]]} + ) + + # Increment index of activated material + index_mat += 1 + + # Return list of mesh sources + return [openmc.MeshSource(self.domains, sources) for sources in source_lists] + + def load_results(self, path: PathLike): + """Load results from a previous R2S calculation. + + Parameters + ---------- + path : PathLike + Path to the directory containing the R2S calculation results. + + """ + path = Path(path) + + # Load neutron transport results + neutron_dir = path / 'neutron_transport' + if self.method == 'mesh-based': + mmv_file = neutron_dir / 'mesh_material_volumes.npz' + if mmv_file.exists(): + self.results['mesh_material_volumes'] = \ + openmc.MeshMaterialVolumes.from_npz(mmv_file) + fluxes_file = neutron_dir / 'fluxes.npy' + if fluxes_file.exists(): + self.results['fluxes'] = list(np.load(fluxes_file, allow_pickle=True)) + micros_dict = read_microxs_hdf5(neutron_dir / 'micros.h5') + self.results['micros'] = [ + micros_dict[f'domain_{i}'] for i in range(len(micros_dict)) + ] + + # Load activation results + activation_dir = path / 'activation' + activation_results = activation_dir / 'depletion_results.h5' + if activation_results.exists(): + self.results['depletion_results'] = Results(activation_results) + activation_mats_file = activation_dir / 'materials.xml' + if activation_mats_file.exists(): + self.results['activation_materials'] = \ + openmc.Materials.from_xml(activation_mats_file) + + # Load photon transport results + photon_dir = path / 'photon_transport' + + # Load photon mesh material volumes if they exist (for mesh-based calculations) + if self.method == 'mesh-based': + photon_mmv_file = photon_dir / 'mesh_material_volumes.npz' + if photon_mmv_file.exists(): + self.results['mesh_material_volumes_photon'] = \ + openmc.MeshMaterialVolumes.from_npz(photon_mmv_file) + + # Load tally IDs from JSON file + tally_ids_path = photon_dir / 'tally_ids.json' + if tally_ids_path.exists(): + with tally_ids_path.open('r') as f: + tally_ids = json.load(f) + self.results['photon_tallies'] = {} + + # For each photon transport calc, load the statepoint and get the + # tally results based on tally_ids + for time_dir in photon_dir.glob('time_*'): + time_index = int(time_dir.name.split('_')[1]) + for sp_path in time_dir.glob('statepoint.*.h5'): + with openmc.StatePoint(sp_path) as sp: + self.results['photon_tallies'][time_index] = [ + sp.tallies[tally_id] for tally_id in tally_ids + ] diff --git a/openmc/deplete/results.py b/openmc/deplete/results.py index 132ec572c..e1fcb26b6 100644 --- a/openmc/deplete/results.py +++ b/openmc/deplete/results.py @@ -113,9 +113,9 @@ class Results(list): ---------- mat : openmc.Material, str Material object or material id to evaluate - units : {'Bq', 'Bq/g', 'Bq/cm3'} + units : {'Bq', 'Bq/g', 'Bq/kg', 'Bq/cm3'} Specifies the type of activity to return, options include total - activity [Bq], specific [Bq/g] or volumetric activity [Bq/cm3]. + activity [Bq], specific [Bq/g, Bq/kg] or volumetric activity [Bq/cm3]. by_nuclide : bool Specifies if the activity should be returned for the material as a whole or per nuclide. Default is False. @@ -203,7 +203,7 @@ class Results(list): # Evaluate value in each region for i, result in enumerate(self): times[i] = result.time[0] - concentrations[i] = result[0, mat_id, nuc] + concentrations[i] = result[mat_id, nuc] # Unit conversions times = _get_time_as(times, time_units) @@ -231,9 +231,9 @@ class Results(list): ---------- mat : openmc.Material, str Material object or material id to evaluate. - units : {'W', 'W/g', 'W/cm3'} + units : {'W', 'W/g', 'W/kg', 'W/cm3'} Specifies the units of decay heat to return. Options include total - heat [W], specific [W/g] or volumetric heat [W/cm3]. + heat [W], specific [W/g, W/kg] or volumetric heat [W/cm3]. by_nuclide : bool Specifies if the decay heat should be returned for the material as a whole or per nuclide. Default is False. @@ -363,7 +363,7 @@ class Results(list): # Evaluate value in each region for i, result in enumerate(self): times[i] = result.time[0] - rates[i] = result.rates[0].get(mat_id, nuc, rx) * result[0, mat, nuc] + rates[i] = result.rates.get(mat_id, nuc, rx) * result[mat, nuc] return times, rates @@ -397,7 +397,7 @@ class Results(list): # Get time/eigenvalue at each point for i, result in enumerate(self): times[i] = result.time[0] - eigenvalues[i] = result.k[0] + eigenvalues[i] = result.k # Convert time units if necessary times = _get_time_as(times, time_units) @@ -630,7 +630,7 @@ class Results(list): for nuc in result.index_nuc: if nuc not in available_cross_sections: continue - atoms = result[0, mat_id, nuc] + atoms = result[mat_id, nuc] if atoms > 0.0: atoms_per_barn_cm = 1e-24 * atoms / mat.volume mat.remove_nuclide(nuc) # Replace if it's there diff --git a/openmc/deplete/stepresult.py b/openmc/deplete/stepresult.py index bc112f5f2..ddc049978 100644 --- a/openmc/deplete/stepresult.py +++ b/openmc/deplete/stepresult.py @@ -16,7 +16,7 @@ from openmc.mpi import comm, MPI from openmc.checkvalue import PathLike from .reaction_rates import ReactionRates -VERSION_RESULTS = (1, 1) +VERSION_RESULTS = (1, 2) __all__ = ["StepResult"] @@ -30,8 +30,8 @@ class StepResult: Attributes ---------- - k : list of (float, float) - Eigenvalue and uncertainty for each substep. + k : tuple of (float, float) + Eigenvalue and uncertainty at end of step. time : list of float Time at beginning, end of step, in seconds. source_rate : float @@ -40,8 +40,8 @@ class StepResult: Number of mats. n_nuc : int Number of nuclides. - rates : list of ReactionRates - The reaction rates for each substep. + rates : ReactionRates + The reaction rates at end of step. volume : dict of str to float Dictionary mapping mat id to volume. index_mat : dict of str to int @@ -52,12 +52,8 @@ class StepResult: A dictionary mapping mat ID as string to global index. n_hdf5_mats : int Number of materials in entire geometry. - n_stages : int - Number of stages in simulation. data : numpy.ndarray - Atom quantity, stored by stage, mat, then by nuclide. - reac_cont : float - The root returned by the reactivity controller. + Atom quantity, stored by mat, then by nuclide. proc_time : int Average time spent depleting a material across all materials and processes @@ -89,17 +85,17 @@ class StepResult: Parameters ---------- pos : tuple - A three-length tuple containing a stage index, mat index and a nuc - index. All can be integers or slices. The second two can be + A two-length tuple containing a mat index and a nuc + index. Both can be integers or slices, or can be strings corresponding to their respective dictionary. Returns ------- float - The atoms for stage, mat, nuc + The atoms for mat, nuc """ - stage, mat, nuc = pos + mat, nuc = pos if isinstance(mat, openmc.Material): mat = str(mat.id) if isinstance(mat, str): @@ -107,7 +103,7 @@ class StepResult: if isinstance(nuc, str): nuc = self.index_nuc[nuc] - return self.data[stage, mat, nuc] + return self.data[mat, nuc] def __setitem__(self, pos, val): """Sets an item from results. @@ -115,21 +111,21 @@ class StepResult: Parameters ---------- pos : tuple - A three-length tuple containing a stage index, mat index and a nuc - index. All can be integers or slices. The second two can be + A two-length tuple containing a mat index and a nuc + index. Both can be integers or slices, or can be strings corresponding to their respective dictionary. val : float The value to set data to. """ - stage, mat, nuc = pos + mat, nuc = pos if isinstance(mat, str): mat = self.index_mat[mat] if isinstance(nuc, str): nuc = self.index_nuc[nuc] - self.data[stage, mat, nuc] = val + self.data[mat, nuc] = val @property def n_mat(self): @@ -143,11 +139,7 @@ class StepResult: def n_hdf5_mats(self): return len(self.mat_to_hdf5_ind) - @property - def n_stages(self): - return self.data.shape[0] - - def allocate(self, volume, nuc_list, burn_list, full_burn_list, stages): + def allocate(self, volume, nuc_list, burn_list, full_burn_list): """Allocate memory for depletion step data Parameters @@ -160,8 +152,6 @@ class StepResult: A list of all mat IDs to be burned. Used for sorting the simulation. full_burn_list : list of str List of all burnable material IDs - stages : int - Number of stages in simulation. """ self.volume = copy.deepcopy(volume) @@ -170,7 +160,7 @@ class StepResult: self.mat_to_hdf5_ind = {mat: i for i, mat in enumerate(full_burn_list)} # Create storage array - self.data = np.zeros((stages, self.n_mat, self.n_nuc)) + self.data = np.zeros((self.n_mat, self.n_nuc)) def distribute(self, local_materials, ranges): """Create a new object containing data for distributed materials @@ -199,8 +189,8 @@ class StepResult: for attr in direct_attrs: setattr(new, attr, getattr(self, attr)) # Get applicable slice of data - new.data = self.data[:, ranges] - new.rates = [r[ranges] for r in self.rates] + new.data = self.data[ranges] + new.rates = self.rates[ranges] return new def get_material(self, mat_id): @@ -235,15 +225,15 @@ class StepResult: f'values are {list(self.volume.keys())}' ) from e for nuc, _ in sorted(self.index_nuc.items(), key=lambda x: x[1]): - atoms = self[0, mat_id, nuc] - if atoms < 0.0: + atoms = self[mat_id, nuc] + if atoms <= 0.0: continue atom_per_bcm = atoms / vol * 1e-24 material.add_nuclide(nuc, atom_per_bcm) material.volume = vol return material - def export_to_hdf5(self, filename, step): + def export_to_hdf5(self, filename, step, write_rates: bool = False): """Export results to an HDF5 file Parameters @@ -252,6 +242,8 @@ class StepResult: The filename to write to step : int What step is this? + write_rates : bool, optional + Whether to include reaction rate datasets in the results file. """ # Write new file if first time step, else add to existing file @@ -262,7 +254,8 @@ class StepResult: kwargs['driver'] = 'mpio' kwargs['comm'] = comm with h5py.File(filename, **kwargs) as handle: - self._to_hdf5(handle, step, parallel=True) + self._to_hdf5(handle, step, parallel=True, + write_rates=write_rates) else: # Gather results at root process all_results = comm.gather(self) @@ -271,15 +264,18 @@ class StepResult: if comm.rank == 0: with h5py.File(filename, **kwargs) as handle: for res in all_results: - res._to_hdf5(handle, step, parallel=False) + res._to_hdf5(handle, step, parallel=False, + write_rates=write_rates) - def _write_hdf5_metadata(self, handle): + def _write_hdf5_metadata(self, handle, write_rates): """Writes result metadata in HDF5 file Parameters ---------- handle : h5py.File or h5py.Group An hdf5 file or group type to store this in. + write_rates : bool + Whether reaction rate datasets are being written. """ # Create and save the 5 dictionaries: @@ -287,8 +283,8 @@ class StepResult: # self.index_mat -> self.volume (TODO: support for changing volumes) # self.index_nuc # reactions - # self.rates[0].index_nuc (can be different from above, above is superset) - # self.rates[0].index_rx + # self.rates.index_nuc (can be different from above, above is superset) + # self.rates.index_rx # these are shared by every step of the simulation, and should be deduplicated. # Store concentration mat and nuclide dictionaries (along with volumes) @@ -298,13 +294,19 @@ class StepResult: mat_list = sorted(self.mat_to_hdf5_ind, key=int) nuc_list = sorted(self.index_nuc) - rxn_list = sorted(self.rates[0].index_rx) + + include_rates = ( + write_rates + and self.rates is not None + and bool(self.rates.index_nuc) + and bool(self.rates.index_rx) + ) + rxn_list = sorted(self.rates.index_rx) if include_rates else [] n_mats = self.n_hdf5_mats n_nuc_number = len(nuc_list) - n_nuc_rxn = len(self.rates[0].index_nuc) + n_nuc_rxn = len(self.rates.index_nuc) if include_rates else 0 n_rxn = len(rxn_list) - n_stages = self.n_stages mat_group = handle.create_group("materials") @@ -318,34 +320,37 @@ class StepResult: for nuc in nuc_list: nuc_single_group = nuc_group.create_group(nuc) nuc_single_group.attrs["atom number index"] = self.index_nuc[nuc] - if nuc in self.rates[0].index_nuc: - nuc_single_group.attrs["reaction rate index"] = self.rates[0].index_nuc[nuc] + if include_rates and nuc in self.rates.index_nuc: + nuc_single_group.attrs["reaction rate index"] = ( + self.rates.index_nuc[nuc]) - rxn_group = handle.create_group("reactions") + if include_rates: + rxn_group = handle.create_group("reactions") - for rxn in rxn_list: - rxn_single_group = rxn_group.create_group(rxn) - rxn_single_group.attrs["index"] = self.rates[0].index_rx[rxn] + for rxn in rxn_list: + rxn_single_group = rxn_group.create_group(rxn) + rxn_single_group.attrs["index"] = ( + self.rates.index_rx[rxn]) # Construct array storage - handle.create_dataset("number", (1, n_stages, n_mats, n_nuc_number), - maxshape=(None, n_stages, n_mats, n_nuc_number), - chunks=(1, 1, n_mats, n_nuc_number), + handle.create_dataset("number", (1, n_mats, n_nuc_number), + maxshape=(None, n_mats, n_nuc_number), + chunks=True, dtype='float64') - if n_nuc_rxn > 0 and n_rxn > 0: - handle.create_dataset("reaction rates", (1, n_stages, n_mats, n_nuc_rxn, n_rxn), - maxshape=(None, n_stages, n_mats, n_nuc_rxn, n_rxn), - chunks=(1, 1, n_mats, n_nuc_rxn, n_rxn), - dtype='float64') + if include_rates and n_nuc_rxn > 0 and n_rxn > 0: + handle.create_dataset( + "reaction rates", (1, n_mats, n_nuc_rxn, n_rxn), + maxshape=(None, n_mats, n_nuc_rxn, n_rxn), + chunks=True, dtype='float64') - handle.create_dataset("eigenvalues", (1, n_stages, 2), - maxshape=(None, n_stages, 2), dtype='float64') + handle.create_dataset("eigenvalues", (1, 2), + maxshape=(None, 2), dtype='float64') handle.create_dataset("time", (1, 2), maxshape=(None, 2), dtype='float64') - handle.create_dataset("source_rate", (1, n_stages), maxshape=(None, n_stages), + handle.create_dataset("source_rate", (1,), maxshape=(None,), dtype='float64') handle.create_dataset( @@ -356,7 +361,7 @@ class StepResult: "reac_cont_root", (1,), maxshape=(None,), dtype="float64") - def _to_hdf5(self, handle, index, parallel=False): + def _to_hdf5(self, handle, index, parallel=False, write_rates: bool = False): """Converts results object into an hdf5 object. Parameters @@ -367,12 +372,14 @@ class StepResult: What step is this? parallel : bool Being called with parallel HDF5? + write_rates : bool, optional + Whether reaction rate datasets are being written. """ if "/number" not in handle: if parallel: comm.barrier() - self._write_hdf5_metadata(handle) + self._write_hdf5_metadata(handle, write_rates) if parallel: comm.barrier() @@ -429,18 +436,14 @@ class StepResult: return # Add data - # Note, for the last step, self.n_stages = 1, even if n_stages != 1. - n_stages = self.n_stages inds = [self.mat_to_hdf5_ind[mat] for mat in self.index_mat] low = min(inds) high = max(inds) - for i in range(n_stages): - number_dset[index, i, low:high+1] = self.data[i] - if has_reactions: - rxn_dset[index, i, low:high+1] = self.rates[i] - if comm.rank == 0: - eigenvalues_dset[index, i] = self.k[i] + number_dset[index, low:high+1] = self.data + if has_reactions: + rxn_dset[index, low:high+1] = self.rates if comm.rank == 0: + eigenvalues_dset[index] = self.k time_dset[index] = self.time source_rate_dset[index] = self.source_rate if self.proc_time is not None: @@ -472,10 +475,24 @@ class StepResult: # Older versions used "power" instead of "source_rate" source_rate_dset = handle["/power"] - results.data = number_dset[step, :, :, :] - results.k = eigenvalues_dset[step, :] + # Check if this is an old format file (with stages dimension) or new format + # Old format: number has shape (n_steps, n_stages, n_mats, n_nucs) + # New format: number has shape (n_steps, n_mats, n_nucs) + has_stages = len(number_dset.shape) == 4 + + if has_stages: + # Old format - extract data from first stage (index 0) + results.data = number_dset[step, 0, :, :] + results.k = eigenvalues_dset[step, 0, :] + # source_rate had shape (n_steps, n_stages) in old format + results.source_rate = source_rate_dset[step, 0] + else: + # New format - no stages dimension + results.data = number_dset[step, :, :] + results.k = eigenvalues_dset[step, :] + results.source_rate = source_rate_dset[step] + results.time = time_dset[step, :] - results.source_rate = source_rate_dset[step, 0] if "depletion time" in handle: proc_time_dset = handle["/depletion time"] @@ -510,33 +527,46 @@ class StepResult: if "reaction rate index" in nuc_handle.attrs: rxn_nuc_to_ind[nuc] = nuc_handle.attrs["reaction rate index"] - for rxn, rxn_handle in handle["/reactions"].items(): - rxn_to_ind[rxn] = rxn_handle.attrs["index"] + if "reactions" in handle: + for rxn, rxn_handle in handle["/reactions"].items(): + rxn_to_ind[rxn] = rxn_handle.attrs["index"] - results.rates = [] - # Reconstruct reactions - for i in range(results.n_stages): - rate = ReactionRates(results.index_mat, rxn_nuc_to_ind, rxn_to_ind, True) - - if "reaction rates" in handle: - rate[:] = handle["/reaction rates"][step, i, :, :, :] - results.rates.append(rate) + # Reconstruct reaction rates + rate = ReactionRates(results.index_mat, rxn_nuc_to_ind, rxn_to_ind, True) + if "reaction rates" in handle: + if has_stages: + # Old format: (n_steps, n_stages, n_mats, n_nucs, n_rxns) + rate[:] = handle["/reaction rates"][step, 0, :, :, :] + else: + # New format: (n_steps, n_mats, n_nucs, n_rxns) + rate[:] = handle["/reaction rates"][step, :, :, :] + results.rates = rate return results @staticmethod - def save(op, x, op_results, t, source_rate, step_ind, proc_time=None, - root=None, path: PathLike = "depletion_results.h5"): + def save( + op, + x, + op_results, + t, + source_rate, + step_ind, + proc_time=None, + write_rates: bool = False, + root=None, + path: PathLike = "depletion_results.h5" + ): """Creates and writes depletion results to disk Parameters ---------- op : openmc.deplete.abc.TransportOperator The operator used to generate these results. - x : list of list of numpy.array - The prior x vectors. Indexed [i][cell] using the above equation. - op_results : list of openmc.deplete.OperatorResult - Results of applying transport operator + x : numpy.array + End-of-step concentrations for each material + op_results : openmc.deplete.OperatorResult + Result of applying transport operator at end of step t : list of float Time indices. source_rate : float @@ -557,26 +587,20 @@ class StepResult: # Get indexing terms vol_dict, nuc_list, burn_list, full_burn_list = op.get_results_info() - stages = len(x) - # Create results results = StepResult() - results.allocate(vol_dict, nuc_list, burn_list, full_burn_list, stages) + results.allocate(vol_dict, nuc_list, burn_list, full_burn_list) n_mat = len(burn_list) - for i in range(stages): - for mat_i in range(n_mat): - results[i, mat_i, :] = x[i][mat_i] + for mat_i in range(n_mat): + results[mat_i, :] = x[mat_i] - ks = [] - for r in op_results: - if isinstance(r.k, type(None)): - ks += [(None, None)] - else: - ks += [(r.k.nominal_value, r.k.std_dev)] - results.k = ks - results.rates = [r.rates for r in op_results] + if isinstance(op_results.k, type(None)): + results.k = (None, None) + else: + results.k = (op_results.k.nominal_value, op_results.k.std_dev) + results.rates = op_results.rates results.time = t results.source_rate = source_rate results.proc_time = proc_time @@ -586,7 +610,7 @@ class StepResult: if not Path(path).is_file(): Path(path).parent.mkdir(parents=True, exist_ok=True) - results.export_to_hdf5(path, step_ind) + results.export_to_hdf5(path, step_ind, write_rates) def transfer_volumes(self, model): """Transfers volumes from depletion results to geometry diff --git a/openmc/deplete/transfer_rates.py b/openmc/deplete/transfer_rates.py index 01c9b2e35..ea9fc9185 100644 --- a/openmc/deplete/transfer_rates.py +++ b/openmc/deplete/transfer_rates.py @@ -1,31 +1,31 @@ +from collections import defaultdict from numbers import Real import re +from typing import Sequence + +import numpy as np from openmc.checkvalue import check_type, check_value from openmc import Material -from openmc.data import ELEMENT_SYMBOL +from openmc.data import ELEMENT_SYMBOL, isotopes, AVOGADRO, atomic_mass +from .results import _SECONDS_PER_MINUTE, _SECONDS_PER_HOUR, \ + _SECONDS_PER_DAY, _SECONDS_PER_JULIAN_YEAR -class TransferRates: - """Class for defining continuous removals and feeds. - Molten Salt Reactors (MSRs) benefit from continuous reprocessing, - which removes fission products and feeds fresh fuel into the system. MSRs - inspired the development of this class. +class ExternalRates: + """External rates class for defining addition terms of depletion equation. - An instance of this class can be passed directly to an instance of one of - the :class:`openmc.deplete.Integrator` classes. - - .. versionadded:: 0.14.0 + .. versionadded:: 0.15.3 Parameters ---------- operator : openmc.TransportOperator Depletion operator - model : openmc.Model - OpenMC model containing materials and geometry. If using - :class:`openmc.deplete.CoupledOperator`, the model must also contain - a :class:`opnemc.Settings` object. + materials : openmc.Materials + OpenMC materials. + number_of_timesteps : int + Total number of depletion timesteps Attributes ---------- @@ -33,22 +33,26 @@ class TransferRates: All burnable material IDs. local_mats : list of str All burnable material IDs being managed by a single process - transfer_rates : dict of str to dict - Container of transfer rates, components (elements and/or nuclides) and - destination material - index_transfer : Set of pair of str - Pair of strings needed to build final matrix (destination_material, mat) + number_of_timesteps : int + Total number of depletion timesteps + external_rates : dict of str to dict + Container of timesteps, external rates, components (elements and/or + nuclides) and optionally destination material + external_timesteps : list of int + Container of all timesteps indeces with an external rate defined. """ - def __init__(self, operator, model): + def __init__(self, operator, materials, number_of_timesteps): - self.materials = model.materials + self.materials = materials self.burnable_mats = operator.burnable_mats self.local_mats = operator.local_mats + self.number_of_timesteps = number_of_timesteps #initialize transfer rates container dict - self.transfer_rates = {mat: {} for mat in self.burnable_mats} - self.index_transfer = set() + self.external_rates = {mat: defaultdict(list) for mat in self.burnable_mats} + self.external_timesteps = [] + self.redox = {} def _get_material_id(self, val): """Helper method for getting material id from Material obj or name. @@ -71,7 +75,7 @@ class TransferRates: check_value('Material ID', str(val), self.burnable_mats) else: check_value('Material name', val, - [mat.name for mat in self.materials if mat.depletable]) + [mat.name for mat in self.materials if mat.depletable]) val = [mat.id for mat in self.materials if mat.name == val][0] elif isinstance(val, int): @@ -79,7 +83,13 @@ class TransferRates: return str(val) - def get_transfer_rate(self, material, component): + def get_external_rate( + self, + material: str | int | Material, + component: str, + timestep: int, + destination_material: str | int | Material | None = None + ): """Return transfer rate for given material and element. Parameters @@ -88,62 +98,114 @@ class TransferRates: Depletable material component : str Element or nuclide to get transfer rate value + timestep : int + Current timestep index + destination_material : openmc.Material or str or int, Optional + Destination material to where nuclides get fed Returns ------- - transfer_rate : list of floats - Transfer rate values + external_rate : list of floats + External rate values """ material_id = self._get_material_id(material) check_type('component', component, str) - return [i[0] for i in self.transfer_rates[material_id][component]] - - def get_destination_material(self, material, component): - """Return destination material for given material and - component, if defined. - - Parameters - ---------- - material : openmc.Material or str or int - Depletable material - component : str - Element or nuclide that gets transferred to another material. - - Returns - ------- - destination_material_id : list of str - Depletable material ID to where the element or nuclide gets - transferred - - """ - material_id = self._get_material_id(material) - check_type('component', component, str) - if component in self.transfer_rates[material_id]: - return [i[1] for i in self.transfer_rates[material_id][component]] + if destination_material is not None: + dest_mat_id = self._get_material_id(destination_material) + return [i[1] for i in self.external_rates[material_id][component] + if timestep in i[0] and dest_mat_id == i[2]] else: - return [] + return [i[1] for i in self.external_rates[material_id][component] + if timestep in i[0]] - def get_components(self, material): - """Extract removing elements and/or nuclides for a given material + def get_components(self, material, timestep, destination_material=None): + """Extract removing elements and/or nuclides for a given material at a + given timestep Parameters ---------- material : openmc.Material or str or int Depletable material + timestep : int + Current timestep index + destination_material : openmc.Material or str or int, Optional + Destination material to where nuclides get fed Returns ------- - elements : list - List of elements and nuclides where transfer rates exist + components : list + List of elements or nuclides with external rates set at a given + timestep """ material_id = self._get_material_id(material) - if material_id in self.transfer_rates: - return self.transfer_rates[material_id].keys() + if destination_material is not None: + dest_mat_id = self._get_material_id(destination_material) + else: + dest_mat_id = None + + all_components = [] + if material_id in self.external_rates: + mat_components = self.external_rates[material_id] + + for component in mat_components: + if dest_mat_id: + # check for both timestep and destination material ids + if np.isin(timestep, [val[0] for val in mat_components[component]]) and \ + np.isin(dest_mat_id, [val[2] for val in mat_components[component]]): + all_components.append(component) + else: + # check only for timesteps + if np.isin(timestep, [val[0] for val in mat_components[component]]): + all_components.append(component) + return all_components + + +class TransferRates(ExternalRates): + """Class for defining continuous removals and feeds. + + Molten Salt Reactors (MSRs) benefit from continuous reprocessing, + which removes fission products and feeds fresh fuel into the system. MSRs + inspired the development of this class. + + An instance of this class can be passed directly to an instance of one of + the :class:`openmc.deplete.Integrator` classes. + + .. versionadded:: 0.14.0 + + Parameters + ---------- + operator : openmc.TransportOperator + Depletion operator + materials : openmc.Materials + OpenMC materials. + number_of_timesteps : int + Total number of depletion timesteps + + Attributes + ---------- + burnable_mats : list of str + All burnable material IDs. + local_mats : list of str + All burnable material IDs being managed by a single process + external_rates : dict of str to dict + Container of timesteps, transfer rates, components (elements and/or + nuclides) and destination material + external_timesteps : list of int + Container of all timesteps indeces with an external rate defined. + index_transfer : Set of pair of str + Pair of strings needed to build final matrix (destination_material, mat) + """ + + def __init__(self, operator, materials, number_of_timesteps): + super().__init__(operator, materials, number_of_timesteps) + self.index_transfer = defaultdict(list) + self.chain_nuclides = [nuc.name for nuc in operator.chain.nuclides] def set_transfer_rate(self, material, components, transfer_rate, - transfer_rate_units='1/s', destination_material=None): + transfer_rate_units='1/s', timesteps=None, + destination_material=None): """Set element and/or nuclide transfer rates in a depletable material. Parameters @@ -157,11 +219,14 @@ class TransferRates: transfer_rate : float Rate at which elements and/or nuclides are transferred. A positive or negative value corresponds to a removal or feed rate, respectively. - destination_material : openmc.Material or str or int, Optional - Destination material to where nuclides get fed. transfer_rate_units : {'1/s', '1/min', '1/h', '1/d', '1/a'} Units for values specified in the transfer_rate argument. 's' for seconds, 'min' for minutes, 'h' for hours, 'a' for Julian years. + timesteps : list of int, Optional + List of timestep indeces where to set transfer rates. + Default to None means the transfer rate is set for all timesteps. + destination_material : openmc.Material or str or int, Optional + Destination material to where nuclides get fed. """ material_id = self._get_material_id(material) @@ -183,19 +248,25 @@ class TransferRates: if transfer_rate_units in ('1/s', '1/sec'): unit_conv = 1 elif transfer_rate_units in ('1/min', '1/minute'): - unit_conv = 60 + unit_conv = _SECONDS_PER_MINUTE elif transfer_rate_units in ('1/h', '1/hr', '1/hour'): - unit_conv = 60*60 + unit_conv = _SECONDS_PER_HOUR elif transfer_rate_units in ('1/d', '1/day'): - unit_conv = 24*60*60 + unit_conv = _SECONDS_PER_DAY elif transfer_rate_units in ('1/a', '1/year'): - unit_conv = 365.25*24*60*60 + unit_conv = _SECONDS_PER_JULIAN_YEAR else: - raise ValueError('Invalid transfer rate unit ' - f'"{transfer_rate_units}"') + raise ValueError(f'Invalid transfer rate unit "{transfer_rate_units}"') + + if timesteps is not None: + for timestep in timesteps: + check_value('timestep', timestep, range(self.number_of_timesteps)) + timesteps = np.array(timesteps) + else: + timesteps = np.arange(self.number_of_timesteps) for component in components: - current_components = self.transfer_rates[material_id].keys() + current_components = self.external_rates[material_id].keys() split_component = re.split(r'\d+', component) element = split_component[0] if element not in ELEMENT_SYMBOL.values(): @@ -219,11 +290,184 @@ class TransferRates: f'where element {element} already has ' 'a transfer rate.') - if component in self.transfer_rates[material_id]: - self.transfer_rates[material_id][component].append( - (transfer_rate / unit_conv, destination_material_id)) - else: - self.transfer_rates[material_id][component] = [ - (transfer_rate / unit_conv, destination_material_id)] + self.external_rates[material_id][component].append( + (timesteps, transfer_rate/unit_conv, destination_material_id)) + if destination_material_id is not None: - self.index_transfer.add((destination_material_id, material_id)) + for timestep in timesteps: + self.index_transfer[timestep].append( + (destination_material_id, material_id)) + + self.external_timesteps = np.unique(np.concatenate( + [self.external_timesteps, timesteps])) + + def set_redox(self, material, buffer, oxidation_states, timesteps=None): + """Add redox control to depletable material. + + Parameters + ---------- + material : openmc.Material or str or int + Depletable material + buffer : dict + Dictionary of buffer nuclides used to maintain redox balance. + Keys are nuclide names (strings) and values are their respective + fractions (float) that collectively sum to 1. + oxidation_states : dict + User-defined oxidation states for elements. + Keys are element symbols (e.g., 'H', 'He'), and values are their + corresponding oxidation states as integers (e.g., +1, 0). + timesteps : list of int, optional + List of timestep indices where to set external source rates. + Defaults to None, which means the external source rate is set for + all timesteps. + + """ + material_id = self._get_material_id(material) + if timesteps is not None: + for timestep in timesteps: + check_value('timestep', timestep, range(self.number_of_timesteps)) + timesteps = np.array(timesteps) + else: + timesteps = np.arange(self.number_of_timesteps) + #Check nuclides in buffer exist + for nuc in buffer: + if nuc not in self.chain_nuclides: + raise ValueError(f'{nuc} is not a valid nuclide.') + # Checks element in oxidation states exist + for elm in oxidation_states: + if elm not in ELEMENT_SYMBOL.values(): + raise ValueError(f'{elm} is not a valid element.') + + self.redox[material_id] = (buffer, oxidation_states) + self.external_timesteps = np.unique(np.concatenate( + [self.external_timesteps, timesteps])) + +class ExternalSourceRates(ExternalRates): + """Class for defining external source rates. + + An instance of this class can be passed directly to an instance of one of + the :class:`openmc.deplete.Integrator` classes. + + .. versionadded:: 0.15.3 + + Parameters + ---------- + operator : openmc.TransportOperator + Depletion operator + materials : openmc.Materials + OpenMC materials. + number_of_timesteps : int + Total number of depletion timesteps + + Attributes + ---------- + burnable_mats : list of str + All burnable material IDs. + local_mats : list of str + All burnable material IDs being managed by a single process + external_timesteps : list of int + Container of all timesteps indeces with an external rate defined. + external_rates : dict of str to dict + Container of timesteps external source rates, and components + (elements and/or nuclides) + """ + + def reformat_nuclide_vectors(self, vectors): + """Remove last element of nuclide vector that was added for handling + external source rates by the depletion solver. + + Parameters + ---------- + vectors : list of array + List of nuclides vector to reformat + + """ + for mat_index, i in enumerate(self.local_mats): + if self.external_rates[i]: + vectors[mat_index] = vectors[mat_index][:-1] + + def set_external_source_rate( + self, + material: str | int | Material, + composition: dict[str, float], + rate: float, + rate_units: str = 'g/s', + timesteps: Sequence[int] | None = None + ): + """Set element and/or nuclide composition vector external source rates + to a depletable material. + + Parameters + ---------- + material : openmc.Material or str or int + Depletable material + composition : dict of str to float + External source rate composition vector, where key can be an element + or a nuclide and value the corresponding weight percent. + rate : float + External source rate in units of mass per time. A positive or + negative value corresponds to a feed or removal rate, respectively. + rate_units : {'g/s', 'g/min', 'g/h', 'g/d', 'g/a'} + Units for values specified in the `rate` argument. 's' for seconds, + 'min' for minutes, 'h' for hours, 'a' for Julian years. + timesteps : list of int, optional + List of timestep indices where to set external source rates. Default + to None, which means the external source rate is set for all + timesteps. + + """ + + material_id = self._get_material_id(material) + check_type('rate', rate, Real) + check_type('composition', composition, dict, str) + + if rate_units in ('g/s', 'g/sec'): + unit_conv = 1 + elif rate_units in ('g/min', 'g/minute'): + unit_conv = _SECONDS_PER_MINUTE + elif rate_units in ('g/h', 'g/hr', 'g/hour'): + unit_conv = _SECONDS_PER_HOUR + elif rate_units in ('g/d', 'g/day'): + unit_conv = _SECONDS_PER_DAY + elif rate_units in ('g/a', 'g/year'): + unit_conv = _SECONDS_PER_JULIAN_YEAR + else: + raise ValueError(f'Invalid external source rate unit "{rate_units}"') + + if timesteps is not None: + for timestep in timesteps: + check_value('timestep', timestep, range(self.number_of_timesteps)) + timesteps = np.asarray(timesteps) + else: + timesteps = np.arange(self.number_of_timesteps) + + components = composition.keys() + percents = composition.values() + norm_percents = [float(i) / sum(percents) for i in percents] + + atoms_per_nuc = {} + for component, percent in zip(components, norm_percents): + split_component = re.split(r'\d+', component) + element = split_component[0] + if element not in ELEMENT_SYMBOL.values(): + raise ValueError(f'{component} is not a valid nuclide or element.') + + if len(split_component) == 1: + if not isotopes(component): + raise ValueError(f'Cannot add element {component} ' + 'as it is not naturally abundant. ' + 'Specify a nuclide vector instead.') + for nuc, frac in isotopes(component): + atoms_per_nuc[nuc] = (rate / atomic_mass(nuc) * AVOGADRO * + frac * percent / unit_conv) + + else: + atoms_per_nuc[component] = (rate / atomic_mass(component) * + AVOGADRO * percent / unit_conv) + + for nuc, val in atoms_per_nuc.items(): + self.external_rates[material_id][nuc].append((timesteps, val, None)) + + self.external_timesteps = np.unique(np.concatenate( + [self.external_timesteps, timesteps] + )) diff --git a/openmc/element.py b/openmc/element.py index 082bee522..f1d8f5f24 100644 --- a/openmc/element.py +++ b/openmc/element.py @@ -144,8 +144,7 @@ class Element(str): root = tree.getroot() for child in root.findall('library'): nuclide = child.attrib['materials'] - if re.match(r'{}\d+'.format(self), nuclide) and \ - '_m' not in nuclide: + if re.match(r'{}\d+'.format(self), nuclide): library_nuclides.add(nuclide) # Get a set of the mutual and absent nuclides. Convert to lists @@ -185,8 +184,10 @@ class Element(str): for nuclide in absent_nuclides: if nuclide in ['O17', 'O18'] and 'O16' in mutual_nuclides: abundances['O16'] += NATURAL_ABUNDANCE[nuclide] - elif nuclide == 'Ta180' and 'Ta181' in mutual_nuclides: - abundances['Ta181'] += NATURAL_ABUNDANCE[nuclide] + elif nuclide == 'Ta180_m1' and 'Ta180' in library_nuclides: + abundances['Ta180'] = NATURAL_ABUNDANCE[nuclide] + elif nuclide == 'Ta180_m1' and 'Ta181' in mutual_nuclides: + abundances['Ta181'] += NATURAL_ABUNDANCE[nuclide] elif nuclide == 'W180' and 'W182' in mutual_nuclides: abundances['W182'] += NATURAL_ABUNDANCE[nuclide] else: diff --git a/openmc/examples.py b/openmc/examples.py index 5578d513e..01dd9d01f 100644 --- a/openmc/examples.py +++ b/openmc/examples.py @@ -83,7 +83,7 @@ def pwr_pin_cell() -> openmc.Model: constraints={'fissionable': True} ) - plot = openmc.Plot.from_geometry(model.geometry) + plot = openmc.SlicePlot.from_geometry(model.geometry) plot.pixels = (300, 300) plot.color_by = 'material' model.plots.append(plot) @@ -429,7 +429,7 @@ def pwr_core() -> openmc.Model: model.settings.source = openmc.IndependentSource(space=openmc.stats.Box( [-160, -160, -183], [160, 160, 183])) - plot = openmc.Plot() + plot = openmc.SlicePlot() plot.origin = (125, 125, 0) plot.width = (250, 250) plot.pixels = (3000, 3000) @@ -544,7 +544,7 @@ def pwr_assembly() -> openmc.Model: constraints={'fissionable': True} ) - plot = openmc.Plot() + plot = openmc.SlicePlot() plot.origin = (0.0, 0.0, 0) plot.width = (21.42, 21.42) plot.pixels = (300, 300) diff --git a/openmc/executor.py b/openmc/executor.py index aacc48b3f..9cd299345 100644 --- a/openmc/executor.py +++ b/openmc/executor.py @@ -164,7 +164,7 @@ def plot_inline(plots, openmc_exec='openmc', cwd='.', path_input=None): Parameters ---------- - plots : Iterable of openmc.Plot + plots : Iterable of openmc.PlotBase Plots to display openmc_exec : str Path to OpenMC executable diff --git a/openmc/filter.py b/openmc/filter.py index 35a7e7c7e..e7c54f2f0 100644 --- a/openmc/filter.py +++ b/openmc/filter.py @@ -17,7 +17,7 @@ from .material import Material from .mixin import IDManagerMixin from .surface import Surface from .universe import UniverseBase -from ._xml import get_text +from ._xml import get_elem_list, get_text _FILTER_TYPES = ( @@ -25,7 +25,8 @@ _FILTER_TYPES = ( 'energyout', 'mu', 'musurface', 'polar', 'azimuthal', 'distribcell', 'delayedgroup', 'energyfunction', 'cellfrom', 'materialfrom', 'legendre', 'spatiallegendre', 'sphericalharmonics', 'zernike', 'zernikeradial', 'particle', 'cellinstance', - 'collision', 'time', 'parentnuclide' + 'collision', 'time', 'parentnuclide', 'weight', 'meshborn', 'meshsurface', + 'meshmaterial', ) _CURRENT_NAMES = ( @@ -258,17 +259,15 @@ class Filter(IDManagerMixin, metaclass=FilterMeta): Filter object """ - filter_type = elem.get('type') - if filter_type is None: - filter_type = elem.find('type').text + filter_type = get_text(elem, "type") # If the filter type matches this class's short_name, then # there is no overridden from_xml_element method if filter_type == cls.short_name.lower(): # Get bins from element -- the default here works for any filters # that just store a list of bins that can be represented as integers - filter_id = int(elem.get('id')) - bins = [int(x) for x in get_text(elem, 'bins').split()] + filter_id = int(get_text(elem, "id")) + bins = get_elem_list(elem, "bins", int) or [] return cls(bins, filter_id=filter_id) # Search through all subclasses and find the one matching the HDF5 @@ -700,8 +699,8 @@ class CellInstanceFilter(Filter): @classmethod def from_xml_element(cls, elem, **kwargs): - filter_id = int(elem.get('id')) - bins = [int(x) for x in get_text(elem, 'bins').split()] + filter_id = int(get_text(elem, "id")) + bins = get_elem_list(elem, "bins", int) or [] cell_instances = list(zip(bins[::2], bins[1::2])) return cls(cell_instances, filter_id=filter_id) @@ -783,8 +782,8 @@ class ParticleFilter(Filter): @classmethod def from_xml_element(cls, elem, **kwargs): - filter_id = int(elem.get('id')) - bins = get_text(elem, 'bins').split() + filter_id = int(get_text(elem, "id")) + bins = get_elem_list(elem, "bins", str) or [] return cls(bins, filter_id=filter_id) @@ -816,7 +815,7 @@ class ParentNuclideFilter(ParticleFilter): class MeshFilter(Filter): - """Bins tally event locations by mesh elements. + r"""Bins tally event locations by mesh elements. Parameters ---------- @@ -834,6 +833,25 @@ class MeshFilter(Filter): translation : Iterable of float This array specifies a vector that is used to translate (shift) the mesh for this filter + rotation : Iterable of float + This array specifies the angles in degrees about the x, y, and z axes + that the mesh should be rotated. The rotation applied is an intrinsic + rotation with specified Tait-Bryan angles. That is to say, if the angles + are :math:`(\phi, \theta, \psi)`, then the rotation matrix applied is + :math:`R_z(\psi) R_y(\theta) R_x(\phi)` or + + .. math:: + + \left [ \begin{array}{ccc} \cos\theta \cos\psi & -\cos\phi \sin\psi + + \sin\phi \sin\theta \cos\psi & \sin\phi \sin\psi + \cos\phi + \sin\theta \cos\psi \\ \cos\theta \sin\psi & \cos\phi \cos\psi + + \sin\phi \sin\theta \sin\psi & -\sin\phi \cos\psi + \cos\phi + \sin\theta \sin\psi \\ -\sin\theta & \sin\phi \cos\theta & \cos\phi + \cos\theta \end{array} \right ] + + A rotation matrix can also be specified directly by setting this + attribute to a nested list (or 2D numpy array) that specifies each + element of the matrix. bins : list of tuple A list of mesh indices for each filter bin, e.g. [(1, 1, 1), (2, 1, 1), ...] @@ -846,6 +864,7 @@ class MeshFilter(Filter): self.mesh = mesh self.id = filter_id self._translation = None + self._rotation = None def __hash__(self): string = type(self).__name__ + '\n' @@ -857,6 +876,7 @@ class MeshFilter(Filter): string += '{: <16}=\t{}\n'.format('\tMesh ID', self.mesh.id) string += '{: <16}=\t{}\n'.format('\tID', self.id) string += '{: <16}=\t{}\n'.format('\tTranslation', self.translation) + string += '{: <16}=\t{}\n'.format('\tRotation', self.rotation) return string @classmethod @@ -880,6 +900,10 @@ class MeshFilter(Filter): if translation: out.translation = translation[()] + rotation = group.get('rotation') + if rotation: + out.rotation = rotation[()] + return out @property @@ -900,8 +924,6 @@ class MeshFilter(Filter): @property def shape(self): - if isinstance(self, MeshSurfaceFilter): - return (self.num_bins,) return self.mesh.dimension @property @@ -914,6 +936,15 @@ class MeshFilter(Filter): cv.check_length('mesh filter translation', t, 3) self._translation = np.asarray(t) + @property + def rotation(self): + return self._rotation + + @rotation.setter + def rotation(self, rotation): + cv.check_length('mesh filter rotation', rotation, 3) + self._rotation = np.asarray(rotation) + def can_merge(self, other): # Mesh filters cannot have more than one bin return False @@ -992,22 +1023,34 @@ class MeshFilter(Filter): XML element containing filter data """ - element = super().to_xml_element() - element[0].text = str(self.mesh.id) + element = ET.Element('filter') + element.set('id', str(self.id)) + element.set('type', self.short_name.lower()) + subelement = ET.SubElement(element, 'bins') + subelement.text = str(self.mesh.id) if self.translation is not None: element.set('translation', ' '.join(map(str, self.translation))) + if self.rotation is not None: + element.set('rotation', ' '.join(map(str, self.rotation.ravel()))) return element @classmethod def from_xml_element(cls, elem: ET.Element, **kwargs) -> MeshFilter: mesh_id = int(get_text(elem, 'bins')) mesh_obj = kwargs['meshes'][mesh_id] - filter_id = int(elem.get('id')) + filter_id = int(get_text(elem, "id")) out = cls(mesh_obj, filter_id=filter_id) - translation = elem.get('translation') + translation = get_elem_list(elem, "translation", float) or [] if translation: - out.translation = [float(x) for x in translation.split()] + out.translation = translation + + rotation = get_elem_list(elem, 'rotation', float) or [] + if rotation: + if len(rotation) == 3: + out.rotation = rotation + elif len(rotation) == 9: + out.rotation = np.array(rotation).reshape(3, 3) return out @@ -1039,6 +1082,186 @@ class MeshBornFilter(MeshFilter): """ +class MeshMaterialFilter(MeshFilter): + """Filter events by combinations of mesh elements and materials. + + .. versionadded:: 0.15.3 + + Parameters + ---------- + mesh : openmc.MeshBase + The mesh object that events will be tallied onto + bins : iterable of 2-tuples or numpy.ndarray + Combinations of (mesh element, material) to tally, given as 2-tuples. + The first value in the tuple represents the index of the mesh element, + and the second value indicates the material (either a + :class:`openmc.Material` instance of the ID). + filter_id : int + Unique identifier for the filter + + """ + def __init__(self, mesh: openmc.MeshBase, bins, filter_id=None): + self.mesh = mesh + self.bins = bins + self.id = filter_id + self._translation = None + + @classmethod + def from_volumes(cls, mesh: openmc.MeshBase, volumes: openmc.MeshMaterialVolumes): + """Construct a MeshMaterialFilter from a MeshMaterialVolumes object. + + Parameters + ---------- + mesh : openmc.MeshBase + The mesh object that events will be tallied onto + volumes : openmc.MeshMaterialVolumes + The mesh material volumes to use for the filter + + Returns + ------- + MeshMaterialFilter + A new MeshMaterialFilter instance + + """ + # Get flat arrays of material IDs and element indices + mat_ids = volumes._materials[volumes._materials > -1] + elems, _ = np.where(volumes._materials > -1) + + # Stack them into a 2D array of (element, material) pairs + bins = np.column_stack((elems, mat_ids)) + return cls(mesh, bins) + + def __hash__(self): + data = (type(self).__name__, self.mesh.id, tuple(self.bins.ravel())) + return hash(data) + + def __repr__(self): + string = type(self).__name__ + '\n' + string += '{: <16}=\t{}\n'.format('\tID', self.id) + string += '{: <16}=\t{}\n'.format('\tMesh ID', self.mesh.id) + string += '{: <16}=\n{}\n'.format('\tBins', self.bins) + string += '{: <16}=\t{}\n'.format('\tTranslation', self.translation) + return string + + @property + def shape(self): + return (self.num_bins,) + + @property + def mesh(self): + return self._mesh + + @mesh.setter + def mesh(self, mesh): + cv.check_type('filter mesh', mesh, openmc.MeshBase) + self._mesh = mesh + + @Filter.bins.setter + def bins(self, bins): + pairs = np.empty((len(bins), 2), dtype=int) + for i, (elem, mat) in enumerate(bins): + cv.check_type('element', elem, Integral) + cv.check_type('material', mat, (Integral, openmc.Material)) + pairs[i, 0] = elem + pairs[i, 1] = mat if isinstance(mat, Integral) else mat.id + self._bins = pairs + + def to_xml_element(self): + """Return XML element representing the filter. + + Returns + ------- + element : lxml.etree._Element + XML element containing filter data + + """ + element = ET.Element('filter') + element.set('id', str(self.id)) + element.set('type', self.short_name.lower()) + element.set('mesh', str(self.mesh.id)) + + if self.translation is not None: + element.set('translation', ' '.join(map(str, self.translation))) + + subelement = ET.SubElement(element, 'bins') + subelement.text = ' '.join(str(i) for i in self.bins.ravel()) + + return element + + @classmethod + def from_xml_element(cls, elem: ET.Element, **kwargs) -> MeshMaterialFilter: + filter_id = int(get_text(elem, "id")) + mesh_id = int(get_text(elem, "mesh")) + mesh_obj = kwargs['meshes'][mesh_id] + bins = get_elem_list(elem, "bins", int) or [] + bins = list(zip(bins[::2], bins[1::2])) + out = cls(mesh_obj, bins, filter_id=filter_id) + + translation = get_elem_list(elem, "translation", float) or [] + if translation: + out.translation = translation + return out + + @classmethod + def from_hdf5(cls, group, **kwargs): + if group['type'][()].decode() != cls.short_name.lower(): + raise ValueError("Expected HDF5 data for filter type '" + + cls.short_name.lower() + "' but got '" + + group['type'][()].decode() + " instead") + + if 'meshes' not in kwargs: + raise ValueError(cls.__name__ + " requires a 'meshes' keyword " + "argument.") + + mesh_id = group['mesh'][()] + mesh_obj = kwargs['meshes'][mesh_id] + bins = group['bins'][()] + filter_id = int(group.name.split('/')[-1].lstrip('filter ')) + out = cls(mesh_obj, bins, filter_id=filter_id) + + translation = group.get('translation') + if translation: + out.translation = translation[()] + + return out + + def get_pandas_dataframe(self, data_size, stride, **kwargs): + """Builds a Pandas DataFrame for the Filter's bins. + + This method constructs a Pandas DataFrame object for the filter with + columns annotated by filter bin information. This is a helper method for + :meth:`Tally.get_pandas_dataframe`. + + Parameters + ---------- + data_size : int + The total number of bins in the tally corresponding to this filter + stride : int + Stride in memory for the filter + + Returns + ------- + pandas.DataFrame + A Pandas DataFrame with a multi-index column for the cell instance. + The number of rows in the DataFrame is the same as the total number + of bins in the corresponding tally, with the filter bin appropriately + tiled to map to the corresponding tally bins. + + See also + -------- + Tally.get_pandas_dataframe(), CrossFilter.get_pandas_dataframe() + + """ + # Repeat and tile bins as necessary to account for other filters. + bins = np.repeat(self.bins, stride, axis=0) + tile_factor = data_size // len(bins) + bins = np.tile(bins, (tile_factor, 1)) + + columns = pd.MultiIndex.from_product([[self.short_name.lower()], + ['element', 'material']]) + return pd.DataFrame(bins, columns=columns) + + class MeshSurfaceFilter(MeshFilter): """Filter events by surface crossings on a mesh. @@ -1065,6 +1288,9 @@ class MeshSurfaceFilter(MeshFilter): The number of filter bins """ + @property + def shape(self): + return (self.num_bins,) @MeshFilter.mesh.setter def mesh(self, mesh): @@ -1238,7 +1464,7 @@ class RealFilter(Filter): cv.check_type('filter value', v1, Real) # Make sure that each tuple has values that are increasing - if v1 < v0: + if v1 <= v0: raise ValueError(f'Values {v0} and {v1} appear to be out of ' 'order') @@ -1372,8 +1598,8 @@ class RealFilter(Filter): @classmethod def from_xml_element(cls, elem, **kwargs): - filter_id = int(elem.get('id')) - bins = [float(x) for x in get_text(elem, 'bins').split()] + filter_id = int(get_text(elem, "id")) + bins = get_elem_list(elem, "bins", float) or [] return cls(bins, filter_id=filter_id) @@ -1384,7 +1610,7 @@ class EnergyFilter(RealFilter): ---------- values : Iterable of Real A list of values for which each successive pair constitutes a range of - energies in [eV] for a single bin + energies in [eV] for a single bin. Entries must be positive and ascending. filter_id : int Unique identifier for the filter @@ -1656,12 +1882,21 @@ class DistribcellFilter(Filter): @property def paths(self): - return self._paths + if self._paths is None: + if not hasattr(self, '_geometry'): + raise ValueError( + "Model must be exported before the 'paths' attribute is" \ + "available for a DistribcellFilter.") - @paths.setter - def paths(self, paths): - cv.check_iterable_type('paths', paths, str) - self._paths = paths + # Determine paths for cell instances + self._geometry.determine_paths() + + # Get paths for the corresponding cell + cell_id = self.bins[0] + cell = self._geometry.get_all_cells()[cell_id] + self._paths = cell.paths + + return self._paths @Filter.bins.setter def bins(self, bins): @@ -2262,12 +2497,13 @@ class EnergyFunctionFilter(Filter): @classmethod def from_xml_element(cls, elem, **kwargs): - filter_id = int(elem.get('id')) - energy = [float(x) for x in get_text(elem, 'energy').split()] - y = [float(x) for x in get_text(elem, 'y').split()] + filter_id = int(get_text(elem, "id")) + energy = get_elem_list(elem, "energy", float) or [] + y = get_elem_list(elem, "y", float) or [] out = cls(energy, y, filter_id=filter_id) - if elem.find('interpolation') is not None: - out.interpolation = elem.find('interpolation').text + interpolation = get_text(elem, "interpolation") + if interpolation is not None: + out.interpolation = interpolation return out def can_merge(self, other): @@ -2328,3 +2564,26 @@ class EnergyFunctionFilter(Filter): {self.short_name.lower(): filter_bins})]) return df + + +class WeightFilter(RealFilter): + """Bins tally events based on the incoming particle weight. + + Parameters + ---------- + Values : Iterable of float + A list or iterable of the weight boundaries, as float values. + filter_id : int + Unique identifier for the filter + + Attributes + ---------- + id : int + Unique identifier for the filter + bins : numpy.ndarray + An array of integer values representing the weights by which to filter + num_bins : int + The number of filter bins + values : numpy.ndarray + Array of weight boundaries + """ diff --git a/openmc/filter_expansion.py b/openmc/filter_expansion.py index f8e677578..b79c8fc79 100644 --- a/openmc/filter_expansion.py +++ b/openmc/filter_expansion.py @@ -3,7 +3,8 @@ from numbers import Integral, Real import lxml.etree as ET import openmc.checkvalue as cv -from . import Filter +from .filter import Filter +from ._xml import get_text class ExpansionFilter(Filter): @@ -49,8 +50,8 @@ class ExpansionFilter(Filter): @classmethod def from_xml_element(cls, elem, **kwargs): - filter_id = int(elem.get('id')) - order = int(elem.find('order').text) + filter_id = int(get_text(elem, "id")) + order = int(get_text(elem, "order")) return cls(order, filter_id=filter_id) def merge(self, other): @@ -263,11 +264,11 @@ class SpatialLegendreFilter(ExpansionFilter): @classmethod def from_xml_element(cls, elem, **kwargs): - filter_id = int(elem.get('id')) - order = int(elem.find('order').text) - axis = elem.find('axis').text - minimum = float(elem.find('min').text) - maximum = float(elem.find('max').text) + filter_id = int(get_text(elem, "id")) + order = int(get_text(elem, "order")) + axis = get_text(elem, "axis") + minimum = float(get_text(elem, "min")) + maximum = float(get_text(elem, "max")) return cls(order, axis, minimum, maximum, filter_id=filter_id) @@ -362,10 +363,10 @@ class SphericalHarmonicsFilter(ExpansionFilter): @classmethod def from_xml_element(cls, elem, **kwargs): - filter_id = int(elem.get('id')) - order = int(elem.find('order').text) + filter_id = int(get_text(elem, "id")) + order = int(get_text(elem, "order")) filter = cls(order, filter_id=filter_id) - filter.cosine = elem.get('cosine') + filter.cosine = get_text(elem, "cosine") return filter @@ -518,11 +519,11 @@ class ZernikeFilter(ExpansionFilter): @classmethod def from_xml_element(cls, elem, **kwargs): - filter_id = int(elem.get('id')) - order = int(elem.find('order').text) - x = float(elem.find('x').text) - y = float(elem.find('y').text) - r = float(elem.find('r').text) + filter_id = int(get_text(elem, "id")) + order = int(get_text(elem, "order")) + x = float(get_text(elem, "x")) + y = float(get_text(elem, "y")) + r = float(get_text(elem, "r")) return cls(order, x, y, r, filter_id=filter_id) diff --git a/openmc/geometry.py b/openmc/geometry.py index c069d5796..8496fb23a 100644 --- a/openmc/geometry.py +++ b/openmc/geometry.py @@ -140,7 +140,6 @@ class Geometry: # Clean the indentation in the file to be user-readable xml.clean_indentation(element) - xml.reorder_attributes(element) # TODO: Remove when support is Python 3.8+ return element @@ -754,4 +753,31 @@ class Geometry: .. versionadded:: 0.14.0 """ - return self.root_universe.plot(*args, **kwargs) + model = openmc.Model() + model.geometry = self + model.materials = self.get_all_materials().values() + + # collect all the material names from the geometry + all_material_names = {m.name for m in model.materials if m.name is not None} + + # makes a placeholder material for each material name if it isn't + # already present on the model. These materials are otherwise missing + # from the geometry and are needed for plotting. + for universe in model.geometry.get_all_universes().values(): + if not isinstance(universe, openmc.DAGMCUniverse): + continue + for name in universe.material_names: + # if this name is already present in the model, skip it + # (this can happen if the same material name is used in multiple + # universes) + if name in all_material_names: + continue + # if the material name is not present on the model, + # create a placeholder material with the same name + # and add it to the model + mat_dag = openmc.Material(name=name) + mat_dag.add_nuclide('H1', 1.0) + model.materials.append(mat_dag) + all_material_names.add(name) + + return model.plot(*args, **kwargs) diff --git a/openmc/lattice.py b/openmc/lattice.py index 518068560..21849ec40 100644 --- a/openmc/lattice.py +++ b/openmc/lattice.py @@ -10,7 +10,7 @@ import numpy as np import openmc import openmc.checkvalue as cv -from ._xml import get_text +from ._xml import get_elem_list, get_text from .mixin import IDManagerMixin @@ -959,18 +959,17 @@ class RectLattice(Lattice): lat_id = int(get_text(elem, 'id')) name = get_text(elem, 'name') lat = cls(lat_id, name) - lat.lower_left = [float(i) - for i in get_text(elem, 'lower_left').split()] - lat.pitch = [float(i) for i in get_text(elem, 'pitch').split()] + lat.lower_left = get_elem_list(elem, "lower_left", float) + lat.pitch = get_elem_list(elem, "pitch", float) outer = get_text(elem, 'outer') if outer is not None: lat.outer = get_universe(int(outer)) # Get array of universes - dimension = get_text(elem, 'dimension').split() + dimension = get_elem_list(elem, 'dimension', int) shape = np.array(dimension, dtype=int)[::-1] - uarray = np.array([get_universe(int(i)) for i in - get_text(elem, 'universes').split()]) + universes = get_elem_list(elem, 'universes', int) + uarray = np.array([get_universe(u) for u in universes]) uarray.shape = shape lat.universes = uarray return lat @@ -1084,8 +1083,11 @@ class HexLattice(Lattice): from the outermost ring), and i is the index with a ring starting from the top and proceeding clockwise. orientation : {'x', 'y'} - str by default 'y' orientation of main lattice diagonal another option - - 'x' + The orientation of the lattice. The 'x' orientation means that each + lattice element has two faces that are perpendicular to the x-axis, + while the 'y' orientation means that each lattice element has two faces + that are perpendicular to the y-axis. By default, the orientation is + 'y'. num_rings : int Number of radial ring positions in the xy-plane num_axial : int @@ -1530,8 +1532,8 @@ class HexLattice(Lattice): lat_id = int(get_text(elem, 'id')) name = get_text(elem, 'name') lat = cls(lat_id, name) - lat.center = [float(i) for i in get_text(elem, 'center').split()] - lat.pitch = [float(i) for i in get_text(elem, 'pitch').split()] + lat.center = get_elem_list(elem, "center", float) + lat.pitch = get_elem_list(elem, "pitch", float) lat.orientation = get_text(elem, 'orientation', 'y') outer = get_text(elem, 'outer') if outer is not None: @@ -1548,8 +1550,8 @@ class HexLattice(Lattice): univs = [deepcopy(univs) for i in range(n_axial)] # Get flat array of universes - uarray = np.array([get_universe(int(i)) for i in - get_text(elem, 'universes').split()]) + universes = get_elem_list(elem, "universes", int) + uarray = np.array([get_universe(u) for u in universes]) # Fill nested lists j = 0 diff --git a/openmc/lib/__init__.py b/openmc/lib/__init__.py index 15642b42b..d2a794eb1 100644 --- a/openmc/lib/__init__.py +++ b/openmc/lib/__init__.py @@ -46,9 +46,6 @@ def _coord_levels(): def _libmesh_enabled(): return c_bool.in_dll(_dll, "LIBMESH_ENABLED").value -def _mcpl_enabled(): - return c_bool.in_dll(_dll, "MCPL_ENABLED").value - def _uwuw_enabled(): return c_bool.in_dll(_dll, "UWUW_ENABLED").value diff --git a/openmc/lib/cell.py b/openmc/lib/cell.py index 971a24cba..dfd09d2f9 100644 --- a/openmc/lib/cell.py +++ b/openmc/lib/cell.py @@ -34,6 +34,10 @@ _dll.openmc_cell_get_temperature.argtypes = [ c_int32, POINTER(c_int32), POINTER(c_double)] _dll.openmc_cell_get_temperature.restype = c_int _dll.openmc_cell_get_temperature.errcheck = _error_handler +_dll.openmc_cell_get_density.argtypes = [ + c_int32, POINTER(c_int32), POINTER(c_double)] +_dll.openmc_cell_get_density.restype = c_int +_dll.openmc_cell_get_density.errcheck = _error_handler _dll.openmc_cell_get_name.argtypes = [c_int32, POINTER(c_char_p)] _dll.openmc_cell_get_name.restype = c_int _dll.openmc_cell_get_name.errcheck = _error_handler @@ -58,6 +62,10 @@ _dll.openmc_cell_set_temperature.argtypes = [ c_int32, c_double, POINTER(c_int32), c_bool] _dll.openmc_cell_set_temperature.restype = c_int _dll.openmc_cell_set_temperature.errcheck = _error_handler +_dll.openmc_cell_set_density.argtypes = [ + c_int32, c_double, POINTER(c_int32), c_bool] +_dll.openmc_cell_set_density.restype = c_int +_dll.openmc_cell_set_density.errcheck = _error_handler _dll.openmc_cell_set_translation.argtypes = [c_int32, POINTER(c_double)] _dll.openmc_cell_set_translation.restype = c_int _dll.openmc_cell_set_translation.errcheck = _error_handler @@ -236,6 +244,44 @@ class Cell(_FortranObjectWithID): _dll.openmc_cell_set_temperature(self._index, T, instance, set_contained) + def get_density(self, instance: int | None = None): + """Get the density of a cell in [g/cm3] + + Parameters + ---------- + instance : int or None + Which instance of the cell + + """ + + if instance is not None: + instance = c_int32(instance) + + rho = c_double() + _dll.openmc_cell_get_density(self._index, instance, rho) + return rho.value + + def set_density(self, rho: float, instance: int | None = None, + set_contained: bool = False): + """Set the density of a cell + + Parameters + ---------- + rho : float + Density of the cell in [g/cm3] + instance : int or None + Which instance of the cell + set_contained : bool + If cell is not filled by a material, whether to set the density + of all filled cells + + """ + + if instance is not None: + instance = c_int32(instance) + + _dll.openmc_cell_set_density(self._index, rho, instance, set_contained) + @property def translation(self): translation = np.zeros(3) diff --git a/openmc/lib/core.py b/openmc/lib/core.py index 577913dcb..02c7784d1 100644 --- a/openmc/lib/core.py +++ b/openmc/lib/core.py @@ -4,13 +4,17 @@ from ctypes import (c_bool, c_int, c_int32, c_int64, c_double, c_char_p, c_uint64, c_size_t) import sys import os +from pathlib import Path from random import getrandbits +from tempfile import TemporaryDirectory +import traceback as tb import numpy as np from numpy.ctypeslib import as_array from . import _dll from .error import _error_handler +from ..mpi import comm from openmc.checkvalue import PathLike import openmc.lib import openmc @@ -617,6 +621,106 @@ def run_in_memory(**kwargs): finalize() +class TemporarySession: + """Context manager for running via openmc.lib in a temporary directory. + + This class is useful for accessing functionality from openmc.lib without + polluting your current working directory with OpenMC files. It is used + internally as a persistent session to avoid loading cross sections multiple + times. + + Parameters + ---------- + model : openmc.Model, optional + OpenMC model to use for the session. If None, a minimal working model is + created. + cwd : PathLike, optional + Working directory in which to run OpenMC. If None, a temporary directory + is created and deleted automatically. + **init_kwargs + Keyword arguments to pass to :func:`openmc.lib.init`. + + Attributes + ---------- + model : openmc.Model + The OpenMC model used for the session. + comm : mpi4py.MPI.Intracomm + The MPI intracommunicator used for the session. + + """ + def __init__(self, model=None, cwd=None, **init_kwargs): + self.init_kwargs = dict(init_kwargs) + self.cwd = cwd + if model is None: + surf = openmc.Sphere(boundary_type="vacuum") + cell = openmc.Cell(region=-surf) + model = openmc.Model() + model.geometry = openmc.Geometry([cell]) + model.settings = openmc.Settings( + particles=1, batches=1, output={'summary': False}) + self.model = model + + # Determine MPI intercommunicator + self.init_kwargs.setdefault('intracomm', comm) + self.comm = self.init_kwargs['intracomm'] + + def __enter__(self): + """Initialize the OpenMC library in a temporary directory.""" + # If already initialized, the context manager is a no-op + self.already_initialized = openmc.lib.is_initialized + if self.already_initialized: + return self + + # Store original working directory + self.orig_dir = Path.cwd() + + if self.cwd is None: + # Set up temporary directory on rank 0 + if self.comm.rank == 0: + self._tmp_dir = TemporaryDirectory() + self.cwd = self._tmp_dir.name + + # Broadcast the path so that all ranks use the same directory + self.cwd = self.comm.bcast(self.cwd) + + # Create and change to specified directory + self.cwd = Path(self.cwd) + self.cwd.mkdir(parents=True, exist_ok=True) + os.chdir(self.cwd) + + # Export model on first rank and initialize OpenMC + if self.comm.rank == 0: + self.model.export_to_model_xml() + self.comm.barrier() + openmc.lib.init(**self.init_kwargs) + + return self + + def __exit__(self, exc_type, exc_value, traceback): + """Finalize the OpenMC library and clean up temporary directory.""" + if self.already_initialized: + return + + # If an exception occurred, abort all ranks immediately + if exc_type is not None: + # Print exception info on the rank that failed + tb.print_exception(exc_type, exc_value, traceback) + sys.stdout.flush() + + # Abort all MPI processes + self.comm.Abort(1) + + try: + finalize() + finally: + os.chdir(self.orig_dir) + + # Make sure all ranks have finalized before deleting temporary dir + self.comm.barrier() + if hasattr(self, '_tmp_dir'): + self._tmp_dir.cleanup() + + class _DLLGlobal: """Data descriptor that exposes global variables from libopenmc.""" def __init__(self, ctype, name): diff --git a/openmc/lib/filter.py b/openmc/lib/filter.py index b6086c567..5cf496107 100644 --- a/openmc/lib/filter.py +++ b/openmc/lib/filter.py @@ -21,10 +21,10 @@ __all__ = [ 'CellInstanceFilter', 'CollisionFilter', 'DistribcellFilter', 'DelayedGroupFilter', 'EnergyFilter', 'EnergyoutFilter', 'EnergyFunctionFilter', 'LegendreFilter', 'MaterialFilter', 'MaterialFromFilter', 'MeshFilter', 'MeshBornFilter', - 'MeshSurfaceFilter', 'MuFilter', 'MuSurfaceFilter', 'ParentNuclideFilter', - 'ParticleFilter', 'PolarFilter', 'SphericalHarmonicsFilter', - 'SpatialLegendreFilter', 'SurfaceFilter', 'UniverseFilter', 'ZernikeFilter', - 'ZernikeRadialFilter', 'filters' + 'MeshMaterialFilter', 'MeshSurfaceFilter', 'MuFilter', 'MuSurfaceFilter', + 'ParentNuclideFilter', 'ParticleFilter', 'PolarFilter', 'SphericalHarmonicsFilter', + 'SpatialLegendreFilter', 'SurfaceFilter', 'TimeFilter', 'UniverseFilter', + 'WeightFilter', 'ZernikeFilter', 'ZernikeRadialFilter', 'filters' ] # Tally functions @@ -97,6 +97,14 @@ _dll.openmc_mesh_filter_get_translation.errcheck = _error_handler _dll.openmc_mesh_filter_set_translation.argtypes = [c_int32, POINTER(c_double*3)] _dll.openmc_mesh_filter_set_translation.restype = c_int _dll.openmc_mesh_filter_set_translation.errcheck = _error_handler +_dll.openmc_mesh_filter_get_rotation.argtypes = [c_int32, POINTER(c_double), + POINTER(c_size_t)] +_dll.openmc_mesh_filter_get_rotation.restype = c_int +_dll.openmc_mesh_filter_get_rotation.errcheck = _error_handler +_dll.openmc_mesh_filter_set_rotation.argtypes = [ + c_int32, POINTER(c_double), c_size_t] +_dll.openmc_mesh_filter_set_rotation.restype = c_int +_dll.openmc_mesh_filter_set_rotation.errcheck = _error_handler _dll.openmc_meshborn_filter_get_mesh.argtypes = [c_int32, POINTER(c_int32)] _dll.openmc_meshborn_filter_get_mesh.restype = c_int _dll.openmc_meshborn_filter_get_mesh.errcheck = _error_handler @@ -393,6 +401,10 @@ class MeshFilter(Filter): Mesh used for the filter translation : Iterable of float 3-D coordinates of the translation vector + rotation : Iterable of float + The rotation matrix or angles of the filter mesh. This can either be + a fully specified 3 x 3 rotation matrix or an Iterable of length 3 + with the angles in degrees about the x, y, and z axes, respectively. """ filter_type = 'mesh' @@ -422,6 +434,34 @@ class MeshFilter(Filter): def translation(self, translation): _dll.openmc_mesh_filter_set_translation(self._index, (c_double*3)(*translation)) + @property + def rotation(self): + rotation_data = np.zeros(12) + rot_size = c_size_t() + + _dll.openmc_mesh_filter_get_rotation( + self._index, rotation_data.ctypes.data_as(POINTER(c_double)), + rot_size) + rot_size = rot_size.value + + if rot_size == 9: + return rotation_data[:rot_size].shape(3, 3) + elif rot_size in (0, 12): + # If size is 0, rotation_data[9:] will be zeros. This indicates no + # rotation and is the most straightforward way to always return + # an iterable of floats + return rotation_data[9:] + else: + raise ValueError( + f'Invalid size of rotation matrix: {rot_size}') + + @rotation.setter + def rotation(self, rotation_data): + flat_rotation = np.asarray(rotation_data, dtype=float).flatten() + + _dll.openmc_mesh_filter_set_rotation( + self._index, flat_rotation.ctypes.data_as(POINTER(c_double)), + c_size_t(len(flat_rotation))) class MeshBornFilter(Filter): """MeshBorn filter stored internally. @@ -480,6 +520,10 @@ class MeshBornFilter(Filter): _dll.openmc_meshborn_filter_set_translation(self._index, (c_double*3)(*translation)) +class MeshMaterialFilter(Filter): + filter_type = 'meshmaterial' + + class MeshSurfaceFilter(Filter): """MeshSurface filter stored internally. @@ -606,10 +650,18 @@ class SurfaceFilter(Filter): filter_type = 'surface' +class TimeFilter(Filter): + filter_type = 'time' + + class UniverseFilter(Filter): filter_type = 'universe' +class WeightFilter(Filter): + filter_type = 'weight' + + class ZernikeFilter(Filter): filter_type = 'zernike' @@ -639,6 +691,7 @@ _FILTER_TYPE_MAP = { 'cellborn': CellbornFilter, 'cellfrom': CellfromFilter, 'cellinstance': CellInstanceFilter, + 'collision': CollisionFilter, 'delayedgroup': DelayedGroupFilter, 'distribcell': DistribcellFilter, 'energy': EnergyFilter, @@ -649,6 +702,7 @@ _FILTER_TYPE_MAP = { 'materialfrom': MaterialFromFilter, 'mesh': MeshFilter, 'meshborn': MeshBornFilter, + 'meshmaterial': MeshMaterialFilter, 'meshsurface': MeshSurfaceFilter, 'mu': MuFilter, 'musurface': MuSurfaceFilter, @@ -658,7 +712,9 @@ _FILTER_TYPE_MAP = { 'sphericalharmonics': SphericalHarmonicsFilter, 'spatiallegendre': SpatialLegendreFilter, 'surface': SurfaceFilter, + 'time': TimeFilter, 'universe': UniverseFilter, + 'weight': WeightFilter, 'zernike': ZernikeFilter, 'zernikeradial': ZernikeRadialFilter } diff --git a/openmc/lib/nuclide.py b/openmc/lib/nuclide.py index 8078882cf..ef1287cf3 100644 --- a/openmc/lib/nuclide.py +++ b/openmc/lib/nuclide.py @@ -40,8 +40,14 @@ def load_nuclide(name): name : str Name of the nuclide, e.g. 'U235' + Returns + ------- + Nuclide + The class:`Nuclide` that was just loaded. + """ _dll.openmc_load_nuclide(name.encode(), None, 0) + return nuclides[name] class Nuclide(_FortranObject): diff --git a/openmc/lib/plot.py b/openmc/lib/plot.py index d98636676..68f61821c 100644 --- a/openmc/lib/plot.py +++ b/openmc/lib/plot.py @@ -52,7 +52,7 @@ class _PlotBase(Structure): C-Type Attributes ----------------- - origin : openmc.lib.plot._Position + origin_ : openmc.lib.plot._Position A position defining the origin of the plot. width_ : openmc.lib.plot._Position The width of the plot along the x, y, and z axes, respectively @@ -60,6 +60,8 @@ class _PlotBase(Structure): The axes basis of the plot view. pixels_ : c_size_t[3] The resolution of the plot in the horizontal and vertical dimensions + color_overlaps_ : c_bool + Whether to assign unique IDs (-3) to overlapping regions. level_ : c_int The universe level for the plot view @@ -90,6 +92,7 @@ class _PlotBase(Structure): def __init__(self): self.level_ = -1 + self.basis_ = 1 self.color_overlaps_ = False @property @@ -186,14 +189,6 @@ class _PlotBase(Structure): def color_overlaps(self, color_overlaps): self.color_overlaps_ = color_overlaps - @property - def color_overlaps(self): - return self.color_overlaps_ - - @color_overlaps.setter - def color_overlaps(self, val): - self.color_overlaps_ = val - def __repr__(self): out_str = ["-----", "Plot:", diff --git a/openmc/lib/tally.py b/openmc/lib/tally.py index d0b34aedc..c17b16597 100644 --- a/openmc/lib/tally.py +++ b/openmc/lib/tally.py @@ -104,7 +104,9 @@ _SCORES = { -5: 'absorption', -6: 'fission', -7: 'nu-fission', -8: 'kappa-fission', -9: 'current', -10: 'events', -11: 'delayed-nu-fission', -12: 'prompt-nu-fission', -13: 'inverse-velocity', -14: 'fission-q-prompt', - -15: 'fission-q-recoverable', -16: 'decay-rate', -17: 'pulse-height' + -15: 'fission-q-recoverable', -16: 'decay-rate', -17: 'pulse-height', + -18: 'ifp-time-numerator', -19: 'ifp-beta-numerator', + -20: 'ifp-denominator', } _ESTIMATORS = { 0: 'analog', 1: 'tracklength', 2: 'collision' diff --git a/openmc/material.py b/openmc/material.py index f40ac805f..735a05743 100644 --- a/openmc/material.py +++ b/openmc/material.py @@ -6,6 +6,8 @@ from numbers import Real from pathlib import Path import re import sys +import tempfile +from typing import Sequence, Dict import warnings import lxml.etree as ET @@ -15,9 +17,10 @@ import h5py import openmc import openmc.data import openmc.checkvalue as cv -from ._xml import clean_indentation, reorder_attributes +from ._xml import clean_indentation, get_elem_list, get_text from .mixin import IDManagerMixin from .utility_funcs import input_path +from . import waste from openmc.checkvalue import PathLike from openmc.stats import Univariate, Discrete, Mixture from openmc.data.data import _get_element_symbol @@ -30,6 +33,7 @@ DENSITY_UNITS = ('g/cm3', 'g/cc', 'kg/m3', 'atom/b-cm', 'atom/cm3', 'sum', # Smallest normalized floating point number _SMALLEST_NORMAL = sys.float_info.min +_BECQUEREL_PER_CURIE = 3.7e10 NuclideTuple = namedtuple('NuclideTuple', ['name', 'percent', 'percent_type']) @@ -56,6 +60,26 @@ class Material(IDManagerMixin): temperature : float, optional Temperature of the material in Kelvin. If not specified, the material inherits the default temperature applied to the model. + density : float, optional + Density of the material (units defined separately) + density_units : str + Units used for `density`. Can be one of 'g/cm3', 'g/cc', 'kg/m3', + 'atom/b-cm', 'atom/cm3', 'sum', or 'macro'. The 'macro' unit only + applies in the case of a multi-group calculation. Defaults to 'sum'. + depletable : bool, optional + Indicate whether the material is depletable. Defaults to False. + volume : float, optional + Volume of the material in cm^3. This can either be set manually or + calculated in a stochastic volume calculation and added via the + :meth:`Material.add_volume_information` method. + components : dict of str to float or dict + Dictionary mapping element or nuclide names to their atom or weight + percent. To specify enrichment of an element, the entry of + ``components`` for that element must instead be a dictionary containing + the keyword arguments as well as a value for ``'percent'`` + percent_type : {'ao', 'wo'} + Whether the values in `components` should be interpreted as atom percent + ('ao') or weight percent ('wo'). Attributes ---------- @@ -107,17 +131,28 @@ class Material(IDManagerMixin): next_id = 1 used_ids = set() - def __init__(self, material_id=None, name='', temperature=None): + def __init__( + self, + material_id: int | None = None, + name: str = "", + temperature: float | None = None, + density: float | None = None, + density_units: str = "sum", + depletable: bool | None = False, + volume: float | None = None, + components: dict | None = None, + percent_type: str = "ao", + ): # Initialize class attributes self.id = material_id self.name = name self.temperature = temperature self._density = None - self._density_units = 'sum' - self._depletable = False + self._density_units = density_units + self._depletable = depletable self._paths = None self._num_instances = None - self._volume = None + self._volume = volume self._atoms = {} self._isotropic = [] self._ncrystal_cfg = None @@ -132,6 +167,15 @@ class Material(IDManagerMixin): # If specified, a list of table names self._sab = [] + # Set density if provided + if density is not None: + self.set_density(density_units, density) + + # Add components if provided + if components is not None: + self.add_components(components, percent_type=percent_type) + + def __repr__(self) -> str: string = 'Material\n' string += '{: <16}=\t{}\n'.format('\tID', self._id) @@ -286,11 +330,13 @@ class Material(IDManagerMixin): return self.get_decay_photon_energy(0.0) def get_decay_photon_energy( - self, - clip_tolerance: float = 1e-6, - units: str = 'Bq', - volume: float | None = None - ) -> Univariate | None: + self, + clip_tolerance: float = 1e-6, + units: str = 'Bq', + volume: float | None = None, + exclude_nuclides: list[str] | None = None, + include_nuclides: list[str] | None = None + ) -> Univariate | None: r"""Return energy distribution of decay photons from unstable nuclides. .. versionadded:: 0.14.0 @@ -298,22 +344,31 @@ class Material(IDManagerMixin): Parameters ---------- clip_tolerance : float - Maximum fraction of :math:`\sum_i x_i p_i` for discrete - distributions that will be discarded. + Maximum fraction of :math:`\sum_i x_i p_i` for discrete distributions + that will be discarded. units : {'Bq', 'Bq/g', 'Bq/kg', 'Bq/cm3'} Specifies the units on the integral of the distribution. volume : float, optional Volume of the material. If not passed, defaults to using the :attr:`Material.volume` attribute. + exclude_nuclides : list of str, optional + Nuclides to exclude from the photon source calculation. + include_nuclides : list of str, optional + Nuclides to include in the photon source calculation. If specified, + only these nuclides are used. Returns ------- Univariate or None - Decay photon energy distribution. The integral of this distribution - is the total intensity of the photon source in the requested units. + Decay photon energy distribution. The integral of this distribution is + the total intensity of the photon source in the requested units. """ cv.check_value('units', units, {'Bq', 'Bq/g', 'Bq/kg', 'Bq/cm3'}) + + if exclude_nuclides is not None and include_nuclides is not None: + raise ValueError("Cannot specify both exclude_nuclides and include_nuclides") + if units == 'Bq': multiplier = volume if volume is not None else self.volume if multiplier is None: @@ -328,6 +383,11 @@ class Material(IDManagerMixin): dists = [] probs = [] for nuc, atoms_per_bcm in self.get_nuclide_atom_densities().items(): + if exclude_nuclides is not None and nuc in exclude_nuclides: + continue + if include_nuclides is not None and nuc not in include_nuclides: + continue + source_per_atom = openmc.data.decay_photon_energy(nuc) if source_per_atom is not None and atoms_per_bcm > 0.0: dists.append(source_per_atom) @@ -1058,7 +1118,6 @@ class Material(IDManagerMixin): nuc_densities.append(nuc.percent) nuc_density_types.append(nuc.percent_type) - nucs = np.array(nucs) nuc_densities = np.array(nuc_densities) nuc_density_types = np.array(nuc_density_types) @@ -1137,17 +1196,16 @@ class Material(IDManagerMixin): def get_activity(self, units: str = 'Bq/cm3', by_nuclide: bool = False, volume: float | None = None) -> dict[str, float] | float: - """Returns the activity of the material or for each nuclide in the - material in units of [Bq], [Bq/g], [Bq/kg] or [Bq/cm3]. + """Returns the activity of the material or of each nuclide within. .. versionadded:: 0.13.1 Parameters ---------- - units : {'Bq', 'Bq/g', 'Bq/kg', 'Bq/cm3'} + units : {'Bq', 'Bq/g', 'Bq/kg', 'Bq/cm3', 'Ci', 'Ci/m3'} Specifies the type of activity to return, options include total - activity [Bq], specific [Bq/g, Bq/kg] or volumetric activity - [Bq/cm3]. Default is volumetric activity [Bq/cm3]. + activity [Bq,Ci], specific [Bq/g, Bq/kg] or volumetric activity + [Bq/cm3,Ci/m3]. Default is volumetric activity [Bq/cm3]. by_nuclide : bool Specifies if the activity should be returned for the material as a whole or per nuclide. Default is False. @@ -1165,17 +1223,24 @@ class Material(IDManagerMixin): of the material is returned as a float. """ - cv.check_value('units', units, {'Bq', 'Bq/g', 'Bq/kg', 'Bq/cm3'}) + cv.check_value('units', units, {'Bq', 'Bq/g', 'Bq/kg', 'Bq/cm3', 'Ci', 'Ci/m3'}) cv.check_type('by_nuclide', by_nuclide, bool) + if volume is None: + volume = self.volume + if units == 'Bq': - multiplier = volume if volume is not None else self.volume + multiplier = volume elif units == 'Bq/cm3': multiplier = 1 elif units == 'Bq/g': multiplier = 1.0 / self.get_mass_density() elif units == 'Bq/kg': multiplier = 1000.0 / self.get_mass_density() + elif units == 'Ci': + multiplier = volume / _BECQUEREL_PER_CURIE + elif units == 'Ci/m3': + multiplier = 1e6 / _BECQUEREL_PER_CURIE activity = {} for nuclide, atoms_per_bcm in self.get_nuclide_atom_densities().items(): @@ -1316,6 +1381,91 @@ class Material(IDManagerMixin): raise ValueError("Volume must be set in order to determine mass.") return volume*self.get_mass_density(nuclide) + def waste_classification(self, metal: bool = False) -> str: + """Classify the material for near-surface waste disposal. + + This method determines a waste classification for the material based on + the NRC regulations (10 CFR 61.55). Note that the NRC regulations do not + consider many long-lived radionuclides relevant to fusion systems; for + fusion applications, it is recommended to calculate a waste disposal + rating based on limits by Fetter et al. using the + :meth:`~openmc.Material.waste_disposal_rating` method. + + Parameters + ---------- + metal : bool, optional + Whether or not the material is in metal form. + + Returns + ------- + str + The waste disposal classification, which can be "Class A", "Class + B", "Class C", or "GTCC" (greater than class C). + + """ + return waste._waste_classification(self, metal=metal) + + def waste_disposal_rating( + self, + limits: str | dict[str, float] = 'Fetter', + metal: bool = False, + by_nuclide: bool = False, + ) -> float | dict[str, float]: + """Return the waste disposal rating for the material. + + This method returns a waste disposal rating for the material based on a + set of specific activity limits. The waste disposal rating is a single + number that represents the sum of the ratios of the specific activity + for each radionuclide in the material against a nuclide-specific limit. + A value less than 1.0 indicates that the material "meets" the limits + whereas a value greater than 1.0 exceeds the limits. + + Note that the limits for NRC do not consider many long-lived + radionuclides relevant to fusion systems. A paper by `Fetter et al. + `_ applies the NRC + methodology to calculate specific activity limits for an expanded set of + radionuclides. + + Parameters + ---------- + limits : str or dict, optional + The name of a predefined set of specific activity limits or a + dictionary that contains specific activity limits for radionuclides, + where keys are nuclide names and values are activities in units of + [Ci/m3]. The predefined options are: + + - 'Fetter': Uses limits from Fetter et al. (1990) + - 'NRC_long': Uses the 10 CFR 61.55 limits for long-lived + radionuclides + - 'NRC_short_A': Uses the 10 CFR 61.55 class A limits for + short-lived radionuclides + - 'NRC_short_B': Uses the 10 CFR 61.55 class B limits for + short-lived radionuclides + - 'NRC_short_C': Uses the 10 CFR 61.55 class C limits for + short-lived radionuclides + metal : bool, optional + Whether or not the material is in metal form (only applicable for + NRC based limits) + by_nuclide : bool, optional + Whether to return the waste disposal rating for each nuclide in the + material. If True, a dictionary is returned where the keys are the + nuclide names and the values are the waste disposal ratings for each + nuclide. If False, a single float value is returned that represents + the overall waste disposal rating for the material. + + Returns + ------- + float or dict + The waste disposal rating for the material or its constituent + nuclides. + + See also + -------- + Material.waste_classification() + + """ + return waste._waste_disposal_rating(self, limits, metal, by_nuclide) + def clone(self, memo: dict | None = None) -> Material: """Create a copy of this material with a new unique ID. @@ -1578,53 +1728,149 @@ class Material(IDManagerMixin): Material generated from XML element """ - mat_id = int(elem.get('id')) + mat_id = int(get_text(elem, 'id')) + # Add NCrystal material from cfg string - if "cfg" in elem.attrib: - cfg = elem.get("cfg") + cfg = get_text(elem, "cfg") + if cfg is not None: return Material.from_ncrystal(cfg, material_id=mat_id) mat = cls(mat_id) - mat.name = elem.get('name') + mat.name = get_text(elem, 'name') - if "temperature" in elem.attrib: - mat.temperature = float(elem.get("temperature")) + temperature = get_text(elem, "temperature") + if temperature is not None: + mat.temperature = float(temperature) - if 'volume' in elem.attrib: - mat.volume = float(elem.get('volume')) + volume = get_text(elem, "volume") + if volume is not None: + mat.volume = float(volume) # Get each nuclide for nuclide in elem.findall('nuclide'): - name = nuclide.attrib['name'] + name = get_text(nuclide, "name") if 'ao' in nuclide.attrib: mat.add_nuclide(name, float(nuclide.attrib['ao'])) elif 'wo' in nuclide.attrib: mat.add_nuclide(name, float(nuclide.attrib['wo']), 'wo') # Get depletable attribute - mat.depletable = elem.get('depletable') in ('true', '1') + depletable = get_text(elem, "depletable") + mat.depletable = depletable in ('true', '1') # Get each S(a,b) table for sab in elem.findall('sab'): - fraction = float(sab.get('fraction', 1.0)) - mat.add_s_alpha_beta(sab.get('name'), fraction) + fraction = float(get_text(sab, "fraction", 1.0)) + name = get_text(sab, "name") + mat.add_s_alpha_beta(name, fraction) # Get total material density density = elem.find('density') - units = density.get('units') + units = get_text(density, "units") if units == 'sum': mat.set_density(units) else: - value = float(density.get('value')) + value = float(get_text(density, 'value')) mat.set_density(units, value) # Check for isotropic scattering nuclides - isotropic = elem.find('isotropic') + isotropic = get_elem_list(elem, "isotropic", str) if isotropic is not None: - mat.isotropic = isotropic.text.split() + mat.isotropic = isotropic return mat + def deplete( + self, + multigroup_flux: Sequence[float], + energy_group_structure: Sequence[float] | str, + timesteps: Sequence[float] | Sequence[tuple[float, str]], + source_rates: float | Sequence[float], + timestep_units: str = 's', + chain_file: cv.PathLike | "openmc.deplete.Chain" | None = None, + reactions: Sequence[str] | None = None, + ) -> list[openmc.Material]: + """Depletes that material, evolving the nuclide densities + + .. versionadded:: 0.15.3 + + Parameters + ---------- + multigroup_flux: Sequence[float] + Energy-dependent multigroup flux values, where each sublist corresponds + to a specific material. Will be normalized so that it sums to 1. + energy_group_structure : Sequence[float] | str + Energy group boundaries in [eV] or the name of the group structure. + timesteps : iterable of float or iterable of tuple + Array of timesteps. Note that values are not cumulative. The units are + specified by the `timestep_units` argument when `timesteps` is an + iterable of float. Alternatively, units can be specified for each step + by passing an iterable of (value, unit) tuples. + source_rates : float or iterable of float, optional + Source rate in [neutron/sec] or neutron flux in [neutron/s-cm^2] for + each interval in :attr:`timesteps` + timestep_units : {'s', 'min', 'h', 'd', 'a', 'MWd/kg'} + Units for values specified in the `timesteps` argument. 's' means + seconds, 'min' means minutes, 'h' means hours, 'a' means Julian years + and 'MWd/kg' indicates that the values are given in burnup (MW-d of + energy deposited per kilogram of initial heavy metal). + chain_file : PathLike or Chain + Path to the depletion chain XML file or instance of openmc.deplete.Chain. + Defaults to ``openmc.config['chain_file']``. + reactions : list of str, optional + Reactions to get cross sections for. If not specified, all neutron + reactions listed in the depletion chain file are used. + + Returns + ------- + list of openmc.Material, one for each timestep + + """ + + materials = openmc.Materials([self]) + + depleted_materials_dict = materials.deplete( + multigroup_fluxes=[multigroup_flux], + energy_group_structures=[energy_group_structure], + timesteps=timesteps, + source_rates=source_rates, + timestep_units=timestep_units, + chain_file=chain_file, + reactions=reactions, + ) + + return depleted_materials_dict[self.id] + + + def mean_free_path(self, energy: float) -> float: + """Calculate the mean free path of neutrons in the material at a given + energy. + + .. versionadded:: 0.15.3 + + Parameters + ---------- + energy : float + Neutron energy in eV + + Returns + ------- + float + Mean free path in cm + + """ + from openmc.plotter import _calculate_cexs_elem_mat + + energy_grid, cexs = _calculate_cexs_elem_mat( + this=self, + types=["total"], + ) + total_cexs = cexs[0] + + interpolated_cexs = float(np.interp(energy, energy_grid, total_cexs)) + + return 1.0 / interpolated_cexs + class Materials(cv.CheckedList): """Collection of Materials used for an OpenMC simulation. @@ -1734,16 +1980,14 @@ class Materials(cv.CheckedList): clean_indentation(element, level=level+1) element.tail = element.tail.strip(' ') file.write((level+1)*spaces_per_level*' ') - reorder_attributes(element) # TODO: Remove when support is Python 3.8+ file.write(ET.tostring(element, encoding="unicode")) # Write the elements. - for material in sorted(self, key=lambda x: x.id): + for material in sorted(set(self), key=lambda x: x.id): element = material.to_xml_element(nuclides_to_ignore=nuclides_to_ignore) clean_indentation(element, level=level+1) element.tail = element.tail.strip(' ') file.write((level+1)*spaces_per_level*' ') - reorder_attributes(element) # TODO: Remove when support is Python 3.8+ file.write(ET.tostring(element, encoding="unicode")) # Write the closing tag for the root element. @@ -1799,9 +2043,9 @@ class Materials(cv.CheckedList): materials.append(Material.from_xml_element(material)) # Check for cross sections settings - xs = elem.find('cross_sections') + xs = get_text(elem, "cross_sections") if xs is not None: - materials.cross_sections = xs.text + materials.cross_sections = xs return materials @@ -1825,3 +2069,114 @@ class Materials(cv.CheckedList): root = tree.getroot() return cls.from_xml_element(root) + + + def deplete( + self, + multigroup_fluxes: Sequence[Sequence[float]], + energy_group_structures: Sequence[Sequence[float] | str], + timesteps: Sequence[float] | Sequence[tuple[float, str]], + source_rates: float | Sequence[float], + timestep_units: str = 's', + chain_file: cv.PathLike | "openmc.deplete.Chain" | None = None, + reactions: Sequence[str] | None = None, + ) -> Dict[int, list[openmc.Material]]: + """Depletes that material, evolving the nuclide densities + + .. versionadded:: 0.15.3 + + Parameters + ---------- + multigroup_fluxes: Sequence[Sequence[float]] + Energy-dependent multigroup flux values, where each sublist corresponds + to a specific material. Will be normalized so that it sums to 1. + energy_group_structures': Sequence[Sequence[float] | str] + Energy group boundaries in [eV] or the name of the group structure. + timesteps : iterable of float or iterable of tuple + Array of timesteps. Note that values are not cumulative. The units are + specified by the `timestep_units` argument when `timesteps` is an + iterable of float. Alternatively, units can be specified for each step + by passing an iterable of (value, unit) tuples. + source_rates : float or iterable of float, optional + Source rate in [neutron/sec] or neutron flux in [neutron/s-cm^2] for + each interval in :attr:`timesteps` + timestep_units : {'s', 'min', 'h', 'd', 'a', 'MWd/kg'} + Units for values specified in the `timesteps` argument. 's' means + seconds, 'min' means minutes, 'h' means hours, 'a' means Julian years + and 'MWd/kg' indicates that the values are given in burnup (MW-d of + energy deposited per kilogram of initial heavy metal). + chain_file : PathLike or Chain + Path to the depletion chain XML file or instance of openmc.deplete.Chain. + Defaults to ``openmc.config['chain_file']``. + reactions : list of str, optional + Reactions to get cross sections for. If not specified, all neutron + reactions listed in the depletion chain file are used. + + Returns + ------- + list of openmc.Material, one for each timestep + + """ + + import openmc.deplete + from .deplete.chain import _get_chain + + # setting all materials to be depletable + for mat in self: + mat.depletable = True + + chain = _get_chain(chain_file) + + # Create MicroXS objects for all materials + micros = [] + fluxes = [] + + with openmc.lib.TemporarySession(): + for material, flux, energy in zip( + self, multigroup_fluxes, energy_group_structures + ): + temperature = material.temperature or 293.6 + micro_xs = openmc.deplete.MicroXS.from_multigroup_flux( + energies=energy, + multigroup_flux=flux, + chain_file=chain, + temperature=temperature, + reactions=reactions, + ) + micros.append(micro_xs) + fluxes.append(material.volume) + + # Create a single operator for all materials + operator = openmc.deplete.IndependentOperator( + materials=self, + fluxes=fluxes, + micros=micros, + normalization_mode="source-rate", + chain_file=chain, + ) + + integrator = openmc.deplete.PredictorIntegrator( + operator=operator, + timesteps=timesteps, + source_rates=source_rates, + timestep_units=timestep_units, + ) + + with tempfile.TemporaryDirectory() as tmpdir: + # Run integrator + results_path = Path(tmpdir) / "depletion_results.h5" + integrator.integrate(path=results_path) + + # Load depletion results + results = openmc.deplete.Results(results_path) + + # For each material, get activated composition at each timestep + all_depleted_materials = { + material.id: [ + result.get_material(str(material.id)) + for result in results + ] + for material in self + } + + return all_depleted_materials diff --git a/openmc/mesh.py b/openmc/mesh.py index 08025f374..ce5218b5e 100644 --- a/openmc/mesh.py +++ b/openmc/mesh.py @@ -5,6 +5,8 @@ from collections.abc import Iterable, Sequence, Mapping from functools import wraps from math import pi, sqrt, atan2 from numbers import Integral, Real +from pathlib import Path +from typing import Protocol import h5py import lxml.etree as ET @@ -15,7 +17,7 @@ import openmc import openmc.checkvalue as cv from openmc.checkvalue import PathLike from openmc.utility_funcs import change_directory -from ._xml import get_text +from ._xml import get_elem_list, get_text from .mixin import IDManagerMixin from .surface import _BOUNDARY_TYPES from .utility_funcs import input_path @@ -286,6 +288,7 @@ class MeshBase(IDManagerMixin, ABC): model: openmc.Model, n_samples: int | tuple[int, int, int] = 10_000, include_void: bool = True, + material_volumes: MeshMaterialVolumes | None = None, **kwargs ) -> list[openmc.Material]: """Generate homogenized materials over each element in a mesh. @@ -304,8 +307,12 @@ class MeshBase(IDManagerMixin, ABC): the x, y, and z dimensions. include_void : bool, optional Whether homogenization should include voids. + material_volumes : MeshMaterialVolumes, optional + Previously computed mesh material volumes to use for homogenization. + If not provided, they will be computed by calling + :meth:`material_volumes`. **kwargs - Keyword-arguments passed to :meth:`MeshBase.material_volumes`. + Keyword-arguments passed to :meth:`material_volumes`. Returns ------- @@ -313,23 +320,16 @@ class MeshBase(IDManagerMixin, ABC): Homogenized material in each mesh element """ - vols = self.material_volumes(model, n_samples, **kwargs) + if material_volumes is None: + vols = self.material_volumes(model, n_samples, **kwargs) + else: + vols = material_volumes mat_volume_by_element = [vols.by_element(i) for i in range(vols.num_elements)] + # Get dictionary of all materials + materials = model._get_all_materials() + # Create homogenized material for each element - materials = model.geometry.get_all_materials() - - # Account for materials in DAGMC universes - # TODO: This should really get incorporated in lower-level calls to - # get_all_materials, but right now it requires information from the - # Model object - for cell in model.geometry.get_all_cells().values(): - if isinstance(cell.fill, openmc.DAGMCUniverse): - names = cell.fill.material_names - materials.update({ - mat.id: mat for mat in model.materials if mat.name in names - }) - homogenized_materials = [] for mat_volume_list in mat_volume_by_element: material_ids, volumes = [list(x) for x in zip(*mat_volume_list)] @@ -399,32 +399,30 @@ class MeshBase(IDManagerMixin, ABC): """ import openmc.lib - with change_directory(tmpdir=True): - # In order to get mesh into model, we temporarily replace the - # tallies with a single mesh tally using the current mesh - original_tallies = model.tallies - new_tally = openmc.Tally() - new_tally.filters = [openmc.MeshFilter(self)] - new_tally.scores = ['flux'] - model.tallies = [new_tally] + # In order to get mesh into model, we temporarily replace the + # tallies with a single mesh tally using the current mesh + original_tallies = list(model.tallies) + new_tally = openmc.Tally() + new_tally.filters = [openmc.MeshFilter(self)] + new_tally.scores = ['flux'] + model.tallies = [new_tally] - # Export model to XML - model.export_to_model_xml() + # Set default arguments + kwargs.setdefault('output', True) + if 'args' in kwargs: + kwargs['args'] = ['-c'] + kwargs['args'] + kwargs.setdefault('args', ['-c']) - # Get material volume fractions - kwargs.setdefault('output', True) - if 'args' in kwargs: - kwargs['args'] = ['-c'] + kwargs['args'] - kwargs.setdefault('args', ['-c']) - openmc.lib.init(**kwargs) + with openmc.lib.TemporarySession(model, **kwargs): + # Get mesh from single tally mesh = openmc.lib.tallies[new_tally.id].filters[0].mesh + + # Compute material volumes volumes = mesh.material_volumes( n_samples, max_materials, output=kwargs['output']) - openmc.lib.finalize() - - # Restore original tallies - model.tallies = original_tallies + # Restore original tallies + model.tallies = original_tallies return volumes @@ -576,11 +574,16 @@ class StructuredMesh(MeshBase): filename : str Name of the VTK file to write. datasets : dict - Dictionary whose keys are the data labels - and values are the data sets. + Dictionary whose keys are the data labels and values are the data + sets. 1D datasets are expected to be extracted directly from + statepoint data without reordering/reshaping. Multidimensional + datasets are expected to have the same dimensions as the mesh itself + with structured indexing in "C" ordering. See the "expand_dims" flag + of :meth:`~openmc.Tally.get_reshaped_data` on reshaping tally data when using + :class:`~openmc.MeshFilter`'s. volume_normalization : bool, optional - Whether or not to normalize the data by - the volume of the mesh elements. + Whether or not to normalize the data by the volume of the mesh + elements. curvilinear : bool Whether or not to write curvilinear elements. Only applies to ``SphericalMesh`` and ``CylindricalMesh``. @@ -594,14 +597,27 @@ class StructuredMesh(MeshBase): ------- vtk.StructuredGrid or vtk.UnstructuredGrid a VTK grid object representing the mesh + + Examples + -------- + 1D data from a tally with only a mesh filter and heating score: + + # pass the tally mean property of shape (N, 1, 1) directly to this + # method; dimensions of size 1 will automatically removed + >>> heating = tally.mean + >>> mesh.write_data_to_vtk({'heating': heating}) + + Multidimensional data from a tally with only a mesh + + # retrieve a data array with the mesh filter expanded into three + # dimensions, ijk; additional dimensions of size one will + # automatically be removed + >>> heating = tally.get_reshaped_data(expand_dims=True) + >>> mesh.write_data_to_vtk({'heating': heating}) """ import vtk from vtk.util import numpy_support as nps - # check that the data sets are appropriately sized - if datasets is not None: - self._check_vtk_datasets(datasets) - # write linear elements using a structured grid if not curvilinear or isinstance(self, (RegularMesh, RectilinearMesh)): vtk_grid = self._create_vtk_structured_grid() @@ -612,22 +628,27 @@ class StructuredMesh(MeshBase): writer = vtk.vtkUnstructuredGridWriter() if datasets is not None: - # maintain a list of the datasets as added - # to the VTK arrays to ensure they persist - # in memory until the file is written + # maintain a list of the datasets as added to the VTK arrays to + # ensure they persist in memory until the file is written datasets_out = [] for label, dataset in datasets.items(): - dataset = np.asarray(dataset).flatten() + dataset = self._reshape_vtk_dataset(dataset) + self._check_vtk_dataset(label, dataset) + # If the array data is 3D, assume is in C ordering and transpose + # before flattening to match the ordering expected by the VTK + # array based on the way mesh indices are ordered in the Python + # API + # TODO: update to "C" ordering throughout + if dataset.ndim == 3: + dataset = dataset.T.ravel() datasets_out.append(dataset) if volume_normalization: - dataset /= self.volumes.T.flatten() + dataset /= self.volumes.T.ravel() dataset_array = vtk.vtkDoubleArray() dataset_array.SetName(label) - dataset_array.SetArray(nps.numpy_to_vtk(dataset), - dataset.size, - True) + dataset_array.SetArray(nps.numpy_to_vtk(dataset), dataset.size, True) vtk_grid.GetCellData().AddArray(dataset_array) writer.SetFileName(str(filename)) @@ -754,28 +775,74 @@ class StructuredMesh(MeshBase): return vtk_grid - def _check_vtk_datasets(self, datasets: dict): - """Perform some basic checks that the datasets are valid for this mesh + @staticmethod + def _reshape_vtk_dataset(dataset): + """Reshape a dataset to be compatible with VTK output + + This method performs the following operations on a dataset: + 1. Convert to numpy array if not already + 2. Remove any trailing dimensions of size 1 + 3. Squeeze out any extra dimensions of size 1 beyond the first 3 Parameters ---------- - datasets : dict - Dictionary whose keys are the data labels - and values are the data sets. + dataset : array-like + The dataset to reshape + + Returns + ------- + numpy.ndarray + The reshaped dataset + """ + reshaped_data = np.asarray(dataset) + + # detect flat array with extra dims + if all(d == 1 for d in reshaped_data.shape[1:]): + reshaped_data = reshaped_data.squeeze() + + # remove any higher dimensions with size 1 + if reshaped_data.ndim > 3 and all(d == 1 for d in reshaped_data.shape[3:]): + reshaped_data = reshaped_data.reshape(reshaped_data.shape[:3]) + + if np.shares_memory(reshaped_data, dataset): + return np.copy(reshaped_data) + else: + return reshaped_data + + def _check_vtk_dataset(self, label: str, dataset: np.ndarray): + """Perform some basic checks that a dataset is valid for this Mesh + + Parameters + ---------- + label : str + The label for the dataset being checked + dataset : numpy.ndarray + The dataset array to check against this mesh's dimensions """ - for label, dataset in datasets.items(): - errmsg = ( + cv.check_type('data label', label, str) + + if dataset.size != self.num_mesh_cells: + raise ValueError( f"The size of the dataset '{label}' ({dataset.size}) should be" f" equal to the number of mesh cells ({self.num_mesh_cells})" ) - if isinstance(dataset, np.ndarray): - if not dataset.size == self.num_mesh_cells: - raise ValueError(errmsg) - else: - if len(dataset) == self.num_mesh_cells: - raise ValueError(errmsg) - cv.check_type('data label', label, str) + + # accept a flat array as-is, assuming it is in the correct order + if dataset.ndim == 1: + return + + if dataset.shape != self.dimension: + raise ValueError( + f'Cannot apply multidimensional dataset "{label}" with ' + f"shape {dataset.shape} to mesh {self.id} " + f"with dimensions {self.dimension}" + ) + + +class HasBoundingBox(Protocol): + """Object that has a ``bounding_box`` attribute.""" + bounding_box: openmc.BoundingBox class RegularMesh(StructuredMesh): @@ -1024,22 +1091,24 @@ class RegularMesh(StructuredMesh): @classmethod def from_domain( cls, - domain: 'openmc.Cell' | 'openmc.Region' | 'openmc.Universe' | 'openmc.Geometry', - dimension: Sequence[int] = (10, 10, 10), + domain: HasBoundingBox, + dimension: Sequence[int] | int = 1000, mesh_id: int | None = None, name: str = '' ): - """Create mesh from an existing openmc cell, region, universe or - geometry by making use of the objects bounding box property. + """Create RegularMesh from a domain using its bounding box. Parameters ---------- - domain : {openmc.Cell, openmc.Region, openmc.Universe, openmc.Geometry} + domain : HasBoundingBox The object passed in will be used as a template for this mesh. The bounding box of the property of the object passed will be used to set the lower_left and upper_right and of the mesh instance - dimension : Iterable of int - The number of mesh cells in each direction (x, y, z). + dimension : Iterable of int | int + The number of mesh cells in total or number of mesh cells in each + direction (x, y, z). If a single integer is provided, the domain + will will be divided into that many mesh cells with roughly equal + lengths in each direction (cubes). mesh_id : int Unique identifier for the mesh name : str @@ -1051,15 +1120,22 @@ class RegularMesh(StructuredMesh): RegularMesh instance """ - cv.check_type( - "domain", - domain, - (openmc.Cell, openmc.Region, openmc.Universe, openmc.Geometry), - ) + if not hasattr(domain, 'bounding_box'): + raise TypeError("Domain must have a bounding_box property") mesh = cls(mesh_id=mesh_id, name=name) mesh.lower_left = domain.bounding_box[0] mesh.upper_right = domain.bounding_box[1] + if isinstance(dimension, int): + cv.check_greater_than("dimension", dimension, 1, equality=True) + # If a single integer is provided, divide the domain into that many + # mesh cells with roughly equal lengths in each direction + ideal_cube_volume = domain.bounding_box.volume / dimension + ideal_cube_size = ideal_cube_volume ** (1 / 3) + dimension = [ + max(1, int(round(side / ideal_cube_size))) + for side in domain.bounding_box.width + ] mesh.dimension = dimension return mesh @@ -1109,21 +1185,21 @@ class RegularMesh(StructuredMesh): mesh_id = int(get_text(elem, 'id')) mesh = cls(mesh_id=mesh_id) - dimension = get_text(elem, 'dimension') + dimension = get_elem_list(elem, "dimension", int) if dimension is not None: - mesh.dimension = [int(x) for x in dimension.split()] + mesh.dimension = dimension - lower_left = get_text(elem, 'lower_left') + lower_left = get_elem_list(elem, "lower_left", float) if lower_left is not None: - mesh.lower_left = [float(x) for x in lower_left.split()] + mesh.lower_left = lower_left - upper_right = get_text(elem, 'upper_right') + upper_right = get_elem_list(elem, "upper_right", float) if upper_right is not None: - mesh.upper_right = [float(x) for x in upper_right.split()] + mesh.upper_right = upper_right - width = get_text(elem, 'width') + width = get_elem_list(elem, "width", float) if width is not None: - mesh.width = [float(x) for x in width.split()] + mesh.width = width return mesh @@ -1429,9 +1505,9 @@ class RectilinearMesh(StructuredMesh): """ mesh_id = int(get_text(elem, 'id')) mesh = cls(mesh_id=mesh_id) - mesh.x_grid = [float(x) for x in get_text(elem, 'x_grid').split()] - mesh.y_grid = [float(y) for y in get_text(elem, 'y_grid').split()] - mesh.z_grid = [float(z) for z in get_text(elem, 'z_grid').split()] + mesh.x_grid = get_elem_list(elem, "x_grid", float) + mesh.y_grid = get_elem_list(elem, "y_grid", float) + mesh.z_grid = get_elem_list(elem, "z_grid", float) return mesh @@ -1723,17 +1799,18 @@ class CylindricalMesh(StructuredMesh): @classmethod def from_domain( cls, - domain: 'openmc.Cell' | 'openmc.Region' | 'openmc.Universe' | 'openmc.Geometry', + domain: HasBoundingBox, dimension: Sequence[int] = (10, 10, 10), mesh_id: int | None = None, phi_grid_bounds: Sequence[float] = (0.0, 2*pi), - name: str = '' + name: str = '', + enclose_domain: bool = False ): - """Creates a regular CylindricalMesh from an existing openmc domain. + """Create CylindricalMesh from a domain using its bounding box. Parameters ---------- - domain : openmc.Cell or openmc.Region or openmc.Universe or openmc.Geometry + domain : HasBoundingBox The object passed in will be used as a template for this mesh. The bounding box of the property of the object passed will be used to set the r_grid, z_grid ranges. @@ -1747,6 +1824,9 @@ class CylindricalMesh(StructuredMesh): is (0, 2π), i.e., the full phi range. name : str Name of the mesh + enclose_domain : bool + If True, the mesh will encompass the bounding box of the domain. If + False, the mesh will be inscribed within the domain's bounding box. Returns ------- @@ -1754,25 +1834,20 @@ class CylindricalMesh(StructuredMesh): CylindricalMesh instance """ - cv.check_type( - "domain", - domain, - (openmc.Cell, openmc.Region, openmc.Universe, openmc.Geometry), - ) + if not hasattr(domain, 'bounding_box'): + raise TypeError("Domain must have a bounding_box property") # loaded once to avoid recalculating bounding box cached_bb = domain.bounding_box - max_bounding_box_radius = max( - [ - cached_bb[0][0], - cached_bb[0][1], - cached_bb[1][0], - cached_bb[1][1], - ] - ) + + if enclose_domain: + outer_radius = 0.5 * np.linalg.norm(cached_bb.width[:2]) + else: + outer_radius = 0.5 * min(cached_bb.width[:2]) + r_grid = np.linspace( 0, - max_bounding_box_radius, + outer_radius, num=dimension[0]+1 ) phi_grid = np.linspace( @@ -1846,10 +1921,10 @@ class CylindricalMesh(StructuredMesh): mesh_id = int(get_text(elem, 'id')) mesh = cls( - r_grid = [float(x) for x in get_text(elem, "r_grid").split()], - phi_grid = [float(x) for x in get_text(elem, "phi_grid").split()], - z_grid = [float(x) for x in get_text(elem, "z_grid").split()], - origin = [float(x) for x in get_text(elem, "origin", default=[0., 0., 0.]).split()], + r_grid = get_elem_list(elem, "r_grid", float), + phi_grid = get_elem_list(elem, "phi_grid", float), + z_grid = get_elem_list(elem, "z_grid", float), + origin = get_elem_list(elem, "origin", float) or [0., 0., 0.], mesh_id=mesh_id, ) @@ -2103,6 +2178,77 @@ class SphericalMesh(StructuredMesh): return mesh + @classmethod + def from_domain( + cls, + domain: HasBoundingBox, + dimension: Sequence[int] = (10, 10, 10), + mesh_id: int | None = None, + phi_grid_bounds: Sequence[float] = (0.0, 2*pi), + theta_grid_bounds: Sequence[float] = (0.0, pi), + name: str = '', + enclose_domain: bool = False + ): + """Create SphericalMesh from a domain using its bounding box. + + Parameters + ---------- + domain : HasBoundingBox + The object passed in will be used as a template for this mesh. The + bounding box of the property of the object passed will be used to + set the r_grid, phi_grid, and theta_grid ranges. + dimension : Iterable of int + The number of equally spaced mesh cells in each direction (r_grid, + phi_grid, theta_grid). Spacing is in angular space (radians) for + phi and theta, and in absolute space for r. + mesh_id : int + Unique identifier for the mesh + phi_grid_bounds : numpy.ndarray + Mesh bounds points along the phi-axis in radians. The default value + is (0, 2π), i.e., the full phi range. + theta_grid_bounds : numpy.ndarray + Mesh bounds points along the theta-axis in radians. The default value + is (0, π), i.e., the full theta range. + name : str + Name of the mesh + enclose_domain : bool + If True, the mesh will encompass the bounding box of the domain. If + False, the mesh will be inscribed within the domain's bounding box. + + Returns + ------- + openmc.SphericalMesh + SphericalMesh instance + + """ + if not hasattr(domain, 'bounding_box'): + raise TypeError("Domain must have a bounding_box property") + + # loaded once to avoid recalculating bounding box + cached_bb = domain.bounding_box + + if enclose_domain: + outer_radius = 0.5 * np.linalg.norm(cached_bb.width) + else: + outer_radius = 0.5 * min(cached_bb.width) + + r_grid = np.linspace(0, outer_radius, num=dimension[0] + 1) + theta_grid = np.linspace( + theta_grid_bounds[0], + theta_grid_bounds[1], + num=dimension[1]+1 + ) + phi_grid = np.linspace( + phi_grid_bounds[0], + phi_grid_bounds[1], + num=dimension[2]+1 + ) + origin = np.array([ + cached_bb.center[0], cached_bb.center[1], cached_bb.center[2]]) + + return cls(r_grid=r_grid, phi_grid=phi_grid, theta_grid=theta_grid, + origin=origin, mesh_id=mesh_id, name=name) + def to_xml_element(self): """Return XML representation of the mesh @@ -2148,10 +2294,10 @@ class SphericalMesh(StructuredMesh): mesh_id = int(get_text(elem, 'id')) mesh = cls( mesh_id=mesh_id, - r_grid = [float(x) for x in get_text(elem, "r_grid").split()], - theta_grid = [float(x) for x in get_text(elem, "theta_grid").split()], - phi_grid = [float(x) for x in get_text(elem, "phi_grid").split()], - origin = [float(x) for x in get_text(elem, "origin", default=[0., 0., 0.]).split()], + r_grid = get_elem_list(elem, "r_grid", float), + theta_grid = get_elem_list(elem, "theta_grid", float), + phi_grid = get_elem_list(elem, "phi_grid", float), + origin = get_elem_list(elem, "origin", float) or [0., 0., 0.], ) return mesh @@ -2298,6 +2444,7 @@ class UnstructuredMesh(MeshBase): _UNSUPPORTED_ELEM = -1 _LINEAR_TET = 0 _LINEAR_HEX = 1 + _VTK_TETRA = 10 def __init__(self, filename: PathLike, library: str, mesh_id: int | None = None, name: str = '', length_multiplier: float = 1.0, @@ -2507,7 +2654,8 @@ class UnstructuredMesh(MeshBase): warnings.warn( "The 'UnstructuredMesh.write_vtk_mesh' method has been renamed " "to 'write_data_to_vtk' and will be removed in a future version " - " of OpenMC.", FutureWarning + " of OpenMC.", + FutureWarning, ) self.write_data_to_vtk(**kwargs) @@ -2525,9 +2673,10 @@ class UnstructuredMesh(MeshBase): Parameters ---------- filename : str or pathlib.Path - Name of the VTK file to write. If the filename ends in '.vtu' then a - binary VTU format file will be written, if the filename ends in - '.vtk' then a legacy VTK file will be written. + Name of the VTK file to write. If the filename ends in '.vtkhdf' + then a VTKHDF format file will be written. If the filename ends in + '.vtu' then a binary VTU format file will be written. If the + filename ends in '.vtk' then a legacy VTK file will be written. datasets : dict Dictionary whose keys are the data labels and values are numpy appropriately sized arrays of the data @@ -2535,6 +2684,35 @@ class UnstructuredMesh(MeshBase): Whether or not to normalize the data by the volume of the mesh elements """ + + if Path(filename).suffix == ".vtkhdf": + + self._write_data_to_vtk_hdf5_format( + filename=filename, + datasets=datasets, + volume_normalization=volume_normalization, + ) + + elif Path(filename).suffix == ".vtk" or Path(filename).suffix == ".vtu": + + self._write_data_to_vtk_ascii_format( + filename=filename, + datasets=datasets, + volume_normalization=volume_normalization, + ) + + else: + raise ValueError( + "Unsupported file extension, The filename must end with " + "'.vtkhdf', '.vtu' or '.vtk'" + ) + + def _write_data_to_vtk_ascii_format( + self, + filename: PathLike | None = None, + datasets: dict | None = None, + volume_normalization: bool = True, + ): from vtkmodules.util import numpy_support from vtkmodules import vtkCommonCore from vtkmodules import vtkCommonDataModel @@ -2542,9 +2720,7 @@ class UnstructuredMesh(MeshBase): from vtkmodules import vtkIOXML if self.connectivity is None or self.vertices is None: - raise RuntimeError( - "This mesh has not been loaded from a statepoint file." - ) + raise RuntimeError("This mesh has not been loaded from a statepoint file.") if filename is None: filename = f"mesh_{self.id}.vtk" @@ -2626,29 +2802,128 @@ class UnstructuredMesh(MeshBase): writer.Write() + def _write_data_to_vtk_hdf5_format( + self, + filename: PathLike | None = None, + datasets: dict | None = None, + volume_normalization: bool = True, + ): + def append_dataset(dset, array): + """Convenience function to append data to an HDF5 dataset""" + origLen = dset.shape[0] + dset.resize(origLen + array.shape[0], axis=0) + dset[origLen:] = array + + if self.library != "moab": + raise NotImplementedError("VTKHDF output is only supported for MOAB meshes") + + # the self.connectivity contains arrays of length 8 to support hex + # elements as well, in the case of tetrahedra mesh elements, the + # last 4 values are -1 and are removed + trimmed_connectivity = [] + for cell in self.connectivity: + # Find the index of the first -1 value, if any + first_negative_index = np.where(cell == -1)[0] + if first_negative_index.size > 0: + # Slice the array up to the first -1 value + trimmed_connectivity.append(cell[: first_negative_index[0]]) + else: + # No -1 values, append the whole cell + trimmed_connectivity.append(cell) + trimmed_connectivity = np.array(trimmed_connectivity, dtype="int32").flatten() + + # MOAB meshes supports tet elements only so we know it has 4 points per cell + points_per_cell = 4 + + # offsets are the indices of the first point of each cell in the array of points + offsets = np.arange(0, self.n_elements * points_per_cell + 1, points_per_cell) + + for name, data in datasets.items(): + if data.shape != self.dimension: + raise ValueError( + f'Cannot apply dataset "{name}" with ' + f"shape {data.shape} to mesh {self.id} " + f"with dimensions {self.dimension}" + ) + + with h5py.File(filename, "w") as f: + + root = f.create_group("VTKHDF") + vtk_file_format_version = (2, 1) + root.attrs["Version"] = vtk_file_format_version + ascii_type = "UnstructuredGrid".encode("ascii") + root.attrs.create( + "Type", + ascii_type, + dtype=h5py.string_dtype("ascii", len(ascii_type)), + ) + + # create hdf5 file structure + root.create_dataset("NumberOfPoints", (0,), maxshape=(None,), dtype="i8") + root.create_dataset("Types", (0,), maxshape=(None,), dtype="uint8") + root.create_dataset("Points", (0, 3), maxshape=(None, 3), dtype="f") + root.create_dataset( + "NumberOfConnectivityIds", (0,), maxshape=(None,), dtype="i8" + ) + root.create_dataset("NumberOfCells", (0,), maxshape=(None,), dtype="i8") + root.create_dataset("Offsets", (0,), maxshape=(None,), dtype="i8") + root.create_dataset("Connectivity", (0,), maxshape=(None,), dtype="i8") + + append_dataset(root["NumberOfPoints"], np.array([len(self.vertices)])) + append_dataset(root["Points"], self.vertices) + append_dataset( + root["NumberOfConnectivityIds"], + np.array([len(trimmed_connectivity)]), + ) + append_dataset(root["Connectivity"], trimmed_connectivity) + append_dataset(root["NumberOfCells"], np.array([self.n_elements])) + append_dataset(root["Offsets"], offsets) + + append_dataset( + root["Types"], np.full(self.n_elements, self._VTK_TETRA, dtype="uint8") + ) + + cell_data_group = root.create_group("CellData") + + for name, data in datasets.items(): + + cell_data_group.create_dataset( + name, (0,), maxshape=(None,), dtype="float64", chunks=True + ) + + if volume_normalization: + data /= self.volumes + append_dataset(cell_data_group[name], data) + @classmethod def from_hdf5(cls, group: h5py.Group, mesh_id: int, name: str): - filename = group['filename'][()].decode() - library = group['library'][()].decode() - if 'options' in group.attrs: + filename = group["filename"][()].decode() + library = group["library"][()].decode() + if "options" in group.attrs: options = group.attrs['options'].decode() else: options = None - mesh = cls(filename=filename, library=library, mesh_id=mesh_id, name=name, options=options) + mesh = cls( + filename=filename, + library=library, + mesh_id=mesh_id, + name=name, + options=options, + ) mesh._has_statepoint_data = True - vol_data = group['volumes'][()] + vol_data = group["volumes"][()] mesh.volumes = np.reshape(vol_data, (vol_data.shape[0],)) mesh.n_elements = mesh.volumes.size - vertices = group['vertices'][()] + vertices = group["vertices"][()] mesh._vertices = vertices.reshape((-1, 3)) - connectivity = group['connectivity'][()] + connectivity = group["connectivity"][()] mesh._connectivity = connectivity.reshape((-1, 8)) - mesh._element_types = group['element_types'][()] + mesh._element_types = group["element_types"][()] - if 'length_multiplier' in group: - mesh.length_multiplier = group['length_multiplier'][()] + if "length_multiplier" in group: + mesh.length_multiplier = group["length_multiplier"][()] return mesh @@ -2667,7 +2942,7 @@ class UnstructuredMesh(MeshBase): element.set("library", self._library) if self.options is not None: - element.set('options', self.options) + element.set("options", self.options) subelement = ET.SubElement(element, "filename") subelement.text = str(self.filename) @@ -2694,7 +2969,7 @@ class UnstructuredMesh(MeshBase): filename = get_text(elem, 'filename') library = get_text(elem, 'library') length_multiplier = float(get_text(elem, 'length_multiplier', 1.0)) - options = elem.get('options') + options = get_text(elem, "options") return cls(filename, library, mesh_id, '', length_multiplier, options) diff --git a/openmc/mgxs/__init__.py b/openmc/mgxs/__init__.py index 901c1eabb..5adbac9c4 100644 --- a/openmc/mgxs/__init__.py +++ b/openmc/mgxs/__init__.py @@ -1,6 +1,6 @@ import numpy as np -from openmc.mgxs.groups import EnergyGroups +from openmc.mgxs.groups import EnergyGroups, convert_flux_groups from openmc.mgxs.library import Library from openmc.mgxs.mgxs import * from openmc.mgxs.mdgxs import * @@ -13,24 +13,29 @@ GROUP_STRUCTURES = {} - "XMAS-172_" designed for LWR analysis ([SAR1990]_, [SAN2004]_) - "SHEM-361_" designed for LWR analysis to eliminate self-shielding calculations of thermal resonances ([HFA2005]_, [SAN2007]_, [HEB2008]_) -- "SCALE-X" (where X is 44 which is designed for criticality analysis - and 252 is designed for thermal reactors) for the SCALE code suite +- "SCALE-X" (where X is 44 which is designed for criticality analysis, 252 is designed + for thermal reactors and 999 for multipurpose activation) for the SCALE code suite ([ZAL1999]_ and [REARDEN2013]_) - "MPACT-X" (where X is 51 (PWR), 60 (BWR), 69 (Magnox)) from the MPACT_ reactor physics code ([KIM2019]_ and [KIM2020]_) +- "ECCO-33" intended for fast reactor criticality benchmarks. It’s derived as a + subset of VITAMIN‑J - "ECCO-1968_" designed for fine group reactor cell calculations for fast, intermediate and thermal reactor applications ([SAR1990]_) - activation_ energy group structures "VITAMIN-J-42", "VITAMIN-J-175", - "TRIPOLI-315", "CCFE-709_" and "UKAEA-1102_" + "TRIPOLI-315", "LLNL-616", "CCFE-709_" and "UKAEA-1102_" .. _CASMO: http://large.stanford.edu/courses/2013/ph241/dalvi1/docs/c5.physor2006.pdf .. _SCALE44: https://www-nds.iaea.org/publications/indc/indc-czr-0001.pdf +.. _ECCO-33: https://serpent.vtt.fi/mediawiki/index.php/ECCO_33-group_structure .. _SCALE252: https://oecd-nea.org/science/wpncs/amct/workingarea/meeting2013/EGAMCT2013_08.pdf +.. _SCALE999: https://info.ornl.gov/sites/publications/Files/Pub67728.pdf, https://www.nrc.gov/docs/ML1218/ML12184A002.pdf .. _MPACT: https://vera.ornl.gov/mpact/ .. _XMAS-172: https://www-nds.iaea.org/wimsd/energy.htm .. _SHEM-361: http://merlin.polymtl.ca/downloads/FP214.pdf .. _activation: https://fispact.ukaea.uk/wiki/Keyword:GETXS .. _VITAMIN-J-42: https://www.oecd-nea.org/dbdata/nds_jefreports/jefreport-10.pdf +.. _LLNL-616: https://fispact.ukaea.uk/manual/user_manual.pdf .. _CCFE-709: https://fispact.ukaea.uk/wiki/CCFE-709_group_structure .. _UKAEA-1102: https://fispact.ukaea.uk/wiki/UKAEA-1102_group_structure .. _ECCO-1968: https://serpent.vtt.fi/mediawiki/index.php/ECCO_1968-group_structure @@ -80,6 +85,16 @@ GROUP_STRUCTURES['CASMO-25'] = np.array([ 0., 3.e-2, 5.8e-2, 1.4e-1, 2.8e-1, 3.5e-1, 6.25e-1, 9.72e-1, 1.02, 1.097, 1.15, 1.855, 4., 9.877, 1.5968e1, 1.4873e2, 5.53e3, 9.118e3, 1.11e5, 5.e5, 8.21e5, 1.353e6, 2.231e6, 3.679e6, 6.0655e6, 2.e7]) +GROUP_STRUCTURES['ECCO-33'] = np.array([ + 1.0000100000E-05, 1.0000000000E-01, 5.4000000000E-01, 4.0000000000E+00, + 8.3152870000E+00, 1.3709590000E+01, 2.2603290000E+01, 4.0169000000E+01, + 6.7904050000E+01, 9.1660880000E+01, 1.4862540000E+02, 3.0432480000E+02, + 4.5399930000E+02, 7.4851830000E+02, 1.2340980000E+03, 2.0346840000E+03, + 3.3546260000E+03, 5.5308440000E+03, 9.1188200000E+03, 1.5034390000E+04, + 2.4787520000E+04, 4.0867710000E+04, 6.7379470000E+04, 1.1109000000E+05, + 1.8315640000E+05, 3.0197380000E+05, 4.9787070000E+05, 8.2085000000E+05, + 1.3533530000E+06, 2.2313020000E+06, 3.6787940000E+06, 6.0653070000E+06, + 1.0000000000E+07, 1.9640330000E+07]) GROUP_STRUCTURES['CASMO-40'] = np.array([ 0., 1.5e-2, 3.e-2, 4.2e-2, 5.8e-2, 8.e-2, 1.e-1, 1.4e-1, 1.8e-1, 2.2e-1, 2.8e-1, 3.5e-1, 6.25e-1, 8.5e-1, 9.5e-1, @@ -346,6 +361,97 @@ GROUP_STRUCTURES['SHEM-361'] = np.array([ 4.06569e+06, 4.96585e+06, 6.06530e+06, 6.70319e+06, 7.40817e+06, 8.18730e+06, 9.04836e+06, 9.99999e+06, 1.16183e+07, 1.38403e+07, 1.49182e+07, 1.96403e+07]) +GROUP_STRUCTURES['LLNL-616'] = np.array([ + 1.0000e-5, 1.0471e-5, 1.0965e-5, 1.1482e-5, 1.2023e-5, 1.2589e-5, 1.3183e-5, + 1.3804e-5, 1.4454e-5, 1.5136e-5, 1.5849e-5, 1.6596e-5, 1.7378e-5, 1.8197e-5, + 1.9055e-5, 1.9953e-5, 2.0893e-5, 2.1878e-5, 2.2909e-5, 2.3988e-5, 2.5119e-5, + 2.6303e-5, 2.7542e-5, 2.8840e-5, 3.0200e-5, 3.1623e-5, 3.3113e-5, 3.4674e-5, + 3.6308e-5, 3.8019e-5, 3.9811e-5, 4.1687e-5, 4.3652e-5, 4.5709e-5, 4.7863e-5, + 5.0119e-5, 5.2481e-5, 5.4954e-5, 5.7544e-5, 6.0256e-5, 6.3096e-5, 6.6069e-5, + 6.9183e-5, 7.2444e-5, 7.5858e-5, 7.9433e-5, 8.3176e-5, 8.7096e-5, 9.1201e-5, + 9.5499e-5, 1.0000e-4, 1.0471e-4, 1.0965e-4, 1.1482e-4, 1.2023e-4, 1.2589e-4, + 1.3183e-4, 1.3804e-4, 1.4454e-4, 1.5136e-4, 1.5849e-4, 1.6596e-4, 1.7378e-4, + 1.8197e-4, 1.9055e-4, 1.9953e-4, 2.0893e-4, 2.1878e-4, 2.2909e-4, 2.3988e-4, + 2.5119e-4, 2.6303e-4, 2.7542e-4, 2.8840e-4, 3.0200e-4, 3.1623e-4, 3.3113e-4, + 3.4674e-4, 3.6308e-4, 3.8019e-4, 3.9811e-4, 4.1687e-4, 4.3652e-4, 4.5709e-4, + 4.7863e-4, 5.0119e-4, 5.2481e-4, 5.4954e-4, 5.7544e-4, 6.0256e-4, 6.3096e-4, + 6.6069e-4, 6.9183e-4, 7.2444e-4, 7.5858e-4, 7.9433e-4, 8.3176e-4, 8.7096e-4, + 9.1201e-4, 9.5499e-4, 1.0000e-3, 1.0471e-3, 1.0965e-3, 1.1482e-3, 1.2023e-3, + 1.2589e-3, 1.3183e-3, 1.3804e-3, 1.4454e-3, 1.5136e-3, 1.5849e-3, 1.6596e-3, + 1.7378e-3, 1.8197e-3, 1.9055e-3, 1.9953e-3, 2.0893e-3, 2.1878e-3, 2.2909e-3, + 2.3988e-3, 2.5119e-3, 2.6303e-3, 2.7542e-3, 2.8840e-3, 3.0200e-3, 3.1623e-3, + 3.3113e-3, 3.4674e-3, 3.6308e-3, 3.8019e-3, 3.9811e-3, 4.1687e-3, 4.3652e-3, + 4.5709e-3, 4.7863e-3, 5.0119e-3, 5.2481e-3, 5.4954e-3, 5.7544e-3, 6.0256e-3, + 6.3096e-3, 6.6069e-3, 6.9183e-3, 7.2444e-3, 7.5858e-3, 7.9433e-3, 8.3176e-3, + 8.7096e-3, 9.1201e-3, 9.5499e-3, 1.0000e-2, 1.0471e-2, 1.0965e-2, 1.1482e-2, + 1.2023e-2, 1.2589e-2, 1.3183e-2, 1.3804e-2, 1.4454e-2, 1.5136e-2, 1.5849e-2, + 1.6596e-2, 1.7378e-2, 1.8197e-2, 1.9055e-2, 1.9953e-2, 2.0893e-2, 2.1878e-2, + 2.2909e-2, 2.3988e-2, 2.5119e-2, 2.6303e-2, 2.7542e-2, 2.8840e-2, 3.0200e-2, + 3.1623e-2, 3.3113e-2, 3.4674e-2, 3.6308e-2, 3.8019e-2, 3.9811e-2, 4.1687e-2, + 4.3652e-2, 4.5709e-2, 4.7863e-2, 5.0119e-2, 5.2481e-2, 5.4954e-2, 5.7544e-2, + 6.0256e-2, 6.3096e-2, 6.6069e-2, 6.9183e-2, 7.2444e-2, 7.5858e-2, 7.9433e-2, + 8.3176e-2, 8.7096e-2, 9.1201e-2, 9.5499e-2, 1.0000e-1, 1.0471e-1, 1.0965e-1, + 1.1482e-1, 1.2023e-1, 1.2589e-1, 1.3183e-1, 1.3804e-1, 1.4454e-1, 1.5136e-1, + 1.5849e-1, 1.6596e-1, 1.7378e-1, 1.8197e-1, 1.9055e-1, 1.9953e-1, 2.0893e-1, + 2.1878e-1, 2.2909e-1, 2.3988e-1, 2.5119e-1, 2.6303e-1, 2.7542e-1, 2.8840e-1, + 3.0200e-1, 3.1623e-1, 3.3113e-1, 3.4674e-1, 3.6308e-1, 3.8019e-1, 3.9811e-1, + 4.1687e-1, 4.3652e-1, 4.5709e-1, 4.7863e-1, 5.0119e-1, 5.2481e-1, 5.4954e-1, + 5.7544e-1, 6.0256e-1, 6.3096e-1, 6.6069e-1, 6.9183e-1, 7.2444e-1, 7.5858e-1, + 7.9433e-1, 8.3176e-1, 8.7096e-1, 9.1201e-1, 9.5499e-1, 1.0000e0, 1.0471e0, + 1.0965e0, 1.1482e0, 1.2023e0, 1.2589e0, 1.3183e0, 1.3804e0, 1.4454e0, + 1.5136e0, 1.5849e0, 1.6596e0, 1.7378e0, 1.8197e0, 1.9055e0, 1.9953e0, + 2.0893e0, 2.1878e0, 2.2909e0, 2.3988e0, 2.5119e0, 2.6303e0, 2.7542e0, + 2.8840e0, 3.0200e0, 3.1623e0, 3.3113e0, 3.4674e0, 3.6308e0, 3.8019e0, + 3.9811e0, 4.1687e0, 4.3652e0, 4.5709e0, 4.7863e0, 5.0119e0, 5.2481e0, + 5.4954e0, 5.7544e0, 6.0256e0, 6.3096e0, 6.6069e0, 6.9183e0, 7.2444e0, + 7.5858e0, 7.9433e0, 8.3176e0, 8.7096e0, 9.1201e0, 9.5499e0, 1.0000e1, + 1.0471e1, 1.0965e1, 1.1482e1, 1.2023e1, 1.2589e1, 1.3183e1, 1.3804e1, + 1.4454e1, 1.5136e1, 1.5849e1, 1.6596e1, 1.7378e1, 1.8197e1, 1.9055e1, + 1.9953e1, 2.0893e1, 2.1878e1, 2.2909e1, 2.3988e1, 2.5119e1, 2.6303e1, + 2.7542e1, 2.8840e1, 3.0200e1, 3.1623e1, 3.3113e1, 3.4674e1, 3.6308e1, + 3.8019e1, 3.9811e1, 4.1687e1, 4.3652e1, 4.5709e1, 4.7863e1, 5.0119e1, + 5.2481e1, 5.4954e1, 5.7544e1, 6.0256e1, 6.3096e1, 6.6069e1, 6.9183e1, + 7.2444e1, 7.5858e1, 7.9433e1, 8.3176e1, 8.7096e1, 9.1201e1, 9.5499e1, + 1.0000e2, 1.0471e2, 1.0965e2, 1.1482e2, 1.2023e2, 1.2589e2, 1.3183e2, + 1.3804e2, 1.4454e2, 1.5136e2, 1.5849e2, 1.6596e2, 1.7378e2, 1.8197e2, + 1.9055e2, 1.9953e2, 2.0893e2, 2.1878e2, 2.2909e2, 2.3988e2, 2.5119e2, + 2.6303e2, 2.7542e2, 2.8840e2, 3.0200e2, 3.1623e2, 3.3113e2, 3.4674e2, + 3.6308e2, 3.8019e2, 3.9811e2, 4.1687e2, 4.3652e2, 4.5709e2, 4.7863e2, + 5.0119e2, 5.2481e2, 5.4954e2, 5.7544e2, 6.0256e2, 6.3096e2, 6.6069e2, + 6.9183e2, 7.2444e2, 7.5858e2, 7.9433e2, 8.3176e2, 8.7096e2, 9.1201e2, + 9.5499e2, 1.0000e3, 1.0471e3, 1.0965e3, 1.1482e3, 1.2023e3, 1.2589e3, + 1.3183e3, 1.3804e3, 1.4454e3, 1.5136e3, 1.5849e3, 1.6596e3, 1.7378e3, + 1.8197e3, 1.9055e3, 1.9953e3, 2.0893e3, 2.1878e3, 2.2909e3, 2.3988e3, + 2.5119e3, 2.6303e3, 2.7542e3, 2.8840e3, 3.0200e3, 3.1623e3, 3.3113e3, + 3.4674e3, 3.6308e3, 3.8019e3, 3.9811e3, 4.1687e3, 4.3652e3, 4.5709e3, + 4.7863e3, 5.0119e3, 5.2481e3, 5.4954e3, 5.7544e3, 6.0256e3, 6.3096e3, + 6.6069e3, 6.9183e3, 7.2444e3, 7.5858e3, 7.9433e3, 8.3176e3, 8.7096e3, + 9.1201e3, 9.5499e3, 1.0000e4, 1.0471e4, 1.0965e4, 1.1482e4, 1.2023e4, + 1.2589e4, 1.3183e4, 1.3804e4, 1.4454e4, 1.5136e4, 1.5849e4, 1.6596e4, + 1.7378e4, 1.8197e4, 1.9055e4, 1.9953e4, 2.0893e4, 2.1878e4, 2.2909e4, + 2.3988e4, 2.5119e4, 2.6303e4, 2.7542e4, 2.8840e4, 3.0200e4, 3.1623e4, + 3.3113e4, 3.4674e4, 3.6308e4, 3.8019e4, 3.9811e4, 4.1687e4, 4.3652e4, + 4.5709e4, 4.7863e4, 5.0119e4, 5.2481e4, 5.4954e4, 5.7544e4, 6.0256e4, + 6.3096e4, 6.6069e4, 6.9183e4, 7.2444e4, 7.5858e4, 7.9433e4, 8.3176e4, + 8.7096e4, 9.1201e4, 9.5499e4, 1.0000e5, 1.0471e5, 1.0965e5, 1.1482e5, + 1.2023e5, 1.2589e5, 1.3183e5, 1.3804e5, 1.4454e5, 1.5136e5, 1.5849e5, + 1.6596e5, 1.7378e5, 1.8197e5, 1.9055e5, 1.9953e5, 2.0893e5, 2.1878e5, + 2.2909e5, 2.3988e5, 2.5119e5, 2.6303e5, 2.7542e5, 2.8840e5, 3.0200e5, + 3.1623e5, 3.3113e5, 3.4674e5, 3.6308e5, 3.8019e5, 3.9811e5, 4.1687e5, + 4.3652e5, 4.5709e5, 4.7863e5, 5.0119e5, 5.2481e5, 5.4954e5, 5.7544e5, + 6.0256e5, 6.3096e5, 6.6069e5, 6.9183e5, 7.2444e5, 7.5858e5, 7.9433e5, + 8.3176e5, 8.7096e5, 9.1201e5, 9.5499e5, 1.0000e6, 1.0471e6, 1.0965e6, + 1.1482e6, 1.2023e6, 1.2589e6, 1.3183e6, 1.3804e6, 1.4454e6, 1.5136e6, + 1.5849e6, 1.6596e6, 1.7378e6, 1.8197e6, 1.9055e6, 1.9953e6, 2.0893e6, + 2.1878e6, 2.2909e6, 2.3988e6, 2.5119e6, 2.6303e6, 2.7542e6, 2.8840e6, + 3.0200e6, 3.1623e6, 3.3113e6, 3.4674e6, 3.6308e6, 3.8019e6, 3.9811e6, + 4.1687e6, 4.3652e6, 4.5709e6, 4.7863e6, 5.0119e6, 5.2481e6, 5.4954e6, + 5.7544e6, 6.0256e6, 6.3096e6, 6.6069e6, 6.9183e6, 7.2444e6, 7.5858e6, + 7.9433e6, 8.3176e6, 8.7096e6, 9.1201e6, 9.5499e6, 1.0000e7, 1.0471e7, + 1.0965e7, 1.1482e7, 1.2023e7, 1.2589e7, 1.3183e7, 1.3804e7, 1.4454e7, + 1.5136e7, 1.5849e7, 1.6596e7, 1.7378e7, 1.8197e7, 1.9055e7, 1.9953e7, + 2.0000e7 +]) GROUP_STRUCTURES['CCFE-709'] = np.array([ 1.e-5, 1.0471e-5, 1.0965e-5, 1.1482e-5, 1.2023e-5, 1.2589e-5, 1.3183e-5, 1.3804e-5, 1.4454e-5, 1.5136e-5, @@ -488,7 +594,208 @@ GROUP_STRUCTURES['CCFE-709'] = np.array([ 2.4000e8, 2.8000e8, 3.2000e8, 3.6000e8, 4.0000e8, 4.4000e8, 4.8000e8, 5.2000e8, 5.6000e8, 6.0000e8, 6.4000e8, 6.8000e8, 7.2000e8, 7.6000e8, 8.0000e8, - 8.4000e8, 8.8000e8, 9.2000e8, 9.6000e8, 1.0000e9,]) + 8.4000e8, 8.8000e8, 9.2000e8, 9.6000e8, 1.0000e9]) +GROUP_STRUCTURES['SCALE-999'] = np.array([ + 1.000e-5, 1.000e-4, 5.000e-4, 7.500e-4, 1.000e-3, + 1.200e-3, 1.500e-3, 2.000e-3, 2.500e-3, 3.000e-3, + 4.000e-3, 5.000e-3, 7.500e-3, 1.000e-2, 1.450e-2, + 1.850e-2, 2.100e-2, 2.530e-2, 3.000e-2, 4.000e-2, + 5.000e-2, 6.000e-2, 7.000e-2, 8.000e-2, 9.000e-2, + 1.000e-1, 1.250e-1, 1.500e-1, 1.750e-1, 1.840e-1, + 2.000e-1, 2.250e-1, 2.500e-1, 2.750e-1, 3.000e-1, + 3.250e-1, 3.500e-1, 3.668e-1, 3.750e-1, 4.000e-1, + 4.140e-1, 4.500e-1, 5.000e-1, 5.316e-1, 5.500e-1, + 6.000e-1, 6.250e-1, 6.500e-1, 6.826e-1, 7.000e-1, + 7.500e-1, 8.000e-1, 8.500e-1, 8.764e-1, 9.000e-1, + 9.250e-1, 9.500e-1, 9.750e-1, 1.000e+0, 1.010e+0, + 1.020e+0, 1.030e+0, 1.040e+0, 1.050e+0, 1.060e+0, + 1.070e+0, 1.080e+0, 1.090e+0, 1.100e+0, 1.110e+0, + 1.120e+0, 1.130e+0, 1.140e+0, 1.150e+0, 1.175e+0, + 1.200e+0, 1.225e+0, 1.250e+0, 1.300e+0, 1.350e+0, + 1.400e+0, 1.450e+0, 1.500e+0, 1.545e+0, 1.590e+0, + 1.635e+0, 1.680e+0, 1.725e+0, 1.770e+0, 1.815e+0, + 1.860e+0, 1.900e+0, 1.940e+0, 1.970e+0, 2.000e+0, + 2.060e+0, 2.120e+0, 2.165e+0, 2.210e+0, 2.255e+0, + 2.300e+0, 2.340e+0, 2.380e+0, 2.425e+0, 2.470e+0, + 2.520e+0, 2.570e+0, 2.620e+0, 2.670e+0, 2.720e+0, + 2.770e+0, 2.820e+0, 2.870e+0, 2.920e+0, 2.970e+0, + 3.000e+0, 3.100e+0, 3.200e+0, 3.300e+0, 3.500e+0, + 3.620e+0, 3.730e+0, 3.830e+0, 3.928e+0, 4.000e+0, + 4.100e+0, 4.300e+0, 4.500e+0, 4.750e+0, 4.875e+0, + 5.000e+0, 5.044e+0, 5.250e+0, 5.400e+0, 5.550e+0, + 5.700e+0, 5.850e+0, 6.000e+0, 6.250e+0, 6.375e+0, + 6.500e+0, 6.625e+0, 6.750e+0, 6.875e+0, 7.000e+0, + 7.075e+0, 7.150e+0, 7.625e+0, 8.100e+0, 8.208e+0, + 8.315e+0, 8.708e+0, 9.100e+0, 9.550e+0, 1.000e+1, + 1.034e+1, 1.068e+1, 1.109e+1, 1.150e+1, 1.170e+1, + 1.190e+1, 1.240e+1, 1.290e+1, 1.333e+1, 1.375e+1, + 1.408e+1, 1.440e+1, 1.475e+1, 1.510e+1, 1.555e+1, + 1.600e+1, 1.650e+1, 1.700e+1, 1.730e+1, 1.760e+1, + 1.805e+1, 1.850e+1, 1.875e+1, 1.900e+1, 1.940e+1, + 2.000e+1, 2.050e+1, 2.100e+1, 2.175e+1, 2.250e+1, + 2.375e+1, 2.500e+1, 2.625e+1, 2.750e+1, 2.826e+1, + 2.902e+1, 2.951e+1, 3.000e+1, 3.063e+1, 3.125e+1, + 3.150e+1, 3.175e+1, 3.250e+1, 3.325e+1, 3.350e+1, + 3.375e+1, 3.418e+1, 3.460e+1, 3.500e+1, 3.550e+1, + 3.600e+1, 3.700e+1, 3.713e+1, 3.727e+1, 3.763e+1, + 3.800e+1, 3.855e+1, 3.910e+1, 3.935e+1, 3.960e+1, + 4.030e+1, 4.100e+1, 4.170e+1, 4.240e+1, 4.320e+1, + 4.400e+1, 4.460e+1, 4.520e+1, 4.610e+1, 4.700e+1, + 4.743e+1, 4.785e+1, 4.808e+1, 4.830e+1, 4.875e+1, + 4.920e+1, 4.990e+1, 5.060e+1, 5.130e+1, 5.200e+1, + 5.270e+1, 5.340e+1, 5.620e+1, 5.800e+1, 6.000e+1, + 6.100e+1, 6.122e+1, 6.144e+1, 6.300e+1, 6.500e+1, + 6.625e+1, 6.750e+1, 6.975e+1, 7.200e+1, 7.400e+1, + 7.600e+1, 7.745e+1, 7.889e+1, 7.945e+1, 8.000e+1, + 8.170e+1, 8.200e+1, 8.400e+1, 8.600e+1, 8.800e+1, + 9.000e+1, 9.250e+1, 9.500e+1, 9.700e+1, 1.000e+2, + 1.012e+2, 1.038e+2, 1.050e+2, 1.080e+2, 1.105e+2, + 1.130e+2, 1.160e+2, 1.175e+2, 1.190e+2, 1.205e+2, + 1.220e+2, 1.240e+2, 1.260e+2, 1.280e+2, 1.301e+2, + 1.325e+2, 1.350e+2, 1.375e+2, 1.400e+2, 1.430e+2, + 1.450e+2, 1.475e+2, 1.500e+2, 1.525e+2, 1.550e+2, + 1.575e+2, 1.600e+2, 1.625e+2, 1.650e+2, 1.670e+2, + 1.700e+2, 1.716e+2, 1.739e+2, 1.763e+2, 1.786e+2, + 1.800e+2, 1.877e+2, 1.885e+2, 1.915e+2, 1.930e+2, + 1.962e+2, 1.999e+2, 2.020e+2, 2.074e+2, 2.088e+2, + 2.095e+2, 2.122e+2, 2.145e+2, 2.175e+2, 2.200e+2, + 2.237e+2, 2.269e+2, 2.301e+2, 2.333e+2, 2.367e+2, + 2.400e+2, 2.442e+2, 2.484e+2, 2.527e+2, 2.571e+2, + 2.615e+2, 2.661e+2, 2.707e+2, 2.754e+2, 2.801e+2, + 2.850e+2, 2.899e+2, 2.948e+2, 2.999e+2, 3.050e+2, + 3.107e+2, 3.165e+2, 3.224e+2, 3.284e+2, 3.345e+2, + 3.408e+2, 3.471e+2, 3.536e+2, 3.591e+2, 3.648e+2, + 3.705e+2, 3.764e+2, 3.823e+2, 3.883e+2, 3.944e+2, + 4.007e+2, 4.070e+2, 4.134e+2, 4.199e+2, 4.265e+2, + 4.332e+2, 4.400e+2, 4.470e+2, 4.540e+2, 4.595e+2, + 4.650e+2, 4.706e+2, 4.763e+2, 4.821e+2, 4.879e+2, + 4.937e+2, 4.997e+2, 5.057e+2, 5.118e+2, 5.180e+2, + 5.243e+2, 5.306e+2, 5.370e+2, 5.435e+2, 5.500e+2, + 5.581e+2, 5.662e+2, 5.745e+2, 5.830e+2, 5.932e+2, + 6.036e+2, 6.142e+2, 6.250e+2, 6.359e+2, 6.471e+2, + 6.585e+2, 6.700e+2, 6.765e+2, 6.830e+2, 6.909e+2, + 6.988e+2, 7.069e+2, 7.150e+2, 7.232e+2, 7.316e+2, + 7.400e+2, 7.485e+2, 7.598e+2, 7.712e+2, 7.827e+2, + 7.945e+2, 8.064e+2, 8.185e+2, 8.308e+2, 8.433e+2, + 8.559e+2, 8.688e+2, 8.818e+2, 8.950e+2, 9.085e+2, + 9.221e+2, 9.360e+2, 9.500e+2, 9.555e+2, 9.611e+2, + 9.720e+2, 9.829e+2, 9.940e+2, 1.005e+3, 1.017e+3, + 1.028e+3, 1.040e+3, 1.051e+3, 1.063e+3, 1.075e+3, + 1.087e+3, 1.100e+3, 1.112e+3, 1.125e+3, 1.137e+3, + 1.150e+3, 1.171e+3, 1.191e+3, 1.213e+3, 1.234e+3, + 1.249e+3, 1.265e+3, 1.280e+3, 1.296e+3, 1.312e+3, + 1.328e+3, 1.344e+3, 1.361e+3, 1.377e+3, 1.394e+3, + 1.411e+3, 1.429e+3, 1.446e+3, 1.464e+3, 1.482e+3, + 1.500e+3, 1.525e+3, 1.550e+3, 1.585e+3, 1.610e+3, + 1.636e+3, 1.662e+3, 1.689e+3, 1.716e+3, 1.744e+3, + 1.772e+3, 1.800e+3, 1.828e+3, 1.856e+3, 1.885e+3, + 1.914e+3, 1.943e+3, 1.973e+3, 2.004e+3, 2.035e+3, + 2.075e+3, 2.116e+3, 2.158e+3, 2.200e+3, 2.250e+3, + 2.290e+3, 2.337e+3, 2.386e+3, 2.435e+3, 2.500e+3, + 2.532e+3, 2.580e+3, 2.613e+3, 2.679e+3, 2.747e+3, + 2.808e+3, 2.871e+3, 2.935e+3, 3.000e+3, 3.035e+3, + 3.112e+3, 3.191e+3, 3.272e+3, 3.355e+3, 3.440e+3, + 3.527e+3, 3.616e+3, 3.707e+3, 3.740e+3, 3.819e+3, + 3.900e+3, 3.998e+3, 4.099e+3, 4.202e+3, 4.307e+3, + 4.400e+3, 4.500e+3, 4.620e+3, 4.740e+3, 4.850e+3, + 4.960e+3, 5.100e+3, 5.250e+3, 5.400e+3, 5.531e+3, + 5.645e+3, 5.700e+3, 5.879e+3, 6.000e+3, 6.128e+3, + 6.258e+3, 6.392e+3, 6.528e+3, 6.667e+3, 6.809e+3, + 6.954e+3, 7.102e+3, 7.212e+3, 7.323e+3, 7.437e+3, + 7.552e+3, 7.669e+3, 7.787e+3, 7.908e+3, 8.030e+3, + 8.159e+3, 8.289e+3, 8.422e+3, 8.557e+3, 8.694e+3, + 8.834e+3, 8.975e+3, 9.119e+3, 9.307e+3, 9.500e+3, + 9.763e+3, 1.003e+4, 1.031e+4, 1.060e+4, 1.086e+4, + 1.114e+4, 1.142e+4, 1.171e+4, 1.202e+4, 1.234e+4, + 1.266e+4, 1.300e+4, 1.324e+4, 1.348e+4, 1.373e+4, + 1.398e+4, 1.424e+4, 1.450e+4, 1.476e+4, 1.503e+4, + 1.527e+4, 1.550e+4, 1.574e+4, 1.599e+4, 1.623e+4, + 1.649e+4, 1.674e+4, 1.700e+4, 1.727e+4, 1.755e+4, + 1.783e+4, 1.812e+4, 1.841e+4, 1.870e+4, 1.900e+4, + 1.931e+4, 1.965e+4, 2.000e+4, 2.045e+4, 2.092e+4, + 2.139e+4, 2.188e+4, 2.229e+4, 2.271e+4, 2.314e+4, + 2.358e+4, 2.388e+4, 2.418e+4, 2.450e+4, 2.479e+4, + 2.500e+4, 2.520e+4, 2.552e+4, 2.580e+4, 2.606e+4, + 2.653e+4, 2.700e+4, 2.737e+4, 2.774e+4, 2.812e+4, + 2.850e+4, 2.887e+4, 2.924e+4, 2.962e+4, 3.000e+4, + 3.045e+4, 3.090e+4, 3.136e+4, 3.183e+4, 3.243e+4, + 3.304e+4, 3.367e+4, 3.431e+4, 3.468e+4, 3.507e+4, + 3.545e+4, 3.584e+4, 3.624e+4, 3.663e+4, 3.704e+4, + 3.744e+4, 3.786e+4, 3.827e+4, 3.869e+4, 3.912e+4, + 3.955e+4, 3.998e+4, 4.042e+4, 4.087e+4, 4.136e+4, + 4.186e+4, 4.237e+4, 4.288e+4, 4.340e+4, 4.393e+4, + 4.446e+4, 4.500e+4, 4.565e+4, 4.631e+4, 4.721e+4, + 4.812e+4, 4.905e+4, 5.000e+4, 5.099e+4, 5.200e+4, + 5.248e+4, 5.347e+4, 5.448e+4, 5.551e+4, 5.656e+4, + 5.740e+4, 5.826e+4, 5.912e+4, 6.000e+4, 6.088e+4, + 6.177e+4, 6.267e+4, 6.358e+4, 6.451e+4, 6.545e+4, + 6.641e+4, 6.738e+4, 6.851e+4, 6.965e+4, 7.081e+4, + 7.200e+4, 7.300e+4, 7.399e+4, 7.500e+4, 7.610e+4, + 7.722e+4, 7.835e+4, 7.950e+4, 8.074e+4, 8.200e+4, + 8.250e+4, 8.374e+4, 8.500e+4, 8.652e+4, 8.788e+4, + 8.926e+4, 9.067e+4, 9.210e+4, 9.355e+4, 9.502e+4, + 9.652e+4, 9.804e+4, 1.000e+5, 1.013e+5, 1.027e+5, + 1.040e+5, 1.054e+5, 1.068e+5, 1.082e+5, 1.096e+5, + 1.111e+5, 1.125e+5, 1.139e+5, 1.153e+5, 1.168e+5, + 1.183e+5, 1.197e+5, 1.213e+5, 1.228e+5, 1.241e+5, + 1.255e+5, 1.269e+5, 1.283e+5, 1.291e+5, 1.307e+5, + 1.323e+5, 1.340e+5, 1.357e+5, 1.374e+5, 1.391e+5, + 1.409e+5, 1.426e+5, 1.445e+5, 1.463e+5, 1.481e+5, + 1.490e+5, 1.519e+5, 1.538e+5, 1.557e+5, 1.576e+5, + 1.596e+5, 1.616e+5, 1.637e+5, 1.657e+5, 1.678e+5, + 1.699e+5, 1.721e+5, 1.742e+5, 1.764e+5, 1.786e+5, + 1.809e+5, 1.832e+5, 1.855e+5, 1.878e+5, 1.902e+5, + 1.926e+5, 1.962e+5, 2.000e+5, 2.024e+5, 2.050e+5, + 2.076e+5, 2.102e+5, 2.128e+5, 2.155e+5, 2.182e+5, + 2.209e+5, 2.237e+5, 2.265e+5, 2.294e+5, 2.323e+5, + 2.352e+5, 2.381e+5, 2.411e+5, 2.442e+5, 2.472e+5, + 2.500e+5, 2.527e+5, 2.555e+5, 2.584e+5, 2.612e+5, + 2.641e+5, 2.670e+5, 2.700e+5, 2.732e+5, 2.767e+5, + 2.802e+5, 2.837e+5, 2.873e+5, 2.909e+5, 2.945e+5, + 2.972e+5, 2.985e+5, 3.020e+5, 3.053e+5, 3.088e+5, + 3.122e+5, 3.157e+5, 3.192e+5, 3.228e+5, 3.264e+5, + 3.300e+5, 3.337e+5, 3.379e+5, 3.422e+5, 3.465e+5, + 3.508e+5, 3.553e+5, 3.597e+5, 3.643e+5, 3.688e+5, + 3.735e+5, 3.782e+5, 3.829e+5, 3.877e+5, 3.938e+5, + 4.000e+5, 4.076e+5, 4.138e+5, 4.200e+5, 4.249e+5, + 4.299e+5, 4.349e+5, 4.400e+5, 4.452e+5, 4.505e+5, + 4.553e+5, 4.601e+5, 4.650e+5, 4.700e+5, 4.772e+5, + 4.845e+5, 4.920e+5, 4.995e+5, 5.054e+5, 5.113e+5, + 5.173e+5, 5.234e+5, 5.299e+5, 5.365e+5, 5.432e+5, + 5.500e+5, 5.557e+5, 5.614e+5, 5.672e+5, 5.730e+5, + 5.784e+5, 5.891e+5, 6.000e+5, 6.081e+5, 6.158e+5, + 6.235e+5, 6.313e+5, 6.393e+5, 6.468e+5, 6.545e+5, + 6.622e+5, 6.700e+5, 6.790e+5, 6.926e+5, 7.065e+5, + 7.154e+5, 7.244e+5, 7.335e+5, 7.427e+5, 7.500e+5, + 7.576e+5, 7.653e+5, 7.730e+5, 7.808e+5, 7.904e+5, + 8.002e+5, 8.100e+5, 8.200e+5, 8.301e+5, 8.403e+5, + 8.506e+5, 8.611e+5, 8.750e+5, 8.874e+5, 9.000e+5, + 9.072e+5, 9.200e+5, 9.400e+5, 9.616e+5, 9.800e+5, + 1.003e+6, 1.010e+6, 1.040e+6, 1.070e+6, 1.100e+6, + 1.108e+6, 1.136e+6, 1.165e+6, 1.200e+6, 1.225e+6, + 1.250e+6, 1.287e+6, 1.317e+6, 1.356e+6, 1.400e+6, + 1.423e+6, 1.461e+6, 1.500e+6, 1.536e+6, 1.572e+6, + 1.612e+6, 1.653e+6, 1.695e+6, 1.738e+6, 1.782e+6, + 1.827e+6, 1.850e+6, 1.921e+6, 1.969e+6, 2.019e+6, + 2.070e+6, 2.123e+6, 2.176e+6, 2.231e+6, 2.307e+6, + 2.354e+6, 2.365e+6, 2.385e+6, 2.466e+6, 2.479e+6, + 2.535e+6, 2.592e+6, 2.658e+6, 2.725e+6, 2.794e+6, + 2.865e+6, 2.932e+6, 3.000e+6, 3.080e+6, 3.166e+6, + 3.247e+6, 3.329e+6, 3.413e+6, 3.499e+6, 3.588e+6, + 3.679e+6, 3.772e+6, 3.867e+6, 3.965e+6, 4.066e+6, + 4.183e+6, 4.304e+6, 4.398e+6, 4.493e+6, 4.607e+6, + 4.724e+6, 4.800e+6, 4.882e+6, 4.966e+6, 5.092e+6, + 5.221e+6, 5.353e+6, 5.488e+6, 5.627e+6, 5.770e+6, + 5.916e+6, 6.065e+6, 6.219e+6, 6.376e+6, 6.434e+6, + 6.592e+6, 6.703e+6, 6.873e+6, 7.047e+6, 7.225e+6, + 7.408e+6, 7.596e+6, 7.788e+6, 7.985e+6, 8.187e+6, + 8.395e+6, 8.607e+6, 8.825e+6, 9.048e+6, 9.278e+6, + 9.512e+6, 9.753e+6, 1.000e+7, 1.025e+7, 1.051e+7, + 1.078e+7, 1.105e+7, 1.133e+7, 1.162e+7, 1.191e+7, + 1.221e+7, 1.252e+7, 1.284e+7, 1.317e+7, 1.350e+7, + 1.384e+7, 1.419e+7, 1.455e+7, 1.492e+7, 1.530e+7, + 1.568e+7, 1.608e+7, 1.649e+7, 1.691e+7, 1.733e+7, + 1.790e+7, 1.845e+7, 1.900e+7, 1.964e+7, 2.000e+7]) GROUP_STRUCTURES['UKAEA-1102'] = np.array([ 1.0000e-5, 1.0471e-5, 1.0965e-5, 1.1482e-5, 1.2023e-5, 1.2589e-5, 1.3183e-5, 1.3804e-5, 1.4454e-5, 1.5136e-5, diff --git a/openmc/mgxs/groups.py b/openmc/mgxs/groups.py index 182402ed7..8910c7d42 100644 --- a/openmc/mgxs/groups.py +++ b/openmc/mgxs/groups.py @@ -300,3 +300,139 @@ class EnergyGroups: # Assign merged edges to merged groups merged_groups.group_edges = list(merged_edges) return merged_groups + + +def convert_flux_groups(flux, source_groups, target_groups): + """Convert flux spectrum between energy group structures. + + Uses flux-per-unit-lethargy conservation, which assumes constant flux per + unit lethargy within each source group and distributes flux to target + groups proportionally to their lethargy width. + + .. versionadded:: 0.15.4 + + Parameters + ---------- + flux : Iterable of float + Flux values for source groups. Length must equal + source_groups.num_groups. + source_groups : EnergyGroups or str + Energy group structure of the input flux with boundaries in [eV]. + Can be an EnergyGroups instance or the name of a group structure + (e.g., 'CCFE-709'). + target_groups : EnergyGroups or str + Target energy group structure with boundaries in [eV]. Can be an + EnergyGroups instance or the name of a group structure + (e.g., 'UKAEA-1102'). + + Returns + ------- + numpy.ndarray + Flux values for target groups. Total flux is conserved for + overlapping energy regions. + + Raises + ------ + TypeError + If source_groups or target_groups is not EnergyGroups or str + ValueError + If flux length doesn't match source_groups, or flux contains + negative, NaN, or infinite values + + See Also + -------- + EnergyGroups : Energy group structure class + + Notes + ----- + The assumption of constant flux per unit lethargy within each source + group is physically reasonable for most reactor spectra but is not + exact. For best accuracy, use source spectra with sufficiently fine + energy resolution. + + Examples + -------- + Convert FNS 709-group flux to UKAEA-1102 structure: + + >>> import numpy as np + >>> flux_709 = np.load('tests/fns_flux_709.npy') + >>> flux_1102 = openmc.mgxs.convert_flux_groups(flux_709, 'CCFE-709', 'UKAEA-1102') + + Convert using EnergyGroups instances: + + >>> source = openmc.mgxs.EnergyGroups([1.0, 10.0, 100.0]) + >>> target = openmc.mgxs.EnergyGroups([1.0, 5.0, 10.0, 50.0, 100.0]) + >>> flux_target = openmc.mgxs.convert_flux_groups([1e8, 2e8], source, target) + + References + ---------- + .. [1] J. J. Duderstadt and L. J. Hamilton, "Nuclear Reactor Analysis," + John Wiley & Sons, 1976. + .. [2] M. Fleming and J.-Ch. Sublet, "FISPACT-II User Manual," + UKAEA-R(18)001, UK Atomic Energy Authority, 2018. See GRPCONVERT keyword. + + """ + # Handle string group structure names + if isinstance(source_groups, str): + source_groups = EnergyGroups(source_groups) + if isinstance(target_groups, str): + target_groups = EnergyGroups(target_groups) + + # Type validation + cv.check_type('source_groups', source_groups, EnergyGroups) + cv.check_type('target_groups', target_groups, EnergyGroups) + + # Convert flux to numpy array + flux = np.asarray(flux, dtype=np.float64) + if flux.ndim != 1: + raise ValueError(f'flux must be 1-dimensional, got shape {flux.shape}') + + # Validate flux length matches source groups + if len(flux) != source_groups.num_groups: + raise ValueError( + f'Length of flux ({len(flux)}) must equal number of source ' + f'groups ({source_groups.num_groups})' + ) + + # Check for invalid flux values + if np.any(np.isnan(flux)): + raise ValueError('flux contains NaN values') + if np.any(np.isinf(flux)): + raise ValueError('flux contains infinite values') + if np.any(flux < 0): + raise ValueError('flux values must be non-negative') + + # Get energy edges + source_edges = source_groups.group_edges + target_edges = target_groups.group_edges + num_target = target_groups.num_groups + + # Initialize output array + flux_target = np.zeros(num_target) + + # Main conversion loop: distribute flux using lethargy weighting + for idx_src, flux_src in enumerate(flux): + if flux_src == 0: + continue + + e_low_src = source_edges[idx_src] + e_high_src = source_edges[idx_src + 1] + lethargy_src = np.log(e_high_src / e_low_src) + + for idx_tgt in range(num_target): + e_low_tgt = target_edges[idx_tgt] + e_high_tgt = target_edges[idx_tgt + 1] + + # Skip non-overlapping groups + if e_high_tgt <= e_low_src or e_low_tgt >= e_high_src: + continue + + # Calculate overlap region + e_low_overlap = max(e_low_src, e_low_tgt) + e_high_overlap = min(e_high_src, e_high_tgt) + lethargy_overlap = np.log(e_high_overlap / e_low_overlap) + + # Distribute flux proportionally to lethargy fraction + flux_target[idx_tgt] += flux_src * (lethargy_overlap / lethargy_src) + + return flux_target diff --git a/openmc/mgxs/library.py b/openmc/mgxs/library.py index 12a4630bd..b476de902 100644 --- a/openmc/mgxs/library.py +++ b/openmc/mgxs/library.py @@ -10,6 +10,7 @@ import numpy as np import openmc import openmc.mgxs import openmc.checkvalue as cv +from openmc.checkvalue import PathLike from ..tallies import ESTIMATOR_TYPES @@ -555,14 +556,14 @@ class Library: self.all_mgxs[domain.id][mgxs_type] = mgxs - def add_to_tallies_file(self, tallies_file, merge=True): - """Add all tallies from all MGXS objects to a tallies file. + def add_to_tallies(self, tallies, merge=True): + """Add tallies from all MGXS objects to a tallies object. NOTE: This assumes that :meth:`Library.build_library` has been called Parameters ---------- - tallies_file : openmc.Tallies + tallies : openmc.Tallies A Tallies collection to add each MGXS' tallies to generate a 'tallies.xml' input file for OpenMC merge : bool @@ -571,7 +572,7 @@ class Library: """ - cv.check_type('tallies_file', tallies_file, openmc.Tallies) + cv.check_type('tallies', tallies, openmc.Tallies) # Add tallies from each MGXS for each domain and mgxs type for domain in self.domains: @@ -586,7 +587,15 @@ class Library: = list(range(1, self.num_delayed_groups + 1)) for tally in mgxs.tallies.values(): - tallies_file.append(tally, merge=merge) + tallies.append(tally, merge=merge) + + def add_to_tallies_file(self, tallies_file, merge=True): + warn( + "The Library.add_to_tallies_file(...) method has been renamed to" + "add_to_tallies(...) and will be removed in a future version of " + "OpenMC.", FutureWarning + ) + self.add_to_tallies(tallies_file, merge=merge) def load_from_statepoint(self, statepoint): """Extracts tallies in an OpenMC StatePoint with the data needed to @@ -851,7 +860,7 @@ class Library: 'since a statepoint has not yet been loaded' raise ValueError(msg) - cv.check_type('filename', filename, str) + cv.check_type('filename', filename, (str, PathLike)) cv.check_type('directory', directory, str) import h5py @@ -894,7 +903,7 @@ class Library: """ - cv.check_type('filename', filename, str) + cv.check_type('filename', filename, (str, PathLike)) cv.check_type('directory', directory, str) # Make directory if it does not exist @@ -930,7 +939,7 @@ class Library: """ - cv.check_type('filename', filename, str) + cv.check_type('filename', filename, (str, PathLike)) cv.check_type('directory', directory, str) # Make directory if it does not exist diff --git a/openmc/mgxs/mdgxs.py b/openmc/mgxs/mdgxs.py index b95a4fbc0..c12c1a9ab 100644 --- a/openmc/mgxs/mdgxs.py +++ b/openmc/mgxs/mdgxs.py @@ -7,6 +7,7 @@ import numpy as np import openmc import openmc.checkvalue as cv +from openmc.checkvalue import PathLike from openmc.mgxs import MGXS from .mgxs import _DOMAIN_TO_FILTER @@ -722,7 +723,7 @@ class MDGXS(MGXS): """ - cv.check_type('filename', filename, str) + cv.check_type('filename', filename, (str, PathLike)) cv.check_type('directory', directory, str) cv.check_value('format', format, ['csv', 'excel', 'pickle', 'latex']) cv.check_value('xs_type', xs_type, ['macro', 'micro']) diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index 1bc7f9387..12b8f6a75 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -2,6 +2,7 @@ import copy from numbers import Integral import os import warnings +from textwrap import dedent import h5py import numpy as np @@ -9,6 +10,7 @@ import numpy as np import openmc from openmc.data import REACTION_MT, REACTION_NAME, FISSION_MTS import openmc.checkvalue as cv +from openmc.checkvalue import PathLike from ..tallies import ESTIMATOR_TYPES from . import EnergyGroups @@ -164,7 +166,7 @@ class MGXS: """ - _params = """ + _params = dedent(""" Parameters ---------- domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh @@ -251,7 +253,7 @@ class MGXS: .. versionadded:: 0.13.1 - """ + """) # Store whether or not the number density should be removed for microscopic # values of this data @@ -1921,7 +1923,7 @@ class MGXS: # Create an HDF5 group for the subdomain if self.domain_type == 'distribcell': - group_name = ''.zfill(num_digits) + group_name = str(subdomain).zfill(num_digits) subdomain_group = domain_group.require_group(group_name) else: subdomain_group = domain_group @@ -1981,7 +1983,7 @@ class MGXS: """ - cv.check_type('filename', filename, str) + cv.check_type('filename', filename, (str, PathLike)) cv.check_type('directory', directory, str) cv.check_value('format', format, ['csv', 'excel', 'pickle', 'latex']) cv.check_value('xs_type', xs_type, ['macro', 'micro']) @@ -2125,8 +2127,8 @@ class MGXS: df['std. dev.'] /= np.tile(densities, tile_factor) # Replace NaNs by zeros (happens if nuclide density is zero) - df['mean'].replace(np.nan, 0.0, inplace=True) - df['std. dev.'].replace(np.nan, 0.0, inplace=True) + df['mean'] = df['mean'].replace(np.nan, 0.0) + df['std. dev.'] = df['std. dev.'].replace(np.nan, 0.0) # Sort the dataframe by domain type id (e.g., distribcell id) and # energy groups such that data is from fast to thermal diff --git a/openmc/mgxs_library.py b/openmc/mgxs_library.py index b840563cf..c1a15998e 100644 --- a/openmc/mgxs_library.py +++ b/openmc/mgxs_library.py @@ -11,7 +11,7 @@ import openmc import openmc.mgxs from openmc.mgxs import SCATTER_TABULAR, SCATTER_LEGENDRE, SCATTER_HISTOGRAM from .checkvalue import check_type, check_value, check_greater_than, \ - check_iterable_type, check_less_than, check_filetype_version + check_iterable_type, check_less_than, check_filetype_version, PathLike ROOM_TEMPERATURE_KELVIN = 294.0 @@ -484,7 +484,8 @@ class XSdata: check_type('temperature', temperature, Real) - temp_store = self.temperatures.tolist().append(temperature) + temp_store = self.temperatures.tolist() + temp_store.append(temperature) self.temperatures = temp_store self._total.append(None) @@ -2506,7 +2507,7 @@ class MGXSLibrary: Parameters ---------- - filename : str + filename : str or PathLike Filename of file, default is mgxs.h5. libver : {'earliest', 'latest'} Compatibility mode for the HDF5 file. 'latest' will produce files @@ -2514,8 +2515,7 @@ class MGXSLibrary: """ - check_type('filename', filename, str) - + check_type('filename', filename, (str, PathLike)) # Create and write to the HDF5 file file = h5py.File(filename, "w", libver=libver) file.attrs['filetype'] = np.bytes_(_FILETYPE_MGXS_LIBRARY) @@ -2554,21 +2554,21 @@ class MGXSLibrary: raise ValueError("Either path or openmc.config['mg_cross_sections']" "must be set") - check_type('filename', filename, str) - file = h5py.File(filename, 'r') + check_type('filename', filename, (str, PathLike)) + with h5py.File(filename, 'r') as file: - # Check filetype and version - check_filetype_version(file, _FILETYPE_MGXS_LIBRARY, - _VERSION_MGXS_LIBRARY) + # Check filetype and version + check_filetype_version(file, _FILETYPE_MGXS_LIBRARY, + _VERSION_MGXS_LIBRARY) - group_structure = file.attrs['group structure'] - num_delayed_groups = file.attrs['delayed_groups'] - energy_groups = openmc.mgxs.EnergyGroups(group_structure) - data = cls(energy_groups, num_delayed_groups) + group_structure = file.attrs['group structure'] + num_delayed_groups = file.attrs['delayed_groups'] + energy_groups = openmc.mgxs.EnergyGroups(group_structure) + data = cls(energy_groups, num_delayed_groups) - for group_name, group in file.items(): - data.add_xsdata(openmc.XSdata.from_hdf5(group, group_name, - energy_groups, - num_delayed_groups)) + for group_name, group in file.items(): + data.add_xsdata(openmc.XSdata.from_hdf5(group, group_name, + energy_groups, + num_delayed_groups)) return data diff --git a/openmc/model/funcs.py b/openmc/model/funcs.py index 41aa920ea..e076b080a 100644 --- a/openmc/model/funcs.py +++ b/openmc/model/funcs.py @@ -39,8 +39,8 @@ def borated_water(boron_ppm, temperature=293., pressure=0.1013, temp_unit='K', press_unit : {'MPa', 'psi'} The units used for the `pressure` argument. density : float - Water density in [g / cm^3]. If specified, this value overrides the - temperature and pressure arguments. + Water density in [g / cm^3]. If specified, this value overrides + the value that is computed from the temperature and pressure arguments. **kwargs All keyword arguments are passed to the created Material object. @@ -95,10 +95,7 @@ def borated_water(boron_ppm, temperature=293., pressure=0.1013, temp_unit='K', frac_B = boron_ppm * 1e-6 / M_B # Build the material. - if density is None: - out = openmc.Material(temperature=T, **kwargs) - else: - out = openmc.Material(**kwargs) + out = openmc.Material(temperature=T, **kwargs) out.add_element('H', frac_H, 'ao') out.add_element('O', frac_O, 'ao') out.add_element('B', frac_B, 'ao') diff --git a/openmc/model/model.py b/openmc/model/model.py index e8558f4ad..6e4c1c585 100644 --- a/openmc/model/model.py +++ b/openmc/model/model.py @@ -1,15 +1,21 @@ from __future__ import annotations -from collections.abc import Iterable, Sequence -from functools import lru_cache +from collections.abc import Callable, Iterable, Sequence +import copy +from dataclasses import dataclass, field +from functools import cache from pathlib import Path import math from numbers import Integral, Real +import random +import re from tempfile import NamedTemporaryFile, TemporaryDirectory +from typing import Any, Protocol import warnings import h5py import lxml.etree as ET import numpy as np +from scipy.optimize import curve_fit import openmc import openmc._xml as xml @@ -17,10 +23,16 @@ from openmc.dummy_comm import DummyCommunicator from openmc.executor import _process_CLI_arguments from openmc.checkvalue import check_type, check_value, PathLike from openmc.exceptions import InvalidIDError -from openmc.plots import add_plot_params +from openmc.plots import add_plot_params, _BASIS_INDICES, id_map_to_rgb from openmc.utility_funcs import change_directory +# Protocol for a function that is passed to search_keff +class ModelModifier(Protocol): + def __call__(self, val: float, **kwargs: Any) -> None: + ... + + class Model: """Model container. @@ -64,8 +76,14 @@ class Model: """ - def __init__(self, geometry=None, materials=None, settings=None, - tallies=None, plots=None): + def __init__( + self, + geometry: openmc.Geometry | None = None, + materials: openmc.Materials | None = None, + settings: openmc.Settings | None = None, + tallies: openmc.Tallies | None = None, + plots: openmc.Plots | None = None, + ): self.geometry = openmc.Geometry() if geometry is None else geometry self.materials = openmc.Materials() if materials is None else materials self.settings = openmc.Settings() if settings is None else settings @@ -73,7 +91,7 @@ class Model: self.plots = openmc.Plots() if plots is None else plots @property - def geometry(self) -> openmc.Geometry | None: + def geometry(self) -> openmc.Geometry: return self._geometry @geometry.setter @@ -82,7 +100,7 @@ class Model: self._geometry = geometry @property - def materials(self) -> openmc.Materials | None: + def materials(self) -> openmc.Materials: return self._materials @materials.setter @@ -91,12 +109,14 @@ class Model: if isinstance(materials, openmc.Materials): self._materials = materials else: + if not hasattr(self, '_materials'): + self._materials = openmc.Materials() del self._materials[:] for mat in materials: self._materials.append(mat) @property - def settings(self) -> openmc.Settings | None: + def settings(self) -> openmc.Settings: return self._settings @settings.setter @@ -105,7 +125,7 @@ class Model: self._settings = settings @property - def tallies(self) -> openmc.Tallies | None: + def tallies(self) -> openmc.Tallies: return self._tallies @tallies.setter @@ -114,12 +134,14 @@ class Model: if isinstance(tallies, openmc.Tallies): self._tallies = tallies else: + if not hasattr(self, '_tallies'): + self._tallies = openmc.Tallies() del self._tallies[:] for tally in tallies: self._tallies.append(tally) @property - def plots(self) -> openmc.Plots | None: + def plots(self) -> openmc.Plots: return self._plots @plots.setter @@ -128,6 +150,8 @@ class Model: if isinstance(plots, openmc.Plots): self._plots = plots else: + if not hasattr(self, '_plots'): + self._plots = openmc.Plots() del self._plots[:] for plot in plots: self._plots.append(plot) @@ -145,7 +169,7 @@ class Model: return False @property - @lru_cache(maxsize=None) + @cache def _materials_by_id(self) -> dict: """Dictionary mapping material ID --> material""" if self.materials: @@ -155,14 +179,14 @@ class Model: return {mat.id: mat for mat in mats} @property - @lru_cache(maxsize=None) + @cache def _cells_by_id(self) -> dict: """Dictionary mapping cell ID --> cell""" cells = self.geometry.get_all_cells() return {cell.id: cell for cell in cells.values()} @property - @lru_cache(maxsize=None) + @cache def _cells_by_name(self) -> dict[int, openmc.Cell]: # Get the names maps, but since names are not unique, store a set for # each name key. In this way when the user requests a change by a name, @@ -175,7 +199,7 @@ class Model: return result @property - @lru_cache(maxsize=None) + @cache def _materials_by_name(self) -> dict[int, openmc.Material]: if self.materials is None: mats = self.geometry.get_all_materials().values() @@ -188,25 +212,84 @@ class Model: result[mat.name].add(mat) return result + # TODO: This should really get incorporated in lower-level calls to + # get_all_materials, but right now it requires information from the Model object + def _get_all_materials(self) -> dict[int, openmc.Material]: + """Get all materials including those in DAGMC universes + + Returns + ------- + dict + Dictionary mapping material ID to material instances + """ + # Get all materials from the Geometry object + materials = self.geometry.get_all_materials() + + # Account for materials in DAGMC universes + for cell in self.geometry.get_all_cells().values(): + if isinstance(cell.fill, openmc.DAGMCUniverse): + names = cell.fill.material_names + materials.update({ + mat.id: mat for mat in self.materials if mat.name in names + }) + + return materials + + def add_kinetics_parameters_tallies(self, num_groups: int | None = None): + """Add tallies for calculating kinetics parameters using the IFP method. + + This method adds tallies to the model for calculating two kinetics + parameters, the generation time and the effective delayed neutron + fraction (beta effective). After a model is run, these parameters can be + determined through the :meth:`openmc.StatePoint.ifp_results` method. + + Parameters + ---------- + num_groups : int, optional + Number of precursor groups to filter the delayed neutron fraction. + If None, only the total effective delayed neutron fraction is + tallied. + + """ + if not any('ifp-time-numerator' in t.scores for t in self.tallies): + gen_time_tally = openmc.Tally(name='IFP time numerator') + gen_time_tally.scores = ['ifp-time-numerator'] + self.tallies.append(gen_time_tally) + if not any('ifp-beta-numerator' in t.scores for t in self.tallies): + beta_tally = openmc.Tally(name='IFP beta numerator') + beta_tally.scores = ['ifp-beta-numerator'] + if num_groups is not None: + beta_tally.filters = [openmc.DelayedGroupFilter(list(range(1, num_groups + 1)))] + self.tallies.append(beta_tally) + if not any('ifp-denominator' in t.scores for t in self.tallies): + denom_tally = openmc.Tally(name='IFP denominator') + denom_tally.scores = ['ifp-denominator'] + self.tallies.append(denom_tally) + @classmethod - def from_xml(cls, geometry='geometry.xml', materials='materials.xml', - settings='settings.xml', tallies='tallies.xml', - plots='plots.xml') -> Model: + def from_xml( + cls, + geometry: PathLike = "geometry.xml", + materials: PathLike = "materials.xml", + settings: PathLike = "settings.xml", + tallies: PathLike = "tallies.xml", + plots: PathLike = "plots.xml", + ) -> Model: """Create model from existing XML files Parameters ---------- - geometry : str + geometry : PathLike Path to geometry.xml file - materials : str + materials : PathLike Path to materials.xml file - settings : str + settings : PathLike Path to settings.xml file - tallies : str + tallies : PathLike Path to tallies.xml file .. versionadded:: 0.13.0 - plots : str + plots : PathLike Path to plots.xml file .. versionadded:: 0.13.0 @@ -226,14 +309,14 @@ class Model: return cls(geometry, materials, settings, tallies, plots) @classmethod - def from_model_xml(cls, path='model.xml'): + def from_model_xml(cls, path: PathLike = "model.xml") -> Model: """Create model from single XML file .. versionadded:: 0.13.3 Parameters ---------- - path : str or PathLike + path : PathLike Path to model.xml file """ parser = ET.XMLParser(huge_tree=True) @@ -259,8 +342,17 @@ class Model: return model - def init_lib(self, threads=None, geometry_debug=False, restart_file=None, - tracks=False, output=True, event_based=None, intracomm=None): + def init_lib( + self, + threads: int | None = None, + geometry_debug: bool = False, + restart_file: PathLike | None = None, + tracks: bool = False, + output: bool = True, + event_based: bool | None = None, + intracomm=None, + directory: PathLike | None = None, + ): """Initializes the model in memory via the C API .. versionadded:: 0.13.0 @@ -275,7 +367,7 @@ class Model: variable). geometry_debug : bool, optional Turn on geometry debugging during simulation. Defaults to False. - restart_file : str, optional + restart_file : PathLike, optional Path to restart file to use tracks : bool, optional Enables the writing of particles tracks. The number of particle @@ -288,6 +380,8 @@ class Model: the Settings will be used. intracomm : mpi4py.MPI.Intracomm or None, optional MPI intracommunicator + directory : PathLike or None, optional + Directory to write XML files to. Defaults to None. """ import openmc.lib @@ -301,7 +395,8 @@ class Model: args = _process_CLI_arguments( volume=False, geometry_debug=geometry_debug, restart_file=restart_file, threads=threads, tracks=tracks, - event_based=event_based) + event_based=event_based, path_input=directory) + # Args adds the openmc_exec command in the first entry; remove it args = args[1:] @@ -315,7 +410,10 @@ class Model: self._intracomm = DummyCommunicator() if self._intracomm.rank == 0: - self.export_to_xml() + if directory is not None: + self.export_to_xml(directory=directory) + else: + self.export_to_xml() self._intracomm.barrier() # We cannot pass DummyCommunicator to openmc.lib.init so pass instead @@ -356,9 +454,15 @@ class Model: openmc.lib.finalize() - def deplete(self, timesteps, method='cecm', final_step=True, - operator_kwargs=None, directory='.', output=True, - **integrator_kwargs): + def deplete( + self, + method: str = "cecm", + final_step: bool = True, + operator_kwargs: dict | None = None, + directory: PathLike = ".", + output: bool = True, + **integrator_kwargs, + ): """Deplete model using specified timesteps/power .. versionchanged:: 0.13.0 @@ -367,10 +471,12 @@ class Model: Parameters ---------- - timesteps : iterable of float - Array of timesteps in units of [s]. Note that values are not - cumulative. - method : str, optional + timesteps : iterable of float or iterable of tuple + Array of timesteps. Note that values are not cumulative. The units are + specified by the `timestep_units` argument when `timesteps` is an + iterable of float. Alternatively, units can be specified for each step + by passing an iterable of (value, unit) tuples. + method : str Integration method used for depletion (e.g., 'cecm', 'predictor'). Defaults to 'cecm'. final_step : bool, optional @@ -379,14 +485,14 @@ class Model: operator_kwargs : dict Keyword arguments passed to the depletion operator initializer (e.g., :func:`openmc.deplete.Operator`) - directory : str, optional + directory : PathLike, optional Directory to write XML files to. If it doesn't exist already, it will be created. Defaults to the current working directory output : bool Capture OpenMC output from standard out integrator_kwargs : dict - Remaining keyword arguments passed to the depletion Integrator - initializer (e.g., :func:`openmc.deplete.integrator.cecm`). + Remaining keyword arguments passed to the depletion integrator + (e.g., :class:`openmc.deplete.CECMIntegrator`). """ @@ -417,8 +523,7 @@ class Model: check_value('method', method, dep.integrators.integrator_by_name.keys()) integrator_class = dep.integrators.integrator_by_name[method] - integrator = integrator_class(depletion_operator, timesteps, - **integrator_kwargs) + integrator = integrator_class(depletion_operator, **integrator_kwargs) # Now perform the depletion with openmc.lib.quiet_dll(output): @@ -441,13 +546,20 @@ class Model: depletion_operator.cleanup_when_done = True depletion_operator.finalize() + def _link_geometry_to_filters(self): + """Establishes a link between distribcell filters and the geometry""" + for tally in self.tallies: + for f in tally.filters: + if isinstance(f, openmc.DistribcellFilter): + f._geometry = self.geometry + def export_to_xml(self, directory: PathLike = '.', remove_surfs: bool = False, nuclides_to_ignore: Iterable[str] | None = None): """Export model to separate XML files. Parameters ---------- - directory : str + directory : PathLike Directory to write XML files to. If it doesn't exist already, it will be created. remove_surfs : bool @@ -482,6 +594,8 @@ class Model: if self.plots: self.plots.export_to_xml(d) + self._link_geometry_to_filters() + def export_to_model_xml(self, path: PathLike = 'model.xml', remove_surfs: bool = False, nuclides_to_ignore: Iterable[str] | None = None): """Export model to a single XML file. @@ -561,7 +675,9 @@ class Model: fh.write(ET.tostring(plots_element, encoding="unicode")) fh.write("\n") - def import_properties(self, filename): + self._link_geometry_to_filters() + + def import_properties(self, filename: PathLike): """Import physical properties .. versionchanged:: 0.13.0 @@ -569,7 +685,7 @@ class Model: Parameters ---------- - filename : str + filename : PathLike Path to properties HDF5 file See Also @@ -591,7 +707,7 @@ class Model: raise ValueError("Number of cells in properties file doesn't " "match current model.") - # Update temperatures for cells filled with materials + # Update temperatures and densities for cells filled with materials for name, group in cells_group.items(): cell_id = int(name.split()[1]) cell = cells[cell_id] @@ -606,6 +722,20 @@ class Model: else: lib_cell.set_temperature(temperature[0]) + if group['density']: + density = group['density'][()] + if density.size > 1: + cell.density = [rho for rho in density] + else: + cell.density = density + if self.is_initialized: + lib_cell = openmc.lib.cells[cell_id] + if density.size > 1: + for i, rho in enumerate(density): + lib_cell.set_density(rho, i) + else: + lib_cell.set_density(density[0]) + # Make sure number of materials matches mats_group = fh['materials'] n_cells = mats_group.attrs['n_materials'] @@ -622,11 +752,22 @@ class Model: C_mat = openmc.lib.materials[mat_id] C_mat.set_density(atom_density, 'atom/b-cm') - def run(self, particles=None, threads=None, geometry_debug=False, - restart_file=None, tracks=False, output=True, cwd='.', - openmc_exec='openmc', mpi_args=None, event_based=None, - export_model_xml=True, apply_tally_results=False, - **export_kwargs): + def run( + self, + particles: int | None = None, + threads: int | None = None, + geometry_debug: bool = False, + restart_file: PathLike | None = None, + tracks: bool = False, + output: bool = True, + cwd: PathLike = ".", + openmc_exec: PathLike = "openmc", + mpi_args: Iterable[str] = None, + event_based: bool | None = None, + export_model_xml: bool = True, + apply_tally_results: bool = False, + **export_kwargs, + ) -> Path: """Run OpenMC If the C API has been initialized, then the C API is used, otherwise, @@ -758,10 +899,17 @@ class Model: return last_statepoint - def calculate_volumes(self, threads=None, output=True, cwd='.', - openmc_exec='openmc', mpi_args=None, - apply_volumes=True, export_model_xml=True, - **export_kwargs): + def calculate_volumes( + self, + threads: int | None = None, + output: bool = True, + cwd: PathLike = ".", + openmc_exec: PathLike = "openmc", + mpi_args: list[str] | None = None, + apply_volumes: bool = True, + export_model_xml: bool = True, + **export_kwargs, + ): """Runs an OpenMC stochastic volume calculation and, if requested, applies volumes to the model @@ -848,59 +996,15 @@ class Model: openmc.lib.materials[domain_id].volume = \ vol_calc.volumes[domain_id].n - @add_plot_params - def plot( + + def _set_plot_defaults( self, - origin: Sequence[float] | None = None, - width: Sequence[float] | None = None, - pixels: int | Sequence[int] = 40000, - basis: str = 'xy', - color_by: str = 'cell', - colors: dict | None = None, - seed: int | None = None, - openmc_exec: PathLike = 'openmc', - axes=None, - legend: bool = False, - axis_units: str = 'cm', - outline: bool | str = False, - show_overlaps: bool = False, - overlap_color: Sequence[int] | str | None = None, - n_samples: int | None = None, - plane_tolerance: float = 1., - legend_kwargs: dict | None = None, - source_kwargs: dict | None = None, - contour_kwargs: dict | None = None, - **kwargs, + origin: Sequence[float] | None, + width: Sequence[float] | None, + pixels: int | Sequence[int], + basis: str ): - """Display a slice plot of the model. - - .. versionadded:: 0.15.1 - """ - import matplotlib.image as mpimg - import matplotlib.patches as mpatches - import matplotlib.pyplot as plt - - check_type('n_samples', n_samples, int | None) - check_type('plane_tolerance', plane_tolerance, Real) - if legend_kwargs is None: - legend_kwargs = {} - legend_kwargs.setdefault('bbox_to_anchor', (1.05, 1)) - legend_kwargs.setdefault('loc', 2) - legend_kwargs.setdefault('borderaxespad', 0.0) - if source_kwargs is None: - source_kwargs = {} - source_kwargs.setdefault('marker', 'x') - - # Determine extents of plot - if basis == 'xy': - x, y, z = 0, 1, 2 - xlabel, ylabel = f'x [{axis_units}]', f'y [{axis_units}]' - elif basis == 'yz': - x, y, z = 1, 2, 0 - xlabel, ylabel = f'y [{axis_units}]', f'z [{axis_units}]' - elif basis == 'xz': - x, y, z = 0, 2, 1 - xlabel, ylabel = f'x [{axis_units}]', f'z [{axis_units}]' + x, y, _ = _BASIS_INDICES[basis] bb = self.bounding_box # checks to see if bounding box contains -inf or inf values @@ -925,6 +1029,130 @@ class Model: pixels_y = math.sqrt(pixels / aspect_ratio) pixels = (int(pixels / pixels_y), int(pixels_y)) + return origin, width, pixels + + def id_map( + self, + origin: Sequence[float] | None = None, + width: Sequence[float] | None = None, + pixels: int | Sequence[int] = 40000, + basis: str = 'xy', + color_overlaps: bool = False, + **init_kwargs + ) -> np.ndarray: + """Generate an ID map for domains based on the plot parameters + + If the model is not yet initialized, it will be initialized with + openmc.lib. If the model is initialized, the model will remain + initialized after this method call exits. + + .. versionadded:: 0.15.3 + + Parameters + ---------- + origin : Sequence[float], optional + Origin of the plot. If unspecified, this argument defaults to the + center of the bounding box if the bounding box does not contain inf + values for the provided basis, otherwise (0.0, 0.0, 0.0). + width : Sequence[float], optional + Width of the plot. If unspecified, this argument defaults to the + width of the bounding box if the bounding box does not contain inf + values for the provided basis, otherwise (10.0, 10.0). + pixels : int | Sequence[int], optional + If an iterable of ints is provided then this directly sets the + number of pixels to use in each basis direction. If a single int is + provided then this sets the total number of pixels in the plot and + the number of pixels in each basis direction is calculated from this + total and the image aspect ratio based on the width argument. + basis : {'xy', 'yz', 'xz'}, optional + Basis of the plot. + color_overlaps : bool, optional + Whether to assign unique IDs (-3) to overlapping regions. If False, + overlapping regions will be assigned the ID of the lowest-numbered + cell that occupies that region. Defaults to False. + **init_kwargs + Keyword arguments passed to :meth:`Model.init_lib`. + + Returns + ------- + id_map : numpy.ndarray + A NumPy array with shape (vertical pixels, horizontal pixels, 3) of + OpenMC property IDs with dtype int32. The last dimension of the + array contains cell IDs, cell instances, and material IDs (in that + order). + """ + import openmc.lib + + origin, width, pixels = self._set_plot_defaults( + origin, width, pixels, basis) + + # initialize the openmc.lib.plot._PlotBase object + plot_obj = openmc.lib.plot._PlotBase() + plot_obj.origin = origin + plot_obj.width = width[0] + plot_obj.height = width[1] + plot_obj.h_res = pixels[0] + plot_obj.v_res = pixels[1] + plot_obj.basis = basis + plot_obj.color_overlaps = color_overlaps + + # Silence output by default. Also set arguments to start in volume + # calculation mode to avoid loading cross sections + init_kwargs.setdefault('output', False) + init_kwargs.setdefault('args', ['-c']) + + with openmc.lib.TemporarySession(self, **init_kwargs): + return openmc.lib.id_map(plot_obj) + + @add_plot_params + def plot( + self, + origin: Sequence[float] | None = None, + width: Sequence[float] | None = None, + pixels: int | Sequence[int] = 40000, + basis: str = 'xy', + color_by: str = 'cell', + colors: dict | None = None, + seed: int | None = None, + axes=None, + legend: bool = False, + axis_units: str = 'cm', + outline: bool | str = False, + show_overlaps: bool = False, + overlap_color: Sequence[int] | str = (255, 0, 0), + n_samples: int | None = None, + plane_tolerance: float = 1., + legend_kwargs: dict | None = None, + source_kwargs: dict | None = None, + contour_kwargs: dict | None = None, + **kwargs, + ): + """Display a slice plot of the model. + + .. versionadded:: 0.15.1 + """ + import matplotlib.patches as mpatches + import matplotlib.pyplot as plt + + check_type('n_samples', n_samples, int | None) + check_type('plane_tolerance', plane_tolerance, Real) + if legend_kwargs is None: + legend_kwargs = {} + legend_kwargs.setdefault('bbox_to_anchor', (1.05, 1)) + legend_kwargs.setdefault('loc', 2) + legend_kwargs.setdefault('borderaxespad', 0.0) + if source_kwargs is None: + source_kwargs = {} + source_kwargs.setdefault('marker', 'x') + + # Set indices using basis and create axis labels + x, y, z = _BASIS_INDICES[basis] + xlabel, ylabel = f'{basis[0]} [{axis_units}]', f'{basis[1]} [{axis_units}]' + + # Determine extents of plot + origin, width, pixels = self._set_plot_defaults( + origin, width, pixels, basis) + axis_scaling_factor = {'km': 0.00001, 'm': 0.01, 'cm': 1, 'mm': 10} x_min = (origin[x] - 0.5*width[0]) * axis_scaling_factor[axis_units] @@ -932,111 +1160,108 @@ class Model: y_min = (origin[y] - 0.5*width[1]) * axis_scaling_factor[axis_units] y_max = (origin[y] + 0.5*width[1]) * axis_scaling_factor[axis_units] - with TemporaryDirectory() as tmpdir: - if seed is not None: - self.settings.plot_seed = seed + # Get ID map from the C API + id_map = self.id_map( + origin=origin, + width=width, + pixels=pixels, + basis=basis, + color_overlaps=show_overlaps + ) - # Create plot object matching passed arguments - plot = openmc.Plot() - plot.origin = origin - plot.width = width - plot.pixels = pixels - plot.basis = basis + # Generate colors if not provided + if colors is None and seed is not None: + # Use the colorize method to generate random colors + plot = openmc.SlicePlot() plot.color_by = color_by - plot.show_overlaps = show_overlaps - if overlap_color is not None: - plot.overlap_color = overlap_color - if colors is not None: - plot.colors = colors - self.plots.append(plot) + plot.colorize(self.geometry, seed=seed) + colors = plot.colors - # Run OpenMC in geometry plotting mode - self.plot_geometry(False, cwd=tmpdir, openmc_exec=openmc_exec) + # Convert ID map to RGB image + img = id_map_to_rgb( + id_map=id_map, + color_by=color_by, + colors=colors, + overlap_color=overlap_color + ) - # Read image from file - img_path = Path(tmpdir) / f'plot_{plot.id}.png' - if not img_path.is_file(): - img_path = img_path.with_suffix('.ppm') - img = mpimg.imread(str(img_path)) + # Create a figure sized such that the size of the axes within + # exactly matches the number of pixels specified + if axes is None: + px = 1/plt.rcParams['figure.dpi'] + fig, axes = plt.subplots() + axes.set_xlabel(xlabel) + axes.set_ylabel(ylabel) + params = fig.subplotpars + width_px = pixels[0]*px/(params.right - params.left) + height_px = pixels[1]*px/(params.top - params.bottom) + fig.set_size_inches(width_px, height_px) - # Create a figure sized such that the size of the axes within - # exactly matches the number of pixels specified - if axes is None: - px = 1/plt.rcParams['figure.dpi'] - fig, axes = plt.subplots() - axes.set_xlabel(xlabel) - axes.set_ylabel(ylabel) - params = fig.subplotpars - width = pixels[0]*px/(params.right - params.left) - height = pixels[1]*px/(params.top - params.bottom) - fig.set_size_inches(width, height) + if outline: + # Combine R, G, B values into a single int for contour detection + rgb = (img * 256).astype(int) + image_value = (rgb[..., 0] << 16) + \ + (rgb[..., 1] << 8) + (rgb[..., 2]) - if outline: - # Combine R, G, B values into a single int - rgb = (img * 256).astype(int) - image_value = (rgb[..., 0] << 16) + \ - (rgb[..., 1] << 8) + (rgb[..., 2]) + # Set default arguments for contour() + if contour_kwargs is None: + contour_kwargs = {} + contour_kwargs.setdefault('colors', 'k') + contour_kwargs.setdefault('linestyles', 'solid') + contour_kwargs.setdefault('algorithm', 'serial') - # Set default arguments for contour() - if contour_kwargs is None: - contour_kwargs = {} - contour_kwargs.setdefault('colors', 'k') - contour_kwargs.setdefault('linestyles', 'solid') - contour_kwargs.setdefault('algorithm', 'serial') + axes.contour( + image_value, + origin="upper", + levels=np.unique(image_value), + extent=(x_min, x_max, y_min, y_max), + **contour_kwargs + ) + + # If only showing outline, set the axis limits and aspect explicitly + if outline == 'only': + axes.set_xlim(x_min, x_max) + axes.set_ylim(y_min, y_max) + axes.set_aspect('equal') - axes.contour( - image_value, - origin="upper", - levels=np.unique(image_value), - extent=(x_min, x_max, y_min, y_max), - **contour_kwargs - ) + # Add legend showing which colors represent which material or cell + if legend: + if colors is None or len(colors) == 0: + raise ValueError("Must pass 'colors' dictionary if you " + "are adding a legend via legend=True.") - # add legend showing which colors represent which material - # or cell if that was requested - if legend: - if plot.colors == {}: - raise ValueError("Must pass 'colors' dictionary if you " - "are adding a legend via legend=True.") + if color_by == "cell": + expected_key_type = openmc.Cell + else: + expected_key_type = openmc.Material - if color_by == "cell": - expected_key_type = openmc.Cell + patches = [] + for key, color in colors.items(): + if isinstance(key, int): + raise TypeError( + "Cannot use IDs in colors dict for auto legend.") + elif not isinstance(key, expected_key_type): + raise TypeError( + "Color dict key type does not match color_by") + + # this works whether we're doing cells or materials + label = key.name if key.name != '' else key.id + + # matplotlib takes RGB on 0-1 scale rather than 0-255 + if len(color) == 3 and not isinstance(color, str): + scaled_color = ( + color[0]/255, color[1]/255, color[2]/255) else: - expected_key_type = openmc.Material + scaled_color = color - patches = [] - for key, color in plot.colors.items(): + key_patch = mpatches.Patch(color=scaled_color, label=label) + patches.append(key_patch) - if isinstance(key, int): - raise TypeError( - "Cannot use IDs in colors dict for auto legend.") - elif not isinstance(key, expected_key_type): - raise TypeError( - "Color dict key type does not match color_by") - - # this works whether we're doing cells or materials - label = key.name if key.name != '' else key.id - - # matplotlib takes RGB on 0-1 scale rather than 0-255. at - # this point PlotBase has already checked that 3-tuple - # based colors are already valid, so if the length is three - # then we know it just needs to be converted to the 0-1 - # format. - if len(color) == 3 and not isinstance(color, str): - scaled_color = ( - color[0]/255, color[1]/255, color[2]/255) - else: - scaled_color = color - - key_patch = mpatches.Patch(color=scaled_color, label=label) - patches.append(key_patch) - - axes.legend(handles=patches, **legend_kwargs) - - # Plot image and return the axes - if outline != 'only': - axes.imshow(img, extent=(x_min, x_max, y_min, y_max), **kwargs) + axes.legend(handles=patches, **legend_kwargs) + # Plot image and return the axes + if outline != 'only': + axes.imshow(img, extent=(x_min, x_max, y_min, y_max), **kwargs) if n_samples: # Sample external source particles @@ -1049,17 +1274,17 @@ class Model: tol = plane_tolerance for particle in particles: if (slice_value - tol < particle.r[z] < slice_value + tol): - xs.append(particle.r[x]) - ys.append(particle.r[y]) + xs.append(particle.r[x] * axis_scaling_factor[axis_units]) + ys.append(particle.r[y] * axis_scaling_factor[axis_units]) axes.scatter(xs, ys, **source_kwargs) return axes def sample_external_source( - self, - n_samples: int = 1000, - prn_seed: int | None = None, - **init_kwargs + self, + n_samples: int = 1000, + prn_seed: int | None = None, + **init_kwargs ) -> openmc.ParticleList: """Sample external source and return source particles. @@ -1087,15 +1312,10 @@ class Model: init_kwargs.setdefault('output', False) init_kwargs.setdefault('args', ['-c']) - with change_directory(tmpdir=True): - # Export model within temporary directory - self.export_to_model_xml() - - # Sample external source sites - with openmc.lib.run_in_memory(**init_kwargs): - return openmc.lib.sample_external_source( - n_samples=n_samples, prn_seed=prn_seed - ) + with openmc.lib.TemporarySession(self, **init_kwargs): + return openmc.lib.sample_external_source( + n_samples=n_samples, prn_seed=prn_seed + ) def apply_tally_results(self, statepoint: PathLike | openmc.StatePoint): """Apply results from a statepoint to tally objects on the Model @@ -1107,8 +1327,14 @@ class Model: """ self.tallies.add_results(statepoint) - def plot_geometry(self, output=True, cwd='.', openmc_exec='openmc', - export_model_xml=True, **export_kwargs): + def plot_geometry( + self, + output: bool = True, + cwd: PathLike = ".", + openmc_exec: PathLike = "openmc", + export_model_xml: bool = True, + **export_kwargs, + ): """Creates plot images as specified by the Model.plots attribute .. versionadded:: 0.13.0 @@ -1117,10 +1343,10 @@ class Model: ---------- output : bool, optional Capture OpenMC output from standard out - cwd : str, optional + cwd : PathLike, optional Path to working directory to run in. Defaults to the current working directory. - openmc_exec : str, optional + openmc_exec : PathLike, optional Path to OpenMC executable. Defaults to 'openmc'. This only applies to the case when not using the C API. export_model_xml : bool, optional @@ -1150,8 +1376,14 @@ class Model: openmc.plot_geometry(output=output, openmc_exec=openmc_exec, path_input=path_input) - def _change_py_lib_attribs(self, names_or_ids, value, obj_type, - attrib_name, density_units='atom/b-cm'): + def _change_py_lib_attribs( + self, + names_or_ids: Iterable[str] | Iterable[int], + value: float | Iterable[float], + obj_type: str, + attrib_name: str, + density_units: str = "atom/b-cm", + ): # Method to do the same work whether it is a cell or material and # a temperature or volume check_type('names_or_ids', names_or_ids, Iterable, (Integral, str)) @@ -1230,7 +1462,9 @@ class Model: else: setattr(lib_obj, attrib_name, value) - def rotate_cells(self, names_or_ids, vector): + def rotate_cells( + self, names_or_ids: Iterable[str] | Iterable[int], vector: Iterable[float] + ): """Rotate the identified cell(s) by the specified rotation vector. The rotation is only applied to cells filled with a universe. @@ -1252,7 +1486,9 @@ class Model: self._change_py_lib_attribs(names_or_ids, vector, 'cell', 'rotation') - def translate_cells(self, names_or_ids, vector): + def translate_cells( + self, names_or_ids: Iterable[str] | Iterable[int], vector: Iterable[float] + ): """Translate the identified cell(s) by the specified translation vector. The translation is only applied to cells filled with a universe. @@ -1275,7 +1511,12 @@ class Model: self._change_py_lib_attribs(names_or_ids, vector, 'cell', 'translation') - def update_densities(self, names_or_ids, density, density_units='atom/b-cm'): + def update_densities( + self, + names_or_ids: Iterable[str] | Iterable[int], + density: float, + density_units: str = "atom/b-cm", + ): """Update the density of a given set of materials to a new value .. note:: If applying this change to a name that is not unique, then @@ -1298,7 +1539,9 @@ class Model: self._change_py_lib_attribs(names_or_ids, density, 'material', 'density', density_units) - def update_cell_temperatures(self, names_or_ids, temperature): + def update_cell_temperatures( + self, names_or_ids: Iterable[str] | Iterable[int], temperature: float + ): """Update the temperature of a set of cells to the given value .. note:: If applying this change to a name that is not unique, then @@ -1319,7 +1562,9 @@ class Model: self._change_py_lib_attribs(names_or_ids, temperature, 'cell', 'temperature') - def update_material_volumes(self, names_or_ids, volume): + def update_material_volumes( + self, names_or_ids: Iterable[str] | Iterable[int], volume: float + ): """Update the volume of a set of materials to the given value .. note:: If applying this change to a name that is not unique, then @@ -1439,3 +1684,938 @@ class Model: self.materials = openmc.Materials( self.geometry.get_all_materials().values() ) + + def _create_mgxs_sources( + self, + groups: openmc.mgxs.EnergyGroups, + spatial_dist: openmc.stats.Spatial, + source_energy: openmc.stats.Univariate | None = None, + ) -> list[openmc.IndependentSource]: + """Create a list of independent sources to use with MGXS generation. + + Note that in all cases, a discrete source that is uniform over all + energy groups is created (strength = 0.01) to ensure that total cross + sections are generated for all energy groups. In the case that the user + has provided a source_energy distribution as an argument, an additional + source (strength = 0.99) is created using that energy distribution. If + the user has not provided a source_energy distribution, but the model + has sources defined, and all of those sources are of IndependentSource + type, then additional sources are created based on the model's existing + sources, keeping their energy distributions but replacing their + spatial/angular distributions, with their combined strength being 0.99. + If the user has not provided a source_energy distribution and no sources + are defined on the model and the run mode is 'eigenvalue', then a + default Watt spectrum source (strength = 0.99) is added. + + Parameters + ---------- + groups : openmc.mgxs.EnergyGroups + Energy group structure for the MGXS. + spatial_dist : openmc.stats.Spatial + Spatial distribution to use for all sources. + source_energy : openmc.stats.Univariate, optional + Energy distribution to use when generating MGXS data, replacing any + existing sources in the model. + + Returns + ------- + list[openmc.IndependentSource] + A list of independent sources to use for MGXS generation. + """ + # Make a discrete source that is uniform over the bins of the group structure + midpoints = [] + strengths = [] + for i in range(groups.num_groups): + bounds = groups.get_group_bounds(i+1) + midpoints.append((bounds[0] + bounds[1]) / 2.0) + strengths.append(1.0) + + uniform_energy = openmc.stats.Discrete(x=midpoints, p=strengths) + uniform_distribution = openmc.IndependentSource(spatial_dist, energy=uniform_energy, strength=0.01) + sources = [uniform_distribution] + + # If the user provided an energy distribution, use that + if source_energy is not None: + user_energy = openmc.IndependentSource( + space=spatial_dist, energy=source_energy, strength=0.99) + sources.append(user_energy) + + # If the user did not provide an energy distribution, create sources + # based on what is in their model, keeping the energy spectrum but + # replacing the spatial/angular distributions. We only do this if ALL + # sources are of IndependentSource type, as we can't pull the energy + # distribution from e.g. CompiledSource or FileSource types. + else: + if self.settings.source is not None: + for src in self.settings.source: + if not isinstance(src, openmc.IndependentSource): + break + else: + n_user_sources = len(self.settings.source) + for src in self.settings.source: + # Create a new IndependentSource with adjusted strength, space, and angle + user_source = openmc.IndependentSource( + space=spatial_dist, + energy=src.energy, + strength=0.99 / n_user_sources + ) + sources.append(user_source) + else: + # No user sources defined. If we are in eigenvalue mode, then use the default Watt spectrum. + if self.settings.run_mode == 'eigenvalue': + watt_energy = openmc.stats.Watt() + watt_source = openmc.IndependentSource( + space=spatial_dist, energy=watt_energy, strength=0.99) + sources.append(watt_source) + + return sources + + def _generate_infinite_medium_mgxs( + self, + groups: openmc.mgxs.EnergyGroups, + nparticles: int, + mgxs_path: PathLike, + correction: str | None, + directory: PathLike, + source_energy: openmc.stats.Univariate | None = None, + ): + """Generate a MGXS library by running multiple OpenMC simulations, each + representing an infinite medium simulation of a single isolated + material. A discrete source is used to sample particles, with an equal + strength spread across each of the energy groups. This is a highly naive + method that ignores all spatial self shielding effects and all resonance + shielding effects between materials. + + Note that in all cases, a discrete source that is uniform over all + energy groups is created (strength = 0.01) to ensure that total cross + sections are generated for all energy groups. In the case that the user + has provided a source_energy distribution as an argument, an additional + source (strength = 0.99) is created using that energy distribution. If + the user has not provided a source_energy distribution, but the model + has sources defined, and all of those sources are of IndependentSource + type, then additional sources are created based on the model's existing + sources, keeping their energy distributions but replacing their + spatial/angular distributions, with their combined strength being 0.99. + If the user has not provided a source_energy distribution and no sources + are defined on the model and the run mode is 'eigenvalue', then a + default Watt spectrum source (strength = 0.99) is added. + + Parameters + ---------- + groups : openmc.mgxs.EnergyGroups + Energy group structure for the MGXS. + nparticles : int + Number of particles to simulate per batch when generating MGXS. + mgxs_path : str + Filename for the MGXS HDF5 file. + correction : str + Transport correction to apply to the MGXS. Options are None and + "P0". + directory : str + Directory to run the simulation in, so as to contain XML files. + source_energy : openmc.stats.Univariate, optional + Energy distribution to use when generating MGXS data, replacing any + existing sources in the model. + """ + mgxs_sets = [] + for material in self.materials: + model = openmc.Model() + + # Set materials on the model + model.materials = [material] + + # Settings + model.settings.batches = 100 + model.settings.particles = nparticles + + model.settings.source = self._create_mgxs_sources( + groups, + spatial_dist=openmc.stats.Point(), + source_energy=source_energy + ) + + model.settings.run_mode = 'fixed source' + model.settings.create_fission_neutrons = False + + model.settings.output = {'summary': True, 'tallies': False} + + # Geometry + box = openmc.model.RectangularPrism( + 100000.0, 100000.0, boundary_type='reflective') + name = material.name + infinite_cell = openmc.Cell(name=name, fill=material, region=-box) + infinite_universe = openmc.Universe(name=name, cells=[infinite_cell]) + model.geometry.root_universe = infinite_universe + + # Add MGXS Tallies + + # Initialize MGXS library with a finished OpenMC geometry object + mgxs_lib = openmc.mgxs.Library(model.geometry) + + # Pick energy group structure + mgxs_lib.energy_groups = groups + + # Disable transport correction + mgxs_lib.correction = correction + + # Specify needed cross sections for random ray + if correction == 'P0': + mgxs_lib.mgxs_types = [ + 'nu-transport', 'absorption', 'nu-fission', 'fission', + 'consistent nu-scatter matrix', 'multiplicity matrix', 'chi' + ] + elif correction is None: + mgxs_lib.mgxs_types = [ + 'total', 'absorption', 'nu-fission', 'fission', + 'consistent nu-scatter matrix', 'multiplicity matrix', 'chi' + ] + + # Specify a "cell" domain type for the cross section tally filters + mgxs_lib.domain_type = "material" + + # Specify the cell domains over which to compute multi-group cross sections + mgxs_lib.domains = model.geometry.get_all_materials().values() + + # Do not compute cross sections on a nuclide-by-nuclide basis + mgxs_lib.by_nuclide = False + + # Check the library - if no errors are raised, then the library is satisfactory. + mgxs_lib.check_library_for_openmc_mgxs() + + # Construct all tallies needed for the multi-group cross section library + mgxs_lib.build_library() + + # Create a "tallies.xml" file for the MGXS Library + mgxs_lib.add_to_tallies(model.tallies, merge=True) + + # Run + statepoint_filename = model.run(cwd=directory) + + # Load MGXS + with openmc.StatePoint(statepoint_filename) as sp: + mgxs_lib.load_from_statepoint(sp) + + # Create a MGXS File which can then be written to disk + mgxs_set = mgxs_lib.get_xsdata(domain=material, xsdata_name=name) + mgxs_sets.append(mgxs_set) + + # Write the file to disk + mgxs_file = openmc.MGXSLibrary(energy_groups=groups) + for mgxs_set in mgxs_sets: + mgxs_file.add_xsdata(mgxs_set) + mgxs_file.export_to_hdf5(mgxs_path) + + @staticmethod + def _create_stochastic_slab_geometry( + materials: Sequence[openmc.Material], + cell_thickness: float = 1.0, + num_repeats: int = 100, + ) -> tuple[openmc.Geometry, openmc.stats.Box]: + """Create a geometry representing a stochastic "sandwich" of materials in a + layered slab geometry. To reduce the impact of the order of materials in + the slab, the materials are applied to 'num_repeats' different randomly + positioned layers of 'cell_thickness' each. + + Parameters + ---------- + materials : list of openmc.Material + List of materials to assign. Each material will appear exactly num_repeats times, + then the ordering is randomly shuffled. + cell_thickness : float, optional + Thickness of each lattice cell in x (default 1.0 cm). + num_repeats : int, optional + Number of repeats for each material (default 100). + + Returns + ------- + geometry : openmc.Geometry + The constructed geometry. + box : openmc.stats.Box + A spatial sampling distribution covering the full slab domain. + """ + if not materials: + raise ValueError("At least one material must be provided.") + + num_materials = len(materials) + total_cells = num_materials * num_repeats + total_width = total_cells * cell_thickness + + # Generate an infinite cell/universe for each material + universes = [] + for i in range(num_materials): + cell = openmc.Cell(fill=materials[i]) + universes.append(openmc.Universe(cells=[cell])) + + # Make a list of randomized material idx assignments for the stochastic slab + assignments = list(range(num_materials)) * num_repeats + random.seed(42) + random.shuffle(assignments) + + # Create a list of the (randomized) universe assignments to be used + # when defining the problem lattice. + lattice_entries = [universes[m] for m in assignments] + + # Create the RectLattice for the 1D material variation in x. + lattice = openmc.RectLattice() + lattice.pitch = (cell_thickness, total_width, total_width) + lattice.lower_left = (0.0, 0.0, 0.0) + lattice.universes = [[lattice_entries]] + lattice.outer = universes[0] + + # Define the six outer surfaces with reflective boundary conditions + rpp = openmc.model.RectangularParallelepiped( + 0.0, total_width, 0.0, total_width, 0.0, total_width, + boundary_type='reflective' + ) + + # Create an outer cell that fills with the lattice. + outer_cell = openmc.Cell(fill=lattice, region=-rpp) + + # Build the geometry + geometry = openmc.Geometry([outer_cell]) + + # Define the spatial distribution that covers the full cubic domain + box = openmc.stats.Box(*outer_cell.bounding_box) + + return geometry, box + + def _generate_stochastic_slab_mgxs( + self, + groups: openmc.mgxs.EnergyGroups, + nparticles: int, + mgxs_path: PathLike, + correction: str | None, + directory: PathLike, + source_energy: openmc.stats.Univariate | None = None, + ) -> None: + """Generate MGXS assuming a stochastic "sandwich" of materials in a layered + slab geometry. While geometry-specific spatial shielding effects are not + captured, this method can be useful when the geometry has materials only + found far from the source region that the "material_wise" method would + not be capable of generating cross sections for. Conversely, this method + will generate cross sections for all materials in the problem regardless + of type. If this is a fixed source problem, a discrete source is used to + sample particles, with an equal strength spread across each of the + energy groups. + + Parameters + ---------- + groups : openmc.mgxs.EnergyGroups + Energy group structure for the MGXS. + nparticles : int + Number of particles to simulate per batch when generating MGXS. + mgxs_path : str + Filename for the MGXS HDF5 file. + correction : str + Transport correction to apply to the MGXS. Options are None and + "P0". + directory : str + Directory to run the simulation in, so as to contain XML files. + source_energy : openmc.stats.Univariate, optional + Energy distribution to use when generating MGXS data, replacing any + existing sources in the model. In all cases, a discrete source that + is uniform over all energy groups is created (strength = 0.01) to + ensure that total cross sections are generated for all energy + groups. In the case that the user has provided a source_energy + distribution as an argument, an additional source (strength = 0.99) + is created using that energy distribution. If the user has not + provided a source_energy distribution, but the model has sources + defined, and all of those sources are of IndependentSource type, + then additional sources are created based on the model's existing + sources, keeping their energy distributions but replacing their + spatial/angular distributions, with their combined strength being + 0.99. If the user has not provided a source_energy distribution and + no sources are defined on the model and the run mode is + 'eigenvalue', then a default Watt spectrum source (strength = 0.99) + is added. + """ + model = openmc.Model() + model.materials = self.materials + + # Settings + model.settings.batches = 200 + model.settings.inactive = 100 + model.settings.particles = nparticles + model.settings.output = {'summary': True, 'tallies': False} + + # Stochastic slab geometry + model.geometry, spatial_distribution = Model._create_stochastic_slab_geometry( + model.materials) + + # Define the sources + model.settings.source = self._create_mgxs_sources( + groups, + spatial_dist=spatial_distribution, + source_energy=source_energy + ) + + model.settings.run_mode = 'fixed source' + model.settings.create_fission_neutrons = False + + model.settings.output = {'summary': True, 'tallies': False} + + # Add MGXS Tallies + + # Initialize MGXS library with a finished OpenMC geometry object + mgxs_lib = openmc.mgxs.Library(model.geometry) + + # Pick energy group structure + mgxs_lib.energy_groups = groups + + # Disable transport correction + mgxs_lib.correction = correction + + # Specify needed cross sections for random ray + if correction == 'P0': + mgxs_lib.mgxs_types = ['nu-transport', 'absorption', 'nu-fission', 'fission', + 'consistent nu-scatter matrix', 'multiplicity matrix', 'chi'] + elif correction is None: + mgxs_lib.mgxs_types = ['total', 'absorption', 'nu-fission', 'fission', + 'consistent nu-scatter matrix', 'multiplicity matrix', 'chi'] + + # Specify a "cell" domain type for the cross section tally filters + mgxs_lib.domain_type = "material" + + # Specify the cell domains over which to compute multi-group cross sections + mgxs_lib.domains = model.geometry.get_all_materials().values() + + # Do not compute cross sections on a nuclide-by-nuclide basis + mgxs_lib.by_nuclide = False + + # Check the library - if no errors are raised, then the library is satisfactory. + mgxs_lib.check_library_for_openmc_mgxs() + + # Construct all tallies needed for the multi-group cross section library + mgxs_lib.build_library() + + # Create a "tallies.xml" file for the MGXS Library + mgxs_lib.add_to_tallies(model.tallies, merge=True) + + # Run + statepoint_filename = model.run(cwd=directory) + + # Load MGXS + with openmc.StatePoint(statepoint_filename) as sp: + mgxs_lib.load_from_statepoint(sp) + + names = [mat.name for mat in mgxs_lib.domains] + + # Create a MGXS File which can then be written to disk + mgxs_file = mgxs_lib.create_mg_library(xs_type='macro', xsdata_names=names) + mgxs_file.export_to_hdf5(mgxs_path) + + def _generate_material_wise_mgxs( + self, + groups: openmc.mgxs.EnergyGroups, + nparticles: int, + mgxs_path: PathLike, + correction: str | None, + directory: PathLike, + ) -> None: + """Generate a material-wise MGXS library for the model by running the + original continuous energy OpenMC simulation of the full material + geometry and source, and tally MGXS data for each material. This method + accurately conserves reaction rates totaled over the entire simulation + domain. However, when the geometry has materials only found far from the + source region, it is possible the Monte Carlo solver may not be able to + score any tallies to these material types, thus resulting in zero cross + section values for these materials. For such cases, the "stochastic + slab" method may be more appropriate. + + Parameters + ---------- + groups : openmc.mgxs.EnergyGroups + Energy group structure for the MGXS. + nparticles : int + Number of particles to simulate per batch when generating MGXS. + mgxs_path : PathLike + Filename for the MGXS HDF5 file. + correction : str + Transport correction to apply to the MGXS. Options are None and + "P0". + directory : PathLike + Directory to run the simulation in, so as to contain XML files. + """ + model = copy.deepcopy(self) + model.tallies = openmc.Tallies() + + # Settings + model.settings.batches = 200 + model.settings.inactive = 100 + model.settings.particles = nparticles + model.settings.output = {'summary': True, 'tallies': False} + + # Add MGXS Tallies + + # Initialize MGXS library with a finished OpenMC geometry object + mgxs_lib = openmc.mgxs.Library(model.geometry) + + # Pick energy group structure + mgxs_lib.energy_groups = groups + + # Disable transport correction + mgxs_lib.correction = correction + + # Specify needed cross sections for random ray + if correction == 'P0': + mgxs_lib.mgxs_types = [ + 'nu-transport', 'absorption', 'nu-fission', 'fission', + 'consistent nu-scatter matrix', 'multiplicity matrix', 'chi' + ] + elif correction is None: + mgxs_lib.mgxs_types = [ + 'total', 'absorption', 'nu-fission', 'fission', + 'consistent nu-scatter matrix', 'multiplicity matrix', 'chi' + ] + + # Specify a "cell" domain type for the cross section tally filters + mgxs_lib.domain_type = "material" + + # Specify the cell domains over which to compute multi-group cross sections + mgxs_lib.domains = model.geometry.get_all_materials().values() + + # Do not compute cross sections on a nuclide-by-nuclide basis + mgxs_lib.by_nuclide = False + + # Check the library - if no errors are raised, then the library is satisfactory. + mgxs_lib.check_library_for_openmc_mgxs() + + # Construct all tallies needed for the multi-group cross section library + mgxs_lib.build_library() + + # Create a "tallies.xml" file for the MGXS Library + mgxs_lib.add_to_tallies(model.tallies, merge=True) + + # Run + statepoint_filename = model.run(cwd=directory) + + # Load MGXS + with openmc.StatePoint(statepoint_filename) as sp: + mgxs_lib.load_from_statepoint(sp) + + names = [mat.name for mat in mgxs_lib.domains] + + # Create a MGXS File which can then be written to disk + mgxs_file = mgxs_lib.create_mg_library( + xs_type='macro', xsdata_names=names) + mgxs_file.export_to_hdf5(mgxs_path) + + def convert_to_multigroup( + self, + method: str = "material_wise", + groups: str = "CASMO-2", + nparticles: int = 2000, + overwrite_mgxs_library: bool = False, + mgxs_path: PathLike = "mgxs.h5", + correction: str | None = None, + source_energy: openmc.stats.Univariate | None = None, + ): + """Convert all materials from continuous energy to multigroup. + + If no MGXS data library file is found, generate one using one or more + continuous energy Monte Carlo simulations. + + Parameters + ---------- + method : {"material_wise", "stochastic_slab", "infinite_medium"}, optional + Method to generate the MGXS. + groups : openmc.mgxs.EnergyGroups or str, optional + Energy group structure for the MGXS or the name of the group + structure (based on keys from openmc.mgxs.GROUP_STRUCTURES). + nparticles : int, optional + Number of particles to simulate per batch when generating MGXS. + overwrite_mgxs_library : bool, optional + Whether to overwrite an existing MGXS library file. + mgxs_path : str, optional + Path to the mgxs.h5 library file. + correction : str, optional + Transport correction to apply to the MGXS. Options are None and + "P0". + source_energy : openmc.stats.Univariate, optional + Energy distribution to use when generating MGXS data, replacing any + existing sources in the model. In all cases, a discrete source that + is uniform over all energy groups is created (strength = 0.01) to + ensure that total cross sections are generated for all energy + groups. In the case that the user has provided a source_energy + distribution as an argument, an additional source (strength = 0.99) + is created using that energy distribution. If the user has not + provided a source_energy distribution, but the model has sources + defined, and all of those sources are of IndependentSource type, + then additional sources are created based on the model's existing + sources, keeping their energy distributions but replacing their + spatial/angular distributions, with their combined strength being + 0.99. If the user has not provided a source_energy distribution and + no sources are defined on the model and the run mode is + 'eigenvalue', then a default Watt spectrum source (strength = 0.99) + is added. Note that this argument is only used when using the + "stochastic_slab" or "infinite_medium" MGXS generation methods. + """ + if isinstance(groups, str): + groups = openmc.mgxs.EnergyGroups(groups) + + # Do all work (including MGXS generation) in a temporary directory + # to avoid polluting the working directory with residual XML files + with TemporaryDirectory() as tmpdir: + + # Determine if there are DAGMC universes in the model. If so, we need to synchronize + # the dagmc materials with cells. + # TODO: Can this be done without having to init/finalize? + for univ in self.geometry.get_all_universes().values(): + if isinstance(univ, openmc.DAGMCUniverse): + self.init_lib(directory=tmpdir) + self.sync_dagmc_universes() + self.finalize_lib() + break + + # Make sure all materials have a name, and that the name is a valid HDF5 + # dataset name + for material in self.materials: + if not material.name or not material.name.strip(): + material.name = f"material {material.id}" + material.name = re.sub(r'[^a-zA-Z0-9]', '_', material.name) + + # If needed, generate the needed MGXS data library file + if not Path(mgxs_path).is_file() or overwrite_mgxs_library: + if method == "infinite_medium": + self._generate_infinite_medium_mgxs( + groups, nparticles, mgxs_path, correction, tmpdir, source_energy) + elif method == "material_wise": + self._generate_material_wise_mgxs( + groups, nparticles, mgxs_path, correction, tmpdir) + elif method == "stochastic_slab": + self._generate_stochastic_slab_mgxs( + groups, nparticles, mgxs_path, correction, tmpdir, source_energy) + else: + raise ValueError( + f'MGXS generation method "{method}" not recognized') + else: + print(f'Existing MGXS library file "{mgxs_path}" will be used') + + # Convert all continuous energy materials to multigroup + self.materials.cross_sections = mgxs_path + for material in self.materials: + material.set_density('macro', 1.0) + material._nuclides = [] + material._sab = [] + material.add_macroscopic(material.name) + + self.settings.energy_mode = 'multi-group' + + def convert_to_random_ray(self): + """Convert a multigroup model to use random ray. + + This method determines values for the needed settings and adds them to + the settings.random_ray dictionary so as to enable random ray mode. The + settings that are populated are: + + - 'ray_source' (openmc.IndependentSource): Where random ray starting + points are sampled from. + - 'distance_inactive' (float): The "dead zone" distance at the beginning + of the ray. + - 'distance_active' (float): The "active" distance of the ray + - 'particles' (int): Number of rays to simulate + + The method will determine reasonable defaults for each of the above + variables based on analysis of the model's geometry. The function will + have no effect if the random ray dictionary is already defined in the + model settings. + """ + # If the random ray dictionary is already set, don't overwrite it + if self.settings.random_ray: + warnings.warn("Random ray conversion skipped as " + "settings.random_ray dictionary is already set.") + return + + if self.settings.energy_mode != 'multi-group': + raise ValueError( + "Random ray conversion failed: energy mode must be " + "'multi-group'. Use convert_to_multigroup() first." + ) + + # Helper function for detecting infinity + def _replace_infinity(value): + if np.isinf(value): + return 1.0 if value > 0 else -1.0 + return value + + # Get a bounding box for sampling rays. We can utilize the geometry's bounding box + # though for 2D problems we need to detect the infinities and replace them with an + # arbitrary finite value. + bounding_box = self.geometry.bounding_box + lower_left = [_replace_infinity(v) for v in bounding_box.lower_left] + upper_right = [_replace_infinity(v) for v in bounding_box.upper_right] + uniform_dist_ray = openmc.stats.Box(lower_left, upper_right) + rr_source = openmc.IndependentSource(space=uniform_dist_ray) + self.settings.random_ray['ray_source'] = rr_source + + # For the dead zone and active length, a reasonable guess is the larger of either: + # 1) The maximum chord length through the geometry (as defined by its bounding box) + # 2) 30 cm + # Then, set the active length to be 5x longer than the dead zone length, for the sake of efficiency. + chord_length = np.array(upper_right) - np.array(lower_left) + max_length = max(np.linalg.norm(chord_length), 30.0) + + self.settings.random_ray['distance_inactive'] = max_length + self.settings.random_ray['distance_active'] = 5 * max_length + + # Take a wild guess as to how many rays are needed + self.settings.particles = 2 * int(max_length) + + def keff_search( + self, + func: ModelModifier, + x0: float, + x1: float, + target: float = 1.0, + k_tol: float = 1e-4, + sigma_final: float = 3e-4, + p: float = 0.5, + q: float = 0.95, + memory: int = 4, + x_min: float | None = None, + x_max: float | None = None, + b0: int | None = None, + b_min: int = 20, + b_max: int | None = None, + maxiter: int = 50, + output: bool = False, + func_kwargs: dict[str, Any] | None = None, + run_kwargs: dict[str, Any] | None = None, + ) -> SearchResult: + r"""Perform a keff search on a model parametrized by a single variable. + + This method uses the GRsecant method described in a paper by `Price and + Roskoff `_. The GRsecant + method is a modification of the secant method that accounts for + uncertainties in the function evaluations. The method uses a weighted + linear fit of the most recent function evaluations to predict the next + point to evaluate. It also adaptively changes the number of batches to + meet the target uncertainty value at each iteration. + + The target uncertainty for iteration :math:`n+1` is determined by the + following equation (following Eq. (8) in the paper): + + .. math:: + \sigma_{i+1} = q \sigma_\text{final} \left ( \frac{ \min \left \{ + \left\lvert k_i - k_\text{target} \right\rvert : k=0,1,\dots,n + \right \} }{k_\text{tol}} \right )^p + + where :math:`q` is a multiplicative factor less than 1, given as the + ``sigma_factor`` parameter below. + + Parameters + ---------- + func : ModelModifier + Function that takes the parameter to be searched and makes a + modification to the model. + x0 : float + First guess for the parameter passed to `func` + x1 : float + Second guess for the parameter passed to `func` + target : float, optional + keff value to search for + k_tol : float, optional + Stopping criterion on the function value; the absolute value must be + within ``k_tol`` of zero to be accepted. + sigma_final : float, optional + Maximum accepted k-effective uncertainty for the stopping criterion. + p : float, optional + Exponent used in the stopping criterion. + q : float, optional + Multiplicative factor used in the stopping criterion. + memory : int, optional + Number of most-recent points used in the weighted linear fit of + ``f(x) = a + b x`` to predict the next point. + x_min : float, optional + Minimum allowed value for the parameter ``x``. + x_max : float, optional + Maximum allowed value for the parameter ``x``. + b0 : int, optional + Number of active batches to use for the initial function + evaluations. If None, uses the model's current setting. + b_min : int, optional + Minimum number of active batches to use in a function evaluation. + b_max : int, optional + Maximum number of active batches to use in a function evaluation. + maxiter : int, optional + Maximum number of iterations to perform. + output : bool, optional + Whether or not to display output showing iteration progress. + func_kwargs : dict, optional + Keyword-based arguments to pass to the `func` function. + run_kwargs : dict, optional + Keyword arguments to pass to :meth:`openmc.Model.run` or + :meth:`openmc.lib.run`. + + Returns + ------- + SearchResult + Result object containing the estimated root (parameter value) and + evaluation history (parameters, means, standard deviations, and + batches), plus convergence status and termination reason. + + """ + import openmc.lib + + check_type('model modifier', func, Callable) + check_type('target', target, Real) + if memory < 2: + raise ValueError("memory must be ≥ 2") + func_kwargs = {} if func_kwargs is None else dict(func_kwargs) + run_kwargs = {} if run_kwargs is None else dict(run_kwargs) + run_kwargs.setdefault('output', False) + + # Create lists to store the history of evaluations + xs: list[float] = [] + fs: list[float] = [] + ss: list[float] = [] + gs: list[int] = [] + count = 0 + + # Helper function to evaluate f and store results + def eval_at(x: float, batches: int) -> tuple[float, float]: + # Modify the model with the current guess + func(x, **func_kwargs) + + # Change the number of batches and run the model + batches += self.settings.inactive + if openmc.lib.is_initialized: + openmc.lib.settings.set_batches(batches) + openmc.lib.reset() + openmc.lib.run(**run_kwargs) + sp_filepath = f'statepoint.{batches}.h5' + else: + self.settings.batches = batches + sp_filepath = self.run(**run_kwargs) + + # Extract keff and its uncertainty + with openmc.StatePoint(sp_filepath) as sp: + keff = sp.keff + + if output: + nonlocal count + count += 1 + print(f'Iteration {count}: {batches=}, {x=:.6g}, {keff=:.5f}') + + xs.append(float(x)) + fs.append(float(keff.n - target)) + ss.append(float(keff.s)) + gs.append(int(batches)) + return fs[-1], ss[-1] + + # Default b0 to current model settings if not explicitly provided + if b0 is None: + b0 = self.settings.batches - self.settings.inactive + + # Perform the search (inlined GRsecant) in a temporary directory + with TemporaryDirectory() as tmpdir: + if not openmc.lib.is_initialized: + run_kwargs.setdefault('cwd', tmpdir) + + # ---- Seed with two evaluations + f0, s0 = eval_at(x0, b0) + if abs(f0) <= k_tol and s0 <= sigma_final: + return SearchResult(x0, xs, fs, ss, gs, True, "converged") + f1, s1 = eval_at(x1, b0) + if abs(f1) <= k_tol and s1 <= sigma_final: + return SearchResult(x1, xs, fs, ss, gs, True, "converged") + + for _ in range(maxiter - 2): + # ------ Step 1: propose next x via GRsecant + m = min(memory, len(xs)) + + # Perform a curve fit on f(x) = a + bx accounting for + # uncertainties. This is equivalent to minimizing the function + # in Equation (A.14) + (a, b), _ = curve_fit( + lambda x, a, b: a + b*x, + xs[-m:], fs[-m:], sigma=ss[-m:], absolute_sigma=True + ) + x_new = float(-a / b) + + # Clamp x_new to the bounds if provided + if x_min is not None: + x_new = max(x_new, x_min) + if x_max is not None: + x_new = min(x_new, x_max) + + # ------ Step 2: choose target σ for next run (Eq. 8 + clamp) + + min_abs_f = float(np.min(np.abs(fs))) + base = q * sigma_final + ratio = min_abs_f / k_tol if k_tol > 0 else 1.0 + sig = base * (ratio ** p) + sig_target = max(sig, base) + + # ------ Step 3: choose generations to hit σ_target (Appendix C) + + # Use at least two past points for regression + if len(gs) >= 2 and np.var(np.log(gs)) > 0.0: + # Perform a curve fit based on Eq. (C.3) to solve for ln(k). + # Note that unlike in the paper, we do not leave r as an + # undetermined parameter and choose r=0.5. + (ln_k,), _ = curve_fit( + lambda ln_b, ln_k: ln_k - 0.5*ln_b, + np.log(gs[-4:]), np.log(ss[-4:]), + ) + k = float(np.exp(ln_k)) + else: + k = float(ss[-1] * math.sqrt(gs[-1])) + + b_new = (k / sig_target) ** 2 + + # Clamp and round up to integer + b_new = max(b_min, math.ceil(b_new)) + if b_max is not None: + b_new = min(b_new, b_max) + + # Evaluate at proposed x with batches determined above + f_new, s_new = eval_at(x_new, b_new) + + # Termination based on both criteria (|f| and σ) + if abs(f_new) <= k_tol and s_new <= sigma_final: + return SearchResult(x_new, xs, fs, ss, gs, True, "converged") + + return SearchResult(xs[-1], xs, fs, ss, gs, False, "maxiter") + + +@dataclass +class SearchResult: + """Result of a GRsecant keff search. + + Attributes + ---------- + root : float + Estimated parameter value where f(x) = 0 at termination. + parameters : list[float] + Parameter values (x) evaluated during the search, in order. + keffs : list[float] + Estimated keff values for each evaluation. + stdevs : list[float] + One-sigma uncertainties of keff for each evaluation. + batches : list[int] + Number of active batches used for each evaluation. + converged : bool + Whether both |f| <= k_tol and sigma <= sigma_final were met. + flag : str + Reason for termination (e.g., "converged", "maxiter"). + """ + root: float + parameters: list[float] = field(repr=False) + means: list[float] = field(repr=False) + stdevs: list[float] = field(repr=False) + batches: list[int] = field(repr=False) + converged: bool + flag: str + + @property + def function_calls(self) -> int: + """Number of function evaluations performed.""" + return len(self.parameters) + + @property + def total_batches(self) -> int: + """Total number of active batches used across all evaluations.""" + return sum(self.batches) + + diff --git a/openmc/plots.py b/openmc/plots.py index 40fcf0c78..8b67d5cac 100644 --- a/openmc/plots.py +++ b/openmc/plots.py @@ -1,6 +1,8 @@ -from collections.abc import Iterable, Mapping +from collections.abc import Iterable, Mapping, Sequence from numbers import Integral, Real from pathlib import Path +from textwrap import dedent +import warnings import h5py import lxml.etree as ET @@ -10,11 +12,13 @@ import openmc import openmc.checkvalue as cv from openmc.checkvalue import PathLike -from ._xml import clean_indentation, get_elem_tuple, reorder_attributes, get_text +from ._xml import clean_indentation, get_elem_list, get_text from .mixin import IDManagerMixin _BASES = {'xy', 'xz', 'yz'} +_BASIS_INDICES = {'xy': (0, 1, 2), 'xz': (0, 2, 1), 'yz': (1, 2, 0)} + _SVG_COLORS = { 'aliceblue': (240, 248, 255), 'antiquewhite': (250, 235, 215), @@ -165,7 +169,8 @@ _SVG_COLORS = { 'yellowgreen': (154, 205, 50) } -_PLOT_PARAMS = """ +_PLOT_PARAMS = dedent("""\ + Parameters ---------- origin : iterable of float @@ -178,11 +183,12 @@ _PLOT_PARAMS = """ ascertain the plot width. Defaults to (10, 10) if the bounding box contains inf values. pixels : Iterable of int or int - If iterable of ints provided then this directly sets the number of - pixels to use in each basis direction. If int provided then this - sets the total number of pixels in the plot and the number of - pixels in each basis direction is calculated from this total and - the image aspect ratio. + If an iterable of ints is provided then this directly sets the + number of pixels to use in each basis direction. If a single int + is provided then this sets the total number of pixels in the plot + and the number of pixels in each basis direction is calculated + from this total and the image aspect ratio based on the width + argument. basis : {'xy', 'xz', 'yz'} The basis directions for the plot color_by : {'cell', 'material'} @@ -246,7 +252,7 @@ _PLOT_PARAMS = """ ------- matplotlib.axes.Axes Axes containing resulting image -""" +""") # Decorator for consistently adding plot parameters to docstrings (Model.plot, @@ -349,6 +355,86 @@ def voxel_to_vtk(voxel_file: PathLike, output: PathLike = 'plot.vti'): return output +def id_map_to_rgb( + id_map: np.ndarray, + color_by: str = 'cell', + colors: dict | None = None, + overlap_color: Sequence[int] | str = (255, 0, 0) +) -> np.ndarray: + """Convert ID map array to RGB image array. + + Parameters + ---------- + id_map : numpy.ndarray + Array with shape (v_pixels, h_pixels, 3) containing cell IDs, + cell instances, and material IDs + color_by : {'cell', 'material'} + Whether to color by cell or material + colors : dict, optional + Dictionary mapping cells/materials to colors + overlap_color : sequence of int or str, optional + Color to use for overlaps. Defaults to red (255, 0, 0). + + Returns + ------- + numpy.ndarray + RGB image array with shape (v_pixels, h_pixels, 3) with values + in range [0, 1] for matplotlib + """ + # Initialize RGB array with white background (values between 0 and 1 for matplotlib) + img = np.ones(id_map.shape, dtype=float) + + # Get the appropriate index based on color_by + if color_by == 'cell': + id_index = 0 # Cell IDs are in the first channel + elif color_by == 'material': + id_index = 2 # Material IDs are in the third channel + else: + raise ValueError("color_by must be either 'cell' or 'material'") + + # Get all unique IDs in the plot + unique_ids = np.unique(id_map[:, :, id_index]) + + # Generate default colors if not provided + if colors is None: + colors = {} + + # Convert colors dict to use IDs as keys + color_map = {} + for key, color in colors.items(): + if isinstance(key, (openmc.Cell, openmc.Material)): + color_map[key.id] = color + else: + color_map[key] = color + + # Generate random colors for IDs not in color_map + rng = np.random.RandomState(1) + for uid in unique_ids: + if uid > 0 and uid not in color_map: + color_map[uid] = rng.randint(0, 256, (3,)) + + # Apply colors to each pixel + for uid in unique_ids: + if uid == -1: # Background/void + continue + elif uid == -3: # Overlap (only present if color_overlaps was True) + if isinstance(overlap_color, str): + rgb = _SVG_COLORS[overlap_color.lower()] + else: + rgb = overlap_color + mask = id_map[:, :, id_index] == uid + img[mask] = np.array(rgb) / 255.0 + elif uid in color_map: + color = color_map[uid] + if isinstance(color, str): + rgb = _SVG_COLORS[color.lower()] + else: + rgb = color + mask = id_map[:, :, id_index] == uid + img[mask] = np.array(rgb) / 255.0 + + return img + class PlotBase(IDManagerMixin): """ Parameters @@ -434,7 +520,7 @@ class PlotBase(IDManagerMixin): @filename.setter def filename(self, filename): - cv.check_type('filename', filename, str) + cv.check_type('filename', filename, (str, PathLike)) self._filename = filename @property @@ -621,14 +707,15 @@ class PlotBase(IDManagerMixin): return element -class Plot(PlotBase): - """Definition of a finite region of space to be plotted. +class SlicePlot(PlotBase): + """Definition of a 2D slice plot of the geometry. - OpenMC is capable of generating two-dimensional slice plots, or - three-dimensional voxel or projection plots. Colors that are used in plots can be given as - RGB tuples, e.g. (255, 255, 255) would be white, or by a string indicating a + Colors that are used in plots can be given as RGB tuples, e.g. + (255, 255, 255) would be white, or by a string indicating a valid `SVG color `_. + .. versionadded:: 0.15.4 + Parameters ---------- plot_id : int @@ -643,7 +730,7 @@ class Plot(PlotBase): name : str Name of the plot pixels : Iterable of int - Number of pixels to use in each direction + Number of pixels to use in each direction (2 values) filename : str Path to write the plot to color_by : {'cell', 'material'} @@ -666,11 +753,9 @@ class Plot(PlotBase): level : int Universe depth to plot at width : Iterable of float - Width of the plot in each basis direction + Width of the plot in each basis direction (2 values) origin : tuple or list of ndarray - Origin (center) of the plot - type : {'slice', 'voxel'} - The type of the plot + Origin (center) of the plot (3 values) basis : {'xy', 'xz', 'yz'} The basis directions for the plot meshlines : dict @@ -683,10 +768,37 @@ class Plot(PlotBase): super().__init__(plot_id, name) self._width = [4.0, 4.0] self._origin = [0., 0., 0.] - self._type = 'slice' self._basis = 'xy' self._meshlines = None + @property + def type(self): + warnings.warn( + "The 'type' attribute is deprecated and will be removed in a future version. " + "This is a SlicePlot instance.", + FutureWarning, stacklevel=2 + ) + return 'slice' + + @type.setter + def type(self, value): + raise TypeError( + "Setting plot.type is no longer supported. " + "Use openmc.SlicePlot() for 2D slice plots or openmc.VoxelPlot() for 3D voxel plots." + ) + + @property + def pixels(self): + return self._pixels + + @pixels.setter + def pixels(self, pixels): + cv.check_type('plot pixels', pixels, Iterable, Integral) + cv.check_length('plot pixels', pixels, 2, 2) + for dim in pixels: + cv.check_greater_than('plot pixels', dim, 0) + self._pixels = pixels + @property def width(self): return self._width @@ -694,7 +806,7 @@ class Plot(PlotBase): @width.setter def width(self, width): cv.check_type('plot width', width, Iterable, Real) - cv.check_length('plot width', width, 2, 3) + cv.check_length('plot width', width, 2, 2) self._width = width @property @@ -707,15 +819,6 @@ class Plot(PlotBase): cv.check_length('plot origin', origin, 3) self._origin = origin - @property - def type(self): - return self._type - - @type.setter - def type(self, plottype): - cv.check_value('plot type', plottype, ['slice', 'voxel']) - self._type = plottype - @property def basis(self): return self._basis @@ -758,11 +861,10 @@ class Plot(PlotBase): self._meshlines = meshlines def __repr__(self): - string = 'Plot\n' + string = 'SlicePlot\n' string += '{: <16}=\t{}\n'.format('\tID', self._id) string += '{: <16}=\t{}\n'.format('\tName', self._name) string += '{: <16}=\t{}\n'.format('\tFilename', self._filename) - string += '{: <16}=\t{}\n'.format('\tType', self._type) string += '{: <16}=\t{}\n'.format('\tBasis', self._basis) string += '{: <16}=\t{}\n'.format('\tWidth', self._width) string += '{: <16}=\t{}\n'.format('\tOrigin', self._origin) @@ -878,7 +980,7 @@ class Plot(PlotBase): self._colors[domain] = (r, g, b) def to_xml_element(self): - """Return XML representation of the slice/voxel plot + """Return XML representation of the slice plot Returns ------- @@ -888,10 +990,8 @@ class Plot(PlotBase): """ element = super().to_xml_element() - element.set("type", self._type) - - if self._type == 'slice': - element.set("basis", self._basis) + element.set("type", "slice") + element.set("basis", self._basis) subelement = ET.SubElement(element, "origin") subelement.text = ' '.join(map(str, self._origin)) @@ -937,68 +1037,63 @@ class Plot(PlotBase): Returns ------- - openmc.Plot - Plot object + openmc.SlicePlot + SlicePlot object """ - plot_id = int(elem.get("id")) + plot_id = int(get_text(elem, "id")) name = get_text(elem, 'name', '') plot = cls(plot_id, name) if "filename" in elem.keys(): - plot.filename = elem.get("filename") - plot.color_by = elem.get("color_by") - plot.type = elem.get("type") - if plot.type == 'slice': - plot.basis = elem.get("basis") + plot.filename = get_text(elem, "filename") + plot.color_by = get_text(elem, "color_by") + plot.basis = get_text(elem, "basis") - plot.origin = get_elem_tuple(elem, "origin", float) - plot.width = get_elem_tuple(elem, "width", float) - plot.pixels = get_elem_tuple(elem, "pixels") - plot._background = get_elem_tuple(elem, "background") + plot.origin = tuple(get_elem_list(elem, "origin", float)) + plot.width = tuple(get_elem_list(elem, "width", float)) + plot.pixels = tuple(get_elem_list(elem, "pixels")) + background = get_elem_list(elem, "background") + if background is not None: + plot._background = tuple(background) # Set plot colors colors = {} for color_elem in elem.findall("color"): - uid = int(color_elem.get("id")) - colors[uid] = tuple([int(x) - for x in color_elem.get("rgb").split()]) + uid = int(get_text(color_elem, "id")) + colors[uid] = tuple(get_elem_list(color_elem, "rgb", int)) plot.colors = colors # Set masking information mask_elem = elem.find("mask") if mask_elem is not None: - plot.mask_components = [ - int(x) for x in mask_elem.get("components").split()] - background = mask_elem.get("background") + plot.mask_components = get_elem_list(mask_elem, "components", int) + background = get_elem_list(mask_elem, "background", int) if background is not None: - plot.mask_background = tuple( - [int(x) for x in background.split()]) + plot.mask_background = tuple(background) # show overlaps - overlap_elem = elem.find("show_overlaps") - if overlap_elem is not None: - plot.show_overlaps = (overlap_elem.text in ('true', '1')) - overlap_color = get_elem_tuple(elem, "overlap_color") + overlap = get_text(elem, "show_overlaps") + if overlap is not None: + plot.show_overlaps = (overlap in ('true', '1')) + overlap_color = get_elem_list(elem, "overlap_color", int) if overlap_color is not None: - plot.overlap_color = overlap_color + plot.overlap_color = tuple(overlap_color) # Set universe level - level = elem.find("level") + level = get_text(elem, "level") if level is not None: - plot.level = int(level.text) + plot.level = int(level) # Set meshlines mesh_elem = elem.find("meshlines") if mesh_elem is not None: - meshlines = {'type': mesh_elem.get('meshtype')} + meshlines = {'type': get_text(mesh_elem, "meshtype")} if 'id' in mesh_elem.keys(): - meshlines['id'] = int(mesh_elem.get('id')) + meshlines['id'] = int(get_text(mesh_elem, "id")) if 'linewidth' in mesh_elem.keys(): - meshlines['linewidth'] = int(mesh_elem.get('linewidth')) + meshlines['linewidth'] = int(get_text(mesh_elem, "linewidth")) if 'color' in mesh_elem.keys(): - meshlines['color'] = tuple( - [int(x) for x in mesh_elem.get('color').split()] - ) + meshlines['color'] = tuple(get_elem_list(mesh_elem, "color", int)) plot.meshlines = meshlines return plot @@ -1034,9 +1129,215 @@ class Plot(PlotBase): # Return produced image return _get_plot_image(self, cwd) + + +class VoxelPlot(PlotBase): + """Definition of a 3D voxel plot of the geometry. + + Colors that are used in plots can be given as RGB tuples, e.g. + (255, 255, 255) would be white, or by a string indicating a + valid `SVG color `_. + + .. versionadded:: 0.15.1 + + Parameters + ---------- + plot_id : int + Unique identifier for the plot + name : str + Name of the plot + + Attributes + ---------- + id : int + Unique identifier + name : str + Name of the plot + pixels : Iterable of int + Number of pixels to use in each direction (3 values) + filename : str + Path to write the plot to + color_by : {'cell', 'material'} + Indicate whether the plot should be colored by cell or by material + background : Iterable of int or str + Color of the background + mask_components : Iterable of openmc.Cell or openmc.Material or int + The cells or materials (or corresponding IDs) to mask + mask_background : Iterable of int or str + Color to apply to all cells/materials listed in mask_components + show_overlaps : bool + Indicate whether or not overlapping regions are shown + overlap_color : Iterable of int or str + Color to apply to overlapping regions + colors : dict + Dictionary indicating that certain cells/materials should be + displayed with a particular color. The keys can be of type + :class:`~openmc.Cell`, :class:`~openmc.Material`, or int (ID for a + cell/material). + level : int + Universe depth to plot at + width : Iterable of float + Width of the plot in each dimension (3 values) + origin : tuple or list of ndarray + Origin (center) of the plot (3 values) + + """ + + def __init__(self, plot_id=None, name=''): + super().__init__(plot_id, name) + self._width = [4.0, 4.0, 4.0] + self._origin = [0., 0., 0.] + self._pixels = [400, 400, 400] + + @property + def pixels(self): + return self._pixels + + @pixels.setter + def pixels(self, pixels): + cv.check_type('plot pixels', pixels, Iterable, Integral) + cv.check_length('plot pixels', pixels, 3, 3) + for dim in pixels: + cv.check_greater_than('plot pixels', dim, 0) + self._pixels = pixels + + @property + def width(self): + return self._width + + @width.setter + def width(self, width): + cv.check_type('plot width', width, Iterable, Real) + cv.check_length('plot width', width, 3, 3) + self._width = width + + @property + def origin(self): + return self._origin + + @origin.setter + def origin(self, origin): + cv.check_type('plot origin', origin, Iterable, Real) + cv.check_length('plot origin', origin, 3) + self._origin = origin + + def __repr__(self): + string = 'VoxelPlot\n' + string += '{: <16}=\t{}\n'.format('\tID', self._id) + string += '{: <16}=\t{}\n'.format('\tName', self._name) + string += '{: <16}=\t{}\n'.format('\tFilename', self._filename) + string += '{: <16}=\t{}\n'.format('\tWidth', self._width) + string += '{: <16}=\t{}\n'.format('\tOrigin', self._origin) + string += '{: <16}=\t{}\n'.format('\tPixels', self._pixels) + string += '{: <16}=\t{}\n'.format('\tColor by', self._color_by) + string += '{: <16}=\t{}\n'.format('\tBackground', self._background) + string += '{: <16}=\t{}\n'.format('\tMask components', + self._mask_components) + string += '{: <16}=\t{}\n'.format('\tMask background', + self._mask_background) + string += '{: <16}=\t{}\n'.format('\tOverlap Color', + self._overlap_color) + string += '{: <16}=\t{}\n'.format('\tColors', self._colors) + string += '{: <16}=\t{}\n'.format('\tLevel', self._level) + return string + + def to_xml_element(self): + """Return XML representation of the voxel plot + + Returns + ------- + element : lxml.etree._Element + XML element containing plot data + + """ + + element = super().to_xml_element() + element.set("type", "voxel") + + subelement = ET.SubElement(element, "origin") + subelement.text = ' '.join(map(str, self._origin)) + + subelement = ET.SubElement(element, "width") + subelement.text = ' '.join(map(str, self._width)) + + if self._colors: + self._colors_to_xml(element) + + if self._show_overlaps: + subelement = ET.SubElement(element, "show_overlaps") + subelement.text = "true" + + if self._overlap_color is not None: + color = self._overlap_color + if isinstance(color, str): + color = _SVG_COLORS[color.lower()] + subelement = ET.SubElement(element, "overlap_color") + subelement.text = ' '.join(str(x) for x in color) + + return element + + @classmethod + def from_xml_element(cls, elem): + """Generate plot object from an XML element + + Parameters + ---------- + elem : lxml.etree._Element + XML element + + Returns + ------- + openmc.VoxelPlot + VoxelPlot object + + """ + plot_id = int(get_text(elem, "id")) + name = get_text(elem, 'name', '') + plot = cls(plot_id, name) + if "filename" in elem.keys(): + plot.filename = get_text(elem, "filename") + plot.color_by = get_text(elem, "color_by") + + plot.origin = tuple(get_elem_list(elem, "origin", float)) + plot.width = tuple(get_elem_list(elem, "width", float)) + plot.pixels = tuple(get_elem_list(elem, "pixels")) + background = get_elem_list(elem, "background") + if background is not None: + plot._background = tuple(background) + + # Set plot colors + colors = {} + for color_elem in elem.findall("color"): + uid = int(get_text(color_elem, "id")) + colors[uid] = tuple(get_elem_list(color_elem, "rgb", int)) + plot.colors = colors + + # Set masking information + mask_elem = elem.find("mask") + if mask_elem is not None: + plot.mask_components = get_elem_list(mask_elem, "components", int) + background = get_elem_list(mask_elem, "background", int) + if background is not None: + plot.mask_background = tuple(background) + + # show overlaps + overlap = get_text(elem, "show_overlaps") + if overlap is not None: + plot.show_overlaps = (overlap in ('true', '1')) + overlap_color = get_elem_list(elem, "overlap_color", int) + if overlap_color is not None: + plot.overlap_color = tuple(overlap_color) + + # Set universe level + level = get_text(elem, "level") + if level is not None: + plot.level = int(level) + + return plot + def to_vtk(self, output: PathLike | None = None, openmc_exec: str = 'openmc', cwd: str = '.'): - """Render plot as an voxel image + """Render plot as a voxel image This method runs OpenMC in plotting mode to produce a .vti file. @@ -1057,10 +1358,6 @@ class Plot(PlotBase): Path of the .vti file produced """ - if self.type != 'voxel': - raise ValueError( - 'Generating a VTK file only works for voxel plots') - # Create plots.xml Plots([self]).export_to_xml(cwd) @@ -1080,6 +1377,20 @@ class Plot(PlotBase): return voxel_to_vtk(h5_voxel_file, output) +def Plot(plot_id=None, name=''): + """Legacy Plot class for backward compatibility. + + .. deprecated:: 0.15.4 + Use :class:`SlicePlot` for 2D slice plots or :class:`VoxelPlot` for 3D voxel plots. + + """ + warnings.warn( + "The Plot class is deprecated. Use SlicePlot for 2D slice plots " + "or VoxelPlot for 3D voxel plots.", FutureWarning + ) + return SlicePlot(plot_id, name) + + class RayTracePlot(PlotBase): """Definition of a camera's view of OpenMC geometry @@ -1256,38 +1567,39 @@ class RayTracePlot(PlotBase): None """ - if "filename" in elem.keys(): - self.filename = elem.get("filename") - self.color_by = elem.get("color_by") + filename = get_text(elem, "filename") + if filename is not None: + self.filename = filename + self.color_by = get_text(elem, "color_by") - horizontal_fov = elem.find("horizontal_field_of_view") + horizontal_fov = get_text(elem, "horizontal_field_of_view") if horizontal_fov is not None: - self.horizontal_field_of_view = float(horizontal_fov.text) + self.horizontal_field_of_view = float(horizontal_fov) - if (tmp := elem.find("orthographic_width")) is not None: - self.orthographic_width = float(tmp) + orthographic_width = get_text(elem, "orthographic_width") + if orthographic_width is not None: + self.orthographic_width = float(orthographic_width) - self.pixels = get_elem_tuple(elem, "pixels") - self.camera_position = get_elem_tuple(elem, "camera_position", float) - self.look_at = get_elem_tuple(elem, "look_at", float) + self.pixels = tuple(get_elem_list(elem, "pixels", int)) + self.camera_position = tuple(get_elem_list(elem, "camera_position", float)) + self.look_at = tuple(get_elem_list(elem, "look_at", float)) - if elem.find("background") is not None: - self.background = get_elem_tuple(elem, "background") + background = get_elem_list(elem, "background", int) + if background is not None: + self.background = tuple(background) # Set masking information if (mask_elem := elem.find("mask")) is not None: - mask_components = [int(x) - for x in mask_elem.get("components").split()] + mask_components = get_elem_list(mask_elem, "components", int) # TODO: set mask components(needs geometry information) - background = mask_elem.get("background") + background = get_elem_list(mask_elem, "background", int) if background is not None: - self.mask_background = tuple( - [int(x) for x in background.split()]) + self.mask_background = tuple(background) # Set universe level - level = elem.find("level") + level = get_text(elem, "level") if level is not None: - self.level = int(level.text) + self.level = int(level) class WireframeRayTracePlot(RayTracePlot): @@ -1512,7 +1824,7 @@ class WireframeRayTracePlot(RayTracePlot): """ - plot_id = int(elem.get("id")) + plot_id = int(get_text(elem, "id")) plot_name = get_text(elem, 'name', '') plot = cls(plot_id, plot_name) plot.type = "wireframe_raytrace" @@ -1520,19 +1832,18 @@ class WireframeRayTracePlot(RayTracePlot): plot._read_xml_attributes(elem) # Attempt to get wireframe thickness.May not be present - wireframe_thickness = elem.find("wireframe_thickness") + wireframe_thickness = get_text(elem, "wireframe_thickness") if wireframe_thickness is not None: - plot.wireframe_thickness = int(wireframe_thickness.text) - wireframe_color = elem.get("wireframe_color") + plot.wireframe_thickness = int(wireframe_thickness) + wireframe_color = get_elem_list(elem, "wireframe_color", int) if wireframe_color: - plot.wireframe_color = [int(item) for item in wireframe_color] + plot.wireframe_color = wireframe_color # Set plot colors for color_elem in elem.findall("color"): - uid = int(color_elem.get("id")) - plot.colors[uid] = tuple(int(i) - for i in get_text(color_elem, 'rgb').split()) - plot.xs[uid] = float(color_elem.get("xs")) + uid = int(get_text(color_elem, "id")) + plot.colors[uid] = tuple(get_elem_list(color_elem, "rgb", int)) + plot.xs[uid] = float(get_text(color_elem, "xs")) return plot @@ -1690,15 +2001,17 @@ class SolidRayTracePlot(RayTracePlot): def _read_phong_attributes(self, elem): """Read attributes specific to the Phong plot from an XML element""" - if elem.find('light_position') is not None: - self.light_position = get_elem_tuple(elem, 'light_position', float) + light_position = get_elem_list(elem, 'light_position', float) + if light_position is not None: + self.light_position = tuple(light_position) - diffuse_fraction = elem.find('diffuse_fraction') + diffuse_fraction = get_text(elem, "diffuse_fraction") if diffuse_fraction is not None: - self.diffuse_fraction = float(diffuse_fraction.text) + self.diffuse_fraction = float(diffuse_fraction) - if elem.find('opaque_ids') is not None: - self.opaque_domains = list(get_elem_tuple(elem, 'opaque_ids', int)) + opaque_domains = get_elem_list(elem, 'opaque_ids', int) + if opaque_domains is not None: + self.opaque_domains = opaque_domains @classmethod def from_xml_element(cls, elem): @@ -1716,7 +2029,7 @@ class SolidRayTracePlot(RayTracePlot): """ - plot_id = int(elem.get("id")) + plot_id = int(get_text(elem, "id")) plot_name = get_text(elem, 'name', '') plot = cls(plot_id, plot_name) plot.type = "solid_raytrace" @@ -1726,23 +2039,23 @@ class SolidRayTracePlot(RayTracePlot): # Set plot colors for color_elem in elem.findall("color"): - uid = color_elem.get("id") - plot.colors[uid] = get_elem_tuple(color_elem, "rgb") + uid = get_text(color_elem, "id") + plot.colors[uid] = tuple(get_elem_list(color_elem, "rgb", int)) return plot class Plots(cv.CheckedList): - """Collection of Plots used for an OpenMC simulation. + """Collection of plots used for an OpenMC simulation. This class corresponds directly to the plots.xml input file. It can be thought of as a normal Python list where each member is inherits from :class:`PlotBase`. It behaves like a list as the following example demonstrates: - >>> xz_plot = openmc.Plot() - >>> big_plot = openmc.Plot() - >>> small_plot = openmc.Plot() + >>> xz_plot = openmc.SlicePlot() + >>> big_plot = openmc.VoxelPlot() + >>> small_plot = openmc.SlicePlot() >>> p = openmc.Plots((xz_plot, big_plot)) >>> p.append(small_plot) >>> small_plot = p.pop() @@ -1778,7 +2091,7 @@ class Plots(cv.CheckedList): ---------- index : int Index in list - plot : openmc.Plot + plot : openmc.PlotBase Plot to insert """ @@ -1854,8 +2167,6 @@ class Plots(cv.CheckedList): # Clean the indentation in the file to be user-readable clean_indentation(self._plots_file) - # TODO: Remove when support is Python 3.8+ - reorder_attributes(self._plots_file) return self._plots_file @@ -1896,13 +2207,18 @@ class Plots(cv.CheckedList): # Generate each plot plots = cls() for e in elem.findall('plot'): - plot_type = e.get('type') + plot_type = get_text(e, "type") if plot_type == 'wireframe_raytrace': plots.append(WireframeRayTracePlot.from_xml_element(e)) elif plot_type == 'solid_raytrace': plots.append(SolidRayTracePlot.from_xml_element(e)) - elif plot_type in ('slice', 'voxel'): - plots.append(Plot.from_xml_element(e)) + elif plot_type == 'slice': + plots.append(SlicePlot.from_xml_element(e)) + elif plot_type == 'voxel': + plots.append(VoxelPlot.from_xml_element(e)) + elif plot_type is None: + # For backward compatibility, assume slice if no type specified + plots.append(SlicePlot.from_xml_element(e)) else: raise ValueError("Unknown plot type: {}".format(plot_type)) return plots diff --git a/openmc/plotter.py b/openmc/plotter.py index 85c4963a7..abd8ab6dd 100644 --- a/openmc/plotter.py +++ b/openmc/plotter.py @@ -413,7 +413,8 @@ def _calculate_cexs_nuclide(this, types, temperature=294., sab_name=None, # Prep S(a,b) data if needed if sab_name: - sab = openmc.data.ThermalScattering.from_hdf5(sab_name) + sab = openmc.data.ThermalScattering.from_hdf5( + library.get_by_material(sab_name, data_type='thermal')['path']) # Obtain the nearest temperature if strT in sab.temperatures: sabT = strT @@ -500,7 +501,7 @@ def _calculate_cexs_nuclide(this, types, temperature=294., sab_name=None, elif ncrystal_cfg: import NCrystal nc_scatter = NCrystal.createScatter(ncrystal_cfg) - nc_func = nc_scatter.crossSectionNonOriented + nc_func = nc_scatter.xsect nc_emax = 5 # eV # this should be obtained from NCRYSTAL_MAX_ENERGY energy_grid = np.union1d(np.geomspace(min(energy_grid), 1.1*nc_emax, @@ -640,14 +641,13 @@ def _calculate_cexs_elem_mat(this, types, temperature=294., sab = openmc.data.ThermalScattering.from_hdf5( library.get_by_material(sab_name, data_type='thermal')['path']) for nuc in sab.nuclides: - sabs[nuc] = library.get_by_material(sab_name, - data_type='thermal')['path'] + sabs[nuc] = sab_name else: if sab_name: - sab = openmc.data.ThermalScattering.from_hdf5(sab_name) + sab = openmc.data.ThermalScattering.from_hdf5( + library.get_by_material(sab_name, data_type='thermal')['path']) for nuc in sab.nuclides: - sabs[nuc] = library.get_by_material(sab_name, - data_type='thermal')['path'] + sabs[nuc] = sab_name # Now we can create the data sets to be plotted xs = {} @@ -655,8 +655,8 @@ def _calculate_cexs_elem_mat(this, types, temperature=294., for nuclide in nuclides.items(): name = nuclide[0] nuc = nuclide[1] - sab_tab = sabs[name] - temp_E, temp_xs = calculate_cexs(nuc, types, T, sab_tab, cross_sections, + sab_name = sabs[name] + temp_E, temp_xs = calculate_cexs(nuc, types, T, sab_name, cross_sections, ncrystal_cfg=ncrystal_cfg ) E.append(temp_E) diff --git a/openmc/settings.py b/openmc/settings.py index ead2c0d00..a022b045f 100644 --- a/openmc/settings.py +++ b/openmc/settings.py @@ -6,17 +6,17 @@ from numbers import Integral, Real from pathlib import Path import lxml.etree as ET - +import warnings import openmc import openmc.checkvalue as cv from openmc.checkvalue import PathLike -from openmc.stats.multivariate import MeshSpatial -from ._xml import clean_indentation, get_text, reorder_attributes +from openmc.stats.multivariate import MeshSpatial, Box, PolarAzimuthal, Isotropic +from ._xml import clean_indentation, get_elem_list, get_text from .mesh import _read_meshes, RegularMesh, MeshBase from .source import SourceBase, MeshSource, IndependentSource from .utility_funcs import input_path from .volume import VolumeCalculation -from .weight_windows import WeightWindows, WeightWindowGenerator +from .weight_windows import WeightWindows, WeightWindowGenerator, WeightWindowsList class RunMode(Enum): @@ -47,6 +47,21 @@ class Settings: half-width of the 95% two-sided confidence interval. If False, uncertainties on tally results will be reported as the sample standard deviation. + collision_track : dict + Options for writing collision information. Acceptable keys are: + + :max_collisions: Maximum number of collisions to be banked per file. (int) + :max_collision_track_files: Maximum number of collision_track files. (int) + :mcpl: Output in the form of an MCPL-file. (bool) + :cell_ids: List of cell IDs to define cells in which collisions should be banked. (list of int) + :universe_ids: List of universe IDs to define universes in which collisions should be banked. (list of int) + :material_ids: List of material IDs to define materials in which collisions should be banked. (list of int) + :nuclides: List of nuclides to define nuclides in which collisions should be banked. + (ex: ["I135m", "U233"] ). (list of str) + :reactions: List of reaction to define specific reactions that should be banked + (ex: ["(n,fission)", 2, "(n,2n)"] ). (list of str or int) + :deposited_E_threshold: Number to define the minimum deposited energy during + per collision to trigger banking. (float) create_fission_neutrons : bool Indicate whether fission neutrons should be created or not. cutoff : dict @@ -84,8 +99,15 @@ class Settings: history-based parallelism. .. versionadded:: 0.12 + free_gas_threshold : float + Energy multiplier (in units of :math:`kT`) below which the free gas + scattering treatment is applied for elastic scattering. If not + specified, a value of 400.0 is used. generations_per_batch : int Number of generations per batch + ifp_n_generation : int + Number of generations to consider for the Iterated Fission Probability + method. max_lost_particles : int Maximum number of lost particles @@ -125,6 +147,10 @@ class Settings: Maximum number of times a particle can split during a history .. versionadded:: 0.13 + max_secondaries : int + Maximum secondary bank size + + .. versionadded:: 0.15.3 max_tracks : int Maximum number of tracks written to a track file (per MPI process). @@ -156,7 +182,7 @@ class Settings: Options for configuring the random ray solver. Acceptable keys are: :distance_inactive: - Indicates the total active distance in [cm] a ray should travel + Indicates the total inactive distance in [cm] a ray should travel :distance_active: Indicates the total active distance in [cm] a ray should travel :ray_source: @@ -187,6 +213,17 @@ class Settings: or openmc.Universe. The mesh will be applied to the listed domains to subdivide source regions so as to improve accuracy and/or conform with tally meshes. + :diagonal_stabilization_rho: + The rho factor for use with diagonal stabilization. This technique is + applied when negative diagonal (in-group) elements are detected in + the scattering matrix of input MGXS data, which is a common feature + of transport corrected MGXS data. The default is 1.0, which ensures + no negative diagonal elements are present in the iteration matrix and + thus stabilizes the simulation. A value of 0.0 will disable diagonal + stabilization. Values between 0.0 and 1.0 will apply a degree of + stabilization, which may be desirable as stronger diagonal stabilization + also tends to dampen the convergence rate of the solver, thus requiring + more iterations to converge. .. versionadded:: 0.15.0 resonance_scattering : dict @@ -208,6 +245,10 @@ class Settings: Number of random numbers allocated for each source particle history source : Iterable of openmc.SourceBase Distribution of source sites in space, angle, and energy + source_rejection_fraction : float + Minimum fraction of source sites that must be accepted when applying + rejection sampling based on constraints. If not specified, the default + value is 0.05. sourcepoint : dict Options for writing source points. Acceptable keys are: @@ -295,7 +336,7 @@ class Settings: described in :ref:`verbosity`. volume_calculations : VolumeCalculation or iterable of VolumeCalculation Stochastic volume calculation specifications - weight_windows : WeightWindows or iterable of WeightWindows + weight_windows : WeightWindowsList Weight windows to use for variance reduction .. versionadded:: 0.13 @@ -343,6 +384,7 @@ class Settings: # Source subelement self._source = cv.CheckedList(SourceBase, 'source distributions') + self._source_rejection_fraction = None self._confidence_intervals = None self._electron_treatment = None @@ -353,6 +395,7 @@ class Settings: self._seed = None self._stride = None self._survival_biasing = None + self._free_gas_threshold = None # Shannon entropy mesh self._entropy_mesh = None @@ -364,6 +407,12 @@ class Settings: self._output = None + # Iterated Fission Probability + self._ifp_n_generation = None + + # Collision track feature + self._collision_track = {} + # Output options self._statepoint = {} self._sourcepoint = {} @@ -402,13 +451,15 @@ class Settings: self._max_particles_in_flight = None self._max_particle_events = None self._write_initial_source = None - self._weight_windows = cv.CheckedList(WeightWindows, 'weight windows') - self._weight_window_generators = cv.CheckedList(WeightWindowGenerator, 'weight window generators') + self._weight_windows = WeightWindowsList() + self._weight_window_generators = cv.CheckedList( + WeightWindowGenerator, 'weight window generators') self._weight_windows_on = None self._weight_windows_file = None self._weight_window_checkpoints = {} self._max_history_splits = None self._max_tracks = None + self._max_secondaries = None self._use_decay_photons = None self._random_ray = {} @@ -443,8 +494,9 @@ class Settings: @generations_per_batch.setter def generations_per_batch(self, generations_per_batch: int): - cv.check_type('generations per patch', generations_per_batch, Integral) - cv.check_greater_than('generations per batch', generations_per_batch, 0) + cv.check_type('generations per batch', generations_per_batch, Integral) + cv.check_greater_than('generations per batch', + generations_per_batch, 0) self._generations_per_batch = generations_per_batch @property @@ -474,7 +526,8 @@ class Settings: @rel_max_lost_particles.setter def rel_max_lost_particles(self, rel_max_lost_particles: float): cv.check_type('rel_max_lost_particles', rel_max_lost_particles, Real) - cv.check_greater_than('rel_max_lost_particles', rel_max_lost_particles, 0) + cv.check_greater_than('rel_max_lost_particles', + rel_max_lost_particles, 0) cv.check_less_than('rel_max_lost_particles', rel_max_lost_particles, 1) self._rel_max_lost_particles = rel_max_lost_particles @@ -484,8 +537,10 @@ class Settings: @max_write_lost_particles.setter def max_write_lost_particles(self, max_write_lost_particles: int): - cv.check_type('max_write_lost_particles', max_write_lost_particles, Integral) - cv.check_greater_than('max_write_lost_particles', max_write_lost_particles, 0) + cv.check_type('max_write_lost_particles', + max_write_lost_particles, Integral) + cv.check_greater_than('max_write_lost_particles', + max_write_lost_particles, 0) self._max_write_lost_particles = max_write_lost_particles @property @@ -506,12 +561,12 @@ class Settings: def keff_trigger(self, keff_trigger: dict): if not isinstance(keff_trigger, dict): msg = f'Unable to set a trigger on keff from "{keff_trigger}" ' \ - 'which is not a Python dictionary' + 'which is not a Python dictionary' raise ValueError(msg) elif 'type' not in keff_trigger: msg = f'Unable to set a trigger on keff from "{keff_trigger}" ' \ - 'which does not have a "type" key' + 'which does not have a "type" key' raise ValueError(msg) elif keff_trigger['type'] not in ['variance', 'std_dev', 'rel_err']: @@ -521,7 +576,7 @@ class Settings: elif 'threshold' not in keff_trigger: msg = f'Unable to set a trigger on keff from "{keff_trigger}" ' \ - 'which does not have a "threshold" key' + 'which does not have a "threshold" key' raise ValueError(msg) elif not isinstance(keff_trigger['threshold'], Real): @@ -538,7 +593,7 @@ class Settings: @energy_mode.setter def energy_mode(self, energy_mode: str): cv.check_value('energy mode', energy_mode, - ['continuous-energy', 'multi-group']) + ['continuous-energy', 'multi-group']) self._energy_mode = energy_mode @property @@ -561,7 +616,8 @@ class Settings: def source(self, source: SourceBase | Iterable[SourceBase]): if not isinstance(source, MutableSequence): source = [source] - self._source = cv.CheckedList(SourceBase, 'source distributions', source) + self._source = cv.CheckedList( + SourceBase, 'source distributions', source) @property def confidence_intervals(self) -> bool: @@ -578,7 +634,8 @@ class Settings: @electron_treatment.setter def electron_treatment(self, electron_treatment: str): - cv.check_value('electron treatment', electron_treatment, ['led', 'ttb']) + cv.check_value('electron treatment', + electron_treatment, ['led', 'ttb']) self._electron_treatment = electron_treatment @property @@ -672,7 +729,8 @@ class Settings: @trigger_max_batches.setter def trigger_max_batches(self, trigger_max_batches: int): cv.check_type('trigger maximum batches', trigger_max_batches, Integral) - cv.check_greater_than('trigger maximum batches', trigger_max_batches, 0) + cv.check_greater_than('trigger maximum batches', + trigger_max_batches, 0) self._trigger_max_batches = trigger_max_batches @property @@ -681,8 +739,10 @@ class Settings: @trigger_batch_interval.setter def trigger_batch_interval(self, trigger_batch_interval: int): - cv.check_type('trigger batch interval', trigger_batch_interval, Integral) - cv.check_greater_than('trigger batch interval', trigger_batch_interval, 0) + cv.check_type('trigger batch interval', + trigger_batch_interval, Integral) + cv.check_greater_than('trigger batch interval', + trigger_batch_interval, 0) self._trigger_batch_interval = trigger_batch_interval @property @@ -766,19 +826,22 @@ class Settings: @surf_source_write.setter def surf_source_write(self, surf_source_write: dict): - cv.check_type("surface source writing options", surf_source_write, Mapping) + cv.check_type("surface source writing options", + surf_source_write, Mapping) for key, value in surf_source_write.items(): cv.check_value( "surface source writing key", key, - ("surface_ids", "max_particles", "max_source_files", "mcpl", "cell", "cellfrom", "cellto"), + ("surface_ids", "max_particles", "max_source_files", + "mcpl", "cell", "cellfrom", "cellto"), ) if key == "surface_ids": cv.check_type( "surface ids for source banking", value, Iterable, Integral ) for surf_id in value: - cv.check_greater_than("surface id for source banking", surf_id, 0) + cv.check_greater_than( + "surface id for source banking", surf_id, 0) elif key == "mcpl": cv.check_type("write to an MCPL-format file", value, bool) @@ -795,6 +858,79 @@ class Settings: self._surf_source_write = surf_source_write + @property + def collision_track(self) -> dict: + return self._collision_track + + @collision_track.setter + def collision_track(self, collision_track: dict): + cv.check_type('Collision tracking options', collision_track, Mapping) + for key, value in collision_track.items(): + cv.check_value('collision_track key', key, + ('cell_ids', 'reactions', 'universe_ids', 'material_ids', 'nuclides', + 'deposited_E_threshold', 'max_collisions', 'max_collision_track_files', 'mcpl')) + if key == 'cell_ids': + cv.check_type('cell ids for collision tracking data banking', value, + Iterable, Integral) + for cell_id in value: + cv.check_greater_than('cell id for collision tracking data banking', + cell_id, 0) + elif key == 'reactions': + cv.check_type('MT numbers for collision tracking data banking', value, + Iterable) + for reaction in value: + if isinstance(reaction, int): + cv.check_greater_than( + 'MT number for collision tracking data banking', reaction, 0 + ) + elif isinstance(reaction, str): + # check against allowed strings? so far let C++ code handle it + pass + else: + raise TypeError( + f"MT number for collision tracking data banking must be a positive int or string, " + f"got {type(reaction).__name__}") + elif key == 'universe_ids': + cv.check_type('universe ids for collision tracking data banking', value, + Iterable, Integral) + for universe_id in value: + cv.check_greater_than('universe id for collision tracking data banking', + universe_id, 0) + elif key == 'material_ids': + cv.check_type('material ids for collision tracking data banking', value, + Iterable, Integral) + for material_id in value: + cv.check_greater_than('material id for collision tracking data banking', + material_id, 0) + elif key == 'nuclides': + cv.check_type('nuclides for collision tracking data banking', value, + Iterable, str) + for nuclide in value: + # If nuclide name doesn't look valid, give a warning + try: + openmc.data.zam(nuclide) + except ValueError: + warnings.warn(f"Nuclide {nuclide} is not valid") + elif key == 'deposited_E_threshold': + cv.check_type('Deposited Energy Threshold for collision tracking data banking', + value, Real) + cv.check_greater_than('Deposited Energy Threshold for collision tracking data banking', + value, 0) + elif key == 'max_collisions': + cv.check_type('maximum collisions banks per file', + value, Integral) + cv.check_greater_than('maximum collisions banks in collision tracking', + value, 0) + elif key == 'max_collision_track_files': + cv.check_type('maximum collisions banks', + value, Integral) + cv.check_greater_than('maximum number of collision_track files ', + value, 0) + elif key == 'mcpl': + cv.check_type('write to an MCPL-format file', value, bool) + + self._collision_track = collision_track + @property def no_reduce(self) -> bool: return self._no_reduce @@ -815,6 +951,17 @@ class Settings: cv.check_less_than('verbosity', verbosity, 10, True) self._verbosity = verbosity + @property + def ifp_n_generation(self) -> int: + return self._ifp_n_generation + + @ifp_n_generation.setter + def ifp_n_generation(self, ifp_n_generation: int): + if ifp_n_generation is not None: + cv.check_type("number of generations", ifp_n_generation, Integral) + cv.check_greater_than("number of generations", ifp_n_generation, 0) + self._ifp_n_generation = ifp_n_generation + @property def tabular_legendre(self) -> dict: return self._tabular_legendre @@ -900,7 +1047,7 @@ class Settings: def cutoff(self, cutoff: dict): if not isinstance(cutoff, Mapping): msg = f'Unable to set cutoff from "{cutoff}" which is not a '\ - 'Python dictionary' + 'Python dictionary' raise ValueError(msg) for key in cutoff: if key == 'weight': @@ -918,7 +1065,7 @@ class Settings: cv.check_greater_than('energy cutoff', cutoff[key], 0.0) else: msg = f'Unable to set cutoff to "{key}" which is unsupported ' \ - 'by OpenMC' + 'by OpenMC' self._cutoff = cutoff @@ -1062,14 +1209,14 @@ class Settings: self._write_initial_source = value @property - def weight_windows(self) -> list[WeightWindows]: + def weight_windows(self) -> WeightWindowsList: return self._weight_windows @weight_windows.setter - def weight_windows(self, value: WeightWindows | Iterable[WeightWindows]): - if not isinstance(value, MutableSequence): + def weight_windows(self, value: WeightWindows | Sequence[WeightWindows]): + if not isinstance(value, Sequence): value = [value] - self._weight_windows = cv.CheckedList(WeightWindows, 'weight windows', value) + self._weight_windows = WeightWindowsList(value) @property def weight_windows_on(self) -> bool: @@ -1087,12 +1234,14 @@ class Settings: @weight_window_checkpoints.setter def weight_window_checkpoints(self, weight_window_checkpoints: dict): for key in weight_window_checkpoints.keys(): - cv.check_value('weight_window_checkpoints', key, ('collision', 'surface')) + cv.check_value('weight_window_checkpoints', + key, ('collision', 'surface')) self._weight_window_checkpoints = weight_window_checkpoints @property def max_splits(self): - raise AttributeError('max_splits has been deprecated. Please use max_history_splits instead') + raise AttributeError( + 'max_splits has been deprecated. Please use max_history_splits instead') @property def max_history_splits(self) -> int: @@ -1104,6 +1253,16 @@ class Settings: cv.check_greater_than('max particle splits', value, 0) self._max_history_splits = value + @property + def max_secondaries(self) -> int: + return self._max_secondaries + + @max_secondaries.setter + def max_secondaries(self, value: int): + cv.check_type('maximum secondary bank size', value, Integral) + cv.check_greater_than('max secondary bank size', value, 0) + self._max_secondaries = value + @property def max_tracks(self) -> int: return self._max_tracks @@ -1119,9 +1278,12 @@ class Settings: return self._weight_windows_file @weight_windows_file.setter - def weight_windows_file(self, value: PathLike): - cv.check_type('weight windows file', value, PathLike) - self._weight_windows_file = input_path(value) + def weight_windows_file(self, value: PathLike | None): + if value is None: + self._weight_windows_file = None + else: + cv.check_type('weight windows file', value, PathLike) + self._weight_windows_file = input_path(value) @property def weight_window_generators(self) -> list[WeightWindowGenerator]: @@ -1131,7 +1293,8 @@ class Settings: def weight_window_generators(self, wwgs): if not isinstance(wwgs, MutableSequence): wwgs = [wwgs] - self._weight_window_generators = cv.CheckedList(WeightWindowGenerator, 'weight window generators', wwgs) + self._weight_window_generators = cv.CheckedList( + WeightWindowGenerator, 'weight window generators', wwgs) @property def random_ray(self) -> dict: @@ -1168,16 +1331,20 @@ class Settings: for mesh, domains in value: cv.check_type('mesh', mesh, MeshBase) cv.check_type('domains', domains, Iterable) - valid_types = (openmc.Material, openmc.Cell, openmc.Universe) + valid_types = (openmc.Material, + openmc.Cell, openmc.Universe) for domain in domains: if not isinstance(domain, valid_types): raise ValueError( f'Invalid domain type: {type(domain)}. Expected ' 'openmc.Material, openmc.Cell, or openmc.Universe.') - cv.check_type('adjoint', value, bool) elif key == 'sample_method': cv.check_value('sample method', value, ('prng', 'halton')) + elif key == 'diagonal_stabilization_rho': + cv.check_type('diagonal stabilization rho', value, Real) + cv.check_greater_than('diagonal stabilization rho', + value, 0.0, True) else: raise ValueError(f'Unable to set random ray to "{key}" which is ' 'unsupported by OpenMC') @@ -1193,6 +1360,31 @@ class Settings: cv.check_type('use decay photons', value, bool) self._use_decay_photons = value + @property + def source_rejection_fraction(self) -> float: + return self._source_rejection_fraction + + @source_rejection_fraction.setter + def source_rejection_fraction(self, source_rejection_fraction: float): + cv.check_type('source_rejection_fraction', + source_rejection_fraction, Real) + cv.check_greater_than('source_rejection_fraction', + source_rejection_fraction, 0) + cv.check_less_than('source_rejection_fraction', + source_rejection_fraction, 1) + self._source_rejection_fraction = source_rejection_fraction + + @property + def free_gas_threshold(self) -> float | None: + return self._free_gas_threshold + + @free_gas_threshold.setter + def free_gas_threshold(self, free_gas_threshold: float | None): + if free_gas_threshold is not None: + cv.check_type('free gas threshold', free_gas_threshold, Real) + cv.check_greater_than('free gas threshold', free_gas_threshold, 0.0) + self._free_gas_threshold = free_gas_threshold + def _create_run_mode_subelement(self, root): elem = ET.SubElement(root, "run_mode") elem.text = self._run_mode.value @@ -1344,6 +1536,45 @@ class Settings: subelement = ET.SubElement(element, key) subelement.text = str(self._surf_source_write[key]) + def _create_collision_track_subelement(self, root): + if self._collision_track: + element = ET.SubElement(root, "collision_track") + if 'cell_ids' in self._collision_track: + subelement = ET.SubElement(element, "cell_ids") + subelement.text = ' '.join( + str(x) for x in self._collision_track['cell_ids']) + if 'reactions' in self._collision_track: + subelement = ET.SubElement(element, "reactions") + subelement.text = ' '.join( + str(x) for x in self._collision_track['reactions']) + if 'universe_ids' in self._collision_track: + subelement = ET.SubElement(element, "universe_ids") + subelement.text = ' '.join( + str(x) for x in self._collision_track['universe_ids']) + if 'material_ids' in self._collision_track: + subelement = ET.SubElement(element, "material_ids") + subelement.text = ' '.join( + str(x) for x in self._collision_track['material_ids']) + if 'nuclides' in self._collision_track: + subelement = ET.SubElement(element, "nuclides") + subelement.text = ' '.join( + str(x) for x in self._collision_track['nuclides']) + if 'deposited_E_threshold' in self._collision_track: + subelement = ET.SubElement(element, "deposited_E_threshold") + subelement.text = str( + self._collision_track['deposited_E_threshold']) + if 'max_collisions' in self._collision_track: + subelement = ET.SubElement(element, "max_collisions") + subelement.text = str(self._collision_track['max_collisions']) + if 'max_collision_track_files' in self._collision_track: + subelement = ET.SubElement( + element, "max_collision_track_files") + subelement.text = str( + self._collision_track['max_collision_track_files']) + if 'mcpl' in self._collision_track: + subelement = ET.SubElement(element, "mcpl") + subelement.text = str(self._collision_track['mcpl']).lower() + def _create_confidence_intervals(self, root): if self._confidence_intervals is not None: element = ET.SubElement(root, "confidence_intervals") @@ -1399,8 +1630,8 @@ class Settings: # use default heuristic for entropy mesh if not set by user if self.entropy_mesh.dimension is None: if self.particles is None: - raise RuntimeError("Number of particles must be set in order to " \ - "use entropy mesh dimension heuristic") + raise RuntimeError("Number of particles must be set in order to " + "use entropy mesh dimension heuristic") else: n = ceil((self.particles / 20.0)**(1.0 / 3.0)) d = len(self.entropy_mesh.lower_left) @@ -1441,6 +1672,11 @@ class Settings: element = ET.SubElement(root, "no_reduce") element.text = str(self._no_reduce).lower() + def _create_ifp_n_generation_subelement(self, root): + if self._ifp_n_generation is not None: + element = ET.SubElement(root, "ifp_n_generation") + element.text = str(self._ifp_n_generation) + def _create_tabular_legendre_subelements(self, root): if self.tabular_legendre: element = ET.SubElement(root, "tabular_legendre") @@ -1485,7 +1721,8 @@ class Settings: path = f"./mesh[@id='{self.ufs_mesh.id}']" if root.find(path) is None: root.append(self.ufs_mesh.to_xml_element()) - if mesh_memo is not None: mesh_memo.add(self.ufs_mesh.id) + if mesh_memo is not None: + mesh_memo.add(self.ufs_mesh.id) def _create_use_decay_photons_subelement(self, root): if self._use_decay_photons is not None: @@ -1574,6 +1811,7 @@ class Settings: if mesh_memo is not None: mesh_memo.add(ww.mesh.id) + def _create_weight_windows_on_subelement(self, root): if self._weight_windows_on is not None: elem = ET.SubElement(root, "weight_windows_on") elem.text = str(self._weight_windows_on).lower() @@ -1590,9 +1828,12 @@ class Settings: if mesh_memo is not None and wwg.mesh.id in mesh_memo: continue - root.append(wwg.mesh.to_xml_element()) - if mesh_memo is not None: - mesh_memo.add(wwg.mesh.id) + # See if a element already exists -- if not, add it + path = f"./mesh[@id='{wwg.mesh.id}']" + if root.find(path) is None: + root.append(wwg.mesh.to_xml_element()) + if mesh_memo is not None: + mesh_memo.add(wwg.mesh.id) def _create_weight_windows_file_element(self, root): if self.weight_windows_file is not None: @@ -1607,17 +1848,24 @@ class Settings: if 'collision' in self._weight_window_checkpoints: subelement = ET.SubElement(element, "collision") - subelement.text = str(self._weight_window_checkpoints['collision']).lower() + subelement.text = str( + self._weight_window_checkpoints['collision']).lower() if 'surface' in self._weight_window_checkpoints: subelement = ET.SubElement(element, "surface") - subelement.text = str(self._weight_window_checkpoints['surface']).lower() + subelement.text = str( + self._weight_window_checkpoints['surface']).lower() def _create_max_history_splits_subelement(self, root): if self._max_history_splits is not None: elem = ET.SubElement(root, "max_history_splits") elem.text = str(self._max_history_splits) + def _create_max_secondaries_subelement(self, root): + if self._max_secondaries is not None: + elem = ET.SubElement(root, "max_secondaries") + elem.text = str(self._max_secondaries) + def _create_max_tracks_subelement(self, root): if self._max_tracks is not None: elem = ET.SubElement(root, "max_tracks") @@ -1629,7 +1877,11 @@ class Settings: for key, value in self._random_ray.items(): if key == 'ray_source' and isinstance(value, SourceBase): source_element = value.to_xml_element() + if source_element.find('bias') is not None: + raise RuntimeError( + "Ray source distributions should not be biased.") element.append(source_element) + elif key == 'source_region_meshes': subelement = ET.SubElement(element, 'source_region_meshes') for mesh, domains in value: @@ -1638,14 +1890,33 @@ class Settings: for domain in domains: domain_elem = ET.SubElement(mesh_elem, 'domain') domain_elem.set('id', str(domain.id)) - domain_elem.set('type', domain.__class__.__name__.lower()) + domain_elem.set( + 'type', domain.__class__.__name__.lower()) if mesh_memo is not None and mesh.id not in mesh_memo: + domain_elem.set('type', domain.__class__.__name__.lower()) + # See if a element already exists -- if not, add it + path = f"./mesh[@id='{mesh.id}']" + if root.find(path) is None: root.append(mesh.to_xml_element()) - mesh_memo.add(mesh.id) + if mesh_memo is not None: + mesh_memo.add(mesh.id) + elif isinstance(value, bool): + subelement = ET.SubElement(element, key) + subelement.text = str(value).lower() else: subelement = ET.SubElement(element, key) subelement.text = str(value) + def _create_source_rejection_fraction_subelement(self, root): + if self._source_rejection_fraction is not None: + element = ET.SubElement(root, "source_rejection_fraction") + element.text = str(self._source_rejection_fraction) + + def _create_free_gas_threshold_subelement(self, root): + if self._free_gas_threshold is not None: + element = ET.SubElement(root, "free_gas_threshold") + element.text = str(self._free_gas_threshold) + def _eigenvalue_from_xml_element(self, root): elem = root.find('eigenvalue') if elem is not None: @@ -1731,23 +2002,21 @@ class Settings: def _statepoint_from_xml_element(self, root): elem = root.find('state_point') if elem is not None: - text = get_text(elem, 'batches') - if text is not None: - self.statepoint['batches'] = [int(x) for x in text.split()] + batches = get_elem_list(elem, "batches", int) + if batches is not None: + self.statepoint['batches'] = batches def _sourcepoint_from_xml_element(self, root): elem = root.find('source_point') if elem is not None: for key in ('separate', 'write', 'overwrite_latest', 'batches', 'mcpl'): - value = get_text(elem, key) - if value is not None: - if key in ('separate', 'write', 'mcpl'): - value = value in ('true', '1') - elif key == 'overwrite_latest': - value = value in ('true', '1') + if key in ('separate', 'write', 'mcpl', 'overwrite_latest'): + value = get_text(elem, key) in ('true', '1') + if key == 'overwrite_latest': key = 'overwrite' - else: - value = [int(x) for x in value.split()] + else: + value = get_elem_list(elem, key, int) + if value is not None: self.sourcepoint[key] = value def _surf_source_read_from_xml_element(self, root): @@ -1764,16 +2033,36 @@ class Settings: if elem is None: return for key in ('surface_ids', 'max_particles', 'max_source_files', 'mcpl', 'cell', 'cellto', 'cellfrom'): - value = get_text(elem, key) + if key == 'surface_ids': + value = get_elem_list(elem, key, int) + else: + value = get_text(elem, key) if value is not None: - if key == 'surface_ids': - value = [int(x) for x in value.split()] - elif key == 'mcpl': + if key == 'mcpl': value = value in ('true', '1') elif key in ('max_particles', 'max_source_files', 'cell', 'cellfrom', 'cellto'): value = int(value) self.surf_source_write[key] = value + def _collision_track_from_xml_element(self, root): + elem = root.find('collision_track') + if elem is not None: + for key in ('cell_ids', 'reactions', 'universe_ids', 'material_ids', 'nuclides', + 'deposited_E_threshold', 'max_collisions', "max_collision_track_files", 'mcpl'): + value = get_text(elem, key) + if value is not None: + if key in ('cell_ids', 'universe_ids', 'material_ids'): + value = [int(x) for x in value.split()] + elif key in ('reactions', 'nuclides'): + value = value.split() + elif key in ('max_collisions', 'max_collision_track_files'): + value = int(value) + elif key == 'deposited_E_threshold': + value = float(value) + elif key == 'mcpl': + value = value in ('true', '1') + self.collision_track[key] = value + def _confidence_intervals_from_xml_element(self, root): text = get_text(root, 'confidence_intervals') if text is not None: @@ -1874,6 +2163,11 @@ class Settings: if text is not None: self.verbosity = int(text) + def _ifp_n_generation_from_xml_element(self, root): + text = get_text(root, 'ifp_n_generation') + if text is not None: + self.ifp_n_generation = int(text) + def _tabular_legendre_from_xml_element(self, root): elem = root.find('tabular_legendre') if elem is not None: @@ -1893,22 +2187,21 @@ class Settings: text = get_text(root, 'temperature_method') if text is not None: self.temperature['method'] = text - text = get_text(root, 'temperature_range') + text = get_elem_list(root, "temperature_range", float) if text is not None: - self.temperature['range'] = [float(x) for x in text.split()] + self.temperature['range'] = text text = get_text(root, 'temperature_multipole') if text is not None: self.temperature['multipole'] = text in ('true', '1') def _trace_from_xml_element(self, root): - text = get_text(root, 'trace') + text = get_elem_list(root, "trace", int) if text is not None: - self.trace = [int(x) for x in text.split()] + self.trace = text def _track_from_xml_element(self, root): - text = get_text(root, 'track') - if text is not None: - values = [int(x) for x in text.split()] + values = get_elem_list(root, "track", int) + if values is not None: self.track = list(zip(values[::3], values[1::3], values[2::3])) def _ufs_mesh_from_xml_element(self, root, meshes): @@ -1925,14 +2218,15 @@ class Settings: if elem is not None: keys = ('enable', 'method', 'energy_min', 'energy_max', 'nuclides') for key in keys: - value = get_text(elem, key) + if key == 'nuclides': + value = get_elem_list(elem, key, str) + else: + value = get_text(elem, key) if value is not None: if key == 'enable': value = value in ('true', '1') elif key in ('energy_min', 'energy_max'): value = float(value) - elif key == 'nuclides': - value = value.split() self.resonance_scattering[key] = value def _create_fission_neutrons_from_xml_element(self, root): @@ -1990,10 +2284,16 @@ class Settings: ww = WeightWindows.from_xml_element(elem, meshes) self.weight_windows.append(ww) + def _weight_windows_on_from_xml_element(self, root): text = get_text(root, 'weight_windows_on') if text is not None: self.weight_windows_on = text in ('true', '1') + def _weight_windows_file_from_xml_element(self, root): + text = get_text(root, 'weight_windows_file') + if text is not None: + self.weight_windows_file = text + def _weight_window_checkpoints_from_xml_element(self, root): elem = root.find('weight_window_checkpoints') if elem is None: @@ -2009,20 +2309,28 @@ class Settings: if text is not None: self.max_history_splits = int(text) + def _max_secondaries_from_xml_element(self, root): + text = get_text(root, 'max_secondaries') + if text is not None: + self.max_secondaries = int(text) + def _max_tracks_from_xml_element(self, root): text = get_text(root, 'max_tracks') if text is not None: self.max_tracks = int(text) - def _random_ray_from_xml_element(self, root): + def _random_ray_from_xml_element(self, root, meshes=None): elem = root.find('random_ray') if elem is not None: self.random_ray = {} for child in elem: - if child.tag in ('distance_inactive', 'distance_active'): + if child.tag in ('distance_inactive', 'distance_active', 'diagonal_stabilization_rho'): self.random_ray[child.tag] = float(child.text) elif child.tag == 'source': source = SourceBase.from_xml_element(child) + if child.find('bias') is not None: + raise RuntimeError( + "Ray source distributions should not be biased.") self.random_ray['ray_source'] = source elif child.tag == 'volume_estimator': self.random_ray['volume_estimator'] = child.text @@ -2041,11 +2349,15 @@ class Settings: elif child.tag == 'source_region_meshes': self.random_ray['source_region_meshes'] = [] for mesh_elem in child.findall('mesh'): - mesh = MeshBase.from_xml_element(mesh_elem) + mesh_id = int(get_text(mesh_elem, 'id')) + if meshes and mesh_id in meshes: + mesh = meshes[mesh_id] + else: + mesh = MeshBase.from_xml_element(mesh_elem) domains = [] for domain_elem in mesh_elem.findall('domain'): - domain_id = int(domain_elem.get('id')) - domain_type = domain_elem.get('type') + domain_id = int(get_text(domain_elem, "id")) + domain_type = get_text(domain_elem, "type") if domain_type == 'material': domain = openmc.Material(domain_id) elif domain_type == 'cell': @@ -2053,13 +2365,24 @@ class Settings: elif domain_type == 'universe': domain = openmc.Universe(domain_id) domains.append(domain) - self.random_ray['source_region_meshes'].append((mesh, domains)) + self.random_ray['source_region_meshes'].append( + (mesh, domains)) def _use_decay_photons_from_xml_element(self, root): text = get_text(root, 'use_decay_photons') if text is not None: self.use_decay_photons = text in ('true', '1') + def _source_rejection_fraction_from_xml_element(self, root): + text = get_text(root, 'source_rejection_fraction') + if text is not None: + self.source_rejection_fraction = float(text) + + def _free_gas_threshold_from_xml_element(self, root): + text = get_text(root, 'free_gas_threshold') + if text is not None: + self.free_gas_threshold = float(text) + def to_xml_element(self, mesh_memo=None): """Create a 'settings' element to be written to an XML file. @@ -2086,6 +2409,7 @@ class Settings: self._create_sourcepoint_subelement(element) self._create_surf_source_read_subelement(element) self._create_surf_source_write_subelement(element) + self._create_collision_track_subelement(element) self._create_confidence_intervals(element) self._create_electron_treatment_subelement(element) self._create_energy_mode_subelement(element) @@ -2102,6 +2426,7 @@ class Settings: self._create_trigger_subelement(element) self._create_no_reduce_subelement(element) self._create_verbosity_subelement(element) + self._create_ifp_n_generation_subelement(element) self._create_tabular_legendre_subelements(element) self._create_temperature_subelements(element) self._create_trace_subelement(element) @@ -2119,17 +2444,20 @@ class Settings: self._create_log_grid_bins_subelement(element) self._create_write_initial_source_subelement(element) self._create_weight_windows_subelement(element, mesh_memo) + self._create_weight_windows_on_subelement(element) self._create_weight_window_generators_subelement(element, mesh_memo) self._create_weight_windows_file_element(element) self._create_weight_window_checkpoints_subelement(element) self._create_max_history_splits_subelement(element) self._create_max_tracks_subelement(element) + self._create_max_secondaries_subelement(element) self._create_random_ray_subelement(element, mesh_memo) self._create_use_decay_photons_subelement(element) + self._create_source_rejection_fraction_subelement(element) + self._create_free_gas_threshold_subelement(element) # Clean the indentation in the file to be user-readable clean_indentation(element) - reorder_attributes(element) # TODO: Remove when support is Python 3.8+ return element @@ -2195,6 +2523,7 @@ class Settings: settings._sourcepoint_from_xml_element(elem) settings._surf_source_read_from_xml_element(elem) settings._surf_source_write_from_xml_element(elem) + settings._collision_track_from_xml_element(elem) settings._confidence_intervals_from_xml_element(elem) settings._electron_treatment_from_xml_element(elem) settings._energy_mode_from_xml_element(elem) @@ -2211,6 +2540,7 @@ class Settings: settings._trigger_from_xml_element(elem) settings._no_reduce_from_xml_element(elem) settings._verbosity_from_xml_element(elem) + settings._ifp_n_generation_from_xml_element(elem) settings._tabular_legendre_from_xml_element(elem) settings._temperature_from_xml_element(elem) settings._trace_from_xml_element(elem) @@ -2227,12 +2557,17 @@ class Settings: settings._log_grid_bins_from_xml_element(elem) settings._write_initial_source_from_xml_element(elem) settings._weight_windows_from_xml_element(elem, meshes) + settings._weight_windows_on_from_xml_element(elem) + settings._weight_windows_file_from_xml_element(elem) settings._weight_window_generators_from_xml_element(elem, meshes) settings._weight_window_checkpoints_from_xml_element(elem) settings._max_history_splits_from_xml_element(elem) settings._max_tracks_from_xml_element(elem) - settings._random_ray_from_xml_element(elem) + settings._max_secondaries_from_xml_element(elem) + settings._random_ray_from_xml_element(elem, meshes) settings._use_decay_photons_from_xml_element(elem) + settings._source_rejection_fraction_from_xml_element(elem) + settings._free_gas_threshold_from_xml_element(elem) return settings diff --git a/openmc/source.py b/openmc/source.py index 878f52c3b..84d8a9619 100644 --- a/openmc/source.py +++ b/openmc/source.py @@ -6,7 +6,6 @@ from numbers import Real from pathlib import Path import warnings from typing import Any -from pathlib import Path import lxml.etree as ET import numpy as np @@ -18,7 +17,7 @@ import openmc.checkvalue as cv from openmc.checkvalue import PathLike from openmc.stats.multivariate import UnitSphere, Spatial from openmc.stats.univariate import Univariate -from ._xml import get_text +from ._xml import get_elem_list, get_text from .mesh import MeshBase, StructuredMesh, UnstructuredMesh from .utility_funcs import input_path @@ -107,10 +106,12 @@ class SourceBase(ABC): cv.check_type('fissionable', value, bool) self._constraints['fissionable'] = value elif key == 'rejection_strategy': - cv.check_value('rejection strategy', value, ('resample', 'kill')) + cv.check_value('rejection strategy', + value, ('resample', 'kill')) self._constraints['rejection_strategy'] = value else: - raise ValueError('Unknown key in constraints dictionary: {key}') + raise ValueError( + f'Unknown key in constraints dictionary: {key}') @abstractmethod def populate_xml_element(self, element): @@ -144,13 +145,16 @@ class SourceBase(ABC): dt_elem = ET.SubElement(constraints_elem, "domain_type") dt_elem.text = constraints["domain_type"] id_elem = ET.SubElement(constraints_elem, "domain_ids") - id_elem.text = ' '.join(str(uid) for uid in constraints["domain_ids"]) + id_elem.text = ' '.join(str(uid) + for uid in constraints["domain_ids"]) if "time_bounds" in constraints: dt_elem = ET.SubElement(constraints_elem, "time_bounds") - dt_elem.text = ' '.join(str(t) for t in constraints["time_bounds"]) + dt_elem.text = ' '.join(str(t) + for t in constraints["time_bounds"]) if "energy_bounds" in constraints: dt_elem = ET.SubElement(constraints_elem, "energy_bounds") - dt_elem.text = ' '.join(str(E) for E in constraints["energy_bounds"]) + dt_elem.text = ' '.join(str(E) + for E in constraints["energy_bounds"]) if "fissionable" in constraints: dt_elem = ET.SubElement(constraints_elem, "fissionable") dt_elem.text = str(constraints["fissionable"]).lower() @@ -199,7 +203,8 @@ class SourceBase(ABC): elif source_type == 'mesh': return MeshSource.from_xml_element(elem, meshes) else: - raise ValueError(f'Source type {source_type} is not recognized') + raise ValueError( + f'Source type {source_type} is not recognized') @staticmethod def _get_constraints(elem: ET.Element) -> dict[str, Any]: @@ -210,7 +215,7 @@ class SourceBase(ABC): constraints = {} domain_type = get_text(elem, "domain_type") if domain_type is not None: - domain_ids = [int(x) for x in get_text(elem, "domain_ids").split()] + domain_ids = get_elem_list(elem, "domain_ids", int) # Instantiate some throw-away domains that are used by the # constructor to assign IDs @@ -224,13 +229,13 @@ class SourceBase(ABC): domains = [openmc.Universe(uid) for uid in domain_ids] constraints['domains'] = domains - time_bounds = get_text(elem, "time_bounds") + time_bounds = get_elem_list(elem, "time_bounds", float) if time_bounds is not None: - constraints['time_bounds'] = [float(x) for x in time_bounds.split()] + constraints['time_bounds'] = time_bounds - energy_bounds = get_text(elem, "energy_bounds") + energy_bounds = get_elem_list(elem, "energy_bounds", float) if energy_bounds is not None: - constraints['energy_bounds'] = [float(x) for x in energy_bounds.split()] + constraints['energy_bounds'] = energy_bounds fissionable = get_text(elem, "fissionable") if fissionable is not None: @@ -260,7 +265,7 @@ class IndependentSource(SourceBase): time distribution of source sites strength : float Strength of the source - particle : {'neutron', 'photon'} + particle : {'neutron', 'photon', 'electron', 'positron'} Source particle type domains : iterable of openmc.Cell, openmc.Material, or openmc.Universe Domains to reject based on, i.e., if a sampled spatial location is not @@ -299,7 +304,7 @@ class IndependentSource(SourceBase): .. versionadded:: 0.14.0 - particle : {'neutron', 'photon'} + particle : {'neutron', 'photon', 'electron', 'positron'} Source particle type constraints : dict Constraints on sampled source particles. Valid keys include @@ -316,7 +321,8 @@ class IndependentSource(SourceBase): time: openmc.stats.Univariate | None = None, strength: float = 1.0, particle: str = 'neutron', - domains: Sequence[openmc.Cell | openmc.Material | openmc.Universe] | None = None, + domains: Sequence[openmc.Cell | openmc.Material | + openmc.Universe] | None = None, constraints: dict[str, Any] | None = None ): if domains is not None: @@ -404,7 +410,8 @@ class IndependentSource(SourceBase): @particle.setter def particle(self, particle): - cv.check_value('source particle', particle, ['neutron', 'photon']) + cv.check_value('source particle', particle, + ['neutron', 'photon', 'electron', 'positron']) self._particle = particle def populate_xml_element(self, element): @@ -526,11 +533,12 @@ class MeshSource(SourceBase): 'fissionable', and 'rejection_strategy'. """ + def __init__( self, mesh: MeshBase, sources: Sequence[SourceBase], - constraints: dict[str, Any] | None = None, + constraints: dict[str, Any] | None = None, ): super().__init__(strength=None, constraints=constraints) self.mesh = mesh @@ -576,7 +584,8 @@ class MeshSource(SourceBase): elif isinstance(self.mesh, UnstructuredMesh): if s.ndim > 1: - raise ValueError('Sources must be a 1-D array for unstructured mesh') + raise ValueError( + 'Sources must be a 1-D array for unstructured mesh') self._sources = s for src in self._sources: @@ -645,7 +654,8 @@ class MeshSource(SourceBase): mesh_id = int(get_text(elem, 'mesh')) mesh = meshes[mesh_id] - sources = [SourceBase.from_xml_element(e) for e in elem.iterchildren('source')] + sources = [SourceBase.from_xml_element( + e) for e in elem.iterchildren('source')] constraints = cls._get_constraints(elem) return cls(mesh, sources, constraints=constraints) @@ -655,7 +665,8 @@ def Source(*args, **kwargs): A function for backward compatibility of sources. Will be removed in the future. Please update to IndependentSource. """ - warnings.warn("This class is deprecated in favor of 'IndependentSource'", FutureWarning) + warnings.warn( + "This class is deprecated in favor of 'IndependentSource'", FutureWarning) return openmc.IndependentSource(*args, **kwargs) @@ -702,6 +713,7 @@ class CompiledSource(SourceBase): 'fissionable', and 'rejection_strategy'. """ + def __init__( self, library: PathLike, @@ -913,7 +925,8 @@ class ParticleType(IntEnum): try: return cls[value.upper()] except KeyError: - raise ValueError(f"Invalid string for creation of {cls.__name__}: {value}") + raise ValueError( + f"Invalid string for creation of {cls.__name__}: {value}") @classmethod def from_pdg_number(cls, pdg_number: int) -> ParticleType: @@ -983,6 +996,7 @@ class SourceParticle: Type of the particle """ + def __init__( self, r: Iterable[float] = (0., 0., 0.), @@ -1041,7 +1055,8 @@ def write_source_file( openmc.SourceParticle """ - cv.check_iterable_type("source particles", source_particles, SourceParticle) + cv.check_iterable_type( + "source particles", source_particles, SourceParticle) pl = ParticleList(source_particles) pl.export_to_hdf5(filename, **kwargs) @@ -1103,7 +1118,8 @@ class ParticleList(list): for particle in f.particles: # Determine particle type based on the PDG number try: - particle_type = ParticleType.from_pdg_number(particle.pdgcode) + particle_type = ParticleType.from_pdg_number( + particle.pdgcode) except ValueError: particle_type = "UNKNOWN" @@ -1240,3 +1256,133 @@ def read_source_file(filename: PathLike) -> ParticleList: return ParticleList.from_hdf5(filename) else: return ParticleList.from_mcpl(filename) + + +def read_collision_track_hdf5(filename): + """Read a collision track file in HDF5 format. + + Parameters + ---------- + filename : str or path-like + Path to the HDF5 collision track file. + + Returns + ------- + numpy.ndarray + Structured array containing collision track data. + + See Also + -------- + read_collision_track_mcpl + read_collision_track_file + """ + + with h5py.File(filename, 'r') as file: + data = file['collision_track_bank'][:] + + return data + + +def read_collision_track_mcpl(file_path): + """Read a collision track file in MCPL format. + + Parameters + ---------- + file_path : str or path-like + Path to the MCPL collision track file. + + Returns + ------- + numpy.ndarray + Structured array of particle collision track information, including + position, direction, energy, weight, reaction data, and identifiers. + + See Also + -------- + read_collision_track_hdf5 + read_collision_track_file + """ + import mcpl + myfile = mcpl.MCPLFile(file_path) + data = { + 'r': [], # for position (x, y, z) + 'u': [], # for direction (ux, uy, uz) + 'E': [], 'dE': [], 'time': [], + 'wgt': [], 'event_mt': [], 'delayed_group': [], + 'cell_id': [], 'nuclide_id': [], 'material_id': [], + 'universe_id': [], 'n_collision': [], 'particle': [], + 'parent_id': [], 'progeny_id': [] + } + + # Read and collect data from the MCPL file + for i, p in enumerate(myfile.particles): + if f'blob_{i}' in myfile.blobs: + blob_data = myfile.blobs[f'blob_{i}'] + decoded_str = blob_data.decode('utf-8') + pairs = decoded_str.split(';') + values_dict = {k.strip(): v.strip() + for k, v in (pair.split(':') for pair in pairs if pair.strip())} + + data['r'].append((p.x, p.y, p.z)) # Append as tuple + data['u'].append((p.ux, p.uy, p.uz)) # Append as tuple + data['E'].append(p.ekin * 1e6) + data['dE'].append(float(values_dict.get('dE', 0))) + data['time'].append(p.time * 1e-3) + data['wgt'].append(p.weight) + data['event_mt'].append(int(values_dict.get('event_mt', 0))) + data['delayed_group'].append( + int(values_dict.get('delayed_group', 0))) + data['cell_id'].append(int(values_dict.get('cell_id', 0))) + data['nuclide_id'].append(int(values_dict.get('nuclide_id', 0))) + data['material_id'].append(int(values_dict.get('material_id', 0))) + data['universe_id'].append(int(values_dict.get('universe_id', 0))) + data['n_collision'].append(int(values_dict.get('n_collision', 0))) + data['particle'].append(ParticleType.from_pdg_number(p.pdgcode)) + data['parent_id'].append(int(values_dict.get('parent_id', 0))) + data['progeny_id'].append(int(values_dict.get('progeny_id', 0))) + + dtypes = [ + ('r', [('x', 'f8'), ('y', 'f8'), ('z', 'f8')]), + ('u', [('x', 'f8'), ('y', 'f8'), ('z', 'f8')]), + ('E', 'f8'), ('dE', 'f8'), ('time', 'f8'), ('wgt', 'f8'), + ('event_mt', 'f8'), ('delayed_group', 'i4'), ('cell_id', 'i4'), + ('nuclide_id', 'i4'), ('material_id', 'i4'), ('universe_id', 'i4'), + ('n_collision', 'i4'), ('particle', 'i4'), + ('parent_id', 'i8'), ('progeny_id', 'i8') + ] + + structured_array = np.zeros(len(data['r']), dtype=dtypes) + for key in data: + structured_array[key] = data[key] # Assign data + + return structured_array + + +def read_collision_track_file(filename): + """Read a collision track file (HDF5 or MCPL) and return its data. + + Parameters + ---------- + filename : str or path-like + Path to the collision track file to read. Must end with + ``.h5`` or ``.mcpl``. + + Returns + ------- + numpy.ndarray + Structured array containing collision track data. + + See Also + -------- + read_collision_track_hdf5 + read_collision_track_mcpl + """ + + filename = Path(filename) + if filename.suffix not in ('.h5', '.mcpl'): + raise ValueError('Collision track file must have a .h5 or .mcpl extension.') + + if filename.suffix == '.h5': + return read_collision_track_hdf5(filename) + else: + return read_collision_track_mcpl(filename) diff --git a/openmc/statepoint.py b/openmc/statepoint.py index 715becf48..a10ec3a83 100644 --- a/openmc/statepoint.py +++ b/openmc/statepoint.py @@ -1,4 +1,5 @@ from datetime import datetime +from collections import namedtuple import glob import re import os @@ -8,6 +9,7 @@ import h5py import numpy as np from pathlib import Path from uncertainties import ufloat +from uncertainties.unumpy import uarray import openmc import openmc.checkvalue as cv @@ -15,6 +17,9 @@ import openmc.checkvalue as cv _VERSION_STATEPOINT = 18 +KineticsParameters = namedtuple("KineticsParameters", ["generation_time", "beta_effective"]) + + class StatePoint: """State information on a simulation at a certain point in time (at the end of a given batch). Statepoints can be used to analyze tally results as well @@ -429,6 +434,10 @@ class StatePoint: if "multiply_density" in group.attrs: tally.multiply_density = group.attrs["multiply_density"].item() > 0 + # Check if tally has higher_moments attribute + if 'higher_moments' in group.attrs: + tally.higher_moments = bool(group.attrs['higher_moments'][()]) + # Read the number of realizations n_realizations = group['n_realizations'][()] @@ -531,7 +540,7 @@ class StatePoint: def get_tally(self, scores=[], filters=[], nuclides=[], name=None, id=None, estimator=None, exact_filters=False, exact_nuclides=False, exact_scores=False, - multiply_density=None, derivative=None): + multiply_density=None, derivative=None, filter_type=None): """Finds and returns a Tally object with certain properties. This routine searches the list of Tallies and returns the first Tally @@ -575,6 +584,9 @@ class StatePoint: to the same value as this parameter. derivative : openmc.TallyDerivative, optional TallyDerivative object to match. + filter_type : type, optional + If not None, the Tally must have at least one Filter that is an + instance of this type. For example `openmc.MeshFilter`. Returns ------- @@ -648,6 +660,10 @@ class StatePoint: if not contains_filters: continue + if filter_type is not None: + if not any(isinstance(f, filter_type) for f in test_tally.filters): + continue + # Determine if Tally has the queried Nuclide(s) if nuclides: if not all(nuclide in test_tally.nuclides for nuclide in nuclides): @@ -707,6 +723,59 @@ class StatePoint: cell = cells[cell_id] if not cell._paths: summary.geometry.determine_paths() - tally_filter.paths = cell.paths + tally_filter._paths = cell.paths self._summary = summary + + def get_kinetics_parameters(self) -> KineticsParameters: + """Get kinetics parameters from IFP tallies. + + This method searches the tallies in the statepoint for the tallies + required to compute kinetics parameters using the Iterated Fission + Probability (IFP) method. + + Returns + ------- + KineticsParameters + A named tuple containing the generation time and effective delayed + neutron fraction. If the necessary tallies for one or both + parameters are not found, that parameter is returned as None. + + """ + + denom_tally = None + gen_time_tally = None + beta_tally = None + for tally in self.tallies.values(): + if 'ifp-denominator' in tally.scores: + denom_tally = self.get_tally(scores=['ifp-denominator']) + if 'ifp-time-numerator' in tally.scores: + gen_time_tally = self.get_tally(scores=['ifp-time-numerator']) + if 'ifp-beta-numerator' in tally.scores: + beta_tally = self.get_tally(scores=['ifp-beta-numerator']) + + if denom_tally is None: + return KineticsParameters(None, None) + + def get_ufloat(tally, score): + return uarray(tally.get_values(scores=[score]), + tally.get_values(scores=[score], value='std_dev')) + + denom_values = get_ufloat(denom_tally, 'ifp-denominator') + if gen_time_tally is None: + generation_time = None + else: + gen_time_values = get_ufloat(gen_time_tally, 'ifp-time-numerator') + gen_time_values /= denom_values*self.keff + generation_time = gen_time_values.flatten()[0] + + if beta_tally is None: + beta_effective = None + else: + beta_values = get_ufloat(beta_tally, 'ifp-beta-numerator') + beta_values /= denom_values + beta_effective = beta_values.flatten() + if beta_effective.size == 1: + beta_effective = beta_effective[0] + + return KineticsParameters(generation_time, beta_effective) diff --git a/openmc/stats/multivariate.py b/openmc/stats/multivariate.py index cd474fa9b..2057f4a49 100644 --- a/openmc/stats/multivariate.py +++ b/openmc/stats/multivariate.py @@ -10,7 +10,7 @@ import numpy as np import openmc import openmc.checkvalue as cv -from .._xml import get_text +from .._xml import get_elem_list, get_text from ..mesh import MeshBase from .univariate import PowerLaw, Uniform, Univariate @@ -79,6 +79,9 @@ class PolarAzimuthal(UnitSphere): reference_uvw : Iterable of float Direction from which polar angle is measured. Defaults to the positive z-direction. + reference_vwu : Iterable of float + Direction from which azimuthal angle is measured. Defaults to the positive + x-direction. Attributes ---------- @@ -89,8 +92,9 @@ class PolarAzimuthal(UnitSphere): """ - def __init__(self, mu=None, phi=None, reference_uvw=(0., 0., 1.)): + def __init__(self, mu=None, phi=None, reference_uvw=(0., 0., 1.), reference_vwu=(1., 0., 0.)): super().__init__(reference_uvw) + self.reference_vwu = reference_vwu if mu is not None: self.mu = mu else: @@ -101,6 +105,20 @@ class PolarAzimuthal(UnitSphere): else: self.phi = Uniform(0., 2*pi) + @property + def reference_vwu(self): + return self._reference_vwu + + @reference_vwu.setter + def reference_vwu(self, vwu): + cv.check_type('reference v direction', vwu, Iterable, Real) + vwu = np.asarray(vwu) + uvw = self.reference_uvw + cv.check_greater_than('reference v direction must not be parallel to reference u direction', np.linalg.norm(np.cross(vwu,uvw)), 1e-6*np.linalg.norm(vwu)) + vwu -= vwu.dot(uvw)*uvw + cv.check_less_than('reference v direction must be orthogonal to reference u direction', np.abs(vwu.dot(uvw)), 1e-6) + self._reference_vwu = vwu/np.linalg.norm(vwu) + @property def mu(self): return self._mu @@ -119,19 +137,30 @@ class PolarAzimuthal(UnitSphere): cv.check_type('azimuthal angle', phi, Univariate) self._phi = phi - def to_xml_element(self): + def to_xml_element(self, element_name: str = None): """Return XML representation of the angular distribution + Parameters + ---------- + element_name : str, optional + XML element name + Returns ------- element : lxml.etree._Element XML element containing angular distribution data """ - element = ET.Element('angle') + if element_name is not None: + element = ET.Element(element_name) + else: + element = ET.Element('angle') + element.set("type", "mu-phi") if self.reference_uvw is not None: element.set("reference_uvw", ' '.join(map(str, self.reference_uvw))) + if self.reference_vwu is not None: + element.set("reference_vwu", ' '.join(map(str, self.reference_vwu))) element.append(self.mu.to_xml_element('mu')) element.append(self.phi.to_xml_element('phi')) return element @@ -152,19 +181,53 @@ class PolarAzimuthal(UnitSphere): """ mu_phi = cls() - uvw = get_text(elem, 'reference_uvw') + uvw = get_elem_list(elem, "reference_uvw", float) if uvw is not None: - mu_phi.reference_uvw = [float(x) for x in uvw.split()] + mu_phi.reference_uvw = uvw + vwu = get_elem_list(elem, "reference_vwu", float) + if vwu is not None: + mu_phi.reference_vwu = vwu mu_phi.mu = Univariate.from_xml_element(elem.find('mu')) mu_phi.phi = Univariate.from_xml_element(elem.find('phi')) return mu_phi class Isotropic(UnitSphere): - """Isotropic angular distribution.""" + """Isotropic angular distribution. - def __init__(self): + Parameters + ---------- + bias : openmc.stats.PolarAzimuthal, optional + Distribution for biased sampling. + + Attributes + ---------- + bias : openmc.stats.PolarAzimuthal or None + Distribution for biased sampling + + """ + + def __init__(self, bias: PolarAzimuthal | None = None): super().__init__() + self.bias = bias + + @property + def bias(self): + return self._bias + + @bias.setter + def bias(self, bias): + cv.check_type('Biasing distribution', bias, PolarAzimuthal, none_ok=True) + if bias is not None: + if (bias.mu.bias is not None) or (bias.phi.bias is not None): + raise RuntimeError('Biasing distributions should not have their own bias.') + elif (bias.mu.support != (-1., 1.) + or not np.all(np.isclose(bias.phi.support, (0., 2*np.pi)))): + raise ValueError("Biasing distribution for an isotropic " + "distribution should be supported on " + "mu=(-1.0,1.0) and phi=(0.0,2*pi).") + + self._bias = bias def to_xml_element(self): """Return XML representation of the isotropic distribution @@ -177,6 +240,15 @@ class Isotropic(UnitSphere): """ element = ET.Element('angle') element.set("type", "isotropic") + + if self.bias is not None: + bias_dist = self.bias + if (bias_dist.mu.bias is not None) or (bias_dist.phi.bias is not None): + raise RuntimeError('Biasing distributions should not have their own bias!') + else: + bias_elem = self.bias.to_xml_element("bias") + element.append(bias_elem) + return element @classmethod @@ -194,7 +266,13 @@ class Isotropic(UnitSphere): Isotropic distribution generated from XML element """ - return cls() + bias_elem = elem.find('bias') + if bias_elem is not None: + bias_dist = PolarAzimuthal.from_xml_element(bias_elem) + return cls(bias=bias_dist) + else: + return cls() + class Monodirectional(UnitSphere): @@ -246,9 +324,9 @@ class Monodirectional(UnitSphere): """ monodirectional = cls() - uvw = get_text(elem, 'reference_uvw') + uvw = get_elem_list(elem, "reference_uvw", float) if uvw is not None: - monodirectional.reference_uvw = [float(x) for x in uvw.split()] + monodirectional.reference_uvw = uvw return monodirectional @@ -504,7 +582,7 @@ class SphericalIndependent(Spatial): r = Univariate.from_xml_element(elem.find('r')) cos_theta = Univariate.from_xml_element(elem.find('cos_theta')) phi = Univariate.from_xml_element(elem.find('phi')) - origin = [float(x) for x in elem.get('origin').split()] + origin = get_elem_list(elem, "origin", float) return cls(r, cos_theta, phi, origin=origin) @@ -626,7 +704,7 @@ class CylindricalIndependent(Spatial): r = Univariate.from_xml_element(elem.find('r')) phi = Univariate.from_xml_element(elem.find('phi')) z = Univariate.from_xml_element(elem.find('z')) - origin = [float(x) for x in elem.get('origin').split()] + origin = get_elem_list(elem, "origin", float) return cls(r, phi, z, origin=origin) @@ -649,6 +727,9 @@ class MeshSpatial(Spatial): volume_normalized : bool, optional Whether or not the strengths will be multiplied by element volumes at runtime. Default is True. + bias : iterable of float, optional + An iterable of values giving the selection weights assigned to each + element during biased sampling. Attributes ---------- @@ -659,12 +740,16 @@ class MeshSpatial(Spatial): volume_normalized : bool Whether or not the strengths will be multiplied by element volumes at runtime. + bias : numpy.ndarray or None + Distribution for biased sampling """ - def __init__(self, mesh, strengths=None, volume_normalized=True): + def __init__(self, mesh, strengths=None, volume_normalized=True, + bias: Sequence[float] | None = None): self.mesh = mesh self.strengths = strengths self.volume_normalized = volume_normalized + self.bias = bias @property def mesh(self): @@ -697,6 +782,23 @@ class MeshSpatial(Spatial): else: self._strengths = None + @property + def bias(self): + return self._bias + + @bias.setter + def bias(self, given_bias): + if given_bias is not None: + cv.check_type('Biasing strengths array', given_bias, Iterable, Real) + bias_array = np.asarray(given_bias, dtype=float).flatten() + if bias_array.size != self.strengths.size: + raise ValueError( + 'Bias strengths array must have same size as strengths array.') + else: + self._bias = bias_array + else: + self._bias = None + @property def num_strength_bins(self): if self.strengths is None: @@ -722,6 +824,9 @@ class MeshSpatial(Spatial): subelement = ET.SubElement(element, 'strengths') subelement.text = ' '.join(str(e) for e in self.strengths) + if self.bias is not None: + Univariate._append_array_bias_to_xml(self, element) + return element @classmethod @@ -743,19 +848,16 @@ class MeshSpatial(Spatial): """ - mesh_id = int(elem.get('mesh_id')) + mesh_id = int(get_text(elem, "mesh_id")) # check if this mesh has been read in from another location already if mesh_id not in meshes: raise ValueError(f'Could not locate mesh with ID "{mesh_id}"') - volume_normalized = elem.get("volume_normalized") volume_normalized = get_text(elem, 'volume_normalized').lower() == 'true' - strengths = get_text(elem, 'strengths') - if strengths is not None: - strengths = [float(b) for b in get_text(elem, 'strengths').split()] - - return cls(meshes[mesh_id], strengths, volume_normalized) + strengths = get_elem_list(elem, 'strengths', float) + bias_strengths = Univariate._read_array_bias_from_xml(elem) + return cls(meshes[mesh_id], strengths, volume_normalized, bias=bias_strengths) class PointCloud(Spatial): @@ -773,6 +875,9 @@ class PointCloud(Spatial): strengths : iterable of float, optional An iterable of values that represents the relative probabilty of each point. + bias : iterable of float, optional + An iterable of values representing the relative probability of each + point under biased sampling. Attributes ---------- @@ -780,15 +885,19 @@ class PointCloud(Spatial): The points in space to be sampled with shape (N, 3) strengths : numpy.ndarray or None An array of relative probabilities for each mesh point + bias : numpy.ndarray or None + An array of relative probabilities for biased sampling of mesh points """ def __init__( self, positions: Sequence[Sequence[float]], - strengths: Sequence[float] | None = None + strengths: Sequence[float] | None = None, + bias: Sequence[float] | None = None ): self.positions = positions self.strengths = strengths + self.bias = bias @property def positions(self) -> np.ndarray: @@ -817,6 +926,23 @@ class PointCloud(Spatial): raise ValueError('strengths must have the same length as positions') self._strengths = strengths + @property + def bias(self): + return self._bias + + @bias.setter + def bias(self, given_bias): + if given_bias is not None: + cv.check_type('Biasing strengths array', given_bias, Iterable, Real) + bias_array = np.asarray(given_bias, dtype=float).flatten() + if bias_array.size != self.strengths.size: + raise ValueError( + 'Bias strengths array must have same size as strengths array.') + else: + self._bias = bias_array + else: + self._bias = None + @property def num_strength_bins(self) -> int: if self.strengths is None: @@ -842,6 +968,9 @@ class PointCloud(Spatial): subelement = ET.SubElement(element, 'strengths') subelement.text = ' '.join(str(e) for e in self.strengths) + if self.bias is not None: + Univariate._append_array_bias_to_xml(self, element) + return element @classmethod @@ -860,14 +989,12 @@ class PointCloud(Spatial): """ - coord_data = get_text(elem, 'coords') - positions = np.array([float(b) for b in coord_data.split()]).reshape((-1, 3)) + coord_data = get_elem_list(elem, 'coords', float) + positions = np.array(coord_data).reshape((-1, 3)) - strengths = get_text(elem, 'strengths') - if strengths is not None: - strengths = [float(b) for b in strengths.split()] - - return cls(positions, strengths) + strengths = get_elem_list(elem, 'strengths', float) + bias_strengths = Univariate._read_array_bias_from_xml(elem) + return cls(positions, strengths, bias=bias_strengths) class Box(Spatial): @@ -979,7 +1106,7 @@ class Box(Spatial): """ only_fissionable = get_text(elem, 'type') == 'fission' - params = [float(x) for x in get_text(elem, 'parameters').split()] + params = get_elem_list(elem, "parameters", float) lower_left = params[:len(params)//2] upper_right = params[len(params)//2:] return cls(lower_left, upper_right, only_fissionable) @@ -1046,7 +1173,7 @@ class Point(Spatial): Point distribution generated from XML element """ - xyz = [float(x) for x in get_text(elem, 'parameters').split()] + xyz = get_elem_list(elem, "parameters", float) return cls(xyz) diff --git a/openmc/stats/univariate.py b/openmc/stats/univariate.py index e0475bf78..272367f6f 100644 --- a/openmc/stats/univariate.py +++ b/openmc/stats/univariate.py @@ -1,18 +1,19 @@ from __future__ import annotations -import math from abc import ABC, abstractmethod from collections import defaultdict from collections.abc import Iterable, Sequence from copy import deepcopy +from math import sqrt, pi, exp from numbers import Real from warnings import warn import lxml.etree as ET import numpy as np from scipy.integrate import trapezoid +import scipy import openmc.checkvalue as cv -from .._xml import get_text +from .._xml import get_elem_list, get_text from ..mixin import EqualityMixin _INTERPOLATION_SCHEMES = { @@ -30,7 +31,55 @@ class Univariate(EqualityMixin, ABC): The Univariate class is an abstract class that can be derived to implement a specific probability distribution. + Parameters + ---------- + bias : Iterable of float, optional + Distribution or discrete probabilities for biased sampling or discrete + probabilities for biased sampling. + """ + def __init__(self, bias: Univariate | Sequence[float] | None = None): + self.bias = bias + + @property + def bias(self): + return self._bias + + @bias.setter + def bias(self, bias): + check_bias_support(self, bias) + self._bias = bias + + def _append_bias_to_xml(self, element: ET.Element) -> None: + """Append bias distribution element to XML if present.""" + if self.bias is not None: + if self.bias.bias is not None: + raise RuntimeError('Biasing distributions should not have their own bias.') + bias_elem = self.bias.to_xml_element("bias") + element.append(bias_elem) + + @classmethod + def _read_bias_from_xml(cls, elem: ET.Element): + """Read bias distribution from XML element if present.""" + bias_elem = elem.find('bias') + if bias_elem is not None: + return Univariate.from_xml_element(bias_elem) + return None + + def _append_array_bias_to_xml(self, element: ET.Element) -> None: + """Append array-based bias probabilities to XML.""" + if self.bias is not None: + bias_elem = ET.SubElement(element, "bias") + bias_elem.text = ' '.join(map(str, self.bias)) + + @classmethod + def _read_array_bias_from_xml(cls, elem: ET.Element): + """Read array-based bias probabilities from XML.""" + bias_elem = elem.find('bias') + if bias_elem is not None: + return get_elem_list(elem, "bias", float) + return None + @abstractmethod def to_xml_element(self, element_name): return '' @@ -57,8 +106,7 @@ class Univariate(EqualityMixin, ABC): return Normal.from_xml_element(elem) elif distribution == 'muir': # Support older files where Muir had its own class - params = [float(x) for x in get_text(elem, 'parameters').split()] - return muir(*params) + return muir(*get_elem_list(elem, "parameters", float)) elif distribution == 'tabular': return Tabular.from_xml_element(elem) elif distribution == 'legendre': @@ -67,8 +115,8 @@ class Univariate(EqualityMixin, ABC): return Mixture.from_xml_element(elem) @abstractmethod - def sample(n_samples: int = 1, seed: int | None = None): - """Sample the univariate distribution + def _sample_unbiased(self, n_samples: int = 1, seed: int | None = None): + """Sample without bias handling. Parameters ---------- @@ -80,10 +128,35 @@ class Univariate(EqualityMixin, ABC): Returns ------- numpy.ndarray - A 1-D array of sampled values + The array of sampled values """ pass + def sample(self, n_samples: int = 1, seed: int | None = None): + """Sample the univariate distribution, handling biasing automatically. + + Parameters + ---------- + n_samples : int + Number of sampled values to generate + seed : int or None + Initial random number seed. + + Returns + ------- + tuple of numpy.ndarray + A tuple of (samples, weights) + """ + if self.bias is None: + x = self._sample_unbiased(n_samples, seed) + return x, np.ones_like(x) + else: + if self.bias.bias is not None: + raise RuntimeError('Biasing distributions should not have their own bias.') + x, _ = self.bias.sample(n_samples=n_samples, seed=seed) + weight = self.evaluate(x) / self.bias.evaluate(x) + return x, weight + def integral(self): """Return integral of distribution @@ -96,6 +169,36 @@ class Univariate(EqualityMixin, ABC): """ return 1.0 + @abstractmethod + def evaluate(self, x: float | Sequence[float]): + """Evaluate the probability density at the provided value. + + Parameters + ---------- + x : float or sequence of float + Location to evaluate p(x) + + Returns + ------- + float or numpy.ndarray + Value of p(x) + """ + pass + + @property + @abstractmethod + def support(self): + """Return the support of the probability distribution. + + Returns + ------- + set or tuple of float or dict + Returns the set of unique points assigned probability mass in a + discrete distribution, the sampling interval for a continuous + distribution, or a dictionary storing the discrete and continuous + parts of the support of a mixed random variable + """ + pass def _intensity_clip(intensity: Sequence[float], tolerance: float = 1e-6) -> np.ndarray: """Clip low-importance points from an array of intensities. @@ -149,6 +252,9 @@ class Discrete(Univariate): Values of the random variable p : Iterable of float Discrete probability for each value + bias : Iterable of float, optional + Alternative discrete probabilities for biased sampling. Defaults to + None for unbiased sampling. Attributes ---------- @@ -156,12 +262,18 @@ class Discrete(Univariate): Values of the random variable p : numpy.ndarray Discrete probability for each value + support : set + Values of the random variable over which the distribution is + nonzero-valued + bias : numpy.ndarray or None + Discrete probabilities for biased sampling """ - def __init__(self, x, p): + def __init__(self, x, p, bias=None): self.x = x self.p = p + super().__init__(bias) def __len__(self): return len(self.x) @@ -190,10 +302,42 @@ class Discrete(Univariate): cv.check_greater_than('discrete probability', pk, 0.0, True) self._p = np.array(p, dtype=float) + @property + def support(self): + return set(np.unique(self._x)) + + @Univariate.bias.setter + def bias(self, bias): + if bias is None: + self._bias = bias + else: + if isinstance(bias, Real): + bias = [bias] + cv.check_type('discrete bias probabilities', bias, Iterable, Real) + for bk in bias: + cv.check_greater_than('discrete probability', bk, 0.0, True) + if len(bias) != len(self.x): + raise RuntimeError("Discrete distribution has unequal number of " + "biased and unbiased probability entries.") + self._bias = np.array(bias, dtype=float) + def cdf(self): return np.insert(np.cumsum(self.p), 0, 0.0) def sample(self, n_samples=1, seed=None): + if self.bias is None: + samples = self._sample_unbiased(n_samples, seed) + return samples, np.ones_like(samples) + else: + rng = np.random.RandomState(seed) + p = self.p / self.p.sum() + b = self.bias / self.bias.sum() + indices = rng.choice(self.x.size, n_samples, p=b) + biased_sample = self.x[indices] + wgt = p[indices] / b[indices] + return biased_sample, wgt + + def _sample_unbiased(self, n_samples=1, seed=None): rng = np.random.RandomState(seed) p = self.p / self.p.sum() return rng.choice(self.x, n_samples, p=p) @@ -203,6 +347,9 @@ class Discrete(Univariate): norm = sum(self.p) self.p = [val / norm for val in self.p] + def evaluate(self, x): + raise NotImplementedError + def to_xml_element(self, element_name): """Return XML representation of the discrete distribution @@ -222,7 +369,7 @@ class Discrete(Univariate): params = ET.SubElement(element, "parameters") params.text = ' '.join(map(str, self.x)) + ' ' + ' '.join(map(str, self.p)) - + self._append_array_bias_to_xml(element) return element @classmethod @@ -240,10 +387,11 @@ class Discrete(Univariate): Discrete distribution generated from XML element """ - params = [float(x) for x in get_text(elem, 'parameters').split()] + params = get_elem_list(elem, "parameters", float) x = params[:len(params)//2] p = params[len(params)//2:] - return cls(x, p) + bias_dist = cls._read_array_bias_from_xml(elem) + return cls(x, p, bias=bias_dist) @classmethod def merge( @@ -271,18 +419,52 @@ class Discrete(Univariate): if len(dists) != len(probs): raise ValueError("Number of distributions and probabilities must match.") + biasing = False + for d in dists: + if d.bias is not None: + # If we find that at least one distribution is biased, all + # distributions which are not biased will be assigned their + # default probability vector as a "bias" so that biased + # sampling can occur on the merged distribution. + biasing = True + break + # Combine distributions accounting for duplicate x values x_merged = set() p_merged = defaultdict(float) - for dist, p_dist in zip(dists, probs): - for x, p in zip(dist.x, dist.p): - x_merged.add(x) - p_merged[x] += p*p_dist + new_bias = None - # Create values and probabilities as arrays - x_arr = np.array(sorted(x_merged)) + if biasing: + b_merged = defaultdict(float) + + # Generate any missing bias distributions + dists = dists.copy() + for i, d in enumerate(dists): + if d.bias is None: + dists[i] = Discrete(d.x, d.p, bias=d.p) + + for dist, p_dist in zip(dists, probs): + for x, p, b in zip(dist.x, dist.p, dist.bias): + x_merged.add(x) + p_merged[x] += p*p_dist + b_merged[x] += b*p_dist + + # Create values and bias probabilities as arrays + x_arr = np.array(sorted(x_merged)) + new_bias = np.array([b_merged[x] for x in x_arr]) + + else: + for dist, p_dist in zip(dists, probs): + for x, p in zip(dist.x, dist.p): + x_merged.add(x) + p_merged[x] += p*p_dist + + # Create values as array + x_arr = np.array(sorted(x_merged)) + + # Create probabilities as array p_arr = np.array([p_merged[x] for x in x_arr]) - return cls(x_arr, p_arr) + return cls(x_arr, p_arr, new_bias) def integral(self): """Return integral of distribution @@ -296,6 +478,20 @@ class Discrete(Univariate): """ return np.sum(self.p) + def mean(self) -> float: + """Return mean of the discrete distribution + + The mean is the weighted average of the discrete values. + + .. versionadded:: 0.15.3 + + Returns + ------- + float + Mean of discrete distribution + """ + return np.sum(self.x * self.p) / np.sum(self.p) + def clip(self, tolerance: float = 1e-6, inplace: bool = False) -> Discrete: r"""Remove low-importance points from discrete distribution. @@ -305,6 +501,9 @@ class Discrete(Univariate): function will remove any low-importance points such that :math:`\sum_i x_i p_i` is preserved to within some threshold. + For biased distributions, clipping should be performed before the bias + probabilities are added. + .. versionadded:: 0.14.0 Parameters @@ -319,6 +518,10 @@ class Discrete(Univariate): Discrete distribution with low-importance points removed """ + if self.bias is not None: + raise RuntimeError("Biased discrete distributions should be clipped " + "before applying bias.") + cv.check_less_than("tolerance", tolerance, 1.0, equality=True) cv.check_greater_than("tolerance", tolerance, 0.0, equality=True) @@ -369,6 +572,8 @@ class Uniform(Univariate): Lower bound of the sampling interval. Defaults to zero. b : float, optional Upper bound of the sampling interval. Defaults to unity. + bias : openmc.stats.Univariate, optional + Distribution for biased sampling. Attributes ---------- @@ -376,12 +581,19 @@ class Uniform(Univariate): Lower bound of the sampling interval b : float Upper bound of the sampling interval + support : tuple of float + A 2-tuple (lower, upper) defining the interval over which the + distribution is nonzero-valued + bias : openmc.stats.Univariate or None + Distribution for biased sampling """ - def __init__(self, a: float = 0.0, b: float = 1.0): + def __init__(self, a: float = 0.0, b: float = 1.0, + bias: Univariate | None = None): self.a = a self.b = b + super().__init__(bias) def __len__(self): return 2 @@ -404,16 +616,37 @@ class Uniform(Univariate): cv.check_type('Uniform b', b, Real) self._b = b + @property + def support(self): + return (self._a, self._b) + def to_tabular(self): + if self.bias is not None: + raise RuntimeError("to_tabular() is not permitted for biased distributions.") prob = 1./(self.b - self.a) t = Tabular([self.a, self.b], [prob, prob], 'histogram') t.c = [0., 1.] return t - def sample(self, n_samples=1, seed=None): + def _sample_unbiased(self, n_samples=1, seed=None): rng = np.random.RandomState(seed) return rng.uniform(self.a, self.b, n_samples) + def evaluate(self, x): + return np.where((self.a <= x) & (x <= self.b), 1/(self.b - self.a), 0.0) + + def mean(self) -> float: + """Return mean of the uniform distribution + + .. versionadded:: 0.15.3 + + Returns + ------- + float + Mean of uniform distribution + """ + return 0.5 * (self.a + self.b) + def to_xml_element(self, element_name: str): """Return XML representation of the uniform distribution @@ -431,6 +664,7 @@ class Uniform(Univariate): element = ET.Element(element_name) element.set("type", "uniform") element.set("parameters", f'{self.a} {self.b}') + self._append_bias_to_xml(element) return element @classmethod @@ -448,8 +682,9 @@ class Uniform(Univariate): Uniform distribution generated from XML element """ - params = get_text(elem, 'parameters').split() - return cls(*map(float, params)) + params = get_elem_list(elem, "parameters", float) + bias_dist = cls._read_bias_from_xml(elem) + return cls(*params, bias=bias_dist) class PowerLaw(Univariate): @@ -468,6 +703,8 @@ class PowerLaw(Univariate): n : float, optional Power law exponent. Defaults to zero, which is equivalent to a uniform distribution. + bias : openmc.stats.Univariate, optional + Distribution for biased sampling. Attributes ---------- @@ -477,13 +714,23 @@ class PowerLaw(Univariate): Upper bound of the sampling interval n : float Power law exponent + support : tuple of float + A 2-tuple (lower, upper) defining the interval over which the + distribution is nonzero-valued + bias : openmc.stats.Univariate or None + Distribution for biased sampling """ - def __init__(self, a: float = 0.0, b: float = 1.0, n: float = 0.): + def __init__(self, a: float = 0.0, b: float = 1.0, n: float = 0., + bias: Univariate | None = None): + if a >= b: + raise ValueError( + "Lower bound of sampling interval must be less than upper bound.") self.a = a self.b = b self.n = n + super().__init__(bias) def __len__(self): return 3 @@ -495,6 +742,9 @@ class PowerLaw(Univariate): @a.setter def a(self, a): cv.check_type('interval lower bound', a, Real) + if a < 0: + raise ValueError( + "PowerLaw sampling is restricted to positive-valued intervals.") self._a = a @property @@ -504,6 +754,9 @@ class PowerLaw(Univariate): @b.setter def b(self, b): cv.check_type('interval upper bound', b, Real) + if b < 0: + raise ValueError( + "PowerLaw sampling is restricted to positive-valued intervals.") self._b = b @property @@ -515,7 +768,11 @@ class PowerLaw(Univariate): cv.check_type('power law exponent', n, Real) self._n = n - def sample(self, n_samples=1, seed=None): + @property + def support(self): + return (self._a, self._b) + + def _sample_unbiased(self, n_samples=1, seed=None): rng = np.random.RandomState(seed) xi = rng.random(n_samples) pwr = self.n + 1 @@ -523,6 +780,10 @@ class PowerLaw(Univariate): span = self.b**pwr - offset return np.power(offset + xi * span, 1/pwr) + def evaluate(self, x): + c = (self.n + 1)/(self.b**(self.n + 1) - self.a**(self.n + 1)) + return np.where((self.a <= x) & (x <= self.b), c * np.abs(x)**self.n, 0.0) + def to_xml_element(self, element_name: str): """Return XML representation of the power law distribution @@ -540,6 +801,7 @@ class PowerLaw(Univariate): element = ET.Element(element_name) element.set("type", "powerlaw") element.set("parameters", f'{self.a} {self.b} {self.n}') + self._append_bias_to_xml(element) return element @classmethod @@ -557,8 +819,9 @@ class PowerLaw(Univariate): Distribution generated from XML element """ - params = get_text(elem, 'parameters').split() - return cls(*map(float, params)) + params = get_elem_list(elem, "parameters", float) + bias_dist = cls._read_bias_from_xml(elem) + return cls(*map(float, params), bias=bias_dist) class Maxwell(Univariate): @@ -572,16 +835,24 @@ class Maxwell(Univariate): ---------- theta : float Effective temperature for distribution in eV + bias : openmc.stats.Univariate, optional + Distribution for biased sampling. Attributes ---------- theta : float Effective temperature for distribution in eV + support : tuple of float + A 2-tuple (lower, upper) defining the interval over which the + distribution is nonzero-valued + bias : openmc.stats.Univariate or None + Distribution for biased sampling """ - def __init__(self, theta): + def __init__(self, theta, bias: Univariate | None = None): self.theta = theta + super().__init__(bias) def __len__(self): return 1 @@ -596,7 +867,11 @@ class Maxwell(Univariate): cv.check_greater_than('Maxwell temperature', theta, 0.0) self._theta = theta - def sample(self, n_samples=1, seed=None): + @property + def support(self): + return (0.0, np.inf) + + def _sample_unbiased(self, n_samples=1, seed=None): rng = np.random.RandomState(seed) return self.sample_maxwell(self.theta, n_samples, rng=rng) @@ -604,9 +879,10 @@ class Maxwell(Univariate): def sample_maxwell(t, n_samples: int, rng=None): if rng is None: rng = np.random.default_rng() - r1, r2, r3 = rng.random((3, n_samples)) - c = np.cos(0.5 * np.pi * r3) - return -t * (np.log(r1) + np.log(r2) * c * c) + return rng.gamma(1.5, t, n_samples) + + def evaluate(self, E): + return scipy.stats.gamma.pdf(E, 1.5, scale=self.theta) def to_xml_element(self, element_name: str): """Return XML representation of the Maxwellian distribution @@ -625,6 +901,7 @@ class Maxwell(Univariate): element = ET.Element(element_name) element.set("type", "maxwell") element.set("parameters", str(self.theta)) + self._append_bias_to_xml(element) return element @classmethod @@ -643,7 +920,8 @@ class Maxwell(Univariate): """ theta = float(get_text(elem, 'parameters')) - return cls(theta) + bias_dist = cls._read_bias_from_xml(elem) + return cls(theta, bias=bias_dist) class Watt(Univariate): @@ -659,6 +937,8 @@ class Watt(Univariate): First parameter of distribution in units of eV b : float Second parameter of distribution in units of 1/eV + bias : openmc.stats.Univariate, optional + Distribution for biased sampling. Attributes ---------- @@ -666,12 +946,18 @@ class Watt(Univariate): First parameter of distribution in units of eV b : float Second parameter of distribution in units of 1/eV + support : tuple of float + A 2-tuple (lower, upper) defining the interval over which the + distribution is nonzero-valued + bias : openmc.stats.Univariate or None + Distribution for biased sampling """ - def __init__(self, a=0.988e6, b=2.249e-6): + def __init__(self, a=0.988e6, b=2.249e-6, bias: Univariate | None = None): self.a = a self.b = b + super().__init__(bias) def __len__(self): return 2 @@ -696,13 +982,21 @@ class Watt(Univariate): cv.check_greater_than('Watt b', b, 0.0) self._b = b - def sample(self, n_samples=1, seed=None): + @property + def support(self): + return (0.0, np.inf) + + def _sample_unbiased(self, n_samples=1, seed=None): rng = np.random.RandomState(seed) w = Maxwell.sample_maxwell(self.a, n_samples, rng=rng) u = rng.uniform(-1., 1., n_samples) aab = self.a * self.a * self.b return w + 0.25*aab + u*np.sqrt(aab*w) + def evaluate(self, E): + c = 2.0/(sqrt(pi * self.b) * (self.a**1.5) * exp(self.a*self.b/4)) + return c*np.exp(-E/self.a)*np.sinh(np.sqrt(self.b*E)) + def to_xml_element(self, element_name: str): """Return XML representation of the Watt distribution @@ -720,6 +1014,7 @@ class Watt(Univariate): element = ET.Element(element_name) element.set("type", "watt") element.set("parameters", f'{self.a} {self.b}') + self._append_bias_to_xml(element) return element @classmethod @@ -737,8 +1032,9 @@ class Watt(Univariate): Watt distribution generated from XML element """ - params = get_text(elem, 'parameters').split() - return cls(*map(float, params)) + params = get_elem_list(elem, "parameters", float) + bias_dist = cls._read_bias_from_xml(elem) + return cls(*map(float, params), bias=bias_dist) class Normal(Univariate): @@ -754,6 +1050,8 @@ class Normal(Univariate): Mean value of the distribution std_dev : float Standard deviation of the Normal distribution + bias : openmc.stats.Univariate, optional + Distribution for biased sampling. Attributes ---------- @@ -761,11 +1059,17 @@ class Normal(Univariate): Mean of the Normal distribution std_dev : float Standard deviation of the Normal distribution + support : tuple of float + A 2-tuple (lower, upper) defining the interval over which the + distribution is nonzero-valued + bias : openmc.stats.Univariate or None + Distribution for biased sampling """ - def __init__(self, mean_value, std_dev): + def __init__(self, mean_value, std_dev, bias: Univariate | None = None): self.mean_value = mean_value self.std_dev = std_dev + super().__init__(bias) def __len__(self): return 2 @@ -789,10 +1093,17 @@ class Normal(Univariate): cv.check_greater_than('Normal std_dev', std_dev, 0.0) self._std_dev = std_dev - def sample(self, n_samples=1, seed=None): + @property + def support(self): + return (-np.inf, np.inf) + + def _sample_unbiased(self, n_samples=1, seed=None): rng = np.random.RandomState(seed) return rng.normal(self.mean_value, self.std_dev, n_samples) + def evaluate(self, x): + return scipy.stats.norm.pdf(x, self.mean_value, self.std_dev) + def to_xml_element(self, element_name: str): """Return XML representation of the Normal distribution @@ -810,6 +1121,7 @@ class Normal(Univariate): element = ET.Element(element_name) element.set("type", "normal") element.set("parameters", f'{self.mean_value} {self.std_dev}') + self._append_bias_to_xml(element) return element @classmethod @@ -827,11 +1139,12 @@ class Normal(Univariate): Normal distribution generated from XML element """ - params = get_text(elem, 'parameters').split() - return cls(*map(float, params)) + params = get_elem_list(elem, "parameters", float) + bias_dist = cls._read_bias_from_xml(elem) + return cls(*map(float, params), bias=bias_dist) -def muir(e0: float, m_rat: float, kt: float): +def muir(e0: float, m_rat: float, kt: float, bias: Univariate | None = None): """Generate a Muir energy spectrum The Muir energy spectrum is a normal distribution, but for convenience @@ -849,6 +1162,8 @@ def muir(e0: float, m_rat: float, kt: float): Ratio of the sum of the masses of the reaction inputs to 1 amu kt : float Ion temperature for the Muir distribution in [eV] + bias : openmc.stats.Univariate, optional + Distribution for biased sampling. Returns ------- @@ -857,8 +1172,8 @@ def muir(e0: float, m_rat: float, kt: float): """ # https://permalink.lanl.gov/object/tr?what=info:lanl-repo/lareport/LA-05411-MS - std_dev = math.sqrt(2 * e0 * kt / m_rat) - return Normal(e0, std_dev) + std_dev = sqrt(2 * e0 * kt / m_rat) + return Normal(e0, std_dev, bias) # Retain deprecated name for the time being @@ -892,6 +1207,8 @@ class Tabular(Univariate): points. Defaults to 'linear-linear'. ignore_negative : bool Ignore negative probabilities + bias : openmc.stats.Univariate, optional + Distribution for biased sampling. Attributes ---------- @@ -902,6 +1219,11 @@ class Tabular(Univariate): interpolation : {'histogram', 'linear-linear', 'linear-log', 'log-linear', 'log-log'} Indicates how the density function is interpolated between tabulated points. Defaults to 'linear-linear'. + support : tuple of float + A 2-tuple (lower, upper) defining the interval over which the + distribution is nonzero-valued + bias : openmc.stats.Univariate or None + Distribution for biased sampling Notes ----- @@ -919,7 +1241,8 @@ class Tabular(Univariate): x: Sequence[float], p: Sequence[float], interpolation: str = 'linear-linear', - ignore_negative: bool = False + ignore_negative: bool = False, + bias: Univariate | None = None ): self.interpolation = interpolation @@ -941,6 +1264,7 @@ class Tabular(Univariate): self._x = x self._p = p + super().__init__(bias) def __len__(self): return self.p.size @@ -962,6 +1286,10 @@ class Tabular(Univariate): cv.check_value('interpolation', interpolation, _INTERPOLATION_SCHEMES) self._interpolation = interpolation + @property + def support(self): + return (self._x[0], self._x[-1]) + def cdf(self): c = np.zeros_like(self.x) x = self.x @@ -1015,7 +1343,7 @@ class Tabular(Univariate): """Normalize the probabilities stored on the distribution""" self._p /= self.cdf().max() - def sample(self, n_samples: int = 1, seed: int | None = None): + def _sample_unbiased(self, n_samples: int = 1, seed: int | None = None): rng = np.random.RandomState(seed) xi = rng.random(n_samples) @@ -1076,6 +1404,39 @@ class Tabular(Univariate): assert all(samples_out < self.x[-1]) return samples_out + def sample(self, n_samples: int = 1, seed: int | None = None): + if self.bias is None: + samples = self._sample_unbiased(n_samples, seed) + return samples, np.ones_like(samples) + else: + if self.bias.bias is not None: + raise RuntimeError('Biasing distributions should not have their own bias.') + biased_sample, _ = self.bias.sample(n_samples=n_samples, seed=seed) + self.normalize() # must have normalized probabilities to apply correct weights + wgt = np.array([self.evaluate(s) / self.bias.evaluate(s) for s in biased_sample]) + return biased_sample, wgt + + def evaluate(self, x): + if self.interpolation == 'linear-linear': + i = np.searchsorted(self.x, x, side='left') - 1 + if i < 0 or i >= len(self.p) - 1: + return 0.0 + x0, x1 = self.x[i], self.x[i + 1] + p0, p1 = self.p[i], self.p[i + 1] + t = (x - x0) / (x1 - x0) + return (1 - t) * p0 + t * p1 + + elif self.interpolation == 'histogram': + i = np.searchsorted(self.x, x, side='right') - 1 + if i < 0 or i >= len(self.p): + return 0.0 + return self.p[i] + + else: + raise NotImplementedError('Can only evaluate tabular ' + 'distributions using histogram ' + 'or linear-linear interpolation.') + def to_xml_element(self, element_name: str): """Return XML representation of the tabular distribution @@ -1096,7 +1457,7 @@ class Tabular(Univariate): params = ET.SubElement(element, "parameters") params.text = ' '.join(map(str, self.x)) + ' ' + ' '.join(map(str, self.p)) - + self._append_bias_to_xml(element) return element @classmethod @@ -1115,11 +1476,12 @@ class Tabular(Univariate): """ interpolation = get_text(elem, 'interpolation') - params = [float(x) for x in get_text(elem, 'parameters').split()] + params = get_elem_list(elem, "parameters", float) m = (len(params) + 1)//2 # +1 for when len(params) is odd x = params[:m] p = params[m:] - return cls(x, p, interpolation) + bias_dist = cls._read_bias_from_xml(elem) + return cls(x, p, interpolation, bias=bias_dist) def integral(self): """Return integral of distribution @@ -1149,16 +1511,24 @@ class Legendre(Univariate): coefficients : Iterable of Real Expansion coefficients :math:`a_\ell`. Note that the :math:`(2\ell + 1)/2` factor should not be included. + bias : openmc.stats.Univariate or None, optional + Distribution for biased sampling. Attributes ---------- coefficients : Iterable of Real Expansion coefficients :math:`a_\ell`. Note that the :math:`(2\ell + 1)/2` factor should not be included. + support : tuple of float + A 2-tuple (lower, upper) defining the interval over which the + distribution is nonzero-valued + bias : openmc.stats.Univariate or None + Distribution for biased sampling """ - def __init__(self, coefficients: Sequence[float]): + def __init__(self, coefficients: Sequence[float], bias: Univariate | None = None): + super().__init__(bias) self.coefficients = coefficients self._legendre_poly = None @@ -1182,9 +1552,19 @@ class Legendre(Univariate): def coefficients(self, coefficients): self._coefficients = np.asarray(coefficients) + @property + def support(self): + raise NotImplementedError + + def _sample_unbiased(self, n_samples=1, seed=None): + raise NotImplementedError + def sample(self, n_samples=1, seed=None): raise NotImplementedError + def evaluate(self, x): + raise NotImplementedError + def to_xml_element(self, element_name): raise NotImplementedError @@ -1202,6 +1582,9 @@ class Mixture(Univariate): Probability of selecting a particular distribution distribution : Iterable of Univariate List of distributions with corresponding probabilities + bias : Iterable of Real, optional + Probability of selecting a particular distribution under biased + sampling Attributes ---------- @@ -1209,14 +1592,20 @@ class Mixture(Univariate): Probability of selecting a particular distribution distribution : Iterable of Univariate List of distributions with corresponding probabilities + support : dict + Dictionary containing discrete and continuous parts of the support + bias : numpy.ndarray or None + Probability of selecting each distribution under biased sampling """ def __init__( self, probability: Sequence[float], - distribution: Sequence[Univariate] + distribution: Sequence[Univariate], + bias: Sequence[float] | None = None ): + super().__init__(bias) self.probability = probability self.distribution = distribution @@ -1246,10 +1635,52 @@ class Mixture(Univariate): Iterable, Univariate) self._distribution = distribution + @Univariate.bias.setter + def bias(self, bias): + if bias is None: + self._bias = bias + else: + cv.check_type('biased mixture distribution probabilities', bias, + Iterable, Real) + for b in bias: + cv.check_greater_than('biased mixture distribution probabilities', + b, 0.0, True) + self._bias = np.array(bias, dtype=float) + + @property + def support(self): + discrete_points = set() + intervals = [] + + for dist in self.distribution: + if isinstance(dist, Discrete): + discrete_points |= dist.support + else: + intervals.append(tuple(dist.support)) + + if intervals: + # simplify union by combining intervals when able + sorted_intervals = sorted(intervals, key=lambda x: x[0]) + merged = [sorted_intervals[0]] + + for current in sorted_intervals[1:]: + prev_start, prev_end = merged[-1] + curr_start, curr_end = current + + if curr_start <= prev_end: + merged[-1] = (prev_start, max(prev_end, curr_end)) + else: + merged.append(current) + + intervals = merged + + return {"discrete": discrete_points, "continuous": intervals} + def cdf(self): return np.insert(np.cumsum(self.probability), 0, 0.0) - def sample(self, n_samples=1, seed=None): + def _sample_unbiased(self, n_samples=1, seed=None): + # Mixture uses internal bias mechanism, not base class bias rng = np.random.RandomState(seed) # Get probability of each distribution accounting for its intensity @@ -1262,11 +1693,49 @@ class Mixture(Univariate): # Draw samples from the distributions sampled above out = np.empty_like(idx, dtype=float) + out_wgt = np.empty_like(idx, dtype=float) for i in np.unique(idx): n_dist_samples = np.count_nonzero(idx == i) - samples = self.distribution[i].sample(n_dist_samples) + samples, weights = self.distribution[i].sample(n_dist_samples) out[idx == i] = samples - return out + out_wgt[idx == i] = weights + return out, out_wgt + + def sample(self, n_samples=1, seed=None): + # Mixture uses internal bias mechanism, not base class bias + if self.bias is None: + return self._sample_unbiased(n_samples, seed) + + rng = np.random.RandomState(seed) + + # Get probability of each distribution accounting for its intensity + p = np.array([prob*dist.integral() for prob, dist in + zip(self.probability, self.distribution)]) + p /= p.sum() + + b = np.array([prob*dist.integral() for prob, dist in + zip(self.bias, self.distribution)]) + b /= b.sum() + + # Sample from the distributions using biased probabilities + idx = rng.choice(range(len(self.distribution)), n_samples, p=b) + idx_wgt = np.ones(n_samples) + for i in np.unique(idx): + idx_wgt[idx == i] = p[i]/b[i] + + # Draw samples from the distributions sampled above + out = np.empty_like(idx, dtype=float) + out_wgt = np.empty_like(idx, dtype=float) + for i in np.unique(idx): + n_dist_samples = np.count_nonzero(idx == i) + samples, weights = self.distribution[i].sample(n_dist_samples) + out[idx == i] = samples + out_wgt[idx == i] = weights * idx_wgt[idx == i] + return out, out_wgt + + def evaluate(self, x): + raise NotImplementedError( + "evaluate() is undefined for Mixture distributions") def normalize(self): """Normalize the probabilities stored on the distribution""" @@ -1297,6 +1766,7 @@ class Mixture(Univariate): data.set("probability", str(p)) data.append(d.to_xml_element("dist")) + self._append_array_bias_to_xml(element) return element @classmethod @@ -1322,7 +1792,8 @@ class Mixture(Univariate): probability.append(float(get_text(pair, 'probability'))) distribution.append(Univariate.from_xml_element(pair.find("dist"))) - return cls(probability, distribution) + bias_dist = cls._read_array_bias_from_xml(elem) + return cls(probability, distribution, bias=bias_dist) def integral(self): """Return integral of the distribution @@ -1339,6 +1810,30 @@ class Mixture(Univariate): for p, dist in zip(self.probability, self.distribution) ]) + def mean(self) -> float: + """Return mean of the mixture distribution + + The mean is the weighted average of the means of the component + distributions, weighted by probability * integral. + + .. versionadded:: 0.15.3 + + Returns + ------- + float + Mean of the mixture distribution + """ + # Weight each component by its probability and integral + weights = [p*dist.integral() for p, dist in + zip(self.probability, self.distribution)] + total_weight = sum(weights) + + if total_weight == 0: + return 0.0 + + return sum([w*dist.mean() for w, dist in + zip(weights, self.distribution)]) / total_weight + def clip(self, tolerance: float = 1e-6, inplace: bool = False) -> Mixture: r"""Remove low-importance points / distributions @@ -1361,14 +1856,14 @@ class Mixture(Univariate): Distribution with low-importance points / distributions removed """ - # Determine integral of original distribution to compare later - original_integral = self.integral() + # Calculate mean * integral for original distribution to compare later. + original_mean_integral = self.mean() * self.integral() # Determine indices for any distributions that contribute non-negligibly - # to overall intensity - intensities = [prob*dist.integral() for prob, dist in - zip(self.probability, self.distribution)] - indices = _intensity_clip(intensities, tolerance=tolerance) + # to overall mean * integral + mean_integrals = [prob*dist.mean()*dist.integral() for prob, dist in + zip(self.probability, self.distribution)] + indices = _intensity_clip(mean_integrals, tolerance=tolerance) # Clip mixture of distributions probability = self.probability[indices] @@ -1389,12 +1884,14 @@ class Mixture(Univariate): # Create new distribution new_dist = type(self)(probability, distribution) - # Show warning if integral of new distribution is not within - # tolerance of original - diff = (original_integral - new_dist.integral())/original_integral + # Show warning if mean * integral of new distribution is not within + # tolerance of original. For energy distributions, mean * integral + # represents total energy. + new_mean_integral = new_dist.mean() * new_dist.integral() + diff = (original_mean_integral - new_mean_integral)/original_mean_integral if diff > tolerance: - warn("Clipping mixture distribution resulted in an integral that is " - f"lower by a fraction of {diff} when tolerance={tolerance}.") + warn("Clipping mixture distribution resulted in a mean*integral " + f"that is lower by a fraction of {diff} when tolerance={tolerance}.") return new_dist @@ -1450,3 +1947,50 @@ def combine_distributions( dist_list[:] = [Mixture(probs, dist_list.copy())] return dist_list[0] + + +def check_bias_support(parent: Univariate, bias: Univariate | None): + """Ensure that bias distributions share the support of the univariate + distribution they are biasing. + + Parameters + ---------- + parent : openmc.stats.Univariate + Distributions to be biased + bias : openmc.stats.Univariate or None + Proposed bias distribution + + """ + if bias is None: + return + + def mismatch_error(err_type, msg): + raise err_type(f"Support of parent {type(parent).__name__} and bias " + f"{type(bias).__name__} distributions do not match. " + f"{msg}") + + p_sup, b_sup = parent.support, bias.support + + if isinstance(p_sup, set) or isinstance(b_sup, set): + raise RuntimeError("Discrete distributions cannot be used as biasing " + "distributions or be biased by another Univariate " + "distribution. Instead, assign a vector of " + "alternate probabilities to the bias attribute.") + + elif isinstance(p_sup, dict) or isinstance (b_sup, dict): + raise RuntimeError("Mixture distributions cannot be used as biasing " + "distributions or be biased by another Univariate " + "distribution. Instead, instantiate the Mixture " + "object using biased member distributions, or " + "assign a vector of alternative probabilities to " + "the bias attribute.") + + elif isinstance(p_sup, tuple): + if isinstance(b_sup, tuple): + if p_sup != b_sup: + mismatch_error(ValueError, "") + else: + mismatch_error(TypeError, "Incompatible support types.") + + else: + raise TypeError("Unrecognized type for parent distribution support") diff --git a/openmc/summary.py b/openmc/summary.py index 6423f8ce1..ca5cfadd7 100644 --- a/openmc/summary.py +++ b/openmc/summary.py @@ -127,11 +127,23 @@ class Summary: self._fast_materials[material.id] = material def _read_surfaces(self): + periodic_surface_ids = set() for group in self._f['geometry/surfaces'].values(): surface = openmc.Surface.from_hdf5(group) # surface may be None for DAGMC surfaces if surface: self._fast_surfaces[surface.id] = surface + if surface.boundary_type == "periodic": + periodic_surface_ids.add(surface.id) + + # Assign periodic surfaces when information is in file + for surface_id in periodic_surface_ids: + group = self._f[f'geometry/surfaces/surface {surface_id}'] + surface = self._fast_surfaces[surface_id] + if 'periodic_surface_id' in group: + periodic_surface_id = int(group['periodic_surface_id'][()]) + surface.periodic_surface = self._fast_surfaces[periodic_surface_id] + def _read_cells(self): diff --git a/openmc/surface.py b/openmc/surface.py index 840c3125d..1fe5fabdf 100644 --- a/openmc/surface.py +++ b/openmc/surface.py @@ -13,6 +13,7 @@ from .checkvalue import check_type, check_value, check_length, check_greater_tha from .mixin import IDManagerMixin, IDWarning from .region import Region, Intersection, Union from .bounding_box import BoundingBox +from ._xml import get_elem_list, get_text _BOUNDARY_TYPES = {'transmission', 'vacuum', 'reflective', 'periodic', 'white'} @@ -122,9 +123,8 @@ class Surface(IDManagerMixin, ABC): boundary_type : {'transmission', 'vacuum', 'reflective', 'periodic', 'white'}, optional Boundary condition that defines the behavior for particles hitting the surface. Defaults to transmissive boundary condition where particles - freely pass through the surface. Note that periodic boundary conditions - can only be applied to x-, y-, and z-planes, and only axis-aligned - periodicity is supported. + freely pass through the surface. Note that only axis-aligned + periodicity is supported around the x-, y-, and z-axes. albedo : float, optional Albedo of the surfaces as a ratio of particle weight after interaction with the surface to the initial weight. Values must be positive. Only @@ -451,17 +451,17 @@ class Surface(IDManagerMixin, ABC): """ # Determine appropriate class - surf_type = elem.get('type') + surf_type = get_text(elem, "type") cls = _SURFACE_CLASSES[surf_type] # Determine ID, boundary type, boundary albedo, coefficients kwargs = {} - kwargs['surface_id'] = int(elem.get('id')) - kwargs['boundary_type'] = elem.get('boundary', 'transmission') + kwargs['surface_id'] = int(get_text(elem, "id")) + kwargs['boundary_type'] = get_text(elem, "boundary", "transmission") if kwargs['boundary_type'] in _ALBEDO_BOUNDARIES: - kwargs['albedo'] = float(elem.get('albedo', 1.0)) - kwargs['name'] = elem.get('name') - coeffs = [float(x) for x in elem.get('coeffs').split()] + kwargs['albedo'] = float(get_text(elem, "albedo", 1.0)) + kwargs['name'] = get_text(elem, "name") + coeffs = get_elem_list(elem, "coeffs", float) kwargs.update(dict(zip(cls._coeff_keys, coeffs))) return cls(**kwargs) @@ -821,8 +821,7 @@ class XPlane(PlaneMixin, Surface): boundary_type : {'transmission', 'vacuum', 'reflective', 'periodic', 'white'}, optional Boundary condition that defines the behavior for particles hitting the surface. Defaults to transmissive boundary condition where particles - freely pass through the surface. Only axis-aligned periodicity is - supported, i.e., x-planes can only be paired with x-planes. + freely pass through the surface. albedo : float, optional Albedo of the surfaces as a ratio of particle weight after interaction with the surface to the initial weight. Values must be positive. Only @@ -886,8 +885,7 @@ class YPlane(PlaneMixin, Surface): boundary_type : {'transmission', 'vacuum', 'reflective', 'periodic', 'white'}, optional Boundary condition that defines the behavior for particles hitting the surface. Defaults to transmissive boundary condition where particles - freely pass through the surface. Only axis-aligned periodicity is - supported, i.e., y-planes can only be paired with y-planes. + freely pass through the surface. albedo : float, optional Albedo of the surfaces as a ratio of particle weight after interaction with the surface to the initial weight. Values must be positive. Only @@ -951,8 +949,7 @@ class ZPlane(PlaneMixin, Surface): boundary_type : {'transmission', 'vacuum', 'reflective', 'periodic', 'white'}, optional Boundary condition that defines the behavior for particles hitting the surface. Defaults to transmissive boundary condition where particles - freely pass through the surface. Only axis-aligned periodicity is - supported, i.e., z-planes can only be paired with z-planes. + freely pass through the surface. albedo : float, optional Albedo of the surfaces as a ratio of particle weight after interaction with the surface to the initial weight. Values must be positive. Only diff --git a/openmc/tallies.py b/openmc/tallies.py index ebb313551..7b1ef0219 100644 --- a/openmc/tallies.py +++ b/openmc/tallies.py @@ -3,6 +3,7 @@ from collections.abc import Iterable, MutableSequence import copy from functools import partial, reduce, wraps from itertools import product +from math import sqrt, log from numbers import Integral, Real import operator from pathlib import Path @@ -11,11 +12,12 @@ import lxml.etree as ET import h5py import numpy as np import pandas as pd -import scipy.sparse as sps +from scipy.stats import chi2, norm import openmc import openmc.checkvalue as cv -from ._xml import clean_indentation, reorder_attributes, get_text +from ._sparse_compat import lil_array +from ._xml import clean_indentation, get_elem_list, get_text from .mixin import IDManagerMixin from .mesh import MeshBase @@ -91,10 +93,24 @@ class Tally(IDManagerMixin): sum_sq : numpy.ndarray An array containing the sum of each independent realization squared for each bin + sum_third : numpy.ndarray + An array containing the sum of each independent realization to the third power for + each bin + sum_fourth : numpy.ndarray + An array containing the sum of each independent realization to the fourth power for + each bin mean : numpy.ndarray An array containing the sample mean for each bin std_dev : numpy.ndarray An array containing the sample standard deviation for each bin + vov : numpy.ndarray + An array containing the variance of the variance for each tally bin + higher_moments : bool + Whether or not the tally accumulates the sums third and fourth to compute higher-order moments + figure_of_merit : numpy.ndarray + An array containing the figure of merit for each bin + + .. versionadded:: 0.15.3 derived : bool Whether or not the tally is derived from one or more other tallies sparse : bool @@ -125,8 +141,13 @@ class Tally(IDManagerMixin): self._sum = None self._sum_sq = None + self._sum_third = None + self._sum_fourth = None self._mean = None self._std_dev = None + self._vov = None + self._higher_moments = False + self._simulation_time = None self._with_batch_statistics = False self._derived = False self._sparse = False @@ -216,6 +237,15 @@ class Tally(IDManagerMixin): cv.check_type('multiply density', value, bool) self._multiply_density = value + @property + def higher_moments(self) -> bool: + return self._higher_moments + + @higher_moments.setter + def higher_moments(self, value): + cv.check_type("higher_moments", value, bool) + self._higher_moments = value + @property def filters(self): return self._filters @@ -260,7 +290,7 @@ class Tally(IDManagerMixin): @property def num_nuclides(self): - return len(self._nuclides) + return max(len(self._nuclides), 1) @property def scores(self): @@ -363,9 +393,19 @@ class Tally(IDManagerMixin): group = f[f'tallies/tally {self.id}'] self._num_realizations = int(group['n_realizations'][()]) + for filt in self.filters: + if isinstance(filt, openmc.DistribcellFilter): + filter_group = f[f'tallies/filters/filter {filt.id}'] + filt._num_bins = int(filter_group['n_bins'][()]) + # Update nuclides nuclide_names = group['nuclides'][()] self._nuclides = [name.decode().strip() for name in nuclide_names] + # Check for higher_moments attribute + if "higher_moments" in group.attrs: + self._higher_moments = bool(group.attrs["higher_moments"][()]) + else: + self._higher_moments = False # Extract Tally data from the file data = group['results'] @@ -380,10 +420,28 @@ class Tally(IDManagerMixin): self._sum = sum_ self._sum_sq = sum_sq + if self._higher_moments: + # Extract additional Tally data when higher moments enabled + sum_third = data[:, :, 2] + sum_fourth = data[:, :, 3] + + # Reshape the results arrays + sum_third = np.reshape(sum_third, self.shape) + sum_fourth = np.reshape(sum_fourth, self.shape) + + # Set the additional data for this Tally + self._sum_third = sum_third + self._sum_fourth = sum_fourth + # Convert NumPy arrays to SciPy sparse LIL matrices if self.sparse: - self._sum = sps.lil_matrix(self._sum.flatten(), self._sum.shape) - self._sum_sq = sps.lil_matrix(self._sum_sq.flatten(), self._sum_sq.shape) + self._sum = lil_array(self._sum.flatten(), self._sum.shape) + self._sum_sq = lil_array(self._sum_sq.flatten(), self._sum_sq.shape) + self._sum_third = lil_array(self._sum_third.flatten(), self._sum_third.shape) + self._sum_fourth = lil_array(self._sum_fourth.flatten(), self._sum_fourth.shape) + + # Read simulation time (needed for figure of merit) + self._simulation_time = f["runtime"]["simulation"][()] # Indicate that Tally results have been read self._results_read = True @@ -420,6 +478,52 @@ class Tally(IDManagerMixin): cv.check_type('sum_sq', sum_sq, Iterable) self._sum_sq = sum_sq + @property + @ensure_results + def sum_third(self): + if not self._higher_moments: + raise ValueError( + "Higher moments have not been enabled for this tally. To make " + "higher moments available, set the higher_moments attribute to " + "True before running a simulation." + ) + + if not self._sp_filename or self.derived: + return None + + if self.sparse: + return np.reshape(self._sum_third.toarray(), self.shape) + else: + return self._sum_third + + @sum_third.setter + def sum_third(self, sum_third): + cv.check_type("sum_third", sum_third, Iterable) + self._sum_third = sum_third + + @property + @ensure_results + def sum_fourth(self): + if not self._higher_moments: + raise ValueError( + "Higher moments have not been enabled for this tally. To make " + "higher moments available, set the higher_moments attribute to " + "True before running a simulation." + ) + + if not self._sp_filename or self.derived: + return None + + if self.sparse: + return np.reshape(self._sum_fourth.toarray(), self.shape) + else: + return self._sum_fourth + + @sum_fourth.setter + def sum_fourth(self, sum_fourth): + cv.check_type("sum_fourth", sum_fourth, Iterable) + self._sum_fourth = sum_fourth + @property def mean(self): if self._mean is None: @@ -430,8 +534,7 @@ class Tally(IDManagerMixin): # Convert NumPy array to SciPy sparse LIL matrix if self.sparse: - self._mean = sps.lil_matrix(self._mean.flatten(), - self._mean.shape) + self._mean = lil_array(self._mean.flatten(), self._mean.shape) if self.sparse: return np.reshape(self._mean.toarray(), self.shape) @@ -452,8 +555,7 @@ class Tally(IDManagerMixin): # Convert NumPy array to SciPy sparse LIL matrix if self.sparse: - self._std_dev = sps.lil_matrix(self._std_dev.flatten(), - self._std_dev.shape) + self._std_dev = lil_array(self._std_dev.flatten(), self._std_dev.shape) self.with_batch_statistics = True @@ -462,6 +564,359 @@ class Tally(IDManagerMixin): else: return self._std_dev + @property + def vov(self): + if self._vov is None: + n = self.num_realizations + sum1 = self.sum + sum2 = self.sum_sq + sum3 = self.sum_third + sum4 = self.sum_fourth + self._vov = np.zeros_like(sum1, dtype=float) + + # Calculate the variance of the variance (Eq. 2.232 in + # https://doi.org/10.2172/2372634) + numerator = (sum4 - (4.0*sum3*sum1)/n + + (6.0*sum2*(sum1**2))/(n**2) + - (3.0*(sum1)**4)/(n**3)) + denominator = (sum2 - (1.0/n)*(sum1**2))**2 + + mask = denominator > 0.0 + + self._vov[mask] = numerator[mask]/denominator[mask] - 1.0/n + + if self.sparse: + self._vov = lil_array(self._vov.flatten(), self._vov.shape) + + if self.sparse: + return np.reshape(self._vov.toarray(), self.shape) + else: + return self._vov + + @property + def m2(self): + n = self.num_realizations + return self.sum_sq/n - self.mean**2 + + @property + def m3(self): + n = self.num_realizations + mean = self.mean + sum2 = self.sum_sq/n + sum3 = self.sum_third/n + + return sum3 - 3.0*mean*sum2 + 2.0*mean**3 + + @property + def m4(self): + n = self.num_realizations + mean = self.mean + sum2 = self.sum_sq/n + sum3 = self.sum_third/n + sum4 = self.sum_fourth/n + + return sum4 - 4.0*mean*sum3 + 6.0*(mean**2)*sum2 - 3.0*mean**4 + + def skew(self, bias=False) -> np.ndarray: + """Return the sample skewness of each tally bin. + + This method computes and returns the unadjusted or adjusted + Fisher-Pearson coefficient of skewness. + + Parameters + ---------- + bias : bool + If False, calculations are corrected for bias and the adjusted + Fisher-Pearson skewness (:math:`G_1`) is returned. If True, + calculations are not corrected for bias and the unadjusted skewness + (:math:`g_1`) is returned. + + Returns + ------- + float + The skewness of each tally bin + """ + n = self.num_realizations + m2 = self.m2 + m3 = self.m3 + + with np.errstate(divide="ignore", invalid="ignore"): + g1 = np.where(m2 > 0.0, m3/(m2**1.5), 0.0) + + if bias: + return g1 + else: + if n <= 2: + raise ValueError("Insufficient number of independent realizations" + f"for bias-corrected skewness: need n >= 3, got {n=}.") + else: + return sqrt(n*(n - 1))/(n - 2)*g1 + + def kurtosis(self, fisher=True, bias=False) -> np.ndarray: + r"""Return the sample kurtosis of each tally bin. + + This method computes and returns the sample kurtosis using either + Pearson's or Fisher's definition, with or without finite-sample bias + correction. The value returned depends on the `bias` and `fisher` + arguments as follows: + + - **bias=True, fisher=False**: Returns :math:`b_2` (Pearson's kurtosis) + This is the raw fourth standardized moment: :math:`m_4/m_2^2`. For a + normal distribution, :math:`b_2\approx 3`. + + - **bias=True, fisher=True**: Returns :math:`g_2` (excess kurtosis) This + is :math:`b_2 - 3`, centered at 0 for normal distributions. Positive + values indicate heavier tails, negative values lighter tails. + + - **bias=False, fisher=True** (default): Returns :math:`G_2` (adjusted + excess kurtosis). This applies finite-sample bias correction to + :math:`g_2`. This is the recommended estimator for statistical + inference. + + - **bias=False, fisher=False**: Returns bias-corrected Pearson's + kurtosis. This is :math:`G_2 + 3`. + + Parameters + ---------- + fisher : bool, optional + If True (default), Fisher's definition is used (excess kurtosis). If + False, Pearson's definition is used. + bias : bool, optional + If False (default), calculations are corrected for statistical bias + using finite-sample adjustments. If True, calculations use the + biased estimator (population formulas). + + Returns + ------- + numpy.ndarray + The kurtosis of each tally bin + + """ + n = self.num_realizations + m2 = self.m2 + m4 = self.m4 + + with np.errstate(divide="ignore", invalid="ignore"): + b2 = np.where(m2 > 0.0, m4/(m2**2), 0.0) + g2 = b2 - 3.0 + + if bias: + # Biased estimator (g2 or b2) + return g2 if fisher else b2 + else: + # Unbiased estimator with finite-sample correction + if n <= 3: + raise ValueError("Insufficient number of independent realizations" + f"for bias-corrected kurtosis: need n >= 4, got {n=}.") + else: + G2 = ((n - 1)/((n - 2)*(n - 3)))*((n + 1)*g2 + 6.0) + return G2 if fisher else G2 + 3.0 + + def skewtest(self, alternative: str = "two-sided"): + """Perform D'Agostino and Pearson's test for skewness. + + This method tests the null hypothesis that the skewness of the + population that the sample was drawn from is the same as that of a + corresponding normal distribution. + + Parameters + ---------- + alternative : {'two-sided', 'less', 'greater'}, optional + Defines the alternative hypothesis. The following options are + available: + + * 'two-sided': the skewness of the distribution is different from + that of the normal distribution (i.e., non-zero) + * 'less': the skewness of the distribution is less than that of the + normal distribution + * 'greater': the skewness of the distribution is greater than that + of the normal distribution + + Returns + ------- + statistic : np.ndarray + The computed z-score for the skewness test for each tally bin + pvalue : np.ndarray + The p-value for the hypothesis test for each tally bin + + Notes + ----- + This test is based on `D'Agostino and Pearson's test + `_. The test requires at least + 8 realizations to produce valid results. + + """ + n = self.num_realizations + if n < 8: + raise ValueError("Skewness test is not well-defined for n < 8.") + + g1 = self.skew(bias=True) + + # --- Z1 (skewness) --- + y = g1 * sqrt(((n + 1.0)*(n + 3.0))/(6.0*(n - 2.0))) + beta2 = (3.0*(n**2 + 27.0*n - 70.0)*(n + 1.0)*(n + 3.0) + )/((n - 2.0)*(n + 5.0)*(n + 7.0)*(n + 9.0)) + W2 = -1.0 + sqrt(2.0*(beta2 - 1.0)) + delta = 1.0 / sqrt(log(sqrt(W2))) + alpha = sqrt(2.0 / (W2 - 1.0)) + Zb1 = np.where( + y >= 0.0, + delta*np.log((y/alpha) + np.sqrt((y/alpha)**2 + 1.0)), + -delta*np.log((-y/alpha) + np.sqrt((y/alpha)**2 + 1.0)) + ) + + # p-value + if alternative == "two-sided": + p = 2.0 * (1.0 - norm.cdf(np.abs(Zb1))) + elif alternative == "greater": + p = 1.0 - norm.cdf(Zb1) + elif alternative == "less": + p = norm.cdf(Zb1) + else: + raise ValueError("alternative must be 'two-sided', 'greater', or 'less'") + + return Zb1, p + + def kurtosistest(self, alternative: str = "two-sided"): + """Perform D'Agostino and Pearson's test for kurtosis. + + This method tests the null hypothesis that the kurtosis of the + population that the sample was drawn from is the same as that of a + corresponding normal distribution. + + Parameters + ---------- + alternative : {'two-sided', 'less', 'greater'}, optional + Defines the alternative hypothesis. Default is 'two-sided'. The + following options are available: + + * 'two-sided': the kurtosis of the distribution is different from + that of the normal distribution + * 'less': the kurtosis of the distribution is less than that of the + normal distribution + * 'greater': the kurtosis of the distribution is greater than that + of the normal distribution + + Returns + ------- + statistic : np.ndarray + The computed z-score for the kurtosis test for each tally bin + pvalue : np.ndarray + The p-value for the hypothesis test for each tally bin + + Raises + ------ + ValueError + If the number of realizations is less than 20, or if an invalid + alternative hypothesis is specified. + + Notes + ----- + This test is based on `D'Agostino and Pearson's test + `_. The test is typically + recommended for at least 20 realizations to produce valid results. + + """ + n = self.num_realizations + if n < 20: + raise ValueError("Kurtosis test is typically recommended for n >= 20.") + + b2 = self.kurtosis(bias=True, fisher=False) + + # --- Z2 (kurtosis) --- + mean_b2 = 3.0 * (n - 1.0) / (n + 1.0) + var_b2 = (24.0*n*(n - 2.0)*(n - 3.0)/( + (n + 1.0)**2*(n + 3.0)*(n + 5.0))) + x = (b2 - mean_b2)/np.sqrt(var_b2) + moment = ((6.0*(n**2 - 5.0*n + 2.0))/((n + 7.0)*(n + 9.0)) + )*sqrt((6.0*(n + 3.0)*(n + 5.0))/(n*(n - 2.0)*(n - 3.0))) + A = 6.0 + (8.0/moment)*((2.0/moment) + sqrt(1.0 + 4.0/(moment**2))) + Zb2 = (1.0- 2.0/(9.0*A) - ((1.0 - 2.0/A) / (1.0 + (x + )*sqrt(2.0/(A - 4.0))))**(1.0/3.0)) / sqrt(2.0/(9.0*A)) + + # p-value + if alternative == "two-sided": + p = 2.0 * (1.0 - norm.cdf(np.abs(Zb2))) + elif alternative == "greater": + p = 1.0 - norm.cdf(Zb2) + elif alternative == "less": + p = norm.cdf(Zb2) + else: + raise ValueError("alternative must be 'two-sided', 'greater', or 'less'") + + return Zb2, p + + def normaltest(self, alternative: str = "two-sided"): + """Perform D'Agostino and Pearson's omnibus test for normality. + + This method tests the null hypothesis that a sample comes from a normal + distribution. It combines skewness and kurtosis to produce an omnibus + test of normality. + + Parameters + ---------- + alternative : {'two-sided', 'less', 'greater'}, optional + Defines the alternative hypothesis used for the component skewness + and kurtosis tests. Default is 'two-sided'. The following options + are available: + + * 'two-sided': the distribution is different from normal + * 'less': used for the component tests + * 'greater': used for the component tests + + Returns + ------- + statistic : np.ndarray + The computed z-score for the normality test for each tally bin + pvalue : np.ndarray + The p-value for the hypothesis test for each tally bin + + Raises + ------ + ValueError + If the number of realizations is less than 20, or if an invalid + alternative hypothesis is specified. + + Notes + ----- + This test combines a test for skewness and a test for kurtosis to + produce an `omnibus test `_. + The test statistic is: + + .. math:: + + K^2 = Z_1^2 + Z_2^2 + + where :math:`Z_1` is the z-score from the skewness test and :math:`Z_2` + is the z-score from the kurtosis test. This statistic follows a + chi-square distribution with 2 degrees of freedom. + + The test requires at least 20 realizations to produce valid results. + + """ + n = self.num_realizations + if n < 20: + raise ValueError("normaltest requires n >= 20 (per D'Agostino-Pearson).") + + # Use the component tests + Z1, _ = self.skewtest(alternative) + Z2, _ = self.kurtosistest(alternative) + + # Combine as chi-square with df=2 since we have skewness and kurtosis + K2 = Z1*Z1 + Z2*Z2 + p = chi2.sf(K2, df=2) + return K2, p + + @property + def figure_of_merit(self): + mean = self.mean + std_dev = self.std_dev + fom = np.zeros_like(mean) + nonzero = np.abs(mean) > 0 + rel_err = std_dev[nonzero] / mean[nonzero] + fom[nonzero] = 1.0 / (rel_err**2 * self._simulation_time) + return fom + @property def with_batch_statistics(self): return self._with_batch_statistics @@ -506,16 +961,17 @@ class Tally(IDManagerMixin): # Convert NumPy arrays to SciPy sparse LIL matrices if sparse and not self.sparse: if self._sum is not None: - self._sum = sps.lil_matrix(self._sum.flatten(), self._sum.shape) + self._sum = lil_array(self._sum.flatten(), self._sum.shape) if self._sum_sq is not None: - self._sum_sq = sps.lil_matrix(self._sum_sq.flatten(), - self._sum_sq.shape) + self._sum_sq = lil_array(self._sum_sq.flatten(), self._sum_sq.shape) + if self._sum_third is not None: + self._sum_third = lil_array(self._sum_third.flatten(), self._sum_third.shape) + if self._sum_fourth is not None: + self._sum_fourth = lil_array(self._sum_fourth.flatten(), self._sum_fourth.shape) if self._mean is not None: - self._mean = sps.lil_matrix(self._mean.flatten(), - self._mean.shape) + self._mean = lil_array(self._mean.flatten(), self._mean.shape) if self._std_dev is not None: - self._std_dev = sps.lil_matrix(self._std_dev.flatten(), - self._std_dev.shape) + self._std_dev = lil_array(self._std_dev.flatten(), self._std_dev.shape) self._sparse = True @@ -525,6 +981,10 @@ class Tally(IDManagerMixin): self._sum = np.reshape(self._sum.toarray(), self.shape) if self._sum_sq is not None: self._sum_sq = np.reshape(self._sum_sq.toarray(), self.shape) + if self._sum_third is not None: + self._sum_third = np.reshape(self._sum_third.toarray(), self.shape) + if self._sum_fourth is not None: + self._sum_fourth = np.reshape(self._sum_fourth.toarray(), self.shape) if self._mean is not None: self._mean = np.reshape(self._mean.toarray(), self.shape) if self._std_dev is not None: @@ -851,6 +1311,34 @@ class Tally(IDManagerMixin): merged_tally._sum_sq = np.reshape(merged_sum_sq, merged_tally.shape) + # Concatenate sum_third arrays if present in both tallies + if self._sum_third is not None and other._sum_third is not None: + self_sum_third = self.get_reshaped_data(value="sum_third") + other_sum_third = other_copy.get_reshaped_data(value="sum_third") + + if join_right: + merged_sum_third = np.concatenate((self_sum_third, other_sum_third), + axis=merge_axis) + else: + merged_sum_third = np.concatenate((other_sum_third, self_sum_third), + axis=merge_axis) + + merged_tally._sum_third = np.reshape(merged_sum_third, merged_tally.shape) + + # Concatenate sum_fourth arrays if present in both tallies + if self._sum_fourth is not None and other._sum_fourth is not None: + self_sum_fourth = self.get_reshaped_data(value="sum_fourth") + other_sum_fourth = other_copy.get_reshaped_data(value="sum_fourth") + + if join_right: + merged_sum_fourth = np.concatenate((self_sum_fourth, other_sum_fourth), + axis=merge_axis) + else: + merged_sum_fourth = np.concatenate((other_sum_fourth, self_sum_fourth), + axis=merge_axis) + + merged_tally._sum_fourth = np.reshape(merged_sum_fourth, merged_tally.shape) + # Concatenate mean arrays if present in both tallies if self.mean is not None and other.mean is not None: self_mean = self.get_reshaped_data(value='mean') @@ -940,6 +1428,11 @@ class Tally(IDManagerMixin): subelement = ET.SubElement(element, "derivative") subelement.text = str(self.derivative.id) + # Optional higher moments accumulation + if self.higher_moments: + subelement = ET.SubElement(element, "higher_moments") + subelement.text = str(self.higher_moments).lower() + return element def add_results(self, statepoint: cv.PathLike | openmc.StatePoint): @@ -966,8 +1459,12 @@ class Tally(IDManagerMixin): # point are based on the current statepoint file self._sum = None self._sum_sq = None + self._sum_third = None + self._sum_fourth = None self._mean = None self._std_dev = None + self._vov = None + self._higher_moments = False self._num_realizations = 0 self._results_read = False @@ -988,8 +1485,8 @@ class Tally(IDManagerMixin): Tally object """ - tally_id = int(elem.get('id')) - name = elem.get('name', '') + tally_id = int(get_text(elem, "id")) + name = get_text(elem, "name", "") tally = cls(tally_id=tally_id, name=name) text = get_text(elem, 'multiply_density') @@ -997,25 +1494,24 @@ class Tally(IDManagerMixin): tally.multiply_density = text in ('true', '1') # Read filters - filters_elem = elem.find('filters') - if filters_elem is not None: - filter_ids = [int(x) for x in filters_elem.text.split()] + filter_ids = get_elem_list(elem, "filters", int) + if filter_ids is not None: tally.filters = [kwargs['filters'][uid] for uid in filter_ids] # Read nuclides - nuclides_elem = elem.find('nuclides') - if nuclides_elem is not None: - tally.nuclides = nuclides_elem.text.split() + nuclides = get_elem_list(elem, "nuclides", str) + if nuclides is not None: + tally.nuclides = nuclides # Read scores - scores_elem = elem.find('scores') - if scores_elem is not None: - tally.scores = scores_elem.text.split() + scores = get_elem_list(elem, "scores", str) + if scores is not None: + tally.scores = scores # Set estimator - estimator_elem = elem.find('estimator') - if estimator_elem is not None: - tally.estimator = estimator_elem.text + estimator = get_text(elem, "estimator") + if estimator is not None: + tally.estimator = estimator # Read triggers tally.triggers = [ @@ -1024,9 +1520,9 @@ class Tally(IDManagerMixin): ] # Read tally derivative - deriv_elem = elem.find('derivative') - if deriv_elem is not None: - deriv_id = int(deriv_elem.text) + deriv = get_text(elem, "derivative") + if deriv is not None: + deriv_id = int(deriv) tally.derivative = kwargs['derivatives'][deriv_id] return tally @@ -1338,7 +1834,9 @@ class Tally(IDManagerMixin): (value == 'std_dev' and self.std_dev is None) or \ (value == 'rel_err' and self.mean is None) or \ (value == 'sum' and self.sum is None) or \ - (value == 'sum_sq' and self.sum_sq is None): + (value == 'sum_sq' and self.sum_sq is None) or \ + (value == "sum_third" and self.sum_third is None) or \ + (value == "sum_fourth" and self.sum_fourth is None): msg = f'The Tally ID="{self.id}" has no data to return' raise ValueError(msg) @@ -1361,10 +1859,14 @@ class Tally(IDManagerMixin): data = self.sum[indices] elif value == 'sum_sq': data = self.sum_sq[indices] + elif value == "sum_third": + data = self.sum_third[indices] + elif value == "sum_fourth": + data = self.sum_fourth[indices] else: msg = f'Unable to return results from Tally ID="{value}" since ' \ f'the requested value "{self.id}" is not \'mean\', ' \ - '\'std_dev\', \'rel_err\', \'sum\', or \'sum_sq\'' + '\'std_dev\', \'rel_err\', \'sum\', \'sum_sq\', \'sum_third\' or \'sum_fourth\'' raise LookupError(msg) return data @@ -1557,7 +2059,7 @@ class Tally(IDManagerMixin): for i, f in enumerate(self.filters): if expand_dims: # Mesh filter indices are backwards so we need to flip them - if isinstance(f, openmc.MeshFilter): + if type(f) in {openmc.MeshFilter, openmc.MeshBornFilter}: fshape = f.shape[::-1] new_shape += fshape idx0, idx1 = i, i + len(fshape) - 1 @@ -2694,6 +3196,16 @@ class Tally(IDManagerMixin): new_sum_sq = self.get_values(scores, filters, filter_bins, nuclides, 'sum_sq') new_tally.sum_sq = new_sum_sq + if not self.derived and self._sum_third is not None: + new_sum_third = self.get_values( + scores, filters, filter_bins, nuclides, "sum_third" + ) + new_tally._sum_third = new_sum_third + if not self.derived and self._sum_fourth is not None: + new_sum_fourth = self.get_values( + scores, filters, filter_bins, nuclides, "sum_fourth" + ) + new_tally._sum_fourth = new_sum_fourth if self.mean is not None: new_mean = self.get_values(scores, filters, filter_bins, nuclides, 'mean') @@ -3134,6 +3646,12 @@ class Tally(IDManagerMixin): if not self.derived and self.sum_sq is not None: new_tally._sum_sq = np.zeros(new_tally.shape, dtype=np.float64) new_tally._sum_sq[diag_indices, :, :] = self.sum_sq + if not self.derived and self._sum_third is not None: + new_tally._sum_third = np.zeros(new_tally.shape, dtype=np.float64) + new_tally._sum_third[diag_indices, :, :] = self.sum_third + if not self.derived and self._sum_fourth is not None: + new_tally._sum_fourth = np.zeros(new_tally.shape, dtype=np.float64) + new_tally._sum_fourth[diag_indices, :, :] = self.sum_fourth if self.mean is not None: new_tally._mean = np.zeros(new_tally.shape, dtype=np.float64) new_tally._mean[diag_indices, :, :] = self.mean @@ -3184,43 +3702,17 @@ class Tallies(cv.CheckedList): if possible. Defaults to False. """ - if not isinstance(tally, Tally): - msg = f'Unable to add a non-Tally "{tally}" to the Tallies instance' - raise TypeError(msg) - if merge: - merged = False - # Look for a tally to merge with this one for i, tally2 in enumerate(self): - # If a mergeable tally is found if tally2.can_merge(tally): # Replace tally2 with the merged tally merged_tally = tally2.merge(tally) self[i] = merged_tally - merged = True - break + return - # If no mergeable tally was found, simply add this tally - if not merged: - super().append(tally) - - else: - super().append(tally) - - def insert(self, index, item): - """Insert tally before index - - Parameters - ---------- - index : int - Index in list - item : openmc.Tally - Tally to insert - - """ - super().insert(index, item) + super().append(tally) def merge_tallies(self): """Merge any mergeable tallies together. Note that n-way merges are @@ -3311,7 +3803,6 @@ class Tallies(cv.CheckedList): # Clean the indentation in the file to be user-readable clean_indentation(element) - reorder_attributes(element) # TODO: Remove when support is Python 3.8+ return element diff --git a/openmc/tally_derivative.py b/openmc/tally_derivative.py index ff918c1b3..f7ba5dce5 100644 --- a/openmc/tally_derivative.py +++ b/openmc/tally_derivative.py @@ -4,6 +4,7 @@ import lxml.etree as ET import openmc.checkvalue as cv from .mixin import EqualityMixin, IDManagerMixin +from ._xml import get_text class TallyDerivative(EqualityMixin, IDManagerMixin): @@ -122,8 +123,8 @@ class TallyDerivative(EqualityMixin, IDManagerMixin): Tally derivative object """ - derivative_id = int(elem.get("id")) - variable = elem.get("variable") - material = int(elem.get("material")) - nuclide = elem.get("nuclide") if variable == "nuclide_density" else None + derivative_id = int(get_text(elem, "id")) + variable = get_text(elem, "variable") + material = int(get_text(elem, "material")) + nuclide = get_text(elem, "nuclide") if variable == "nuclide_density" else None return cls(derivative_id, variable, material, nuclide) diff --git a/openmc/tracks.py b/openmc/tracks.py index 61e5a7244..81646e7d2 100644 --- a/openmc/tracks.py +++ b/openmc/tracks.py @@ -296,16 +296,16 @@ class Tracks(list): for state in pt.states: points.InsertNextPoint(state['r']) - # Create VTK line and assign points to line. - n = pt.states.size - line = vtk.vtkPolyLine() - line.GetPointIds().SetNumberOfIds(n) - for i in range(n): - line.GetPointIds().SetId(i, point_offset + i) - point_offset += n + # Create VTK line and assign points to line. + n = pt.states.size + line = vtk.vtkPolyLine() + line.GetPointIds().SetNumberOfIds(n) + for i in range(n): + line.GetPointIds().SetId(i, point_offset + i) + point_offset += n - # Add line to cell array - cells.InsertNextCell(line) + # Add line to cell array + cells.InsertNextCell(line) data = vtk.vtkPolyData() data.SetPoints(points) diff --git a/openmc/trigger.py b/openmc/trigger.py index be2537e3a..70b6b7a03 100644 --- a/openmc/trigger.py +++ b/openmc/trigger.py @@ -5,6 +5,7 @@ import lxml.etree as ET import openmc.checkvalue as cv from .mixin import EqualityMixin +from ._xml import get_elem_list, get_text class Trigger(EqualityMixin): @@ -129,16 +130,16 @@ class Trigger(EqualityMixin): """ # Generate trigger object - trigger_type = elem.get("type") - threshold = float(elem.get("threshold")) - ignore_zeros = str(elem.get("ignore_zeros", "false")).lower() + trigger_type = get_text(elem, "type") + threshold = float(get_text(elem, "threshold")) + ignore_zeros = str(get_text(elem, "ignore_zeros", "false")).lower() # Try to convert to bool. Let Trigger error out on instantiation. ignore_zeros = ignore_zeros in ('true', '1') trigger = cls(trigger_type, threshold, ignore_zeros) # Add scores if present - scores = elem.get("scores") + scores = get_elem_list(elem, "scores", str) if scores is not None: - trigger.scores = scores.split() + trigger.scores = scores return trigger diff --git a/openmc/universe.py b/openmc/universe.py index 02b794dee..0e64693ba 100644 --- a/openmc/universe.py +++ b/openmc/universe.py @@ -337,14 +337,6 @@ class UniverseBase(ABC, IDManagerMixin): """ model = openmc.Model() model.geometry = openmc.Geometry(self) - - # Determine whether any materials contains macroscopic data and if - # so, set energy mode accordingly - for mat in self.get_all_materials().values(): - if mat._macroscopic is not None: - model.settings.energy_mode = 'multi-group' - break - return model.plot(*args, **kwargs) def get_nuclides(self): diff --git a/openmc/utility_funcs.py b/openmc/utility_funcs.py index da9f73b16..935a58985 100644 --- a/openmc/utility_funcs.py +++ b/openmc/utility_funcs.py @@ -3,6 +3,8 @@ import os from pathlib import Path from tempfile import TemporaryDirectory +import h5py + import openmc from .checkvalue import PathLike @@ -57,3 +59,20 @@ def input_path(filename: PathLike) -> Path: return Path(filename).resolve() else: return Path(filename) + + +@contextmanager +def h5py_file_or_group(group_or_filename: PathLike | h5py.Group, *args, **kwargs): + """Context manager for opening an HDF5 file or using an existing group + + Parameters + ---------- + group_or_filename : path-like or h5py.Group + Path to HDF5 file, or group from an existing HDF5 file + + """ + if isinstance(group_or_filename, h5py.Group): + yield group_or_filename + else: + with h5py.File(group_or_filename, *args, **kwargs) as f: + yield f diff --git a/openmc/volume.py b/openmc/volume.py index df19def1e..c44adf98a 100644 --- a/openmc/volume.py +++ b/openmc/volume.py @@ -10,7 +10,7 @@ from uncertainties import ufloat import openmc import openmc.checkvalue as cv -from openmc._xml import get_text +from openmc._xml import get_elem_list, get_text _VERSION_VOLUME = 1 @@ -375,13 +375,10 @@ class VolumeCalculation: """ domain_type = get_text(elem, "domain_type") - domain_ids = get_text(elem, "domain_ids").split() - ids = [int(x) for x in domain_ids] + ids = get_elem_list(elem, "domain_ids", int) samples = int(get_text(elem, "samples")) - lower_left = get_text(elem, "lower_left").split() - lower_left = tuple([float(x) for x in lower_left]) - upper_right = get_text(elem, "upper_right").split() - upper_right = tuple([float(x) for x in upper_right]) + lower_left = tuple(get_elem_list(elem, "lower_left", float)) + upper_right = tuple(get_elem_list(elem, "upper_right", float)) # Instantiate some throw-away domains that are used by the constructor # to assign IDs diff --git a/openmc/waste.py b/openmc/waste.py new file mode 100644 index 000000000..80cfc0adc --- /dev/null +++ b/openmc/waste.py @@ -0,0 +1,286 @@ +from __future__ import annotations + +import openmc +from openmc.data import half_life + + +def _waste_classification(mat: openmc.Material, metal: bool = True) -> str: + """Classify a material for near-surface waste disposal. + + This method determines a waste classification for a material based on the + NRC regulations (10 CFR 61.55). + + Parameters + ---------- + mat : openmc.Material + The material to classify. + metal : bool, optional + Whether or not the material is in metal form. This changes the + acceptable limits in Tables 1 and 2 for certain nuclides. + + Returns + ------- + str + The waste disposal classification, which can be "Class A", "Class B", + "Class C", or "GTCC" (greater than class C). + + """ + # Determine metrics based on Tables 1 and 2 using sum of fractions rule for + # mixture of radionuclides from §61.55(a)(7) + ratio1 = _waste_disposal_rating(mat, 'NRC_long', metal=metal) + ratio2 = [ + _waste_disposal_rating(mat, 'NRC_short_A', metal=metal), + _waste_disposal_rating(mat, 'NRC_short_B', metal=metal), + _waste_disposal_rating(mat, 'NRC_short_C', metal=metal), + ] + + # Determine which nuclides are present in Table 1 and Table 2 + table1_nuclides_present = (ratio1 > 0.0) + table2_nuclides_present = any(x > 0.0 for x in ratio2) + + # Helper function for classifying based on Table 2 + def classify_table2(col1, col2, col3): + if col1 < 1.0: + return "Class A" + elif col2 < 1.0: + return "Class B" + elif col3 < 1.0: + return "Class C" + else: + return "GTCC" + + if table1_nuclides_present and table2_nuclides_present: + # Classification based on §61.55(a)(5) + if ratio1 < 0.1: + return classify_table2(*ratio2) + elif ratio1 < 1.0: + return "Class C" if ratio2[2] < 1.0 else "GTCC" + else: + return "GTCC" + + elif table1_nuclides_present: + # Classification based on §61.55(a)(3) + if ratio1 < 0.1: + return "Class A" + elif ratio1 < 1.0: + return "Class C" + else: + return "GTCC" + + elif table2_nuclides_present: + # Classification based on §61.55(a)(4) + return classify_table2(*ratio2) + + else: + # Classification based on §61.55(a)(6) + return "Class A" + + +def _waste_disposal_rating( + mat: openmc.Material, + limits: str | dict[str, float] = 'Fetter', + metal: bool = False, + by_nuclide: bool = False, +) -> float | dict[str, float]: + """Return the waste disposal rating for a material. + + This method returns a waste disposal rating for the material based on a set + of specific activity limits. The waste disposal rating is a single number + that represents the sum of the ratios of the specific activity for each + radionuclide in the material against a nuclide-specific limit. A value less + than 1.0 indicates that the material "meets" the limits whereas a value + greater than 1.0 exceeds the limits. + + Parameters + ---------- + mat : openmc.Material + The material to classify. + limits : str or dict, optional + The name of a predefined set of specific activity limits or a dictionary + that contains specific activity limits for radionuclides, where keys are + nuclide names and values are activities in units of [Ci/m3]. The + predefined options are: + + - 'Fetter': Uses limits from Fetter et al. (1990) + - 'NRC_long': Uses the 10 CFR 61.55 limits for long-lived radionuclides + - 'NRC_short_A': Uses the 10 CFR 61.55 class A limits for short-lived + radionuclides + - 'NRC_short_B': Uses the 10 CFR 61.55 class B limits for short-lived + radionuclides + - 'NRC_short_C': Uses the 10 CFR 61.55 class C limits for short-lived + radionuclides + metal : bool, optional + Whether or not the material is in metal form (only applicable for NRC + based limits) + by_nuclide : bool, optional + Whether to return the waste disposal rating for each nuclide in the + material. If True, a dictionary is returned where the keys are the + nuclide names and the values are the waste disposal ratings for each + nuclide. If False, a single float value is returned that represents the + overall waste disposal rating for the material. + + Returns + ------- + float or dict + The waste disposal rating for the material or its constituent nuclides. + + """ + if limits == 'Fetter': + # Specific activity limits for radionuclides with half-lives between 5 + # years and 1e12 years from Table 2 in Fetter + limits = { + "Be10": 5.0e3, + "C14": 6.0e2, + "Al26": 9.0e-2, + "Si32": 6.0e2, + "Cl36": 1.0e1, + "Ar39": 2.0e4, + "Ar42": 2.0e4, + "K40": 2.0e0, + "Ca41": 1.0e4, + "Ti44": 2.0e2, + "Fe60": 1.0e-1, + "Co60": 3.0e8, + "Ni59": 9.0e2, + "Ni63": 7.0e5, + "Se79": 5.0e1, + "Kr81": 3.0e1, + "Sr90": 8.0e5, + "Nb91": 2.0e2, + "Nb92": 2.0e-1, + "Nb94": 2.0e-1, + "Mo93": 4.0e3, + "Tc97": 4.0e-1, + "Tc98": 1.0e-2, + "Tc99": 6.0e-2, + "Pd107": 9.0e2, + "Ag108_m1": 3.0e0, + "Sn121_m1": 7.0e5, + "Sn126": 1.0e-1, + "I129": 2.0e0, + "Cs137": 5.0e4, + "Ba133": 2.0e8, + "La137": 2.0e2, + "Sm151": 5.0e7, + "Eu150_m1": 3.0e3, + "Eu152": 3.0e5, + "Eu154": 5.0e6, + "Gd148": 2.0e5, + "Gd150": 2.0e3, + "Tb157": 5.0e3, + "Tb158": 4.0e0, + "Dy154": 1.0e3, + "Ho166_m1": 2.0e-1, + "Hf178_m1": 9.0e3, + "Hf182": 2.0e-1, + "Re186_m1": 2.0e1, + "Ir192_m1": 1.0e0, + "Pt193": 2.0e8, + "Hg194": 5.0e-1, + "Pb202": 6.0e-1, + "Pb210": 3.0e7, + "Bi207": 9.0e3, + "Bi208": 8.0e-2, + "Bi210_m1": 1.0e0, + "Po209": 3.0e3, + "Ra226": 1.0e-1, + "Ra228": 3.0e7, + "Ac227": 5.0e5, + "Th229": 2.0e0, + "Th230": 3.0e-1, + "Th232": 1.0e-1, + "Pa231": 7.0e-1, + "U232": 3.0e1, + "U233": 2.0e1, + "U234": 9.0e1, + "U235": 2.0e0, + "Np236": 1.0e0, + "Np237": 1.0e0, + "Pu238": 7.0e4, + "Pu239": 1.0e3, + "Pu240": 1.0e3, + "Pu241": 2.0e3, + "Pu242": 1.0e3, + "Pu244": 9.0e-1, + "Am241": 5.0e1, + "Am242_m1": 3.0e2, + "Am243": 2.0e0, + "Cm243": 6.0e2, + "Cm244": 5.0e5, + "Cm245": 5.0e0, + "Cm246": 8.0e2, + "Cm248": 8.0e2, + } + + elif limits == 'NRC_long': + # Specific activity limits for long-lived radionuclides from Table 1 in + # 10 CFR 61.55 in Ci/m3. + limits = { + 'C14': 8.0, + 'Tc99': 3.0, + 'I129': 0.08, + } + if metal: + limits['C14'] = 80.0 + limits['Ni59'] = 220.0 + limits['Nb94'] = 0.2 + + # Convert values in nCi/g to Ci/m3 + factor = (1e6 * mat.get_mass_density()) / 1e9 + limits.update({ + 'Pu241': 3500.0 * factor, + 'Cm242': 20000.0 * factor, + 'Np237': 100.0 * factor, + 'Pu238': 100.0 * factor, + 'Pu239': 100.0 * factor, + 'Pu240': 100.0 * factor, + 'Pu242': 100.0 * factor, + 'Pu244': 100.0 * factor, + 'Am241': 100.0 * factor, + 'Am243': 100.0 * factor, + 'Cm243': 100.0 * factor, + 'Cm244': 100.0 * factor, + 'Cm245': 100.0 * factor, + 'Cm246': 100.0 * factor, + 'Cm247': 100.0 * factor, + 'Cm248': 100.0 * factor, + 'Bk247': 100.0 * factor, + 'Cf249': 100.0 * factor, + 'Cf250': 100.0 * factor, + 'Cf251': 100.0 * factor, + }) + + elif limits == 'NRC_short_A': + # Get Class A specific activity limits for short-lived radionuclides + # from Table 2 in 10 CFR 61.55 + limits = { + 'H3': 40.0, + 'Co60': 700.0, + 'Ni63': 35.0 if metal else 3.5, + 'Sr90': 0.04, + 'Cs137': 1.0 + } + + # Add radionuclides with half-lives < 5 years to limits for class A + five_years = 60.0 * 60.0 * 24.0 * 365.25 * 5.0 + for nuc in mat.get_nuclides(): + if half_life(nuc) is not None and half_life(nuc) < five_years: + limits[nuc] = 700.0 + + elif limits == 'NRC_short_B': + # Get Class B specific activity limits for short-lived radionuclides + # from Table 2 in 10 CFR 61.55 + limits = {'Ni63': 700.0 if metal else 70.0, 'Sr90': 150.0, 'Cs137': 44.0} + + elif limits == 'NRC_short_C': + # Get Class C specific activity limits for short-lived radionuclides + # from Table 2 in 10 CFR 61.55 + limits = {'Ni63': 7000.0 if metal else 700.0, 'Sr90': 7000.0, 'Cs137': 4600.0} + + # Calculate the sum of the fractions of the activity of each radionuclide + # compared to the specified limits + ratio = {} + for nuc, ci_m3 in mat.get_activity(units="Ci/m3", by_nuclide=True).items(): + if nuc in limits: + ratio[nuc] = ci_m3 / limits[nuc] + return ratio if by_nuclide else sum(ratio.values()) diff --git a/openmc/weight_windows.py b/openmc/weight_windows.py index d52b81925..5d52a579a 100644 --- a/openmc/weight_windows.py +++ b/openmc/weight_windows.py @@ -1,6 +1,8 @@ from __future__ import annotations from numbers import Real, Integral from collections.abc import Iterable, Sequence +from pathlib import Path +from typing import Self import warnings import lxml.etree as ET @@ -12,8 +14,9 @@ from openmc.filter import _PARTICLES from openmc.mesh import MeshBase, RectilinearMesh, CylindricalMesh, SphericalMesh, UnstructuredMesh import openmc.checkvalue as cv from openmc.checkvalue import PathLike -from ._xml import get_text, clean_indentation +from ._xml import get_elem_list, get_text, clean_indentation from .mixin import IDManagerMixin +from .utility_funcs import change_directory class WeightWindows(IDManagerMixin): @@ -90,7 +93,7 @@ class WeightWindows(IDManagerMixin): survival_ratio : float Ratio of the survival weight to the lower weight window bound for rouletting - max_lower_bound_ratio: float + max_lower_bound_ratio : float Maximum allowed ratio of a particle's weight to the weight window's lower bound. (Default: 1.0) max_split : int @@ -114,7 +117,7 @@ class WeightWindows(IDManagerMixin): upper_bound_ratio: float | None = None, energy_bounds: Iterable[Real] | None = None, particle_type: str = 'neutron', - survival_ratio: float = 3, + survival_ratio: float = 3.0, max_lower_bound_ratio: float | None = None, max_split: int = 10, weight_cutoff: float = 1.e-38, @@ -354,7 +357,7 @@ class WeightWindows(IDManagerMixin): return element @classmethod - def from_xml_element(cls, elem: ET.Element, meshes: dict[int, MeshBase]) -> WeightWindows: + def from_xml_element(cls, elem: ET.Element, meshes: dict[int, MeshBase]) -> Self: """Generate weight window settings from an XML element Parameters @@ -376,9 +379,9 @@ class WeightWindows(IDManagerMixin): mesh = meshes[mesh_id] # Read all other parameters - lower_ww_bounds = [float(l) for l in get_text(elem, 'lower_ww_bounds').split()] - upper_ww_bounds = [float(u) for u in get_text(elem, 'upper_ww_bounds').split()] - e_bounds = [float(b) for b in get_text(elem, 'energy_bounds').split()] + lower_ww_bounds = get_elem_list(elem, "lower_ww_bounds", float) + upper_ww_bounds = get_elem_list(elem, "upper_ww_bounds", float) + e_bounds = get_elem_list(elem, "energy_bounds", float) particle_type = get_text(elem, 'particle_type') survival_ratio = float(get_text(elem, 'survival_ratio')) @@ -408,7 +411,7 @@ class WeightWindows(IDManagerMixin): ) @classmethod - def from_hdf5(cls, group: h5py.Group, meshes: dict[int, MeshBase]) -> WeightWindows: + def from_hdf5(cls, group: h5py.Group, meshes: dict[int, MeshBase]) -> Self: """Create weight windows from HDF5 group Parameters @@ -458,7 +461,7 @@ class WeightWindows(IDManagerMixin): ) -def wwinp_to_wws(path: PathLike) -> list[WeightWindows]: +def wwinp_to_wws(path: PathLike) -> WeightWindowsList: """Create WeightWindows instances from a wwinp file .. versionadded:: 0.13.1 @@ -470,190 +473,13 @@ def wwinp_to_wws(path: PathLike) -> list[WeightWindows]: Returns ------- - list of openmc.WeightWindows + WeightWindowsList """ - - with open(path) as wwinp: - # BLOCK 1 - header = wwinp.readline().split(None, 4) - # read file type, time-dependence, number of - # particles, mesh type and problem identifier - _if, iv, ni, nr = [int(x) for x in header[:4]] - - # header value checks - if _if != 1: - raise ValueError(f'Found incorrect file type, if: {_if}') - - if iv > 1: - # read number of time bins for each particle, 'nt(1...ni)' - nt = np.fromstring(wwinp.readline(), sep=' ', dtype=int) - - # raise error if time bins are present for now - raise ValueError('Time-dependent weight windows ' - 'are not yet supported') - else: - nt = ni * [1] - - # read number of energy bins for each particle, 'ne(1...ni)' - ne = np.fromstring(wwinp.readline(), sep=' ', dtype=int) - - # read coarse mesh dimensions and lower left corner - mesh_description = np.fromstring(wwinp.readline(), sep=' ') - nfx, nfy, nfz = mesh_description[:3].astype(int) - xyz0 = mesh_description[3:] - - # read cylindrical and spherical mesh vectors if present - if nr == 16: - # read number of coarse bins - line_arr = np.fromstring(wwinp.readline(), sep=' ') - ncx, ncy, ncz = line_arr[:3].astype(int) - # read polar vector (x1, y1, z1) - xyz1 = line_arr[3:] - # read azimuthal vector (x2, y2, z2) - line_arr = np.fromstring(wwinp.readline(), sep=' ') - xyz2 = line_arr[:3] - - # Get polar and azimuthal axes - polar_axis = xyz1 - xyz0 - azimuthal_axis = xyz2 - xyz0 - - # Check for polar axis other than (0, 0, 1) - norm = np.linalg.norm(polar_axis) - if not np.isclose(polar_axis[2]/norm, 1.0): - raise NotImplementedError('Polar axis not aligned to z-axis not supported') - - # Check for azimuthal axis other than (1, 0, 0) - norm = np.linalg.norm(azimuthal_axis) - if not np.isclose(azimuthal_axis[0]/norm, 1.0): - raise NotImplementedError('Azimuthal axis not aligned to x-axis not supported') - - # read geometry type - nwg = int(line_arr[-1]) - - elif nr == 10: - # read rectilinear data: - # number of coarse mesh bins and mesh type - ncx, ncy, ncz, nwg = \ - np.fromstring(wwinp.readline(), sep=' ').astype(int) - else: - raise RuntimeError(f'Invalid mesh description (nr) found: {nr}') - - # read BLOCK 2 and BLOCK 3 data into a single array - ww_data = np.fromstring(wwinp.read(), sep=' ') - - # extract mesh data from the ww_data array - start_idx = 0 - - # first values in the mesh definition arrays are the first - # coordinate of the grid - end_idx = start_idx + 1 + 3 * ncx - i0, i_vals = ww_data[start_idx], ww_data[start_idx+1:end_idx] - start_idx = end_idx - - end_idx = start_idx + 1 + 3 * ncy - j0, j_vals = ww_data[start_idx], ww_data[start_idx+1:end_idx] - start_idx = end_idx - - end_idx = start_idx + 1 + 3 * ncz - k0, k_vals = ww_data[start_idx], ww_data[start_idx+1:end_idx] - start_idx = end_idx - - # mesh consistency checks - if nr == 16 and nwg == 1 or nr == 10 and nwg != 1: - raise ValueError(f'Mesh description in header ({nr}) ' - f'does not match the mesh type ({nwg})') - - if nr == 10 and (xyz0 != (i0, j0, k0)).any(): - raise ValueError(f'Mesh origin in the header ({xyz0}) ' - f' does not match the origin in the mesh ' - f' description ({i0, j0, k0})') - - # create openmc mesh object - grids = [] - mesh_definition = [(i0, i_vals, nfx), (j0, j_vals, nfy), (k0, k_vals, nfz)] - for grid0, grid_vals, n_pnts in mesh_definition: - # file spec checks for the mesh definition - if (grid_vals[2::3] != 1.0).any(): - raise ValueError('One or more mesh ratio value, qx, ' - 'is not equal to one') - - s = int(grid_vals[::3].sum()) - if s != n_pnts: - raise ValueError(f'Sum of the fine bin entries, {s}, does ' - f'not match the number of fine bins, {n_pnts}') - - # extend the grid based on the next coarse bin endpoint, px - # and the number of fine bins in the coarse bin, sx - intervals = grid_vals.reshape(-1, 3) - coords = [grid0] - for sx, px, qx in intervals: - coords += np.linspace(coords[-1], px, int(sx + 1)).tolist()[1:] - - grids.append(np.array(coords)) - - if nwg == 1: - mesh = RectilinearMesh() - mesh.x_grid, mesh.y_grid, mesh.z_grid = grids - elif nwg == 2: - mesh = CylindricalMesh( - r_grid=grids[0], - z_grid=grids[1], - phi_grid=grids[2], - origin = xyz0, - ) - elif nwg == 3: - mesh = SphericalMesh( - r_grid=grids[0], - theta_grid=grids[1], - phi_grid=grids[2], - origin = xyz0 - ) - - # extract weight window values from array - wws = [] - for ne_i, nt_i, particle_type in zip(ne, nt, ('neutron', 'photon')): - # no information to read for this particle if - # either the energy bins or time bins are empty - if ne_i == 0 or nt_i == 0: - continue - - if iv > 1: - # time bins are parsed but unused for now - end_idx = start_idx + nt_i - time_bounds = ww_data[start_idx:end_idx] - np.insert(time_bounds, (0,), (0.0,)) - start_idx = end_idx - - # read energy boundaries - end_idx = start_idx + ne_i - energy_bounds = np.insert(ww_data[start_idx:end_idx], (0,), (0.0,)) - # convert from MeV to eV - energy_bounds *= 1e6 - start_idx = end_idx - - # read weight window values - end_idx = start_idx + (nfx * nfy * nfz) * nt_i * ne_i - - # read values and reshape according to ordering - # slowest to fastest: t, e, z, y, x - # reorder with transpose since our ordering is x, y, z, e, t - ww_shape = (nt_i, ne_i, nfz, nfy, nfx) - ww_values = ww_data[start_idx:end_idx].reshape(ww_shape).T - # Only use first time bin since we don't support time dependent weight - # windows yet. - ww_values = ww_values[:, :, :, :, 0] - start_idx = end_idx - - # create a weight window object - ww = WeightWindows(id=None, - mesh=mesh, - lower_ww_bounds=ww_values, - upper_bound_ratio=5.0, - energy_bounds=energy_bounds, - particle_type=particle_type) - wws.append(ww) - - return wws + warnings.warn( + "This function is deprecated in favor of 'WeightWindowsList.from_wwinp'", + FutureWarning + ) + return WeightWindowsList.from_wwinp(path) class WeightWindowGenerator: @@ -886,7 +712,7 @@ class WeightWindowGenerator: return element @classmethod - def from_xml_element(cls, elem: ET.Element, meshes: dict) -> WeightWindowGenerator: + def from_xml_element(cls, elem: ET.Element, meshes: dict) -> Self: """ Create a weight window generation object from an XML element @@ -904,11 +730,8 @@ class WeightWindowGenerator: mesh_id = int(get_text(elem, 'mesh')) mesh = meshes[mesh_id] - - if (energy_bounds := get_text(elem, 'energy_bounds')) is not None: - energy_bounds = [float(x) for x in energy_bounds.split()] - else: - energy_bounds = None + + energy_bounds = get_elem_list(elem, "energy_bounds, float") particle_type = get_text(elem, 'particle_type') wwg = cls(mesh, energy_bounds, particle_type) @@ -929,8 +752,8 @@ class WeightWindowGenerator: return wwg -def hdf5_to_wws(path='weight_windows.h5'): - """Create WeightWindows instances from a weight windows HDF5 file +def hdf5_to_wws(path='weight_windows.h5') -> WeightWindowsList: + """Create a WeightWindowsList from a weight windows HDF5 file .. versionadded:: 0.14.0 @@ -941,13 +764,280 @@ def hdf5_to_wws(path='weight_windows.h5'): Returns ------- - list of openmc.WeightWindows + WeightWindowsList """ + warnings.warn( + "This function is deprecated in favor of 'WeightWindowsList.from_hdf5'", + FutureWarning + ) + return WeightWindowsList.from_hdf5(path) - with h5py.File(path) as h5_file: - # read in all of the meshes in the mesh node - meshes = {} - for mesh_group in h5_file['meshes']: - mesh = MeshBase.from_hdf5(h5_file['meshes'][mesh_group]) - meshes[mesh.id] = mesh - return [WeightWindows.from_hdf5(ww, meshes) for ww in h5_file['weight_windows'].values()] + +class WeightWindowsList(list): + """A list of WeightWindows objects. + + .. versionadded:: 0.15.3 + + Parameters + ---------- + iterable : iterable of openmc.WeightWindows + An iterable of WeightWindows objects to initialize the list with + + """ + def __init__(self, iterable: Iterable[WeightWindows] = ()): + super().__init__(iterable) + + @classmethod + def from_hdf5(cls, path: PathLike = 'weight_windows.h5') -> Self: + """Create WeightWindowsList from a weight windows HDF5 file. + + Parameters + ---------- + path : PathLike + Path to the weight windows hdf5 file + + Returns + ------- + WeightWindowsList + A list of WeightWindows objects read from the file + """ + + with h5py.File(path) as h5_file: + # read in all of the meshes in the mesh node + meshes = {} + for mesh_group in h5_file['meshes']: + mesh = MeshBase.from_hdf5(h5_file['meshes'][mesh_group]) + meshes[mesh.id] = mesh + wws = [ + WeightWindows.from_hdf5(ww, meshes) + for ww in h5_file['weight_windows'].values() + ] + + return cls(wws) + + @classmethod + def from_wwinp(cls, path: PathLike) -> Self: + """Create WeightWindowsList from a wwinp file. + + Parameters + ---------- + path : PathLike + Path to the wwinp file + + Returns + ------- + WeightWindowsList + A list of WeightWindows objects read from the file + """ + + with open(path) as wwinp: + # BLOCK 1 + header = wwinp.readline().split(None, 4) + # read file type, time-dependence, number of + # particles, mesh type and problem identifier + _if, iv, ni, nr = [int(x) for x in header[:4]] + + # header value checks + if _if != 1: + raise ValueError(f'Found incorrect file type, if: {_if}') + + if iv > 1: + # read number of time bins for each particle, 'nt(1...ni)' + nt = np.fromstring(wwinp.readline(), sep=' ', dtype=int) + + # raise error if time bins are present for now + raise ValueError('Time-dependent weight windows ' + 'are not yet supported') + else: + nt = ni * [1] + + # read number of energy bins for each particle, 'ne(1...ni)' + ne = np.fromstring(wwinp.readline(), sep=' ', dtype=int) + + # read coarse mesh dimensions and lower left corner + mesh_description = np.fromstring(wwinp.readline(), sep=' ') + nfx, nfy, nfz = mesh_description[:3].astype(int) + xyz0 = mesh_description[3:] + + # read cylindrical and spherical mesh vectors if present + if nr == 16: + # read number of coarse bins + line_arr = np.fromstring(wwinp.readline(), sep=' ') + ncx, ncy, ncz = line_arr[:3].astype(int) + # read polar vector (x1, y1, z1) + xyz1 = line_arr[3:] + # read azimuthal vector (x2, y2, z2) + line_arr = np.fromstring(wwinp.readline(), sep=' ') + xyz2 = line_arr[:3] + + # Get polar and azimuthal axes + polar_axis = xyz1 - xyz0 + azimuthal_axis = xyz2 - xyz0 + + # Check for polar axis other than (0, 0, 1) + norm = np.linalg.norm(polar_axis) + if not np.isclose(polar_axis[2]/norm, 1.0): + raise NotImplementedError('Polar axis not aligned to z-axis not supported') + + # Check for azimuthal axis other than (1, 0, 0) + norm = np.linalg.norm(azimuthal_axis) + if not np.isclose(azimuthal_axis[0]/norm, 1.0): + raise NotImplementedError('Azimuthal axis not aligned to x-axis not supported') + + # read geometry type + nwg = int(line_arr[-1]) + + elif nr == 10: + # read rectilinear data: + # number of coarse mesh bins and mesh type + ncx, ncy, ncz, nwg = \ + np.fromstring(wwinp.readline(), sep=' ').astype(int) + else: + raise RuntimeError(f'Invalid mesh description (nr) found: {nr}') + + # read BLOCK 2 and BLOCK 3 data into a single array + ww_data = np.fromstring(wwinp.read(), sep=' ') + + # extract mesh data from the ww_data array + start_idx = 0 + + # first values in the mesh definition arrays are the first + # coordinate of the grid + end_idx = start_idx + 1 + 3 * ncx + i0, i_vals = ww_data[start_idx], ww_data[start_idx+1:end_idx] + start_idx = end_idx + + end_idx = start_idx + 1 + 3 * ncy + j0, j_vals = ww_data[start_idx], ww_data[start_idx+1:end_idx] + start_idx = end_idx + + end_idx = start_idx + 1 + 3 * ncz + k0, k_vals = ww_data[start_idx], ww_data[start_idx+1:end_idx] + start_idx = end_idx + + # mesh consistency checks + if nr == 16 and nwg == 1 or nr == 10 and nwg != 1: + raise ValueError(f'Mesh description in header ({nr}) ' + f'does not match the mesh type ({nwg})') + + if nr == 10 and (xyz0 != (i0, j0, k0)).any(): + raise ValueError(f'Mesh origin in the header ({xyz0}) ' + f' does not match the origin in the mesh ' + f' description ({i0, j0, k0})') + + # create openmc mesh object + grids = [] + mesh_definition = [(i0, i_vals, nfx), (j0, j_vals, nfy), (k0, k_vals, nfz)] + for grid0, grid_vals, n_pnts in mesh_definition: + # file spec checks for the mesh definition + if (grid_vals[2::3] != 1.0).any(): + raise ValueError('One or more mesh ratio value, qx, ' + 'is not equal to one') + + s = int(grid_vals[::3].sum()) + if s != n_pnts: + raise ValueError(f'Sum of the fine bin entries, {s}, does ' + f'not match the number of fine bins, {n_pnts}') + + # extend the grid based on the next coarse bin endpoint, px + # and the number of fine bins in the coarse bin, sx + intervals = grid_vals.reshape(-1, 3) + coords = [grid0] + for sx, px, qx in intervals: + coords += np.linspace(coords[-1], px, int(sx + 1)).tolist()[1:] + + grids.append(np.array(coords)) + + if nwg == 1: + mesh = RectilinearMesh() + mesh.x_grid, mesh.y_grid, mesh.z_grid = grids + elif nwg == 2: + mesh = CylindricalMesh( + r_grid=grids[0], + z_grid=grids[1], + phi_grid=grids[2], + origin = xyz0, + ) + elif nwg == 3: + mesh = SphericalMesh( + r_grid=grids[0], + theta_grid=grids[1], + phi_grid=grids[2], + origin = xyz0 + ) + + # extract weight window values from array + wws = cls() + for ne_i, nt_i, particle_type in zip(ne, nt, ('neutron', 'photon')): + # no information to read for this particle if + # either the energy bins or time bins are empty + if ne_i == 0 or nt_i == 0: + continue + + if iv > 1: + # time bins are parsed but unused for now + end_idx = start_idx + nt_i + time_bounds = ww_data[start_idx:end_idx] + np.insert(time_bounds, (0,), (0.0,)) + start_idx = end_idx + + # read energy boundaries + end_idx = start_idx + ne_i + energy_bounds = np.insert(ww_data[start_idx:end_idx], (0,), (0.0,)) + # convert from MeV to eV + energy_bounds *= 1e6 + start_idx = end_idx + + # read weight window values + end_idx = start_idx + (nfx * nfy * nfz) * nt_i * ne_i + + # read values and reshape according to ordering + # slowest to fastest: t, e, z, y, x + # reorder with transpose since our ordering is x, y, z, e, t + ww_shape = (nt_i, ne_i, nfz, nfy, nfx) + ww_values = ww_data[start_idx:end_idx].reshape(ww_shape).T + # Only use first time bin since we don't support time dependent weight + # windows yet. + ww_values = ww_values[:, :, :, :, 0] + start_idx = end_idx + + # create a weight window object + ww = WeightWindows(id=None, + mesh=mesh, + lower_ww_bounds=ww_values, + upper_bound_ratio=5.0, + energy_bounds=energy_bounds, + particle_type=particle_type) + wws.append(ww) + + return wws + + def export_to_hdf5(self, path: PathLike = 'weight_windows.h5', **init_kwargs): + """Write weight windows to an HDF5 file. + + Parameters + ---------- + path : PathLike + Path to the file to write weight windows to + **init_kwargs + Keyword arguments passed to :func:`openmc.lib.init` + + """ + import openmc.lib + cv.check_type('path', path, PathLike) + + # Create a temporary model with the weight windows + model = openmc.Model() + sph = openmc.Sphere(boundary_type='vacuum') + cell = openmc.Cell(region=-sph) + model.geometry = openmc.Geometry([cell]) + model.settings.weight_windows = self + model.settings.particles = 100 + model.settings.batches = 1 + + # Get absolute path before moving to temporary directory + path = Path(path).resolve() + + # Load the model with openmc.lib and then export it to an HDF5 file + with openmc.lib.TemporarySession(model, **init_kwargs): + openmc.lib.export_weight_windows(path) diff --git a/pyproject.toml b/pyproject.toml index 6e8ed798e..2d67e8340 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,15 +41,22 @@ dependencies = [ [project.optional-dependencies] depletion-mpi = ["mpi4py"] docs = [ - "sphinx==5.0.2", + "sphinx", "sphinxcontrib-katex", "sphinx-numfig", "jupyter", "sphinxcontrib-svg2pdfconverter", - "sphinx-rtd-theme==1.0.0" + "sphinx-rtd-theme" ] -test = ["packaging", "pytest", "pytest-cov", "colorama", "openpyxl"] -ci = ["cpp-coveralls", "coveralls"] +test = [ + "packaging", + "pytest", + "pytest-cov>=4.0", + "pytest-rerunfailures", + "colorama", + "openpyxl", +] +ci = ["coverage>=7.4", "gcovr>=7.2"] vtk = ["vtk"] [project.urls] diff --git a/src/bank.cpp b/src/bank.cpp index 8d00d5440..33790379b 100644 --- a/src/bank.cpp +++ b/src/bank.cpp @@ -1,6 +1,7 @@ #include "openmc/bank.h" #include "openmc/capi.h" #include "openmc/error.h" +#include "openmc/ifp.h" #include "openmc/message_passing.h" #include "openmc/simulation.h" #include "openmc/vector.h" @@ -19,6 +20,8 @@ vector source_bank; SharedArray surf_source_bank; +SharedArray collision_track_bank; + // The fission bank is allocated as a SharedArray, rather than a vector, as it // will be shared by all threads in the simulation. It will be allocated to a // fixed maximum capacity in the init_fission_bank() function. Then, Elements @@ -26,6 +29,14 @@ SharedArray surf_source_bank; // function. SharedArray fission_bank; +vector> ifp_source_delayed_group_bank; + +vector> ifp_source_lifetime_bank; + +vector> ifp_fission_delayed_group_bank; + +vector> ifp_fission_lifetime_bank; + // Each entry in this vector corresponds to the number of progeny produced // this generation for the particle located at that index. This vector is // used to efficiently sort the fission bank after each iteration. @@ -41,8 +52,13 @@ void free_memory_bank() { simulation::source_bank.clear(); simulation::surf_source_bank.clear(); + simulation::collision_track_bank.clear(); simulation::fission_bank.clear(); simulation::progeny_per_particle.clear(); + simulation::ifp_source_delayed_group_bank.clear(); + simulation::ifp_source_lifetime_bank.clear(); + simulation::ifp_fission_delayed_group_bank.clear(); + simulation::ifp_fission_lifetime_bank.clear(); } void init_fission_bank(int64_t max) @@ -66,22 +82,17 @@ void sort_fission_bank() // Perform exclusive scan summation to determine starting indices in fission // bank for each parent particle id - int64_t tmp = simulation::progeny_per_particle[0]; - simulation::progeny_per_particle[0] = 0; - for (int64_t i = 1; i < simulation::progeny_per_particle.size(); i++) { - int64_t value = simulation::progeny_per_particle[i - 1] + tmp; - tmp = simulation::progeny_per_particle[i]; - simulation::progeny_per_particle[i] = value; - } - - // TODO: C++17 introduces the exclusive_scan() function which could be - // used to replace everything above this point in this function. + std::exclusive_scan(simulation::progeny_per_particle.begin(), + simulation::progeny_per_particle.end(), + simulation::progeny_per_particle.begin(), 0); // We need a scratch vector to make permutation of the fission bank into // sorted order easy. Under normal usage conditions, the fission bank is // over provisioned, so we can use that as scratch space. SourceSite* sorted_bank; vector sorted_bank_holder; + vector> sorted_ifp_delayed_group_bank; + vector> sorted_ifp_lifetime_bank; // If there is not enough space, allocate a temporary vector and point to it if (simulation::fission_bank.size() > @@ -92,6 +103,11 @@ void sort_fission_bank() sorted_bank = &simulation::fission_bank[simulation::fission_bank.size()]; } + if (settings::ifp_on) { + allocate_temporary_vector_ifp( + sorted_ifp_delayed_group_bank, sorted_ifp_lifetime_bank); + } + // Use parent and progeny indices to sort fission bank for (int64_t i = 0; i < simulation::fission_bank.size(); i++) { const auto& site = simulation::fission_bank[i]; @@ -102,11 +118,19 @@ void sort_fission_bank() "shared fission bank size."); } sorted_bank[idx] = site; + if (settings::ifp_on) { + copy_ifp_data_from_fission_banks( + i, sorted_ifp_delayed_group_bank[idx], sorted_ifp_lifetime_bank[idx]); + } } // Copy sorted bank into the fission bank std::copy(sorted_bank, sorted_bank + simulation::fission_bank.size(), simulation::fission_bank.data()); + if (settings::ifp_on) { + copy_ifp_data_to_fission_banks( + sorted_ifp_delayed_group_bank.data(), sorted_ifp_lifetime_bank.data()); + } } //============================================================================== diff --git a/src/boundary_condition.cpp b/src/boundary_condition.cpp index 7216ac896..5bbda4830 100644 --- a/src/boundary_condition.cpp +++ b/src/boundary_condition.cpp @@ -129,23 +129,8 @@ TranslationalPeriodicBC::TranslationalPeriodicBC(int i_surf, int j_surf) void TranslationalPeriodicBC::handle_particle( Particle& p, const Surface& surf) const { - int i_particle_surf = p.surface_index(); - - // Figure out which of the two BC surfaces were struck then find the - // particle's new location and surface. - Position new_r; - int new_surface; - if (i_particle_surf == i_surf_) { - new_r = p.r() + translation_; - new_surface = p.surface() > 0 ? j_surf_ + 1 : -(j_surf_ + 1); - } else if (i_particle_surf == j_surf_) { - new_r = p.r() - translation_; - new_surface = p.surface() > 0 ? i_surf_ + 1 : -(i_surf_ + 1); - } else { - throw std::runtime_error( - "Called BoundaryCondition::handle_particle after " - "hitting a surface, but that surface is not recognized by the BC."); - } + auto new_r = p.r() + translation_; + int new_surface = p.surface() > 0 ? j_surf_ + 1 : -(j_surf_ + 1); // Handle the effects of the surface albedo on the particle's weight. BoundaryCondition::handle_albedo(p, surf); @@ -158,63 +143,45 @@ void TranslationalPeriodicBC::handle_particle( // RotationalPeriodicBC implementation //============================================================================== -RotationalPeriodicBC::RotationalPeriodicBC(int i_surf, int j_surf) - : PeriodicBC(i_surf, j_surf) +RotationalPeriodicBC::RotationalPeriodicBC( + int i_surf, int j_surf, PeriodicAxis axis) + : PeriodicBC(std::abs(i_surf) - 1, std::abs(j_surf) - 1) { Surface& surf1 {*model::surfaces[i_surf_]}; Surface& surf2 {*model::surfaces[j_surf_]}; - // Check the type of the first surface - bool surf1_is_xyplane; - if (const auto* ptr = dynamic_cast(&surf1)) { - surf1_is_xyplane = true; - } else if (const auto* ptr = dynamic_cast(&surf1)) { - surf1_is_xyplane = true; - } else if (const auto* ptr = dynamic_cast(&surf1)) { - surf1_is_xyplane = false; - } else { - throw std::invalid_argument(fmt::format( - "Surface {} is an invalid type for " - "rotational periodic BCs. Only x-planes, y-planes, or general planes " - "(that are perpendicular to z) are supported for these BCs.", - surf1.id_)); + // below convention for right handed coordinate system + switch (axis) { + case x: + zero_axis_idx_ = 0; // x component of plane must be zero + axis_1_idx_ = 1; // y component independent + axis_2_idx_ = 2; // z component dependent + break; + case y: + zero_axis_idx_ = 1; // y component of plane must be zero + axis_1_idx_ = 2; // z component independent + axis_2_idx_ = 0; // x component dependent + break; + case z: + zero_axis_idx_ = 2; // z component of plane must be zero + axis_1_idx_ = 0; // x component independent + axis_2_idx_ = 1; // y component dependent + break; + default: + throw std::invalid_argument( + fmt::format("You've specified an axis that is not x, y, or z.")); } - // Check the type of the second surface - bool surf2_is_xyplane; - if (const auto* ptr = dynamic_cast(&surf2)) { - surf2_is_xyplane = true; - } else if (const auto* ptr = dynamic_cast(&surf2)) { - surf2_is_xyplane = true; - } else if (const auto* ptr = dynamic_cast(&surf2)) { - surf2_is_xyplane = false; - } else { - throw std::invalid_argument(fmt::format( - "Surface {} is an invalid type for " - "rotational periodic BCs. Only x-planes, y-planes, or general planes " - "(that are perpendicular to z) are supported for these BCs.", - surf2.id_)); - } + Direction ax = {0.0, 0.0, 0.0}; + ax[zero_axis_idx_] = 1.0; + + auto i_sign = std::copysign(1, i_surf); + auto j_sign = -std::copysign(1, j_surf); // Compute the surface normal vectors and make sure they are perpendicular - // to the z-axis - Direction norm1 = surf1.normal({0, 0, 0}); - Direction norm2 = surf2.normal({0, 0, 0}); - if (std::abs(norm1.z) > FP_PRECISION) { - throw std::invalid_argument(fmt::format( - "Rotational periodic BCs are only " - "supported for rotations about the z-axis, but surface {} is not " - "perpendicular to the z-axis.", - surf1.id_)); - } - if (std::abs(norm2.z) > FP_PRECISION) { - throw std::invalid_argument(fmt::format( - "Rotational periodic BCs are only " - "supported for rotations about the z-axis, but surface {} is not " - "perpendicular to the z-axis.", - surf2.id_)); - } - + // to the correct axis + Direction norm1 = i_sign * surf1.normal({0, 0, 0}); + Direction norm2 = j_sign * surf2.normal({0, 0, 0}); // Make sure both surfaces intersect the origin if (std::abs(surf1.evaluate({0, 0, 0})) > FP_COINCIDENT) { throw std::invalid_argument(fmt::format( @@ -231,15 +198,15 @@ RotationalPeriodicBC::RotationalPeriodicBC(int i_surf, int j_surf) surf2.id_)); } - // Compute the BC rotation angle. Here it is assumed that both surface - // normal vectors point inwards---towards the valid geometry region. - // Consequently, the rotation angle is not the difference between the two - // normals, but is instead the difference between one normal and one - // anti-normal. (An incident ray on one surface must be an outgoing ray on - // the other surface after rotation hence the anti-normal.) - double theta1 = std::atan2(norm1.y, norm1.x); - double theta2 = std::atan2(norm2.y, norm2.x) + PI; - angle_ = theta2 - theta1; + // Compute the signed rotation angle about the periodic axis. Note that + // (n1×n2)·a = |n1||n2|sin(θ) and n1·n2 = |n1||n2|cos(θ), where a is the axis + // of rotation. + auto c = norm1.cross(norm2); + angle_ = std::atan2(c.dot(ax), norm1.dot(norm2)); + + // If the normals point in the same general direction, the surface sense + // should change when crossing the boundary + flip_sense_ = (i_sign * j_sign > 0.0); // Warn the user if the angle does not evenly divide a circle double rem = std::abs(std::remainder((2 * PI / angle_), 1.0)); @@ -254,34 +221,25 @@ RotationalPeriodicBC::RotationalPeriodicBC(int i_surf, int j_surf) void RotationalPeriodicBC::handle_particle( Particle& p, const Surface& surf) const { - int i_particle_surf = p.surface_index(); + int new_surface = p.surface() > 0 ? -(j_surf_ + 1) : j_surf_ + 1; + if (flip_sense_) + new_surface = -new_surface; - // Figure out which of the two BC surfaces were struck to figure out if a - // forward or backward rotation is required. Specify the other surface as - // the particle's new surface. - double theta; - int new_surface; - if (i_particle_surf == i_surf_) { - theta = angle_; - new_surface = p.surface() > 0 ? -(j_surf_ + 1) : j_surf_ + 1; - } else if (i_particle_surf == j_surf_) { - theta = -angle_; - new_surface = p.surface() > 0 ? -(i_surf_ + 1) : i_surf_ + 1; - } else { - throw std::runtime_error( - "Called BoundaryCondition::handle_particle after " - "hitting a surface, but that surface is not recognized by the BC."); - } - - // Rotate the particle's position and direction about the z-axis. + // Rotate the particle's position and direction. Position r = p.r(); Direction u = p.u(); - double cos_theta = std::cos(theta); - double sin_theta = std::sin(theta); - Position new_r = { - cos_theta * r.x - sin_theta * r.y, sin_theta * r.x + cos_theta * r.y, r.z}; - Direction new_u = { - cos_theta * u.x - sin_theta * u.y, sin_theta * u.x + cos_theta * u.y, u.z}; + double cos_theta = std::cos(angle_); + double sin_theta = std::sin(angle_); + + Position new_r; + new_r[zero_axis_idx_] = r[zero_axis_idx_]; + new_r[axis_1_idx_] = cos_theta * r[axis_1_idx_] - sin_theta * r[axis_2_idx_]; + new_r[axis_2_idx_] = sin_theta * r[axis_1_idx_] + cos_theta * r[axis_2_idx_]; + + Direction new_u; + new_u[zero_axis_idx_] = u[zero_axis_idx_]; + new_u[axis_1_idx_] = cos_theta * u[axis_1_idx_] - sin_theta * u[axis_2_idx_]; + new_u[axis_2_idx_] = sin_theta * u[axis_1_idx_] + cos_theta * u[axis_2_idx_]; // Handle the effects of the surface albedo on the particle's weight. BoundaryCondition::handle_albedo(p, surf); diff --git a/src/bremsstrahlung.cpp b/src/bremsstrahlung.cpp index d22d6392a..a2320e0b4 100644 --- a/src/bremsstrahlung.cpp +++ b/src/bremsstrahlung.cpp @@ -112,6 +112,12 @@ void thick_target_bremsstrahlung(Particle& p, double* E_lost) std::pow(a * (c - c_l) / (std::exp(w_l) * p_l) + 1.0, 1.0 / a); if (w > settings::energy_cutoff[photon]) { + // If the energy of the secondary photon is larger than the remaining + // energy of the primary particle, adjust it to the remaining energy + if (*E_lost + w > p.E()) { + w = p.E() - *E_lost; + } + // Create secondary photon p.create_secondary(p.wgt(), p.u(), w, ParticleType::photon); *E_lost += w; diff --git a/src/cell.cpp b/src/cell.cpp index 4b2699229..aceed31ca 100644 --- a/src/cell.cpp +++ b/src/cell.cpp @@ -40,6 +40,11 @@ vector> cells; // Cell implementation //============================================================================== +int32_t Cell::n_instances() const +{ + return model::universes[universe_]->n_instances_; +} + void Cell::set_rotation(const vector& rot) { if (fill_ == C_NONE) { @@ -52,7 +57,7 @@ void Cell::set_rotation(const vector& rot) fatal_error(fmt::format("Non-3D rotation vector applied to cell {}", id_)); } - // Compute and store the rotation matrix. + // Compute and store the inverse rotation matrix for the angles given. rotation_.clear(); rotation_.reserve(rot.size() == 9 ? 9 : 12); if (rot.size() == 3) { @@ -96,6 +101,25 @@ double Cell::temperature(int32_t instance) const } } +double Cell::density_mult(int32_t instance) const +{ + if (instance >= 0) { + return density_mult_.size() == 1 ? density_mult_.at(0) + : density_mult_.at(instance); + } else { + return density_mult_[0]; + } +} + +double Cell::density(int32_t instance) const +{ + const int32_t mat_index = material(instance); + if (mat_index == MATERIAL_VOID) + return 0.0; + + return density_mult(instance) * model::materials[mat_index]->density_gpcc(); +} + void Cell::set_temperature(double T, int32_t instance, bool set_contained) { if (settings::temperature_method == TemperatureMethod::INTERPOLATION) { @@ -115,8 +139,8 @@ void Cell::set_temperature(double T, int32_t instance, bool set_contained) if (type_ == Fill::MATERIAL) { if (instance >= 0) { // If temperature vector is not big enough, resize it first - if (sqrtkT_.size() != n_instances_) - sqrtkT_.resize(n_instances_, sqrtkT_[0]); + if (sqrtkT_.size() != n_instances()) + sqrtkT_.resize(n_instances(), sqrtkT_[0]); // Set temperature for the corresponding instance sqrtkT_.at(instance) = std::sqrt(K_BOLTZMANN * T); @@ -146,6 +170,47 @@ void Cell::set_temperature(double T, int32_t instance, bool set_contained) } } +void Cell::set_density(double density, int32_t instance, bool set_contained) +{ + if (type_ != Fill::MATERIAL && !set_contained) { + fatal_error( + fmt::format("Attempted to set the density multiplier of cell {} " + "which is not filled by a material.", + id_)); + } + + if (type_ == Fill::MATERIAL) { + const int32_t mat_index = material(instance); + if (mat_index == MATERIAL_VOID) + return; + + if (instance >= 0) { + // If density multiplier vector is not big enough, resize it first + if (density_mult_.size() != n_instances()) + density_mult_.resize(n_instances(), density_mult_[0]); + + // Set density multiplier for the corresponding instance + density_mult_.at(instance) = + density / model::materials[mat_index]->density_gpcc(); + } else { + // Set density multiplier for all instances + for (auto& x : density_mult_) { + x = density / model::materials[mat_index]->density_gpcc(); + } + } + } else { + auto contained_cells = this->get_contained_cells(instance); + for (const auto& entry : contained_cells) { + auto& cell = model::cells[entry.first]; + assert(cell->type_ == Fill::MATERIAL); + auto& instances = entry.second; + for (auto instance : instances) { + cell->set_density(density, instance); + } + } + } +} + void Cell::export_properties_hdf5(hid_t group) const { // Create a group for this cell. @@ -157,6 +222,15 @@ void Cell::export_properties_hdf5(hid_t group) const temps.push_back(sqrtkT_val * sqrtkT_val / K_BOLTZMANN); write_dataset(cell_group, "temperature", temps); + // Write density for one or more cell instances + if (type_ == Fill::MATERIAL && material_.size() > 0) { + vector density; + for (int32_t i = 0; i < density_mult_.size(); ++i) + density.push_back(this->density(i)); + + write_dataset(cell_group, "density", density); + } + close_group(cell_group); } @@ -170,8 +244,8 @@ void Cell::import_properties_hdf5(hid_t group) // Ensure number of temperatures makes sense auto n_temps = temps.size(); - if (n_temps > 1 && n_temps != n_instances_) { - throw std::runtime_error(fmt::format( + if (n_temps > 1 && n_temps != n_instances()) { + fatal_error(fmt::format( "Number of temperatures for cell {} doesn't match number of instances", id_)); } @@ -183,6 +257,25 @@ void Cell::import_properties_hdf5(hid_t group) this->set_temperature(temps[i], i); } + // Read densities + if (object_exists(cell_group, "density")) { + vector density; + read_dataset(cell_group, "density", density); + + // Ensure number of densities makes sense + auto n_density = density.size(); + if (n_density > 1 && n_density != n_instances()) { + fatal_error(fmt::format("Number of densities for cell {} " + "doesn't match number of instances", + id_)); + } + + // Set densities. + for (int32_t i = 0; i < n_density; ++i) { + this->set_density(density[i], i); + } + } + close_group(cell_group); } @@ -222,6 +315,8 @@ void Cell::to_hdf5(hid_t cell_group) const temps.push_back(sqrtkT_val * sqrtkT_val / K_BOLTZMANN); write_dataset(group, "temperature", temps); + write_dataset(group, "density_mult", density_mult_); + } else if (type_ == Fill::UNIVERSE) { write_dataset(group, "fill_type", "universe"); write_dataset(group, "fill", model::universes[fill_]->id_); @@ -339,6 +434,44 @@ CSGCell::CSGCell(pugi::xml_node cell_node) } } + // Read the density element which can be distributed similar to temperature. + // These get assigned to the density multiplier, requiring a division by + // the material density. + // Note: calculating the actual density multiplier is deferred until materials + // are finalized. density_mult_ contains the true density in the meantime. + if (check_for_node(cell_node, "density")) { + density_mult_ = get_node_array(cell_node, "density"); + density_mult_.shrink_to_fit(); + + // Make sure this is a material-filled cell. + if (material_.size() == 0) { + fatal_error(fmt::format( + "Cell {} was specified with a density but no material. Density" + "specification is only valid for cells filled with a material.", + id_)); + } + + // Make sure this is a non-void material. + for (auto mat_id : material_) { + if (mat_id == MATERIAL_VOID) { + fatal_error(fmt::format( + "Cell {} was specified with a density, but contains a void " + "material. Density specification is only valid for cells " + "filled with a non-void material.", + id_)); + } + } + + // Make sure all densities are non-negative and greater than zero. + for (auto rho : density_mult_) { + if (rho <= 0) { + fatal_error(fmt::format( + "Cell {} was specified with a density less than or equal to zero", + id_)); + } + } + } + // Read the region specification. std::string region_spec; if (check_for_node(cell_node, "region")) { @@ -1025,7 +1158,7 @@ void populate_universes() model::universes.back()->cells_.push_back(index_cell); model::universe_map[uid] = model::universes.size() - 1; } else { -#ifdef DAGMC +#ifdef OPENMC_DAGMC_ENABLED // Skip implicit complement cells for now Universe* univ = model::universes[it->second].get(); DAGUniverse* dag_univ = dynamic_cast(univ); @@ -1124,6 +1257,24 @@ extern "C" int openmc_cell_set_temperature( return 0; } +extern "C" int openmc_cell_set_density( + int32_t index, double density, const int32_t* instance, bool set_contained) +{ + if (index < 0 || index >= model::cells.size()) { + strcpy(openmc_err_msg, "Index in cells array is out of bounds."); + return OPENMC_E_OUT_OF_BOUNDS; + } + + int32_t instance_index = instance ? *instance : -1; + try { + model::cells[index]->set_density(density, instance_index, set_contained); + } catch (const std::exception& e) { + set_errmsg(e.what()); + return OPENMC_E_UNASSIGNED; + } + return 0; +} + extern "C" int openmc_cell_get_temperature( int32_t index, const int32_t* instance, double* T) { @@ -1142,6 +1293,36 @@ extern "C" int openmc_cell_get_temperature( return 0; } +extern "C" int openmc_cell_get_density( + int32_t index, const int32_t* instance, double* density) +{ + if (index < 0 || index >= model::cells.size()) { + strcpy(openmc_err_msg, "Index in cells array is out of bounds."); + return OPENMC_E_OUT_OF_BOUNDS; + } + + int32_t instance_index = instance ? *instance : -1; + try { + if (model::cells[index]->type_ != Fill::MATERIAL) { + fatal_error( + fmt::format("Cell {}, instance {} is not filled with a material.", + model::cells[index]->id_, instance_index)); + } + + int32_t mat_index = model::cells[index]->material(instance_index); + if (mat_index == MATERIAL_VOID) { + *density = 0.0; + } else { + *density = model::cells[index]->density_mult(instance_index) * + model::materials[mat_index]->density_gpcc(); + } + } catch (const std::exception& e) { + set_errmsg(e.what()); + return OPENMC_E_UNASSIGNED; + } + return 0; +} + //! Get the bounding box of a cell extern "C" int openmc_cell_bounding_box( const int32_t index, double* llc, double* urc) @@ -1153,14 +1334,14 @@ extern "C" int openmc_cell_bounding_box( bbox = c->bounding_box(); // set lower left corner values - llc[0] = bbox.xmin; - llc[1] = bbox.ymin; - llc[2] = bbox.zmin; + llc[0] = bbox.min.x; + llc[1] = bbox.min.y; + llc[2] = bbox.min.z; // set upper right corner values - urc[0] = bbox.xmax; - urc[1] = bbox.ymax; - urc[2] = bbox.zmax; + urc[0] = bbox.max.x; + urc[1] = bbox.max.y; + urc[2] = bbox.max.z; return 0; } @@ -1314,10 +1495,10 @@ vector Cell::find_parent_cells( bool cell_found = false; for (auto it = coords.begin(); it != coords.end(); it++) { const auto& coord = *it; - const auto& cell = model::cells[coord.cell]; + const auto& cell = model::cells[coord.cell()]; // if the cell at this level matches the current cell, stop adding to the // stack - if (coord.cell == model::cell_map[this->id_]) { + if (coord.cell() == model::cell_map[this->id_]) { cell_found = true; break; } @@ -1327,10 +1508,10 @@ vector Cell::find_parent_cells( int lattice_idx = C_NONE; if (cell->type_ == Fill::LATTICE) { const auto& next_coord = *(it + 1); - lattice_idx = model::lattices[next_coord.lattice]->get_flat_index( - next_coord.lattice_i); + lattice_idx = model::lattices[next_coord.lattice()]->get_flat_index( + next_coord.lattice_index()); } - stack.push(coord.universe, {coord.cell, lattice_idx}); + stack.push(coord.universe(), {coord.cell(), lattice_idx}); } // if this loop finished because the cell was found and @@ -1618,7 +1799,7 @@ extern "C" int openmc_cell_get_num_instances( set_errmsg("Index in cells array is out of bounds."); return OPENMC_E_OUT_OF_BOUNDS; } - *num_instances = model::cells[index]->n_instances_; + *num_instances = model::cells[index]->n_instances(); return 0; } diff --git a/src/chain.cpp b/src/chain.cpp index e279d1f59..a60ef12cd 100644 --- a/src/chain.cpp +++ b/src/chain.cpp @@ -70,8 +70,8 @@ ChainNuclide::~ChainNuclide() void DecayPhotonAngleEnergy::sample( double E_in, double& E_out, double& mu, uint64_t* seed) const { - E_out = photon_energy_->sample(seed); - mu = Uniform(-1., 1.).sample(seed); + E_out = photon_energy_->sample(seed).first; + mu = Uniform(-1., 1.).sample(seed).first; } //============================================================================== diff --git a/src/collision_track.cpp b/src/collision_track.cpp new file mode 100644 index 000000000..03cbc32b7 --- /dev/null +++ b/src/collision_track.cpp @@ -0,0 +1,238 @@ +#include "openmc/collision_track.h" + +#include +#include + +#include + +#include "openmc/bank.h" +#include "openmc/bank_io.h" +#include "openmc/cell.h" +#include "openmc/constants.h" +#include "openmc/error.h" +#include "openmc/file_utils.h" +#include "openmc/hdf5_interface.h" +#include "openmc/material.h" +#include "openmc/mcpl_interface.h" +#include "openmc/message_passing.h" +#include "openmc/nuclide.h" +#include "openmc/output.h" +#include "openmc/particle.h" +#include "openmc/settings.h" +#include "openmc/simulation.h" +#include "openmc/universe.h" + +#ifdef OPENMC_MPI +#include +#endif + +namespace openmc { + +namespace { + +hid_t h5_collision_track_banktype() +{ + hid_t postype = H5Tcreate(H5T_COMPOUND, sizeof(Position)); + H5Tinsert(postype, "x", HOFFSET(Position, x), H5T_NATIVE_DOUBLE); + H5Tinsert(postype, "y", HOFFSET(Position, y), H5T_NATIVE_DOUBLE); + H5Tinsert(postype, "z", HOFFSET(Position, z), H5T_NATIVE_DOUBLE); + + hid_t banktype = H5Tcreate(H5T_COMPOUND, sizeof(CollisionTrackSite)); + + H5Tinsert(banktype, "r", HOFFSET(CollisionTrackSite, r), postype); + H5Tinsert(banktype, "u", HOFFSET(CollisionTrackSite, u), postype); + H5Tinsert(banktype, "E", HOFFSET(CollisionTrackSite, E), H5T_NATIVE_DOUBLE); + H5Tinsert(banktype, "dE", HOFFSET(CollisionTrackSite, dE), H5T_NATIVE_DOUBLE); + H5Tinsert( + banktype, "time", HOFFSET(CollisionTrackSite, time), H5T_NATIVE_DOUBLE); + H5Tinsert( + banktype, "wgt", HOFFSET(CollisionTrackSite, wgt), H5T_NATIVE_DOUBLE); + H5Tinsert(banktype, "event_mt", HOFFSET(CollisionTrackSite, event_mt), + H5T_NATIVE_INT); + H5Tinsert(banktype, "delayed_group", + HOFFSET(CollisionTrackSite, delayed_group), H5T_NATIVE_INT); + H5Tinsert( + banktype, "cell_id", HOFFSET(CollisionTrackSite, cell_id), H5T_NATIVE_INT); + H5Tinsert(banktype, "nuclide_id", HOFFSET(CollisionTrackSite, nuclide_id), + H5T_NATIVE_INT); + H5Tinsert(banktype, "material_id", HOFFSET(CollisionTrackSite, material_id), + H5T_NATIVE_INT); + H5Tinsert(banktype, "universe_id", HOFFSET(CollisionTrackSite, universe_id), + H5T_NATIVE_INT); + H5Tinsert(banktype, "n_collision", HOFFSET(CollisionTrackSite, n_collision), + H5T_NATIVE_INT); + H5Tinsert(banktype, "particle", HOFFSET(CollisionTrackSite, particle), + H5T_NATIVE_INT); + H5Tinsert(banktype, "parent_id", HOFFSET(CollisionTrackSite, parent_id), + H5T_NATIVE_INT64); + H5Tinsert(banktype, "progeny_id", HOFFSET(CollisionTrackSite, progeny_id), + H5T_NATIVE_INT64); + H5Tclose(postype); + return banktype; +} + +void write_collision_track_bank(hid_t group_id, + openmc::span collision_track_bank, + const openmc::vector& bank_index) +{ + hid_t banktype = h5_collision_track_banktype(); +#ifdef OPENMC_MPI + write_bank_dataset("collision_track_bank", group_id, collision_track_bank, + bank_index, banktype, banktype, mpi::collision_track_site); +#else + write_bank_dataset("collision_track_bank", group_id, collision_track_bank, + bank_index, banktype, banktype); +#endif + + H5Tclose(banktype); +} + +void write_h5_collision_track(const char* filename, + openmc::span collision_track_bank, + const openmc::vector& bank_index) +{ +#ifdef PHDF5 + bool parallel = true; +#else + bool parallel = false; +#endif + + if (!filename) + fatal_error("write_h5_collision_track filename needs a nonempty name."); + + std::string filename_(filename); + const auto extension = get_file_extension(filename_); + if (extension.empty()) { + filename_.append(".h5"); + } else if (extension != "h5") { + warning("write_h5_collision_track was passed a file extension differing " + "from .h5, but an hdf5 file will be written."); + } + + hid_t file_id; + if (mpi::master || parallel) { + file_id = file_open(filename_.c_str(), 'w', true); + + // Write filetype and version info + write_attribute(file_id, "filetype", "collision_track"); + write_attribute(file_id, "version", VERSION_COLLISION_TRACK); + } + + write_collision_track_bank(file_id, collision_track_bank, bank_index); + + if (mpi::master || parallel) + file_close(file_id); +} + +} // namespace + +bool should_record_event(int id_cell, int mt_event, const std::string& nuclide, + int id_universe, int id_material, double energy_loss) +{ + auto matches_filter = [](const auto& filter_set, const auto& value) { + return filter_set.empty() || filter_set.count(value) > 0; + }; + + const auto& cfg = settings::collision_track_config; + return simulation::current_batch > settings::n_inactive && + !simulation::collision_track_bank.full() && + matches_filter(cfg.cell_ids, id_cell) && + matches_filter(cfg.mt_numbers, mt_event) && + matches_filter(cfg.universe_ids, id_universe) && + matches_filter(cfg.material_ids, id_material) && + matches_filter(cfg.nuclides, nuclide) && + (cfg.deposited_energy_threshold == 0 || + cfg.deposited_energy_threshold < energy_loss); +} + +void collision_track_reserve_bank() +{ + simulation::collision_track_bank.reserve( + settings::collision_track_config.max_collisions); +} + +void collision_track_flush_bank() +{ + const auto& cfg = settings::collision_track_config; + if (simulation::ct_current_file > cfg.max_files) + return; + + bool last_batch = (simulation::current_batch == settings::n_batches); + if (!simulation::collision_track_bank.full() && !last_batch) + return; + + auto size = simulation::collision_track_bank.size(); + if (size == 0 && !last_batch) + return; + + auto collision_track_work_index = mpi::calculate_parallel_index_vector(size); + openmc::span collisiontrackbankspan( + simulation::collision_track_bank.begin(), size); + + std::string ext = cfg.mcpl_write ? "mcpl" : "h5"; + auto filename = fmt::format("{}collision_track.{}.{}", settings::path_output, + simulation::ct_current_file, ext); + + if (cfg.max_files == 1 || (simulation::ct_current_file == 1 && last_batch)) { + filename = settings::path_output + "collision_track." + ext; + } + write_message("Creating {}...", filename, 4); + + if (cfg.mcpl_write) { + write_mcpl_collision_track( + filename.c_str(), collisiontrackbankspan, collision_track_work_index); + } else { + write_h5_collision_track( + filename.c_str(), collisiontrackbankspan, collision_track_work_index); + } + + simulation::collision_track_bank.clear(); + if (!last_batch && cfg.max_files >= 1) { + collision_track_reserve_bank(); + } + ++simulation::ct_current_file; +} + +void collision_track_record(Particle& particle) +{ + int cell_index = particle.lowest_coord().cell(); + if (cell_index == C_NONE) + return; + + int cell_id = model::cells[cell_index]->id_; + const auto* nuclide_ptr = data::nuclides[particle.event_nuclide()].get(); + std::string nuclide = nuclide_ptr->name_; + int universe_id = model::universes[particle.lowest_coord().universe()]->id_; + double delta_E = particle.E_last() - particle.E(); + int material_index = particle.material(); + if (material_index == C_NONE) + return; + + int material_id = model::materials[material_index]->id_; + + if (!should_record_event(cell_id, particle.event_mt(), nuclide, universe_id, + material_id, delta_E)) + return; + + CollisionTrackSite site; + site.r = particle.r(); + site.u = particle.u(); + site.E = particle.E_last(); + site.dE = delta_E; + site.time = particle.time(); + site.wgt = particle.wgt(); + site.event_mt = particle.event_mt(); + site.delayed_group = particle.delayed_group(); + site.cell_id = cell_id; + site.nuclide_id = + 10000 * nuclide_ptr->Z_ + 10 * nuclide_ptr->A_ + nuclide_ptr->metastable_; + site.material_id = material_id; + site.universe_id = universe_id; + site.n_collision = particle.n_collision(); + site.particle = particle.type(); + site.parent_id = particle.id(); + site.progeny_id = particle.n_progeny(); + simulation::collision_track_bank.thread_safe_append(site); +} + +} // namespace openmc diff --git a/src/dagmc.cpp b/src/dagmc.cpp index 134360886..571182fa6 100644 --- a/src/dagmc.cpp +++ b/src/dagmc.cpp @@ -13,7 +13,7 @@ #include "openmc/settings.h" #include "openmc/string_utils.h" -#ifdef OPENMC_UWUW +#ifdef OPENMC_UWUW_ENABLED #include "uwuw.hpp" #endif #include @@ -26,13 +26,13 @@ namespace openmc { -#ifdef DAGMC +#ifdef OPENMC_DAGMC_ENABLED const bool DAGMC_ENABLED = true; #else const bool DAGMC_ENABLED = false; #endif -#ifdef OPENMC_UWUW +#ifdef OPENMC_UWUW_ENABLED const bool UWUW_ENABLED = true; #else const bool UWUW_ENABLED = false; @@ -40,7 +40,7 @@ const bool UWUW_ENABLED = false; } // namespace openmc -#ifdef DAGMC +#ifdef OPENMC_DAGMC_ENABLED namespace openmc { @@ -131,7 +131,7 @@ void DAGUniverse::set_id() void DAGUniverse::initialize() { -#ifdef OPENMC_UWUW +#ifdef OPENMC_UWUW_ENABLED // read uwuw materials from the .h5m file if present read_uwuw_materials(); #endif @@ -430,7 +430,7 @@ bool DAGUniverse::find_cell(GeometryState& p) const // cells, place it in the implicit complement bool found = Universe::find_cell(p); if (!found && model::universe_map[this->id_] != model::root_universe) { - p.lowest_coord().cell = implicit_complement_idx(); + p.lowest_coord().cell() = implicit_complement_idx(); found = true; } return found; @@ -456,16 +456,16 @@ void DAGUniverse::to_hdf5(hid_t universes_group) const bool DAGUniverse::uses_uwuw() const { -#ifdef OPENMC_UWUW +#ifdef OPENMC_UWUW_ENABLED return uwuw_ && !uwuw_->material_library.empty(); #else return false; -#endif // OPENMC_UWUW +#endif // OPENMC_UWUW_ENABLED } std::string DAGUniverse::get_uwuw_materials_xml() const { -#ifdef OPENMC_UWUW +#ifdef OPENMC_UWUW_ENABLED if (!uses_uwuw()) { throw std::runtime_error("This DAGMC Universe does not use UWUW materials"); } @@ -485,12 +485,12 @@ std::string DAGUniverse::get_uwuw_materials_xml() const return ss.str(); #else fatal_error("DAGMC was not configured with UWUW."); -#endif // OPENMC_UWUW +#endif // OPENMC_UWUW_ENABLED } void DAGUniverse::write_uwuw_materials_xml(const std::string& outfile) const { -#ifdef OPENMC_UWUW +#ifdef OPENMC_UWUW_ENABLED if (!uses_uwuw()) { throw std::runtime_error( "This DAGMC universe does not use UWUW materials."); @@ -503,7 +503,7 @@ void DAGUniverse::write_uwuw_materials_xml(const std::string& outfile) const mats_xml.close(); #else fatal_error("DAGMC was not configured with UWUW."); -#endif // OPENMC_UWUW +#endif // OPENMC_UWUW_ENABLED } void DAGUniverse::legacy_assign_material( @@ -565,7 +565,7 @@ void DAGUniverse::legacy_assign_material( void DAGUniverse::read_uwuw_materials() { -#ifdef OPENMC_UWUW +#ifdef OPENMC_UWUW_ENABLED // If no filename was provided, don't read UWUW materials if (filename_ == "") return; @@ -605,13 +605,13 @@ void DAGUniverse::read_uwuw_materials() } #else fatal_error("DAGMC was not configured with UWUW."); -#endif // OPENMC_UWUW +#endif // OPENMC_UWUW_ENABLED } void DAGUniverse::uwuw_assign_material( moab::EntityHandle vol_handle, std::unique_ptr& c) const { -#ifdef OPENMC_UWUW +#ifdef OPENMC_UWUW_ENABLED // lookup material in uwuw if present std::string uwuw_mat = dmd_ptr->volume_material_property_data_eh[vol_handle]; if (uwuw_->material_library.count(uwuw_mat) != 0) { @@ -627,7 +627,7 @@ void DAGUniverse::uwuw_assign_material( } #else fatal_error("DAGMC was not configured with UWUW."); -#endif // OPENMC_UWUW +#endif // OPENMC_UWUW_ENABLED } void DAGUniverse::override_assign_material(std::unique_ptr& c) const @@ -672,11 +672,11 @@ std::pair DAGCell::distance( p->last_dir() = u; p->history().reset(); } - if (on_surface == 0) { + if (on_surface == SURFACE_NONE) { p->history().reset(); } - const auto& univ = model::universes[p->lowest_coord().universe]; + const auto& univ = model::universes[p->lowest_coord().universe()]; DAGUniverse* dag_univ = static_cast(univ.get()); if (!dag_univ) @@ -753,7 +753,7 @@ BoundingBox DAGCell::bounding_box() const double min[3], max[3]; rval = dagmc_ptr_->getobb(vol, min, max); MB_CHK_ERR_CONT(rval); - return {min[0], max[0], min[1], max[1], min[2], max[2]}; + return {{min[0], min[1], min[2]}, {max[0], max[1], max[2]}}; } //============================================================================== @@ -926,4 +926,4 @@ int32_t next_cell(int32_t surf, int32_t curr_cell, int32_t univ); } // namespace openmc -#endif // DAGMC +#endif // OPENMC_DAGMC_ENABLED diff --git a/src/distribution.cpp b/src/distribution.cpp index ca00cbde4..537a56171 100644 --- a/src/distribution.cpp +++ b/src/distribution.cpp @@ -8,6 +8,7 @@ #include // for runtime_error #include // for string, stod +#include "openmc/constants.h" #include "openmc/error.h" #include "openmc/math_functions.h" #include "openmc/random_dist.h" @@ -16,6 +17,74 @@ namespace openmc { +//============================================================================== +// Helper function for computing importance weights from biased sampling +//============================================================================== + +vector compute_importance_weights( + const vector& p, const vector& b) +{ + std::size_t n = p.size(); + + // Normalize original probabilities + double sum_p = std::accumulate(p.begin(), p.end(), 0.0); + vector p_norm(n); + for (std::size_t i = 0; i < n; ++i) { + p_norm[i] = p[i] / sum_p; + } + + // Normalize bias probabilities + double sum_b = std::accumulate(b.begin(), b.end(), 0.0); + vector b_norm(n); + for (std::size_t i = 0; i < n; ++i) { + b_norm[i] = b[i] / sum_b; + } + + // Compute importance weights + vector weights(n); + for (std::size_t i = 0; i < n; ++i) { + weights[i] = (b_norm[i] == 0.0) ? INFTY : p_norm[i] / b_norm[i]; + } + return weights; +} + +std::pair Distribution::sample(uint64_t* seed) const +{ + if (bias_) { + // Sample from the bias distribution and compute importance weight + double val = bias_->sample_unbiased(seed); + double wgt = this->evaluate(val) / bias_->evaluate(val); + return {val, wgt}; + } else { + // Unbiased sampling: return sampled value with weight 1.0 + double val = sample_unbiased(seed); + return {val, 1.0}; + } +} + +// PDF evaluation not supported for all distribution types +double Distribution::evaluate(double x) const +{ + throw std::runtime_error( + "PDF evaluation not implemented for this distribution type."); +} + +void Distribution::read_bias_from_xml(pugi::xml_node node) +{ + if (check_for_node(node, "bias")) { + pugi::xml_node bias_node = node.child("bias"); + + if (check_for_node(bias_node, "bias")) { + openmc::fatal_error( + "Distribution has a bias distribution with its own bias distribution. " + "Please ensure bias distributions do not have their own bias."); + } + + UPtrDist bias = distribution_from_xml(bias_node); + this->set_bias(std::move(bias)); + } +} + //============================================================================== // DiscreteIndex implementation //============================================================================== @@ -36,7 +105,6 @@ DiscreteIndex::DiscreteIndex(span p) void DiscreteIndex::assign(span p) { prob_.assign(p.begin(), p.end()); - this->init_alias(); } @@ -115,24 +183,55 @@ void DiscreteIndex::normalize() // Discrete implementation //============================================================================== -Discrete::Discrete(pugi::xml_node node) : di_(node) +Discrete::Discrete(pugi::xml_node node) { auto params = get_node_array(node, "parameters"); - std::size_t n = params.size() / 2; + // First half is x values, second half is probabilities x_.assign(params.begin(), params.begin() + n); + const double* p = params.data() + n; + + // Check for bias + if (check_for_node(node, "bias")) { + // Get bias probabilities + auto bias_params = get_node_array(node, "bias"); + if (bias_params.size() != n) { + openmc::fatal_error( + "Size mismatch: Attempted to bias Discrete distribution with " + + std::to_string(n) + " probability entries using a bias with " + + std::to_string(bias_params.size()) + + " entries. Please ensure distributions have the same size."); + } + + // Compute importance weights + vector p_vec(p, p + n); + weight_ = compute_importance_weights(p_vec, bias_params); + + // Initialize DiscreteIndex with bias probabilities for sampling + di_.assign(bias_params); + } else { + // Unbiased case: weight_ stays empty + di_.assign({p, n}); + } } Discrete::Discrete(const double* x, const double* p, size_t n) : di_({p, n}) { - x_.assign(x, x + n); } -double Discrete::sample(uint64_t* seed) const +std::pair Discrete::sample(uint64_t* seed) const { - return x_[di_.sample(seed)]; + size_t idx = di_.sample(seed); + double wgt = weight_.empty() ? 1.0 : weight_[idx]; + return {x_[idx], wgt}; +} + +double Discrete::sample_unbiased(uint64_t* seed) const +{ + size_t idx = di_.sample(seed); + return x_[idx]; } //============================================================================== @@ -149,13 +248,26 @@ Uniform::Uniform(pugi::xml_node node) a_ = params.at(0); b_ = params.at(1); + + read_bias_from_xml(node); } -double Uniform::sample(uint64_t* seed) const +double Uniform::sample_unbiased(uint64_t* seed) const { return a_ + prn(seed) * (b_ - a_); } +double Uniform::evaluate(double x) const +{ + if (x <= a()) { + return 0.0; + } else if (x >= b()) { + return 0.0; + } else { + return 1 / (b() - a()); + } +} + //============================================================================== // PowerLaw implementation //============================================================================== @@ -175,9 +287,24 @@ PowerLaw::PowerLaw(pugi::xml_node node) offset_ = std::pow(a, n + 1); span_ = std::pow(b, n + 1) - offset_; ninv_ = 1 / (n + 1); + + read_bias_from_xml(node); } -double PowerLaw::sample(uint64_t* seed) const +double PowerLaw::evaluate(double x) const +{ + if (x <= a()) { + return 0.0; + } else if (x >= b()) { + return 0.0; + } else { + int pwr = n() + 1; + double norm = pwr / span_; + return norm * std::pow(std::fabs(x), n()); + } +} + +double PowerLaw::sample_unbiased(uint64_t* seed) const { return std::pow(offset_ + prn(seed) * span_, ninv_); } @@ -189,13 +316,21 @@ double PowerLaw::sample(uint64_t* seed) const Maxwell::Maxwell(pugi::xml_node node) { theta_ = std::stod(get_node_value(node, "parameters")); + + read_bias_from_xml(node); } -double Maxwell::sample(uint64_t* seed) const +double Maxwell::sample_unbiased(uint64_t* seed) const { return maxwell_spectrum(theta_, seed); } +double Maxwell::evaluate(double x) const +{ + double c = (2.0 / SQRT_PI) * std::pow(theta_, -1.5); + return c * std::sqrt(x) * std::exp(-x / theta_); +} + //============================================================================== // Watt implementation //============================================================================== @@ -209,13 +344,22 @@ Watt::Watt(pugi::xml_node node) a_ = params.at(0); b_ = params.at(1); + + read_bias_from_xml(node); } -double Watt::sample(uint64_t* seed) const +double Watt::sample_unbiased(uint64_t* seed) const { return watt_spectrum(a_, b_, seed); } +double Watt::evaluate(double x) const +{ + double c = + 2.0 / (std::sqrt(PI * b_) * std::pow(a_, 1.5) * std::exp(a_ * b_ / 4.0)); + return c * std::exp(-x / a_) * std::sinh(std::sqrt(b_ * x)); +} + //============================================================================== // Normal implementation //============================================================================== @@ -229,13 +373,22 @@ Normal::Normal(pugi::xml_node node) mean_value_ = params.at(0); std_dev_ = params.at(1); + + read_bias_from_xml(node); } -double Normal::sample(uint64_t* seed) const +double Normal::sample_unbiased(uint64_t* seed) const { return normal_variate(mean_value_, std_dev_, seed); } +double Normal::evaluate(double x) const +{ + return (1.0 / (std::sqrt(2.0 / PI) * std_dev_)) * + std::exp(-(std::pow((x - mean_value_), 2.0)) / + (2.0 * std::pow(std_dev_, 2.0))); +} + //============================================================================== // Tabular implementation //============================================================================== @@ -266,6 +419,8 @@ Tabular::Tabular(pugi::xml_node node) const double* x = params.data(); const double* p = x + n; init(x, p, n); + + read_bias_from_xml(node); } Tabular::Tabular(const double* x, const double* p, int n, Interpolation interp, @@ -314,7 +469,7 @@ void Tabular::init( } } -double Tabular::sample(uint64_t* seed) const +double Tabular::sample_unbiased(uint64_t* seed) const { // Sample value of CDF double c = prn(seed); @@ -356,11 +511,39 @@ double Tabular::sample(uint64_t* seed) const } } +double Tabular::evaluate(double x) const +{ + int i; + + if (interp_ == Interpolation::histogram) { + i = std::upper_bound(x_.begin(), x_.end(), x) - x_.begin() - 1; + if (i < 0 || i >= static_cast(p_.size())) { + return 0.0; + } else { + return p_[i]; + } + } else { + i = std::lower_bound(x_.begin(), x_.end(), x) - x_.begin() - 1; + + if (i < 0 || i >= static_cast(p_.size()) - 1) { + return 0.0; + } else { + double x0 = x_[i]; + double x1 = x_[i + 1]; + double p0 = p_[i]; + double p1 = p_[i + 1]; + + double t = (x - x0) / (x1 - x0); + return (1 - t) * p0 + t * p1; + } + } +} + //============================================================================== // Equiprobable implementation //============================================================================== -double Equiprobable::sample(uint64_t* seed) const +double Equiprobable::sample_unbiased(uint64_t* seed) const { std::size_t n = x_.size(); @@ -372,13 +555,27 @@ double Equiprobable::sample(uint64_t* seed) const return xl + ((n - 1) * r - i) * (xr - xl); } +double Equiprobable::evaluate(double x) const +{ + double x_min = *std::min_element(x_.begin(), x_.end()); + double x_max = *std::max_element(x_.begin(), x_.end()); + + if (x < x_min || x > x_max) { + return 0.0; + } else { + return 1.0 / (x_max - x_min); + } +} + //============================================================================== // Mixture implementation //============================================================================== Mixture::Mixture(pugi::xml_node node) { - double cumsum = 0.0; + vector probabilities; + + // First pass: collect distributions and their probabilities for (pugi::xml_node pair : node.children("pair")) { // Check that required data exists if (!pair.attribute("probability")) @@ -386,39 +583,60 @@ Mixture::Mixture(pugi::xml_node node) if (!pair.child("dist")) fatal_error("Mixture pair element does not have a distribution."); - // cummulative sum of probabilities + // Get probability and distribution double p = std::stod(pair.attribute("probability").value()); - - // Save cummulative probability and distribution auto dist = distribution_from_xml(pair.child("dist")); - cumsum += p * dist->integral(); - distribution_.push_back(std::make_pair(cumsum, std::move(dist))); + // Weight probability by the distribution's integral + double weighted_prob = p * dist->integral(); + probabilities.push_back(weighted_prob); + distribution_.push_back(std::move(dist)); } - // Save integral of distribution - integral_ = cumsum; + // Save sum of weighted probabilities + integral_ = std::accumulate(probabilities.begin(), probabilities.end(), 0.0); - // Normalize cummulative probabilities to 1 - for (auto& pair : distribution_) { - pair.first /= cumsum; + std::size_t n = probabilities.size(); + + // Check for bias + if (check_for_node(node, "bias")) { + // Get bias probabilities + auto bias_params = get_node_array(node, "bias"); + if (bias_params.size() != n) { + openmc::fatal_error( + "Size mismatch: Attempted to bias Mixture distribution with " + + std::to_string(n) + " components using a bias with " + + std::to_string(bias_params.size()) + + " entries. Please ensure distributions have the same size."); + } + + // Compute importance weights + weight_ = compute_importance_weights(probabilities, bias_params); + + // Initialize DiscreteIndex with bias probabilities for sampling + di_.assign(bias_params); + } else { + // Unbiased case: weight_ stays empty + di_.assign(probabilities); } } -double Mixture::sample(uint64_t* seed) const +std::pair Mixture::sample(uint64_t* seed) const { - // Sample value of CDF - const double p = prn(seed); - - // find matching distribution - const auto it = std::lower_bound(distribution_.cbegin(), distribution_.cend(), - p, [](const DistPair& pair, double p) { return pair.first < p; }); - - // This should not happen. Catch it - assert(it != distribution_.cend()); + size_t idx = di_.sample(seed); // Sample the chosen distribution - return it->second->sample(seed); + auto [val, sub_wgt] = distribution_[idx]->sample(seed); + + // Multiply by component selection weight + double mix_wgt = weight_.empty() ? 1.0 : weight_[idx]; + return {val, mix_wgt * sub_wgt}; +} + +double Mixture::sample_unbiased(uint64_t* seed) const +{ + size_t idx = di_.sample(seed); + return distribution_[idx]->sample(seed).first; } //============================================================================== diff --git a/src/distribution_angle.cpp b/src/distribution_angle.cpp index 5e92b794a..50f1aca11 100644 --- a/src/distribution_angle.cpp +++ b/src/distribution_angle.cpp @@ -7,6 +7,7 @@ #include "openmc/endf.h" #include "openmc/hdf5_interface.h" +#include "openmc/math_functions.h" #include "openmc/random_lcg.h" #include "openmc/search.h" #include "openmc/vector.h" // for vector @@ -64,30 +65,17 @@ AngleDistribution::AngleDistribution(hid_t group) double AngleDistribution::sample(double E, uint64_t* seed) const { - // Determine number of incoming energies - auto n = energy_.size(); - - // Find energy bin and calculate interpolation factor -- if the energy is - // outside the range of the tabulated energies, choose the first or last bins + // Find energy bin and calculate interpolation factor int i; double r; - if (E < energy_[0]) { - i = 0; - r = 0.0; - } else if (E > energy_[n - 1]) { - i = n - 2; - r = 1.0; - } else { - i = lower_bound_index(energy_.begin(), energy_.end(), E); - r = (E - energy_[i]) / (energy_[i + 1] - energy_[i]); - } + get_energy_index(energy_, E, i, r); // Sample between the ith and (i+1)th bin if (r > prn(seed)) ++i; // Sample i-th distribution - double mu = distribution_[i]->sample(seed); + double mu = distribution_[i]->sample(seed).first; // Make sure mu is in range [-1,1] and return if (std::abs(mu) > 1.0) diff --git a/src/distribution_multi.cpp b/src/distribution_multi.cpp index b7b3efe52..857e1c30b 100644 --- a/src/distribution_multi.cpp +++ b/src/distribution_multi.cpp @@ -20,7 +20,7 @@ unique_ptr UnitSphereDistribution::create( if (check_for_node(node, "type")) type = get_node_value(node, "type", true, true); if (type == "isotropic") { - return UPtrAngle {new Isotropic()}; + return UPtrAngle {new Isotropic(node)}; } else if (type == "monodirectional") { return UPtrAngle {new Monodirectional(node)}; } else if (type == "mu-phi") { @@ -58,6 +58,15 @@ PolarAzimuthal::PolarAzimuthal(Direction u, UPtrDist mu, UPtrDist phi) PolarAzimuthal::PolarAzimuthal(pugi::xml_node node) : UnitSphereDistribution {node} { + // Read reference directional unit vector + if (check_for_node(node, "reference_vwu")) { + auto v_ref = get_node_array(node, "reference_vwu"); + if (v_ref.size() != 3) + fatal_error("Angular distribution reference v direction must have " + "three parameters specified."); + v_ref_ = Direction(v_ref.data()); + } + w_ref_ = u_ref_.cross(v_ref_); if (check_for_node(node, "mu")) { pugi::xml_node node_dist = node.child("mu"); mu_ = distribution_from_xml(node_dist); @@ -73,23 +82,63 @@ PolarAzimuthal::PolarAzimuthal(pugi::xml_node node) } } -Direction PolarAzimuthal::sample(uint64_t* seed) const +std::pair PolarAzimuthal::sample(uint64_t* seed) const +{ + return sample_impl(seed, false); +} + +std::pair PolarAzimuthal::sample_as_bias( + uint64_t* seed) const +{ + return sample_impl(seed, true); +} + +std::pair PolarAzimuthal::sample_impl( + uint64_t* seed, bool return_pdf) const { // Sample cosine of polar angle - double mu = mu_->sample(seed); - if (mu == 1.0) - return u_ref_; + auto [mu, mu_wgt] = mu_->sample(seed); // Sample azimuthal angle - double phi = phi_->sample(seed); + auto [phi, phi_wgt] = phi_->sample(seed); - return rotate_angle(u_ref_, mu, &phi, seed); + // Compute either the PDF value or the importance weight + double weight = + return_pdf ? (mu_->evaluate(mu) * phi_->evaluate(phi)) : (mu_wgt * phi_wgt); + + if (mu == 1.0) + return {u_ref_, weight}; + if (mu == -1.0) + return {-u_ref_, weight}; + + double f = std::sqrt(1 - mu * mu); + return {mu * u_ref_ + f * std::cos(phi) * v_ref_ + f * std::sin(phi) * w_ref_, + weight}; } //============================================================================== // Isotropic implementation //============================================================================== +Isotropic::Isotropic(pugi::xml_node node) : UnitSphereDistribution {node} +{ + if (check_for_node(node, "bias")) { + pugi::xml_node bias_node = node.child("bias"); + std::string bias_type = get_node_value(bias_node, "type", true, true); + if (bias_type != "mu-phi") { + openmc::fatal_error( + "Isotropic distributions may only be biased by a PolarAzimuthal."); + } + auto bias = std::make_unique(bias_node); + if (bias->mu()->bias() || bias->phi()->bias()) { + openmc::fatal_error( + "Attempted to bias Isotropic distribution with a biased PolarAzimuthal " + "distribution. Please ensure bias distributions are unbiased."); + } + this->set_bias(std::move(bias)); + } +} + Direction isotropic_direction(uint64_t* seed) { double phi = uniform_distribution(0., 2.0 * PI, seed); @@ -98,18 +147,23 @@ Direction isotropic_direction(uint64_t* seed) std::sqrt(1.0 - mu * mu) * std::sin(phi)}; } -Direction Isotropic::sample(uint64_t* seed) const +std::pair Isotropic::sample(uint64_t* seed) const { - return isotropic_direction(seed); + if (bias()) { + auto [val, eval] = bias()->sample_as_bias(seed); + return {val, 1.0 / (4.0 * PI * eval)}; + } else { + return {isotropic_direction(seed), 1.0}; + } } //============================================================================== // Monodirectional implementation //============================================================================== -Direction Monodirectional::sample(uint64_t* seed) const +std::pair Monodirectional::sample(uint64_t* seed) const { - return u_ref_; + return {u_ref_, 1.0}; } } // namespace openmc diff --git a/src/distribution_spatial.cpp b/src/distribution_spatial.cpp index d2b0f413b..80f8f7de1 100644 --- a/src/distribution_spatial.cpp +++ b/src/distribution_spatial.cpp @@ -80,9 +80,13 @@ CartesianIndependent::CartesianIndependent(pugi::xml_node node) } } -Position CartesianIndependent::sample(uint64_t* seed) const +std::pair CartesianIndependent::sample(uint64_t* seed) const { - return {x_->sample(seed), y_->sample(seed), z_->sample(seed)}; + auto [x_val, x_wgt] = x_->sample(seed); + auto [y_val, y_wgt] = y_->sample(seed); + auto [z_val, z_wgt] = z_->sample(seed); + Position xi {x_val, y_val, z_val}; + return {xi, x_wgt * y_wgt * z_wgt}; } //============================================================================== @@ -139,14 +143,16 @@ CylindricalIndependent::CylindricalIndependent(pugi::xml_node node) } } -Position CylindricalIndependent::sample(uint64_t* seed) const +std::pair CylindricalIndependent::sample(uint64_t* seed) const { - double r = r_->sample(seed); - double phi = phi_->sample(seed); + auto [r, r_wgt] = r_->sample(seed); + auto [phi, phi_wgt] = phi_->sample(seed); + auto [z, z_wgt] = z_->sample(seed); double x = r * cos(phi) + origin_.x; double y = r * sin(phi) + origin_.y; - double z = z_->sample(seed) + origin_.z; - return {x, y, z}; + z += origin_.z; + Position xi {x, y, z}; + return {xi, r_wgt * phi_wgt * z_wgt}; } //============================================================================== @@ -203,16 +209,17 @@ SphericalIndependent::SphericalIndependent(pugi::xml_node node) } } -Position SphericalIndependent::sample(uint64_t* seed) const +std::pair SphericalIndependent::sample(uint64_t* seed) const { - double r = r_->sample(seed); - double cos_theta = cos_theta_->sample(seed); - double phi = phi_->sample(seed); + auto [r, r_wgt] = r_->sample(seed); + auto [cos_theta, cos_theta_wgt] = cos_theta_->sample(seed); + auto [phi, phi_wgt] = phi_->sample(seed); // sin(theta) by sin**2 + cos**2 = 1 double x = r * std::sqrt(1 - cos_theta * cos_theta) * cos(phi) + origin_.x; double y = r * std::sqrt(1 - cos_theta * cos_theta) * sin(phi) + origin_.y; double z = r * cos_theta + origin_.z; - return {x, y, z}; + Position xi {x, y, z}; + return {xi, r_wgt * cos_theta_wgt * phi_wgt}; } //============================================================================== @@ -260,6 +267,37 @@ MeshSpatial::MeshSpatial(pugi::xml_node node) } elem_idx_dist_.assign(strengths); + + if (check_for_node(node, "bias")) { + pugi::xml_node bias_node = node.child("bias"); + + if (check_for_node(bias_node, "strengths")) { + std::vector bias_strengths(n_bins, 1.0); + bias_strengths = get_node_array(node, "strengths"); + + if (bias_strengths.size() != n_bins) { + fatal_error( + fmt::format("Number of entries in the bias strengths array {} does " + "not match the number of entities in mesh {} ({}).", + bias_strengths.size(), mesh_id, n_bins)); + } + + if (get_node_value_bool(node, "volume_normalized")) { + for (int i = 0; i < n_bins; i++) { + bias_strengths[i] *= this->mesh()->volume(i); + } + } + + // Compute importance weights + weight_ = compute_importance_weights(strengths, bias_strengths); + + // Re-initialize DiscreteIndex with bias strengths for sampling + elem_idx_dist_.assign(bias_strengths); + } else { + fatal_error(fmt::format( + "Bias node for mesh {} found without strengths array.", mesh_id)); + } + } } MeshSpatial::MeshSpatial(int32_t mesh_idx, span strengths) @@ -295,9 +333,11 @@ std::pair MeshSpatial::sample_mesh(uint64_t* seed) const return {elem_idx, mesh()->sample_element(elem_idx, seed)}; } -Position MeshSpatial::sample(uint64_t* seed) const +std::pair MeshSpatial::sample(uint64_t* seed) const { - return this->sample_mesh(seed).second; + auto [elem_idx, u] = this->sample_mesh(seed); + double wgt = weight_.empty() ? 1.0 : weight_[elem_idx]; + return {u, wgt}; } //============================================================================== @@ -328,6 +368,31 @@ PointCloud::PointCloud(pugi::xml_node node) } point_idx_dist_.assign(strengths); + + if (check_for_node(node, "bias")) { + pugi::xml_node bias_node = node.child("bias"); + + if (check_for_node(bias_node, "strengths")) { + std::vector bias_strengths(point_cloud_.size(), 1.0); + bias_strengths = get_node_array(node, "strengths"); + + if (bias_strengths.size() != point_cloud_.size()) { + fatal_error( + fmt::format("Number of entries in the bias strengths array {} does " + "not match the number of spatial points provided {}.", + bias_strengths.size(), point_cloud_.size())); + } + + // Compute importance weights + weight_ = compute_importance_weights(strengths, bias_strengths); + + // Re-initialize DiscreteIndex with bias strengths for sampling + point_idx_dist_.assign(bias_strengths); + } else { + fatal_error( + fmt::format("Bias node for PointCloud found without strengths array.")); + } + } } PointCloud::PointCloud( @@ -337,10 +402,11 @@ PointCloud::PointCloud( point_idx_dist_.assign(strengths); } -Position PointCloud::sample(uint64_t* seed) const +std::pair PointCloud::sample(uint64_t* seed) const { int32_t index = point_idx_dist_.sample(seed); - return point_cloud_[index]; + double wgt = weight_.empty() ? 1.0 : weight_[index]; + return {point_cloud_[index], wgt}; } //============================================================================== @@ -360,10 +426,10 @@ SpatialBox::SpatialBox(pugi::xml_node node, bool fission) upper_right_ = Position {params[3], params[4], params[5]}; } -Position SpatialBox::sample(uint64_t* seed) const +std::pair SpatialBox::sample(uint64_t* seed) const { Position xi {prn(seed), prn(seed), prn(seed)}; - return lower_left_ + xi * (upper_right_ - lower_left_); + return {lower_left_ + xi * (upper_right_ - lower_left_), 1.0}; } //============================================================================== @@ -382,9 +448,9 @@ SpatialPoint::SpatialPoint(pugi::xml_node node) r_ = Position {params.data()}; } -Position SpatialPoint::sample(uint64_t* seed) const +std::pair SpatialPoint::sample(uint64_t* seed) const { - return r_; + return {r_, 1.0}; } } // namespace openmc diff --git a/src/eigenvalue.cpp b/src/eigenvalue.cpp index 8669d76f9..8412cbd3b 100644 --- a/src/eigenvalue.cpp +++ b/src/eigenvalue.cpp @@ -11,6 +11,7 @@ #include "openmc/constants.h" #include "openmc/error.h" #include "openmc/hdf5_interface.h" +#include "openmc/ifp.h" #include "openmc/math_functions.h" #include "openmc/mesh.h" #include "openmc/message_passing.h" @@ -126,54 +127,54 @@ void synchronize_bank() "No fission sites banked on MPI rank " + std::to_string(mpi::rank)); } - // Make sure all processors start at the same point for random sampling. Then - // skip ahead in the sequence using the starting index in the 'global' - // fission bank for each processor. - - int64_t id = simulation::total_gen + overall_generation(); - uint64_t seed = init_seed(id, STREAM_TRACKING); - advance_prn_seed(start, &seed); - - // Determine how many fission sites we need to sample from the source bank - // and the probability for selecting a site. - - int64_t sites_needed; - if (total < settings::n_particles) { - sites_needed = settings::n_particles % total; - } else { - sites_needed = settings::n_particles; - } - double p_sample = static_cast(sites_needed) / total; - simulation::time_bank_sample.start(); - // ========================================================================== - // SAMPLE N_PARTICLES FROM FISSION BANK AND PLACE IN TEMP_SITES - // Allocate temporary source bank -- we don't really know how many fission // sites were created, so overallocate by a factor of 3 int64_t index_temp = 0; + vector temp_sites(3 * simulation::work_per_rank); - for (int64_t i = 0; i < simulation::fission_bank.size(); i++) { - const auto& site = simulation::fission_bank[i]; + // Temporary banks for IFP + vector> temp_delayed_groups; + vector> temp_lifetimes; + if (settings::ifp_on) { + resize_ifp_data( + temp_delayed_groups, temp_lifetimes, 3 * simulation::work_per_rank); + } - // If there are less than n_particles particles banked, automatically add - // int(n_particles/total) sites to temp_sites. For example, if you need - // 1000 and 300 were banked, this would add 3 source sites per banked site - // and the remaining 100 would be randomly sampled. - if (total < settings::n_particles) { - for (int64_t j = 1; j <= settings::n_particles / total; ++j) { - temp_sites[index_temp] = site; - ++index_temp; - } - } + // ========================================================================== + // SAMPLE N_PARTICLES FROM FISSION BANK AND PLACE IN TEMP_SITES - // Randomly sample sites needed - if (prn(&seed) < p_sample) { - temp_sites[index_temp] = site; - ++index_temp; + // We use Uniform Combing method to exactly get the targeted particle size + // [https://doi.org/10.1080/00295639.2022.2091906] + + // Make sure all processors use the same random number seed. + int64_t id = simulation::total_gen + overall_generation(); + uint64_t seed = init_seed(id, STREAM_TRACKING); + + // Comb specification + double teeth_distance = static_cast(total) / settings::n_particles; + double teeth_offset = prn(&seed) * teeth_distance; + + // First and last hitting tooth + int64_t end = start + simulation::fission_bank.size(); + int64_t tooth_start = std::ceil((start - teeth_offset) / teeth_distance); + int64_t tooth_end = std::floor((end - teeth_offset) / teeth_distance) + 1; + + // Locally comb particles in fission_bank + double tooth = tooth_start * teeth_distance + teeth_offset; + for (int64_t i = tooth_start; i < tooth_end; i++) { + int64_t idx = std::floor(tooth) - start; + temp_sites[index_temp] = simulation::fission_bank[idx]; + if (settings::ifp_on) { + copy_ifp_data_from_fission_banks( + idx, temp_delayed_groups[index_temp], temp_lifetimes[index_temp]); } + ++index_temp; + + // Next tooth + tooth += teeth_distance; } // At this point, the sampling of source sites is done and now we need to @@ -188,6 +189,8 @@ void synchronize_bank() MPI_Exscan(&index_temp, &start, 1, MPI_INT64_T, MPI_SUM, mpi::intracomm); finish = start + index_temp; + // TODO: protect for MPI_Exscan at rank 0 + // Allocate space for bank_position if this hasn't been done yet int64_t bank_position[mpi::n_procs]; MPI_Allgather( @@ -197,31 +200,6 @@ void synchronize_bank() finish = index_temp; #endif - // Now that the sampling is complete, we need to ensure that we have exactly - // n_particles source sites. The way this is done in a reproducible manner is - // to adjust only the source sites on the last processor. - - if (mpi::rank == mpi::n_procs - 1) { - if (finish > settings::n_particles) { - // If we have extra sites sampled, we will simply discard the extra - // ones on the last processor - index_temp = settings::n_particles - start; - - } else if (finish < settings::n_particles) { - // If we have too few sites, repeat sites from the very end of the - // fission bank - sites_needed = settings::n_particles - finish; - for (int i = 0; i < sites_needed; ++i) { - int i_bank = simulation::fission_bank.size() - sites_needed + i; - temp_sites[index_temp] = simulation::fission_bank[i_bank]; - ++index_temp; - } - } - - // the last processor should not be sending sites to right - finish = simulation::work_index[mpi::rank + 1]; - } - simulation::time_bank_sample.stop(); simulation::time_bank_sendrecv.start(); @@ -229,15 +207,32 @@ void synchronize_bank() // ========================================================================== // SEND BANK SITES TO NEIGHBORS + // IFP number of generation + int ifp_n_generation; + if (settings::ifp_on) { + broadcast_ifp_n_generation( + ifp_n_generation, temp_delayed_groups, temp_lifetimes); + } + int64_t index_local = 0; vector requests; + // IFP send buffers + vector send_delayed_groups; + vector send_lifetimes; + if (start < settings::n_particles) { // Determine the index of the processor which has the first part of the // source_bank for the local processor int neighbor = upper_bound_index( simulation::work_index.begin(), simulation::work_index.end(), start); + // Resize IFP send buffers + if (settings::ifp_on && mpi::n_procs > 1) { + resize_ifp_data(send_delayed_groups, send_lifetimes, + ifp_n_generation * 3 * simulation::work_per_rank); + } + while (start < finish) { // Determine the number of sites to send int64_t n = @@ -250,6 +245,13 @@ void synchronize_bank() MPI_Isend(&temp_sites[index_local], static_cast(n), mpi::source_site, neighbor, mpi::rank, mpi::intracomm, &requests.back()); + + if (settings::ifp_on) { + // Send IFP data + send_ifp_info(index_local, n, ifp_n_generation, neighbor, requests, + temp_delayed_groups, send_delayed_groups, temp_lifetimes, + send_lifetimes); + } } // Increment all indices @@ -271,6 +273,11 @@ void synchronize_bank() start = simulation::work_index[mpi::rank]; index_local = 0; + // IFP receive buffers + vector recv_delayed_groups; + vector recv_lifetimes; + vector deserialization_info; + // Determine what process has the source sites that will need to be stored at // the beginning of this processor's source bank. @@ -282,6 +289,12 @@ void synchronize_bank() upper_bound_index(bank_position, bank_position + mpi::n_procs, start); } + // Resize IFP receive buffers + if (settings::ifp_on && mpi::n_procs > 1) { + resize_ifp_data(recv_delayed_groups, recv_lifetimes, + ifp_n_generation * simulation::work_per_rank); + } + while (start < simulation::work_index[mpi::rank + 1]) { // Determine how many sites need to be received int64_t n; @@ -301,13 +314,24 @@ void synchronize_bank() MPI_Irecv(&simulation::source_bank[index_local], static_cast(n), mpi::source_site, neighbor, neighbor, mpi::intracomm, &requests.back()); + if (settings::ifp_on) { + // Receive IFP data + receive_ifp_data(index_local, n, ifp_n_generation, neighbor, requests, + recv_delayed_groups, recv_lifetimes, deserialization_info); + } + } else { - // If the source sites are on this procesor, we can simply copy them + // If the source sites are on this processor, we can simply copy them // from the temp_sites bank index_temp = start - bank_position[mpi::rank]; std::copy(&temp_sites[index_temp], &temp_sites[index_temp + n], &simulation::source_bank[index_local]); + + if (settings::ifp_on) { + copy_partial_ifp_data_to_source_banks( + index_temp, n, index_local, temp_delayed_groups, temp_lifetimes); + } } // Increment all indices @@ -323,9 +347,17 @@ void synchronize_bank() int n_request = requests.size(); MPI_Waitall(n_request, requests.data(), MPI_STATUSES_IGNORE); + if (settings::ifp_on) { + deserialize_ifp_info(ifp_n_generation, deserialization_info, + recv_delayed_groups, recv_lifetimes); + } + #else std::copy(temp_sites.data(), temp_sites.data() + settings::n_particles, simulation::source_bank.begin()); + if (settings::ifp_on) { + copy_complete_ifp_data_to_source_banks(temp_delayed_groups, temp_lifetimes); + } #endif simulation::time_bank_sendrecv.stop(); @@ -371,6 +403,16 @@ void calculate_average_keff() t_value * std::sqrt( (simulation::k_sum[1] / n - std::pow(simulation::keff, 2)) / (n - 1)); + + // In some cases (such as an infinite medium problem), random ray + // may estimate k exactly and in an unvarying manner between iterations. + // In this case, the floating point roundoff between the division and the + // power operations may cause an extremely small negative value to occur + // inside the sqrt operation, leading to NaN. If this occurs, we check for + // it and set the std dev to zero. + if (!std::isfinite(simulation::keff_std)) { + simulation::keff_std = 0.0; + } } } } diff --git a/src/error.cpp b/src/error.cpp index 566950a97..f99f5935f 100644 --- a/src/error.cpp +++ b/src/error.cpp @@ -110,23 +110,26 @@ void write_message(const std::string& message, int level) void fatal_error(const std::string& message, int err) { +#pragma omp critical(FatalError) + { #ifdef _POSIX_VERSION - // Make output red if user is in a terminal - if (isatty(STDERR_FILENO)) { - std::cerr << "\033[0;31m"; - } + // Make output red if user is in a terminal + if (isatty(STDERR_FILENO)) { + std::cerr << "\033[0;31m"; + } #endif - // Write error message - std::cerr << " ERROR: "; - output(message, std::cerr, 8); + // Write error message + std::cerr << " ERROR: "; + output(message, std::cerr, 8); #ifdef _POSIX_VERSION - // Reset color for terminal - if (isatty(STDERR_FILENO)) { - std::cerr << "\033[0m"; - } + // Reset color for terminal + if (isatty(STDERR_FILENO)) { + std::cerr << "\033[0m"; + } #endif + } #ifdef OPENMC_MPI MPI_Abort(mpi::intracomm, err); diff --git a/src/event.cpp b/src/event.cpp index ae914c8be..f33e132d0 100644 --- a/src/event.cpp +++ b/src/event.cpp @@ -1,4 +1,5 @@ #include "openmc/event.h" + #include "openmc/material.h" #include "openmc/simulation.h" #include "openmc/timer.h" @@ -73,17 +74,17 @@ void process_calculate_xs_events(SharedArray& queue) { simulation::time_event_calculate_xs.start(); - // TODO: If using C++17, perform a parallel sort of the queue - // by particle type, material type, and then energy, in order to - // improve cache locality and reduce thread divergence on GPU. Prior - // to C++17, std::sort is a serial only operation, which in this case - // makes it too slow to be practical for most test problems. + // TODO: If using C++17, we could perform a parallel sort of the queue by + // particle type, material type, and then energy, in order to improve cache + // locality and reduce thread divergence on GPU. However, the parallel + // algorithms typically require linking against an additional library (Intel + // TBB). Prior to C++17, std::sort is a serial only operation, which in this + // case makes it too slow to be practical for most test problems. // // std::sort(std::execution::par_unseq, queue.data(), queue.data() + // queue.size()); int64_t offset = simulation::advance_particle_queue.size(); - ; #pragma omp parallel for schedule(runtime) for (int64_t i = 0; i < queue.size(); i++) { @@ -114,7 +115,7 @@ void process_advance_particle_events() p.event_advance(); if (!p.alive()) continue; - if (p.collision_distance() > p.boundary().distance) { + if (p.collision_distance() > p.boundary().distance()) { simulation::surface_crossing_queue.thread_safe_append({p, buffer_idx}); } else { simulation::collision_queue.thread_safe_append({p, buffer_idx}); diff --git a/src/finalize.cpp b/src/finalize.cpp index ed3d0e7f4..344eaa1a0 100644 --- a/src/finalize.cpp +++ b/src/finalize.cpp @@ -3,6 +3,7 @@ #include "openmc/bank.h" #include "openmc/capi.h" #include "openmc/cmfd_solver.h" +#include "openmc/collision_track.h" #include "openmc/constants.h" #include "openmc/cross_sections.h" #include "openmc/dagmc.h" @@ -76,6 +77,7 @@ int openmc_finalize() // Reset global variables settings::assume_separate = false; settings::check_overlaps = false; + settings::collision_track_config = CollisionTrackConfig {}; settings::confidence_intervals = false; settings::create_fission_neutrons = true; settings::create_delayed_neutrons = true; @@ -85,6 +87,7 @@ int openmc_finalize() settings::time_cutoff = {INFTY, INFTY, INFTY, INFTY}; settings::entropy_on = false; settings::event_based = false; + settings::free_gas_threshold = 400.0; settings::gen_per_batch = 1; settings::legendre_to_tabular = true; settings::legendre_to_tabular_points = -1; @@ -92,6 +95,7 @@ int openmc_finalize() settings::max_lost_particles = 10; settings::max_order = 0; settings::max_particles_in_flight = 100000; + settings::max_secondaries = 10000; settings::max_particle_events = 1'000'000; settings::max_history_splits = 10'000'000; settings::max_tracks = 1000; @@ -119,6 +123,7 @@ int openmc_finalize() settings::run_CE = true; settings::run_mode = RunMode::UNSET; settings::source_latest = false; + settings::source_rejection_fraction = 0.05; settings::source_separate = false; settings::source_write = true; settings::ssw_cell_id = C_NONE; @@ -137,7 +142,7 @@ int openmc_finalize() settings::uniform_source_sampling = false; settings::ufs_on = false; settings::urr_ptables_on = true; - settings::verbosity = 7; + settings::verbosity = -1; settings::weight_cutoff = 0.25; settings::weight_survive = 1.0; settings::weight_windows_file.clear(); @@ -153,8 +158,8 @@ int openmc_finalize() simulation::entropy_mesh = nullptr; simulation::ufs_mesh = nullptr; - data::energy_max = {INFTY, INFTY}; - data::energy_min = {0.0, 0.0}; + data::energy_max = {INFTY, INFTY, INFTY, INFTY}; + data::energy_min = {0.0, 0.0, 0.0, 0.0}; data::temperature_min = 0.0; data::temperature_max = INFTY; model::root_universe = -1; @@ -165,14 +170,18 @@ int openmc_finalize() // Deallocate arrays free_memory(); -#ifdef LIBMESH +#ifdef OPENMC_LIBMESH_ENABLED settings::libmesh_init.reset(); #endif // Free all MPI types #ifdef OPENMC_MPI - if (mpi::source_site != MPI_DATATYPE_NULL) + if (mpi::source_site != MPI_DATATYPE_NULL) { MPI_Type_free(&mpi::source_site); + } + if (mpi::collision_track_site != MPI_DATATYPE_NULL) { + MPI_Type_free(&mpi::collision_track_site); + } #endif openmc_reset_random_ray(); @@ -183,7 +192,6 @@ int openmc_finalize() int openmc_reset() { - model::universe_cell_counts.clear(); model::universe_level_counts.clear(); for (auto& t : model::tallies) { diff --git a/src/geometry.cpp b/src/geometry.cpp index 9e975c00d..ddb61385f 100644 --- a/src/geometry.cpp +++ b/src/geometry.cpp @@ -38,17 +38,17 @@ bool check_cell_overlap(GeometryState& p, bool error) // Loop through each coordinate level for (int j = 0; j < n_coord; j++) { - Universe& univ = *model::universes[p.coord(j).universe]; + Universe& univ = *model::universes[p.coord(j).universe()]; // Loop through each cell on this level for (auto index_cell : univ.cells_) { Cell& c = *model::cells[index_cell]; - if (c.contains(p.coord(j).r, p.coord(j).u, p.surface())) { - if (index_cell != p.coord(j).cell) { + if (c.contains(p.coord(j).r(), p.coord(j).u(), p.surface())) { + if (index_cell != p.coord(j).cell()) { if (error) { fatal_error( fmt::format("Overlapping cells detected: {}, {} on universe {}", - c.id_, model::cells[p.coord(j).cell]->id_, univ.id_)); + c.id_, model::cells[p.coord(j).cell()]->id_, univ.id_)); } return true; } @@ -73,7 +73,7 @@ int cell_instance_at_level(const GeometryState& p, int level) } // determine the cell instance - Cell& c {*model::cells[p.coord(level).cell]}; + Cell& c {*model::cells[p.coord(level).cell()]}; // quick exit if this cell doesn't have distribcell instances if (c.distribcell_index_ == C_NONE) @@ -82,13 +82,13 @@ int cell_instance_at_level(const GeometryState& p, int level) // compute the cell's instance int instance = 0; for (int i = 0; i < level; i++) { - const auto& c_i {*model::cells[p.coord(i).cell]}; + const auto& c_i {*model::cells[p.coord(i).cell()]}; if (c_i.type_ == Fill::UNIVERSE) { instance += c_i.offset_[c.distribcell_index_]; } else if (c_i.type_ == Fill::LATTICE) { instance += c_i.offset_[c.distribcell_index_]; - auto& lat {*model::lattices[p.coord(i + 1).lattice]}; - const auto& i_xyz {p.coord(i + 1).lattice_i}; + auto& lat {*model::lattices[p.coord(i + 1).lattice()]}; + const auto& i_xyz {p.coord(i + 1).lattice_index()}; if (lat.are_valid_indices(i_xyz)) { instance += lat.offset(c.distribcell_index_, i_xyz); } @@ -111,7 +111,7 @@ bool find_cell_inner( i_cell = *it; // Make sure the search cell is in the same universe. - int i_universe = p.lowest_coord().universe; + int i_universe = p.lowest_coord().universe(); if (model::cells[i_cell]->universe_ != i_universe) continue; @@ -120,7 +120,7 @@ bool find_cell_inner( Direction u {p.u_local()}; auto surf = p.surface(); if (model::cells[i_cell]->contains(r, u, surf)) { - p.lowest_coord().cell = i_cell; + p.lowest_coord().cell() = i_cell; found = true; break; } @@ -146,7 +146,7 @@ bool find_cell_inner( // code below this conditional, we set i_cell back to C_NONE to indicate // that. if (i_cell == C_NONE) { - int i_universe = p.lowest_coord().universe; + int i_universe = p.lowest_coord().universe(); const auto& univ {model::universes[i_universe]}; found = univ->find_cell(p); } @@ -154,7 +154,7 @@ bool find_cell_inner( if (!found) { return found; } - i_cell = p.lowest_coord().cell; + i_cell = p.lowest_coord().cell(); // Announce the cell that the particle is entering. if (found && verbose) { @@ -172,11 +172,13 @@ bool find_cell_inner( p.cell_instance() = cell_instance_at_level(p, p.n_coord() - 1); } - // Set the material and temperature. + // Set the material, temperature and density multiplier. p.material_last() = p.material(); p.material() = c.material(p.cell_instance()); p.sqrtkT_last() = p.sqrtkT(); p.sqrtkT() = c.sqrtkT(p.cell_instance()); + p.density_mult_last() = p.density_mult(); + p.density_mult() = c.density_mult(p.cell_instance()); return true; @@ -186,14 +188,14 @@ bool find_cell_inner( // Set the lower coordinate level universe. auto& coord {p.coord(p.n_coord())}; - coord.universe = c.fill_; + coord.universe() = c.fill_; // Set the position and direction. - coord.r = p.r_local(); - coord.u = p.u_local(); + coord.r() = p.r_local(); + coord.u() = p.u_local(); // Apply translation. - coord.r -= c.translation_; + coord.r() -= c.translation_; // Apply rotation. if (!c.rotation_.empty()) { @@ -208,11 +210,11 @@ bool find_cell_inner( // Set the position and direction. auto& coord {p.coord(p.n_coord())}; - coord.r = p.r_local(); - coord.u = p.u_local(); + coord.r() = p.r_local(); + coord.u() = p.u_local(); // Apply translation. - coord.r -= c.translation_; + coord.r() -= c.translation_; // Apply rotation. if (!c.rotation_.empty()) { @@ -220,21 +222,21 @@ bool find_cell_inner( } // Determine lattice indices. - auto& i_xyz {coord.lattice_i}; - lat.get_indices(coord.r, coord.u, i_xyz); + auto& i_xyz {coord.lattice_index()}; + lat.get_indices(coord.r(), coord.u(), i_xyz); // Get local position in appropriate lattice cell - coord.r = lat.get_local_position(coord.r, i_xyz); + coord.r() = lat.get_local_position(coord.r(), i_xyz); // Set lattice indices. - coord.lattice = c.fill_; + coord.lattice() = c.fill_; // Set the lower coordinate level universe. if (lat.are_valid_indices(i_xyz)) { - coord.universe = lat[i_xyz]; + coord.universe() = lat[i_xyz]; } else { if (lat.outer_ != NO_OUTER_UNIVERSE) { - coord.universe = lat.outer_; + coord.universe() = lat.outer_; } else { p.mark_as_lost(fmt::format( "Particle {} left lattice {}, but it has no outer definition.", @@ -261,7 +263,7 @@ bool neighbor_list_find_cell(GeometryState& p, bool verbose) // Get the cell this particle was in previously. auto coord_lvl = p.n_coord() - 1; - auto i_cell = p.coord(coord_lvl).cell; + auto i_cell = p.coord(coord_lvl).cell(); Cell& c {*model::cells[i_cell]}; // Search for the particle in that cell's neighbor list. Return if we @@ -275,15 +277,15 @@ bool neighbor_list_find_cell(GeometryState& p, bool verbose) // neighboring cell. found = find_cell_inner(p, nullptr, verbose); if (found) - c.neighbors_.push_back(p.coord(coord_lvl).cell); + c.neighbors_.push_back(p.coord(coord_lvl).cell()); return found; } bool exhaustive_find_cell(GeometryState& p, bool verbose) { - int i_universe = p.lowest_coord().universe; + int i_universe = p.lowest_coord().universe(); if (i_universe == C_NONE) { - p.coord(0).universe = model::root_universe; + p.coord(0).universe() = model::root_universe; p.n_coord() = 1; i_universe = model::root_universe; } @@ -299,32 +301,32 @@ bool exhaustive_find_cell(GeometryState& p, bool verbose) void cross_lattice(GeometryState& p, const BoundaryInfo& boundary, bool verbose) { auto& coord {p.lowest_coord()}; - auto& lat {*model::lattices[coord.lattice]}; + auto& lat {*model::lattices[coord.lattice()]}; if (verbose) { write_message( fmt::format(" Crossing lattice {}. Current position ({},{},{}). r={}", - lat.id_, coord.lattice_i[0], coord.lattice_i[1], coord.lattice_i[2], - p.r()), + lat.id_, coord.lattice_index()[0], coord.lattice_index()[1], + coord.lattice_index()[2], p.r()), 1); } // Set the lattice indices. - coord.lattice_i[0] += boundary.lattice_translation[0]; - coord.lattice_i[1] += boundary.lattice_translation[1]; - coord.lattice_i[2] += boundary.lattice_translation[2]; + coord.lattice_index()[0] += boundary.lattice_translation()[0]; + coord.lattice_index()[1] += boundary.lattice_translation()[1]; + coord.lattice_index()[2] += boundary.lattice_translation()[2]; // Set the new coordinate position. const auto& upper_coord {p.coord(p.n_coord() - 2)}; - const auto& cell {model::cells[upper_coord.cell]}; - Position r = upper_coord.r; + const auto& cell {model::cells[upper_coord.cell()]}; + Position r = upper_coord.r(); r -= cell->translation_; if (!cell->rotation_.empty()) { r = r.rotate(cell->rotation_); } - p.r_local() = lat.get_local_position(r, coord.lattice_i); + p.r_local() = lat.get_local_position(r, coord.lattice_index()); - if (!lat.are_valid_indices(coord.lattice_i)) { + if (!lat.are_valid_indices(coord.lattice_index())) { // The particle is outside the lattice. Search for it from the base coords. p.n_coord() = 1; bool found = exhaustive_find_cell(p); @@ -337,7 +339,7 @@ void cross_lattice(GeometryState& p, const BoundaryInfo& boundary, bool verbose) } else { // Find cell in next lattice element. - p.lowest_coord().universe = lat[coord.lattice_i]; + p.lowest_coord().universe() = lat[coord.lattice_index()]; bool found = exhaustive_find_cell(p); if (!found) { @@ -367,9 +369,9 @@ BoundaryInfo distance_to_boundary(GeometryState& p) // Loop over each coordinate level. for (int i = 0; i < p.n_coord(); i++) { const auto& coord {p.coord(i)}; - const Position& r {coord.r}; - const Direction& u {coord.u}; - Cell& c {*model::cells[coord.cell]}; + const Position& r {coord.r()}; + const Direction& u {coord.u()}; + Cell& c {*model::cells[coord.cell()]}; // Find the oncoming surface in this cell and the distance to it. auto surface_distance = c.distance(r, u, p.surface(), &p); @@ -377,24 +379,24 @@ BoundaryInfo distance_to_boundary(GeometryState& p) level_surf_cross = surface_distance.second; // Find the distance to the next lattice tile crossing. - if (coord.lattice != C_NONE) { - auto& lat {*model::lattices[coord.lattice]}; + if (coord.lattice() != C_NONE) { + auto& lat {*model::lattices[coord.lattice()]}; // TODO: refactor so both lattice use the same position argument (which // also means the lat.type attribute can be removed) std::pair> lattice_distance; switch (lat.type_) { case LatticeType::rect: - lattice_distance = lat.distance(r, u, coord.lattice_i); + lattice_distance = lat.distance(r, u, coord.lattice_index()); break; case LatticeType::hex: - auto& cell_above {model::cells[p.coord(i - 1).cell]}; - Position r_hex {p.coord(i - 1).r}; + auto& cell_above {model::cells[p.coord(i - 1).cell()]}; + Position r_hex {p.coord(i - 1).r()}; r_hex -= cell_above->translation_; - if (coord.rotated) { + if (coord.rotated()) { r_hex = r_hex.rotate(cell_above->rotation_); } - r_hex.z = coord.r.z; - lattice_distance = lat.distance(r_hex, u, coord.lattice_i); + r_hex.z = coord.r().z; + lattice_distance = lat.distance(r_hex, u, coord.lattice_index()); break; } d_lat = lattice_distance.first; @@ -410,7 +412,7 @@ BoundaryInfo distance_to_boundary(GeometryState& p) // If the boundary on this coordinate level is coincident with a boundary on // a higher level then we need to make sure that the higher level boundary // is selected. This logic must consider floating point precision. - double& d = info.distance; + double& d = info.distance(); if (d_surf < d_lat - FP_COINCIDENT) { if (d == INFINITY || (d - d_surf) / d >= FP_REL_PRECISION) { // Update closest distance @@ -421,29 +423,29 @@ BoundaryInfo distance_to_boundary(GeometryState& p) // have to explicitly check which half-space the particle would be // traveling into if the surface is crossed if (c.is_simple() || d == INFTY) { - info.surface = level_surf_cross; + info.surface() = level_surf_cross; } else { Position r_hit = r + d_surf * u; Surface& surf {*model::surfaces[std::abs(level_surf_cross) - 1]}; Direction norm = surf.normal(r_hit); if (u.dot(norm) > 0) { - info.surface = std::abs(level_surf_cross); + info.surface() = std::abs(level_surf_cross); } else { - info.surface = -std::abs(level_surf_cross); + info.surface() = -std::abs(level_surf_cross); } } - info.lattice_translation[0] = 0; - info.lattice_translation[1] = 0; - info.lattice_translation[2] = 0; - info.coord_level = i + 1; + info.lattice_translation()[0] = 0; + info.lattice_translation()[1] = 0; + info.lattice_translation()[2] = 0; + info.coord_level() = i + 1; } } else { if (d == INFINITY || (d - d_lat) / d >= FP_REL_PRECISION) { d = d_lat; - info.surface = SURFACE_NONE; - info.lattice_translation = level_lat_trans; - info.coord_level = i + 1; + info.surface() = SURFACE_NONE; + info.lattice_translation() = level_lat_trans; + info.coord_level() = i + 1; } } } @@ -468,7 +470,7 @@ extern "C" int openmc_find_cell( return OPENMC_E_GEOMETRY; } - *index = geom_state.lowest_coord().cell; + *index = geom_state.lowest_coord().cell(); *instance = geom_state.cell_instance(); return 0; } @@ -478,14 +480,14 @@ extern "C" int openmc_global_bounding_box(double* llc, double* urc) auto bbox = model::universes.at(model::root_universe)->bounding_box(); // set lower left corner values - llc[0] = bbox.xmin; - llc[1] = bbox.ymin; - llc[2] = bbox.zmin; + llc[0] = bbox.min.x; + llc[1] = bbox.min.y; + llc[2] = bbox.min.z; // set upper right corner values - urc[0] = bbox.xmax; - urc[1] = bbox.ymax; - urc[2] = bbox.zmax; + urc[0] = bbox.max.x; + urc[1] = bbox.max.y; + urc[2] = bbox.max.z; return 0; } diff --git a/src/geometry_aux.cpp b/src/geometry_aux.cpp index 2f8a55743..a740740c1 100644 --- a/src/geometry_aux.cpp +++ b/src/geometry_aux.cpp @@ -25,21 +25,9 @@ namespace openmc { namespace model { -std::unordered_map> - universe_cell_counts; std::unordered_map universe_level_counts; } // namespace model -// adds the cell counts of universe b to universe a -void update_universe_cell_count(int32_t a, int32_t b) -{ - auto& universe_a_counts = model::universe_cell_counts[a]; - const auto& universe_b_counts = model::universe_cell_counts[b]; - for (const auto& it : universe_b_counts) { - universe_a_counts[it.first] += it.second; - } -} - void read_geometry_xml() { // Display output message @@ -67,8 +55,13 @@ void read_geometry_xml() void read_geometry_xml(pugi::xml_node root) { // Read surfaces, cells, lattice - read_surfaces(root); + std::set> periodic_pairs; + std::unordered_map albedo_map; + std::unordered_map periodic_sense_map; + + read_surfaces(root, periodic_pairs, albedo_map, periodic_sense_map); read_cells(root); + prepare_boundary_conditions(periodic_pairs, albedo_map, periodic_sense_map); read_lattices(root); // Check to make sure a boundary condition was applied to at least one @@ -207,6 +200,24 @@ void assign_temperatures() //============================================================================== +void finalize_cell_densities() +{ + for (auto& c : model::cells) { + // Convert to density multipliers. + if (!c->density_mult_.empty()) { + for (int32_t instance = 0; instance < c->density_mult_.size(); + ++instance) { + c->density_mult_[instance] /= + model::materials[c->material(instance)]->density_gpcc(); + } + } else { + c->density_mult_ = {1.0}; + } + } +} + +//============================================================================== + void get_temperatures( vector>& nuc_temps, vector>& thermal_temps) { @@ -263,7 +274,7 @@ void finalize_geometry() { // Perform some final operations to set up the geometry adjust_indices(); - count_cell_instances(model::root_universe); + count_universe_instances(); partition_universes(); // Assign temperatures to cells that don't have temperatures already assigned @@ -356,35 +367,49 @@ void prepare_distribcell(const std::vector* user_distribcells) Cell& c {*model::cells[i]}; if (c.material_.size() > 1) { - if (c.material_.size() != c.n_instances_) { + if (c.material_.size() != c.n_instances()) { fatal_error(fmt::format( "Cell {} was specified with {} materials but has {} distributed " "instances. The number of materials must equal one or the number " "of instances.", - c.id_, c.material_.size(), c.n_instances_)); + c.id_, c.material_.size(), c.n_instances())); } } if (c.sqrtkT_.size() > 1) { - if (c.sqrtkT_.size() != c.n_instances_) { + if (c.sqrtkT_.size() != c.n_instances()) { fatal_error(fmt::format( "Cell {} was specified with {} temperatures but has {} distributed " "instances. The number of temperatures must equal one or the number " "of instances.", - c.id_, c.sqrtkT_.size(), c.n_instances_)); + c.id_, c.sqrtkT_.size(), c.n_instances())); + } + } + + if (c.density_mult_.size() > 1) { + if (c.density_mult_.size() != c.n_instances()) { + fatal_error(fmt::format("Cell {} was specified with {} density " + "multipliers but has {} distributed " + "instances. The number of density multipliers " + "must equal one or the number " + "of instances.", + c.id_, c.density_mult_.size(), c.n_instances())); } } } // Search through universes for material cells and assign each one a - // unique distribcell array index. - int distribcell_index = 0; + // distribcell array index according to the containing universe. vector target_univ_ids; for (const auto& u : model::universes) { for (auto idx : u->cells_) { if (distribcells.find(idx) != distribcells.end()) { - model::cells[idx]->distribcell_index_ = distribcell_index++; - target_univ_ids.push_back(u->id_); + if (!contains(target_univ_ids, u->id_)) { + target_univ_ids.push_back(u->id_); + } + model::cells[idx]->distribcell_index_ = + std::find(target_univ_ids.begin(), target_univ_ids.end(), u->id_) - + target_univ_ids.begin(); } } } @@ -419,8 +444,7 @@ void prepare_distribcell(const std::vector* user_distribcells) } else if (c.type_ == Fill::LATTICE) { c.offset_[map] = offset; Lattice& lat = *model::lattices[c.fill_]; - offset += - lat.fill_offset_table(offset, target_univ_id, map, univ_count_memo); + offset += lat.fill_offset_table(target_univ_id, map, univ_count_memo); } } } @@ -429,32 +453,12 @@ void prepare_distribcell(const std::vector* user_distribcells) //============================================================================== -void count_cell_instances(int32_t univ_indx) +void count_universe_instances() { - const auto univ_counts = model::universe_cell_counts.find(univ_indx); - if (univ_counts != model::universe_cell_counts.end()) { - for (const auto& it : univ_counts->second) { - model::cells[it.first]->n_instances_ += it.second; - } - } else { - for (int32_t cell_indx : model::universes[univ_indx]->cells_) { - Cell& c = *model::cells[cell_indx]; - ++c.n_instances_; - model::universe_cell_counts[univ_indx][cell_indx] += 1; - - if (c.type_ == Fill::UNIVERSE) { - // This cell contains another universe. Recurse into that universe. - count_cell_instances(c.fill_); - update_universe_cell_count(univ_indx, c.fill_); - } else if (c.type_ == Fill::LATTICE) { - // This cell contains a lattice. Recurse into the lattice universes. - Lattice& lat = *model::lattices[c.fill_]; - for (auto it = lat.begin(); it != lat.end(); ++it) { - count_cell_instances(*it); - update_universe_cell_count(univ_indx, *it); - } - } - } + for (auto& univ : model::universes) { + std::unordered_map univ_count_memo; + univ->n_instances_ = count_universe_instances( + model::root_universe, univ->id_, univ_count_memo); } } @@ -528,19 +532,16 @@ std::string distribcell_path_inner(int32_t target_cell, int32_t map, // Material cells don't contain other cells so ignore them. if (c.type_ != Fill::MATERIAL) { - int32_t temp_offset; - if (c.type_ == Fill::UNIVERSE) { - temp_offset = - offset + c.offset_[map]; // TODO: should also apply to lattice fills? - } else { + int32_t temp_offset = offset + c.offset_[map]; + if (c.type_ == Fill::LATTICE) { Lattice& lat = *model::lattices[c.fill_]; int32_t indx = lat.universes_.size() * map + lat.begin().indx_; - temp_offset = offset + lat.offsets_[indx]; + temp_offset += lat.offsets_[indx]; } // The desired cell is the first cell that gives an offset smaller or // equal to the target offset. - if (temp_offset <= target_offset - c.offset_[map]) + if (temp_offset <= target_offset) break; } } @@ -570,12 +571,12 @@ std::string distribcell_path_inner(int32_t target_cell, int32_t map, path << "l" << lat.id_; for (ReverseLatticeIter it = lat.rbegin(); it != lat.rend(); ++it) { int32_t indx = lat.universes_.size() * map + it.indx_; - int32_t temp_offset = offset + lat.offsets_[indx]; - if (temp_offset <= target_offset - c.offset_[map]) { + int32_t temp_offset = offset + lat.offsets_[indx] + c.offset_[map]; + if (temp_offset <= target_offset) { offset = temp_offset; path << "(" << lat.index_to_string(it.indx_) << ")->"; - path << distribcell_path_inner(target_cell, map, target_offset, - *model::universes[*it], offset + c.offset_[map]); + path << distribcell_path_inner( + target_cell, map, target_offset, *model::universes[*it], offset); return path.str(); } } diff --git a/src/hdf5_interface.cpp b/src/hdf5_interface.cpp index 27b750b93..c56d485e2 100644 --- a/src/hdf5_interface.cpp +++ b/src/hdf5_interface.cpp @@ -92,7 +92,7 @@ void get_shape_attr(hid_t obj_id, const char* name, hsize_t* dims) H5Aclose(attr); } -hid_t create_group(hid_t parent_id, char const* name) +hid_t create_group(hid_t parent_id, const char* name) { hid_t out = H5Gcreate(parent_id, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (out < 0) { @@ -225,8 +225,7 @@ void get_name(hid_t obj_id, std::string& name) { size_t size = 1 + H5Iget_name(obj_id, nullptr, 0); name.resize(size); - // TODO: switch to name.data() when using C++17 - H5Iget_name(obj_id, &name[0], size); + H5Iget_name(obj_id, name.data(), size); } int get_num_datasets(hid_t group_id) @@ -537,14 +536,14 @@ void read_complex( H5Tclose(complex_id); } -void read_tally_results( - hid_t group_id, hsize_t n_filter, hsize_t n_score, double* results) +void read_tally_results(hid_t group_id, hsize_t n_filter, hsize_t n_score, + hsize_t n_results, double* results) { // Create dataspace for hyperslab in memory constexpr int ndim = 3; - hsize_t dims[ndim] {n_filter, n_score, 3}; + hsize_t dims[ndim] {n_filter, n_score, n_results}; hsize_t start[ndim] {0, 0, 1}; - hsize_t count[ndim] {n_filter, n_score, 2}; + hsize_t count[ndim] {n_filter, n_score, n_results - 1}; hid_t memspace = H5Screate_simple(ndim, dims, nullptr); H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, nullptr, count, nullptr); @@ -687,15 +686,15 @@ void write_string( group_id, 0, nullptr, buffer.length(), name, buffer.c_str(), indep); } -void write_tally_results( - hid_t group_id, hsize_t n_filter, hsize_t n_score, const double* results) +void write_tally_results(hid_t group_id, hsize_t n_filter, hsize_t n_score, + hsize_t n_results, const double* results) { // Set dimensions of sum/sum_sq hyperslab to store constexpr int ndim = 3; - hsize_t count[ndim] {n_filter, n_score, 2}; + hsize_t count[ndim] {n_filter, n_score, n_results - 1}; // Set dimensions of results array - hsize_t dims[ndim] {n_filter, n_score, 3}; + hsize_t dims[ndim] {n_filter, n_score, n_results}; hsize_t start[ndim] {0, 0, 1}; hid_t memspace = H5Screate_simple(ndim, dims, nullptr); H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, nullptr, count, nullptr); diff --git a/src/ifp.cpp b/src/ifp.cpp new file mode 100644 index 000000000..cc4a76538 --- /dev/null +++ b/src/ifp.cpp @@ -0,0 +1,216 @@ +#include "openmc/ifp.h" + +#include "openmc/bank.h" +#include "openmc/message_passing.h" +#include "openmc/particle.h" +#include "openmc/particle_data.h" +#include "openmc/settings.h" +#include "openmc/simulation.h" +#include "openmc/vector.h" + +namespace openmc { + +bool is_beta_effective_or_both() +{ + if (settings::ifp_parameter == IFPParameter::BetaEffective || + settings::ifp_parameter == IFPParameter::Both) { + return true; + } + return false; +} + +bool is_generation_time_or_both() +{ + if (settings::ifp_parameter == IFPParameter::GenerationTime || + settings::ifp_parameter == IFPParameter::Both) { + return true; + } + return false; +} + +void ifp(const Particle& p, int64_t idx) +{ + if (is_beta_effective_or_both()) { + const auto& delayed_groups = + simulation::ifp_source_delayed_group_bank[p.current_work() - 1]; + simulation::ifp_fission_delayed_group_bank[idx] = + _ifp(p.delayed_group(), delayed_groups); + } + if (is_generation_time_or_both()) { + const auto& lifetimes = + simulation::ifp_source_lifetime_bank[p.current_work() - 1]; + simulation::ifp_fission_lifetime_bank[idx] = _ifp(p.lifetime(), lifetimes); + } +} + +void resize_simulation_ifp_banks() +{ + resize_ifp_data(simulation::ifp_source_delayed_group_bank, + simulation::ifp_source_lifetime_bank, simulation::work_per_rank); + resize_ifp_data(simulation::ifp_fission_delayed_group_bank, + simulation::ifp_fission_lifetime_bank, 3 * simulation::work_per_rank); +} + +void copy_ifp_data_from_fission_banks( + int i_bank, vector& delayed_groups, vector& lifetimes) +{ + if (is_beta_effective_or_both()) { + delayed_groups = simulation::ifp_fission_delayed_group_bank[i_bank]; + } + if (is_generation_time_or_both()) { + lifetimes = simulation::ifp_fission_lifetime_bank[i_bank]; + } +} + +#ifdef OPENMC_MPI + +void broadcast_ifp_n_generation(int& n_generation, + const vector>& delayed_groups, + const vector>& lifetimes) +{ + if (mpi::rank == 0) { + if (is_beta_effective_or_both()) { + n_generation = static_cast(delayed_groups[0].size()); + } else { + n_generation = static_cast(lifetimes[0].size()); + } + } + MPI_Bcast(&n_generation, 1, MPI_INT, 0, mpi::intracomm); +} + +void send_ifp_info(int64_t idx, int64_t n, int n_generation, int neighbor, + vector& requests, const vector>& delayed_groups, + vector& send_delayed_groups, const vector>& lifetimes, + vector& send_lifetimes) +{ + // Copy data in send buffers + for (int i = idx; i < idx + n; i++) { + if (is_beta_effective_or_both()) { + std::copy(delayed_groups[i].begin(), delayed_groups[i].end(), + send_delayed_groups.begin() + i * n_generation); + } + if (is_generation_time_or_both()) { + std::copy(lifetimes[i].begin(), lifetimes[i].end(), + send_lifetimes.begin() + i * n_generation); + } + } + // Send delayed groups + if (is_beta_effective_or_both()) { + requests.emplace_back(); + MPI_Isend(&send_delayed_groups[n_generation * idx], + n_generation * static_cast(n), MPI_INT, neighbor, mpi::rank, + mpi::intracomm, &requests.back()); + } + // Send lifetimes + if (is_generation_time_or_both()) { + requests.emplace_back(); + MPI_Isend(&send_lifetimes[n_generation * idx], + n_generation * static_cast(n), MPI_DOUBLE, neighbor, mpi::rank, + mpi::intracomm, &requests.back()); + } +} + +void receive_ifp_data(int64_t idx, int64_t n, int n_generation, int neighbor, + vector& requests, vector& delayed_groups, + vector& lifetimes, vector& deserialization) +{ + // Receive delayed groups + if (is_beta_effective_or_both()) { + requests.emplace_back(); + MPI_Irecv(&delayed_groups[n_generation * idx], + n_generation * static_cast(n), MPI_INT, neighbor, neighbor, + mpi::intracomm, &requests.back()); + } + // Receive lifetimes + if (is_generation_time_or_both()) { + requests.emplace_back(); + MPI_Irecv(&lifetimes[n_generation * idx], + n_generation * static_cast(n), MPI_DOUBLE, neighbor, neighbor, + mpi::intracomm, &requests.back()); + } + // Deserialization info to reconstruct data later + DeserializationInfo info = {idx, n}; + deserialization.push_back(info); +} + +void copy_partial_ifp_data_to_source_banks(int64_t idx, int n, int64_t i_bank, + const vector>& delayed_groups, + const vector>& lifetimes) +{ + if (is_beta_effective_or_both()) { + std::copy(&delayed_groups[idx], &delayed_groups[idx + n], + &simulation::ifp_source_delayed_group_bank[i_bank]); + } + if (is_generation_time_or_both()) { + std::copy(&lifetimes[idx], &lifetimes[idx + n], + &simulation::ifp_source_lifetime_bank[i_bank]); + } +} + +void deserialize_ifp_info(int n_generation, + const vector& deserialization, + const vector& delayed_groups, const vector& lifetimes) +{ + for (auto info : deserialization) { + int64_t index_local = info.index_local; + int64_t n = info.n; + + for (int i = index_local; i < index_local + n; i++) { + if (is_beta_effective_or_both()) { + vector delayed_groups_received( + delayed_groups.begin() + n_generation * i, + delayed_groups.begin() + n_generation * (i + 1)); + simulation::ifp_source_delayed_group_bank[i] = delayed_groups_received; + } + if (is_generation_time_or_both()) { + vector lifetimes_received(lifetimes.begin() + n_generation * i, + lifetimes.begin() + n_generation * (i + 1)); + simulation::ifp_source_lifetime_bank[i] = lifetimes_received; + } + } + } +} + +#endif + +void copy_complete_ifp_data_to_source_banks( + const vector>& delayed_groups, + const vector>& lifetimes) +{ + if (is_beta_effective_or_both()) { + std::copy(delayed_groups.data(), + delayed_groups.data() + settings::n_particles, + simulation::ifp_source_delayed_group_bank.begin()); + } + if (is_generation_time_or_both()) { + std::copy(lifetimes.data(), lifetimes.data() + settings::n_particles, + simulation::ifp_source_lifetime_bank.begin()); + } +} + +void allocate_temporary_vector_ifp( + vector>& delayed_groups, vector>& lifetimes) +{ + if (is_beta_effective_or_both()) { + delayed_groups.resize(simulation::fission_bank.size()); + } + if (is_generation_time_or_both()) { + lifetimes.resize(simulation::fission_bank.size()); + } +} + +void copy_ifp_data_to_fission_banks(const vector* const delayed_groups_ptr, + const vector* lifetimes_ptr) +{ + if (is_beta_effective_or_both()) { + std::copy(delayed_groups_ptr, + delayed_groups_ptr + simulation::fission_bank.size(), + simulation::ifp_fission_delayed_group_bank.data()); + } + if (is_generation_time_or_both()) { + std::copy(lifetimes_ptr, lifetimes_ptr + simulation::fission_bank.size(), + simulation::ifp_fission_lifetime_bank.data()); + } +} + +} // namespace openmc diff --git a/src/initialize.cpp b/src/initialize.cpp index 4b821bee1..a2269ed1e 100644 --- a/src/initialize.cpp +++ b/src/initialize.cpp @@ -38,7 +38,7 @@ #include "openmc/vector.h" #include "openmc/weight_windows.h" -#ifdef LIBMESH +#ifdef OPENMC_LIBMESH_ENABLED #include "libmesh/libmesh.h" #endif @@ -64,7 +64,7 @@ int openmc_init(int argc, char* argv[], const void* intracomm) if (err) return err; -#ifdef LIBMESH +#ifdef OPENMC_LIBMESH_ENABLED const int n_threads = num_threads(); // initialize libMesh if it hasn't been initialized already // (if initialized externally, the libmesh_init object needs to be provided @@ -157,7 +157,7 @@ void initialize_mpi(MPI_Comm intracomm) // Create bank datatype SourceSite b; - MPI_Aint disp[10]; + MPI_Aint disp[11]; MPI_Get_address(&b.r, &disp[0]); MPI_Get_address(&b.u, &disp[1]); MPI_Get_address(&b.E, &disp[2]); @@ -178,6 +178,37 @@ void initialize_mpi(MPI_Comm intracomm) MPI_DOUBLE, MPI_INT, MPI_INT, MPI_INT, MPI_INT, MPI_LONG, MPI_LONG}; MPI_Type_create_struct(11, blocks, disp, types, &mpi::source_site); MPI_Type_commit(&mpi::source_site); + + CollisionTrackSite bc; + MPI_Aint dispc[16]; + MPI_Get_address(&bc.r, &dispc[0]); // double + MPI_Get_address(&bc.u, &dispc[1]); // double + MPI_Get_address(&bc.E, &dispc[2]); // double + MPI_Get_address(&bc.dE, &dispc[3]); // double + MPI_Get_address(&bc.time, &dispc[4]); // double + MPI_Get_address(&bc.wgt, &dispc[5]); // double + MPI_Get_address(&bc.event_mt, &dispc[6]); // int + MPI_Get_address(&bc.delayed_group, &dispc[7]); // int + MPI_Get_address(&bc.cell_id, &dispc[8]); // int + MPI_Get_address(&bc.nuclide_id, &dispc[9]); // int + MPI_Get_address(&bc.material_id, &dispc[10]); // int + MPI_Get_address(&bc.universe_id, &dispc[11]); // int + MPI_Get_address(&bc.n_collision, &dispc[12]); // int + MPI_Get_address(&bc.particle, &dispc[13]); // int + MPI_Get_address(&bc.parent_id, &dispc[14]); // int64_t + MPI_Get_address(&bc.progeny_id, &dispc[15]); // int64_t + for (int i = 15; i >= 0; --i) { + dispc[i] -= dispc[0]; + } + + int blocksc[] = {3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; + MPI_Datatype typesc[] = {MPI_DOUBLE, MPI_DOUBLE, MPI_DOUBLE, MPI_DOUBLE, + MPI_DOUBLE, MPI_DOUBLE, MPI_INT, MPI_INT, MPI_INT, MPI_INT, MPI_INT, + MPI_INT, MPI_INT, MPI_INT, MPI_INT64_T, MPI_INT64_T}; + + MPI_Type_create_struct( + 16, blocksc, dispc, typesc, &mpi::collision_track_site); + MPI_Type_commit(&mpi::collision_track_site); } #endif // OPENMC_MPI @@ -195,6 +226,15 @@ int parse_command_line(int argc, char* argv[]) i += 1; settings::n_particles = std::stoll(argv[i]); + } else if (arg == "-q" || arg == "--verbosity") { + i += 1; + settings::verbosity = std::stoi(argv[i]); + if (settings::verbosity > 10 || settings::verbosity < 1) { + auto msg = fmt::format("Invalid verbosity: {}.", settings::verbosity); + strcpy(openmc_err_msg, msg.c_str()); + return OPENMC_E_INVALID_ARGUMENT; + } + } else if (arg == "-e" || arg == "--event") { settings::event_based = true; } else if (arg == "-r" || arg == "--restart") { @@ -345,8 +385,10 @@ bool read_model_xml() auto settings_root = root.child("settings"); // Verbosity - if (check_for_node(settings_root, "verbosity")) { + if (check_for_node(settings_root, "verbosity") && settings::verbosity == -1) { settings::verbosity = std::stoi(get_node_value(settings_root, "verbosity")); + } else if (settings::verbosity == -1) { + settings::verbosity = 7; } // To this point, we haven't displayed any output since we didn't know what @@ -401,6 +443,10 @@ bool read_model_xml() // Finalize cross sections having assigned temperatures finalize_cross_sections(); + // Compute cell density multipliers now that material densities + // have been finalized (from geometry_aux.h) + finalize_cell_densities(); + if (check_for_node(root, "tallies")) read_tallies_xml(root.child("tallies")); @@ -441,6 +487,11 @@ void read_separate_xml_files() // Finalize cross sections having assigned temperatures finalize_cross_sections(); + + // Compute cell density multipliers now that material densities + // have been finalized (from geometry_aux.h) + finalize_cell_densities(); + read_tallies_xml(); // Initialize distribcell_filters diff --git a/src/lattice.cpp b/src/lattice.cpp index 73005ad09..92d451f61 100644 --- a/src/lattice.cpp +++ b/src/lattice.cpp @@ -103,8 +103,8 @@ void Lattice::adjust_indices() //============================================================================== -int32_t Lattice::fill_offset_table(int32_t offset, int32_t target_univ_id, - int map, std::unordered_map& univ_count_memo) +int32_t Lattice::fill_offset_table(int32_t target_univ_id, int map, + std::unordered_map& univ_count_memo) { // If the offsets have already been determined for this "map", don't bother // recalculating all of them and just return the total offset. Note that the @@ -119,6 +119,7 @@ int32_t Lattice::fill_offset_table(int32_t offset, int32_t target_univ_id, count_universe_instances(last_univ, target_univ_id, univ_count_memo); } + int32_t offset = 0; for (LatticeIter it = begin(); it != end(); ++it) { offsets_[map * universes_.size() + it.indx_] = offset; offset += count_universe_instances(*it, target_univ_id, univ_count_memo); @@ -259,46 +260,24 @@ std::pair> RectLattice::distance( // Determine the oncoming edge. double x0 {copysign(0.5 * pitch_[0], u.x)}; double y0 {copysign(0.5 * pitch_[1], u.y)}; + double z0; - // Left and right sides - double d {INFTY}; - array lattice_trans; - if ((std::abs(x - x0) > FP_PRECISION) && u.x != 0) { - d = (x0 - x) / u.x; - if (u.x > 0) { - lattice_trans = {1, 0, 0}; - } else { - lattice_trans = {-1, 0, 0}; - } - } - - // Front and back sides - if ((std::abs(y - y0) > FP_PRECISION) && u.y != 0) { - double this_d = (y0 - y) / u.y; - if (this_d < d) { - d = this_d; - if (u.y > 0) { - lattice_trans = {0, 1, 0}; - } else { - lattice_trans = {0, -1, 0}; - } - } - } - - // Top and bottom sides + double d = std::min( + u.x != 0.0 ? (x0 - x) / u.x : INFTY, u.y != 0.0 ? (y0 - y) / u.y : INFTY); if (is_3d_) { - double z0 {copysign(0.5 * pitch_[2], u.z)}; - if ((std::abs(z - z0) > FP_PRECISION) && u.z != 0) { - double this_d = (z0 - z) / u.z; - if (this_d < d) { - d = this_d; - if (u.z > 0) { - lattice_trans = {0, 0, 1}; - } else { - lattice_trans = {0, 0, -1}; - } - } - } + z0 = copysign(0.5 * pitch_[2], u.z); + d = std::min(d, u.z != 0.0 ? (z0 - z) / u.z : INFTY); + } + + // Determine which lattice boundaries are being crossed + array lattice_trans = {0, 0, 0}; + if (u.x != 0.0 && std::abs(x + u.x * d - x0) < FP_PRECISION) + lattice_trans[0] = copysign(1, u.x); + if (u.y != 0.0 && std::abs(y + u.y * d - y0) < FP_PRECISION) + lattice_trans[1] = copysign(1, u.y); + if (is_3d_) { + if (u.z != 0.0 && std::abs(z + u.z * d - z0) < FP_PRECISION) + lattice_trans[2] = copysign(1, u.z); } return {d, lattice_trans}; diff --git a/src/material.cpp b/src/material.cpp index a1937aca4..54caa3840 100644 --- a/src/material.cpp +++ b/src/material.cpp @@ -454,12 +454,15 @@ void Material::normalize_density() // Calculate nuclide atom densities atom_density_ *= density_; - // Calculate density in g/cm^3. + // Calculate density in [g/cm^3] and charge density in [e/b-cm] density_gpcc_ = 0.0; + charge_density_ = 0.0; for (int i = 0; i < nuclide_.size(); ++i) { int i_nuc = nuclide_[i]; double awr = settings::run_CE ? data::nuclides[i_nuc]->awr_ : 1.0; + int z = settings::run_CE ? data::nuclides[i_nuc]->Z_ : 0.0; density_gpcc_ += atom_density_(i) * awr * MASS_NEUTRON / N_AVOGADRO; + charge_density_ += atom_density_(i) * z; } } @@ -640,7 +643,7 @@ void Material::init_bremsstrahlung() // Allocate arrays for TTB data ttb->pdf = xt::zeros({n_e, n_e}); ttb->cdf = xt::zeros({n_e, n_e}); - ttb->yield = xt::empty({n_e}); + ttb->yield = xt::zeros({n_e}); // Allocate temporary arrays xt::xtensor stopping_power_collision({n_e}, 0.0); @@ -777,14 +780,15 @@ void Material::init_bremsstrahlung() // Loop over photon energies double c = 0.0; for (int i = 0; i < j; ++i) { - // Integrate the CDF from the PDF using the trapezoidal rule in log-log - // space + // Integrate the CDF from the PDF using the fact that the PDF is linear + // in log-log space double w_l = std::log(data::ttb_e_grid(i)); double w_r = std::log(data::ttb_e_grid(i + 1)); double x_l = std::log(ttb->pdf(j, i)); double x_r = std::log(ttb->pdf(j, i + 1)); - - c += 0.5 * (w_r - w_l) * (std::exp(w_l + x_l) + std::exp(w_r + x_r)); + double beta = (x_r - x_l) / (w_r - w_l); + double a = beta + 1.0; + c += std::exp(w_l + x_l) / a * std::expm1(a * (w_r - w_l)); ttb->cdf(j, i + 1) = c; } @@ -886,7 +890,7 @@ void Material::calculate_neutron_xs(Particle& p) const // ADD TO MACROSCOPIC CROSS SECTION // Copy atom density of nuclide in material - double atom_density = atom_density_(i); + double atom_density = this->atom_density(i, p.density_mult()); // Add contributions to cross sections p.macro_xs().total += atom_density * micro.total; @@ -921,7 +925,7 @@ void Material::calculate_photon_xs(Particle& p) const // ADD TO MACROSCOPIC CROSS SECTION // Copy atom density of nuclide in material - double atom_density = atom_density_(i); + double atom_density = this->atom_density(i, p.density_mult()); // Add contributions to material macroscopic cross sections p.macro_xs().total += atom_density * micro.total; @@ -981,12 +985,15 @@ void Material::set_density(double density, const std::string& units) // Recalculate nuclide atom densities based on given density atom_density_ *= density; - // Calculate density in g/cm^3. + // Calculate density in g/cm^3 and charge density in [e/b-cm] density_gpcc_ = 0.0; + charge_density_ = 0.0; for (int i = 0; i < nuclide_.size(); ++i) { int i_nuc = nuclide_[i]; double awr = data::nuclides[i_nuc]->awr_; + int z = settings::run_CE ? data::nuclides[i_nuc]->Z_ : 0.0; density_gpcc_ += atom_density_(i) * awr * MASS_NEUTRON / N_AVOGADRO; + charge_density_ += atom_density_(i) * z; } } else if (units == "g/cm3" || units == "g/cc") { // Determine factor by which to change densities @@ -997,6 +1004,7 @@ void Material::set_density(double density, const std::string& units) density_gpcc_ = density; density_ *= f; atom_density_ *= f; + charge_density_ *= f; } else { throw std::invalid_argument { "Invalid units '" + std::string(units.data()) + "' specified."}; diff --git a/src/math_functions.cpp b/src/math_functions.cpp index 5469b56c8..9473f928b 100644 --- a/src/math_functions.cpp +++ b/src/math_functions.cpp @@ -919,4 +919,19 @@ std::complex w_derivative(std::complex z, int order) } } +// Helper function to get index and interpolation function on an incident energy +// grid +void get_energy_index( + const vector& energies, double E, int& i, double& f) +{ + // Get index and interpolation factor for linear-linear energy grid + i = 0; + f = 0.0; + if (E >= energies.front()) { + i = lower_bound_index(energies.begin(), energies.end(), E); + if (i + 1 < energies.size()) + f = (E - energies[i]) / (energies[i + 1] - energies[i]); + } +} + } // namespace openmc diff --git a/src/mcpl_interface.cpp b/src/mcpl_interface.cpp index 83ef63320..256f3343f 100644 --- a/src/mcpl_interface.cpp +++ b/src/mcpl_interface.cpp @@ -11,32 +11,317 @@ #include -#ifdef OPENMC_MCPL -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN +#include +#else +#include #endif +// WARNING: These declarations MUST EXACTLY MATCH the structure and function +// signatures of the libmcpl being loaded at runtime. Any discrepancy will +// likely lead to crashes or incorrect behavior. This is a maintenance risk. +// MCPL 2.2.0 + +#pragma pack(push, 1) +struct mcpl_particle_repr_t { + double ekin; + double polarisation[3]; + double position[3]; + double direction[3]; + double time; + double weight; + int32_t pdgcode; + uint32_t userflags; +}; +#pragma pack(pop) + +// Opaque struct definitions replicating the MCPL C-API to ensure ABI +// compatibility without including mcpl.h. These must be kept in sync. +struct mcpl_file_t { + void* internal; +}; +struct mcpl_outfile_t { + void* internal; +}; + +// Function pointer types for the dynamically loaded MCPL library +using mcpl_open_file_fpt = mcpl_file_t* (*)(const char* filename); +using mcpl_hdr_nparticles_fpt = uint64_t (*)(mcpl_file_t* file_handle); +using mcpl_read_fpt = const mcpl_particle_repr_t* (*)(mcpl_file_t* file_handle); +using mcpl_close_file_fpt = void (*)(mcpl_file_t* file_handle); + +using mcpl_hdr_add_data_fpt = void (*)(mcpl_outfile_t* file_handle, + const char* key, uint32_t datalength, const char* data); +using mcpl_create_outfile_fpt = mcpl_outfile_t* (*)(const char* filename); +using mcpl_hdr_set_srcname_fpt = void (*)( + mcpl_outfile_t* outfile_handle, const char* srcname); +using mcpl_add_particle_fpt = void (*)( + mcpl_outfile_t* outfile_handle, const mcpl_particle_repr_t* particle); +using mcpl_close_outfile_fpt = void (*)(mcpl_outfile_t* outfile_handle); +using mcpl_hdr_add_stat_sum_fpt = void (*)( + mcpl_outfile_t* outfile_handle, const char* key, double value); + namespace openmc { -//============================================================================== -// Constants -//============================================================================== - -#ifdef OPENMC_MCPL -const bool MCPL_ENABLED = true; +#ifdef _WIN32 +using LibraryHandleType = HMODULE; #else -const bool MCPL_ENABLED = false; +using LibraryHandleType = void*; #endif -//============================================================================== -// Functions -//============================================================================== +std::string get_last_library_error() +{ +#ifdef _WIN32 + DWORD error_code = GetLastError(); + if (error_code == 0) + return "No error reported by system."; // More accurate than "No error." + LPSTR message_buffer = nullptr; + size_t size = + FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, error_code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPSTR)&message_buffer, 0, NULL); + std::string message(message_buffer, size); + LocalFree(message_buffer); + while ( + !message.empty() && (message.back() == '\n' || message.back() == '\r')) { + message.pop_back(); + } + return message; +#else + const char* err = dlerror(); + return err ? std::string(err) : "No error reported by dlerror."; +#endif +} -#ifdef OPENMC_MCPL -SourceSite mcpl_particle_to_site(const mcpl_particle_t* particle) +struct McplApi { + mcpl_open_file_fpt open_file; + mcpl_hdr_nparticles_fpt hdr_nparticles; + mcpl_read_fpt read; + mcpl_close_file_fpt close_file; + mcpl_create_outfile_fpt create_outfile; + mcpl_hdr_set_srcname_fpt hdr_set_srcname; + mcpl_hdr_add_data_fpt hdr_add_data; + mcpl_add_particle_fpt add_particle; + mcpl_close_outfile_fpt close_outfile; + mcpl_hdr_add_stat_sum_fpt hdr_add_stat_sum; + + explicit McplApi(LibraryHandleType lib_handle) + { + if (!lib_handle) + throw std::runtime_error( + "MCPL library handle is null during API binding."); + + auto load_symbol_platform = [lib_handle](const char* name) { + void* sym = nullptr; +#ifdef _WIN32 + sym = (void*)GetProcAddress(lib_handle, name); +#else + sym = dlsym(lib_handle, name); +#endif + if (!sym) { + throw std::runtime_error( + fmt::format("Failed to load MCPL symbol '{}': {}", name, + get_last_library_error())); + } + return sym; + }; + + open_file = reinterpret_cast( + load_symbol_platform("mcpl_open_file")); + hdr_nparticles = reinterpret_cast( + load_symbol_platform("mcpl_hdr_nparticles")); + read = reinterpret_cast(load_symbol_platform("mcpl_read")); + close_file = reinterpret_cast( + load_symbol_platform("mcpl_close_file")); + create_outfile = reinterpret_cast( + load_symbol_platform("mcpl_create_outfile")); + hdr_set_srcname = reinterpret_cast( + load_symbol_platform("mcpl_hdr_set_srcname")); + add_particle = reinterpret_cast( + load_symbol_platform("mcpl_add_particle")); + close_outfile = reinterpret_cast( + load_symbol_platform("mcpl_close_outfile")); + + // Try to load mcpl_hdr_add_data (available in MCPL >= 2.1.0) + // Set to nullptr if not available for graceful fallback + try { + hdr_add_data = reinterpret_cast( + load_symbol_platform("mcpl_hdr_add_data")); + } catch (const std::runtime_error&) { + hdr_add_data = nullptr; + } + + // Try to load mcpl_hdr_add_stat_sum (available in MCPL >= 2.1.0) + // Set to nullptr if not available for graceful fallback + try { + hdr_add_stat_sum = reinterpret_cast( + load_symbol_platform("mcpl_hdr_add_stat_sum")); + } catch (const std::runtime_error&) { + hdr_add_stat_sum = nullptr; + } + } +}; + +static LibraryHandleType g_mcpl_lib_handle = nullptr; +static std::unique_ptr g_mcpl_api; +static bool g_mcpl_init_attempted = false; +static bool g_mcpl_successfully_loaded = false; +static std::string g_mcpl_load_error_msg; +static std::once_flag g_mcpl_init_flag; + +void append_error(std::string& existing_msg, const std::string& new_error) +{ + if (!existing_msg.empty()) { + existing_msg += "; "; + } + existing_msg += new_error; +} + +void initialize_mcpl_interface_impl() +{ + g_mcpl_init_attempted = true; + g_mcpl_load_error_msg.clear(); + + // Try mcpl-config + if (!g_mcpl_lib_handle) { + FILE* pipe = nullptr; +#ifdef _WIN32 + pipe = _popen("mcpl-config --show libpath", "r"); +#else + pipe = popen("mcpl-config --show libpath 2>/dev/null", "r"); +#endif + if (pipe) { + char buffer[512]; + if (fgets(buffer, sizeof(buffer), pipe) != nullptr) { + std::string shlibpath = buffer; + // Remove trailing whitespace + while (!shlibpath.empty() && + std::isspace(static_cast(shlibpath.back()))) { + shlibpath.pop_back(); + } + + if (!shlibpath.empty()) { +#ifdef _WIN32 + g_mcpl_lib_handle = LoadLibraryA(shlibpath.c_str()); +#else + g_mcpl_lib_handle = dlopen(shlibpath.c_str(), RTLD_LAZY); +#endif + if (!g_mcpl_lib_handle) { + append_error( + g_mcpl_load_error_msg, fmt::format("From mcpl-config ({}): {}", + shlibpath, get_last_library_error())); + } + } + } +#ifdef _WIN32 + _pclose(pipe); +#else + pclose(pipe); +#endif + } else { // pipe failed to open + append_error(g_mcpl_load_error_msg, + "mcpl-config command not found or failed to execute"); + } + } + + // Try standard library names + if (!g_mcpl_lib_handle) { +#ifdef _WIN32 + const char* standard_names[] = {"mcpl.dll", "libmcpl.dll"}; +#else + const char* standard_names[] = {"libmcpl.so", "libmcpl.dylib"}; +#endif + for (const char* name : standard_names) { +#ifdef _WIN32 + g_mcpl_lib_handle = LoadLibraryA(name); +#else + g_mcpl_lib_handle = dlopen(name, RTLD_LAZY); +#endif + if (g_mcpl_lib_handle) + break; + } + if (!g_mcpl_lib_handle) { + append_error( + g_mcpl_load_error_msg, fmt::format("Using standard names (e.g. {}): {}", + standard_names[0], get_last_library_error())); + } + } + + if (!g_mcpl_lib_handle) { + if (mpi::master) { + warning(fmt::format("MCPL library could not be loaded. MCPL-dependent " + "features will be unavailable. Load attempts: {}", + g_mcpl_load_error_msg.empty() + ? "No specific error during load attempts." + : g_mcpl_load_error_msg)); + } + g_mcpl_successfully_loaded = false; + return; + } + + try { + g_mcpl_api = std::make_unique(g_mcpl_lib_handle); + g_mcpl_successfully_loaded = true; + // Do not call dlclose/FreeLibrary at exit. Leaking the handle is safer + // and standard practice for libraries used for the application's lifetime. + } catch (const std::runtime_error& e) { + append_error(g_mcpl_load_error_msg, + fmt::format( + "MCPL library loaded, but failed to bind symbols: {}", e.what())); + if (mpi::master) { + warning(g_mcpl_load_error_msg); + } +#ifdef _WIN32 + FreeLibrary(g_mcpl_lib_handle); +#else + dlclose(g_mcpl_lib_handle); +#endif + g_mcpl_lib_handle = nullptr; + g_mcpl_successfully_loaded = false; + } +} + +void initialize_mcpl_interface_if_needed() +{ + std::call_once(g_mcpl_init_flag, initialize_mcpl_interface_impl); +} + +bool is_mcpl_interface_available() +{ + initialize_mcpl_interface_if_needed(); + return g_mcpl_successfully_loaded; +} + +inline void ensure_mcpl_ready_or_fatal() +{ + initialize_mcpl_interface_if_needed(); + if (!g_mcpl_successfully_loaded) { + fatal_error("MCPL functionality is required, but the MCPL library is not " + "available or failed to initialize. Please ensure MCPL is " + "installed and its library can be found (e.g., via PATH on " + "Windows, LD_LIBRARY_PATH on Linux, or DYLD_LIBRARY_PATH on " + "macOS). You can often install MCPL with 'pip install mcpl' or " + "'conda install mcpl'."); + } +} + +SourceSite mcpl_particle_to_site(const mcpl_particle_repr_t* particle_repr) { SourceSite site; - - switch (particle->pdgcode) { + switch (particle_repr->pdgcode) { case 2112: site.particle = ParticleType::neutron; break; @@ -49,179 +334,377 @@ SourceSite mcpl_particle_to_site(const mcpl_particle_t* particle) case -11: site.particle = ParticleType::positron; break; + default: + fatal_error(fmt::format( + "MCPL: Encountered unexpected PDG code {} when converting to SourceSite.", + particle_repr->pdgcode)); + break; } // Copy position and direction - site.r.x = particle->position[0]; - site.r.y = particle->position[1]; - site.r.z = particle->position[2]; - site.u.x = particle->direction[0]; - site.u.y = particle->direction[1]; - site.u.z = particle->direction[2]; - + site.r.x = particle_repr->position[0]; + site.r.y = particle_repr->position[1]; + site.r.z = particle_repr->position[2]; + site.u.x = particle_repr->direction[0]; + site.u.y = particle_repr->direction[1]; + site.u.z = particle_repr->direction[2]; // MCPL stores kinetic energy in [MeV], time in [ms] - site.E = particle->ekin * 1e6; - site.time = particle->time * 1e-3; - site.wgt = particle->weight; - + site.E = particle_repr->ekin * 1e6; + site.time = particle_repr->time * 1e-3; + site.wgt = particle_repr->weight; return site; } -#endif - -//============================================================================== vector mcpl_source_sites(std::string path) { + ensure_mcpl_ready_or_fatal(); vector sites; -#ifdef OPENMC_MCPL - // Open MCPL file and determine number of particles - auto mcpl_file = mcpl_open_file(path.c_str()); - size_t n_sites = mcpl_hdr_nparticles(mcpl_file); + mcpl_file_t* mcpl_file = g_mcpl_api->open_file(path.c_str()); + if (!mcpl_file) { + fatal_error(fmt::format("MCPL: Could not open file '{}'. It might be " + "missing, inaccessible, or not a valid MCPL file.", + path)); + } - for (int i = 0; i < n_sites; i++) { - // Extract particle from mcpl-file, checking if it is a neutron, photon, - // electron, or positron. Otherwise skip. - const mcpl_particle_t* particle; - int pdg = 0; - while (pdg != 2112 && pdg != 22 && pdg != 11 && pdg != -11) { - particle = mcpl_read(mcpl_file); - pdg = particle->pdgcode; + size_t n_particles_in_file = g_mcpl_api->hdr_nparticles(mcpl_file); + size_t n_skipped = 0; + if (n_particles_in_file > 0) { + sites.reserve(n_particles_in_file); + } + + for (size_t i = 0; i < n_particles_in_file; ++i) { + const mcpl_particle_repr_t* p_repr = g_mcpl_api->read(mcpl_file); + if (!p_repr) { + warning(fmt::format("MCPL: Read error or unexpected end of file '{}' " + "after reading {} of {} expected particles.", + path, sites.size(), n_particles_in_file)); + break; + } + if (p_repr->pdgcode == 2112 || p_repr->pdgcode == 22 || + p_repr->pdgcode == 11 || p_repr->pdgcode == -11) { + sites.push_back(mcpl_particle_to_site(p_repr)); + } else { + n_skipped++; } - - // Convert to source site and add to vector - sites.push_back(mcpl_particle_to_site(particle)); } - // Check that some sites were read + g_mcpl_api->close_file(mcpl_file); + + if (n_skipped > 0 && n_particles_in_file > 0) { + double percent_skipped = + 100.0 * static_cast(n_skipped) / n_particles_in_file; + warning(fmt::format( + "MCPL: Skipped {} of {} total particles ({:.1f}%) in file '{}' because " + "their type is not supported by OpenMC.", + n_skipped, n_particles_in_file, percent_skipped, path)); + } + if (sites.empty()) { - fatal_error("MCPL file contained no neutron, photon, electron, or positron " - "source particles."); + if (n_particles_in_file > 0) { + fatal_error(fmt::format( + "MCPL file '{}' contained {} particles, but none were of the supported " + "types (neutron, photon, electron, positron). OpenMC cannot proceed " + "without source particles.", + path, n_particles_in_file)); + } else { + fatal_error(fmt::format( + "MCPL file '{}' is empty or contains no particle data.", path)); + } } - - mcpl_close_file(mcpl_file); -#else - fatal_error( - "Your build of OpenMC does not support reading MCPL source files."); -#endif - return sites; } -//============================================================================== - -#ifdef OPENMC_MCPL -void write_mcpl_source_bank(mcpl_outfile_t file_id, - span source_bank, const vector& bank_index) +void write_mcpl_source_bank_internal(mcpl_outfile_t* file_id, + span local_source_bank, + const vector& bank_index_all_ranks) { - int64_t dims_size = settings::n_particles; - int64_t count_size = simulation::work_per_rank; - if (mpi::master) { - // Particles are writeen to disk from the master node only + if (!file_id) { + fatal_error("MCPL: Internal error - master rank called " + "write_mcpl_source_bank_internal with null file_id."); + } + vector receive_buffer; - // Save source bank sites since the array is overwritten below + for (int rank_idx = 0; rank_idx < mpi::n_procs; ++rank_idx) { + size_t num_sites_on_rank = static_cast( + bank_index_all_ranks[rank_idx + 1] - bank_index_all_ranks[rank_idx]); + if (num_sites_on_rank == 0) + continue; + + span sites_to_write; #ifdef OPENMC_MPI - vector temp_source {source_bank.begin(), source_bank.end()}; + if (rank_idx == mpi::rank) { + sites_to_write = openmc::span( + local_source_bank.data(), num_sites_on_rank); + } else { + if (receive_buffer.size() < num_sites_on_rank) { + receive_buffer.resize(num_sites_on_rank); + } + MPI_Recv(receive_buffer.data(), num_sites_on_rank, mpi::source_site, + rank_idx, rank_idx, mpi::intracomm, MPI_STATUS_IGNORE); + sites_to_write = openmc::span( + receive_buffer.data(), num_sites_on_rank); + } +#else + sites_to_write = openmc::span( + local_source_bank.data(), num_sites_on_rank); #endif - - // loop over the other nodes and receive data - then write those. - for (int i = 0; i < mpi::n_procs; ++i) { - // number of particles for node node i - size_t count[] {static_cast(bank_index[i + 1] - bank_index[i])}; - -#ifdef OPENMC_MPI - if (i > 0) - MPI_Recv(source_bank.data(), count[0], mpi::source_site, i, i, - mpi::intracomm, MPI_STATUS_IGNORE); -#endif - // now write the source_bank data again. - for (const auto& site : source_bank) { - // particle is now at the iterator - // write it to the mcpl-file - mcpl_particle_t p; - p.position[0] = site.r.x; - p.position[1] = site.r.y; - p.position[2] = site.r.z; - - // mcpl requires that the direction vector is unit length - // which is also the case in openmc - p.direction[0] = site.u.x; - p.direction[1] = site.u.y; - p.direction[2] = site.u.z; - - // MCPL stores kinetic energy in [MeV], time in [ms] - p.ekin = site.E * 1e-6; - p.time = site.time * 1e3; - p.weight = site.wgt; - + for (const auto& site : sites_to_write) { + mcpl_particle_repr_t p_repr {}; + p_repr.position[0] = site.r.x; + p_repr.position[1] = site.r.y; + p_repr.position[2] = site.r.z; + p_repr.direction[0] = site.u.x; + p_repr.direction[1] = site.u.y; + p_repr.direction[2] = site.u.z; + p_repr.ekin = site.E * 1e-6; + p_repr.time = site.time * 1e3; + p_repr.weight = site.wgt; switch (site.particle) { case ParticleType::neutron: - p.pdgcode = 2112; + p_repr.pdgcode = 2112; break; case ParticleType::photon: - p.pdgcode = 22; + p_repr.pdgcode = 22; break; case ParticleType::electron: - p.pdgcode = 11; + p_repr.pdgcode = 11; break; case ParticleType::positron: - p.pdgcode = -11; + p_repr.pdgcode = -11; break; + default: + continue; } - - mcpl_add_particle(file_id, &p); + g_mcpl_api->add_particle(file_id, &p_repr); } } -#ifdef OPENMC_MPI - // Restore state of source bank - std::copy(temp_source.begin(), temp_source.end(), source_bank.begin()); -#endif } else { #ifdef OPENMC_MPI - MPI_Send(source_bank.data(), count_size, mpi::source_site, 0, mpi::rank, - mpi::intracomm); + if (!local_source_bank.empty()) { + MPI_Send(local_source_bank.data(), local_source_bank.size(), + mpi::source_site, 0, mpi::rank, mpi::intracomm); + } #endif } } -#endif - -//============================================================================== void write_mcpl_source_point(const char* filename, span source_bank, const vector& bank_index) { + ensure_mcpl_ready_or_fatal(); + std::string filename_(filename); const auto extension = get_file_extension(filename_); - if (extension == "") { + if (extension.empty()) { filename_.append(".mcpl"); } else if (extension != "mcpl") { - warning("write_mcpl_source_point was passed a file extension differing " - "from .mcpl, but an mcpl file will be written."); + warning(fmt::format("Specified filename '{}' has an extension '.{}', but " + "an MCPL file (.mcpl) will be written using this name.", + filename, extension)); } -#ifdef OPENMC_MCPL - mcpl_outfile_t file_id; + mcpl_outfile_t* file_id = nullptr; - std::string line; if (mpi::master) { - file_id = mcpl_create_outfile(filename_.c_str()); + file_id = g_mcpl_api->create_outfile(filename_.c_str()); + if (!file_id) { + fatal_error(fmt::format( + "MCPL: Failed to create output file '{}'. Check permissions and path.", + filename_)); + } + std::string src_line; if (VERSION_DEV) { - line = fmt::format("OpenMC {0}.{1}.{2}-dev{3}", VERSION_MAJOR, + src_line = fmt::format("OpenMC {}.{}.{}-dev{}", VERSION_MAJOR, VERSION_MINOR, VERSION_RELEASE, VERSION_COMMIT_COUNT); } else { - line = fmt::format( - "OpenMC {0}.{1}.{2}", VERSION_MAJOR, VERSION_MINOR, VERSION_RELEASE); + src_line = fmt::format( + "OpenMC {}.{}.{}", VERSION_MAJOR, VERSION_MINOR, VERSION_RELEASE); + } + g_mcpl_api->hdr_set_srcname(file_id, src_line.c_str()); + + // Initialize stat:sum with -1 to indicate incomplete file (issue #3514) + // This follows MCPL >= 2.1.0 convention for tracking simulation statistics + // The -1 value indicates "not available" if file creation is interrupted + if (g_mcpl_api->hdr_add_stat_sum) { + // Using key "openmc_np1" following tkittel's recommendation + // Initial value of -1 prevents misleading values in case of crashes + g_mcpl_api->hdr_add_stat_sum(file_id, "openmc_np1", -1.0); } - mcpl_hdr_set_srcname(file_id, line.c_str()); } - write_mcpl_source_bank(file_id, source_bank, bank_index); + write_mcpl_source_bank_internal(file_id, source_bank, bank_index); if (mpi::master) { - mcpl_close_outfile(file_id); + if (file_id) { + // Update stat:sum with actual particle count before closing (issue #3514) + // This represents the original number of source particles in the + // simulation (not the number of particles in the file) + if (g_mcpl_api->hdr_add_stat_sum) { + // Calculate total source particles from active batches + // Per issue #3514: this should be the original number of source + // particles, not the number written to the file + int64_t total_source_particles = + static_cast(settings::n_batches - settings::n_inactive) * + settings::gen_per_batch * settings::n_particles; + // Update with actual count - this overwrites the initial -1 value + g_mcpl_api->hdr_add_stat_sum( + file_id, "openmc_np1", static_cast(total_source_particles)); + } + + g_mcpl_api->close_outfile(file_id); + } } +} + +// Collision track feature with MCPL +void write_mcpl_collision_track_internal(mcpl_outfile_t* file_id, + span collision_track_bank, + const vector& bank_index_all_ranks) +{ + if (mpi::master) { + if (!file_id) { + fatal_error("MCPL: Internal error - master rank called " + "write_mcpl_source_bank_internal with null file_id."); + } + vector receive_buffer; + vector all_sites; + all_sites.reserve(static_cast(bank_index_all_ranks.back())); + vector all_blobs; + all_blobs.reserve(static_cast(bank_index_all_ranks.back())); + + for (int rank_idx = 0; rank_idx < mpi::n_procs; ++rank_idx) { + size_t num_sites_on_rank = static_cast( + bank_index_all_ranks[rank_idx + 1] - bank_index_all_ranks[rank_idx]); + if (num_sites_on_rank == 0) + continue; + + span sites_to_process; +#ifdef OPENMC_MPI + if (rank_idx == mpi::rank) { + sites_to_process = openmc::span( + collision_track_bank.data(), num_sites_on_rank); + } else { + receive_buffer.resize(num_sites_on_rank); + MPI_Recv(receive_buffer.data(), num_sites_on_rank, + mpi::collision_track_site, rank_idx, rank_idx, mpi::intracomm, + MPI_STATUS_IGNORE); + sites_to_process = openmc::span( + receive_buffer.data(), num_sites_on_rank); + } +#else + sites_to_process = openmc::span( + collision_track_bank.data(), num_sites_on_rank); #endif + + for (const auto& site : sites_to_process) { + std::ostringstream custom_data_stream; + custom_data_stream << " dE : " << site.dE + << " ; event_mt : " << site.event_mt + << " ; delayed_group : " << site.delayed_group + << " ; cell_id : " << site.cell_id + << " ; nuclide_id : " << site.nuclide_id + << " ; material_id : " << site.material_id + << " ; universe_id : " << site.universe_id + << " ; n_collision : " << site.n_collision + << " ; parent_id : " << site.parent_id + << " ; progeny_id : " << site.progeny_id; + + all_blobs.push_back(custom_data_stream.str()); + all_sites.push_back(site); + } + } + + for (size_t idx = 0; idx < all_blobs.size(); ++idx) { + const auto& blob = all_blobs[idx]; + std::string key = "blob_" + std::to_string(idx); + g_mcpl_api->hdr_add_data(file_id, key.c_str(), blob.size(), blob.c_str()); + } + + for (const auto& site : all_sites) { + mcpl_particle_repr_t p_repr {}; + p_repr.position[0] = site.r.x; + p_repr.position[1] = site.r.y; + p_repr.position[2] = site.r.z; + p_repr.direction[0] = site.u.x; + p_repr.direction[1] = site.u.y; + p_repr.direction[2] = site.u.z; + p_repr.ekin = site.E * 1e-6; + p_repr.time = site.time * 1e3; + p_repr.weight = site.wgt; + switch (site.particle) { + case ParticleType::neutron: + p_repr.pdgcode = 2112; + break; + case ParticleType::photon: + p_repr.pdgcode = 22; + break; + case ParticleType::electron: + p_repr.pdgcode = 11; + break; + case ParticleType::positron: + p_repr.pdgcode = -11; + break; + default: + continue; + } + g_mcpl_api->add_particle(file_id, &p_repr); + } + } else { +#ifdef OPENMC_MPI + if (!collision_track_bank.empty()) { + MPI_Send(collision_track_bank.data(), collision_track_bank.size(), + mpi::collision_track_site, 0, mpi::rank, mpi::intracomm); + } +#endif + } +} + +void write_mcpl_collision_track(const char* filename, + span collision_track_bank, + const vector& bank_index) +{ + ensure_mcpl_ready_or_fatal(); + + std::string filename_(filename); + const auto extension = get_file_extension(filename_); + if (extension.empty()) { + filename_.append(".mcpl"); + } else if (extension != "mcpl") { + warning(fmt::format("Specified filename '{}' has an extension '.{}', but " + "an MCPL file (.mcpl) will be written using this name.", + filename, extension)); + } + + mcpl_outfile_t* file_id = nullptr; + + if (mpi::master) { + file_id = g_mcpl_api->create_outfile(filename_.c_str()); + if (!file_id) { + fatal_error(fmt::format( + "MCPL: Failed to create output file '{}'. Check permissions and path.", + filename_)); + } + std::string src_line; + if (VERSION_DEV) { + src_line = fmt::format("OpenMC {}.{}.{}-dev{}", VERSION_MAJOR, + VERSION_MINOR, VERSION_RELEASE, VERSION_COMMIT_COUNT); + } else { + src_line = fmt::format( + "OpenMC {}.{}.{}", VERSION_MAJOR, VERSION_MINOR, VERSION_RELEASE); + } + + g_mcpl_api->hdr_set_srcname(file_id, src_line.c_str()); + } + write_mcpl_collision_track_internal( + file_id, collision_track_bank, bank_index); + + if (mpi::master) { + if (file_id) { + g_mcpl_api->close_outfile(file_id); + } + } } } // namespace openmc diff --git a/src/mesh.cpp b/src/mesh.cpp index 101da7468..9a7a8e751 100644 --- a/src/mesh.cpp +++ b/src/mesh.cpp @@ -47,13 +47,14 @@ #include "openmc/volume_calc.h" #include "openmc/xml_interface.h" -#ifdef LIBMESH +#ifdef OPENMC_LIBMESH_ENABLED #include "libmesh/mesh_modification.h" #include "libmesh/mesh_tools.h" #include "libmesh/numeric_vector.h" +#include "libmesh/replicated_mesh.h" #endif -#ifdef DAGMC +#ifdef OPENMC_DAGMC_ENABLED #include "moab/FileOptions.hpp" #endif @@ -63,7 +64,7 @@ namespace openmc { // Global variables //============================================================================== -#ifdef LIBMESH +#ifdef OPENMC_LIBMESH_ENABLED const bool LIBMESH_ENABLED = true; #else const bool LIBMESH_ENABLED = false; @@ -80,7 +81,7 @@ vector> meshes; } // namespace model -#ifdef LIBMESH +#ifdef OPENMC_LIBMESH_ENABLED namespace settings { unique_ptr libmesh_init; const libMesh::Parallel::Communicator* libmesh_comm {nullptr}; @@ -230,6 +231,42 @@ void MaterialVolumes::add_volume_unsafe( // Mesh implementation //============================================================================== +template +const std::unique_ptr& Mesh::create( + T dataset, const std::string& mesh_type, const std::string& mesh_library) +{ + // Determine mesh type. Add to model vector and map + if (mesh_type == RegularMesh::mesh_type) { + model::meshes.push_back(make_unique(dataset)); + } else if (mesh_type == RectilinearMesh::mesh_type) { + model::meshes.push_back(make_unique(dataset)); + } else if (mesh_type == CylindricalMesh::mesh_type) { + model::meshes.push_back(make_unique(dataset)); + } else if (mesh_type == SphericalMesh::mesh_type) { + model::meshes.push_back(make_unique(dataset)); +#ifdef OPENMC_DAGMC_ENABLED + } else if (mesh_type == UnstructuredMesh::mesh_type && + mesh_library == MOABMesh::mesh_lib_type) { + model::meshes.push_back(make_unique(dataset)); +#endif +#ifdef OPENMC_LIBMESH_ENABLED + } else if (mesh_type == UnstructuredMesh::mesh_type && + mesh_library == LibMesh::mesh_lib_type) { + model::meshes.push_back(make_unique(dataset)); +#endif + } else if (mesh_type == UnstructuredMesh::mesh_type) { + fatal_error("Unstructured mesh support is not enabled or the mesh " + "library is invalid."); + } else { + fatal_error(fmt::format("Invalid mesh type: {}", mesh_type)); + } + + // Map ID to position in vector + model::mesh_map[model::meshes.back()->id_] = model::meshes.size() - 1; + + return model::meshes.back(); +} + Mesh::Mesh(pugi::xml_node node) { // Read mesh id @@ -238,6 +275,17 @@ Mesh::Mesh(pugi::xml_node node) name_ = get_node_value(node, "name"); } +Mesh::Mesh(hid_t group) +{ + // Read mesh ID + read_attribute(group, "id", id_); + + // Read mesh name + if (object_exists(group, "name")) { + read_dataset(group, "name", name_); + } +} + void Mesh::set_id(int32_t id) { assert(id >= 0 || id == C_NONE); @@ -265,7 +313,13 @@ void Mesh::set_id(int32_t id) // Update ID and entry in the mesh map id_ = id; - model::mesh_map[id] = model::meshes.size() - 1; + + // find the index of this mesh in the model::meshes vector + // (search in reverse because this mesh was likely just added to the vector) + auto it = std::find_if(model::meshes.rbegin(), model::meshes.rend(), + [this](const std::unique_ptr& mesh) { return mesh.get() == this; }); + + model::mesh_map[id] = std::distance(model::meshes.begin(), it.base()) - 1; } vector Mesh::volumes() const @@ -305,9 +359,10 @@ void Mesh::material_volumes(int nx, int ny, int nz, int table_size, std::array n_rays = {nx, ny, nz}; // Determine effective width of rays - Position width((nx > 0) ? (bbox.xmax - bbox.xmin) / nx : 0.0, - (ny > 0) ? (bbox.ymax - bbox.ymin) / ny : 0.0, - (nz > 0) ? (bbox.zmax - bbox.zmin) / nz : 0.0); + Position width = bbox.max - bbox.min; + width.x = (nx > 0) ? width.x / nx : 0.0; + width.y = (ny > 0) ? width.y / ny : 0.0; + width.z = (nz > 0) ? width.z / nz : 0.0; // Set flag for mesh being contained within model bool out_of_model = false; @@ -326,15 +381,15 @@ void Mesh::material_volumes(int nx, int ny, int nz, int table_size, for (int axis = 0; axis < 3; ++axis) { // Set starting position and direction site.r = {0.0, 0.0, 0.0}; - site.r[axis] = bbox.min()[axis]; + site.r[axis] = bbox.min[axis]; site.u = {0.0, 0.0, 0.0}; site.u[axis] = 1.0; // Determine width of rays and number of rays in other directions int ax1 = (axis + 1) % 3; int ax2 = (axis + 2) % 3; - double min1 = bbox.min()[ax1]; - double min2 = bbox.min()[ax2]; + double min1 = bbox.min[ax1]; + double min2 = bbox.min[ax2]; double d1 = width[ax1]; double d2 = width[ax2]; int n1 = n_rays[ax1]; @@ -368,24 +423,24 @@ void Mesh::material_volumes(int nx, int ny, int nz, int table_size, // Set birth cell attribute if (p.cell_born() == C_NONE) - p.cell_born() = p.lowest_coord().cell; + p.cell_born() = p.lowest_coord().cell(); // Initialize last cells from current cell for (int j = 0; j < p.n_coord(); ++j) { - p.cell_last(j) = p.coord(j).cell; + p.cell_last(j) = p.coord(j).cell(); } p.n_coord_last() = p.n_coord(); while (true) { // Ray trace from r_start to r_end Position r0 = p.r(); - double max_distance = bbox.max()[axis] - r0[axis]; + double max_distance = bbox.max[axis] - r0[axis]; // Find the distance to the nearest boundary BoundaryInfo boundary = distance_to_boundary(p); // Advance particle forward - double distance = std::min(boundary.distance, max_distance); + double distance = std::min(boundary.distance(), max_distance); p.move_distance(distance); // Determine what mesh elements were crossed by particle @@ -411,17 +466,17 @@ void Mesh::material_volumes(int nx, int ny, int nz, int table_size, // cross next geometric surface for (int j = 0; j < p.n_coord(); ++j) { - p.cell_last(j) = p.coord(j).cell; + p.cell_last(j) = p.coord(j).cell(); } p.n_coord_last() = p.n_coord(); // Set surface that particle is on and adjust coordinate levels - p.surface() = boundary.surface; - p.n_coord() = boundary.coord_level; + p.surface() = boundary.surface(); + p.n_coord() = boundary.coord_level(); - if (boundary.lattice_translation[0] != 0 || - boundary.lattice_translation[1] != 0 || - boundary.lattice_translation[2] != 0) { + if (boundary.lattice_translation()[0] != 0 || + boundary.lattice_translation()[1] != 0 || + boundary.lattice_translation()[2] != 0) { // Particle crosses lattice boundary cross_lattice(p, boundary); } else { @@ -590,6 +645,8 @@ Position StructuredMesh::sample_element( UnstructuredMesh::UnstructuredMesh(pugi::xml_node node) : Mesh(node) { + n_dimension_ = 3; + // check the mesh type if (check_for_node(node, "type")) { auto temp = get_node_value(node, "type", true, true); @@ -625,6 +682,46 @@ UnstructuredMesh::UnstructuredMesh(pugi::xml_node node) : Mesh(node) } } +UnstructuredMesh::UnstructuredMesh(hid_t group) : Mesh(group) +{ + n_dimension_ = 3; + + // check the mesh type + if (object_exists(group, "type")) { + std::string temp; + read_dataset(group, "type", temp); + if (temp != mesh_type) { + fatal_error(fmt::format("Invalid mesh type: {}", temp)); + } + } + + // check if a length unit multiplier was specified + if (object_exists(group, "length_multiplier")) { + read_dataset(group, "length_multiplier", length_multiplier_); + } + + // get the filename of the unstructured mesh to load + if (object_exists(group, "filename")) { + read_dataset(group, "filename", filename_); + if (!file_exists(filename_)) { + fatal_error("Mesh file '" + filename_ + "' does not exist!"); + } + } else { + fatal_error(fmt::format( + "No filename supplied for unstructured mesh with ID: {}", id_)); + } + + if (attribute_exists(group, "options")) { + read_attribute(group, "options", options_); + } + + // check if mesh tally data should be written with + // statepoint files + if (attribute_exists(group, "output")) { + read_attribute(group, "output", output_); + } +} + void UnstructuredMesh::determine_bounds() { double xmin = INFTY; @@ -915,6 +1012,11 @@ void StructuredMesh::raytrace_mesh( if (total_distance == 0.0 && settings::solver_type != SolverType::RANDOM_RAY) return; + // keep a copy of the original global position to pass to get_indices, + // which performs its own transformation to local coordinates + Position global_r = r0; + Position local_r = local_coords(r0); + const int n = n_dimension_; // Flag if position is inside the mesh @@ -925,7 +1027,7 @@ void StructuredMesh::raytrace_mesh( // Calculate index of current cell. Offset the position a tiny bit in // direction of flight - MeshIndex ijk = get_indices(r0 + TINY_BIT * u, in_mesh); + MeshIndex ijk = get_indices(global_r + TINY_BIT * u, in_mesh); // if track is very short, assume that it is completely inside one cell. // Only the current cell will score and no surfaces @@ -936,16 +1038,10 @@ void StructuredMesh::raytrace_mesh( return; } - // translate start and end positions, - // this needs to come after the get_indices call because it does its own - // translation - local_coords(r0); - local_coords(r1); - // Calculate initial distances to next surfaces in all three dimensions std::array distances; for (int k = 0; k < n; ++k) { - distances[k] = distance_to_grid_boundary(ijk, k, r0, u, 0.0); + distances[k] = distance_to_grid_boundary(ijk, k, local_r, u, 0.0); } // Loop until r = r1 is eventually reached @@ -975,7 +1071,7 @@ void StructuredMesh::raytrace_mesh( // The two other directions are still valid! ijk[k] = distances[k].next_index; distances[k] = - distance_to_grid_boundary(ijk, k, r0, u, traveled_distance); + distance_to_grid_boundary(ijk, k, local_r, u, traveled_distance); // Check if we have left the interior of the mesh in_mesh = ((ijk[k] >= 1) && (ijk[k] <= shape_[k])); @@ -990,7 +1086,7 @@ void StructuredMesh::raytrace_mesh( // For all directions outside the mesh, find the distance that we need // to travel to reach the next surface. Use the largest distance, as // only this will cross all outer surfaces. - int k_max {0}; + int k_max {-1}; for (int k = 0; k < n; ++k) { if ((ijk[k] < 1 || ijk[k] > shape_[k]) && (distances[k].distance > traveled_distance)) { @@ -998,6 +1094,10 @@ void StructuredMesh::raytrace_mesh( k_max = k; } } + // Assure some distance is traveled + if (k_max == -1) { + traveled_distance += TINY_BIT; + } // If r1 is not inside the mesh, exit here if (traveled_distance >= total_distance) @@ -1005,14 +1105,14 @@ void StructuredMesh::raytrace_mesh( // Calculate the new cell index and update all distances to next // surfaces. - ijk = get_indices(r0 + (traveled_distance + TINY_BIT) * u, in_mesh); + ijk = get_indices(global_r + (traveled_distance + TINY_BIT) * u, in_mesh); for (int k = 0; k < n; ++k) { distances[k] = - distance_to_grid_boundary(ijk, k, r0, u, traveled_distance); + distance_to_grid_boundary(ijk, k, local_r, u, traveled_distance); } // If inside the mesh, Tally inward current - if (in_mesh) + if (in_mesh && k_max >= 0) tally.surface(ijk, k_max, !distances[k_max].max_surface, true); } } @@ -1081,6 +1181,72 @@ void StructuredMesh::surface_bins_crossed( // RegularMesh implementation //============================================================================== +int RegularMesh::set_grid() +{ + auto shape = xt::adapt(shape_, {n_dimension_}); + + // Check that dimensions are all greater than zero + if (xt::any(shape <= 0)) { + set_errmsg("All entries for a regular mesh dimensions " + "must be positive."); + return OPENMC_E_INVALID_ARGUMENT; + } + + // Make sure lower_left and dimension match + if (lower_left_.size() != n_dimension_) { + set_errmsg("Number of entries in lower_left must be the same " + "as the regular mesh dimensions."); + return OPENMC_E_INVALID_ARGUMENT; + } + if (width_.size() > 0) { + + // Check to ensure width has same dimensions + if (width_.size() != n_dimension_) { + set_errmsg("Number of entries on width must be the same as " + "the regular mesh dimensions."); + return OPENMC_E_INVALID_ARGUMENT; + } + + // Check for negative widths + if (xt::any(width_ < 0.0)) { + set_errmsg("Cannot have a negative width on a regular mesh."); + return OPENMC_E_INVALID_ARGUMENT; + } + + // Set width and upper right coordinate + upper_right_ = xt::eval(lower_left_ + shape * width_); + + } else if (upper_right_.size() > 0) { + + // Check to ensure upper_right_ has same dimensions + if (upper_right_.size() != n_dimension_) { + set_errmsg("Number of entries on upper_right must be the " + "same as the regular mesh dimensions."); + return OPENMC_E_INVALID_ARGUMENT; + } + + // Check that upper-right is above lower-left + if (xt::any(upper_right_ < lower_left_)) { + set_errmsg( + "The upper_right coordinates of a regular mesh must be greater than " + "the lower_left coordinates."); + return OPENMC_E_INVALID_ARGUMENT; + } + + // Set width + width_ = xt::eval((upper_right_ - lower_left_) / shape); + } + + // Set material volumes + volume_frac_ = 1.0 / xt::prod(shape)(); + + element_volume_ = 1.0; + for (int i = 0; i < n_dimension_; i++) { + element_volume_ *= width_[i]; + } + return 0; +} + RegularMesh::RegularMesh(pugi::xml_node node) : StructuredMesh {node} { // Determine number of dimensions for mesh @@ -1095,12 +1261,6 @@ RegularMesh::RegularMesh(pugi::xml_node node) : StructuredMesh {node} } std::copy(shape.begin(), shape.end(), shape_.begin()); - // Check that dimensions are all greater than zero - if (xt::any(shape <= 0)) { - fatal_error("All entries on the element for a tally " - "mesh must be positive."); - } - // Check for lower-left coordinates if (check_for_node(node, "lower_left")) { // Read mesh lower-left corner location @@ -1109,12 +1269,6 @@ RegularMesh::RegularMesh(pugi::xml_node node) : StructuredMesh {node} fatal_error("Must specify on a mesh."); } - // Make sure lower_left and dimension match - if (shape.size() != lower_left_.size()) { - fatal_error("Number of entries on must be the same " - "as the number of entries on ."); - } - if (check_for_node(node, "width")) { // Make sure one of upper-right or width were specified if (check_for_node(node, "upper_right")) { @@ -1123,49 +1277,52 @@ RegularMesh::RegularMesh(pugi::xml_node node) : StructuredMesh {node} width_ = get_node_xarray(node, "width"); - // Check to ensure width has same dimensions - auto n = width_.size(); - if (n != lower_left_.size()) { - fatal_error("Number of entries on must be the same as " - "the number of entries on ."); - } - - // Check for negative widths - if (xt::any(width_ < 0.0)) { - fatal_error("Cannot have a negative on a tally mesh."); - } - - // Set width and upper right coordinate - upper_right_ = xt::eval(lower_left_ + shape * width_); - } else if (check_for_node(node, "upper_right")) { + upper_right_ = get_node_xarray(node, "upper_right"); - // Check to ensure width has same dimensions - auto n = upper_right_.size(); - if (n != lower_left_.size()) { - fatal_error("Number of entries on must be the " - "same as the number of entries on ."); - } - - // Check that upper-right is above lower-left - if (xt::any(upper_right_ < lower_left_)) { - fatal_error("The coordinates must be greater than " - "the coordinates on a tally mesh."); - } - - // Set width - width_ = xt::eval((upper_right_ - lower_left_) / shape); } else { fatal_error("Must specify either or on a mesh."); } - // Set material volumes - volume_frac_ = 1.0 / xt::prod(shape)(); + if (int err = set_grid()) { + fatal_error(openmc_err_msg); + } +} - element_volume_ = 1.0; - for (int i = 0; i < n_dimension_; i++) { - element_volume_ *= width_[i]; +RegularMesh::RegularMesh(hid_t group) : StructuredMesh {group} +{ + // Determine number of dimensions for mesh + if (!object_exists(group, "dimension")) { + fatal_error("Must specify on a regular mesh."); + } + + xt::xtensor shape; + read_dataset(group, "dimension", shape); + int n = n_dimension_ = shape.size(); + if (n != 1 && n != 2 && n != 3) { + fatal_error("Mesh must be one, two, or three dimensions."); + } + std::copy(shape.begin(), shape.end(), shape_.begin()); + + // Check for lower-left coordinates + if (object_exists(group, "lower_left")) { + // Read mesh lower-left corner location + read_dataset(group, "lower_left", lower_left_); + } else { + fatal_error("Must specify lower_left dataset on a mesh."); + } + + if (object_exists(group, "upper_right")) { + + read_dataset(group, "upper_right", upper_right_); + + } else { + fatal_error("Must specify either upper_right dataset on a mesh."); + } + + if (int err = set_grid()) { + fatal_error(openmc_err_msg); } } @@ -1208,6 +1365,7 @@ StructuredMesh::MeshDistance RegularMesh::distance_to_grid_boundary( d.next_index--; d.distance = (negative_grid_boundary(ijk, i) - r0[i]) / u[i]; } + return d; } @@ -1337,6 +1495,19 @@ RectilinearMesh::RectilinearMesh(pugi::xml_node node) : StructuredMesh {node} } } +RectilinearMesh::RectilinearMesh(hid_t group) : StructuredMesh {group} +{ + n_dimension_ = 3; + + read_dataset(group, "x_grid", grid_[0]); + read_dataset(group, "y_grid", grid_[1]); + read_dataset(group, "z_grid", grid_[2]); + + if (int err = set_grid()) { + fatal_error(openmc_err_msg); + } +} + const std::string RectilinearMesh::mesh_type = "rectilinear"; std::string RectilinearMesh::get_mesh_type() const @@ -1472,6 +1643,19 @@ CylindricalMesh::CylindricalMesh(pugi::xml_node node) } } +CylindricalMesh::CylindricalMesh(hid_t group) : PeriodicStructuredMesh {group} +{ + n_dimension_ = 3; + read_dataset(group, "r_grid", grid_[0]); + read_dataset(group, "phi_grid", grid_[1]); + read_dataset(group, "z_grid", grid_[2]); + read_dataset(group, "origin", origin_); + + if (int err = set_grid()) { + fatal_error(openmc_err_msg); + } +} + const std::string CylindricalMesh::mesh_type = "cylindrical"; std::string CylindricalMesh::get_mesh_type() const @@ -1482,7 +1666,7 @@ std::string CylindricalMesh::get_mesh_type() const StructuredMesh::MeshIndex CylindricalMesh::get_indices( Position r, bool& in_mesh) const { - local_coords(r); + r = local_coords(r); Position mapped_r; mapped_r[0] = std::hypot(r.x, r.y); @@ -1630,23 +1814,21 @@ StructuredMesh::MeshDistance CylindricalMesh::distance_to_grid_boundary( const MeshIndex& ijk, int i, const Position& r0, const Direction& u, double l) const { - Position r = r0 - origin_; - if (i == 0) { return std::min( - MeshDistance(ijk[i] + 1, true, find_r_crossing(r, u, l, ijk[i])), - MeshDistance(ijk[i] - 1, false, find_r_crossing(r, u, l, ijk[i] - 1))); + MeshDistance(ijk[i] + 1, true, find_r_crossing(r0, u, l, ijk[i])), + MeshDistance(ijk[i] - 1, false, find_r_crossing(r0, u, l, ijk[i] - 1))); } else if (i == 1) { return std::min(MeshDistance(sanitize_phi(ijk[i] + 1), true, - find_phi_crossing(r, u, l, ijk[i])), + find_phi_crossing(r0, u, l, ijk[i])), MeshDistance(sanitize_phi(ijk[i] - 1), false, - find_phi_crossing(r, u, l, ijk[i] - 1))); + find_phi_crossing(r0, u, l, ijk[i] - 1))); } else { - return find_z_crossing(r, u, l, ijk[i]); + return find_z_crossing(r0, u, l, ijk[i]); } } @@ -1752,6 +1934,20 @@ SphericalMesh::SphericalMesh(pugi::xml_node node) } } +SphericalMesh::SphericalMesh(hid_t group) : PeriodicStructuredMesh {group} +{ + n_dimension_ = 3; + + read_dataset(group, "r_grid", grid_[0]); + read_dataset(group, "theta_grid", grid_[1]); + read_dataset(group, "phi_grid", grid_[2]); + read_dataset(group, "origin", origin_); + + if (int err = set_grid()) { + fatal_error(openmc_err_msg); + } +} + const std::string SphericalMesh::mesh_type = "spherical"; std::string SphericalMesh::get_mesh_type() const @@ -1762,7 +1958,7 @@ std::string SphericalMesh::get_mesh_type() const StructuredMesh::MeshIndex SphericalMesh::get_indices( Position r, bool& in_mesh) const { - local_coords(r); + r = local_coords(r); Position mapped_r; mapped_r[0] = r.norm(); @@ -1797,7 +1993,8 @@ Position SphericalMesh::sample_element( double phi_min = this->phi(ijk[2] - 1); double phi_max = this->phi(ijk[2]); - double cos_theta = uniform_distribution(theta_min, theta_max, seed); + double cos_theta = + uniform_distribution(std::cos(theta_min), std::cos(theta_max), seed); double sin_theta = std::sin(std::acos(cos_theta)); double phi = uniform_distribution(phi_min, phi_max, seed); double r_min_cub = std::pow(r_min, 3); @@ -2131,14 +2328,14 @@ extern "C" int openmc_add_unstructured_mesh( std::string mesh_file(filename); bool valid_lib = false; -#ifdef DAGMC +#ifdef OPENMC_DAGMC_ENABLED if (lib_name == MOABMesh::mesh_lib_type) { model::meshes.push_back(std::move(make_unique(mesh_file))); valid_lib = true; } #endif -#ifdef LIBMESH +#ifdef OPENMC_LIBMESH_ENABLED if (lib_name == LibMesh::mesh_lib_type) { model::meshes.push_back(std::move(make_unique(mesh_file))); valid_lib = true; @@ -2219,14 +2416,14 @@ extern "C" int openmc_mesh_bounding_box(int32_t index, double* ll, double* ur) BoundingBox bbox = model::meshes[index]->bounding_box(); // set lower left corner values - ll[0] = bbox.xmin; - ll[1] = bbox.ymin; - ll[2] = bbox.zmin; + ll[0] = bbox.min.x; + ll[1] = bbox.min.y; + ll[2] = bbox.min.z; // set upper right corner values - ur[0] = bbox.xmax; - ur[1] = bbox.ymax; - ur[2] = bbox.zmax; + ur[0] = bbox.max.x; + ur[1] = bbox.max.y; + ur[2] = bbox.max.z; return 0; } @@ -2506,7 +2703,7 @@ extern "C" int openmc_spherical_mesh_set_grid(int32_t index, index, grid_x, nx, grid_y, ny, grid_z, nz); } -#ifdef DAGMC +#ifdef OPENMC_DAGMC_ENABLED const std::string MOABMesh::mesh_lib_type = "moab"; @@ -2515,8 +2712,15 @@ MOABMesh::MOABMesh(pugi::xml_node node) : UnstructuredMesh(node) initialize(); } -MOABMesh::MOABMesh(const std::string& filename, double length_multiplier) +MOABMesh::MOABMesh(hid_t group) : UnstructuredMesh(group) { + initialize(); +} + +MOABMesh::MOABMesh(const std::string& filename, double length_multiplier) + : UnstructuredMesh() +{ + n_dimension_ = 3; filename_ = filename; set_length_multiplier(length_multiplier); initialize(); @@ -3208,11 +3412,20 @@ void MOABMesh::write(const std::string& base_filename) const #endif -#ifdef LIBMESH +#ifdef OPENMC_LIBMESH_ENABLED const std::string LibMesh::mesh_lib_type = "libmesh"; -LibMesh::LibMesh(pugi::xml_node node) : UnstructuredMesh(node), adaptive_(false) +LibMesh::LibMesh(pugi::xml_node node) : UnstructuredMesh(node) +{ + // filename_ and length_multiplier_ will already be set by the + // UnstructuredMesh constructor + set_mesh_pointer_from_filename(filename_); + set_length_multiplier(length_multiplier_); + initialize(); +} + +LibMesh::LibMesh(hid_t group) : UnstructuredMesh(group) { // filename_ and length_multiplier_ will already be set by the // UnstructuredMesh constructor @@ -3223,9 +3436,8 @@ LibMesh::LibMesh(pugi::xml_node node) : UnstructuredMesh(node), adaptive_(false) // create the mesh from a pointer to a libMesh Mesh LibMesh::LibMesh(libMesh::MeshBase& input_mesh, double length_multiplier) - : adaptive_(input_mesh.n_active_elem() != input_mesh.n_elem()) { - if (!dynamic_cast(&input_mesh)) { + if (!input_mesh.is_replicated()) { fatal_error("At present LibMesh tallies require a replicated mesh. Please " "ensure 'input_mesh' is a libMesh::ReplicatedMesh."); } @@ -3237,8 +3449,8 @@ LibMesh::LibMesh(libMesh::MeshBase& input_mesh, double length_multiplier) // create the mesh from an input file LibMesh::LibMesh(const std::string& filename, double length_multiplier) - : adaptive_(false) { + n_dimension_ = 3; set_mesh_pointer_from_filename(filename); set_length_multiplier(length_multiplier); initialize(); @@ -3299,21 +3511,6 @@ void LibMesh::initialize() auto first_elem = *m_->elements_begin(); first_element_id_ = first_elem->id(); - // if the mesh is adaptive elements aren't guaranteed by libMesh to be - // contiguous in ID space, so we need to map from bin indices (defined over - // active elements) to global dof ids - if (adaptive_) { - bin_to_elem_map_.reserve(m_->n_active_elem()); - elem_to_bin_map_.resize(m_->n_elem(), -1); - for (auto it = m_->active_elements_begin(); it != m_->active_elements_end(); - it++) { - auto elem = *it; - - bin_to_elem_map_.push_back(elem->id()); - elem_to_bin_map_[elem->id()] = bin_to_elem_map_.size() - 1; - } - } - // bounding box for the mesh for quick rejection checks bbox_ = libMesh::MeshTools::create_bounding_box(*m_); libMesh::Point ll = bbox_.min(); @@ -3371,7 +3568,7 @@ std::string LibMesh::library() const int LibMesh::n_bins() const { - return m_->n_active_elem(); + return m_->n_elem(); } int LibMesh::n_surface_bins() const @@ -3394,14 +3591,6 @@ int LibMesh::n_surface_bins() const void LibMesh::add_score(const std::string& var_name) { - if (adaptive_) { - warning(fmt::format( - "Exodus output cannot be provided as unstructured mesh {} is adaptive.", - this->id_)); - - return; - } - if (!equation_systems_) { build_eqn_sys(); } @@ -3437,14 +3626,6 @@ void LibMesh::remove_scores() void LibMesh::set_score_data(const std::string& var_name, const vector& values, const vector& std_dev) { - if (adaptive_) { - warning(fmt::format( - "Exodus output cannot be provided as unstructured mesh {} is adaptive.", - this->id_)); - - return; - } - if (!equation_systems_) { build_eqn_sys(); } @@ -3488,14 +3669,6 @@ void LibMesh::set_score_data(const std::string& var_name, void LibMesh::write(const std::string& filename) const { - if (adaptive_) { - warning(fmt::format( - "Exodus output cannot be provided as unstructured mesh {} is adaptive.", - this->id_)); - - return; - } - write_message(fmt::format( "Writing file: {}.e for unstructured mesh {}", filename, this->id_)); libMesh::ExodusII_IO exo(*m_); @@ -3529,8 +3702,7 @@ int LibMesh::get_bin(Position r) const int LibMesh::get_bin_from_element(const libMesh::Elem* elem) const { - int bin = - adaptive_ ? elem_to_bin_map_[elem->id()] : elem->id() - first_element_id_; + int bin = elem->id() - first_element_id_; if (bin >= n_bins() || bin < 0) { fatal_error(fmt::format("Invalid bin: {}", bin)); } @@ -3545,7 +3717,7 @@ std::pair, vector> LibMesh::plot( const libMesh::Elem& LibMesh::get_element_from_bin(int bin) const { - return adaptive_ ? m_->elem_ref(bin_to_elem_map_.at(bin)) : m_->elem_ref(bin); + return m_->elem_ref(bin); } double LibMesh::volume(int bin) const @@ -3553,7 +3725,66 @@ double LibMesh::volume(int bin) const return this->get_element_from_bin(bin).volume(); } -#endif // LIBMESH +AdaptiveLibMesh::AdaptiveLibMesh( + libMesh::MeshBase& input_mesh, double length_multiplier) + : LibMesh(input_mesh, length_multiplier), num_active_(m_->n_active_elem()) +{ + // if the mesh is adaptive elements aren't guaranteed by libMesh to be + // contiguous in ID space, so we need to map from bin indices (defined over + // active elements) to global dof ids + bin_to_elem_map_.reserve(num_active_); + elem_to_bin_map_.resize(m_->n_elem(), -1); + for (auto it = m_->active_elements_begin(); it != m_->active_elements_end(); + it++) { + auto elem = *it; + + bin_to_elem_map_.push_back(elem->id()); + elem_to_bin_map_[elem->id()] = bin_to_elem_map_.size() - 1; + } +} + +int AdaptiveLibMesh::n_bins() const +{ + return num_active_; +} + +void AdaptiveLibMesh::add_score(const std::string& var_name) +{ + warning(fmt::format( + "Exodus output cannot be provided as unstructured mesh {} is adaptive.", + this->id_)); +} + +void AdaptiveLibMesh::set_score_data(const std::string& var_name, + const vector& values, const vector& std_dev) +{ + warning(fmt::format( + "Exodus output cannot be provided as unstructured mesh {} is adaptive.", + this->id_)); +} + +void AdaptiveLibMesh::write(const std::string& filename) const +{ + warning(fmt::format( + "Exodus output cannot be provided as unstructured mesh {} is adaptive.", + this->id_)); +} + +int AdaptiveLibMesh::get_bin_from_element(const libMesh::Elem* elem) const +{ + int bin = elem_to_bin_map_[elem->id()]; + if (bin >= n_bins() || bin < 0) { + fatal_error(fmt::format("Invalid bin: {}", bin)); + } + return bin; +} + +const libMesh::Elem& AdaptiveLibMesh::get_element_from_bin(int bin) const +{ + return m_->elem_ref(bin_to_elem_map_.at(bin)); +} + +#endif // OPENMC_LIBMESH_ENABLED //============================================================================== // Non-member functions @@ -3593,34 +3824,51 @@ void read_meshes(pugi::xml_node root) mesh_lib = get_node_value(node, "library", true, true); } - // Read mesh and add to vector - if (mesh_type == RegularMesh::mesh_type) { - model::meshes.push_back(make_unique(node)); - } else if (mesh_type == RectilinearMesh::mesh_type) { - model::meshes.push_back(make_unique(node)); - } else if (mesh_type == CylindricalMesh::mesh_type) { - model::meshes.push_back(make_unique(node)); - } else if (mesh_type == SphericalMesh::mesh_type) { - model::meshes.push_back(make_unique(node)); -#ifdef DAGMC - } else if (mesh_type == UnstructuredMesh::mesh_type && - mesh_lib == MOABMesh::mesh_lib_type) { - model::meshes.push_back(make_unique(node)); -#endif -#ifdef LIBMESH - } else if (mesh_type == UnstructuredMesh::mesh_type && - mesh_lib == LibMesh::mesh_lib_type) { - model::meshes.push_back(make_unique(node)); -#endif - } else if (mesh_type == UnstructuredMesh::mesh_type) { - fatal_error("Unstructured mesh support is not enabled or the mesh " - "library is invalid."); - } else { - fatal_error("Invalid mesh type: " + mesh_type); + Mesh::create(node, mesh_type, mesh_lib); + } +} + +void read_meshes(hid_t group) +{ + std::unordered_set mesh_ids; + + std::vector ids; + read_attribute(group, "ids", ids); + + for (auto id : ids) { + + // Check to make sure multiple meshes in the same file don't share IDs + if (contains(mesh_ids, id)) { + fatal_error(fmt::format("Two or more meshes use the same unique ID " + "'{}' in the same HDF5 input file", + id)); + } + mesh_ids.insert(id); + + // If we've already read a mesh with the same ID in a *different* file, + // assume it is the same here + if (model::mesh_map.find(id) != model::mesh_map.end()) { + warning(fmt::format("Mesh with ID={} appears in multiple files.", id)); + continue; } - // Map ID to position in vector - model::mesh_map[model::meshes.back()->id_] = model::meshes.size() - 1; + std::string name = fmt::format("mesh {}", id); + hid_t mesh_group = open_group(group, name.c_str()); + + std::string mesh_type; + if (object_exists(mesh_group, "type")) { + read_dataset(mesh_group, "type", mesh_type); + } else { + mesh_type = "regular"; + } + + // determine the mesh library to use + std::string mesh_lib; + if (object_exists(mesh_group, "library")) { + read_dataset(mesh_group, "library", mesh_lib); + } + + Mesh::create(mesh_group, mesh_type, mesh_lib); } } diff --git a/src/message_passing.cpp b/src/message_passing.cpp index 374c1aa72..a160f6d73 100644 --- a/src/message_passing.cpp +++ b/src/message_passing.cpp @@ -10,6 +10,7 @@ bool master {true}; #ifdef OPENMC_MPI MPI_Comm intracomm {MPI_COMM_NULL}; MPI_Datatype source_site {MPI_DATATYPE_NULL}; +MPI_Datatype collision_track_site {MPI_DATATYPE_NULL}; #endif extern "C" bool openmc_master() diff --git a/src/mgxs.cpp b/src/mgxs.cpp index eae3e5817..a2c479f21 100644 --- a/src/mgxs.cpp +++ b/src/mgxs.cpp @@ -99,7 +99,21 @@ void Mgxs::metadata_from_hdf5(hid_t xs_id, const vector& temperature, case TemperatureMethod::NEAREST: // Determine actual temperatures to read for (const auto& T : temperature) { - auto i_closest = xt::argmin(xt::abs(temps_available - T))[0]; + // Determine the closest temperature value + // NOTE: the below block could be replaced with the following line, + // though this gives a runtime error if using LLVM 20 or newer, + // likely due to a bug in xtensor. + // auto i_closest = xt::argmin(xt::abs(temps_available - T))[0]; + double closest = std::numeric_limits::max(); + int i_closest = 0; + for (int i = 0; i < temps_available.size(); i++) { + double diff = std::abs(temps_available[i] - T); + if (diff < closest) { + closest = diff; + i_closest = i; + } + } + double temp_actual = temps_available[i_closest]; if (std::fabs(temp_actual - T) < settings::temperature_tolerance) { if (std::find(temps_to_read.begin(), temps_to_read.end(), @@ -603,10 +617,12 @@ void Mgxs::calculate_xs(Particle& p) } int temperature = p.mg_xs_cache().t; int angle = p.mg_xs_cache().a; - p.macro_xs().total = xs[temperature].total(angle, p.g()); - p.macro_xs().absorption = xs[temperature].absorption(angle, p.g()); + p.macro_xs().total = xs[temperature].total(angle, p.g()) * p.density_mult(); + p.macro_xs().absorption = + xs[temperature].absorption(angle, p.g()) * p.density_mult(); p.macro_xs().nu_fission = - fissionable ? xs[temperature].nu_fission(angle, p.g()) : 0.; + fissionable ? xs[temperature].nu_fission(angle, p.g()) * p.density_mult() + : 0.; } //============================================================================== diff --git a/src/nuclide.cpp b/src/nuclide.cpp index eaac2f756..5ae6e30ee 100644 --- a/src/nuclide.cpp +++ b/src/nuclide.cpp @@ -31,8 +31,8 @@ namespace openmc { //============================================================================== namespace data { -array energy_min {0.0, 0.0}; -array energy_max {INFTY, INFTY}; +array energy_min {0.0, 0.0, 0.0, 0.0}; +array energy_max {INFTY, INFTY, INFTY, INFTY}; double temperature_min {INFTY}; double temperature_max {0.0}; std::unordered_map nuclide_map; @@ -1114,7 +1114,7 @@ extern "C" size_t nuclides_size() extern "C" int openmc_load_nuclide(const char* name, const double* temps, int n) { if (data::nuclide_map.find(name) == data::nuclide_map.end() || - data::nuclide_map.at(name) >= data::elements.size()) { + data::nuclide_map.at(name) >= data::nuclides.size()) { LibraryKey key {Library::Type::neutron, name}; const auto& it = data::library_map.find(key); if (it == data::library_map.end()) { @@ -1215,7 +1215,6 @@ extern "C" int openmc_nuclide_collapse_rate(int index, int MT, *xs = data::nuclides[index]->collapse_rate( MT, temperature, {energy, energy + n + 1}, {flux, flux + n}); } catch (const std::out_of_range& e) { - fmt::print("Caught error\n"); set_errmsg(e.what()); return OPENMC_E_OUT_OF_BOUNDS; } diff --git a/src/output.cpp b/src/output.cpp index e20868efb..80e2b10ab 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -177,25 +177,26 @@ void print_particle(Particle& p) for (auto i = 0; i < p.n_coord(); i++) { fmt::print(" Level {}\n", i); - if (p.coord(i).cell != C_NONE) { - const Cell& c {*model::cells[p.coord(i).cell]}; + if (p.coord(i).cell() != C_NONE) { + const Cell& c {*model::cells[p.coord(i).cell()]}; fmt::print(" Cell = {}\n", c.id_); } - if (p.coord(i).universe != C_NONE) { - const Universe& u {*model::universes[p.coord(i).universe]}; + if (p.coord(i).universe() != C_NONE) { + const Universe& u {*model::universes[p.coord(i).universe()]}; fmt::print(" Universe = {}\n", u.id_); } - if (p.coord(i).lattice != C_NONE) { - const Lattice& lat {*model::lattices[p.coord(i).lattice]}; + if (p.coord(i).lattice() != C_NONE) { + const Lattice& lat {*model::lattices[p.coord(i).lattice()]}; fmt::print(" Lattice = {}\n", lat.id_); - fmt::print(" Lattice position = ({},{},{})\n", p.coord(i).lattice_i[0], - p.coord(i).lattice_i[1], p.coord(i).lattice_i[2]); + fmt::print(" Lattice position = ({},{},{})\n", + p.coord(i).lattice_index()[0], p.coord(i).lattice_index()[1], + p.coord(i).lattice_index()[2]); } - fmt::print(" r = {}\n", p.coord(i).r); - fmt::print(" u = {}\n", p.coord(i).u); + fmt::print(" r = {}\n", p.coord(i).r()); + fmt::print(" u = {}\n", p.coord(i).u()); } // Display miscellaneous info. @@ -280,6 +281,7 @@ void print_usage() " -t, --track Write tracks for all particles (up to " "max_tracks)\n" " -e, --event Run using event-based parallelism\n" + " -q, --verbosity Output verbosity\n" " -v, --version Show version information\n" " -h, --help Show this message\n"); } @@ -322,10 +324,10 @@ void print_build_info() #ifdef OPENMC_MPI mpi = y; #endif -#ifdef DAGMC +#ifdef OPENMC_DAGMC_ENABLED dagmc = y; #endif -#ifdef LIBMESH +#ifdef OPENMC_LIBMESH_ENABLED libmesh = y; #endif #ifdef OPENMC_MCPL @@ -340,7 +342,7 @@ void print_build_info() #ifdef COVERAGEBUILD coverage = y; #endif -#ifdef OPENMC_UWUW +#ifdef OPENMC_UWUW_ENABLED uwuw = y; #endif @@ -593,6 +595,9 @@ const std::unordered_map score_names = { {SCORE_FISS_Q_RECOV, "Recoverable fission power"}, {SCORE_CURRENT, "Current"}, {SCORE_PULSE_HEIGHT, "pulse-height"}, + {SCORE_IFP_TIME_NUM, "IFP lifetime numerator"}, + {SCORE_IFP_BETA_NUM, "IFP delayed fraction numerator"}, + {SCORE_IFP_DENOM, "IFP common denominator"}, }; //! Create an ASCII output file showing all tally results. diff --git a/src/particle.cpp b/src/particle.cpp index c51011d6b..b9f9c8f86 100644 --- a/src/particle.cpp +++ b/src/particle.cpp @@ -8,6 +8,7 @@ #include "openmc/bank.h" #include "openmc/capi.h" #include "openmc/cell.h" +#include "openmc/collision_track.h" #include "openmc/constants.h" #include "openmc/dagmc.h" #include "openmc/error.h" @@ -32,7 +33,7 @@ #include "openmc/track_output.h" #include "openmc/weight_windows.h" -#ifdef DAGMC +#ifdef OPENMC_DAGMC_ENABLED #include "DagMC.hpp" #endif @@ -44,34 +45,30 @@ namespace openmc { double Particle::speed() const { - // Determine mass in eV/c^2 - double mass; - switch (this->type()) { - case ParticleType::neutron: - mass = MASS_NEUTRON_EV; - break; - case ParticleType::photon: - mass = 0.0; - break; - case ParticleType::electron: - case ParticleType::positron: - mass = MASS_ELECTRON_EV; - break; - } - - if (this->E() < 1.0e-9 * mass) { - // If the energy is much smaller than the mass, revert to non-relativistic - // formula. The 1e-9 criterion is specifically chosen as the point below - // which the error from using the non-relativistic formula is less than the - // round-off eror when using the relativistic formula (see analysis at - // https://gist.github.com/paulromano/da3b473fe3df33de94b265bdff0c7817) - return C_LIGHT * std::sqrt(2 * this->E() / mass); + if (settings::run_CE) { + // Determine mass in eV/c^2 + double mass; + switch (this->type()) { + case ParticleType::neutron: + mass = MASS_NEUTRON_EV; + break; + case ParticleType::photon: + mass = 0.0; + break; + case ParticleType::electron: + case ParticleType::positron: + mass = MASS_ELECTRON_EV; + break; + } + // Equivalent to C * sqrt(1-(m/(m+E))^2) without problem at E<E() * (this->E() + 2 * mass)) / + (this->E() + mass); } else { - // Calculate inverse of Lorentz factor - const double inv_gamma = mass / (this->E() + mass); - - // Calculate speed via v = c * sqrt(1 - γ^-2) - return C_LIGHT * std::sqrt(1 - inv_gamma * inv_gamma); + auto& macro_xs = data::mg.macro_xs_[this->material()]; + int macro_t = this->mg_xs_cache().t; + int macro_a = macro_xs.get_angle_index(this->u()); + return 1.0 / macro_xs.get_xs(MgxsType::INVERSE_VELOCITY, this->g(), nullptr, + nullptr, nullptr, macro_t, macro_a); } } @@ -104,6 +101,14 @@ void Particle::split(double wgt) bank.u = u(); bank.E = settings::run_CE ? E() : g(); bank.time = time(); + + // Convert signed index to a signed surface ID + if (surface() == SURFACE_NONE) { + bank.surf_id = SURFACE_NONE; + } else { + int surf_id = model::surfaces[surface_index()]->id_; + bank.surf_id = (surface() > 0) ? surf_id : -surf_id; + } } void Particle::from_source(const SourceSite* src) @@ -116,6 +121,10 @@ void Particle::from_source(const SourceSite* src) n_collision() = 0; fission() = false; zero_flux_derivs(); + lifetime() = 0.0; +#ifdef OPENMC_DAGMC_ENABLED + history().reset(); +#endif // Copy attributes from source bank site type() = src->particle; @@ -139,6 +148,13 @@ void Particle::from_source(const SourceSite* src) time() = src->time; time_last() = src->time; parent_nuclide() = src->parent_nuclide; + delayed_group() = src->delayed_group; + + // Convert signed surface ID to signed index + if (src->surf_id != SURFACE_NONE) { + int index_plus_one = model::surface_map[std::abs(src->surf_id)] + 1; + surface() = (src->surf_id > 0) ? index_plus_one : -index_plus_one; + } } void Particle::event_calculate_xs() @@ -161,7 +177,7 @@ void Particle::event_calculate_xs() // If the cell hasn't been determined based on the particle's location, // initiate a search for the current cell. This generally happens at the // beginning of the history and again for any secondary particles - if (lowest_coord().cell == C_NONE) { + if (lowest_coord().cell() == C_NONE) { if (!exhaustive_find_cell(*this)) { mark_as_lost( "Could not find the cell containing particle " + std::to_string(id())); @@ -170,11 +186,11 @@ void Particle::event_calculate_xs() // Set birth cell attribute if (cell_born() == C_NONE) - cell_born() = lowest_coord().cell; + cell_born() = lowest_coord().cell(); // Initialize last cells from current cell for (int j = 0; j < n_coord(); ++j) { - cell_last(j) = coord(j).cell; + cell_last(j) = coord(j).cell(); } n_coord_last() = n_coord(); } @@ -189,7 +205,8 @@ void Particle::event_calculate_xs() // Calculate microscopic and macroscopic cross sections if (material() != MATERIAL_VOID) { if (settings::run_CE) { - if (material() != material_last() || sqrtkT() != sqrtkT_last()) { + if (material() != material_last() || sqrtkT() != sqrtkT_last() || + density_mult() != density_mult_last()) { // If the material is the same as the last material and the // temperature hasn't changed, we don't need to lookup cross // sections again. @@ -219,34 +236,31 @@ void Particle::event_advance() // Sample a distance to collision if (type() == ParticleType::electron || type() == ParticleType::positron) { - collision_distance() = 0.0; + collision_distance() = material() == MATERIAL_VOID ? INFINITY : 0.0; } else if (macro_xs().total == 0.0) { collision_distance() = INFINITY; } else { collision_distance() = -std::log(prn(current_seed())) / macro_xs().total; } - // Select smaller of the two distances - double distance = std::min(boundary().distance, collision_distance()); + double speed = this->speed(); + double time_cutoff = settings::time_cutoff[static_cast(type())]; + double distance_cutoff = + (time_cutoff < INFTY) ? (time_cutoff - time()) * speed : INFTY; + + // Select smaller of the three distances + double distance = + std::min({boundary().distance(), collision_distance(), distance_cutoff}); // Advance particle in space and time - // Short-term solution until the surface source is revised and we can use - // this->move_distance(distance) - for (int j = 0; j < n_coord(); ++j) { - coord(j).r += distance * coord(j).u; - } - this->time() += distance / this->speed(); + this->move_distance(distance); + double dt = distance / speed; + this->time() += dt; + this->lifetime() += dt; - // Kill particle if its time exceeds the cutoff - bool hit_time_boundary = false; - double time_cutoff = settings::time_cutoff[static_cast(type())]; - if (time() > time_cutoff) { - double dt = time() - time_cutoff; - time() = time_cutoff; - - double push_back_distance = speed() * dt; - this->move_distance(-push_back_distance); - hit_time_boundary = true; + // Score timed track-length tallies + if (!model::active_timed_tracklength_tallies.empty()) { + score_timed_tracklength_tally(*this, distance); } // Score track-length tallies @@ -266,7 +280,7 @@ void Particle::event_advance() } // Set particle weight to zero if it hit the time boundary - if (hit_time_boundary) { + if (distance == distance_cutoff) { wgt() = 0.0; } } @@ -275,17 +289,17 @@ void Particle::event_cross_surface() { // Saving previous cell data for (int j = 0; j < n_coord(); ++j) { - cell_last(j) = coord(j).cell; + cell_last(j) = coord(j).cell(); } n_coord_last() = n_coord(); // Set surface that particle is on and adjust coordinate levels - surface() = boundary().surface; - n_coord() = boundary().coord_level; + surface() = boundary().surface(); + n_coord() = boundary().coord_level(); - if (boundary().lattice_translation[0] != 0 || - boundary().lattice_translation[1] != 0 || - boundary().lattice_translation[2] != 0) { + if (boundary().lattice_translation()[0] != 0 || + boundary().lattice_translation()[1] != 0 || + boundary().lattice_translation()[2] != 0) { // Particle crosses lattice boundary bool verbose = settings::verbosity >= 10 || trace(); @@ -338,6 +352,11 @@ void Particle::event_collide() collision_mg(*this); } + // Collision track feature to recording particle interaction + if (settings::collision_track) { + collision_track_record(*this); + } + // Score collision estimator tallies -- this is done after a collision // has occurred rather than before because we need information on the // outgoing energy for any tallies with an outgoing energy filter @@ -375,14 +394,14 @@ void Particle::event_collide() // Set all directions to base level -- right now, after a collision, only // the base level directions are changed for (int j = 0; j < n_coord() - 1; ++j) { - if (coord(j + 1).rotated) { + if (coord(j + 1).rotated()) { // If next level is rotated, apply rotation matrix - const auto& m {model::cells[coord(j).cell]->rotation_}; - const auto& u {coord(j).u}; - coord(j + 1).u = u.rotate(m); + const auto& m {model::cells[coord(j).cell()]->rotation_}; + const auto& u {coord(j).u()}; + coord(j + 1).u() = u.rotate(m); } else { // Otherwise, copy this level's direction - coord(j + 1).u = coord(j).u; + coord(j + 1).u() = coord(j).u(); } } @@ -390,7 +409,7 @@ void Particle::event_collide() if (!model::active_tallies.empty()) score_collision_derivative(*this); -#ifdef DAGMC +#ifdef OPENMC_DAGMC_ENABLED history().reset(); #endif } @@ -427,7 +446,7 @@ void Particle::event_revive_from_secondary() // Since the birth cell of the particle has not been set we // have to determine it before the energy of the secondary particle can be // removed from the pulse-height of this cell. - if (lowest_coord().cell == C_NONE) { + if (lowest_coord().cell() == C_NONE) { bool verbose = settings::verbosity >= 10 || trace(); if (!exhaustive_find_cell(*this, verbose)) { mark_as_lost("Could not find the cell containing particle " + @@ -436,11 +455,11 @@ void Particle::event_revive_from_secondary() } // Set birth cell attribute if (cell_born() == C_NONE) - cell_born() = lowest_coord().cell; + cell_born() = lowest_coord().cell(); // Initialize last cells from current cell for (int j = 0; j < n_coord(); ++j) { - cell_last(j) = coord(j).cell; + cell_last(j) = coord(j).cell(); } n_coord_last() = n_coord(); } @@ -455,7 +474,7 @@ void Particle::event_revive_from_secondary() void Particle::event_death() { -#ifdef DAGMC +#ifdef OPENMC_DAGMC_ENABLED history().reset(); #endif @@ -498,7 +517,7 @@ void Particle::pht_collision_energy() // determine index of cell in pulse_height_cells auto it = std::find(model::pulse_height_cells.begin(), - model::pulse_height_cells.end(), lowest_coord().cell); + model::pulse_height_cells.end(), lowest_coord().cell()); if (it != model::pulse_height_cells.end()) { int index = std::distance(model::pulse_height_cells.begin(), it); @@ -535,13 +554,14 @@ void Particle::cross_surface(const Surface& surf) } // if we're crossing a CSG surface, make sure the DAG history is reset -#ifdef DAGMC +#ifdef OPENMC_DAGMC_ENABLED if (surf.geom_type() == GeometryType::CSG) history().reset(); #endif // Handle any applicable boundary conditions. - if (surf.bc_ && settings::run_mode != RunMode::PLOTTING) { + if (surf.bc_ && settings::run_mode != RunMode::PLOTTING && + settings::run_mode != RunMode::VOLUME) { surf.bc_->handle_particle(*this, surf); return; } @@ -549,17 +569,18 @@ void Particle::cross_surface(const Surface& surf) // ========================================================================== // SEARCH NEIGHBOR LISTS FOR NEXT CELL -#ifdef DAGMC +#ifdef OPENMC_DAGMC_ENABLED // in DAGMC, we know what the next cell should be if (surf.geom_type() == GeometryType::DAG) { int32_t i_cell = next_cell(surface_index(), cell_last(n_coord() - 1), - lowest_coord().universe) - + lowest_coord().universe()) - 1; - // save material and temp + // save material, temperature, and density multiplier material_last() = material(); sqrtkT_last() = sqrtkT(); + density_mult_last() = density_mult(); // set new cell value - lowest_coord().cell = i_cell; + lowest_coord().cell() = i_cell; auto& cell = model::cells[i_cell]; cell_instance() = 0; @@ -568,6 +589,7 @@ void Particle::cross_surface(const Surface& surf) material() = cell->material(cell_instance()); sqrtkT() = cell->sqrtkT(cell_instance()); + density_mult() = cell->density_mult(cell_instance()); return; } #endif @@ -663,7 +685,7 @@ void Particle::cross_reflective_bc(const Surface& surf, Direction new_u) u() = new_u; // Reassign particle's cell and surface - coord(0).cell = cell_last(0); + coord(0).cell() = cell_last(0); surface() = -surface(); // If a reflective surface is coincident with a lattice or universe @@ -722,9 +744,7 @@ void Particle::cross_periodic_bc( if (!neighbor_list_find_cell(*this)) { mark_as_lost("Couldn't find particle after hitting periodic " "boundary on surface " + - std::to_string(surf.id_) + - ". The normal vector " - "of one periodic surface may need to be reversed."); + std::to_string(surf.id_) + "."); return; } @@ -842,10 +862,12 @@ void Particle::update_neutron_xs( // If the cache doesn't match, recalculate micro xs if (this->E() != micro.last_E || this->sqrtkT() != micro.last_sqrtkT || - i_sab != micro.index_sab || sab_frac != micro.sab_frac) { + i_sab != micro.index_sab || sab_frac != micro.sab_frac || + ncrystal_xs != micro.ncrystal_xs) { data::nuclides[i_nuclide]->calculate_xs(i_sab, i_grid, sab_frac, *this); // If NCrystal is being used, update micro cross section cache + micro.ncrystal_xs = ncrystal_xs; if (ncrystal_xs >= 0.0) { data::nuclides[i_nuclide]->calculate_elastic_xs(*this); ncrystal_update_micro(ncrystal_xs, micro); @@ -924,7 +946,7 @@ void add_surf_source_to_bank(Particle& p, const Surface& surf) // Check if the cell of interest has been entered bool entered = false; for (int i = 0; i < p.n_coord(); ++i) { - if (p.coord(i).cell == cell_idx) { + if (p.coord(i).cell() == cell_idx) { entered = true; } } diff --git a/src/particle_data.cpp b/src/particle_data.cpp index fef8359a3..370ca12e4 100644 --- a/src/particle_data.cpp +++ b/src/particle_data.cpp @@ -32,20 +32,20 @@ void GeometryState::mark_as_lost(const std::stringstream& message) void LocalCoord::rotate(const vector& rotation) { - r = r.rotate(rotation); - u = u.rotate(rotation); - rotated = true; + r_ = r_.rotate(rotation); + u_ = u_.rotate(rotation); + rotated_ = true; } void LocalCoord::reset() { - cell = C_NONE; - universe = C_NONE; - lattice = C_NONE; - lattice_i[0] = 0; - lattice_i[1] = 0; - lattice_i[2] = 0; - rotated = false; + cell_ = C_NONE; + universe_ = C_NONE; + lattice_ = C_NONE; + lattice_index_[0] = 0; + lattice_index_[1] = 0; + lattice_index_[2] = 0; + rotated_ = false; } GeometryState::GeometryState() @@ -64,29 +64,29 @@ void GeometryState::advance_to_boundary_from_void() for (auto c_i : root_universe->cells_) { auto dist = - model::cells.at(c_i)->distance(root_coord.r, root_coord.u, 0, this); - if (dist.first < boundary().distance) { - boundary().distance = dist.first; - boundary().surface = dist.second; + model::cells.at(c_i)->distance(root_coord.r(), root_coord.u(), 0, this); + if (dist.first < boundary().distance()) { + boundary().distance() = dist.first; + boundary().surface() = dist.second; } } // if no intersection or near-infinite intersection, reset // boundary information - if (boundary().distance > 1e300) { - boundary().distance = INFTY; - boundary().surface = SURFACE_NONE; + if (boundary().distance() > 1e300) { + boundary().distance() = INFTY; + boundary().surface() = SURFACE_NONE; return; } // move the particle up to (and just past) the boundary - move_distance(boundary().distance + TINY_BIT); + move_distance(boundary().distance() + TINY_BIT); } void GeometryState::move_distance(double length) { for (int j = 0; j < n_coord(); ++j) { - coord(j).r += length * coord(j).u; + coord(j).r() += length * coord(j).u(); } } @@ -123,7 +123,7 @@ TrackState ParticleData::get_track_state() const state.E = this->E(); state.time = this->time(); state.wgt = this->wgt(); - state.cell_id = model::cells[this->lowest_coord().cell]->id_; + state.cell_id = model::cells[this->lowest_coord().cell()]->id_; state.cell_instance = this->cell_instance(); if (this->material() != MATERIAL_VOID) { state.material_id = model::materials[material()]->id_; diff --git a/src/photon.cpp b/src/photon.cpp index 4b2fb4197..4926e3eae 100644 --- a/src/photon.cpp +++ b/src/photon.cpp @@ -165,7 +165,6 @@ PhotonInteraction::PhotonInteraction(hid_t group) 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 @@ -233,6 +232,28 @@ PhotonInteraction::PhotonInteraction(hid_t group) } close_group(rgroup); + // Map Compton subshell data to atomic relaxation data by finding the + // subshell with the equivalent binding energy + if (has_atomic_relaxation_) { + auto is_close = [](double a, double b) { + return std::abs(a - b) / a < FP_REL_PRECISION; + }; + subshell_map_ = xt::full_like(binding_energy_, -1); + for (int i = 0; i < binding_energy_.size(); ++i) { + double E_b = binding_energy_[i]; + if (i < n_shell && is_close(E_b, shells_[i].binding_energy)) { + subshell_map_[i] = i; + } else { + for (int j = 0; j < n_shell; ++j) { + if (is_close(E_b, shells_[j].binding_energy)) { + subshell_map_[i] = j; + break; + } + } + } + } + } + // Create Compton profile CDF auto n_profile = data::compton_profile_pz.size(); auto n_shell_compton = profile_pdf_.shape(0); @@ -423,13 +444,6 @@ void PhotonInteraction::compton_scatter(double alpha, bool doppler, double E_out; this->compton_doppler(alpha, *mu, &E_out, i_shell, seed); *alpha_out = E_out / MASS_ELECTRON_EV; - - // It's possible for the Compton profile data to have more shells than - // there are in the ENDF data. Make sure the shell index doesn't end up - // out of bounds. - if (*i_shell >= shells_.size()) { - *i_shell = -1; - } } else { *i_shell = -1; } @@ -770,8 +784,9 @@ 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 if no atomic relaxation data is present or if the binding energy is + // larger than the incident particle energy + if (!has_atomic_relaxation_ || shells_[i_shell].binding_energy > p.E()) return; // Stack for unprocessed holes left by transitioning electrons diff --git a/src/physics.cpp b/src/physics.cpp index 72c04a5ca..41509af97 100644 --- a/src/physics.cpp +++ b/src/physics.cpp @@ -8,6 +8,7 @@ #include "openmc/eigenvalue.h" #include "openmc/endf.h" #include "openmc/error.h" +#include "openmc/ifp.h" #include "openmc/material.h" #include "openmc/math_functions.h" #include "openmc/message_passing.h" @@ -114,13 +115,14 @@ void sample_neutron_reaction(Particle& p) // Make sure particle population doesn't grow out of control for // subcritical multiplication problems. - if (p.secondary_bank().size() >= 10000) { + if (p.secondary_bank().size() >= settings::max_secondaries) { fatal_error( "The secondary particle bank appears to be growing without " "bound. You are likely running a subcritical multiplication problem " "with k-effective close to or greater than one."); } } + p.event_mt() = rx.mt_; } // Create secondary photons @@ -209,13 +211,23 @@ void create_fission_sites(Particle& p, int i_nuclide, const Reaction& rx) site.particle = ParticleType::neutron; site.time = p.time(); site.wgt = 1. / weight; - site.parent_id = p.id(); - site.progeny_id = p.n_progeny()++; site.surf_id = 0; // Sample delayed group and angle/energy for fission reaction sample_fission_neutron(i_nuclide, rx, &site, p); + // Reject site if it exceeds time cutoff + if (site.delayed_group > 0) { + double t_cutoff = settings::time_cutoff[static_cast(site.particle)]; + if (site.time > t_cutoff) { + continue; + } + } + + // Set parent and progeny IDs + site.parent_id = p.id(); + site.progeny_id = p.n_progeny()++; + // Store fission site in bank if (use_fission_bank) { int64_t idx = simulation::fission_bank.thread_safe_append(site); @@ -233,16 +245,17 @@ void create_fission_sites(Particle& p, int i_nuclide, const Reaction& rx) // Break out of loop as no more sites can be added to fission bank break; } + // Iterated Fission Probability (IFP) method + if (settings::ifp_on) { + ifp(p, idx); + } } else { p.secondary_bank().push_back(site); } - // Set the delayed group on the particle as well - p.delayed_group() = site.delayed_group; - // Increment the number of neutrons born delayed - if (p.delayed_group() > 0) { - nu_d[p.delayed_group() - 1]++; + if (site.delayed_group > 0) { + nu_d[site.delayed_group - 1]++; } // Write fission particles to nuBank @@ -335,11 +348,11 @@ void sample_photon_reaction(Particle& p) p.create_secondary(p.wgt(), u, E_electron, ParticleType::electron); } - // TODO: Compton subshell data does not match atomic relaxation data - // Allow electrons to fill orbital and produce auger electrons - // and fluorescent photons - if (i_shell >= 0) { - element.atomic_relaxation(i_shell, p); + // Allow electrons to fill orbital and produce Auger electrons and + // fluorescent photons. Since Compton subshell data does not match atomic + // relaxation data, use the mapping between the data to find the subshell + if (i_shell >= 0 && element.subshell_map_[i_shell] >= 0) { + element.atomic_relaxation(element.subshell_map_[i_shell], p); } phi += PI; @@ -491,7 +504,7 @@ int sample_nuclide(Particle& p) for (int i = 0; i < n; ++i) { // Get atom density int i_nuclide = mat->nuclide_[i]; - double atom_density = mat->atom_density_[i]; + double atom_density = mat->atom_density(i, p.density_mult()); // Increment probability to compare to cutoff prob += atom_density * p.neutron_xs(i_nuclide).total; @@ -516,7 +529,7 @@ int sample_element(Particle& p) for (int i = 0; i < mat->element_.size(); ++i) { // Find atom density int i_element = mat->element_[i]; - double atom_density = mat->atom_density_[i]; + double atom_density = mat->atom_density(i, p.density_mult()); // Determine microscopic cross section double sigma = atom_density * p.photon_xs(i_element).total; @@ -651,7 +664,9 @@ void absorption(Particle& p, int i_nuclide) p.wgt() = 0.0; p.event() = TallyEvent::ABSORB; - p.event_mt() = N_DISAPPEAR; + if (!p.fission()) { + p.event_mt() = N_DISAPPEAR; + } } } } @@ -839,7 +854,7 @@ Direction sample_target_velocity(const Nuclide& nuc, double E, Direction u, // otherwise, use free gas model } else { - if (E >= FREE_GAS_THRESHOLD * kT && nuc.awr_ > 1.0) { + if (E >= settings::free_gas_threshold * kT && nuc.awr_ > 1.0) { return {}; } else { sampling_method = ResScatMethod::cxs; @@ -1064,6 +1079,10 @@ void sample_fission_neutron( // set the delayed group for the particle born from fission site->delayed_group = group; + // Sample time of emission based on decay constant of precursor + double decay_rate = rx.products_[site->delayed_group].decay_rate_; + site->time -= std::log(prn(p.current_seed())) / decay_rate; + } else { // ==================================================================== // PROMPT NEUTRON SAMPLED diff --git a/src/physics_mg.cpp b/src/physics_mg.cpp index c97a3d6f3..4c28cb179 100644 --- a/src/physics_mg.cpp +++ b/src/physics_mg.cpp @@ -137,9 +137,8 @@ void create_fission_sites(Particle& p) SourceSite site; site.r = p.r(); site.particle = ParticleType::neutron; + site.time = p.time(); site.wgt = 1. / weight; - site.parent_id = p.id(); - site.progeny_id = p.n_progeny()++; // Sample the cosine of the angle, assuming fission neutrons are emitted // isotropically @@ -164,6 +163,24 @@ void create_fission_sites(Particle& p) // of the code, 0 is prompt. site.delayed_group = dg + 1; + // If delayed product production, sample time of emission + if (dg != -1) { + auto& macro_xs = data::mg.macro_xs_[p.material()]; + double decay_rate = + macro_xs.get_xs(MgxsType::DECAY_RATE, 0, nullptr, nullptr, &dg, 0, 0); + site.time -= std::log(prn(p.current_seed())) / decay_rate; + + // Reject site if it exceeds time cutoff + double t_cutoff = settings::time_cutoff[static_cast(site.particle)]; + if (site.time > t_cutoff) { + continue; + } + } + + // Set parent and progeny ID + site.parent_id = p.id(); + site.progeny_id = p.n_progeny()++; + // Store fission site in bank if (use_fission_bank) { int64_t idx = simulation::fission_bank.thread_safe_append(site); diff --git a/src/plot.cpp b/src/plot.cpp index dbc25b21e..2cadc48ce 100644 --- a/src/plot.cpp +++ b/src/plot.cpp @@ -54,14 +54,14 @@ void IdData::set_value(size_t y, size_t x, const GeometryState& p, int level) data_(y, x, 0) = NOT_FOUND; data_(y, x, 1) = NOT_FOUND; } else { - data_(y, x, 0) = model::cells.at(p.coord(level).cell)->id_; + data_(y, x, 0) = model::cells.at(p.coord(level).cell())->id_; data_(y, x, 1) = level == p.n_coord() - 1 ? p.cell_instance() : cell_instance_at_level(p, level); } // set material data - Cell* c = model::cells.at(p.lowest_coord().cell).get(); + Cell* c = model::cells.at(p.lowest_coord().cell()).get(); if (p.material() == MATERIAL_VOID) { data_(y, x, 2) = MATERIAL_VOID; return; @@ -83,7 +83,7 @@ PropertyData::PropertyData(size_t h_res, size_t v_res) void PropertyData::set_value( size_t y, size_t x, const GeometryState& p, int level) { - Cell* c = model::cells.at(p.lowest_coord().cell).get(); + Cell* c = model::cells.at(p.lowest_coord().cell()).get(); data_(y, x, 0) = (p.sqrtkT() * p.sqrtkT()) / K_BOLTZMANN; if (c->type_ != Fill::UNIVERSE && p.material() != MATERIAL_VOID) { Material* m = model::materials.at(p.material()).get(); @@ -1634,7 +1634,7 @@ void Ray::trace() break; // if there is no intersection with the model, we're done - if (boundary().surface == SURFACE_NONE) + if (boundary().surface() == SURFACE_NONE) return; event_counter_++; @@ -1646,10 +1646,10 @@ void Ray::trace() // Call the specialized logic for this type of ray. This is for the // intersection for the first intersection if we had one. - if (boundary().surface != SURFACE_NONE) { + if (boundary().surface() != SURFACE_NONE) { // set the geometry state's surface attribute to be used for // surface normal computation - surface() = boundary().surface; + surface() = boundary().surface(); on_intersection(); if (stop_) return; @@ -1674,37 +1674,37 @@ void Ray::trace() // if we hit the edge of the model, so stop // the particle in that case. Also, just exit // if a negative distance was somehow computed. - if (boundary().distance == INFTY || boundary().distance == INFINITY || - boundary().distance < 0) { + if (boundary().distance() == INFTY || boundary().distance() == INFINITY || + boundary().distance() < 0) { return; } // See below comment where call_on_intersection is checked in an // if statement for an explanation of this. bool call_on_intersection {true}; - if (boundary().distance < 10 * TINY_BIT) { + if (boundary().distance() < 10 * TINY_BIT) { call_on_intersection = false; } // DAGMC surfaces expect us to go a little bit further than the advance // distance to properly check cell inclusion. - boundary().distance += TINY_BIT; + boundary().distance() += TINY_BIT; // Advance particle, prepare for next intersection for (int lev = 0; lev < n_coord(); ++lev) { - coord(lev).r += boundary().distance * coord(lev).u; + coord(lev).r() += boundary().distance() * coord(lev).u(); } - surface() = boundary().surface; + surface() = boundary().surface(); n_coord_last() = n_coord(); - n_coord() = boundary().coord_level; - if (boundary().lattice_translation[0] != 0 || - boundary().lattice_translation[1] != 0 || - boundary().lattice_translation[2] != 0) { + n_coord() = boundary().coord_level(); + if (boundary().lattice_translation()[0] != 0 || + boundary().lattice_translation()[1] != 0 || + boundary().lattice_translation()[2] != 0) { cross_lattice(*this, boundary(), settings::verbosity >= 10); } // Record how far the ray has traveled - traversal_distance_ += boundary().distance; + traversal_distance_ += boundary().distance(); inside_cell = neighbor_list_find_cell(*this, settings::verbosity >= 10); // Call the specialized logic for this type of ray. Note that we do not @@ -1743,7 +1743,7 @@ void ProjectionRay::on_intersection() line_segments_.emplace_back( plot_.color_by_ == PlottableInterface::PlotColorBy::mats ? material() - : lowest_coord().cell, + : lowest_coord().cell(), traversal_distance_, boundary().surface_index()); } @@ -1752,7 +1752,7 @@ void PhongRay::on_intersection() // Check if we hit an opaque material or cell int hit_id = plot_.color_by_ == PlottableInterface::PlotColorBy::mats ? material() - : lowest_coord().cell; + : lowest_coord().cell(); // If we are reflected and have advanced beyond the camera, // the ray is done. This is checked here because we should @@ -1798,8 +1798,8 @@ void PhongRay::on_intersection() // Need to apply translations to find the normal vector in // the base level universe's coordinate system. for (int lev = n_coord() - 2; lev >= 0; --lev) { - if (coord(lev + 1).rotated) { - const Cell& c {*model::cells[coord(lev).cell]}; + if (coord(lev + 1).rotated()) { + const Cell& c {*model::cells[coord(lev).cell()]}; normal = normal.inverse_rotate(c.rotation_); } } diff --git a/src/random_ray/flat_source_domain.cpp b/src/random_ray/flat_source_domain.cpp index 33651574f..ec14795dd 100644 --- a/src/random_ray/flat_source_domain.cpp +++ b/src/random_ray/flat_source_domain.cpp @@ -30,6 +30,7 @@ RandomRayVolumeEstimator FlatSourceDomain::volume_estimator_ { RandomRayVolumeEstimator::HYBRID}; bool FlatSourceDomain::volume_normalized_flux_tallies_ {false}; bool FlatSourceDomain::adjoint_ {false}; +double FlatSourceDomain::diagonal_stabilization_rho_ {1.0}; std::unordered_map>> FlatSourceDomain::mesh_domain_map_; @@ -45,31 +46,13 @@ FlatSourceDomain::FlatSourceDomain() : negroups_(data::mg.num_energy_groups_) source_region_offsets_.push_back(-1); } else { source_region_offsets_.push_back(base_source_regions); - base_source_regions += c->n_instances_; + base_source_regions += c->n_instances(); } } // Initialize source regions. bool is_linear = RandomRay::source_shape_ != RandomRaySourceShape::FLAT; source_regions_ = SourceRegionContainer(negroups_, is_linear); - source_regions_.assign( - base_source_regions, SourceRegion(negroups_, is_linear)); - - // Initialize materials - int64_t source_region_id = 0; - for (int i = 0; i < model::cells.size(); i++) { - Cell& cell = *model::cells[i]; - if (cell.type_ == Fill::MATERIAL) { - for (int j = 0; j < cell.n_instances_; j++) { - source_regions_.material(source_region_id++) = cell.material(j); - } - } - } - - // Sanity check - if (source_region_id != base_source_regions) { - fatal_error("Unexpected number of source regions"); - } // Initialize tally volumes if (volume_normalized_flux_tallies_) { @@ -117,54 +100,58 @@ void FlatSourceDomain::accumulate_iteration_flux() } } -// Compute new estimate of scattering + fission sources in each source region -// based on the flux estimate from the previous iteration. -void FlatSourceDomain::update_neutron_source(double k_eff) +void FlatSourceDomain::update_single_neutron_source(SourceRegionHandle& srh) { - simulation::time_update_src.start(); - - double inverse_k_eff = 1.0 / k_eff; - -// Reset all source regions to zero (important for void regions) -#pragma omp parallel for - for (int64_t se = 0; se < n_source_elements(); se++) { - source_regions_.source(se) = 0.0; + // Reset all source regions to zero (important for void regions) + for (int g = 0; g < negroups_; g++) { + srh.source(g) = 0.0; } // Add scattering + fission source -#pragma omp parallel for - for (int64_t sr = 0; sr < n_source_regions(); sr++) { - int material = source_regions_.material(sr); - if (material == MATERIAL_VOID) { - continue; - } + int material = srh.material(); + if (material != MATERIAL_VOID) { + double inverse_k_eff = 1.0 / k_eff_; for (int g_out = 0; g_out < negroups_; g_out++) { double sigma_t = sigma_t_[material * negroups_ + g_out]; double scatter_source = 0.0; double fission_source = 0.0; for (int g_in = 0; g_in < negroups_; g_in++) { - double scalar_flux = source_regions_.scalar_flux_old(sr, g_in); + double scalar_flux = srh.scalar_flux_old(g_in); double sigma_s = sigma_s_[material * negroups_ * negroups_ + g_out * negroups_ + g_in]; double nu_sigma_f = nu_sigma_f_[material * negroups_ + g_in]; double chi = chi_[material * negroups_ + g_out]; scatter_source += sigma_s * scalar_flux; - fission_source += nu_sigma_f * scalar_flux * chi; + if (settings::create_fission_neutrons) { + fission_source += nu_sigma_f * scalar_flux * chi; + } } - source_regions_.source(sr, g_out) = + srh.source(g_out) = (scatter_source + fission_source * inverse_k_eff) / sigma_t; } } // Add external source if in fixed source mode if (settings::run_mode == RunMode::FIXED_SOURCE) { -#pragma omp parallel for - for (int64_t se = 0; se < n_source_elements(); se++) { - source_regions_.source(se) += source_regions_.external_source(se); + for (int g = 0; g < negroups_; g++) { + srh.source(g) += srh.external_source(g); } } +} + +// Compute new estimate of scattering + fission sources in each source region +// based on the flux estimate from the previous iteration. +void FlatSourceDomain::update_all_neutron_sources() +{ + simulation::time_update_src.start(); + +#pragma omp parallel for + for (int64_t sr = 0; sr < n_source_regions(); sr++) { + SourceRegionHandle srh = source_regions_.get_source_region_handle(sr); + update_single_neutron_source(srh); + } simulation::time_update_src.stop(); } @@ -205,9 +192,11 @@ void FlatSourceDomain::set_flux_to_flux_plus_source( int material = source_regions_.material(sr); if (material == MATERIAL_VOID) { source_regions_.scalar_flux_new(sr, g) /= volume; - source_regions_.scalar_flux_new(sr, g) += - 0.5f * source_regions_.external_source(sr, g) * - source_regions_.volume_sq(sr); + if (settings::run_mode == RunMode::FIXED_SOURCE) { + source_regions_.scalar_flux_new(sr, g) += + 0.5f * source_regions_.external_source(sr, g) * + source_regions_.volume_sq(sr); + } } else { double sigma_t = sigma_t_[source_regions_.material(sr) * negroups_ + g]; source_regions_.scalar_flux_new(sr, g) /= (sigma_t * volume); @@ -295,12 +284,19 @@ int64_t FlatSourceDomain::add_source_to_scalar_flux() // in the cell we will use the previous iteration's flux estimate. This // injects a small degree of correlation into the simulation, but this // is going to be trivial when the miss rate is a few percent or less. - if (source_regions_.external_source_present(sr) && !adjoint_) { + if (source_regions_.external_source_present(sr)) { set_flux_to_old_flux(sr, g); } else { set_flux_to_source(sr, g); } } + // Halt if NaN implosion is detected + if (!std::isfinite(source_regions_.scalar_flux_new(sr, g))) { + fatal_error("A source region scalar flux is not finite. " + "This indicates a numerical instability in the " + "simulation. Consider increasing ray density or adjusting " + "the source region mesh."); + } } } @@ -310,7 +306,7 @@ int64_t FlatSourceDomain::add_source_to_scalar_flux() // Generates new estimate of k_eff based on the differences between this // iteration's estimate of the scalar flux and the last iteration's estimate. -double FlatSourceDomain::compute_k_eff(double k_eff_old) const +void FlatSourceDomain::compute_k_eff() { double fission_rate_old = 0; double fission_rate_new = 0; @@ -355,7 +351,7 @@ double FlatSourceDomain::compute_k_eff(double k_eff_old) const p[sr] = sr_fission_source_new; } - double k_eff_new = k_eff_old * (fission_rate_new / fission_rate_old); + double k_eff_new = k_eff_ * (fission_rate_new / fission_rate_old); double H = 0.0; // defining an inverse sum for better performance @@ -375,7 +371,8 @@ double FlatSourceDomain::compute_k_eff(double k_eff_old) const // Adds entropy value to shared entropy vector in openmc namespace. simulation::entropy.push_back(H); - return k_eff_new; + fission_rate_ = fission_rate_new; + k_eff_ = k_eff_new; } // This function is responsible for generating a mapping between random @@ -411,7 +408,12 @@ double FlatSourceDomain::compute_k_eff(double k_eff_old) const // be passed back to the caller to alert them that this function doesn't // need to be called for the remainder of the simulation. -void FlatSourceDomain::convert_source_regions_to_tallies() +// It takes as an argument the starting index in the source region array, +// and it will operate from that index until the end of the array. This +// is useful as it can be called for both explicit user source regions or +// when a source region mesh is overlaid. + +void FlatSourceDomain::convert_source_regions_to_tallies(int64_t start_sr_id) { openmc::simulation::time_tallies.start(); @@ -420,7 +422,7 @@ void FlatSourceDomain::convert_source_regions_to_tallies() // Attempt to generate mapping for all source regions #pragma omp parallel for - for (int64_t sr = 0; sr < n_source_regions(); sr++) { + for (int64_t sr = start_sr_id; sr < n_source_regions(); sr++) { // If this source region has not been hit by a ray yet, then // we aren't going to be able to map it, so skip it. @@ -458,7 +460,7 @@ void FlatSourceDomain::convert_source_regions_to_tallies() // Loop over all active tallies. This logic is essentially identical // to what happens when scanning for applicable tallies during // MC transport. - for (auto i_tally : model::active_tallies) { + for (int i_tally = 0; i_tally < model::tallies.size(); i_tally++) { Tally& tally {*model::tallies[i_tally]}; // Initialize an iterator over valid filter bin combinations. @@ -520,12 +522,33 @@ void FlatSourceDomain::reset_tally_volumes() // simulation double FlatSourceDomain::compute_fixed_source_normalization_factor() const { - // If we are not in fixed source mode, then there are no external sources - // so no normalization is needed. - if (settings::run_mode != RunMode::FIXED_SOURCE || adjoint_) { + // Eigenvalue mode normalization + if (settings::run_mode == RunMode::EIGENVALUE) { + // Normalize fluxes by total number of fission neutrons produced. This + // ensures consistent scaling of the eigenvector such that its magnitude is + // comparable to the eigenvector produced by the Monte Carlo solver. + // Multiplying by the eigenvalue is unintuitive, but it is necessary. + // If the eigenvalue is 1.2, per starting source neutron, you will + // generate 1.2 neutrons. Thus if we normalize to generating only ONE + // neutron in total for the whole domain, then we don't actually have enough + // flux to generate the required 1.2 neutrons. We only know the flux + // required to generate 1 neutron (which would have required less than one + // starting neutron). Thus, you have to scale the flux up by the eigenvalue + // such that 1.2 neutrons are generated, so as to be consistent with the + // bookkeeping in MC which is all done per starting source neutron (not per + // neutron produced). + return k_eff_ / (fission_rate_ * simulation_volume_); + } + + // If we are in adjoint mode of a fixed source problem, the external + // source is already normalized, such that all resulting fluxes are + // also normalized. + if (adjoint_) { return 1.0; } + // Fixed source mode normalization + // Step 1 is to sum over all source regions and energy groups to get the // total external source strength in the simulation. double simulation_external_source_strength = 0.0; @@ -637,7 +660,6 @@ void FlatSourceDomain::random_ray_tally() "random ray mode."); break; } - // Apply score to the appropriate tally bin Tally& tally {*model::tallies[task.tally_idx]}; #pragma omp atomic @@ -711,21 +733,21 @@ void FlatSourceDomain::output_to_vtk() const print_plot(); // Outer loop over plots - for (int p = 0; p < model::plots.size(); p++) { + for (int plt = 0; plt < model::plots.size(); plt++) { // Get handle to OpenMC plot object and extract params - Plot* openmc_plot = dynamic_cast(model::plots[p].get()); + Plot* openmc_plot = dynamic_cast(model::plots[plt].get()); // Random ray plots only support voxel plots if (!openmc_plot) { warning(fmt::format("Plot {} is invalid plot type -- only voxel plotting " "is allowed in random ray mode.", - p)); + plt)); continue; } else if (openmc_plot->type_ != Plot::PlotType::voxel) { warning(fmt::format("Plot {} is invalid plot type -- only voxel plotting " "is allowed in random ray mode.", - p)); + plt)); continue; } @@ -779,23 +801,11 @@ void FlatSourceDomain::output_to_vtk() const continue; } - int i_cell = p.lowest_coord().cell; - int64_t sr = source_region_offsets_[i_cell] + p.cell_instance(); - if (RandomRay::mesh_subdivision_enabled_) { - int mesh_idx = base_source_regions_.mesh(sr); - int mesh_bin; - if (mesh_idx == C_NONE) { - mesh_bin = 0; - } else { - mesh_bin = model::meshes[mesh_idx]->get_bin(p.r()); - } - SourceRegionKey sr_key {sr, mesh_bin}; - auto it = source_region_map_.find(sr_key); - if (it != source_region_map_.end()) { - sr = it->second; - } else { - sr = -1; - } + SourceRegionKey sr_key = lookup_source_region_key(p); + int64_t sr = -1; + auto it = source_region_map_.find(sr_key); + if (it != source_region_map_.end()) { + sr = it->second; } voxel_indices[z * Ny * Nx + y * Nx + x] = sr; @@ -916,10 +926,17 @@ void FlatSourceDomain::output_to_vtk() const std::fprintf(plot, "LOOKUP_TABLE default\n"); for (int i = 0; i < Nx * Ny * Nz; i++) { int64_t fsr = voxel_indices[i]; + int mat = source_regions_.material(fsr); float total_external = 0.0f; if (fsr >= 0) { for (int g = 0; g < negroups_; g++) { - total_external += source_regions_.external_source(fsr, g); + // External sources are already divided by sigma_t, so we need to + // multiply it back to get the true external source. + double sigma_t = 1.0; + if (mat != MATERIAL_VOID) { + sigma_t = sigma_t_[mat * negroups_ + g]; + } + total_external += source_regions_.external_source(fsr, g) * sigma_t; } } total_external = convert_to_big_endian(total_external); @@ -945,23 +962,25 @@ void FlatSourceDomain::output_to_vtk() const } void FlatSourceDomain::apply_external_source_to_source_region( - Discrete* discrete, double strength_factor, int64_t sr) + int src_idx, SourceRegionHandle& srh) { - source_regions_.external_source_present(sr) = 1; - + auto s = model::external_sources[src_idx].get(); + auto is = dynamic_cast(s); + auto discrete = dynamic_cast(is->energy()); + double strength_factor = is->strength(); const auto& discrete_energies = discrete->x(); const auto& discrete_probs = discrete->prob(); + srh.external_source_present() = 1; + for (int i = 0; i < discrete_energies.size(); i++) { int g = data::mg.get_group_index(discrete_energies[i]); - source_regions_.external_source(sr, g) += - discrete_probs[i] * strength_factor; + srh.external_source(g) += discrete_probs[i] * strength_factor; } } void FlatSourceDomain::apply_external_source_to_cell_instances(int32_t i_cell, - Discrete* discrete, double strength_factor, int target_material_id, - const vector& instances) + int src_idx, int target_material_id, const vector& instances) { Cell& cell = *model::cells[i_cell]; @@ -979,30 +998,28 @@ void FlatSourceDomain::apply_external_source_to_cell_instances(int32_t i_cell, if (target_material_id == C_NONE || cell_material_id == target_material_id) { int64_t source_region = source_region_offsets_[i_cell] + j; - apply_external_source_to_source_region( - discrete, strength_factor, source_region); + external_volumetric_source_map_[source_region].push_back(src_idx); } } } void FlatSourceDomain::apply_external_source_to_cell_and_children( - int32_t i_cell, Discrete* discrete, double strength_factor, - int32_t target_material_id) + int32_t i_cell, int src_idx, int32_t target_material_id) { Cell& cell = *model::cells[i_cell]; if (cell.type_ == Fill::MATERIAL) { - vector instances(cell.n_instances_); + vector instances(cell.n_instances()); std::iota(instances.begin(), instances.end(), 0); apply_external_source_to_cell_instances( - i_cell, discrete, strength_factor, target_material_id, instances); + i_cell, src_idx, target_material_id, instances); } else if (target_material_id == C_NONE) { std::unordered_map> cell_instance_list = cell.get_contained_cells(0, nullptr); for (const auto& pair : cell_instance_list) { int32_t i_child_cell = pair.first; - apply_external_source_to_cell_instances(i_child_cell, discrete, - strength_factor, target_material_id, pair.second); + apply_external_source_to_cell_instances( + i_child_cell, src_idx, target_material_id, pair.second); } } } @@ -1022,51 +1039,69 @@ void FlatSourceDomain::convert_external_sources() { // Loop over external sources for (int es = 0; es < model::external_sources.size(); es++) { + + // Extract source information Source* s = model::external_sources[es].get(); IndependentSource* is = dynamic_cast(s); Discrete* energy = dynamic_cast(is->energy()); const std::unordered_set& domain_ids = is->domain_ids(); - double strength_factor = is->strength(); - if (is->domain_type() == Source::DomainType::MATERIAL) { - for (int32_t material_id : domain_ids) { - for (int i_cell = 0; i_cell < model::cells.size(); i_cell++) { - apply_external_source_to_cell_and_children( - i_cell, energy, strength_factor, material_id); + // If there is no domain constraint specified, then this must be a point + // source. In this case, we need to find the source region that contains the + // point source and apply or relate it to the external source. + if (is->domain_ids().size() == 0) { + + // Extract the point source coordinate and find the base source region at + // that point + auto sp = dynamic_cast(is->space()); + GeometryState gs; + gs.r() = sp->r(); + gs.r_last() = sp->r(); + gs.u() = {1.0, 0.0, 0.0}; + bool found = exhaustive_find_cell(gs); + if (!found) { + fatal_error(fmt::format("Could not find cell containing external " + "point source at {}", + sp->r())); + } + SourceRegionKey key = lookup_source_region_key(gs); + + // With the source region and mesh bin known, we can use the + // accompanying SourceRegionKey as a key into a map that stores the + // corresponding external source index for the point source. Notably, we + // do not actually apply the external source to any source regions here, + // as if mesh subdivision is enabled, they haven't actually been + // discovered & initilized yet. When discovered, they will read from the + // external_source_map to determine if there are any external source + // terms that should be applied. + external_point_source_map_[key].push_back(es); + + } else { + // If not a point source, then use the volumetric domain constraints to + // determine which source regions to apply the external source to. + if (is->domain_type() == Source::DomainType::MATERIAL) { + for (int32_t material_id : domain_ids) { + for (int i_cell = 0; i_cell < model::cells.size(); i_cell++) { + apply_external_source_to_cell_and_children(i_cell, es, material_id); + } } - } - } else if (is->domain_type() == Source::DomainType::CELL) { - for (int32_t cell_id : domain_ids) { - int32_t i_cell = model::cell_map[cell_id]; - apply_external_source_to_cell_and_children( - i_cell, energy, strength_factor, C_NONE); - } - } else if (is->domain_type() == Source::DomainType::UNIVERSE) { - for (int32_t universe_id : domain_ids) { - int32_t i_universe = model::universe_map[universe_id]; - Universe& universe = *model::universes[i_universe]; - for (int32_t i_cell : universe.cells_) { - apply_external_source_to_cell_and_children( - i_cell, energy, strength_factor, C_NONE); + } else if (is->domain_type() == Source::DomainType::CELL) { + for (int32_t cell_id : domain_ids) { + int32_t i_cell = model::cell_map[cell_id]; + apply_external_source_to_cell_and_children(i_cell, es, C_NONE); + } + } else if (is->domain_type() == Source::DomainType::UNIVERSE) { + for (int32_t universe_id : domain_ids) { + int32_t i_universe = model::universe_map[universe_id]; + Universe& universe = *model::universes[i_universe]; + for (int32_t i_cell : universe.cells_) { + apply_external_source_to_cell_and_children(i_cell, es, C_NONE); + } } } } } // End loop over external sources - -// Divide the fixed source term by sigma t (to save time when applying each -// iteration) -#pragma omp parallel for - for (int64_t sr = 0; sr < n_source_regions(); sr++) { - int material = source_regions_.material(sr); - if (material == MATERIAL_VOID) { - continue; - } - for (int g = 0; g < negroups_; g++) { - double sigma_t = sigma_t_[material * negroups_ + g]; - source_regions_.external_source(sr, g) /= sigma_t; - } - } } void FlatSourceDomain::flux_swap() @@ -1083,16 +1118,26 @@ void FlatSourceDomain::flatten_xs() const int a = 0; n_materials_ = data::mg.macro_xs_.size(); - for (auto& m : data::mg.macro_xs_) { + for (int i = 0; i < n_materials_; i++) { + auto& m = data::mg.macro_xs_[i]; for (int g_out = 0; g_out < negroups_; g_out++) { if (m.exists_in_model) { double sigma_t = m.get_xs(MgxsType::TOTAL, g_out, NULL, NULL, NULL, t, a); sigma_t_.push_back(sigma_t); - double nu_Sigma_f = + if (sigma_t < MINIMUM_MACRO_XS) { + Material* mat = model::materials[i].get(); + warning(fmt::format( + "Material \"{}\" (id: {}) has a group {} total cross section " + "({:.3e}) below the minimum threshold " + "({:.3e}). Material will be treated as pure void.", + mat->name(), mat->id(), g_out, sigma_t, MINIMUM_MACRO_XS)); + } + + double nu_sigma_f = m.get_xs(MgxsType::NU_FISSION, g_out, NULL, NULL, NULL, t, a); - nu_sigma_f_.push_back(nu_Sigma_f); + nu_sigma_f_.push_back(nu_sigma_f); double sigma_f = m.get_xs(MgxsType::FISSION, g_out, NULL, NULL, NULL, t, a); @@ -1100,12 +1145,22 @@ void FlatSourceDomain::flatten_xs() double chi = m.get_xs(MgxsType::CHI_PROMPT, g_out, &g_out, NULL, NULL, t, a); + if (!std::isfinite(chi)) { + // MGXS interface may return NaN in some cases, such as when material + // is fissionable but has very small sigma_f. + chi = 0.0; + } chi_.push_back(chi); for (int g_in = 0; g_in < negroups_; g_in++) { double sigma_s = m.get_xs(MgxsType::NU_SCATTER, g_in, &g_out, NULL, NULL, t, a); sigma_s_.push_back(sigma_s); + // For transport corrected XS data, diagonal elements may be negative. + // In this case, set a flag to enable transport stabilization for the + // simulation. + if (g_out == g_in && sigma_s < 0.0) + is_transport_stabilization_needed_ = true; } } else { sigma_t_.push_back(0); @@ -1120,19 +1175,32 @@ void FlatSourceDomain::flatten_xs() } } -void FlatSourceDomain::set_adjoint_sources(const vector& forward_flux) +void FlatSourceDomain::set_adjoint_sources() { - // Set the external source to 1/forward_flux. If the forward flux is negative - // or zero, set the adjoint source to zero, as this is likely a very small - // source region that we don't need to bother trying to vector particles - // towards. Flux negativity in random ray is not related to the flux being - // small in magnitude, but rather due to the source region being physically - // small in volume and thus having a noisy flux estimate. + // Set the adjoint external source to 1/forward_flux. If the forward flux is + // negative, zero, or extremely close to zero, set the adjoint source to zero, + // as this is likely a very small source region that we don't need to bother + // trying to vector particles towards. In the case of flux "being extremely + // close to zero", we define this as being a fixed fraction of the maximum + // forward flux, below which we assume the flux would be physically + // undetectable. + + // First, find the maximum forward flux value + double max_flux = 0.0; +#pragma omp parallel for reduction(max : max_flux) + for (int64_t se = 0; se < n_source_elements(); se++) { + double flux = source_regions_.scalar_flux_final(se); + if (flux > max_flux) { + max_flux = flux; + } + } + + // Then, compute the adjoint source for each source region #pragma omp parallel for for (int64_t sr = 0; sr < n_source_regions(); sr++) { for (int g = 0; g < negroups_; g++) { - double flux = forward_flux[sr * negroups_ + g]; - if (flux <= 0.0) { + double flux = source_regions_.scalar_flux_final(sr, g); + if (flux <= ZERO_FLUX_CUTOFF * max_flux) { source_regions_.external_source(sr, g) = 0.0; } else { source_regions_.external_source(sr, g) = 1.0 / flux; @@ -1140,9 +1208,33 @@ void FlatSourceDomain::set_adjoint_sources(const vector& forward_flux) if (flux > 0.0) { source_regions_.external_source_present(sr) = 1; } + source_regions_.scalar_flux_final(sr, g) = 0.0; } } + // "Small" source regions in OpenMC are defined as those that are hit by + // MIN_HITS_PER_BATCH rays or fewer each batch. These regions typically have + // very small volumes combined with a low aspect ratio, and are often + // generated when applying a source region mesh that clips the edge of a + // curved surface. As perhaps only a few rays will visit these regions over + // the entire forward simulation, the forward flux estimates are extremely + // noisy and unreliable. In some cases, the noise may make the forward fluxes + // extremely low, leading to unphysically large adjoint source terms, + // resulting in weight windows that aggressively try to drive particles + // towards these regions. To fix this, we simply filter out any "small" source + // regions from consideration. If a source region is "small", we + // set its adjoint source to zero. This adds negligible bias to the adjoint + // flux solution, as the true total adjoint source contribution from small + // regions is likely to be negligible. +#pragma omp parallel for + for (int64_t sr = 0; sr < n_source_regions(); sr++) { + if (source_regions_.is_small(sr)) { + for (int g = 0; g < negroups_; g++) { + source_regions_.external_source(sr, g) = 0.0; + } + source_regions_.external_source_present(sr) = 0; + } + } // Divide the fixed source term by sigma t (to save time when applying each // iteration) #pragma omp parallel for @@ -1203,13 +1295,14 @@ void FlatSourceDomain::apply_mesh_to_cell_instances(int32_t i_cell, if ((target_material_id == C_NONE && !is_target_void) || cell_material_id == target_material_id) { int64_t sr = source_region_offsets_[i_cell] + j; - if (source_regions_.mesh(sr) != C_NONE) { - // print out the source region that is broken: + // Check if the key is already present in the mesh_map_ + if (mesh_map_.find(sr) != mesh_map_.end()) { fatal_error(fmt::format("Source region {} already has mesh idx {} " "applied, but trying to apply mesh idx {}", - sr, source_regions_.mesh(sr), mesh_idx)); + sr, mesh_map_[sr], mesh_idx)); } - source_regions_.mesh(sr) = mesh_idx; + // If the SR has not already been assigned, then we can write to it + mesh_map_[sr] = mesh_idx; } } } @@ -1220,12 +1313,12 @@ void FlatSourceDomain::apply_mesh_to_cell_and_children(int32_t i_cell, Cell& cell = *model::cells[i_cell]; if (cell.type_ == Fill::MATERIAL) { - vector instances(cell.n_instances_); + vector instances(cell.n_instances()); std::iota(instances.begin(), instances.end(), 0); apply_mesh_to_cell_instances( i_cell, mesh_idx, target_material_id, instances, is_target_void); } else if (target_material_id == C_NONE && !is_target_void) { - for (int j = 0; j < cell.n_instances_; j++) { + for (int j = 0; j < cell.n_instances(); j++) { std::unordered_map> cell_instance_list = cell.get_contained_cells(j, nullptr); for (const auto& pair : cell_instance_list) { @@ -1279,18 +1372,9 @@ void FlatSourceDomain::apply_meshes() } } -void FlatSourceDomain::prepare_base_source_regions() -{ - std::swap(source_regions_, base_source_regions_); - source_regions_.negroups() = base_source_regions_.negroups(); - source_regions_.is_linear() = base_source_regions_.is_linear(); -} - SourceRegionHandle FlatSourceDomain::get_subdivided_source_region_handle( - int64_t sr, int mesh_bin, Position r, double dist, Direction u) + SourceRegionKey sr_key, Position r, Direction u) { - SourceRegionKey sr_key {sr, mesh_bin}; - // Case 1: Check if the source region key is already present in the permanent // map. This is the most common condition, as any source region visited in a // previous power iteration will already be present in the permanent map. If @@ -1352,9 +1436,8 @@ SourceRegionHandle FlatSourceDomain::get_subdivided_source_region_handle( gs.r() = r + TINY_BIT * u; gs.u() = {1.0, 0.0, 0.0}; exhaustive_find_cell(gs); - int gs_i_cell = gs.lowest_coord().cell; - int64_t sr_found = source_region_offsets_[gs_i_cell] + gs.cell_instance(); - if (sr_found != sr) { + int64_t sr_found = lookup_base_source_region_idx(gs); + if (sr_found != sr_key.base_source_region_id) { discovered_source_regions_.unlock(sr_key); SourceRegionHandle handle; handle.is_numerical_fp_artifact_ = true; @@ -1362,9 +1445,9 @@ SourceRegionHandle FlatSourceDomain::get_subdivided_source_region_handle( } // Sanity check on mesh bin - int mesh_idx = base_source_regions_.mesh(sr); + int mesh_idx = lookup_mesh_idx(sr_key.base_source_region_id); if (mesh_idx == C_NONE) { - if (mesh_bin != 0) { + if (sr_key.mesh_bin != 0) { discovered_source_regions_.unlock(sr_key); SourceRegionHandle handle; handle.is_numerical_fp_artifact_ = true; @@ -1373,7 +1456,7 @@ SourceRegionHandle FlatSourceDomain::get_subdivided_source_region_handle( } else { Mesh* mesh = model::meshes[mesh_idx].get(); int bin_found = mesh->get_bin(r + TINY_BIT * u); - if (bin_found != mesh_bin) { + if (bin_found != sr_key.mesh_bin) { discovered_source_regions_.unlock(sr_key); SourceRegionHandle handle; handle.is_numerical_fp_artifact_ = true; @@ -1385,14 +1468,82 @@ SourceRegionHandle FlatSourceDomain::get_subdivided_source_region_handle( // condition only occurs the first time the source region is discovered // (typically in the first power iteration). In this case, we need to handle // creation of the new source region and its storage into the parallel map. - // The new source region is created by copying the base source region, so as - // to inherit material, external source, and some flux properties etc. We - // also pass the base source region id to allow the new source region to - // know which base source region it is derived from. - SourceRegion* sr_ptr = discovered_source_regions_.emplace( - sr_key, {base_source_regions_.get_source_region_handle(sr), sr}); - discovered_source_regions_.unlock(sr_key); + // Additionally, we need to determine the source region's material, initialize + // the starting scalar flux guess, and apply any known external sources. + + // Call the basic constructor for the source region and store in the parallel + // map. + bool is_linear = RandomRay::source_shape_ != RandomRaySourceShape::FLAT; + SourceRegion* sr_ptr = + discovered_source_regions_.emplace(sr_key, {negroups_, is_linear}); SourceRegionHandle handle {*sr_ptr}; + + // Determine the material + int gs_i_cell = gs.lowest_coord().cell(); + Cell& cell = *model::cells[gs_i_cell]; + int material = cell.material(gs.cell_instance()); + + // If material total XS is extremely low, just set it to void to avoid + // problems with 1/Sigma_t + for (int g = 0; g < negroups_; g++) { + double sigma_t = sigma_t_[material * negroups_ + g]; + if (sigma_t < MINIMUM_MACRO_XS) { + material = MATERIAL_VOID; + break; + } + } + + handle.material() = material; + + // Store the mesh index (if any) assigned to this source region + handle.mesh() = mesh_idx; + + if (settings::run_mode == RunMode::FIXED_SOURCE) { + // Determine if there are any volumetric sources, and apply them. + // Volumetric sources are specifc only to the base SR idx. + auto it_vol = + external_volumetric_source_map_.find(sr_key.base_source_region_id); + if (it_vol != external_volumetric_source_map_.end()) { + const vector& vol_sources = it_vol->second; + for (int src_idx : vol_sources) { + apply_external_source_to_source_region(src_idx, handle); + } + } + + // Determine if there are any point sources, and apply them. + // Point sources are specific to the source region key. + auto it_point = external_point_source_map_.find(sr_key); + if (it_point != external_point_source_map_.end()) { + const vector& point_sources = it_point->second; + for (int src_idx : point_sources) { + apply_external_source_to_source_region(src_idx, handle); + } + } + + // Divide external source term by sigma_t + if (material != C_NONE) { + for (int g = 0; g < negroups_; g++) { + double sigma_t = sigma_t_[material * negroups_ + g]; + handle.external_source(g) /= sigma_t; + } + } + } + + // Compute the combined source term + update_single_neutron_source(handle); + + // Unlock the parallel map. Note: we may be tempted to release + // this lock earlier, and then just use the source region's lock to protect + // the flux/source initialization stages above. However, the rest of the code + // only protects updates to the new flux and volume fields, and assumes that + // the source is constant for the duration of transport. Thus, using just the + // source region's lock by itself would result in other threads potentially + // reading from the source before it is computed, as they won't use the lock + // when only reading from the SR's source. It would be expensive to protect + // those operations, whereas generating the SR is only done once, so we just + // hold the map's bucket lock until the source region is fully initialized. + discovered_source_regions_.unlock(sr_key); + return handle; } @@ -1412,6 +1563,9 @@ void FlatSourceDomain::finalize_discovered_source_regions() // order due to shared memory threading. std::sort(keys.begin(), keys.end()); + // Remember the index of the first new source region + int64_t start_sr_id = source_regions_.n_source_regions(); + // Append the source regions in the sorted key order. for (const auto& key : keys) { const SourceRegion& sr = discovered_source_regions_[key]; @@ -1419,12 +1573,108 @@ void FlatSourceDomain::finalize_discovered_source_regions() source_regions_.push_back(sr); } - // If any new source regions were discovered, we need to update the - // tally mapping between source regions and tally bins. - mapped_all_tallies_ = false; + // Map all new source regions to tallies + convert_source_regions_to_tallies(start_sr_id); } discovered_source_regions_.clear(); } +// This is the "diagonal stabilization" technique developed by Gunow et al. in: +// +// Geoffrey Gunow, Benoit Forget, Kord Smith, Stabilization of multi-group +// neutron transport with transport-corrected cross-sections, Annals of Nuclear +// Energy, Volume 126, 2019, Pages 211-219, ISSN 0306-4549, +// https://doi.org/10.1016/j.anucene.2018.10.036. +void FlatSourceDomain::apply_transport_stabilization() +{ + // Don't do anything if all in-group scattering + // cross sections are positive + if (!is_transport_stabilization_needed_) { + return; + } + + // Apply the stabilization factor to all source elements +#pragma omp parallel for + for (int64_t sr = 0; sr < n_source_regions(); sr++) { + int material = source_regions_.material(sr); + if (material == MATERIAL_VOID) { + continue; + } + for (int g = 0; g < negroups_; g++) { + // Only apply stabilization if the diagonal (in-group) scattering XS is + // negative + double sigma_s = + sigma_s_[material * negroups_ * negroups_ + g * negroups_ + g]; + if (sigma_s < 0.0) { + double sigma_t = sigma_t_[material * negroups_ + g]; + double phi_new = source_regions_.scalar_flux_new(sr, g); + double phi_old = source_regions_.scalar_flux_old(sr, g); + + // Equation 18 in the above Gunow et al. 2019 paper. For a default + // rho of 1.0, this ensures there are no negative diagonal elements + // in the iteration matrix. A lesser rho could be used (or exposed + // as a user input parameter) to reduce the negative impact on + // convergence rate though would need to be experimentally tested to see + // if it doesn't become unstable. rho = 1.0 is good as it gives the + // highest assurance of stability, and the impacts on convergence rate + // are pretty mild. + double D = diagonal_stabilization_rho_ * sigma_s / sigma_t; + + // Equation 16 in the above Gunow et al. 2019 paper + source_regions_.scalar_flux_new(sr, g) = + (phi_new - D * phi_old) / (1.0 - D); + } + } + } +} + +// Determines the base source region index (i.e., a material filled cell +// instance) that corresponds to a particular location in the geometry. Requires +// that the "gs" object passed in has already been initialized and has called +// find_cell etc. +int64_t FlatSourceDomain::lookup_base_source_region_idx( + const GeometryState& gs) const +{ + int i_cell = gs.lowest_coord().cell(); + int64_t sr = source_region_offsets_[i_cell] + gs.cell_instance(); + return sr; +} + +// Determines the index of the mesh (if any) that has been applied +// to a particular base source region index. +int FlatSourceDomain::lookup_mesh_idx(int64_t sr) const +{ + int mesh_idx = C_NONE; + auto mesh_it = mesh_map_.find(sr); + if (mesh_it != mesh_map_.end()) { + mesh_idx = mesh_it->second; + } + return mesh_idx; +} + +// Determines the source region key that corresponds to a particular location in +// the geometry. This takes into account both the base source region index as +// well as the mesh bin if a mesh is applied to this source region for +// subdivision. +SourceRegionKey FlatSourceDomain::lookup_source_region_key( + const GeometryState& gs) const +{ + int64_t sr = lookup_base_source_region_idx(gs); + int64_t mesh_bin = lookup_mesh_bin(sr, gs.r()); + return SourceRegionKey {sr, mesh_bin}; +} + +// Determines the mesh bin that corresponds to a particular base source region +// index and position. +int64_t FlatSourceDomain::lookup_mesh_bin(int64_t sr, Position r) const +{ + int mesh_idx = lookup_mesh_idx(sr); + int mesh_bin = 0; + if (mesh_idx != C_NONE) { + mesh_bin = model::meshes[mesh_idx]->get_bin(r); + } + return mesh_bin; +} + } // namespace openmc diff --git a/src/random_ray/linear_source_domain.cpp b/src/random_ray/linear_source_domain.cpp index 81412164e..47ffbb727 100644 --- a/src/random_ray/linear_source_domain.cpp +++ b/src/random_ray/linear_source_domain.cpp @@ -34,25 +34,18 @@ void LinearSourceDomain::batch_reset() } } -void LinearSourceDomain::update_neutron_source(double k_eff) +void LinearSourceDomain::update_single_neutron_source(SourceRegionHandle& srh) { - simulation::time_update_src.start(); - - double inverse_k_eff = 1.0 / k_eff; - -// Reset all source regions to zero (important for void regions) -#pragma omp parallel for - for (int64_t se = 0; se < n_source_elements(); se++) { - source_regions_.source(se) = 0.0; + // Reset all source regions to zero (important for void regions) + for (int g = 0; g < negroups_; g++) { + srh.source(g) = 0.0; } -#pragma omp parallel for - for (int64_t sr = 0; sr < n_source_regions(); sr++) { - int material = source_regions_.material(sr); - if (material == MATERIAL_VOID) { - continue; - } - MomentMatrix invM = source_regions_.mom_matrix(sr).inverse(); + // Add scattering + fission source + int material = srh.material(); + if (material != MATERIAL_VOID) { + double inverse_k_eff = 1.0 / k_eff_; + MomentMatrix invM = srh.mom_matrix().inverse(); for (int g_out = 0; g_out < negroups_; g_out++) { double sigma_t = sigma_t_[material * negroups_ + g_out]; @@ -64,8 +57,8 @@ void LinearSourceDomain::update_neutron_source(double k_eff) for (int g_in = 0; g_in < negroups_; g_in++) { // Handles for the flat and linear components of the flux - double flux_flat = source_regions_.scalar_flux_old(sr, g_in); - MomentArray flux_linear = source_regions_.flux_moments_old(sr, g_in); + double flux_flat = srh.scalar_flux_old(g_in); + MomentArray flux_linear = srh.flux_moments_old(g_in); // Handles for cross sections double sigma_s = @@ -75,13 +68,15 @@ void LinearSourceDomain::update_neutron_source(double k_eff) // Compute source terms for flat and linear components of the flux scatter_flat += sigma_s * flux_flat; - fission_flat += nu_sigma_f * flux_flat * chi; scatter_linear += sigma_s * flux_linear; - fission_linear += nu_sigma_f * flux_linear * chi; + if (settings::create_fission_neutrons) { + fission_flat += nu_sigma_f * flux_flat * chi; + fission_linear += nu_sigma_f * flux_linear * chi; + } } // Compute the flat source term - source_regions_.source(sr, g_out) = + srh.source(g_out) = (scatter_flat + fission_flat * inverse_k_eff) / sigma_t; // Compute the linear source terms. In the first 10 iterations when the @@ -91,25 +86,21 @@ void LinearSourceDomain::update_neutron_source(double k_eff) // very small/noisy or have poorly developed spatial moments, so we zero // the source gradients (effectively making this a flat source region // temporarily), so as to improve stability. - if (simulation::current_batch > 10 && - source_regions_.source(sr, g_out) >= 0.0) { - source_regions_.source_gradients(sr, g_out) = + if (simulation::current_batch > 10 && srh.source(g_out) >= 0.0) { + srh.source_gradients(g_out) = invM * ((scatter_linear + fission_linear * inverse_k_eff) / sigma_t); } else { - source_regions_.source_gradients(sr, g_out) = {0.0, 0.0, 0.0}; + srh.source_gradients(g_out) = {0.0, 0.0, 0.0}; } } } + // Add external source if in fixed source mode if (settings::run_mode == RunMode::FIXED_SOURCE) { -// Add external source to flat source term if in fixed source mode -#pragma omp parallel for - for (int64_t se = 0; se < n_source_elements(); se++) { - source_regions_.source(se) += source_regions_.external_source(se); + for (int g = 0; g < negroups_; g++) { + srh.source(g) += srh.external_source(g); } } - - simulation::time_update_src.stop(); } void LinearSourceDomain::normalize_scalar_flux_and_volumes( diff --git a/src/random_ray/random_ray.cpp b/src/random_ray/random_ray.cpp index 9a9d1394a..c19d136a4 100644 --- a/src/random_ray/random_ray.cpp +++ b/src/random_ray/random_ray.cpp @@ -237,7 +237,6 @@ double RandomRay::distance_inactive_; double RandomRay::distance_active_; unique_ptr RandomRay::ray_source_; RandomRaySourceShape RandomRay::source_shape_ {RandomRaySourceShape::FLAT}; -bool RandomRay::mesh_subdivision_enabled_ {false}; RandomRaySampleMethod RandomRay::sample_method_ {RandomRaySampleMethod::PRNG}; RandomRay::RandomRay() @@ -265,6 +264,12 @@ uint64_t RandomRay::transport_history_based_single_ray() if (!alive()) break; event_cross_surface(); + // If ray has too many events, display warning and kill it + if (n_event() >= settings::max_particle_events) { + warning("Ray " + std::to_string(id()) + + " underwent maximum number of events, terminating ray."); + wgt() = 0.0; + } } return n_event(); @@ -273,11 +278,15 @@ uint64_t RandomRay::transport_history_based_single_ray() // Transports ray across a single source region void RandomRay::event_advance_ray() { + // If geometry debug mode is on, check for cell overlaps + if (settings::check_overlaps) + check_cell_overlap(*this); + // Find the distance to the nearest boundary boundary() = distance_to_boundary(*this); - double distance = boundary().distance; + double distance = boundary().distance(); - if (distance <= 0.0) { + if (distance < 0.0) { mark_as_lost("Negative transport distance detected for particle " + std::to_string(id())); return; @@ -324,77 +333,66 @@ void RandomRay::event_advance_ray() // Advance particle for (int j = 0; j < n_coord(); ++j) { - coord(j).r += distance * coord(j).u; + coord(j).r() += distance * coord(j).u(); } } void RandomRay::attenuate_flux(double distance, bool is_active, double offset) { - // Determine source region index etc. - int i_cell = lowest_coord().cell; - - // The base source region is the spatial region index - int64_t sr = domain_->source_region_offsets_[i_cell] + cell_instance(); + // Lookup base source region index + int64_t sr = domain_->lookup_base_source_region_idx(*this); // Perform ray tracing across mesh - if (mesh_subdivision_enabled_) { - // Determine the mesh index for the base source region, if any - int mesh_idx = domain_->base_source_regions_.mesh(sr); + // Determine the mesh index for the base source region, if any + int mesh_idx = domain_->lookup_mesh_idx(sr); - if (mesh_idx == C_NONE) { - // If there's no mesh being applied to this cell, then - // we just attenuate the flux as normal, and set - // the mesh bin to 0 - attenuate_flux_inner(distance, is_active, sr, 0, r()); - } else { - // If there is a mesh being applied to this cell, then - // we loop over all the bin crossings and attenuate - // separately. - Mesh* mesh = model::meshes[mesh_idx].get(); - - // We adjust the start and end positions of the ray slightly - // to accomodate for floating point precision issues that tend - // to occur at mesh boundaries that overlap with geometry lattice - // boundaries. - Position start = r() + (offset + TINY_BIT) * u(); - Position end = start + (distance - 2.0 * TINY_BIT) * u(); - double reduced_distance = (end - start).norm(); - - // Ray trace through the mesh and record bins and lengths - mesh_bins_.resize(0); - mesh_fractional_lengths_.resize(0); - mesh->bins_crossed(start, end, u(), mesh_bins_, mesh_fractional_lengths_); - - // Loop over all mesh bins and attenuate flux - for (int b = 0; b < mesh_bins_.size(); b++) { - double physical_length = reduced_distance * mesh_fractional_lengths_[b]; - attenuate_flux_inner( - physical_length, is_active, sr, mesh_bins_[b], start); - start += physical_length * u(); - } - } + if (mesh_idx == C_NONE) { + // If there's no mesh being applied to this cell, then + // we just attenuate the flux as normal, and set + // the mesh bin to 0 + attenuate_flux_inner(distance, is_active, sr, 0, r()); } else { - attenuate_flux_inner(distance, is_active, sr, C_NONE, r()); + // If there is a mesh being applied to this cell, then + // we loop over all the bin crossings and attenuate + // separately. + Mesh* mesh = model::meshes[mesh_idx].get(); + + // We adjust the start and end positions of the ray slightly + // to accomodate for floating point precision issues that tend + // to occur at mesh boundaries that overlap with geometry lattice + // boundaries. + Position start = r() + (offset + TINY_BIT) * u(); + Position end = start + (distance - 2.0 * TINY_BIT) * u(); + double reduced_distance = (end - start).norm(); + + // Ray trace through the mesh and record bins and lengths + mesh_bins_.resize(0); + mesh_fractional_lengths_.resize(0); + mesh->bins_crossed(start, end, u(), mesh_bins_, mesh_fractional_lengths_); + + // Loop over all mesh bins and attenuate flux + for (int b = 0; b < mesh_bins_.size(); b++) { + double physical_length = reduced_distance * mesh_fractional_lengths_[b]; + attenuate_flux_inner( + physical_length, is_active, sr, mesh_bins_[b], start); + start += physical_length * u(); + } } } void RandomRay::attenuate_flux_inner( double distance, bool is_active, int64_t sr, int mesh_bin, Position r) { + SourceRegionKey sr_key {sr, mesh_bin}; SourceRegionHandle srh; - if (mesh_subdivision_enabled_) { - srh = domain_->get_subdivided_source_region_handle( - sr, mesh_bin, r, distance, u()); - if (srh.is_numerical_fp_artifact_) { - return; - } - } else { - srh = domain_->source_regions_.get_source_region_handle(sr); + srh = domain_->get_subdivided_source_region_handle(sr_key, r, u()); + if (srh.is_numerical_fp_artifact_) { + return; } switch (source_shape_) { case RandomRaySourceShape::FLAT: - if (this->material() == MATERIAL_VOID) { + if (srh.material() == MATERIAL_VOID) { attenuate_flux_flat_source_void(srh, distance, is_active, r); } else { attenuate_flux_flat_source(srh, distance, is_active, r); @@ -402,7 +400,7 @@ void RandomRay::attenuate_flux_inner( break; case RandomRaySourceShape::LINEAR: case RandomRaySourceShape::LINEAR_XY: - if (this->material() == MATERIAL_VOID) { + if (srh.material() == MATERIAL_VOID) { attenuate_flux_linear_source_void(srh, distance, is_active, r); } else { attenuate_flux_linear_source(srh, distance, is_active, r); @@ -433,7 +431,7 @@ void RandomRay::attenuate_flux_flat_source( n_event()++; // Get material - int material = this->material(); + int material = srh.material(); // MOC incoming flux attenuation + source contribution/attenuation equation for (int g = 0; g < negroups_; g++) { @@ -484,7 +482,7 @@ void RandomRay::attenuate_flux_flat_source_void( // The number of geometric intersections is counted for reporting purposes n_event()++; - int material = this->material(); + int material = srh.material(); // If ray is in the active phase (not in dead zone), make contributions to // source region bookkeeping @@ -518,8 +516,10 @@ void RandomRay::attenuate_flux_flat_source_void( } // Add source to incoming angular flux, assuming void region - for (int g = 0; g < negroups_; g++) { - angular_flux_[g] += srh.external_source(g) * distance; + if (settings::run_mode == RunMode::FIXED_SOURCE) { + for (int g = 0; g < negroups_; g++) { + angular_flux_[g] += srh.external_source(g) * distance; + } } } @@ -529,7 +529,7 @@ void RandomRay::attenuate_flux_linear_source( // The number of geometric intersections is counted for reporting purposes n_event()++; - int material = this->material(); + int material = srh.material(); Position& centroid = srh.centroid(); Position midpoint = r + u() * (distance / 2.0); @@ -688,7 +688,10 @@ void RandomRay::attenuate_flux_linear_source_void( // transport through a void region is greatly simplified. Here we // compute the updated flux moments. for (int g = 0; g < negroups_; g++) { - float spatial_source = srh.external_source(g); + float spatial_source = 0.f; + if (settings::run_mode == RunMode::FIXED_SOURCE) { + spatial_source = srh.external_source(g); + } float new_delta_psi = (angular_flux_[g] - spatial_source) * distance; float h1 = 0.5f; h1 = h1 * angular_flux_[g]; @@ -750,8 +753,10 @@ void RandomRay::attenuate_flux_linear_source_void( } // Add source to incoming angular flux, assuming void region - for (int g = 0; g < negroups_; g++) { - angular_flux_[g] += srh.external_source(g) * distance; + if (settings::run_mode == RunMode::FIXED_SOURCE) { + for (int g = 0; g < negroups_; g++) { + angular_flux_[g] += srh.external_source(g) * distance; + } } } @@ -782,13 +787,11 @@ void RandomRay::initialize_ray(uint64_t ray_id, FlatSourceDomain* domain) fatal_error("Unknown sample method for random ray transport."); } - site.E = lower_bound_index( - data::mg.rev_energy_bins_.begin(), data::mg.rev_energy_bins_.end(), site.E); - site.E = negroups_ - site.E - 1.; + site.E = 0.0; this->from_source(&site); // Locate ray - if (lowest_coord().cell == C_NONE) { + if (lowest_coord().cell() == C_NONE) { if (!exhaustive_find_cell(*this)) { this->mark_as_lost( "Could not find the cell containing particle " + std::to_string(id())); @@ -796,30 +799,15 @@ void RandomRay::initialize_ray(uint64_t ray_id, FlatSourceDomain* domain) // Set birth cell attribute if (cell_born() == C_NONE) - cell_born() = lowest_coord().cell; + cell_born() = lowest_coord().cell(); } + SourceRegionKey sr_key = domain_->lookup_source_region_key(*this); + SourceRegionHandle srh = + domain_->get_subdivided_source_region_handle(sr_key, r(), u()); + // Initialize ray's starting angular flux to starting location's isotropic // source - int i_cell = lowest_coord().cell; - int64_t sr = domain_->source_region_offsets_[i_cell] + cell_instance(); - - SourceRegionHandle srh; - if (mesh_subdivision_enabled_) { - int mesh_idx = domain_->base_source_regions_.mesh(sr); - int mesh_bin; - if (mesh_idx == C_NONE) { - mesh_bin = 0; - } else { - Mesh* mesh = model::meshes[mesh_idx].get(); - mesh_bin = mesh->get_bin(r()); - } - srh = - domain_->get_subdivided_source_region_handle(sr, mesh_bin, r(), 0.0, u()); - } else { - srh = domain_->source_regions_.get_source_region_handle(sr); - } - if (!srh.is_numerical_fp_artifact_) { for (int g = 0; g < negroups_; g++) { angular_flux_[g] = srh.source(g); diff --git a/src/random_ray/random_ray_simulation.cpp b/src/random_ray/random_ray_simulation.cpp index bf01d2f57..d475b2593 100644 --- a/src/random_ray/random_ray_simulation.cpp +++ b/src/random_ray/random_ray_simulation.cpp @@ -47,97 +47,82 @@ void openmc_run_random_ray() if (mpi::master) validate_random_ray_inputs(); - // Declare forward flux so that it can be saved for later adjoint simulation - vector forward_flux; - SourceRegionContainer forward_source_regions; - SourceRegionContainer forward_base_source_regions; - std::unordered_map - forward_source_region_map; + // Initialize Random Ray Simulation Object + RandomRaySimulation sim; - { - // Initialize Random Ray Simulation Object - RandomRaySimulation sim; + // Initialize fixed sources, if present + sim.apply_fixed_sources_and_mesh_domains(); - // Initialize fixed sources, if present - sim.apply_fixed_sources_and_mesh_domains(); + // Begin main simulation timer + simulation::time_total.start(); - // Begin main simulation timer - simulation::time_total.start(); + // Execute random ray simulation + sim.simulate(); - // Execute random ray simulation - sim.simulate(); + // End main simulation timer + simulation::time_total.stop(); - // End main simulation timer - simulation::time_total.stop(); - - // Normalize and save the final forward flux - sim.domain()->serialize_final_fluxes(forward_flux); - - double source_normalization_factor = - sim.domain()->compute_fixed_source_normalization_factor() / - (settings::n_batches - settings::n_inactive); + // Normalize and save the final forward flux + double source_normalization_factor = + sim.domain()->compute_fixed_source_normalization_factor() / + (settings::n_batches - settings::n_inactive); #pragma omp parallel for - for (uint64_t i = 0; i < forward_flux.size(); i++) { - forward_flux[i] *= source_normalization_factor; - } - - forward_source_regions = sim.domain()->source_regions_; - forward_source_region_map = sim.domain()->source_region_map_; - forward_base_source_regions = sim.domain()->base_source_regions_; - - // Finalize OpenMC - openmc_simulation_finalize(); - - // Output all simulation results - sim.output_simulation_results(); + for (uint64_t se = 0; se < sim.domain()->n_source_elements(); se++) { + sim.domain()->source_regions_.scalar_flux_final(se) *= + source_normalization_factor; } + // Finalize OpenMC + openmc_simulation_finalize(); + + // Output all simulation results + sim.output_simulation_results(); + ////////////////////////////////////////////////////////// // Run adjoint simulation (if enabled) ////////////////////////////////////////////////////////// - if (adjoint_needed) { - reset_timers(); - - // Configure the domain for adjoint simulation - FlatSourceDomain::adjoint_ = true; - - if (mpi::master) - header("ADJOINT FLUX SOLVE", 3); - - // Initialize OpenMC general data structures - openmc_simulation_init(); - - // Initialize Random Ray Simulation Object - RandomRaySimulation adjoint_sim; - - // Initialize adjoint fixed sources, if present - adjoint_sim.prepare_fixed_sources_adjoint(forward_flux, - forward_source_regions, forward_base_source_regions, - forward_source_region_map); - - // Transpose scattering matrix - adjoint_sim.domain()->transpose_scattering_matrix(); - - // Swap nu_sigma_f and chi - adjoint_sim.domain()->nu_sigma_f_.swap(adjoint_sim.domain()->chi_); - - // Begin main simulation timer - simulation::time_total.start(); - - // Execute random ray simulation - adjoint_sim.simulate(); - - // End main simulation timer - simulation::time_total.stop(); - - // Finalize OpenMC - openmc_simulation_finalize(); - - // Output all simulation results - adjoint_sim.output_simulation_results(); + if (!adjoint_needed) { + return; } + + reset_timers(); + + // Configure the domain for adjoint simulation + FlatSourceDomain::adjoint_ = true; + + if (mpi::master) + header("ADJOINT FLUX SOLVE", 3); + + // Initialize OpenMC general data structures + openmc_simulation_init(); + + sim.domain()->k_eff_ = 1.0; + + // Initialize adjoint fixed sources, if present + sim.prepare_fixed_sources_adjoint(); + + // Transpose scattering matrix + sim.domain()->transpose_scattering_matrix(); + + // Swap nu_sigma_f and chi + sim.domain()->nu_sigma_f_.swap(sim.domain()->chi_); + + // Begin main simulation timer + simulation::time_total.start(); + + // Execute random ray simulation + sim.simulate(); + + // End main simulation timer + simulation::time_total.stop(); + + // Finalize OpenMC + openmc_simulation_finalize(); + + // Output all simulation results + sim.output_simulation_results(); } // Enforces restrictions on inputs in random ray mode. While there are @@ -196,8 +181,8 @@ void validate_random_ray_inputs() "supported in random ray mode."); } if (material.get_xsdata().size() > 1) { - fatal_error("Non-isothermal MGXS detected. Only isothermal XS data sets " - "supported in random ray mode."); + warning("Non-isothermal MGXS detected. Only isothermal XS data sets " + "supported in random ray mode. Using lowest temperature."); } for (int g = 0; g < data::mg.num_energy_groups_; g++) { if (material.exists_in_model) { @@ -281,10 +266,21 @@ void validate_random_ray_inputs() "allowed in random ray mode."); } - // Validate that a domain ID was specified - if (is->domain_ids().size() == 0) { - fatal_error("Fixed sources must be specified by domain " - "id (cell, material, or universe) in random ray mode."); + // Validate that a domain ID was specified OR that it is a point source + auto sp = dynamic_cast(is->space()); + if (is->domain_ids().size() == 0 && !sp) { + fatal_error("Fixed sources must be point source or spatially " + "constrained by domain id (cell, material, or universe) in " + "random ray mode."); + } else if (is->domain_ids().size() > 0 && sp) { + // If both a domain constraint and a non-default point source location + // are specified, notify user that domain constraint takes precedence. + if (sp->r().x == 0.0 && sp->r().y == 0.0 && sp->r().z == 0.0) { + warning("Fixed source has both a domain constraint and a point " + "type spatial distribution. The domain constraint takes " + "precedence in random ray mode -- point source coordinate " + "will be ignored."); + } } // Check that a discrete energy distribution was used @@ -303,20 +299,21 @@ void validate_random_ray_inputs() for (int p = 0; p < model::plots.size(); p++) { // Get handle to OpenMC plot object - Plot* openmc_plot = dynamic_cast(model::plots[p].get()); + const auto& openmc_plottable = model::plots[p]; + Plot* openmc_plot = dynamic_cast(openmc_plottable.get()); // Random ray plots only support voxel plots if (!openmc_plot) { warning(fmt::format( "Plot {} will not be used for end of simulation data plotting -- only " "voxel plotting is allowed in random ray mode.", - p)); + openmc_plottable->id())); continue; } else if (openmc_plot->type_ != Plot::PlotType::voxel) { warning(fmt::format( "Plot {} will not be used for end of simulation data plotting -- only " "voxel plotting is allowed in random ray mode.", - p)); + openmc_plottable->id())); continue; } } @@ -336,7 +333,6 @@ void validate_random_ray_inputs() // when generating weight windows with FW-CADIS and an overlaid mesh. /////////////////////////////////////////////////////////////////// if (RandomRay::source_shape_ == RandomRaySourceShape::LINEAR && - RandomRay::mesh_subdivision_enabled_ && variance_reduction::weight_windows.size() > 0) { warning( "Linear sources may result in negative fluxes in small source regions " @@ -354,7 +350,6 @@ void openmc_reset_random_ray() FlatSourceDomain::mesh_domain_map_.clear(); RandomRay::ray_source_.reset(); RandomRay::source_shape_ = RandomRaySourceShape::FLAT; - RandomRay::mesh_subdivision_enabled_ = false; RandomRay::sample_method_ = RandomRaySampleMethod::PRNG; } @@ -392,28 +387,19 @@ RandomRaySimulation::RandomRaySimulation() void RandomRaySimulation::apply_fixed_sources_and_mesh_domains() { + domain_->apply_meshes(); if (settings::run_mode == RunMode::FIXED_SOURCE) { // Transfer external source user inputs onto random ray source regions domain_->convert_external_sources(); domain_->count_external_source_regions(); } - domain_->apply_meshes(); } -void RandomRaySimulation::prepare_fixed_sources_adjoint( - vector& forward_flux, SourceRegionContainer& forward_source_regions, - SourceRegionContainer& forward_base_source_regions, - std::unordered_map& - forward_source_region_map) +void RandomRaySimulation::prepare_fixed_sources_adjoint() { + domain_->source_regions_.adjoint_reset(); if (settings::run_mode == RunMode::FIXED_SOURCE) { - if (RandomRay::mesh_subdivision_enabled_) { - domain_->source_regions_ = forward_source_regions; - domain_->source_region_map_ = forward_source_region_map; - domain_->base_source_regions_ = forward_base_source_regions; - domain_->source_regions_.adjoint_reset(); - } - domain_->set_adjoint_sources(forward_flux); + domain_->set_adjoint_sources(); } } @@ -433,22 +419,18 @@ void RandomRaySimulation::simulate() simulation::total_weight = 1.0; // Update source term (scattering + fission) - domain_->update_neutron_source(k_eff_); + domain_->update_all_neutron_sources(); - // Reset scalar fluxes, iteration volume tallies, and region hit flags to - // zero + // Reset scalar fluxes, iteration volume tallies, and region hit flags + // to zero domain_->batch_reset(); - // At the beginning of the simulation, if mesh subvivision is in use, we + // At the beginning of the simulation, if mesh subdivision is in use, we // need to swap the main source region container into the base container, // as the main source region container will be used to hold the true // subdivided source regions. The base container will therefore only // contain the external source region information, the mesh indices, // material properties, and initial guess values for the flux/source. - if (RandomRay::mesh_subdivision_enabled_ && - simulation::current_batch == 1 && !FlatSourceDomain::adjoint_) { - domain_->prepare_base_source_regions(); - } // Start timer for transport simulation::time_transport.start(); @@ -464,11 +446,9 @@ void RandomRaySimulation::simulate() simulation::time_transport.stop(); - // If using mesh subdivision, add any newly discovered source regions - // to the main source region container. - if (RandomRay::mesh_subdivision_enabled_) { - domain_->finalize_discovered_source_regions(); - } + // Add any newly discovered source regions to the main source region + // container. + domain_->finalize_discovered_source_regions(); // Normalize scalar flux and update volumes domain_->normalize_scalar_flux_and_volumes( @@ -477,12 +457,15 @@ void RandomRaySimulation::simulate() // Add source to scalar flux, compute number of FSR hits int64_t n_hits = domain_->add_source_to_scalar_flux(); + // Apply transport stabilization factors + domain_->apply_transport_stabilization(); + if (settings::run_mode == RunMode::EIGENVALUE) { // Compute random ray k-eff - k_eff_ = domain_->compute_k_eff(k_eff_); + domain_->compute_k_eff(); // Store random ray k-eff into OpenMC's native k-eff variable - global_tally_tracklength = k_eff_; + global_tally_tracklength = domain_->k_eff_; } // Execute all tallying tasks, if this is an active batch @@ -492,11 +475,6 @@ void RandomRaySimulation::simulate() // estimate domain_->accumulate_iteration_flux(); - // Generate mapping between source regions and tallies - if (!domain_->mapped_all_tallies_) { - domain_->convert_source_regions_to_tallies(); - } - // Use above mapping to contribute FSR flux data to appropriate // tallies domain_->random_ray_tally(); @@ -506,13 +484,15 @@ void RandomRaySimulation::simulate() domain_->flux_swap(); // Check for any obvious insabilities/nans/infs - instability_check(n_hits, k_eff_, avg_miss_rate_); + instability_check(n_hits, domain_->k_eff_, avg_miss_rate_); } // End MPI master work // Finalize the current batch finalize_generation(); finalize_batch(); } // End random ray power iteration loop + + domain_->count_external_source_regions(); } void RandomRaySimulation::output_simulation_results() const @@ -553,7 +533,7 @@ void RandomRaySimulation::instability_check( } if (k_eff > 10.0 || k_eff < 0.01 || !(std::isfinite(k_eff))) { - fatal_error("Instability detected"); + fatal_error(fmt::format("Instability detected: k-eff = {:.5f}", k_eff)); } } } @@ -576,17 +556,23 @@ void RandomRaySimulation::print_results_random_ray( header("Simulation Statistics", 4); fmt::print( " Total Iterations = {}\n", settings::n_batches); - fmt::print(" Flat Source Regions (FSRs) = {}\n", n_source_regions); fmt::print( - " FSRs Containing External Sources = {}\n", n_external_source_regions); + " Number of Rays per Iteration = {}\n", settings::n_particles); + fmt::print(" Inactive Distance = {} cm\n", + RandomRay::distance_inactive_); + fmt::print(" Active Distance = {} cm\n", + RandomRay::distance_active_); + fmt::print(" Source Regions (SRs) = {}\n", n_source_regions); + fmt::print( + " SRs Containing External Sources = {}\n", n_external_source_regions); fmt::print(" Total Geometric Intersections = {:.4e}\n", static_cast(total_geometric_intersections)); fmt::print(" Avg per Iteration = {:.4e}\n", static_cast(total_geometric_intersections) / settings::n_batches); - fmt::print(" Avg per Iteration per FSR = {:.2f}\n", + fmt::print(" Avg per Iteration per SR = {:.2f}\n", static_cast(total_geometric_intersections) / static_cast(settings::n_batches) / n_source_regions); - fmt::print(" Avg FSR Miss Rate per Iteration = {:.4f}%\n", avg_miss_rate); + fmt::print(" Avg SR Miss Rate per Iteration = {:.4f}%\n", avg_miss_rate); fmt::print(" Energy Groups = {}\n", negroups); fmt::print( " Total Integrations = {:.4e}\n", total_integrations); @@ -612,6 +598,33 @@ void RandomRaySimulation::print_results_random_ray( std::string adjoint_true = (FlatSourceDomain::adjoint_) ? "ON" : "OFF"; fmt::print(" Adjoint Flux Mode = {}\n", adjoint_true); + std::string shape; + switch (RandomRay::source_shape_) { + case RandomRaySourceShape::FLAT: + shape = "Flat"; + break; + case RandomRaySourceShape::LINEAR: + shape = "Linear"; + break; + case RandomRaySourceShape::LINEAR_XY: + shape = "Linear XY"; + break; + default: + fatal_error("Invalid random ray source shape"); + } + fmt::print(" Source Shape = {}\n", shape); + std::string sample_method = + (RandomRay::sample_method_ == RandomRaySampleMethod::PRNG) ? "PRNG" + : "Halton"; + fmt::print(" Sample Method = {}\n", sample_method); + + if (domain_->is_transport_stabilization_needed_) { + fmt::print(" Transport XS Stabilization Used = YES (rho = {:.3f})\n", + FlatSourceDomain::diagonal_stabilization_rho_); + } else { + fmt::print(" Transport XS Stabilization Used = NO\n"); + } + header("Timing Statistics", 4); show_time("Total time for initialization", time_initialize.elapsed()); show_time("Reading cross sections", time_read_xs.elapsed(), 1); diff --git a/src/random_ray/source_region.cpp b/src/random_ray/source_region.cpp index 6c0df0157..3b06f0ed0 100644 --- a/src/random_ray/source_region.cpp +++ b/src/random_ray/source_region.cpp @@ -48,7 +48,7 @@ SourceRegion::SourceRegion(int negroups, bool is_linear) } scalar_flux_new_.assign(negroups, 0.0); - source_.resize(negroups); + source_.assign(negroups, 0.0); scalar_flux_final_.assign(negroups, 0.0); tally_task_.resize(negroups); @@ -60,25 +60,6 @@ SourceRegion::SourceRegion(int negroups, bool is_linear) } } -SourceRegion::SourceRegion(const SourceRegionHandle& handle, int64_t parent_sr) - : SourceRegion(handle.negroups_, handle.is_linear_) -{ - material_ = handle.material(); - mesh_ = handle.mesh(); - parent_sr_ = parent_sr; - for (int g = 0; g < scalar_flux_new_.size(); g++) { - scalar_flux_old_[g] = handle.scalar_flux_old(g); - source_[g] = handle.source(g); - } - - if (settings::run_mode == RunMode::FIXED_SOURCE) { - external_source_present_ = handle.external_source_present(); - for (int g = 0; g < scalar_flux_new_.size(); g++) { - external_source_[g] = handle.external_source(g); - } - } -} - //============================================================================== // SourceRegionContainer implementation //============================================================================== @@ -217,7 +198,11 @@ SourceRegionHandle SourceRegionContainer::get_source_region_handle(int64_t sr) handle.scalar_flux_old_ = &scalar_flux_old(sr, 0); handle.scalar_flux_new_ = &scalar_flux_new(sr, 0); handle.source_ = &source(sr, 0); - handle.external_source_ = &external_source(sr, 0); + if (settings::run_mode == RunMode::FIXED_SOURCE) { + handle.external_source_ = &external_source(sr, 0); + } else { + handle.external_source_ = nullptr; + } handle.scalar_flux_final_ = &scalar_flux_final(sr, 0); handle.tally_task_ = &tally_task(sr, 0); @@ -255,15 +240,14 @@ void SourceRegionContainer::adjoint_reset() MomentMatrix {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}); std::fill(mom_matrix_t_.begin(), mom_matrix_t_.end(), MomentMatrix {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}); - for (auto& task_set : volume_task_) { - task_set.clear(); + if (settings::run_mode == RunMode::FIXED_SOURCE) { + std::fill(scalar_flux_old_.begin(), scalar_flux_old_.end(), 0.0); + } else { + std::fill(scalar_flux_old_.begin(), scalar_flux_old_.end(), 1.0); } - std::fill(scalar_flux_old_.begin(), scalar_flux_old_.end(), 0.0); std::fill(scalar_flux_new_.begin(), scalar_flux_new_.end(), 0.0); - std::fill(scalar_flux_final_.begin(), scalar_flux_final_.end(), 0.0); std::fill(source_.begin(), source_.end(), 0.0f); std::fill(external_source_.begin(), external_source_.end(), 0.0f); - std::fill(source_gradients_.begin(), source_gradients_.end(), MomentArray {0.0, 0.0, 0.0}); std::fill(flux_moments_old_.begin(), flux_moments_old_.end(), @@ -272,10 +256,6 @@ void SourceRegionContainer::adjoint_reset() MomentArray {0.0, 0.0, 0.0}); std::fill(flux_moments_t_.begin(), flux_moments_t_.end(), MomentArray {0.0, 0.0, 0.0}); - - for (auto& task_set : tally_task_) { - task_set.clear(); - } } } // namespace openmc diff --git a/src/reaction.cpp b/src/reaction.cpp index 971473438..d96790c6d 100644 --- a/src/reaction.cpp +++ b/src/reaction.cpp @@ -202,6 +202,9 @@ std::unordered_map REACTION_NAME_MAP { {SCORE_FISS_Q_PROMPT, "fission-q-prompt"}, {SCORE_FISS_Q_RECOV, "fission-q-recoverable"}, {SCORE_PULSE_HEIGHT, "pulse-height"}, + {SCORE_IFP_TIME_NUM, "ifp-time-numerator"}, + {SCORE_IFP_BETA_NUM, "ifp-beta-numerator"}, + {SCORE_IFP_DENOM, "ifp-denominator"}, // Normal ENDF-based reactions {TOTAL_XS, "(n,total)"}, {ELASTIC, "(n,elastic)"}, diff --git a/src/scattdata.cpp b/src/scattdata.cpp index 813f9e19b..21b18cbd9 100644 --- a/src/scattdata.cpp +++ b/src/scattdata.cpp @@ -37,22 +37,12 @@ void ScattData::base_init(int order, const xt::xtensor& in_gmin, mult[gin] = in_mult[gin]; // Make sure the multiplicity does not have 0s - unsigned long int num_converted = 0; for (int go = 0; go < mult[gin].size(); go++) { if (mult[gin][go] == 0.) { - num_converted += 1; mult[gin][go] = 1.; } } - if (num_converted > 0) { - // Raise a warning to the user if we did have to do the conversion - std::string msg = - std::to_string(num_converted) + - " entries in the Multiplicity Matrix were changed from 0 to 1"; - warning(msg); - } - // Make sure the energy is normalized double norm = std::accumulate(energy[gin].begin(), energy[gin].end(), 0.); diff --git a/src/secondary_correlated.cpp b/src/secondary_correlated.cpp index 0e4891dd3..e820419b4 100644 --- a/src/secondary_correlated.cpp +++ b/src/secondary_correlated.cpp @@ -10,6 +10,7 @@ #include "openmc/endf.h" #include "openmc/hdf5_interface.h" +#include "openmc/math_functions.h" #include "openmc/random_lcg.h" #include "openmc/search.h" @@ -156,21 +157,10 @@ CorrelatedAngleEnergy::CorrelatedAngleEnergy(hid_t group) void CorrelatedAngleEnergy::sample( double E_in, double& E_out, double& mu, uint64_t* seed) const { - // Find energy bin and calculate interpolation factor -- if the energy is - // outside the range of the tabulated energies, choose the first or last bins - auto n_energy_in = energy_.size(); + // Find energy bin and calculate interpolation factor int i; double r; - if (E_in < energy_[0]) { - i = 0; - r = 0.0; - } else if (E_in > energy_[n_energy_in - 1]) { - i = n_energy_in - 2; - r = 1.0; - } else { - i = lower_bound_index(energy_.begin(), energy_.end(), E_in); - r = (E_in - energy_[i]) / (energy_[i + 1] - energy_[i]); - } + get_energy_index(energy_, E_in, i, r); // Sample between the ith and [i+1]th bin int l = r > prn(seed) ? i + 1 : i; @@ -257,9 +247,9 @@ void CorrelatedAngleEnergy::sample( // Find correlated angular distribution for closest outgoing energy bin if (r1 - c_k < c_k1 - r1 || distribution_[l].interpolation == Interpolation::histogram) { - mu = distribution_[l].angle[k]->sample(seed); + mu = distribution_[l].angle[k]->sample(seed).first; } else { - mu = distribution_[l].angle[k + 1]->sample(seed); + mu = distribution_[l].angle[k + 1]->sample(seed).first; } } diff --git a/src/secondary_kalbach.cpp b/src/secondary_kalbach.cpp index 4a7878343..6ac91e665 100644 --- a/src/secondary_kalbach.cpp +++ b/src/secondary_kalbach.cpp @@ -9,6 +9,7 @@ #include "xtensor/xview.hpp" #include "openmc/hdf5_interface.h" +#include "openmc/math_functions.h" #include "openmc/random_dist.h" #include "openmc/random_lcg.h" #include "openmc/search.h" @@ -117,21 +118,10 @@ KalbachMann::KalbachMann(hid_t group) void KalbachMann::sample( double E_in, double& E_out, double& mu, uint64_t* seed) const { - // Find energy bin and calculate interpolation factor -- if the energy is - // outside the range of the tabulated energies, choose the first or last bins - auto n_energy_in = energy_.size(); + // Find energy bin and calculate interpolation factor int i; double r; - if (E_in < energy_[0]) { - i = 0; - r = 0.0; - } else if (E_in > energy_[n_energy_in - 1]) { - i = n_energy_in - 2; - r = 1.0; - } else { - i = lower_bound_index(energy_.begin(), energy_.end(), E_in); - r = (E_in - energy_[i]) / (energy_[i + 1] - energy_[i]); - } + get_energy_index(energy_, E_in, i, r); // Sample between the ith and [i+1]th bin int l = r > prn(seed) ? i + 1 : i; diff --git a/src/secondary_thermal.cpp b/src/secondary_thermal.cpp index 8b9e8737c..030d398aa 100644 --- a/src/secondary_thermal.cpp +++ b/src/secondary_thermal.cpp @@ -1,6 +1,7 @@ #include "openmc/secondary_thermal.h" #include "openmc/hdf5_interface.h" +#include "openmc/math_functions.h" #include "openmc/random_lcg.h" #include "openmc/search.h" @@ -11,20 +12,6 @@ namespace openmc { -// Helper function to get index on incident energy grid -void get_energy_index( - const vector& energies, double E, int& i, double& f) -{ - // Get index and interpolation factor for elastic grid - i = 0; - f = 0.0; - if (E >= energies.front()) { - i = lower_bound_index(energies.begin(), energies.end(), E); - if (i + 1 < energies.size()) - f = (E - energies[i]) / (energies[i + 1] - energies[i]); - } -} - //============================================================================== // CoherentElasticAE implementation //============================================================================== diff --git a/src/settings.cpp b/src/settings.cpp index 49b6590ec..5b472468f 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -11,6 +11,7 @@ #endif #include "openmc/capi.h" +#include "openmc/collision_track.h" #include "openmc/constants.h" #include "openmc/container_util.h" #include "openmc/distribution.h" @@ -26,6 +27,7 @@ #include "openmc/plot.h" #include "openmc/random_lcg.h" #include "openmc/random_ray/random_ray.h" +#include "openmc/reaction.h" #include "openmc/simulation.h" #include "openmc/source.h" #include "openmc/string_utils.h" @@ -45,6 +47,7 @@ namespace settings { // Default values for boolean flags bool assume_separate {false}; bool check_overlaps {false}; +bool collision_track {false}; bool cmfd_run {false}; bool confidence_intervals {false}; bool create_delayed_neutrons {true}; @@ -52,6 +55,7 @@ bool create_fission_neutrons {true}; bool delayed_photon_scaling {true}; bool entropy_on {false}; bool event_based {false}; +bool ifp_on {false}; bool legendre_to_tabular {true}; bool material_cell_offsets {true}; bool output_summary {true}; @@ -106,11 +110,14 @@ int max_particle_events {1000000}; ElectronTreatment electron_treatment {ElectronTreatment::TTB}; array energy_cutoff {0.0, 1000.0, 0.0, 0.0}; array time_cutoff {INFTY, INFTY, INFTY, INFTY}; +int ifp_n_generation {-1}; +IFPParameter ifp_parameter {IFPParameter::None}; int legendre_to_tabular_points {C_NONE}; int max_order {0}; int n_log_bins {8000}; int n_batches; int n_max_batches; +int max_secondaries {10000}; int max_history_splits {10'000'000}; int max_tracks {1000}; ResScatMethod res_scat_method {ResScatMethod::rvs}; @@ -121,7 +128,10 @@ RunMode run_mode {RunMode::UNSET}; SolverType solver_type {SolverType::MONTE_CARLO}; std::unordered_set sourcepoint_batch; std::unordered_set statepoint_batch; +double source_rejection_fraction {0.05}; +double free_gas_threshold {400.0}; std::unordered_set source_write_surf_id; +CollisionTrackConfig collision_track_config {}; int64_t ssw_max_particles; int64_t ssw_max_files; int64_t ssw_cell_id {C_NONE}; @@ -135,7 +145,7 @@ int trace_gen; int64_t trace_particle; vector> track_identifiers; int trigger_batch_interval {1}; -int verbosity {7}; +int verbosity {-1}; double weight_cutoff {0.25}; double weight_survive {1.0}; @@ -341,10 +351,18 @@ void get_run_parameters(pugi::xml_node node_base) } FlatSourceDomain::mesh_domain_map_[mesh_id].emplace_back( type, domain_id); - RandomRay::mesh_subdivision_enabled_ = true; } } } + if (check_for_node(random_ray_node, "diagonal_stabilization_rho")) { + FlatSourceDomain::diagonal_stabilization_rho_ = std::stod( + get_node_value(random_ray_node, "diagonal_stabilization_rho")); + if (FlatSourceDomain::diagonal_stabilization_rho_ < 0.0 || + FlatSourceDomain::diagonal_stabilization_rho_ > 1.0) { + fatal_error("Random ray diagonal stabilization rho factor must be " + "between 0 and 1"); + } + } } } @@ -378,8 +396,10 @@ void read_settings_xml() xml_node root = doc.document_element(); // Verbosity - if (check_for_node(root, "verbosity")) { + if (check_for_node(root, "verbosity") && verbosity == -1) { verbosity = std::stoi(get_node_value(root, "verbosity")); + } else if (verbosity == -1) { + verbosity = 7; } // To this point, we haven't displayed any output since we didn't know what @@ -527,6 +547,20 @@ void read_settings_xml(pugi::xml_node root) } else if (rel_max_lost_particles <= 0.0 || rel_max_lost_particles >= 1.0) { fatal_error("Relative max lost particles must be between zero and one."); } + + // Check for user value for the number of generation of the Iterated Fission + // Probability (IFP) method + if (check_for_node(root, "ifp_n_generation")) { + ifp_n_generation = std::stoi(get_node_value(root, "ifp_n_generation")); + if (ifp_n_generation <= 0) { + fatal_error("'ifp_n_generation' must be greater than 0."); + } + // Avoid tallying 0 if IFP logs are not complete when active cycles start + if (ifp_n_generation > n_inactive) { + fatal_error("'ifp_n_generation' must be lower than or equal to the " + "number of inactive cycles."); + } + } } // Copy plotting random number seed if specified @@ -608,13 +642,6 @@ void read_settings_xml(pugi::xml_node root) model::external_sources.push_back(make_unique(path)); } - // Build probability mass function for sampling external sources - vector source_strengths; - for (auto& s : model::external_sources) { - source_strengths.push_back(s->strength()); - } - model::external_sources_probability.assign(source_strengths); - // If no source specified, default to isotropic point source at origin with // Watt spectrum. No default source is needed in random ray mode. if (model::external_sources.empty() && @@ -627,11 +654,28 @@ void read_settings_xml(pugi::xml_node root) UPtrDist {new Discrete(T, p, 1)})); } + // Build probability mass function for sampling external sources + vector source_strengths; + for (auto& s : model::external_sources) { + source_strengths.push_back(s->strength()); + } + model::external_sources_probability.assign(source_strengths); + // Check if we want to write out source if (check_for_node(root, "write_initial_source")) { write_initial_source = get_node_value_bool(root, "write_initial_source"); } + // Get relative number of lost particles + if (check_for_node(root, "source_rejection_fraction")) { + source_rejection_fraction = + std::stod(get_node_value(root, "source_rejection_fraction")); + } + + if (check_for_node(root, "free_gas_threshold")) { + free_gas_threshold = std::stod(get_node_value(root, "free_gas_threshold")); + } + // Survival biasing if (check_for_node(root, "survival_biasing")) { survival_biasing = get_node_value_bool(root, "survival_biasing"); @@ -825,12 +869,6 @@ void read_settings_xml(pugi::xml_node root) } if (check_for_node(node_sp, "mcpl")) { source_mcpl_write = get_node_value_bool(node_sp, "mcpl"); - - // Make sure MCPL support is enabled - if (source_mcpl_write && !MCPL_ENABLED) { - fatal_error( - "Your build of OpenMC does not support writing MCPL source files."); - } } if (check_for_node(node_sp, "overwrite_latest")) { source_latest = get_node_value_bool(node_sp, "overwrite_latest"); @@ -883,12 +921,6 @@ void read_settings_xml(pugi::xml_node root) if (check_for_node(node_ssw, "mcpl")) { surf_mcpl_write = get_node_value_bool(node_ssw, "mcpl"); - - // Make sure MCPL support is enabled - if (surf_mcpl_write && !MCPL_ENABLED) { - fatal_error("Your build of OpenMC does not support writing MCPL " - "surface source files."); - } } // Get cell information if (check_for_node(node_ssw, "cell")) { @@ -913,8 +945,72 @@ void read_settings_xml(pugi::xml_node root) } } - // If source is not separate and is to be written out in the statepoint file, - // make sure that the sourcepoint batch numbers are contained in the + // Check if the user has specified to write specific collisions + if (check_for_node(root, "collision_track")) { + settings::collision_track = true; + // Get collision track node + xml_node node_ct = root.child("collision_track"); + collision_track_config = CollisionTrackConfig {}; + + // Determine cell ids at which crossing particles are to be banked + if (check_for_node(node_ct, "cell_ids")) { + auto temp = get_node_array(node_ct, "cell_ids"); + for (const auto& b : temp) { + collision_track_config.cell_ids.insert(b); + } + } + if (check_for_node(node_ct, "reactions")) { + auto temp = get_node_array(node_ct, "reactions"); + for (const auto& b : temp) { + int reaction_int = reaction_type(b); + if (reaction_int > 0) { + collision_track_config.mt_numbers.insert(reaction_int); + } + } + } + if (check_for_node(node_ct, "universe_ids")) { + auto temp = get_node_array(node_ct, "universe_ids"); + for (const auto& b : temp) { + collision_track_config.universe_ids.insert(b); + } + } + if (check_for_node(node_ct, "material_ids")) { + auto temp = get_node_array(node_ct, "material_ids"); + for (const auto& b : temp) { + collision_track_config.material_ids.insert(b); + } + } + if (check_for_node(node_ct, "nuclides")) { + auto temp = get_node_array(node_ct, "nuclides"); + for (const auto& b : temp) { + collision_track_config.nuclides.insert(b); + } + } + if (check_for_node(node_ct, "deposited_E_threshold")) { + collision_track_config.deposited_energy_threshold = + std::stod(get_node_value(node_ct, "deposited_E_threshold")); + } + // Get maximum number of particles to be banked per collision + if (check_for_node(node_ct, "max_collisions")) { + collision_track_config.max_collisions = + std::stoll(get_node_value(node_ct, "max_collisions")); + } else { + warning("A maximum number of collisions needs to be specified. " + "By default the code sets 'max_collisions' parameter equals to " + "1000."); + } + // Get maximum number of collision_track files to be created + if (check_for_node(node_ct, "max_collision_track_files")) { + collision_track_config.max_files = + std::stoll(get_node_value(node_ct, "max_collision_track_files")); + } + if (check_for_node(node_ct, "mcpl")) { + collision_track_config.mcpl_write = get_node_value_bool(node_ct, "mcpl"); + } + } + + // If source is not separate and is to be written out in the statepoint + // file, make sure that the sourcepoint batch numbers are contained in the // statepoint list if (!source_separate) { for (const auto& b : sourcepoint_batch) { @@ -1123,6 +1219,11 @@ void read_settings_xml(pugi::xml_node root) weight_windows_on = get_node_value_bool(root, "weight_windows_on"); } + if (check_for_node(root, "max_secondaries")) { + settings::max_secondaries = + std::stoi(get_node_value(root, "max_secondaries")); + } + if (check_for_node(root, "max_history_splits")) { settings::max_history_splits = std::stoi(get_node_value(root, "max_history_splits")); @@ -1140,8 +1241,8 @@ void read_settings_xml(pugi::xml_node root) variance_reduction::weight_windows_generators.emplace_back( std::make_unique(node_wwg)); } - // if any of the weight windows are intended to be generated otf, make sure - // they're applied + // if any of the weight windows are intended to be generated otf, make + // sure they're applied for (const auto& wwg : variance_reduction::weight_windows_generators) { if (wwg->on_the_fly_) { settings::weight_windows_on = true; @@ -1189,11 +1290,6 @@ extern "C" int openmc_set_n_batches( return OPENMC_E_INVALID_ARGUMENT; } - if (simulation::current_batch >= n_batches) { - set_errmsg("Number of batches must be greater than current batch."); - return OPENMC_E_INVALID_ARGUMENT; - } - if (!settings::trigger_on) { // Set n_batches and n_max_batches to same value settings::n_batches = n_batches; diff --git a/src/simulation.cpp b/src/simulation.cpp index 74a7dbe63..b536ae588 100644 --- a/src/simulation.cpp +++ b/src/simulation.cpp @@ -2,13 +2,14 @@ #include "openmc/bank.h" #include "openmc/capi.h" +#include "openmc/collision_track.h" #include "openmc/container_util.h" #include "openmc/eigenvalue.h" #include "openmc/error.h" #include "openmc/event.h" #include "openmc/geometry_aux.h" +#include "openmc/ifp.h" #include "openmc/material.h" -#include "openmc/mcpl_interface.h" #include "openmc/message_passing.h" #include "openmc/nuclide.h" #include "openmc/output.h" @@ -117,6 +118,7 @@ int openmc_simulation_init() // Reset global variables -- this is done before loading state point (as that // will potentially populate k_generation and entropy) simulation::current_batch = 0; + simulation::ct_current_file = 1; simulation::ssw_current_file = 1; simulation::k_generation.clear(); simulation::entropy.clear(); @@ -296,6 +298,7 @@ namespace openmc { namespace simulation { +int ct_current_file; int current_batch; int current_gen; bool initialized {false}; @@ -335,12 +338,22 @@ void allocate_banks() // Allocate fission bank init_fission_bank(3 * simulation::work_per_rank); + + // Allocate IFP bank + if (settings::ifp_on) { + resize_simulation_ifp_banks(); + } } if (settings::surf_source_write) { // Allocate surface source bank simulation::surf_source_bank.reserve(settings::ssw_max_particles); } + + if (settings::collision_track) { + // Allocate collision track bank + collision_track_reserve_bank(); + } } void initialize_batch() @@ -484,6 +497,10 @@ void finalize_batch() ++simulation::ssw_current_file; } } + // Write collision track file if requested + if (settings::collision_track) { + collision_track_flush_bank(); + } } void initialize_generation() @@ -608,6 +625,10 @@ void initialize_history(Particle& p, int64_t index_source) // Set particle track. p.write_track() = check_track_criteria(p); + // Set the particle's initial weight window value. + p.wgt_ww_born() = -1.0; + apply_weight_windows(p); + // Display message if high verbosity or trace is on if (settings::verbosity >= 9 || p.trace()) { write_message("Simulating Particle {}", p.id()); @@ -661,8 +682,9 @@ void calculate_work() void initialize_data() { // Determine minimum/maximum energy for incident neutron/photon data - data::energy_max = {INFTY, INFTY}; - data::energy_min = {0.0, 0.0}; + data::energy_max = {INFTY, INFTY, INFTY, INFTY}; + data::energy_min = {0.0, 0.0, 0.0, 0.0}; + for (const auto& nuc : data::nuclides) { if (nuc->grid_.size() >= 1) { int neutron = static_cast(ParticleType::neutron); @@ -690,11 +712,21 @@ void initialize_data() // than the current minimum/maximum if (data::ttb_e_grid.size() >= 1) { int photon = static_cast(ParticleType::photon); + int electron = static_cast(ParticleType::electron); + int positron = static_cast(ParticleType::positron); int n_e = data::ttb_e_grid.size(); + + const std::vector charged = {electron, positron}; + for (auto t : charged) { + data::energy_min[t] = std::exp(data::ttb_e_grid(1)); + data::energy_max[t] = std::exp(data::ttb_e_grid(n_e - 1)); + } + data::energy_min[photon] = - std::max(data::energy_min[photon], std::exp(data::ttb_e_grid(1))); - data::energy_max[photon] = std::min( - data::energy_max[photon], std::exp(data::ttb_e_grid(n_e - 1))); + std::max(data::energy_min[photon], data::energy_min[electron]); + + data::energy_max[photon] = + std::min(data::energy_max[photon], data::energy_max[electron]); } } } @@ -777,7 +809,7 @@ void transport_history_based_single_particle(Particle& p) p.event_advance(); } if (p.alive()) { - if (p.collision_distance() > p.boundary().distance) { + if (p.collision_distance() > p.boundary().distance()) { p.event_cross_surface(); } else if (p.alive()) { p.event_collide(); diff --git a/src/source.cpp b/src/source.cpp index c1b4ce260..b30b964d3 100644 --- a/src/source.cpp +++ b/src/source.cpp @@ -157,11 +157,28 @@ void Source::read_constraints(pugi::xml_node node) } } +void check_rejection_fraction(int64_t n_reject, int64_t n_accept) +{ + // Don't check unless we've hit a minimum number of total sites rejected + if (n_reject < EXTSRC_REJECT_THRESHOLD) + return; + + // Compute fraction of accepted sites and compare against minimum + double fraction = static_cast(n_accept) / n_reject; + if (fraction <= settings::source_rejection_fraction) { + fatal_error(fmt::format( + "Too few source sites satisfied the constraints (minimum source " + "rejection fraction = {}). Please check your source definition or " + "set a lower value of Settings.source_rejection_fraction.", + settings::source_rejection_fraction)); + } +} + SourceSite Source::sample_with_constraints(uint64_t* seed) const { bool accepted = false; - static int n_reject = 0; - static int n_accept = 0; + static int64_t n_reject = 0; + static int64_t n_accept = 0; SourceSite site; while (!accepted) { @@ -176,13 +193,9 @@ SourceSite Source::sample_with_constraints(uint64_t* seed) const satisfies_energy_constraints(site.E) && satisfies_time_constraints(site.time); if (!accepted) { + // Increment number of rejections and check against minimum fraction ++n_reject; - if (n_reject >= EXTSRC_REJECT_THRESHOLD && - static_cast(n_accept) / n_reject <= - EXTSRC_REJECT_FRACTION) { - fatal_error("More than 95% of external source sites sampled were " - "rejected. Please check your source definition."); - } + check_rejection_fraction(n_reject, n_accept); // For the "kill" strategy, accept particle but set weight to 0 so that // it is terminated immediately @@ -226,14 +239,17 @@ bool Source::satisfies_spatial_constraints(Position r) const if (!domain_ids_.empty()) { if (domain_type_ == DomainType::MATERIAL) { auto mat_index = geom_state.material(); - if (mat_index != MATERIAL_VOID) { + if (mat_index == MATERIAL_VOID) { + accepted = false; + } else { accepted = contains(domain_ids_, model::materials[mat_index]->id()); } } else { for (int i = 0; i < geom_state.n_coord(); i++) { - auto id = (domain_type_ == DomainType::CELL) - ? model::cells[geom_state.coord(i).cell]->id_ - : model::universes[geom_state.coord(i).universe]->id_; + auto id = + (domain_type_ == DomainType::CELL) + ? model::cells[geom_state.coord(i).cell()].get()->id_ + : model::universes[geom_state.coord(i).universe()].get()->id_; if ((accepted = contains(domain_ids_, id))) break; } @@ -274,6 +290,12 @@ IndependentSource::IndependentSource(pugi::xml_node node) : Source(node) } else if (temp_str == "photon") { particle_ = ParticleType::photon; settings::photon_transport = true; + } else if (temp_str == "electron") { + particle_ = ParticleType::electron; + settings::photon_transport = true; + } else if (temp_str == "positron") { + particle_ = ParticleType::positron; + settings::photon_transport = true; } else { fatal_error(std::string("Unknown source particle type: ") + temp_str); } @@ -334,16 +356,20 @@ SourceSite IndependentSource::sample(uint64_t* seed) const { SourceSite site; site.particle = particle_; + double r_wgt = 1.0; + double E_wgt = 1.0; // Repeat sampling source location until a good site has been accepted bool accepted = false; - static int n_reject = 0; - static int n_accept = 0; + static int64_t n_reject = 0; + static int64_t n_accept = 0; while (!accepted) { // Sample spatial distribution - site.r = space_->sample(seed); + auto [r, r_wgt_temp] = space_->sample(seed); + site.r = r; + r_wgt = r_wgt_temp; // Check if sampled position satisfies spatial constraints accepted = satisfies_spatial_constraints(site.r); @@ -351,17 +377,15 @@ SourceSite IndependentSource::sample(uint64_t* seed) const // Check for rejection if (!accepted) { ++n_reject; - if (n_reject >= EXTSRC_REJECT_THRESHOLD && - static_cast(n_accept) / n_reject <= EXTSRC_REJECT_FRACTION) { - fatal_error("More than 95% of external source sites sampled were " - "rejected. Please check your external source's spatial " - "definition."); - } + check_rejection_fraction(n_reject, n_accept); } } // Sample angle - site.u = angle_->sample(seed); + auto [u, u_wgt] = angle_->sample(seed); + site.u = u; + + site.wgt = r_wgt * u_wgt; // Sample energy and time for neutron and photon sources if (settings::solver_type != SolverType::RANDOM_RAY) { @@ -378,25 +402,24 @@ SourceSite IndependentSource::sample(uint64_t* seed) const while (true) { // Sample energy spectrum - site.E = energy_->sample(seed); + auto [E, E_wgt_temp] = energy_->sample(seed); + site.E = E; + E_wgt = E_wgt_temp; // Resample if energy falls above maximum particle energy - if (site.E < data::energy_max[p] and + if (site.E < data::energy_max[p] && (satisfies_energy_constraints(site.E))) break; n_reject++; - if (n_reject >= EXTSRC_REJECT_THRESHOLD && - static_cast(n_accept) / n_reject <= EXTSRC_REJECT_FRACTION) { - fatal_error( - "More than 95% of external source sites sampled were " - "rejected. Please check your external source energy spectrum " - "definition."); - } + check_rejection_fraction(n_reject, n_accept); } // Sample particle creation time - site.time = time_->sample(seed); + auto [time, time_wgt] = time_->sample(seed); + site.time = time; + + site.wgt *= (E_wgt * time_wgt); } // Increment number of accepted samples @@ -412,11 +435,7 @@ SourceSite IndependentSource::sample(uint64_t* seed) const FileSource::FileSource(pugi::xml_node node) : Source(node) { auto path = get_node_value(node, "file", false, true); - if (ends_with(path, ".mcpl") || ends_with(path, ".mcpl.gz")) { - sites_ = mcpl_source_sites(path); - } else { - this->load_sites_from_file(path); - } + load_sites_from_file(path); } FileSource::FileSource(const std::string& path) @@ -426,30 +445,33 @@ FileSource::FileSource(const std::string& path) void FileSource::load_sites_from_file(const std::string& path) { - // Check if source file exists - if (!file_exists(path)) { - fatal_error(fmt::format("Source file '{}' does not exist.", path)); + // If MCPL file, use the dedicated file reader + if (ends_with(path, ".mcpl") || ends_with(path, ".mcpl.gz")) { + sites_ = mcpl_source_sites(path); + } else { + // Check if source file exists + if (!file_exists(path)) { + fatal_error(fmt::format("Source file '{}' does not exist.", path)); + } + + write_message(6, "Reading source file from {}...", path); + + // Open the binary file + hid_t file_id = file_open(path, 'r', true); + + // Check to make sure this is a source file + std::string filetype; + read_attribute(file_id, "filetype", filetype); + if (filetype != "source" && filetype != "statepoint") { + fatal_error("Specified starting source file not a source file type."); + } + + // Read in the source particles + read_source_bank(file_id, sites_, false); + + // Close file + file_close(file_id); } - - // Read the source from a binary file instead of sampling from some - // assumed source distribution - write_message(6, "Reading source file from {}...", path); - - // Open the binary file - hid_t file_id = file_open(path, 'r', true); - - // Check to make sure this is a source file - std::string filetype; - read_attribute(file_id, "filetype", filetype); - if (filetype != "source" && filetype != "statepoint") { - fatal_error("Specified starting source file not a source file type."); - } - - // Read in the source particles - read_source_bank(file_id, sites_, false); - - // Close file - file_close(file_id); } SourceSite FileSource::sample(uint64_t* seed) const @@ -523,6 +545,15 @@ CompiledSourceWrapper::~CompiledSourceWrapper() #endif } +//============================================================================== +// MeshElementSpatial implementation +//============================================================================== + +std::pair MeshElementSpatial::sample(uint64_t* seed) const +{ + return {model::meshes[mesh_index_]->sample_element(elem_index_, seed), 1.0}; +} + //============================================================================== // MeshSource implementation //============================================================================== @@ -537,10 +568,23 @@ MeshSource::MeshSource(pugi::xml_node node) : Source(node) // read all source distributions and populate strengths vector for MeshSpatial // object for (auto source_node : node.children("source")) { - sources_.emplace_back(Source::create(source_node)); + auto src = Source::create(source_node); + if (auto ptr = dynamic_cast(src.get())) { + src.release(); + sources_.emplace_back(ptr); + } else { + fatal_error( + "The source assigned to each element must be an IndependentSource."); + } strengths.push_back(sources_.back()->strength()); } + // Set spatial distributions for each mesh element + for (int elem_index = 0; elem_index < sources_.size(); ++elem_index) { + sources_[elem_index]->set_space( + std::make_unique(mesh_idx, elem_index)); + } + // the number of source distributions should either be one or equal to the // number of mesh elements if (sources_.size() > 1 && sources_.size() != mesh->n_bins()) { @@ -554,29 +598,12 @@ MeshSource::MeshSource(pugi::xml_node node) : Source(node) SourceSite MeshSource::sample(uint64_t* seed) const { - // Sample the CDF defined in initialization above + // Sample a mesh element based on the relative strengths int32_t element = space_->sample_element_index(seed); - // Sample position and apply rejection on spatial domains - Position r; - do { - r = space_->mesh()->sample_element(element, seed); - } while (!this->satisfies_spatial_constraints(r)); - - SourceSite site; - while (true) { - // Sample source for the chosen element and replace the position - site = source(element)->sample_with_constraints(seed); - site.r = r; - - // Apply other rejections - if (satisfies_energy_constraints(site.E) && - satisfies_time_constraints(site.time)) { - break; - } - } - - return site; + // Sample the distribution for the specific mesh element; note that the + // spatial distribution has been set for each element using MeshElementSpatial + return source(element)->sample_with_constraints(seed); } //============================================================================== @@ -613,9 +640,10 @@ SourceSite sample_external_source(uint64_t* seed) { // Sample from among multiple source distributions int i = 0; - if (model::external_sources.size() > 1) { + int n_sources = model::external_sources.size(); + if (n_sources > 1) { if (settings::uniform_source_sampling) { - i = prn(seed) * model::external_sources.size(); + i = prn(seed) * n_sources; } else { i = model::external_sources_probability.sample(seed); } @@ -624,9 +652,13 @@ SourceSite sample_external_source(uint64_t* seed) // Sample source site from i-th source distribution SourceSite site {model::external_sources[i]->sample_with_constraints(seed)}; - // Set particle creation weight - if (settings::uniform_source_sampling) { - site.wgt *= model::external_sources[i]->strength(); + // For uniform source sampling, multiply the weight by the ratio of the actual + // probability of sampling source i to the biased probability of sampling + // source i, which is (strength_i / total_strength) / (1 / n) + if (n_sources > 1 && settings::uniform_source_sampling) { + double total_strength = model::external_sources_probability.integral(); + site.wgt *= + model::external_sources[i]->strength() * n_sources / total_strength; } // If running in MG, convert site.E to group diff --git a/src/state_point.cpp b/src/state_point.cpp index 3b822715c..8ccebeb05 100644 --- a/src/state_point.cpp +++ b/src/state_point.cpp @@ -9,6 +9,7 @@ #include #include "openmc/bank.h" +#include "openmc/bank_io.h" #include "openmc/capi.h" #include "openmc/constants.h" #include "openmc/eigenvalue.h" @@ -201,6 +202,12 @@ extern "C" int openmc_statepoint_write(const char* filename, bool* write_source) write_attribute(tally_group, "multiply_density", 0); } + if (tally->higher_moments()) { + write_attribute(tally_group, "higher_moments", 1); + } else { + write_attribute(tally_group, "higher_moments", 0); + } + if (tally->estimator_ == TallyEstimator::ANALOG) { write_dataset(tally_group, "estimator", "analog"); } else if (tally->estimator_ == TallyEstimator::TRACKLENGTH) { @@ -264,12 +271,13 @@ extern "C" int openmc_statepoint_write(const char* filename, bool* write_source) for (const auto& tally : model::tallies) { if (!tally->writable_) continue; - // Write sum and sum_sq for each bin + + // Write results for each bin std::string name = "tally " + std::to_string(tally->id_); hid_t tally_group = open_group(tallies_group, name.c_str()); auto& results = tally->results_; write_tally_results(tally_group, results.shape()[0], - results.shape()[1], results.data()); + results.shape()[1], results.shape()[2], results.data()); close_group(tally_group); } } else { @@ -340,7 +348,7 @@ extern "C" int openmc_statepoint_write(const char* filename, bool* write_source) file_close(file_id); } -#if defined(LIBMESH) || defined(DAGMC) +#if defined(OPENMC_LIBMESH_ENABLED) || defined(OPENMC_DAGMC_ENABLED) // write unstructured mesh tally files write_unstructured_mesh_results(); #endif @@ -436,7 +444,8 @@ extern "C" int openmc_statepoint_load(const char* filename) // Read batch number to restart at read_dataset(file_id, "current_batch", simulation::restart_batch); - if (simulation::restart_batch >= settings::n_max_batches) { + if (settings::restart_run && + simulation::restart_batch >= settings::n_max_batches) { warning(fmt::format( "The number of batches specified for simulation ({}) is smaller " "than or equal to the number of batches in the restart statepoint file " @@ -508,7 +517,8 @@ extern "C" int openmc_statepoint_load(const char* filename) } else { auto& results = tally->results_; read_tally_results(tally_group, results.shape()[0], - results.shape()[1], results.data()); + results.shape()[1], results.shape()[2], results.data()); + read_dataset(tally_group, "n_realizations", tally->n_realizations_); close_group(tally_group); } @@ -544,7 +554,7 @@ extern "C" int openmc_statepoint_load(const char* filename) return 0; } -hid_t h5banktype() +hid_t h5banktype(bool memory) { // Create compound type for position hid_t postype = H5Tcreate(H5T_COMPOUND, sizeof(struct Position)); @@ -559,7 +569,10 @@ hid_t h5banktype() // - openmc/statepoint.py // - docs/source/io_formats/statepoint.rst // - docs/source/io_formats/source.rst - hid_t banktype = H5Tcreate(H5T_COMPOUND, sizeof(struct SourceSite)); + auto n = sizeof(SourceSite); + if (!memory) + n = 2 * sizeof(struct Position) + 3 * sizeof(double) + 3 * sizeof(int); + hid_t banktype = H5Tcreate(H5T_COMPOUND, n); H5Tinsert(banktype, "r", HOFFSET(SourceSite, r), postype); H5Tinsert(banktype, "u", HOFFSET(SourceSite, u), postype); H5Tinsert(banktype, "E", HOFFSET(SourceSite, E), H5T_NATIVE_DOUBLE); @@ -631,96 +644,19 @@ void write_h5_source_point(const char* filename, span source_bank, void write_source_bank(hid_t group_id, span source_bank, const vector& bank_index) { - hid_t banktype = h5banktype(); - - // Set total and individual process dataspace sizes for source bank - int64_t dims_size = bank_index.back(); - int64_t count_size = bank_index[mpi::rank + 1] - bank_index[mpi::rank]; - -#ifdef PHDF5 - // Set size of total dataspace for all procs and rank - hsize_t dims[] {static_cast(dims_size)}; - hid_t dspace = H5Screate_simple(1, dims, nullptr); - hid_t dset = H5Dcreate(group_id, "source_bank", banktype, dspace, H5P_DEFAULT, - H5P_DEFAULT, H5P_DEFAULT); - - // Create another data space but for each proc individually - hsize_t count[] {static_cast(count_size)}; - hid_t memspace = H5Screate_simple(1, count, nullptr); - - // Select hyperslab for this dataspace - hsize_t start[] {static_cast(bank_index[mpi::rank])}; - H5Sselect_hyperslab(dspace, H5S_SELECT_SET, start, nullptr, count, nullptr); - - // Set up the property list for parallel writing - hid_t plist = H5Pcreate(H5P_DATASET_XFER); - H5Pset_dxpl_mpio(plist, H5FD_MPIO_COLLECTIVE); - - // Write data to file in parallel - H5Dwrite(dset, banktype, memspace, dspace, plist, source_bank.data()); - - // Free resources - H5Sclose(dspace); - H5Sclose(memspace); - H5Dclose(dset); - H5Pclose(plist); + hid_t membanktype = h5banktype(true); + hid_t filebanktype = h5banktype(false); +#ifdef OPENMC_MPI + write_bank_dataset("source_bank", group_id, source_bank, bank_index, + membanktype, filebanktype, mpi::source_site); #else - - if (mpi::master) { - // Create dataset big enough to hold all source sites - hsize_t dims[] {static_cast(dims_size)}; - hid_t dspace = H5Screate_simple(1, dims, nullptr); - hid_t dset = H5Dcreate(group_id, "source_bank", banktype, dspace, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - - // Save source bank sites since the array is overwritten below -#ifdef OPENMC_MPI - vector temp_source {source_bank.begin(), source_bank.end()}; + write_bank_dataset("source_bank", group_id, source_bank, bank_index, + membanktype, filebanktype); #endif - for (int i = 0; i < mpi::n_procs; ++i) { - // Create memory space - hsize_t count[] {static_cast(bank_index[i + 1] - bank_index[i])}; - hid_t memspace = H5Screate_simple(1, count, nullptr); - -#ifdef OPENMC_MPI - // Receive source sites from other processes - if (i > 0) - MPI_Recv(source_bank.data(), count[0], mpi::source_site, i, i, - mpi::intracomm, MPI_STATUS_IGNORE); -#endif - - // Select hyperslab for this dataspace - dspace = H5Dget_space(dset); - hsize_t start[] {static_cast(bank_index[i])}; - H5Sselect_hyperslab( - dspace, H5S_SELECT_SET, start, nullptr, count, nullptr); - - // Write data to hyperslab - H5Dwrite( - dset, banktype, memspace, dspace, H5P_DEFAULT, source_bank.data()); - - H5Sclose(memspace); - H5Sclose(dspace); - } - - // Close all ids - H5Dclose(dset); - -#ifdef OPENMC_MPI - // Restore state of source bank - std::copy(temp_source.begin(), temp_source.end(), source_bank.begin()); -#endif - } else { -#ifdef OPENMC_MPI - MPI_Send(source_bank.data(), count_size, mpi::source_site, 0, mpi::rank, - mpi::intracomm); -#endif - } -#endif - - H5Tclose(banktype); + H5Tclose(membanktype); + H5Tclose(filebanktype); } // Determine member names of a compound HDF5 datatype @@ -741,7 +677,7 @@ std::string dtype_member_names(hid_t dtype_id) void read_source_bank( hid_t group_id, vector& sites, bool distribute) { - hid_t banktype = h5banktype(); + hid_t banktype = h5banktype(true); // Open the dataset hid_t dset = H5Dopen(group_id, "source_bank", H5P_DEFAULT); @@ -1000,7 +936,8 @@ void write_tally_results_nr(hid_t file_id) // Write reduced tally results to file auto shape = results_copy.shape(); - write_tally_results(tally_group, shape[0], shape[1], results_copy.data()); + write_tally_results( + tally_group, shape[0], shape[1], shape[2], results_copy.data()); close_group(tally_group); } else { diff --git a/src/surface.cpp b/src/surface.cpp index 0002275c3..81b756dea 100644 --- a/src/surface.cpp +++ b/src/surface.cpp @@ -9,6 +9,7 @@ #include #include "openmc/array.h" +#include "openmc/cell.h" #include "openmc/container_util.h" #include "openmc/error.h" #include "openmc/external/quartic_solver.h" @@ -172,6 +173,19 @@ void Surface::to_hdf5(hid_t group_id) const if (bc_) { write_string(surf_group, "boundary_type", bc_->type(), false); bc_->to_hdf5(surf_group); + + // write periodic surface ID + if (bc_->type() == "periodic") { + auto pbc = dynamic_cast(bc_.get()); + Surface& surf1 {*model::surfaces[pbc->i_surf()]}; + Surface& surf2 {*model::surfaces[pbc->j_surf()]}; + + if (id_ == surf1.id_) { + write_dataset(surf_group, "periodic_surface_id", surf2.id_); + } else { + write_dataset(surf_group, "periodic_surface_id", surf1.id_); + } + } } else { write_string(surf_group, "boundary_type", "transmission", false); } @@ -238,9 +252,9 @@ void SurfaceXPlane::to_hdf5_inner(hid_t group_id) const BoundingBox SurfaceXPlane::bounding_box(bool pos_side) const { if (pos_side) { - return {x0_, INFTY, -INFTY, INFTY, -INFTY, INFTY}; + return {{x0_, -INFTY, -INFTY}, {INFTY, INFTY, INFTY}}; } else { - return {-INFTY, x0_, -INFTY, INFTY, -INFTY, INFTY}; + return {{-INFTY, -INFTY, -INFTY}, {x0_, INFTY, INFTY}}; } } @@ -278,9 +292,9 @@ void SurfaceYPlane::to_hdf5_inner(hid_t group_id) const BoundingBox SurfaceYPlane::bounding_box(bool pos_side) const { if (pos_side) { - return {-INFTY, INFTY, y0_, INFTY, -INFTY, INFTY}; + return {{-INFTY, y0_, -INFTY}, {INFTY, INFTY, INFTY}}; } else { - return {-INFTY, INFTY, -INFTY, y0_, -INFTY, INFTY}; + return {{-INFTY, -INFTY, -INFTY}, {INFTY, y0_, INFTY}}; } } @@ -318,9 +332,9 @@ void SurfaceZPlane::to_hdf5_inner(hid_t group_id) const BoundingBox SurfaceZPlane::bounding_box(bool pos_side) const { if (pos_side) { - return {-INFTY, INFTY, -INFTY, INFTY, z0_, INFTY}; + return {{-INFTY, -INFTY, z0_}, {INFTY, INFTY, INFTY}}; } else { - return {-INFTY, INFTY, -INFTY, INFTY, -INFTY, z0_}; + return {{-INFTY, -INFTY, -INFTY}, {INFTY, INFTY, z0_}}; } } @@ -479,8 +493,8 @@ void SurfaceXCylinder::to_hdf5_inner(hid_t group_id) const BoundingBox SurfaceXCylinder::bounding_box(bool pos_side) const { if (!pos_side) { - return {-INFTY, INFTY, y0_ - radius_, y0_ + radius_, z0_ - radius_, - z0_ + radius_}; + return {{-INFTY, y0_ - radius_, z0_ - radius_}, + {INFTY, y0_ + radius_, z0_ + radius_}}; } else { return {}; } @@ -522,8 +536,8 @@ void SurfaceYCylinder::to_hdf5_inner(hid_t group_id) const BoundingBox SurfaceYCylinder::bounding_box(bool pos_side) const { if (!pos_side) { - return {x0_ - radius_, x0_ + radius_, -INFTY, INFTY, z0_ - radius_, - z0_ + radius_}; + return {{x0_ - radius_, -INFTY, z0_ - radius_}, + {x0_ + radius_, INFTY, z0_ + radius_}}; } else { return {}; } @@ -566,8 +580,8 @@ void SurfaceZCylinder::to_hdf5_inner(hid_t group_id) const BoundingBox SurfaceZCylinder::bounding_box(bool pos_side) const { if (!pos_side) { - return {x0_ - radius_, x0_ + radius_, y0_ - radius_, y0_ + radius_, -INFTY, - INFTY}; + return {{x0_ - radius_, y0_ - radius_, -INFTY}, + {x0_ + radius_, y0_ + radius_, INFTY}}; } else { return {}; } @@ -644,8 +658,8 @@ void SurfaceSphere::to_hdf5_inner(hid_t group_id) const BoundingBox SurfaceSphere::bounding_box(bool pos_side) const { if (!pos_side) { - return {x0_ - radius_, x0_ + radius_, y0_ - radius_, y0_ + radius_, - z0_ - radius_, z0_ + radius_}; + return {{x0_ - radius_, y0_ - radius_, z0_ - radius_}, + {x0_ + radius_, y0_ + radius_, z0_ + radius_}}; } else { return {}; } @@ -1156,7 +1170,10 @@ Direction SurfaceZTorus::normal(Position r) const //============================================================================== -void read_surfaces(pugi::xml_node node) +void read_surfaces(pugi::xml_node node, + std::set>& periodic_pairs, + std::unordered_map& albedo_map, + std::unordered_map& periodic_sense_map) { // Count the number of surfaces int n_surfaces = 0; @@ -1167,8 +1184,6 @@ void read_surfaces(pugi::xml_node node) // Loop over XML surface elements and populate the array. Keep track of // periodic surfaces and their albedos. model::surfaces.reserve(n_surfaces); - std::set> periodic_pairs; - std::unordered_map albedo_map; { pugi::xml_node surf_node; int i_surf; @@ -1231,6 +1246,7 @@ void read_surfaces(pugi::xml_node node) if (check_for_node(surf_node, "boundary")) { std::string surf_bc = get_node_value(surf_node, "boundary", true, true); if (surf_bc == "periodic") { + periodic_sense_map[model::surfaces.back()->id_] = 0; // Check for surface albedo. Skip sanity check as it is already done // in the Surface class's constructor. if (check_for_node(surf_node, "albedo")) { @@ -1262,6 +1278,28 @@ void read_surfaces(pugi::xml_node node) fmt::format("Two or more surfaces use the same unique ID: {}", id)); } } +} + +void prepare_boundary_conditions(std::set>& periodic_pairs, + std::unordered_map& albedo_map, + std::unordered_map& periodic_sense_map) +{ + // Fill the senses map for periodic surfaces + auto n_periodic = periodic_sense_map.size(); + for (const auto& cell : model::cells) { + if (n_periodic == 0) + break; // Early exit once all periodic surfaces found + + for (auto s : cell->surfaces()) { + auto surf_idx = std::abs(s) - 1; + auto id = model::surfaces[surf_idx]->id_; + + if (periodic_sense_map.count(id)) { + periodic_sense_map[id] = std::copysign(1, s); + --n_periodic; + } + } + } // Resolve unpaired periodic surfaces. A lambda function is used with // std::find_if to identify the unpaired surfaces. @@ -1319,10 +1357,50 @@ void read_surfaces(pugi::xml_node node) // condition. Otherwise, it is a rotational periodic BC. if (std::abs(1.0 - dot_prod) < FP_PRECISION) { surf1.bc_ = make_unique(i_surf, j_surf); - surf2.bc_ = make_unique(i_surf, j_surf); + surf2.bc_ = make_unique(j_surf, i_surf); } else { - surf1.bc_ = make_unique(i_surf, j_surf); - surf2.bc_ = make_unique(i_surf, j_surf); + // check that both normals have at least one 0 component + if (std::abs(norm1.x) > FP_PRECISION && + std::abs(norm1.y) > FP_PRECISION && + std::abs(norm1.z) > FP_PRECISION) { + fatal_error(fmt::format( + "The normal ({}) of the periodic surface ({}) does not contain any " + "component with a zero value. A RotationalPeriodicBC requires one " + "component which is zero for both plane normals.", + norm1, i_surf)); + } + if (std::abs(norm2.x) > FP_PRECISION && + std::abs(norm2.y) > FP_PRECISION && + std::abs(norm2.z) > FP_PRECISION) { + fatal_error(fmt::format( + "The normal ({}) of the periodic surface ({}) does not contain any " + "component with a zero value. A RotationalPeriodicBC requires one " + "component which is zero for both plane normals.", + norm2, j_surf)); + } + // find common zero component, which indicates the periodic axis + RotationalPeriodicBC::PeriodicAxis axis; + if (std::abs(norm1.x) <= FP_PRECISION && + std::abs(norm2.x) <= FP_PRECISION) { + axis = RotationalPeriodicBC::PeriodicAxis::x; + } else if (std::abs(norm1.y) <= FP_PRECISION && + std::abs(norm2.y) <= FP_PRECISION) { + axis = RotationalPeriodicBC::PeriodicAxis::y; + } else if (std::abs(norm1.z) <= FP_PRECISION && + std::abs(norm2.z) <= FP_PRECISION) { + axis = RotationalPeriodicBC::PeriodicAxis::z; + } else { + fatal_error(fmt::format( + "There is no component which is 0.0 in both normal vectors. This " + "indicates that the two planes are not periodic about the X, Y, or Z " + "axis, which is not supported.")); + } + auto i_sign = periodic_sense_map[periodic_pair.first]; + auto j_sign = periodic_sense_map[periodic_pair.second]; + surf1.bc_ = make_unique( + i_sign * (i_surf + 1), j_sign * (j_surf + 1), axis); + surf2.bc_ = make_unique( + j_sign * (j_surf + 1), i_sign * (i_surf + 1), axis); } // If albedo data is present in albedo map, set the boundary albedo. diff --git a/src/tallies/filter.cpp b/src/tallies/filter.cpp index 6430d9ae1..79817981d 100644 --- a/src/tallies/filter.cpp +++ b/src/tallies/filter.cpp @@ -25,6 +25,7 @@ #include "openmc/tallies/filter_materialfrom.h" #include "openmc/tallies/filter_mesh.h" #include "openmc/tallies/filter_meshborn.h" +#include "openmc/tallies/filter_meshmaterial.h" #include "openmc/tallies/filter_meshsurface.h" #include "openmc/tallies/filter_mu.h" #include "openmc/tallies/filter_musurface.h" @@ -36,6 +37,7 @@ #include "openmc/tallies/filter_surface.h" #include "openmc/tallies/filter_time.h" #include "openmc/tallies/filter_universe.h" +#include "openmc/tallies/filter_weight.h" #include "openmc/tallies/filter_zernike.h" #include "openmc/xml_interface.h" @@ -132,6 +134,8 @@ Filter* Filter::create(const std::string& type, int32_t id) return Filter::create(id); } else if (type == "meshborn") { return Filter::create(id); + } else if (type == "meshmaterial") { + return Filter::create(id); } else if (type == "meshsurface") { return Filter::create(id); } else if (type == "mu") { @@ -154,6 +158,8 @@ Filter* Filter::create(const std::string& type, int32_t id) return Filter::create(id); } else if (type == "universe") { return Filter::create(id); + } else if (type == "weight") { + return Filter::create(id); } else if (type == "zernike") { return Filter::create(id); } else if (type == "zernikeradial") { diff --git a/src/tallies/filter_cell.cpp b/src/tallies/filter_cell.cpp index b545801ea..7a6394956 100644 --- a/src/tallies/filter_cell.cpp +++ b/src/tallies/filter_cell.cpp @@ -49,7 +49,7 @@ void CellFilter::get_all_bins( const Particle& p, TallyEstimator estimator, FilterMatch& match) const { for (int i = 0; i < p.n_coord(); i++) { - auto search = map_.find(p.coord(i).cell); + auto search = map_.find(p.coord(i).cell()); if (search != map_.end()) { match.bins_.push_back(search->second); match.weights_.push_back(1.0); diff --git a/src/tallies/filter_cell_instance.cpp b/src/tallies/filter_cell_instance.cpp index 0634175dd..316a758d1 100644 --- a/src/tallies/filter_cell_instance.cpp +++ b/src/tallies/filter_cell_instance.cpp @@ -73,7 +73,7 @@ void CellInstanceFilter::set_cell_instances(span instances) void CellInstanceFilter::get_all_bins( const Particle& p, TallyEstimator estimator, FilterMatch& match) const { - int64_t index_cell = p.lowest_coord().cell; + int64_t index_cell = p.lowest_coord().cell(); int64_t instance = p.cell_instance(); if (cells_.count(index_cell) > 0) { @@ -89,7 +89,7 @@ void CellInstanceFilter::get_all_bins( return; for (int i = 0; i < p.n_coord() - 1; i++) { - int64_t index_cell = p.coord(i).cell; + int64_t index_cell = p.coord(i).cell(); // if this cell isn't used on the filter, move on if (cells_.count(index_cell) == 0) continue; diff --git a/src/tallies/filter_distribcell.cpp b/src/tallies/filter_distribcell.cpp index 821e843da..f511a6816 100644 --- a/src/tallies/filter_distribcell.cpp +++ b/src/tallies/filter_distribcell.cpp @@ -34,7 +34,7 @@ void DistribcellFilter::set_cell(int32_t cell) assert(cell >= 0); assert(cell < model::cells.size()); cell_ = cell; - n_bins_ = model::cells[cell]->n_instances_; + n_bins_ = model::cells[cell]->n_instances(); } void DistribcellFilter::get_all_bins( @@ -43,18 +43,18 @@ void DistribcellFilter::get_all_bins( int offset = 0; auto distribcell_index = model::cells[cell_]->distribcell_index_; for (int i = 0; i < p.n_coord(); i++) { - auto& c {*model::cells[p.coord(i).cell]}; + auto& c {*model::cells[p.coord(i).cell()]}; if (c.type_ == Fill::UNIVERSE) { offset += c.offset_[distribcell_index]; } else if (c.type_ == Fill::LATTICE) { - auto& lat {*model::lattices[p.coord(i + 1).lattice]}; - const auto& i_xyz {p.coord(i + 1).lattice_i}; + auto& lat {*model::lattices[p.coord(i + 1).lattice()]}; + const auto& i_xyz {p.coord(i + 1).lattice_index()}; if (lat.are_valid_indices(i_xyz)) { offset += lat.offset(distribcell_index, i_xyz) + c.offset_[distribcell_index]; } } - if (cell_ == p.coord(i).cell) { + if (cell_ == p.coord(i).cell()) { match.bins_.push_back(offset); match.weights_.push_back(1.0); return; diff --git a/src/tallies/filter_mesh.cpp b/src/tallies/filter_mesh.cpp index 4edfbec4b..a0698992d 100644 --- a/src/tallies/filter_mesh.cpp +++ b/src/tallies/filter_mesh.cpp @@ -6,6 +6,7 @@ #include "openmc/constants.h" #include "openmc/error.h" #include "openmc/mesh.h" +#include "openmc/position.h" #include "openmc/xml_interface.h" namespace openmc { @@ -30,6 +31,10 @@ void MeshFilter::from_xml(pugi::xml_node node) if (check_for_node(node, "translation")) { set_translation(get_node_array(node, "translation")); } + // Read the rotation transform. + if (check_for_node(node, "rotation")) { + set_rotation(get_node_array(node, "rotation")); + } } void MeshFilter::get_all_bins( @@ -45,6 +50,12 @@ void MeshFilter::get_all_bins( last_r -= translation(); r -= translation(); } + // apply rotation if present + if (!rotation_.empty()) { + last_r = last_r.rotate(rotation_); + r = r.rotate(rotation_); + u = u.rotate(rotation_); + } if (estimator != TallyEstimator::TRACKLENGTH) { auto bin = model::meshes[mesh_]->get_bin(r); @@ -65,6 +76,9 @@ void MeshFilter::to_statepoint(hid_t filter_group) const if (translated_) { write_dataset(filter_group, "translation", translation_); } + if (rotated_) { + write_dataset(filter_group, "rotation", rotation_); + } } std::string MeshFilter::text_label(int bin) const @@ -93,6 +107,40 @@ void MeshFilter::set_translation(const double translation[3]) this->set_translation({translation[0], translation[1], translation[2]}); } +void MeshFilter::set_rotation(const vector& rot) +{ + rotated_ = true; + + // Compute and store the inverse rotation matrix for the angles given. + rotation_.clear(); + rotation_.reserve(rot.size() == 9 ? 9 : 12); + if (rot.size() == 3) { + double phi = -rot[0] * PI / 180.0; + double theta = -rot[1] * PI / 180.0; + double psi = -rot[2] * PI / 180.0; + rotation_.push_back(std::cos(theta) * std::cos(psi)); + rotation_.push_back(-std::cos(phi) * std::sin(psi) + + std::sin(phi) * std::sin(theta) * std::cos(psi)); + rotation_.push_back(std::sin(phi) * std::sin(psi) + + std::cos(phi) * std::sin(theta) * std::cos(psi)); + rotation_.push_back(std::cos(theta) * std::sin(psi)); + rotation_.push_back(std::cos(phi) * std::cos(psi) + + std::sin(phi) * std::sin(theta) * std::sin(psi)); + rotation_.push_back(-std::sin(phi) * std::cos(psi) + + std::cos(phi) * std::sin(theta) * std::sin(psi)); + rotation_.push_back(-std::sin(theta)); + rotation_.push_back(std::sin(phi) * std::cos(theta)); + rotation_.push_back(std::cos(phi) * std::cos(theta)); + + // When user specifies angles, write them at end of vector + rotation_.push_back(rot[0]); + rotation_.push_back(rot[1]); + rotation_.push_back(rot[2]); + } else { + std::copy(rot.begin(), rot.end(), std::back_inserter(rotation_)); + } +} + //============================================================================== // C-API functions //============================================================================== @@ -201,4 +249,48 @@ extern "C" int openmc_mesh_filter_set_translation( return 0; } +//! Return the rotation matrix of a mesh filter +extern "C" int openmc_mesh_filter_get_rotation( + int32_t index, double rot[], size_t* n) +{ + // Make sure this is a valid index to an allocated filter + if (int err = verify_filter(index)) + return err; + + // Check the filter type + const auto& filter = model::tally_filters[index]; + if (filter->type() != FilterType::MESH) { + set_errmsg("Tried to get a rotation from a non-mesh filter."); + return OPENMC_E_INVALID_TYPE; + } + // Get rotation from the mesh filter and set value + auto mesh_filter = dynamic_cast(filter.get()); + *n = mesh_filter->rotation().size(); + std::memcpy(rot, mesh_filter->rotation().data(), + *n * sizeof(mesh_filter->rotation()[0])); + return 0; +} + +//! Set the flattened rotation matrix of a mesh filter +extern "C" int openmc_mesh_filter_set_rotation( + int32_t index, const double rot[], size_t rot_len) +{ + // Make sure this is a valid index to an allocated filter + if (int err = verify_filter(index)) + return err; + + const auto& filter = model::tally_filters[index]; + // Check the filter type + if (filter->type() != FilterType::MESH) { + set_errmsg("Tried to set a rotation from a non-mesh filter."); + return OPENMC_E_INVALID_TYPE; + } + + // Get a pointer to the filter and downcast + auto mesh_filter = dynamic_cast(filter.get()); + std::vector vec_rot(rot, rot + rot_len); + mesh_filter->set_rotation(vec_rot); + return 0; +} + } // namespace openmc diff --git a/src/tallies/filter_meshmaterial.cpp b/src/tallies/filter_meshmaterial.cpp new file mode 100644 index 000000000..6e1f30380 --- /dev/null +++ b/src/tallies/filter_meshmaterial.cpp @@ -0,0 +1,185 @@ +#include "openmc/tallies/filter_meshmaterial.h" + +#include // for move + +#include + +#include "openmc/capi.h" +#include "openmc/constants.h" +#include "openmc/container_util.h" +#include "openmc/error.h" +#include "openmc/material.h" +#include "openmc/mesh.h" +#include "openmc/xml_interface.h" + +namespace openmc { + +void MeshMaterialFilter::from_xml(pugi::xml_node node) +{ + // Get mesh ID + auto mesh = get_node_array(node, "mesh"); + if (mesh.size() != 1) { + fatal_error( + "Only one mesh can be specified per " + type_str() + " mesh filter."); + } + + auto id = mesh[0]; + auto search = model::mesh_map.find(id); + if (search == model::mesh_map.end()) { + fatal_error( + fmt::format("Could not find mesh {} specified on tally filter.", id)); + } + set_mesh(search->second); + + // Get pairs of (element index, material) and set the bins + auto bins = get_node_array(node, "bins"); + this->set_bins(bins); + + if (check_for_node(node, "translation")) { + set_translation(get_node_array(node, "translation")); + } +} + +void MeshMaterialFilter::set_bins(span bins) +{ + if (bins.size() % 2 != 0) { + fatal_error( + fmt::format("Size of mesh material bins is not even: {}", bins.size())); + } + + // Create a vector of ElementMat pairs from the flat vector of bins + vector element_mats; + for (int64_t i = 0; i < bins.size() / 2; ++i) { + int32_t element = bins[2 * i]; + int32_t mat_id = bins[2 * i + 1]; + auto search = model::material_map.find(mat_id); + if (search == model::material_map.end()) { + fatal_error(fmt::format( + "Could not find material {} specified on tally filter.", mat_id)); + } + int32_t mat_index = search->second; + element_mats.push_back({element, mat_index}); + } + + this->set_bins(std::move(element_mats)); +} + +void MeshMaterialFilter::set_bins(vector&& bins) +{ + // Swap internal bins_ with the provided vector to avoid copying + bins_.swap(bins); + + // Clear and update the mapping and vector of materials + materials_.clear(); + map_.clear(); + for (std::size_t i = 0; i < bins_.size(); ++i) { + const auto& x = bins_[i]; + assert(x.index_mat >= 0); + assert(x.index_mat < model::materials.size()); + materials_.insert(x.index_mat); + map_[x] = i; + } + + n_bins_ = bins_.size(); +} + +void MeshMaterialFilter::set_mesh(int32_t mesh) +{ + // perform any additional perparation for mesh tallies here + mesh_ = mesh; + model::meshes[mesh_]->prepare_for_point_location(); +} + +void MeshMaterialFilter::set_translation(const Position& translation) +{ + translated_ = true; + translation_ = translation; +} + +void MeshMaterialFilter::set_translation(const double translation[3]) +{ + this->set_translation({translation[0], translation[1], translation[2]}); +} + +void MeshMaterialFilter::get_all_bins( + const Particle& p, TallyEstimator estimator, FilterMatch& match) const +{ + // If current material is not in any bins, don't bother checking + if (!contains(materials_, p.material())) { + return; + } + + Position last_r = p.r_last(); + Position r = p.r(); + Position u = p.u(); + + // apply translation if present + if (translated_) { + last_r -= translation(); + r -= translation(); + } + + if (estimator != TallyEstimator::TRACKLENGTH) { + int32_t index_element = model::meshes[mesh_]->get_bin(r); + if (index_element >= 0) { + auto search = map_.find({index_element, p.material()}); + if (search != map_.end()) { + match.bins_.push_back(search->second); + match.weights_.push_back(1.0); + } + } + } else { + // First determine which elements the particle crosses (may or may not + // actually match bins so we have to adjust bins_/weight_ after) + int32_t n_start = match.bins_.size(); + model::meshes[mesh_]->bins_crossed( + last_r, r, u, match.bins_, match.weights_); + int32_t n_end = match.bins_.size(); + + // Go through bins and weights and check which ones are actually a match + // based on the (element, material) pair. For matches, overwrite the bin. + int i = 0; + for (int j = n_start; j < n_end; ++j) { + int32_t index_element = match.bins_[j]; + double weight = match.weights_[j]; + auto search = map_.find({index_element, p.material()}); + if (search != map_.end()) { + match.bins_[n_start + i] = search->second; + match.weights_[n_start + i] = weight; + ++i; + } + } + + // Resize the vectors to remove the unmatched bins + match.bins_.resize(n_start + i); + } +} + +void MeshMaterialFilter::to_statepoint(hid_t filter_group) const +{ + Filter::to_statepoint(filter_group); + write_dataset(filter_group, "mesh", model::meshes[mesh_]->id_); + + size_t n = bins_.size(); + xt::xtensor data({n, 2}); + for (int64_t i = 0; i < n; ++i) { + const auto& x = bins_[i]; + data(i, 0) = x.index_element; + data(i, 1) = model::materials[x.index_mat]->id_; + } + write_dataset(filter_group, "bins", data); + + if (translated_) { + write_dataset(filter_group, "translation", translation_); + } +} + +std::string MeshMaterialFilter::text_label(int bin) const +{ + auto& x = bins_[bin]; + auto& mesh = *model::meshes.at(mesh_); + return fmt::format("Mesh {}, {}, Material {}", mesh.id(), + mesh.bin_label(x.index_element), model::materials[x.index_mat]->id_); +} + +} // namespace openmc diff --git a/src/tallies/filter_sph_harm.cpp b/src/tallies/filter_sph_harm.cpp index 7441f32fb..1989e6ef1 100644 --- a/src/tallies/filter_sph_harm.cpp +++ b/src/tallies/filter_sph_harm.cpp @@ -25,6 +25,9 @@ void SphericalHarmonicsFilter::set_order(int order) if (order < 0) { throw std::invalid_argument { "Spherical harmonics order must be non-negative."}; + } else if (order > 10) { + throw std::invalid_argument {"Spherical harmonics orders greater than 10 " + "are currently not supported!"}; } order_ = order; n_bins_ = (order_ + 1) * (order_ + 1); diff --git a/src/tallies/filter_universe.cpp b/src/tallies/filter_universe.cpp index 48114cfad..f4b22decd 100644 --- a/src/tallies/filter_universe.cpp +++ b/src/tallies/filter_universe.cpp @@ -48,7 +48,7 @@ void UniverseFilter::get_all_bins( const Particle& p, TallyEstimator estimator, FilterMatch& match) const { for (int i = 0; i < p.n_coord(); i++) { - auto search = map_.find(p.coord(i).universe); + auto search = map_.find(p.coord(i).universe()); if (search != map_.end()) { match.bins_.push_back(search->second); match.weights_.push_back(1.0); diff --git a/src/tallies/filter_weight.cpp b/src/tallies/filter_weight.cpp new file mode 100644 index 000000000..31f4bd1bf --- /dev/null +++ b/src/tallies/filter_weight.cpp @@ -0,0 +1,63 @@ +#include "openmc/tallies/filter_weight.h" + +#include // for is_sorted +#include // for runtime_error + +#include + +#include "openmc/search.h" +#include "openmc/xml_interface.h" + +namespace openmc { + +//============================================================================== +// WeightFilter implementation +//============================================================================== + +void WeightFilter::from_xml(pugi::xml_node node) +{ + auto bins = get_node_array(node, "bins"); + this->set_bins(bins); +} + +void WeightFilter::set_bins(span bins) +{ + if (!std::is_sorted(bins.begin(), bins.end())) { + throw std::runtime_error {"Weight bins must be monotonically increasing."}; + } + + // Clear existing bins + bins_.clear(); + bins_.reserve(bins.size()); + + // Copy bins + bins_.insert(bins_.end(), bins.begin(), bins.end()); + n_bins_ = bins_.size() - 1; +} + +void WeightFilter::get_all_bins( + const Particle& p, TallyEstimator estimator, FilterMatch& match) const +{ + // Get particle weight + double wgt = p.wgt_last(); + + // Bin the weight + if (wgt >= bins_.front() && wgt <= bins_.back()) { + auto bin = lower_bound_index(bins_.begin(), bins_.end(), wgt); + match.bins_.push_back(bin); + match.weights_.push_back(1.0); + } +} + +void WeightFilter::to_statepoint(hid_t filter_group) const +{ + Filter::to_statepoint(filter_group); + write_dataset(filter_group, "bins", bins_); +} + +std::string WeightFilter::text_label(int bin) const +{ + return fmt::format("Weight [{}, {}]", bins_[bin], bins_[bin + 1]); +} + +} // namespace openmc diff --git a/src/tallies/tally.cpp b/src/tallies/tally.cpp index 96d684f71..6eef1da9c 100644 --- a/src/tallies/tally.cpp +++ b/src/tallies/tally.cpp @@ -27,10 +27,12 @@ #include "openmc/tallies/filter_legendre.h" #include "openmc/tallies/filter_mesh.h" #include "openmc/tallies/filter_meshborn.h" +#include "openmc/tallies/filter_meshmaterial.h" #include "openmc/tallies/filter_meshsurface.h" #include "openmc/tallies/filter_particle.h" #include "openmc/tallies/filter_sph_harm.h" #include "openmc/tallies/filter_surface.h" +#include "openmc/tallies/filter_time.h" #include "openmc/xml_interface.h" #include "xtensor/xadapt.hpp" @@ -38,9 +40,10 @@ #include "xtensor/xview.hpp" #include -#include // for max +#include // for max, set_union #include -#include // for size_t +#include // for size_t +#include // for back_inserter #include namespace openmc { @@ -56,11 +59,13 @@ vector> tallies; vector active_tallies; vector active_analog_tallies; vector active_tracklength_tallies; +vector active_timed_tracklength_tallies; vector active_collision_tallies; vector active_meshsurf_tallies; vector active_surface_tallies; vector active_pulse_height_tallies; vector pulse_height_cells; +vector time_grid; } // namespace model namespace simulation { @@ -102,6 +107,9 @@ Tally::Tally(pugi::xml_node node) multiply_density_ = get_node_value_bool(node, "multiply_density"); } + if (check_for_node(node, "higher_moments")) { + higher_moments_ = get_node_value_bool(node, "higher_moments"); + } // ======================================================================= // READ DATA FOR FILTERS @@ -180,13 +188,71 @@ Tally::Tally(pugi::xml_node node) fatal_error(fmt::format("No scores specified on tally {}.", id_)); } + // Set IFP if needed + if (!settings::ifp_on) { + // Determine if this tally has an IFP score + bool has_ifp_score = false; + for (int score : scores_) { + if (score == SCORE_IFP_TIME_NUM || score == SCORE_IFP_BETA_NUM || + score == SCORE_IFP_DENOM) { + has_ifp_score = true; + break; + } + } + + // Check for errors + if (has_ifp_score) { + if (settings::run_mode == RunMode::EIGENVALUE) { + if (settings::ifp_n_generation < 0) { + settings::ifp_n_generation = DEFAULT_IFP_N_GENERATION; + warning(fmt::format( + "{} generations will be used for IFP (default value). It can be " + "changed using the 'ifp_n_generation' settings.", + settings::ifp_n_generation)); + } + if (settings::ifp_n_generation > settings::n_inactive) { + fatal_error("'ifp_n_generation' must be lower than or equal to the " + "number of inactive cycles."); + } + settings::ifp_on = true; + } else if (settings::run_mode == RunMode::FIXED_SOURCE) { + fatal_error( + "Iterated Fission Probability can only be used in an eigenvalue " + "calculation."); + } + } + } + + // Set IFP parameters if needed + if (settings::ifp_on) { + for (int score : scores_) { + switch (score) { + case SCORE_IFP_TIME_NUM: + if (settings::ifp_parameter == IFPParameter::None) { + settings::ifp_parameter = IFPParameter::GenerationTime; + } else if (settings::ifp_parameter == IFPParameter::BetaEffective) { + settings::ifp_parameter = IFPParameter::Both; + } + break; + case SCORE_IFP_BETA_NUM: + case SCORE_IFP_DENOM: + if (settings::ifp_parameter == IFPParameter::None) { + settings::ifp_parameter = IFPParameter::BetaEffective; + } else if (settings::ifp_parameter == IFPParameter::GenerationTime) { + settings::ifp_parameter = IFPParameter::Both; + } + break; + } + } + } + // Check if tally is compatible with particle type if (!settings::photon_transport) { for (int score : scores_) { switch (score) { case SCORE_PULSE_HEIGHT: - fatal_error( - "For pulse-height tallies, photon transport needs to be activated."); + fatal_error("For pulse-height tallies, photon transport needs to be " + "activated."); break; } } @@ -260,7 +326,8 @@ Tally::Tally(pugi::xml_node node) if (has_energyout && i_nuc == -1) { fatal_error(fmt::format( "Error on tally {}: Cannot use a " - "'nuclide_density' or 'temperature' derivative on a tally with an " + "'nuclide_density' or 'temperature' derivative on a tally with " + "an " "outgoing energy filter and 'total' nuclide rate. Instead, tally " "each nuclide in the material individually.", id_)); @@ -318,7 +385,7 @@ Tally::Tally(pugi::xml_node node) } } -#ifdef LIBMESH +#ifdef OPENMC_LIBMESH_ENABLED // ensure a tracklength tally isn't used with a libMesh filter for (auto i : this->filters_) { auto df = dynamic_cast(model::tally_filters[i].get()); @@ -429,19 +496,15 @@ void Tally::add_filter(Filter* filter) energyout_filter_ = filters_.size(); } else if (filter->type() == FilterType::DELAYED_GROUP) { delayedgroup_filter_ = filters_.size(); - } else if (filter->type() == FilterType::CELL) { - cell_filter_ = filters_.size(); - } else if (filter->type() == FilterType::ENERGY) { - energy_filter_ = filters_.size(); } filters_.push_back(filter_idx); } void Tally::set_strides() { - // Set the strides. Filters are traversed in reverse so that the last filter - // has the shortest stride in memory and the first filter has the longest - // stride. + // Set the strides. Filters are traversed in reverse so that the last + // filter has the shortest stride in memory and the first filter has the + // longest stride. auto n = filters_.size(); strides_.resize(n, 0); int stride = 1; @@ -497,9 +560,11 @@ void Tally::set_scores(const vector& scores) // Iterate over the given scores. for (auto score_str : scores) { - // Make sure a delayed group filter wasn't used with an incompatible score. + // Make sure a delayed group filter wasn't used with an incompatible + // score. if (delayedgroup_filter_ != C_NONE) { - if (score_str != "delayed-nu-fission" && score_str != "decay-rate") + if (score_str != "delayed-nu-fission" && score_str != "decay-rate" && + score_str != "ifp-beta-numerator") fatal_error("Cannot tally " + score_str + "with a delayedgroup filter"); } @@ -585,7 +650,12 @@ void Tally::set_scores(const vector& scores) } } } + break; + case SCORE_IFP_TIME_NUM: + case SCORE_IFP_BETA_NUM: + case SCORE_IFP_DENOM: + estimator_ = TallyEstimator::COLLISION; break; } @@ -733,7 +803,11 @@ void Tally::init_triggers(pugi::xml_node node) void Tally::init_results() { int n_scores = scores_.size() * nuclides_.size(); - results_ = xt::empty({n_filter_bins_, n_scores, 3}); + if (higher_moments_) { + results_ = xt::empty({n_filter_bins_, n_scores, 5}); + } else { + results_ = xt::empty({n_filter_bins_, n_scores, 3}); + } } void Tally::reset() @@ -752,31 +826,52 @@ void Tally::accumulate() if (mpi::master || !settings::reduce_tallies) { // Calculate total source strength for normalization double total_source = 0.0; - if (settings::run_mode == RunMode::FIXED_SOURCE && - !settings::uniform_source_sampling) { - for (const auto& s : model::external_sources) { - total_source += s->strength(); - } + if (settings::run_mode == RunMode::FIXED_SOURCE) { + total_source = model::external_sources_probability.integral(); } else { total_source = 1.0; } + // Determine number of particles contributing to tally + double contributing_particles = settings::reduce_tallies + ? settings::n_particles + : simulation::work_per_rank; + // Account for number of source particles in normalization double norm = - total_source / (settings::n_particles * settings::gen_per_batch); + total_source / (contributing_particles * settings::gen_per_batch); if (settings::solver_type == SolverType::RANDOM_RAY) { norm = 1.0; } -// Accumulate each result + // Accumulate each result + if (higher_moments_) { #pragma omp parallel for - for (int i = 0; i < results_.shape()[0]; ++i) { - for (int j = 0; j < results_.shape()[1]; ++j) { - double val = results_(i, j, TallyResult::VALUE) * norm; - results_(i, j, TallyResult::VALUE) = 0.0; - results_(i, j, TallyResult::SUM) += val; - results_(i, j, TallyResult::SUM_SQ) += val * val; + // filter bins (specific cell, energy bins) + for (int i = 0; i < results_.shape()[0]; ++i) { + // score bins (flux, total reaction rate, fission reaction rate, etc.) + for (int j = 0; j < results_.shape()[1]; ++j) { + double val = results_(i, j, TallyResult::VALUE) * norm; + double val2 = val * val; + results_(i, j, TallyResult::VALUE) = 0.0; + results_(i, j, TallyResult::SUM) += val; + results_(i, j, TallyResult::SUM_SQ) += val2; + results_(i, j, TallyResult::SUM_THIRD) += val2 * val; + results_(i, j, TallyResult::SUM_FOURTH) += val2 * val2; + } + } + } else { +#pragma omp parallel for + // filter bins (specific cell, energy bins) + for (int i = 0; i < results_.shape()[0]; ++i) { + // score bins (flux, total reaction rate, fission reaction rate, etc.) + for (int j = 0; j < results_.shape()[1]; ++j) { + double val = results_(i, j, TallyResult::VALUE) * norm; + results_(i, j, TallyResult::VALUE) = 0.0; + results_(i, j, TallyResult::SUM) += val; + results_(i, j, TallyResult::SUM_SQ) += val * val; + } } } } @@ -928,8 +1023,8 @@ void reduce_tally_results() } } - // Note that global tallies are *always* reduced even when no_reduce option is - // on. + // Note that global tallies are *always* reduced even when no_reduce option + // is on. // Get view of global tally values auto& gt = simulation::global_tallies; @@ -1008,21 +1103,59 @@ void accumulate_tallies() } } +double distance_to_time_boundary(double time, double speed) +{ + if (model::time_grid.empty()) { + return INFTY; + } else if (time >= model::time_grid.back()) { + return INFTY; + } else { + double next_time = + *std::upper_bound(model::time_grid.begin(), model::time_grid.end(), time); + return (next_time - time) * speed; + } +} + +//! Add new points to the global time grid +// +//! \param grid Vector of new time points to add +void add_to_time_grid(vector grid) +{ + if (grid.empty()) + return; + + // Create new vector with enough space to hold old and new grid points + vector merged; + merged.reserve(model::time_grid.size() + grid.size()); + + // Merge and remove duplicates + std::set_union(model::time_grid.begin(), model::time_grid.end(), grid.begin(), + grid.end(), std::back_inserter(merged)); + + // Swap in the new grid + model::time_grid.swap(merged); +} + void setup_active_tallies() { model::active_tallies.clear(); model::active_analog_tallies.clear(); model::active_tracklength_tallies.clear(); + model::active_timed_tracklength_tallies.clear(); model::active_collision_tallies.clear(); model::active_meshsurf_tallies.clear(); model::active_surface_tallies.clear(); model::active_pulse_height_tallies.clear(); + model::time_grid.clear(); for (auto i = 0; i < model::tallies.size(); ++i) { const auto& tally {*model::tallies[i]}; if (tally.active_) { model::active_tallies.push_back(i); + bool mesh_present = (tally.get_filter() || + tally.get_filter()); + auto time_filter = tally.get_filter(); switch (tally.type_) { case TallyType::VOLUME: @@ -1031,7 +1164,12 @@ void setup_active_tallies() model::active_analog_tallies.push_back(i); break; case TallyEstimator::TRACKLENGTH: - model::active_tracklength_tallies.push_back(i); + if (time_filter && mesh_present) { + model::active_timed_tracklength_tallies.push_back(i); + add_to_time_grid(time_filter->bins()); + } else { + model::active_tracklength_tallies.push_back(i); + } break; case TallyEstimator::COLLISION: model::active_collision_tallies.push_back(i); @@ -1067,10 +1205,12 @@ void free_memory_tally() model::active_tallies.clear(); model::active_analog_tallies.clear(); model::active_tracklength_tallies.clear(); + model::active_timed_tracklength_tallies.clear(); model::active_collision_tallies.clear(); model::active_meshsurf_tallies.clear(); model::active_surface_tallies.clear(); model::active_pulse_height_tallies.clear(); + model::time_grid.clear(); model::tally_map.clear(); } @@ -1409,8 +1549,8 @@ extern "C" int openmc_tally_get_n_realizations(int32_t index, int32_t* n) return 0; } -//! \brief Returns a pointer to a tally results array along with its shape. This -//! allows a user to obtain in-memory tally results from Python directly. +//! \brief Returns a pointer to a tally results array along with its shape. +//! This allows a user to obtain in-memory tally results from Python directly. extern "C" int openmc_tally_results( int32_t index, double** results, size_t* shape) { diff --git a/src/tallies/tally_scoring.cpp b/src/tallies/tally_scoring.cpp index 02cb48567..67e851644 100644 --- a/src/tallies/tally_scoring.cpp +++ b/src/tallies/tally_scoring.cpp @@ -4,6 +4,7 @@ #include "openmc/capi.h" #include "openmc/constants.h" #include "openmc/error.h" +#include "openmc/ifp.h" #include "openmc/material.h" #include "openmc/mgxs_interface.h" #include "openmc/nuclide.h" @@ -232,7 +233,7 @@ double score_fission_q(const Particle& p, int score_bin, const Tally& tally, double score {0.0}; for (auto i = 0; i < material.nuclide_.size(); ++i) { auto j_nuclide = material.nuclide_[i]; - auto atom_density = material.atom_density_(i); + auto atom_density = material.atom_density(i, p.density_mult()); const Nuclide& nuc {*data::nuclides[j_nuclide]}; score += get_nuc_fission_q(nuc, p, score_bin) * atom_density * p.neutron_xs(j_nuclide).fission; @@ -324,6 +325,56 @@ double score_neutron_heating(const Particle& p, const Tally& tally, double flux, return score; } +//! Helper function to obtain reaction Q value for photons and charged particles +double get_reaction_q_value(const Particle& p) +{ + if (p.type() == ParticleType::photon && p.event_mt() == PAIR_PROD) { + // pair production + return -2 * MASS_ELECTRON_EV; + } else if (p.type() == ParticleType::positron) { + // positron annihilation + return 2 * MASS_ELECTRON_EV; + } else { + return 0.0; + } +} + +//! Helper function to obtain particle heating [eV] + +double score_particle_heating(const Particle& p, const Tally& tally, + double flux, int rxn_bin, int i_nuclide, double atom_density) +{ + if (p.type() == ParticleType::neutron) + return score_neutron_heating( + p, tally, flux, rxn_bin, i_nuclide, atom_density); + if (i_nuclide == -1 || i_nuclide == p.event_nuclide() || + p.event_nuclide() == -1) { + // For pair production and positron annihilation, we need to account for the + // reaction Q value + double Q = get_reaction_q_value(p); + + // Get the pre-collision energy of the particle. + auto E = p.E_last(); + + // The energy deposited is the sum of the incident energy and the reaction + // Q-value less the energy of any outgoing particles + double score = E + Q - p.E() - p.bank_second_E(); + + score *= p.wgt_last(); + + // if no event_nuclide (charged particle) scale energy deposition by + // fractional charge density + if (i_nuclide != -1 && p.event_nuclide() == -1) { + const auto& mat {model::materials[p.material()]}; + int z = data::nuclides[i_nuclide]->Z_; + auto i = mat->mat_nuclide_index_[i_nuclide]; + score *= (z * mat->atom_density_[i] / mat->charge_density()); + } + return score; + } + return 0.0; +} + //! Helper function for nu-fission tallies with energyout filters. // //! In this case, we may need to score to multiple bins if there were multiple @@ -645,7 +696,7 @@ void score_general_ce_nonanalog(Particle& p, int i_tally, int start_index, const Material& material {*model::materials[p.material()]}; for (auto i = 0; i < material.nuclide_.size(); ++i) { auto j_nuclide = material.nuclide_[i]; - auto atom_density = material.atom_density_(i); + auto atom_density = material.atom_density(i, p.density_mult()); score += p.neutron_xs(j_nuclide).fission * data::nuclides[j_nuclide]->nu( E, ReactionProduct::EmissionMode::prompt) * @@ -692,7 +743,7 @@ void score_general_ce_nonanalog(Particle& p, int i_tally, int start_index, const Material& material {*model::materials[p.material()]}; for (auto i = 0; i < material.nuclide_.size(); ++i) { auto j_nuclide = material.nuclide_[i]; - auto atom_density = material.atom_density_(i); + auto atom_density = material.atom_density(i, p.density_mult()); // Tally each delayed group bin individually for (auto d_bin = 0; d_bin < filt.n_bins(); ++d_bin) { auto d = filt.groups()[d_bin]; @@ -712,7 +763,7 @@ void score_general_ce_nonanalog(Particle& p, int i_tally, int start_index, const Material& material {*model::materials[p.material()]}; for (auto i = 0; i < material.nuclide_.size(); ++i) { auto j_nuclide = material.nuclide_[i]; - auto atom_density = material.atom_density_(i); + auto atom_density = material.atom_density(i, p.density_mult()); score += p.neutron_xs(j_nuclide).fission * data::nuclides[j_nuclide]->nu( E, ReactionProduct::EmissionMode::delayed) * @@ -773,7 +824,7 @@ void score_general_ce_nonanalog(Particle& p, int i_tally, int start_index, const Material& material {*model::materials[p.material()]}; for (auto i = 0; i < material.nuclide_.size(); ++i) { auto j_nuclide = material.nuclide_[i]; - auto atom_density = material.atom_density_(i); + auto atom_density = material.atom_density(i, p.density_mult()); const auto& nuc {*data::nuclides[j_nuclide]}; if (nuc.fissionable_) { const auto& rxn {*nuc.fission_rx_[0]}; @@ -798,7 +849,7 @@ void score_general_ce_nonanalog(Particle& p, int i_tally, int start_index, const Material& material {*model::materials[p.material()]}; for (auto i = 0; i < material.nuclide_.size(); ++i) { auto j_nuclide = material.nuclide_[i]; - auto atom_density = material.atom_density_(i); + auto atom_density = material.atom_density(i, p.density_mult()); const auto& nuc {*data::nuclides[j_nuclide]}; if (nuc.fissionable_) { const auto& rxn {*nuc.fission_rx_[0]}; @@ -842,7 +893,7 @@ void score_general_ce_nonanalog(Particle& p, int i_tally, int start_index, const Material& material {*model::materials[p.material()]}; for (auto i = 0; i < material.nuclide_.size(); ++i) { auto j_nuclide = material.nuclide_[i]; - auto atom_density = material.atom_density_(i); + auto atom_density = material.atom_density(i, p.density_mult()); const auto& nuc {*data::nuclides[j_nuclide]}; if (nuc.fissionable_) { const auto& rxn {*nuc.fission_rx_[0]}; @@ -873,7 +924,7 @@ void score_general_ce_nonanalog(Particle& p, int i_tally, int start_index, const Material& material {*model::materials[p.material()]}; for (auto i = 0; i < material.nuclide_.size(); ++i) { auto j_nuclide = material.nuclide_[i]; - auto atom_density = material.atom_density_(i); + auto atom_density = material.atom_density(i, p.density_mult()); if (p.neutron_xs(j_nuclide).elastic == CACHE_INVALID) data::nuclides[j_nuclide]->calculate_elastic_xs(p); score += p.neutron_xs(j_nuclide).elastic * atom_density * flux; @@ -890,6 +941,65 @@ void score_general_ce_nonanalog(Particle& p, int i_tally, int start_index, score_fission_q(p, score_bin, tally, flux, i_nuclide, atom_density); break; + case SCORE_IFP_TIME_NUM: + if (settings::ifp_on) { + if ((p.type() == Type::neutron) && (p.fission())) { + if (is_generation_time_or_both()) { + const auto& lifetimes = + simulation::ifp_source_lifetime_bank[p.current_work() - 1]; + if (lifetimes.size() == settings::ifp_n_generation) { + score = lifetimes[0] * p.wgt_last(); + } + } + } + } + break; + + case SCORE_IFP_BETA_NUM: + if (settings::ifp_on) { + if ((p.type() == Type::neutron) && (p.fission())) { + if (is_beta_effective_or_both()) { + const auto& delayed_groups = + simulation::ifp_source_delayed_group_bank[p.current_work() - 1]; + if (delayed_groups.size() == settings::ifp_n_generation) { + if (delayed_groups[0] > 0) { + score = p.wgt_last(); + if (tally.delayedgroup_filter_ != C_NONE) { + auto i_dg_filt = tally.filters()[tally.delayedgroup_filter_]; + const DelayedGroupFilter& filt { + *dynamic_cast( + model::tally_filters[i_dg_filt].get())}; + score_fission_delayed_dg(i_tally, delayed_groups[0] - 1, + score, score_index, p.filter_matches()); + continue; + } + } + } + } + } + } + break; + + case SCORE_IFP_DENOM: + if (settings::ifp_on) { + if ((p.type() == Type::neutron) && (p.fission())) { + int ifp_data_size; + if (is_beta_effective_or_both()) { + ifp_data_size = static_cast( + simulation::ifp_source_delayed_group_bank[p.current_work() - 1] + .size()); + } else { + ifp_data_size = static_cast( + simulation::ifp_source_lifetime_bank[p.current_work() - 1] + .size()); + } + if (ifp_data_size == settings::ifp_n_generation) { + score = p.wgt_last(); + } + } + } + break; + case N_2N: case N_3N: case N_4N: @@ -924,7 +1034,7 @@ void score_general_ce_nonanalog(Particle& p, int i_tally, int start_index, const Material& material {*model::materials[p.material()]}; for (auto i = 0; i < material.nuclide_.size(); ++i) { auto j_nuclide = material.nuclide_[i]; - auto atom_density = material.atom_density_(i); + auto atom_density = material.atom_density(i, p.density_mult()); score += p.neutron_xs(j_nuclide).reaction[m] * atom_density * flux; } } @@ -956,23 +1066,8 @@ void score_general_ce_nonanalog(Particle& p, int i_tally, int start_index, break; case HEATING: - if (p.type() == Type::neutron) { - score = score_neutron_heating( - p, tally, flux, HEATING, i_nuclide, atom_density); - } else { - if (i_nuclide == -1 || i_nuclide == p.event_nuclide()) { - // The energy deposited is the difference between the pre-collision - // and post-collision energy... - score = E - p.E(); - // ...less the energy of any secondary particles since they will be - // transported individually later - score -= p.bank_second_E(); - - score *= p.wgt_last(); - } else { - score = 0.0; - } - } + score = score_particle_heating( + p, tally, flux, HEATING, i_nuclide, atom_density); break; default: @@ -993,7 +1088,7 @@ void score_general_ce_nonanalog(Particle& p, int i_tally, int start_index, const Material& material {*model::materials[p.material()]}; for (auto i = 0; i < material.nuclide_.size(); ++i) { auto j_nuclide = material.nuclide_[i]; - auto atom_density = material.atom_density_(i); + auto atom_density = material.atom_density(i, p.density_mult()); score += get_nuclide_xs(p, j_nuclide, score_bin) * atom_density * flux; } @@ -1488,19 +1583,8 @@ void score_general_ce_analog(Particle& p, int i_tally, int start_index, break; case HEATING: - if (p.type() == Type::neutron) { - score = score_neutron_heating( - p, tally, flux, HEATING, i_nuclide, atom_density); - } else { - // The energy deposited is the difference between the pre-collision and - // post-collision energy... - score = E - p.E(); - // ...less the energy of any secondary particles since they will be - // transported individually later - score -= p.bank_second_E(); - - score *= p.wgt_last(); - } + score = score_particle_heating( + p, tally, flux, HEATING, i_nuclide, atom_density); break; default: @@ -1549,8 +1633,7 @@ void score_general_mg(Particle& p, int i_tally, int start_index, tally.estimator_ == TallyEstimator::COLLISION) { if (settings::survival_biasing) { // Determine weight that was absorbed - wgt_absorb = p.wgt_last() * p.neutron_xs(p.event_nuclide()).absorption / - p.neutron_xs(p.event_nuclide()).total; + wgt_absorb = p.wgt_last() * p.macro_xs().absorption / p.macro_xs().total; // Then we either are alive and had a scatter (and so g changed), // or are dead and g did not change @@ -2308,7 +2391,8 @@ void score_analog_tally_mg(Particle& p) model::materials[p.material()]->mat_nuclide_index_[i_nuclide]; if (j == C_NONE) continue; - atom_density = model::materials[p.material()]->atom_density_(j); + atom_density = + model::materials[p.material()]->atom_density(j, p.density_mult()); } score_general_mg(p, i_tally, i * tally.scores_.size(), filter_index, @@ -2329,15 +2413,13 @@ void score_analog_tally_mg(Particle& p) match.bins_present_ = false; } -void score_tracklength_tally(Particle& p, double distance) +void score_tracklength_tally_general( + Particle& p, double flux, const vector& tallies) { - // Determine the tracklength estimate of the flux - double flux = p.wgt() * distance; - // Set 'none' value for log union grid index int i_log_union = C_NONE; - for (auto i_tally : model::active_tracklength_tallies) { + for (auto i_tally : tallies) { const Tally& tally {*model::tallies[i_tally]}; // Initialize an iterator over valid filter bin combinations. If there are @@ -2376,8 +2458,9 @@ void score_tracklength_tally(Particle& p, double distance) atom_density = 1.0; } } else { - atom_density = - tally.multiply_density() ? mat->atom_density_(j) : 1.0; + atom_density = tally.multiply_density() + ? mat->atom_density(j, p.density_mult()) + : 1.0; } } } @@ -2406,6 +2489,57 @@ void score_tracklength_tally(Particle& p, double distance) match.bins_present_ = false; } +void score_timed_tracklength_tally(Particle& p, double total_distance) +{ + double speed = p.speed(); + double total_dt = total_distance / speed; + + // save particle last state + auto time_last = p.time_last(); + auto r_last = p.r_last(); + + // move particle back + p.move_distance(-total_distance); + p.time() -= total_dt; + p.lifetime() -= total_dt; + + double distance_traveled = 0.0; + while (distance_traveled < total_distance) { + + double distance = std::min(distance_to_time_boundary(p.time(), speed), + total_distance - distance_traveled); + double dt = distance / speed; + + // Save particle last state for tracklength tallies + p.time_last() = p.time(); + p.r_last() = p.r(); + + // Advance particle in space and time + p.move_distance(distance); + p.time() += dt; + p.lifetime() += dt; + + // Determine the tracklength estimate of the flux + double flux = p.wgt() * distance; + + score_tracklength_tally_general( + p, flux, model::active_timed_tracklength_tallies); + distance_traveled += distance; + } + + p.time_last() = time_last; + p.r_last() = r_last; +} + +void score_tracklength_tally(Particle& p, double distance) +{ + + // Determine the tracklength estimate of the flux + double flux = p.wgt() * distance; + + score_tracklength_tally_general(p, flux, model::active_tracklength_tallies); +} + void score_collision_tally(Particle& p) { // Determine the collision estimate of the flux @@ -2455,8 +2589,9 @@ void score_collision_tally(Particle& p) atom_density = 1.0; } } else { - atom_density = - tally.multiply_density() ? mat->atom_density_(j) : 1.0; + atom_density = tally.multiply_density() + ? mat->atom_density(j, p.density_mult()) + : 1.0; } } @@ -2540,7 +2675,7 @@ void score_pulse_height_tally(Particle& p, const vector& tallies) // Save original cell/energy information int orig_n_coord = p.n_coord(); - int orig_cell = p.coord(0).cell; + int orig_cell = p.coord(0).cell(); double orig_E_last = p.E_last(); for (auto i_tally : tallies) { @@ -2559,7 +2694,7 @@ void score_pulse_height_tally(Particle& p, const vector& tallies) // Temporarily change cell of particle p.n_coord() = 1; - p.coord(0).cell = cell_id; + p.coord(0).cell() = cell_id; // Determine index of cell in model::pulse_height_cells auto it = std::find(model::pulse_height_cells.begin(), @@ -2599,7 +2734,7 @@ void score_pulse_height_tally(Particle& p, const vector& tallies) } // Restore cell/energy p.n_coord() = orig_n_coord; - p.coord(0).cell = orig_cell; + p.coord(0).cell() = orig_cell; p.E_last() = orig_E_last; } } diff --git a/src/universe.cpp b/src/universe.cpp index b4ef6b4b2..e1db80b99 100644 --- a/src/universe.cpp +++ b/src/universe.cpp @@ -45,14 +45,14 @@ bool Universe::find_cell(GeometryState& p) const Position r {p.r_local()}; Position u {p.u_local()}; auto surf = p.surface(); - int32_t i_univ = p.lowest_coord().universe; + int32_t i_univ = p.lowest_coord().universe(); for (auto i_cell : cells) { if (model::cells[i_cell]->universe_ != i_univ) continue; // Check if this cell contains the particle if (model::cells[i_cell]->contains(r, u, surf)) { - p.lowest_coord().cell = i_cell; + p.lowest_coord().cell() = i_cell; return true; } } @@ -61,7 +61,7 @@ bool Universe::find_cell(GeometryState& p) const BoundingBox Universe::bounding_box() const { - BoundingBox bbox = {INFTY, -INFTY, INFTY, -INFTY, INFTY, -INFTY}; + BoundingBox bbox = BoundingBox::inverted(); if (cells_.size() == 0) { return {}; } else { diff --git a/src/volume_calc.cpp b/src/volume_calc.cpp index 8b5c27f14..1deffb804 100644 --- a/src/volume_calc.cpp +++ b/src/volume_calc.cpp @@ -179,7 +179,7 @@ vector VolumeCalculation::execute() const } else if (domain_type_ == TallyDomain::CELL) { for (int level = 0; level < p.n_coord(); ++level) { for (int i_domain = 0; i_domain < n; i_domain++) { - if (model::cells[p.coord(level).cell]->id_ == + if (model::cells[p.coord(level).cell()]->id_ == domain_ids_[i_domain]) { this->check_hit( p.material(), indices[i_domain], hits[i_domain]); @@ -190,7 +190,7 @@ vector VolumeCalculation::execute() const } else if (domain_type_ == TallyDomain::UNIVERSE) { for (int level = 0; level < p.n_coord(); ++level) { for (int i_domain = 0; i_domain < n; ++i_domain) { - if (model::universes[p.coord(level).universe]->id_ == + if (model::universes[p.coord(level).universe()]->id_ == domain_ids_[i_domain]) { check_hit(p.material(), indices[i_domain], hits[i_domain]); break; diff --git a/src/weight_windows.cpp b/src/weight_windows.cpp index 0efa5a6ae..4838e4591 100644 --- a/src/weight_windows.cpp +++ b/src/weight_windows.cpp @@ -6,11 +6,11 @@ #include #include +#include "xtensor/xdynamic_view.hpp" #include "xtensor/xindex_view.hpp" #include "xtensor/xio.hpp" #include "xtensor/xmasked_view.hpp" #include "xtensor/xnoalias.hpp" -#include "xtensor/xstrided_view.hpp" #include "xtensor/xview.hpp" #include "openmc/error.h" @@ -26,6 +26,7 @@ #include "openmc/random_ray/flat_source_domain.h" #include "openmc/search.h" #include "openmc/settings.h" +#include "openmc/simulation.h" #include "openmc/tallies/filter_energy.h" #include "openmc/tallies/filter_mesh.h" #include "openmc/tallies/filter_particle.h" @@ -73,10 +74,26 @@ void apply_weight_windows(Particle& p) if (weight_window.is_valid()) break; } + + // If particle has not yet had its birth weight window value set, set it to + // the current weight window (or 1.0 if not born in a weight window). + if (p.wgt_ww_born() == -1.0) { + if (weight_window.is_valid()) { + p.wgt_ww_born() = + (weight_window.lower_weight + weight_window.upper_weight) / 2; + } else { + p.wgt_ww_born() = 1.0; + } + } + // particle is not in any of the ww domains, do nothing if (!weight_window.is_valid()) return; + // Normalize weight windows based on particle's starting weight + // and the value of the weight window the particle was born in. + weight_window.scale(p.wgt_born() / p.wgt_ww_born()); + // get the paramters double weight = p.wgt(); @@ -490,8 +507,18 @@ void WeightWindows::update_weights(const Tally* tally, const std::string& value, /////////////////////////// this->check_tally_update_compatibility(tally); - lower_ww_.fill(-1); - upper_ww_.fill(-1); + // Dimensions of weight window arrays + int e_bins = lower_ww_.shape()[0]; + int64_t mesh_bins = lower_ww_.shape()[1]; + + // Initialize weight window arrays to -1.0 by default +#pragma omp parallel for collapse(2) schedule(static) + for (int e = 0; e < e_bins; e++) { + for (int64_t m = 0; m < mesh_bins; m++) { + lower_ww_(e, m) = -1.0; + upper_ww_(e, m) = -1.0; + } + } // determine which value to use const std::set allowed_values = {"mean", "rel_err"}; @@ -520,8 +547,10 @@ void WeightWindows::update_weights(const Tally* tally, const std::string& value, // build a shape for a view of the tally results, this will always be // dimension 5 (3 filter dimensions, 1 score dimension, 1 results dimension) - std::array shape = { - 1, 1, 1, tally->n_scores(), static_cast(TallyResult::SIZE)}; + // Look for the size of the last dimension of the results array + const auto& results_arr = tally->results(); + const int results_dim = static_cast(results_arr.shape()[2]); + std::array shape = {1, 1, 1, tally->n_scores(), results_dim}; // set the shape for the filters applied on the tally for (int i = 0; i < tally->filters().size(); i++) { @@ -559,7 +588,7 @@ void WeightWindows::update_weights(const Tally* tally, const std::string& value, // get a fully reshaped view of the tally according to tally ordering of // filters - auto tally_values = xt::reshape_view(tally->results(), shape); + auto tally_values = xt::reshape_view(results_arr, shape); // get a that is (particle, energy, mesh, scores, values) auto transposed_view = xt::transpose(tally_values, transpose); @@ -589,10 +618,12 @@ void WeightWindows::update_weights(const Tally* tally, const std::string& value, } // down-select data based on particle and score - auto sum = xt::view(transposed_view, particle_idx, xt::all(), xt::all(), - score_index, static_cast(TallyResult::SUM)); - auto sum_sq = xt::view(transposed_view, particle_idx, xt::all(), xt::all(), - score_index, static_cast(TallyResult::SUM_SQ)); + auto sum = xt::dynamic_view( + transposed_view, {particle_idx, xt::all(), xt::all(), score_index, + static_cast(TallyResult::SUM)}); + auto sum_sq = xt::dynamic_view( + transposed_view, {particle_idx, xt::all(), xt::all(), score_index, + static_cast(TallyResult::SUM_SQ)}); int n = tally->n_realizations_; ////////////////////////////////////////////// @@ -610,78 +641,117 @@ void WeightWindows::update_weights(const Tally* tally, const std::string& value, auto& new_bounds = this->lower_ww_; auto& rel_err = this->upper_ww_; - // noalias avoids memory allocation here - xt::noalias(new_bounds) = sum / n; - - xt::noalias(rel_err) = - xt::sqrt(((sum_sq / n) - xt::square(new_bounds)) / (n - 1)) / new_bounds; - xt::filter(rel_err, sum <= 0.0).fill(INFTY); - - if (value == "rel_err") - xt::noalias(new_bounds) = 1 / rel_err; - // get mesh volumes auto mesh_vols = this->mesh()->volumes(); - int e_bins = new_bounds.shape()[0]; - - if (method == WeightWindowUpdateMethod::MAGIC) { - // If we are computing weight windows with forward fluxes derived from a - // Monte Carlo or forward random ray solve, we use the MAGIC algorithm. - for (int e = 0; e < e_bins; e++) { - // select all - auto group_view = xt::view(new_bounds, e); - - // divide by volume of mesh elements - for (int i = 0; i < group_view.size(); i++) { - group_view[i] /= mesh_vols[i]; + // Calculate mean (new_bounds) and relative error +#pragma omp parallel for collapse(2) schedule(static) + for (int e = 0; e < e_bins; e++) { + for (int64_t m = 0; m < mesh_bins; m++) { + // Calculate mean + new_bounds(e, m) = sum(e, m) / n; + // Calculate relative error + if (sum(e, m) > 0.0) { + double mean_val = new_bounds(e, m); + double variance = (sum_sq(e, m) / n - mean_val * mean_val) / (n - 1); + rel_err(e, m) = std::sqrt(variance) / mean_val; + } else { + rel_err(e, m) = INFTY; } - - double group_max = - *std::max_element(group_view.begin(), group_view.end()); - // normalize values in this energy group by the maximum value for this - // group - if (group_max > 0.0) - group_view /= 2.0 * group_max; - } - } else { - // If we are computing weight windows with adjoint fluxes derived from an - // adjoint random ray solve, we use the FW-CADIS algorithm. - for (int e = 0; e < e_bins; e++) { - // select all - auto group_view = xt::view(new_bounds, e); - - // divide by volume of mesh elements - for (int i = 0; i < group_view.size(); i++) { - group_view[i] /= mesh_vols[i]; + if (value == "rel_err") { + new_bounds(e, m) = 1.0 / rel_err(e, m); } } - - // We take the inverse, but are careful not to divide by zero e.g. if some - // mesh bins are not reachable in the physical geometry. - xt::noalias(new_bounds) = - xt::where(xt::not_equal(new_bounds, 0.0), 1.0 / new_bounds, 0.0); - auto max_val = xt::amax(new_bounds)(); - xt::noalias(new_bounds) = new_bounds / (2.0 * max_val); - - // For bins that were missed, we use the minimum weight window value. This - // shouldn't matter except for plotting. - auto min_val = xt::amin(new_bounds)(); - xt::noalias(new_bounds) = - xt::where(xt::not_equal(new_bounds, 0.0), new_bounds, min_val); } - // make sure that values where the mean is zero are set s.t. the weight window - // value will be ignored - xt::filter(new_bounds, sum <= 0.0).fill(-1.0); + // Divide by volume of mesh elements +#pragma omp parallel for collapse(2) schedule(static) + for (int e = 0; e < e_bins; e++) { + for (int64_t m = 0; m < mesh_bins; m++) { + new_bounds(e, m) /= mesh_vols[m]; + } + } - // make sure the weight windows are ignored for any locations where the - // relative error is higher than the specified relative error threshold - xt::filter(new_bounds, rel_err > threshold).fill(-1.0); + if (method == WeightWindowUpdateMethod::MAGIC) { + // For MAGIC, weight windows are proportional to the forward fluxes. + // We normalize weight windows independently for each energy group. - // update the bounds of this weight window class - // noalias avoids additional memory allocation - xt::noalias(upper_ww_) = ratio * lower_ww_; + // Find group maximum and normalize (per energy group) + for (int e = 0; e < e_bins; e++) { + double group_max = 0.0; + + // Find maximum value across all elements in this energy group +#pragma omp parallel for schedule(static) reduction(max : group_max) + for (int64_t m = 0; m < mesh_bins; m++) { + if (new_bounds(e, m) > group_max) { + group_max = new_bounds(e, m); + } + } + + // Normalize values in this energy group by the maximum value + if (group_max > 0.0) { + double norm_factor = 1.0 / (2.0 * group_max); +#pragma omp parallel for schedule(static) + for (int64_t m = 0; m < mesh_bins; m++) { + new_bounds(e, m) *= norm_factor; + } + } + } + } else { + // For FW-CADIS, weight windows are inversely proportional to the adjoint + // fluxes. We normalize the weight windows across all energy groups. +#pragma omp parallel for collapse(2) schedule(static) + for (int e = 0; e < e_bins; e++) { + for (int64_t m = 0; m < mesh_bins; m++) { + // Take the inverse, but are careful not to divide by zero + if (new_bounds(e, m) != 0.0) { + new_bounds(e, m) = 1.0 / new_bounds(e, m); + } else { + new_bounds(e, m) = 0.0; + } + } + } + + // Find the maximum value across all elements + double max_val = 0.0; +#pragma omp parallel for collapse(2) schedule(static) reduction(max : max_val) + for (int e = 0; e < e_bins; e++) { + for (int64_t m = 0; m < mesh_bins; m++) { + if (new_bounds(e, m) > max_val) { + max_val = new_bounds(e, m); + } + } + } + + // Parallel normalization + if (max_val > 0.0) { + double norm_factor = 1.0 / (2.0 * max_val); +#pragma omp parallel for collapse(2) schedule(static) + for (int e = 0; e < e_bins; e++) { + for (int64_t m = 0; m < mesh_bins; m++) { + new_bounds(e, m) *= norm_factor; + } + } + } + } + + // Final processing +#pragma omp parallel for collapse(2) schedule(static) + for (int e = 0; e < e_bins; e++) { + for (int64_t m = 0; m < mesh_bins; m++) { + // Values where the mean is zero should be ignored + if (sum(e, m) <= 0.0) { + new_bounds(e, m) = -1.0; + } + // Values where the relative error is higher than the threshold should be + // ignored + else if (rel_err(e, m) > threshold) { + new_bounds(e, m) = -1.0; + } + // Set the upper bounds + upper_ww_(e, m) = ratio * lower_ww_(e, m); + } + } } void WeightWindows::check_tally_update_compatibility(const Tally* tally) @@ -863,7 +933,8 @@ void WeightWindowsGenerator::create_tally() for (const auto& f : model::tally_filters) { if (f->type() == FilterType::MESH) { const auto* mesh_filter = dynamic_cast(f.get()); - if (mesh_filter->mesh() == mesh_idx && !mesh_filter->translated()) { + if (mesh_filter->mesh() == mesh_idx && !mesh_filter->translated() && + !mesh_filter->rotated()) { ww_tally->add_filter(f.get()); found_mesh_filter = true; break; @@ -899,11 +970,17 @@ void WeightWindowsGenerator::update() const Tally* tally = model::tallies[tally_idx_].get(); - // if we're beyond the number of max realizations or not at the corrrect - // update interval, skip the update - if (max_realizations_ < tally->n_realizations_ || - tally->n_realizations_ % update_interval_ != 0) + // If in random ray mode, only update on the last batch + if (settings::solver_type == SolverType::RANDOM_RAY) { + if (simulation::current_batch != settings::n_batches) { + return; + } + // If in Monte Carlo mode and beyond the number of max realizations or + // not at the correct update interval, skip the update + } else if (max_realizations_ < tally->n_realizations_ || + tally->n_realizations_ % update_interval_ != 0) { return; + } wws->update_weights(tally, tally_value_, threshold_, ratio_, method_); @@ -1261,6 +1338,10 @@ extern "C" int openmc_weight_windows_import(const char* filename) hid_t weight_windows_group = open_group(ww_file, "weight_windows"); + hid_t mesh_group = open_group(ww_file, "meshes"); + + read_meshes(mesh_group); + std::vector names = group_names(weight_windows_group); for (const auto& name : names) { diff --git a/tests/conftest.py b/tests/conftest.py index cd86da539..71dd5ebf5 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,3 +1,4 @@ +import os import pytest import openmc @@ -29,8 +30,28 @@ def run_in_tmpdir(tmpdir): finally: orig.chdir() +@pytest.fixture(scope="module") +def endf_data(): + return os.environ['OPENMC_ENDF_DATA'] @pytest.fixture(scope='session', autouse=True) def resolve_paths(): with openmc.config.patch('resolve_paths', False): yield + + +@pytest.fixture(scope='session', autouse=True) +def disable_depletion_multiprocessing_under_mpi(): + """Fork-based depletion multiprocessing may deadlock if MPI is active.""" + if not regression_config['mpi']: + yield + return + + from openmc.deplete import pool + + original_setting = pool.USE_MULTIPROCESSING + pool.USE_MULTIPROCESSING = False + try: + yield + finally: + pool.USE_MULTIPROCESSING = original_setting diff --git a/tests/cpp_unit_tests/CMakeLists.txt b/tests/cpp_unit_tests/CMakeLists.txt index f0f5f2853..5f87db9ea 100644 --- a/tests/cpp_unit_tests/CMakeLists.txt +++ b/tests/cpp_unit_tests/CMakeLists.txt @@ -4,6 +4,8 @@ set(TEST_NAMES test_tally test_interpolate test_math + test_mcpl_stat_sum + test_mesh # Add additional unit test files here ) diff --git a/tests/cpp_unit_tests/test_distribution.cpp b/tests/cpp_unit_tests/test_distribution.cpp index e1a212db5..2024b812e 100644 --- a/tests/cpp_unit_tests/test_distribution.cpp +++ b/tests/cpp_unit_tests/test_distribution.cpp @@ -28,7 +28,7 @@ TEST_CASE("Test alias method sampling of a discrete distribution") int counter = 0; for (size_t i = 0; i < n_samples; i++) { - auto sample = dist.sample(&seed); + auto sample = dist.sample(&seed).first; std += sample * sample / n_samples; dist_mean += sample; @@ -61,7 +61,7 @@ TEST_CASE("Test alias sampling method for pugixml constructor") // Initialize discrete distribution and seed openmc::Discrete dist(energy); uint64_t seed = openmc::init_seed(0, 0); - auto sample = dist.sample(&seed); + auto sample = dist.sample(&seed).first; // Assertions REQUIRE(dist.x().size() == 3); diff --git a/tests/cpp_unit_tests/test_mcpl_stat_sum.cpp b/tests/cpp_unit_tests/test_mcpl_stat_sum.cpp new file mode 100644 index 000000000..909830e03 --- /dev/null +++ b/tests/cpp_unit_tests/test_mcpl_stat_sum.cpp @@ -0,0 +1,108 @@ +#include +#include +#include +#include + +#include "openmc/bank.h" +#include "openmc/mcpl_interface.h" + +// Test the MCPL stat:sum functionality (issue #3514) +TEST_CASE("MCPL stat:sum field") +{ + // Check if MCPL interface is available + if (!openmc::is_mcpl_interface_available()) { + SKIP("MCPL library not available"); + } + + SECTION("stat:sum field is written to MCPL files") + { + // Create a temporary filename + std::string filename = "test_stat_sum.mcpl"; + + // Create some test particles + std::vector source_bank(100); + std::vector bank_index = {0, 100}; // 100 particles total + + // Initialize test particles + for (int i = 0; i < 100; ++i) { + source_bank[i].particle = openmc::ParticleType::neutron; + source_bank[i].r = {i * 0.1, i * 0.2, i * 0.3}; + source_bank[i].u = {0.0, 0.0, 1.0}; + source_bank[i].E = 2.0e6; // 2 MeV + source_bank[i].time = 0.0; + source_bank[i].wgt = 1.0; + } + + // Write the MCPL file + openmc::write_mcpl_source_point(filename.c_str(), source_bank, bank_index); + + // Verify the file was created + FILE* f = std::fopen(filename.c_str(), "r"); + REQUIRE(f != nullptr); + std::fclose(f); + + // Read the file back to check stat:sum + // Note: This would require mcpl_open_file and checking the header + // Since we can't easily read MCPL headers in C++ without the full MCPL API, + // we rely on the Python test to verify the actual content + + // Clean up + std::remove(filename.c_str()); + } + + SECTION("stat:sum uses correct particle count") + { + std::string filename = "test_count.mcpl"; + + // Test with different particle counts + std::vector test_counts = {1, 10, 100, 1000}; + + for (int count : test_counts) { + std::vector source_bank(count); + std::vector bank_index = {0, count}; + + // Initialize particles + for (int i = 0; i < count; ++i) { + source_bank[i].particle = openmc::ParticleType::neutron; + source_bank[i].r = {0.0, 0.0, 0.0}; + source_bank[i].u = {0.0, 0.0, 1.0}; + source_bank[i].E = 1.0e6; + source_bank[i].time = 0.0; + source_bank[i].wgt = 1.0; + } + + // Write MCPL file + openmc::write_mcpl_source_point( + filename.c_str(), source_bank, bank_index); + + // The stat:sum should equal count (verified by Python test) + // Here we just verify the file was created successfully + FILE* f = std::fopen(filename.c_str(), "r"); + REQUIRE(f != nullptr); + std::fclose(f); + + // Clean up + std::remove(filename.c_str()); + } + } + + SECTION("stat:sum handles empty particle bank") + { + std::string filename = "test_empty.mcpl"; + + // Create empty particle bank + std::vector source_bank; + std::vector bank_index = {0}; + + // This should still create a valid MCPL file with stat:sum = 0 + openmc::write_mcpl_source_point(filename.c_str(), source_bank, bank_index); + + // Verify file was created + FILE* f = std::fopen(filename.c_str(), "r"); + REQUIRE(f != nullptr); + std::fclose(f); + + // Clean up + std::remove(filename.c_str()); + } +} diff --git a/tests/cpp_unit_tests/test_mesh.cpp b/tests/cpp_unit_tests/test_mesh.cpp new file mode 100644 index 000000000..24c4f7737 --- /dev/null +++ b/tests/cpp_unit_tests/test_mesh.cpp @@ -0,0 +1,257 @@ +#include +#include +#include + +#include +#include + +#include "openmc/hdf5_interface.h" +#include "openmc/mesh.h" + +using namespace openmc; + +TEST_CASE("Test mesh hdf5 roundtrip - regular") +{ + // The XML data as a string + std::string xml_string = R"( + + 3 4 5 + -2 -3 -5 + 2 3 5 + + )"; + + // Create a pugixml document object + pugi::xml_document doc; + + // Load the XML from the string + pugi::xml_parse_result result = doc.load_string(xml_string.c_str()); + + pugi::xml_node root = doc.child("mesh"); + + auto mesh = RegularMesh(root); + + hid_t file_id = file_open("mesh.h5", 'w'); + + mesh.to_hdf5(file_id); + + file_close(file_id); + + hid_t file_id2 = file_open("mesh.h5", 'r'); + + hid_t group = open_group(file_id2, "mesh 1"); + + auto mesh2 = RegularMesh(group); + + file_close(file_id2); + + remove("mesh.h5"); + + REQUIRE(mesh2.shape_ == mesh.shape_); + + REQUIRE(mesh2.lower_left() == mesh.lower_left()); + + REQUIRE(mesh2.upper_right() == mesh.upper_right()); +} + +TEST_CASE("Test mesh hdf5 roundtrip - rectilinear") +{ + // The XML data as a string + std::string xml_string = R"( + + 0.0 1.0 5.0 10.0 + -10.0 -5.0 0.0 + -100.0 0.0 100.0 + + )"; + + // Create a pugixml document object + pugi::xml_document doc; + + // Load the XML from the string + pugi::xml_parse_result result = doc.load_string(xml_string.c_str()); + + pugi::xml_node root = doc.child("mesh"); + + auto mesh = RectilinearMesh(root); + + hid_t file_id = file_open("mesh.h5", 'w'); + + mesh.to_hdf5(file_id); + + file_close(file_id); + + hid_t file_id2 = file_open("mesh.h5", 'r'); + + hid_t group = open_group(file_id2, "mesh 1"); + + auto mesh2 = RectilinearMesh(group); + + file_close(file_id2); + + remove("mesh.h5"); + + REQUIRE(mesh2.shape_ == mesh.shape_); + + REQUIRE(mesh2.grid_ == mesh.grid_); +} + +TEST_CASE("Test mesh hdf5 roundtrip - cylindrical") +{ + // The XML data as a string + std::string xml_string = R"( + + 0.1 0.2 0.5 1.0 + 0.0 6.283185307179586 + 0.1 0.2 0.4 0.6 1.0 + 0 0 0 + + )"; + + // Create a pugixml document object + pugi::xml_document doc; + + // Load the XML from the string + pugi::xml_parse_result result = doc.load_string(xml_string.c_str()); + + pugi::xml_node root = doc.child("mesh"); + + auto mesh = CylindricalMesh(root); + + hid_t file_id = file_open("mesh.h5", 'w'); + + mesh.to_hdf5(file_id); + + file_close(file_id); + + hid_t file_id2 = file_open("mesh.h5", 'r'); + + hid_t group = open_group(file_id2, "mesh 1"); + + auto mesh2 = CylindricalMesh(group); + + file_close(file_id2); + + remove("mesh.h5"); + + REQUIRE(mesh2.shape_ == mesh.shape_); + + REQUIRE(mesh2.grid_ == mesh.grid_); +} + +TEST_CASE("Test mesh hdf5 roundtrip - spherical") +{ + // The XML data as a string + std::string xml_string = R"( + + 0.1 0.2 0.5 1.0 + 0.0 3.141592653589793 + 0.0 6.283185307179586 + 0.0 0.0 0.0 + ' + )"; + + // Create a pugixml document object + pugi::xml_document doc; + + // Load the XML from the string + pugi::xml_parse_result result = doc.load_string(xml_string.c_str()); + + pugi::xml_node root = doc.child("mesh"); + + auto mesh = SphericalMesh(root); + + hid_t file_id = file_open("mesh.h5", 'w'); + + mesh.to_hdf5(file_id); + + file_close(file_id); + + hid_t file_id2 = file_open("mesh.h5", 'r'); + + hid_t group = open_group(file_id2, "mesh 1"); + + auto mesh2 = SphericalMesh(group); + + file_close(file_id2); + + remove("mesh.h5"); + + REQUIRE(mesh2.shape_ == mesh.shape_); + + REQUIRE(mesh2.grid_ == mesh.grid_); +} + +TEST_CASE("Test multiple meshes HDF5 roundtrip - spherical") +{ + // The XML data as a string + std::string xml_string = R"( + + + 0.1 0.2 0.5 1.0 + 0.0 3.141592653589793 + 0.0 6.283185307179586 + 0.0 0.0 0.0 + + + 3 4 5 + -2 -3 -5 + 2 3 5 + + + )"; + + // Create a pugixml document object + pugi::xml_document doc; + + // Load the XML from the string + pugi::xml_parse_result result = doc.load_string(xml_string.c_str()); + + pugi::xml_node root = doc.child("meshes"); + + read_meshes(root); + + const auto spherical_mesh_xml = + dynamic_cast(model::meshes[0].get()); + const auto regular_mesh_xml = + dynamic_cast(model::meshes[1].get()); + + hid_t file_id = file_open("meshes.h5", 'w'); + + hid_t root_group = create_group(file_id, "root"); + + open_group(file_id, "root"); + + meshes_to_hdf5(root_group); + + close_group(root_group); + + file_close(file_id); + + hid_t file_id2 = file_open("meshes.h5", 'r'); + + hid_t root_group_read = open_group(file_id2, "root"); + + hid_t mesh_group_read = open_group(root_group_read, "meshes"); + + read_meshes(mesh_group_read); + + // increment mesh IDs to avoid collision during read + for (auto& mesh : model::meshes) { + mesh->set_id(mesh->id() + 10); + } + + const auto spherical_mesh_hdf5 = dynamic_cast( + model::meshes[model::mesh_map[spherical_mesh_xml->id_]].get()); + const auto regular_mesh_hdf5 = dynamic_cast( + model::meshes[model::mesh_map[regular_mesh_xml->id_]].get()); + + remove("meshes.h5"); + + REQUIRE(spherical_mesh_hdf5->shape_ == spherical_mesh_xml->shape_); + REQUIRE(spherical_mesh_hdf5->grid_ == spherical_mesh_xml->grid_); + + REQUIRE(regular_mesh_hdf5->shape_ == regular_mesh_xml->shape_); + REQUIRE(regular_mesh_hdf5->lower_left() == regular_mesh_xml->lower_left()); + REQUIRE(regular_mesh_hdf5->upper_right() == regular_mesh_xml->upper_right()); +} diff --git a/tests/fns_flux_709.npy b/tests/fns_flux_709.npy new file mode 100644 index 000000000..62c612842 Binary files /dev/null and b/tests/fns_flux_709.npy differ diff --git a/tests/regression_tests/adj_cell_rotation/inputs_true.dat b/tests/regression_tests/adj_cell_rotation/inputs_true.dat index 7e2a0cf62..18c0552ce 100644 --- a/tests/regression_tests/adj_cell_rotation/inputs_true.dat +++ b/tests/regression_tests/adj_cell_rotation/inputs_true.dat @@ -1,35 +1,35 @@ - - - + + + - - + + - - - - - - - - - - + + + + + + + + + + eigenvalue 10000 10 5 - + -4.0 -4.0 -4.0 4.0 4.0 4.0 diff --git a/tests/regression_tests/adj_cell_rotation/results_true.dat b/tests/regression_tests/adj_cell_rotation/results_true.dat index b3df12e71..ddb1546b5 100644 --- a/tests/regression_tests/adj_cell_rotation/results_true.dat +++ b/tests/regression_tests/adj_cell_rotation/results_true.dat @@ -1,2 +1,2 @@ k-combined: -4.403987E-01 1.514158E-03 +4.368327E-01 1.953533E-03 diff --git a/tests/regression_tests/albedo_box/results_true.dat b/tests/regression_tests/albedo_box/results_true.dat index 0f571f245..dca80abcd 100644 --- a/tests/regression_tests/albedo_box/results_true.dat +++ b/tests/regression_tests/albedo_box/results_true.dat @@ -1,2 +1,2 @@ k-combined: -1.590800E+00 4.251788E-03 +1.593206E+00 2.925742E-03 diff --git a/tests/regression_tests/asymmetric_lattice/inputs_true.dat b/tests/regression_tests/asymmetric_lattice/inputs_true.dat index 302ef24c2..ee3d68907 100644 --- a/tests/regression_tests/asymmetric_lattice/inputs_true.dat +++ b/tests/regression_tests/asymmetric_lattice/inputs_true.dat @@ -1,40 +1,40 @@ - - - - - - - + + + + + + + - - - - - - + + + + + + - - - - - + + + + + - - - - - + + + + + - + @@ -47,7 +47,7 @@ - + @@ -62,7 +62,7 @@ - + @@ -77,7 +77,7 @@ - + @@ -92,7 +92,7 @@ - + @@ -107,7 +107,7 @@ - + @@ -122,7 +122,7 @@ - + @@ -135,7 +135,7 @@ - + @@ -149,7 +149,7 @@ - + @@ -157,7 +157,7 @@ - + 1.26 1.26 17 17 @@ -190,25 +190,25 @@ 8 8 8 7 7 7 - - - - - - - - - - - - + + + + + + + + + + + + eigenvalue 100 10 5 - + -32 -32 0 32 32 32 diff --git a/tests/regression_tests/asymmetric_lattice/results_true.dat b/tests/regression_tests/asymmetric_lattice/results_true.dat index 741327d80..3d6b610a6 100644 --- a/tests/regression_tests/asymmetric_lattice/results_true.dat +++ b/tests/regression_tests/asymmetric_lattice/results_true.dat @@ -1 +1 @@ -b0ca1fb0436732188b1a199b3250ca9a33782f8fc379b0f7ff9c582e0c794b0a0470df063cafd0b05e802b26f61eaaf9ff5c0a8a672a933246acf49eed3ebf9f \ No newline at end of file +cc76769636be4f681137598cf366e978d7347425a1dfa1b293d17a28381b2b62595fb7f0d2f126dd06972ff9e79089a18dd53aba45fa2b1f316515b91fe6495a \ No newline at end of file diff --git a/tests/regression_tests/cmfd_feed/results_true.dat b/tests/regression_tests/cmfd_feed/results_true.dat index f5f22d9ac..1ef9624d4 100644 --- a/tests/regression_tests/cmfd_feed/results_true.dat +++ b/tests/regression_tests/cmfd_feed/results_true.dat @@ -1,117 +1,117 @@ k-combined: -1.164262E+00 9.207592E-03 +1.181723E+00 9.944883E-03 tally 1: -1.156972E+01 -1.339924E+01 -2.136306E+01 -4.567185E+01 -2.859527E+01 -8.195821E+01 -3.470754E+01 -1.207851E+02 -3.766403E+01 -1.422263E+02 -3.778821E+01 -1.432660E+02 -3.573197E+01 -1.278854E+02 -2.849979E+01 -8.135515E+01 -2.073803E+01 -4.303374E+01 -1.112117E+01 -1.242944E+01 +1.169899E+01 +1.373251E+01 +2.142380E+01 +4.605511E+01 +2.968085E+01 +8.838716E+01 +3.561418E+01 +1.271206E+02 +3.777783E+01 +1.428817E+02 +3.805832E+01 +1.450213E+02 +3.439836E+01 +1.184892E+02 +2.852438E+01 +8.161896E+01 +2.088423E+01 +4.376204E+01 +1.076670E+01 +1.168108E+01 tally 2: -2.388054E+01 -2.875255E+01 -1.667791E+01 -1.403426E+01 -4.224771E+01 -8.942109E+01 -2.993088E+01 -4.490335E+01 -5.689839E+01 -1.625557E+02 -4.043633E+01 -8.212299E+01 -6.764024E+01 -2.297126E+02 -4.807902E+01 -1.161468E+02 -7.314835E+01 -2.684645E+02 -5.203584E+01 -1.359261E+02 -7.375727E+01 -2.733105E+02 -5.252944E+01 -1.386205E+02 -6.909571E+01 -2.397721E+02 -4.922548E+01 -1.217465E+02 -5.685978E+01 -1.621746E+02 -4.051938E+01 -8.237277E+01 -4.185562E+01 -8.784067E+01 -2.983570E+01 -4.467414E+01 -2.238373E+01 -2.520356E+01 -1.566758E+01 -1.234103E+01 +2.321241E+01 +2.702156E+01 +1.620912E+01 +1.317752E+01 +4.197404E+01 +8.845008E+01 +2.982666E+01 +4.469221E+01 +5.810089E+01 +1.695857E+02 +4.134123E+01 +8.588866E+01 +6.982488E+01 +2.447068E+02 +4.966939E+01 +1.238763E+02 +7.428421E+01 +2.767613E+02 +5.287955E+01 +1.403163E+02 +7.447402E+01 +2.785012E+02 +5.324628E+01 +1.423393E+02 +6.895164E+01 +2.381937E+02 +4.916366E+01 +1.211701E+02 +5.679253E+01 +1.617881E+02 +4.043125E+01 +8.204061E+01 +4.218618E+01 +8.933666E+01 +2.978592E+01 +4.456592E+01 +2.196426E+01 +2.435867E+01 +1.525576E+01 +1.175879E+01 tally 3: -1.609520E+01 -1.307542E+01 -1.033429E+00 -5.510889E-02 -2.877073E+01 -4.149542E+01 -1.964219E+00 -1.954692E-01 -3.896816E+01 -7.629752E+01 -2.484053E+00 -3.103733E-01 -4.634285E+01 -1.079367E+02 -2.974750E+00 -4.468223E-01 -5.007964E+01 -1.259202E+02 -3.181802E+00 -5.103621E-01 -5.058915E+01 -1.286193E+02 -3.249442E+00 -5.337712E-01 -4.744464E+01 -1.131026E+02 -3.067644E+00 -4.736335E-01 -3.900632E+01 -7.634433E+01 -2.443552E+00 -3.028060E-01 -2.874166E+01 -4.146375E+01 -1.810421E+00 -1.671667E-01 -1.509222E+01 -1.145579E+01 -1.014919E+00 -5.391053E-02 +1.563788E+01 +1.226528E+01 +1.053289E+00 +5.666942E-02 +2.870755E+01 +4.139654E+01 +1.838017E+00 +1.710528E-01 +3.978616E+01 +7.955764E+01 +2.560657E+00 +3.334449E-01 +4.780385E+01 +1.147770E+02 +3.139243E+00 +4.967628E-01 +5.106650E+01 +1.308704E+02 +3.170056E+00 +5.078920E-01 +5.123992E+01 +1.318586E+02 +3.211706E+00 +5.205979E-01 +4.729862E+01 +1.121695E+02 +3.068662E+00 +4.749488E-01 +3.898816E+01 +7.630564E+01 +2.516911E+00 +3.199696E-01 +2.865357E+01 +4.125742E+01 +1.852314E+00 +1.741116E-01 +1.467340E+01 +1.088460E+01 +9.268633E-01 +4.450662E-02 tally 4: -3.148231E+00 -4.974555E-01 +3.029754E+00 +4.613561E-01 0.000000E+00 0.000000E+00 -2.805439E+00 -3.982239E-01 -5.574031E+00 -1.561105E+00 +2.832501E+00 +4.049252E-01 +5.517243E+00 +1.527794E+00 0.000000E+00 0.000000E+00 0.000000E+00 @@ -128,14 +128,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -5.574031E+00 -1.561105E+00 -2.805439E+00 -3.982239E-01 -5.171038E+00 -1.344877E+00 -7.372031E+00 -2.725420E+00 +5.517243E+00 +1.527794E+00 +2.832501E+00 +4.049252E-01 +5.117178E+00 +1.316972E+00 +7.333303E+00 +2.701677E+00 0.000000E+00 0.000000E+00 0.000000E+00 @@ -152,14 +152,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -7.372031E+00 -2.725420E+00 -5.171038E+00 -1.344877E+00 -6.946847E+00 -2.424850E+00 -8.496610E+00 -3.627542E+00 +7.333303E+00 +2.701677E+00 +5.117178E+00 +1.316972E+00 +7.248464E+00 +2.641591E+00 +8.817788E+00 +3.905530E+00 0.000000E+00 0.000000E+00 0.000000E+00 @@ -176,14 +176,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -8.496610E+00 -3.627542E+00 -6.946847E+00 -2.424850E+00 -8.479501E+00 -3.607280E+00 -9.261869E+00 -4.305912E+00 +8.817788E+00 +3.905530E+00 +7.248464E+00 +2.641591E+00 +8.646465E+00 +3.749847E+00 +9.460948E+00 +4.495388E+00 0.000000E+00 0.000000E+00 0.000000E+00 @@ -200,14 +200,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -9.261869E+00 -4.305912E+00 -8.479501E+00 -3.607280E+00 -9.232858E+00 -4.278432E+00 -9.306384E+00 -4.348594E+00 +9.460948E+00 +4.495388E+00 +8.646465E+00 +3.749847E+00 +9.379341E+00 +4.415049E+00 +9.278640E+00 +4.320720E+00 0.000000E+00 0.000000E+00 0.000000E+00 @@ -224,14 +224,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -9.306384E+00 -4.348594E+00 -9.232858E+00 -4.278432E+00 -9.299764E+00 -4.347828E+00 -8.511976E+00 -3.639893E+00 +9.278640E+00 +4.320720E+00 +9.379341E+00 +4.415049E+00 +9.465746E+00 +4.498591E+00 +8.656146E+00 +3.760545E+00 0.000000E+00 0.000000E+00 0.000000E+00 @@ -248,14 +248,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -8.511976E+00 -3.639893E+00 -9.299764E+00 -4.347828E+00 -8.726086E+00 -3.819567E+00 -7.147277E+00 -2.562747E+00 +8.656146E+00 +3.760545E+00 +9.465746E+00 +4.498591E+00 +8.589782E+00 +3.700308E+00 +6.996002E+00 +2.456935E+00 0.000000E+00 0.000000E+00 0.000000E+00 @@ -272,14 +272,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -7.147277E+00 -2.562747E+00 -8.726086E+00 -3.819567E+00 -7.218790E+00 -2.612243E+00 -5.018287E+00 -1.263077E+00 +6.996002E+00 +2.456935E+00 +8.589782E+00 +3.700308E+00 +7.352050E+00 +2.714808E+00 +5.105164E+00 +1.312559E+00 0.000000E+00 0.000000E+00 0.000000E+00 @@ -296,14 +296,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -5.018287E+00 -1.263077E+00 -7.218790E+00 -2.612243E+00 -5.443494E+00 -1.487018E+00 -2.732334E+00 -3.773047E-01 +5.105164E+00 +1.312559E+00 +7.352050E+00 +2.714808E+00 +5.442756E+00 +1.486776E+00 +2.697305E+00 +3.675580E-01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -320,12 +320,12 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -2.732334E+00 -3.773047E-01 -5.443494E+00 -1.487018E+00 -3.044773E+00 -4.655756E-01 +2.697305E+00 +3.675580E-01 +5.442756E+00 +1.486776E+00 +3.017025E+00 +4.571443E-01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -345,144 +345,144 @@ tally 4: 0.000000E+00 0.000000E+00 tally 5: -1.609029E+01 -1.306718E+01 -2.230601E+00 -2.559496E-01 -2.876780E+01 -4.148686E+01 -3.835952E+00 -7.456562E-01 -3.895738E+01 -7.625344E+01 -4.841024E+00 -1.197335E+00 -4.633595E+01 -1.079043E+02 -6.236821E+00 -1.963311E+00 -5.007472E+01 -1.258967E+02 -6.749745E+00 -2.297130E+00 -5.058336E+01 -1.285894E+02 -6.727612E+00 -2.315656E+00 -4.743869E+01 -1.130735E+02 -6.338193E+00 -2.042159E+00 -3.899838E+01 -7.631289E+01 -5.187573E+00 -1.359733E+00 -2.873434E+01 -4.144233E+01 -3.815610E+00 -7.367619E-01 -1.509020E+01 -1.145268E+01 -2.125767E+00 -2.341894E-01 +1.563588E+01 +1.226217E+01 +2.209027E+00 +2.507131E-01 +2.870034E+01 +4.137550E+01 +3.726620E+00 +7.021948E-01 +3.977762E+01 +7.952285E+01 +5.304975E+00 +1.427333E+00 +4.779747E+01 +1.147456E+02 +6.528302E+00 +2.151715E+00 +5.105366E+01 +1.308037E+02 +6.986782E+00 +2.467487E+00 +5.123380E+01 +1.318264E+02 +6.845633E+00 +2.383542E+00 +4.729296E+01 +1.121433E+02 +6.252695E+00 +1.977351E+00 +3.898236E+01 +7.628315E+01 +5.461495E+00 +1.528579E+00 +2.864576E+01 +4.123538E+01 +3.857301E+00 +7.581323E-01 +1.467047E+01 +1.088031E+01 +2.277024E+00 +2.679801E-01 cmfd indices 1.000000E+01 1.000000E+00 1.000000E+00 1.000000E+00 k cmfd -1.129918E+00 -1.143848E+00 -1.147976E+00 -1.151534E+00 -1.152378E+00 -1.148219E+00 -1.150402E+00 -1.154647E+00 -1.156159E+00 -1.160048E+00 -1.167441E+00 -1.168163E+00 -1.168629E+00 -1.164120E+00 -1.165051E+00 -1.169177E+00 +1.169107E+00 +1.175079E+00 +1.173912E+00 +1.175368E+00 +1.174026E+00 +1.181745E+00 +1.182261E+00 +1.183559E+00 +1.178691E+00 +1.179222E+00 +1.179017E+00 +1.172979E+00 +1.175043E+00 +1.173458E+00 +1.174152E+00 +1.171451E+00 cmfd entropy -3.224769E+00 -3.225945E+00 -3.227421E+00 -3.226174E+00 -3.224429E+00 -3.227049E+00 -3.230710E+00 -3.230315E+00 -3.226825E+00 -3.226655E+00 -3.226588E+00 -3.224155E+00 -3.223246E+00 -3.222640E+00 -3.223920E+00 -3.222838E+00 +3.207640E+00 +3.210547E+00 +3.212218E+00 +3.209573E+00 +3.211619E+00 +3.212126E+00 +3.213163E+00 +3.214288E+00 +3.215737E+00 +3.213677E+00 +3.214925E+00 +3.215612E+00 +3.216708E+00 +3.221454E+00 +3.219048E+00 +3.218387E+00 cmfd balance -3.90454E-03 -4.08089E-03 -3.46511E-03 -4.09535E-03 -2.62009E-03 -2.23559E-03 -2.54033E-03 -2.12799E-03 -2.25864E-03 -1.85766E-03 -1.49916E-03 -1.63471E-03 -1.48377E-03 -1.59800E-03 -1.37354E-03 -1.32853E-03 +4.88208E-03 +4.75139E-03 +3.15783E-03 +3.67091E-03 +2.99797E-03 +2.91060E-03 +2.06576E-03 +1.83482E-03 +1.56292E-03 +1.58659E-03 +2.32986E-03 +1.47376E-03 +1.46673E-03 +1.22627E-03 +1.31963E-03 +1.26456E-03 cmfd dominance ratio -5.539E-01 -5.537E-01 -5.536E-01 -5.515E-01 -5.512E-01 -5.514E-01 -5.518E-01 -5.507E-01 -5.500E-01 -5.497E-01 -5.477E-01 -5.461E-01 -5.444E-01 -5.445E-01 -5.454E-01 +5.467E-01 +5.453E-01 +5.458E-01 +5.436E-01 +5.442E-01 +5.406E-01 +5.401E-01 +5.413E-01 +4.995E-01 +5.396E-01 +5.409E-01 +5.414E-01 +5.423E-01 +5.456E-01 +5.442E-01 5.441E-01 cmfd openmc source comparison -9.875240E-03 -1.106163E-02 -9.847628E-03 -6.065921E-03 -5.772039E-03 -4.615656E-03 -4.244331E-03 -3.694299E-03 -3.545814E-03 -3.213063E-03 -3.467537E-03 -3.383489E-03 -3.697591E-03 -3.937358E-03 -3.369124E-03 -3.190359E-03 +9.587418E-03 +8.150978E-03 +6.677661E-03 +6.334727E-03 +5.153692E-03 +5.082964E-03 +4.633153E-03 +4.037383E-03 +3.528742E-03 +4.559089E-03 +3.517370E-03 +3.306117E-03 +2.913809E-03 +1.906045E-03 +1.932794E-03 +1.711341E-03 cmfd source -4.360494E-02 -8.397599E-02 -1.074181E-01 -1.294531E-01 -1.385611E-01 -1.407934E-01 -1.325191E-01 -1.044311E-01 -7.660359E-02 -4.263941E-02 +4.496492E-02 +7.869674E-02 +1.100280E-01 +1.354045E-01 +1.363339E-01 +1.380533E-01 +1.314512E-01 +1.077480E-01 +7.847306E-02 +3.884630E-02 diff --git a/tests/regression_tests/cmfd_feed_2g/results_true.dat b/tests/regression_tests/cmfd_feed_2g/results_true.dat index 2b61d9f4e..e66eae13c 100644 --- a/tests/regression_tests/cmfd_feed_2g/results_true.dat +++ b/tests/regression_tests/cmfd_feed_2g/results_true.dat @@ -1,112 +1,112 @@ k-combined: -1.035567E+00 9.463160E-03 +1.027434E+00 6.509170E-03 tally 1: -1.146535E+02 -1.315267E+03 -1.157458E+02 -1.340166E+03 -1.140491E+02 -1.301364E+03 -1.146589E+02 -1.315433E+03 +1.162758E+02 +1.352562E+03 +1.138125E+02 +1.295815E+03 +1.143712E+02 +1.308316E+03 +1.150293E+02 +1.323834E+03 tally 2: -4.319968E+01 -9.360083E+01 -6.373035E+01 -2.038056E+02 -1.889646E+02 -1.812892E+03 -1.024866E+02 -5.254528E+02 -4.323262E+01 -9.360200E+01 -6.363111E+01 -2.028178E+02 -1.849746E+02 -1.711533E+03 -1.034532E+02 -5.352768E+02 -4.296541E+01 -9.249656E+01 -6.346919E+01 -2.018659E+02 -1.888697E+02 -1.812037E+03 -1.025707E+02 -5.262261E+02 -4.691085E+01 -1.269707E+02 -6.299377E+01 -1.990497E+02 -1.853864E+02 -1.719984E+03 -1.023015E+02 -5.235858E+02 +4.284580E+01 +9.207089E+01 +6.335165E+01 +2.014931E+02 +1.894187E+02 +1.818190E+03 +1.033212E+02 +5.340768E+02 +4.282771E+01 +9.186295E+01 +6.295029E+01 +1.983895E+02 +1.834276E+02 +1.684375E+03 +1.022482E+02 +5.228403E+02 +4.330690E+01 +9.402038E+01 +6.395965E+01 +2.053163E+02 +1.851113E+02 +1.714198E+03 +1.030809E+02 +5.314535E+02 +4.337097E+01 +9.426435E+01 +6.417590E+01 +2.063443E+02 +1.846817E+02 +1.706518E+03 +1.027233E+02 +5.279582E+02 tally 3: -6.034963E+01 -1.827718E+02 +5.992726E+01 +1.803120E+02 0.000000E+00 0.000000E+00 -1.865665E-02 -4.244195E-05 -4.170941E+00 -8.769372E-01 -3.453368E+00 -5.989168E-01 +2.172646E-02 +4.414237E-05 +4.181401E+00 +8.912796E-01 +3.536506E+00 +6.287425E-01 0.000000E+00 0.000000E+00 -9.743205E+01 -4.749420E+02 -8.570316E-01 -3.807993E-02 -6.005903E+01 -1.807233E+02 +9.824432E+01 +4.828691E+02 +9.116848E-01 +4.231247E-02 +5.955090E+01 +1.775522E+02 0.000000E+00 0.000000E+00 -1.885450E-02 -3.653402E-05 -4.323863E+00 -9.447512E-01 -3.465465E+00 -6.022861E-01 +1.893222E-02 +3.288000E-05 +4.048183E+00 +8.291130E-01 +3.384041E+00 +5.742363E-01 0.000000E+00 0.000000E+00 -9.843481E+01 -4.846158E+02 -9.048150E-01 -4.205551E-02 -5.996660E+01 -1.802150E+02 +9.734253E+01 +4.738861E+02 +9.157632E-01 +4.329280E-02 +6.045835E+01 +1.835255E+02 0.000000E+00 0.000000E+00 -1.221444E-02 -2.263445E-05 -4.301287E+00 -9.309882E-01 -3.456076E+00 -5.992144E-01 +1.501842E-02 +1.896931E-05 +4.289989E+00 +9.251538E-01 +3.481357E+00 +6.071667E-01 0.000000E+00 0.000000E+00 -9.761231E+01 -4.765834E+02 -8.434644E-01 -3.728180E-02 -5.961891E+01 -1.783106E+02 +9.799829E+01 +4.803591E+02 +8.899390E-01 +4.078750E-02 +6.064531E+01 +1.842746E+02 0.000000E+00 0.000000E+00 -1.500709E-02 -3.541280E-05 -4.155669E+00 -8.713442E-01 -3.455342E+00 -6.006426E-01 +1.495496E-02 +3.082640E-05 +4.321537E+00 +9.371611E-01 +3.453767E+00 +5.983727E-01 0.000000E+00 0.000000E+00 -9.726798E+01 -4.733393E+02 -9.202611E-01 -4.390503E-02 +9.771776E+01 +4.777781E+02 +8.975444E-01 +4.157471E-02 tally 4: 0.000000E+00 0.000000E+00 @@ -116,14 +116,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -8.943264E+00 -4.008855E+00 -3.661063E+01 -6.704808E+01 -8.945553E+00 -4.011707E+00 -3.696832E+01 -6.835286E+01 +8.840487E+00 +3.915792E+00 +3.700362E+01 +6.851588E+01 +8.756789E+00 +3.844443E+00 +3.672366E+01 +6.747174E+01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -132,14 +132,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -8.844569E+00 -3.924591E+00 -3.666726E+01 -6.726522E+01 -8.769637E+00 -3.855006E+00 -3.654115E+01 -6.680777E+01 +8.860460E+00 +3.940908E+00 +3.704658E+01 +6.864069E+01 +8.832046E+00 +3.916611E+00 +3.736239E+01 +6.982147E+01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -156,14 +156,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -8.945553E+00 -4.011707E+00 -3.696832E+01 -6.835286E+01 -8.943264E+00 -4.008855E+00 -3.661063E+01 -6.704808E+01 +8.756789E+00 +3.844443E+00 +3.672366E+01 +6.747174E+01 +8.840487E+00 +3.915792E+00 +3.700362E+01 +6.851588E+01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -180,14 +180,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -8.648474E+00 -3.752219E+00 -3.689442E+01 -6.808997E+01 -8.757378E+00 -3.850408E+00 -3.716920E+01 -6.909715E+01 +8.892576E+00 +3.964978E+00 +3.703525E+01 +6.860645E+01 +8.824229E+00 +3.906925E+00 +3.685909E+01 +6.796123E+01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -212,22 +212,22 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -8.783669E+00 -3.870748E+00 -3.687358E+01 -6.802581E+01 -8.755250E+00 -3.846298E+00 -3.660278E+01 -6.704349E+01 -8.769637E+00 -3.855006E+00 -3.654115E+01 -6.680777E+01 -8.844569E+00 -3.924591E+00 -3.666726E+01 -6.726522E+01 +9.050876E+00 +4.111409E+00 +3.656082E+01 +6.687580E+01 +9.042402E+00 +4.105842E+00 +3.687247E+01 +6.801050E+01 +8.832046E+00 +3.916611E+00 +3.736239E+01 +6.982147E+01 +8.860460E+00 +3.940908E+00 +3.704658E+01 +6.864069E+01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -252,14 +252,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -8.755250E+00 -3.846298E+00 -3.660278E+01 -6.704349E+01 -8.783669E+00 -3.870748E+00 -3.687358E+01 -6.802581E+01 +9.042402E+00 +4.105842E+00 +3.687247E+01 +6.801050E+01 +9.050876E+00 +4.111409E+00 +3.656082E+01 +6.687580E+01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -268,14 +268,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -8.757378E+00 -3.850408E+00 -3.716920E+01 -6.909715E+01 -8.648474E+00 -3.752219E+00 -3.689442E+01 -6.808997E+01 +8.824229E+00 +3.906925E+00 +3.685909E+01 +6.796123E+01 +8.892576E+00 +3.964978E+00 +3.703525E+01 +6.860645E+01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -301,133 +301,133 @@ tally 4: 0.000000E+00 0.000000E+00 tally 5: -6.036829E+01 -1.828885E+02 -1.008777E+02 -5.091033E+02 -1.353211E+01 -9.188155E+00 -4.618716E+01 -1.067410E+02 -6.007789E+01 -1.808371E+02 -1.018892E+02 -5.192269E+02 -1.357961E+01 -9.247052E+00 -4.618560E+01 -1.067058E+02 -5.997882E+01 -1.802895E+02 -1.010597E+02 -5.108478E+02 -1.374955E+01 -9.502494E+00 -4.619500E+01 -1.067547E+02 -5.963392E+01 -1.783999E+02 -1.007134E+02 -5.074700E+02 -1.319398E+01 -8.734106E+00 -4.586295E+01 -1.052870E+02 +5.994898E+01 +1.804403E+02 +1.017670E+02 +5.181130E+02 +1.354160E+01 +9.220935E+00 +4.648971E+01 +1.081636E+02 +5.956983E+01 +1.776668E+02 +1.007226E+02 +5.073592E+02 +1.347883E+01 +9.120344E+00 +4.609907E+01 +1.063127E+02 +6.047337E+01 +1.836168E+02 +1.014777E+02 +5.150557E+02 +1.390508E+01 +9.722899E+00 +4.629251E+01 +1.072027E+02 +6.066027E+01 +1.843661E+02 +1.011648E+02 +5.120629E+02 +1.365982E+01 +9.372236E+00 +4.602994E+01 +1.060579E+02 cmfd indices 2.000000E+00 2.000000E+00 1.000000E+00 2.000000E+00 k cmfd -1.018115E+00 -1.022665E+00 -1.020323E+00 -1.020653E+00 -1.021036E+00 -1.020623E+00 -1.021482E+00 -1.025450E+00 -1.027292E+00 -1.028065E+00 -1.027065E+00 -1.024275E+00 -1.025309E+00 -1.026039E+00 -1.026700E+00 -1.023865E+00 +1.013488E+00 +1.024396E+00 +1.015533E+00 +1.009319E+00 +1.012726E+00 +1.014831E+00 +1.021757E+00 +1.022002E+00 +1.023619E+00 +1.020953E+00 +1.023910E+00 +1.027657E+00 +1.024501E+00 +1.023838E+00 +1.025464E+00 +1.022802E+00 cmfd entropy -1.998965E+00 -1.999214E+00 -1.999348E+00 -1.999366E+00 -1.999564E+00 -1.999453E+00 -1.999533E+00 -1.999630E+00 -1.999739E+00 -1.999588E+00 -1.999581E+00 -1.999719E+00 -1.999773E+00 -1.999764E+00 -1.999821E+00 -1.999843E+00 +1.998974E+00 +1.998742E+00 +1.999128E+00 +1.998952E+00 +1.998951E+00 +1.999439E+00 +1.999626E+00 +1.999826E+00 +1.999513E+00 +1.999451E+00 +1.999514E+00 +1.999590E+00 +1.999563E+00 +1.999604E+00 +1.999742E+00 +1.999736E+00 cmfd balance -5.73174E-04 -7.55398E-04 -1.46671E-03 -6.39625E-04 -8.19008E-04 -1.93449E-03 -1.15900E-03 -1.01690E-03 -5.62788E-04 -6.90450E-04 -6.01060E-04 -5.73418E-04 -4.37190E-04 -4.82966E-04 -4.09700E-04 -3.45096E-04 +9.79896E-04 +4.24873E-04 +8.05696E-04 +1.92071E-03 +3.70731E-04 +2.81424E-04 +8.28991E-04 +6.12217E-04 +5.29185E-04 +4.97799E-04 +3.09154E-04 +1.73703E-04 +2.56689E-04 +2.64938E-04 +1.96305E-04 +1.82702E-04 cmfd dominance ratio -6.264E-03 -6.142E-03 -5.987E-03 -6.082E-03 -5.895E-03 -5.939E-03 -5.910E-03 -5.948E-03 -6.013E-03 -6.017E-03 -6.024E-03 -6.008E-03 -5.976E-03 -5.987E-03 -5.967E-03 -5.929E-03 +6.304E-03 +6.246E-03 +6.159E-03 +6.249E-03 +6.101E-03 +6.155E-03 +6.010E-03 +6.177E-03 +6.349E-03 +6.241E-03 +6.244E-03 +6.249E-03 +6.270E-03 +6.272E-03 +6.278E-03 +6.290E-03 cmfd openmc source comparison -4.832872E-05 -6.552342E-05 -7.516800E-05 -7.916087E-05 -9.022260E-05 -8.574478E-05 -7.891622E-05 -7.281636E-05 -7.750571E-05 -6.565408E-05 -6.078665E-05 -5.834343E-05 -4.758176E-05 -5.723990E-05 -4.994116E-05 -4.116808E-05 +4.046094E-05 +5.979431E-05 +3.836521E-05 +4.577591E-05 +5.012911E-05 +2.114677E-05 +2.074571E-05 +3.042280E-05 +2.408163E-05 +2.434542E-05 +1.190699E-05 +9.499301E-06 +2.354221E-05 +2.937924E-05 +1.889875E-05 +1.913866E-05 cmfd source -2.455663E-01 -2.553511E-01 -2.512257E-01 -2.478570E-01 +2.489706E-01 +2.426801E-01 +2.532142E-01 +2.551351E-01 0.000000E+00 0.000000E+00 0.000000E+00 diff --git a/tests/regression_tests/cmfd_feed_expanding_window/results_true.dat b/tests/regression_tests/cmfd_feed_expanding_window/results_true.dat index 8fd8cdbb8..b39f82f96 100644 --- a/tests/regression_tests/cmfd_feed_expanding_window/results_true.dat +++ b/tests/regression_tests/cmfd_feed_expanding_window/results_true.dat @@ -1,117 +1,117 @@ k-combined: -1.167865E+00 7.492213E-03 +1.170835E+00 5.423480E-03 tally 1: -1.146860E+01 -1.318884E+01 -2.161527E+01 -4.685283E+01 -2.951158E+01 -8.733566E+01 -3.521610E+01 -1.242821E+02 -3.774236E+01 -1.426501E+02 -3.727918E+01 -1.391158E+02 -3.377176E+01 -1.143839E+02 -2.904497E+01 -8.452907E+01 -2.090871E+01 -4.384549E+01 -1.078642E+01 -1.168086E+01 +1.205100E+01 +1.456707E+01 +2.183882E+01 +4.781179E+01 +2.844010E+01 +8.102358E+01 +3.356334E+01 +1.130832E+02 +3.660829E+01 +1.344973E+02 +3.697740E+01 +1.371500E+02 +3.400119E+01 +1.160196E+02 +2.839868E+01 +8.083199E+01 +2.140398E+01 +4.615447E+01 +1.118179E+01 +1.262942E+01 tally 2: -1.136810E+00 -1.292338E+00 -7.987303E-01 -6.379700E-01 -2.266938E+00 -5.139009E+00 -1.613483E+00 -2.603328E+00 -3.046349E+00 -9.280239E+00 -2.182459E+00 -4.763126E+00 -3.568068E+00 -1.273111E+01 -2.532456E+00 -6.413333E+00 -3.989504E+00 -1.591614E+01 -2.848301E+00 -8.112818E+00 -3.853133E+00 -1.484663E+01 -2.718493E+00 -7.390202E+00 -3.478138E+00 -1.209745E+01 -2.467281E+00 -6.087476E+00 -2.952220E+00 -8.715605E+00 -2.103261E+00 -4.423706E+00 -1.917459E+00 -3.676649E+00 -1.378369E+00 -1.899902E+00 -1.048240E+00 -1.098807E+00 -7.511947E-01 -5.642934E-01 +1.218245E+00 +1.484121E+00 +8.387442E-01 +7.034918E-01 +2.142134E+00 +4.588738E+00 +1.526727E+00 +2.330895E+00 +2.736157E+00 +7.486556E+00 +1.973921E+00 +3.896363E+00 +3.606244E+00 +1.300500E+01 +2.537580E+00 +6.439313E+00 +3.668958E+00 +1.346126E+01 +2.599095E+00 +6.755294E+00 +3.647982E+00 +1.330777E+01 +2.539750E+00 +6.450332E+00 +3.118921E+00 +9.727669E+00 +2.186447E+00 +4.780549E+00 +2.881110E+00 +8.300795E+00 +2.042635E+00 +4.172360E+00 +2.045602E+00 +4.184486E+00 +1.458384E+00 +2.126884E+00 +1.022124E+00 +1.044738E+00 +7.112678E-01 +5.059018E-01 tally 3: -7.701233E-01 -5.930898E-01 -4.481585E-02 -2.008461E-03 -1.547307E+00 -2.394158E+00 -1.226539E-01 -1.504398E-02 -2.106373E+00 -4.436806E+00 -1.450618E-01 -2.104294E-02 -2.437654E+00 -5.942157E+00 -1.521380E-01 -2.314598E-02 -2.754639E+00 -7.588038E+00 -1.745460E-01 -3.046629E-02 -2.623852E+00 -6.884601E+00 -1.851602E-01 -3.428432E-02 -2.376886E+00 -5.649588E+00 -1.615729E-01 -2.610582E-02 -2.021856E+00 -4.087900E+00 -1.533174E-01 -2.350622E-02 -1.333190E+00 -1.777397E+00 -7.076188E-02 -5.007243E-03 -7.258527E-01 -5.268622E-01 -3.656030E-02 -1.336656E-03 +8.048428E-01 +6.477720E-01 +6.603741E-02 +4.360940E-03 +1.466886E+00 +2.151755E+00 +1.002354E-01 +1.004713E-02 +1.909238E+00 +3.645189E+00 +1.202824E-01 +1.446786E-02 +2.443130E+00 +5.968886E+00 +1.627351E-01 +2.648270E-02 +2.492602E+00 +6.213064E+00 +1.910368E-01 +3.649506E-02 +2.437262E+00 +5.940245E+00 +1.568389E-01 +2.459843E-02 +2.104091E+00 +4.427200E+00 +1.450465E-01 +2.103848E-02 +1.965900E+00 +3.864762E+00 +1.367918E-01 +1.871199E-02 +1.402871E+00 +1.968047E+00 +1.061316E-01 +1.126391E-02 +6.832689E-01 +4.668565E-01 +4.599034E-02 +2.115112E-03 tally 4: -1.667432E-01 -2.780328E-02 +1.497312E-01 +2.241943E-02 0.000000E+00 0.000000E+00 -1.292567E-01 -1.670730E-02 -2.813370E-01 -7.915052E-02 +1.535839E-01 +2.358801E-02 +2.882052E-01 +8.306225E-02 0.000000E+00 0.000000E+00 0.000000E+00 @@ -128,14 +128,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -2.813370E-01 -7.915052E-02 -1.292567E-01 -1.670730E-02 -2.670549E-01 -7.131835E-02 -4.055324E-01 -1.644566E-01 +2.882052E-01 +8.306225E-02 +1.535839E-01 +2.358801E-02 +2.526805E-01 +6.384743E-02 +3.616220E-01 +1.307705E-01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -152,14 +152,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -4.055324E-01 -1.644566E-01 -2.670549E-01 -7.131835E-02 -3.848125E-01 -1.480807E-01 -4.809430E-01 -2.313062E-01 +3.616220E-01 +1.307705E-01 +2.526805E-01 +6.384743E-02 +3.594306E-01 +1.291904E-01 +4.229730E-01 +1.789062E-01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -176,14 +176,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -4.809430E-01 -2.313062E-01 -3.848125E-01 -1.480807E-01 -4.543918E-01 -2.064719E-01 -5.106133E-01 -2.607260E-01 +4.229730E-01 +1.789062E-01 +3.594306E-01 +1.291904E-01 +3.973299E-01 +1.578711E-01 +4.255879E-01 +1.811250E-01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -200,14 +200,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -5.106133E-01 -2.607260E-01 -4.543918E-01 -2.064719E-01 -4.543120E-01 -2.063994E-01 -4.626328E-01 -2.140291E-01 +4.255879E-01 +1.811250E-01 +3.973299E-01 +1.578711E-01 +4.633933E-01 +2.147333E-01 +4.672837E-01 +2.183540E-01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -224,14 +224,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -4.626328E-01 -2.140291E-01 -4.543120E-01 -2.063994E-01 -4.827759E-01 -2.330726E-01 -4.442622E-01 -1.973689E-01 +4.672837E-01 +2.183540E-01 +4.633933E-01 +2.147333E-01 +4.251073E-01 +1.807162E-01 +3.842922E-01 +1.476805E-01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -248,14 +248,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -4.442622E-01 -1.973689E-01 -4.827759E-01 -2.330726E-01 -4.630420E-01 -2.144079E-01 -3.886524E-01 -1.510507E-01 +3.842922E-01 +1.476805E-01 +4.251073E-01 +1.807162E-01 +4.045096E-01 +1.636280E-01 +3.192860E-01 +1.019436E-01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -272,14 +272,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -3.886524E-01 -1.510507E-01 -4.630420E-01 -2.144079E-01 -3.535870E-01 -1.250237E-01 -2.530312E-01 -6.402478E-02 +3.192860E-01 +1.019436E-01 +4.045096E-01 +1.636280E-01 +3.738326E-01 +1.397508E-01 +2.598153E-01 +6.750398E-02 0.000000E+00 0.000000E+00 0.000000E+00 @@ -296,14 +296,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -2.530312E-01 -6.402478E-02 -3.535870E-01 -1.250237E-01 -2.465524E-01 -6.078808E-02 -1.197152E-01 -1.433173E-02 +2.598153E-01 +6.750398E-02 +3.738326E-01 +1.397508E-01 +2.453191E-01 +6.018146E-02 +1.098964E-01 +1.207721E-02 0.000000E+00 0.000000E+00 0.000000E+00 @@ -320,12 +320,12 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -1.197152E-01 -1.433173E-02 -2.465524E-01 -6.078808E-02 -1.369631E-01 -1.875888E-02 +1.098964E-01 +1.207721E-02 +2.453191E-01 +6.018146E-02 +1.458094E-01 +2.126039E-02 0.000000E+00 0.000000E+00 0.000000E+00 @@ -345,119 +345,119 @@ tally 4: 0.000000E+00 0.000000E+00 tally 5: -7.701233E-01 -5.930898E-01 -1.386250E-01 -1.921688E-02 -1.547307E+00 -2.394158E+00 -2.630277E-01 -6.918357E-02 -2.106373E+00 -4.436806E+00 -2.807880E-01 -7.884187E-02 -2.435849E+00 -5.933361E+00 -3.322060E-01 -1.103608E-01 -2.753634E+00 -7.582501E+00 -3.825922E-01 -1.463768E-01 -2.623852E+00 -6.884601E+00 -3.888710E-01 -1.512206E-01 -2.376886E+00 -5.649588E+00 -3.196217E-01 -1.021581E-01 -2.021856E+00 -4.087900E+00 -2.897881E-01 -8.397715E-02 -1.333190E+00 -1.777397E+00 -1.627110E-01 -2.647486E-02 -7.258527E-01 -5.268622E-01 -9.348666E-02 -8.739755E-03 +8.048428E-01 +6.477720E-01 +1.018934E-01 +1.038226E-02 +1.466886E+00 +2.151755E+00 +1.414681E-01 +2.001322E-02 +1.909238E+00 +3.645189E+00 +2.450211E-01 +6.003535E-02 +2.443130E+00 +5.968886E+00 +3.360056E-01 +1.128997E-01 +2.492602E+00 +6.213064E+00 +3.266277E-01 +1.066856E-01 +2.437262E+00 +5.940245E+00 +2.878100E-01 +8.283461E-02 +2.104091E+00 +4.427200E+00 +3.440457E-01 +1.183675E-01 +1.965900E+00 +3.864762E+00 +2.880615E-01 +8.297945E-02 +1.401955E+00 +1.965478E+00 +1.646479E-01 +2.710892E-02 +6.832689E-01 +4.668565E-01 +1.147413E-01 +1.316557E-02 cmfd indices 1.000000E+01 1.000000E+00 1.000000E+00 1.000000E+00 k cmfd -1.149077E+00 -1.156751E+00 -1.158648E+00 -1.159506E+00 -1.156567E+00 -1.160259E+00 -1.150345E+00 -1.149846E+00 -1.151606E+00 -1.164544E+00 -1.174648E+00 +1.181376E+00 +1.176656E+00 +1.161939E+00 +1.163552E+00 +1.163035E+00 +1.170382E+00 +1.160597E+00 +1.154301E+00 +1.159007E+00 +1.148290E+00 +1.157088E+00 cmfd entropy -3.216173E+00 -3.228717E+00 -3.220402E+00 -3.214352E+00 -3.215636E+00 -3.213599E+00 -3.212854E+00 -3.213131E+00 -3.213196E+00 -3.205474E+00 -3.202869E+00 +3.246419E+00 +3.246511E+00 +3.252247E+00 +3.240919E+00 +3.237600E+00 +3.233990E+00 +3.234226E+00 +3.229356E+00 +3.224272E+00 +3.225381E+00 +3.226778E+00 cmfd balance -3.08825E-03 -1.42345E-03 -1.21253E-03 -1.17694E-03 -1.05901E-03 -9.29611E-04 -1.35587E-03 -1.13579E-03 -1.14964E-03 -1.29313E-03 -1.46566E-03 +4.18486E-03 +1.72126E-03 +1.10899E-03 +1.88170E-03 +1.31646E-03 +1.34128E-03 +1.57944E-03 +2.11251E-03 +1.79912E-03 +1.86000E-03 +1.47765E-03 cmfd dominance ratio 5.524E-01 -5.614E-01 -5.522E-01 -5.487E-01 -5.482E-01 -5.446E-01 -5.437E-01 -5.429E-01 -5.407E-01 -5.380E-01 -5.377E-01 +5.597E-01 +5.622E-01 +5.544E-01 +5.541E-01 +5.519E-01 +5.532E-01 +5.550E-01 +5.484E-01 +5.497E-01 +5.500E-01 cmfd openmc source comparison -1.586045E-02 -6.953134E-03 -6.860419E-03 -6.198467E-03 -5.142854E-03 -4.373354E-03 -5.564831E-03 -4.184765E-03 -1.867780E-03 -2.734784E-03 -2.523985E-03 +1.905464E-03 +4.145126E-03 +2.465876E-03 +2.346755E-03 +1.848120E-03 +3.263822E-03 +3.641639E-03 +4.031509E-03 +4.999010E-03 +6.640746E-03 +5.691414E-03 cmfd source -4.241440E-02 -8.226026E-02 -1.180811E-01 -1.328433E-01 -1.412410E-01 -1.424902E-01 -1.269340E-01 -1.096490E-01 -6.953251E-02 -3.455422E-02 +4.951338E-02 +8.478025E-02 +1.083132E-01 +1.301432E-01 +1.341190E-01 +1.445825E-01 +1.255119E-01 +1.063303E-01 +7.830158E-02 +3.840469E-02 diff --git a/tests/regression_tests/cmfd_feed_ng/results_true.dat b/tests/regression_tests/cmfd_feed_ng/results_true.dat index 153238bfe..4ea1515f1 100644 --- a/tests/regression_tests/cmfd_feed_ng/results_true.dat +++ b/tests/regression_tests/cmfd_feed_ng/results_true.dat @@ -1,208 +1,208 @@ k-combined: -1.005987E+00 1.354263E-02 +1.008852E+00 9.028695E-03 tally 1: -1.140273E+02 -1.301245E+03 -1.147962E+02 -1.319049E+03 -1.151426E+02 -1.326442E+03 -1.149265E+02 -1.321518E+03 +1.151271E+02 +1.325871E+03 +1.143934E+02 +1.309051E+03 +1.142507E+02 +1.306616E+03 +1.140242E+02 +1.300786E+03 tally 2: -3.462748E+01 -7.542476E+01 -5.129219E+01 -1.658142E+02 -1.034704E+01 -6.730603E+00 -8.672967E+00 -4.715295E+00 -1.344669E+02 -1.132019E+03 -7.262519E+01 -3.300787E+02 -3.447358E+01 -7.459545E+01 -5.075836E+01 -1.619570E+02 -1.080516E+01 -7.366369E+00 -8.908065E+00 -4.991975E+00 -1.354224E+02 -1.146824E+03 -7.300078E+01 -3.332531E+02 -3.432298E+01 -7.388666E+01 -5.096378E+01 -1.627979E+02 -1.053664E+01 -7.029789E+00 -8.826624E+00 -4.904429E+00 -1.388389E+02 -1.207280E+03 -7.376623E+01 -3.403211E+02 -4.383841E+01 -1.943331E+02 -5.165881E+01 -1.675923E+02 -1.059646E+01 -7.048052E+00 -8.763673E+00 -4.823505E+00 -1.378179E+02 -1.188104E+03 -7.431708E+01 -3.453746E+02 +3.403617E+01 +7.260478E+01 +5.031678E+01 +1.588977E+02 +1.003700E+01 +6.373741E+00 +8.514575E+00 +4.571811E+00 +1.413036E+02 +1.264708E+03 +7.321799E+01 +3.353408E+02 +3.354839E+01 +7.052647E+01 +4.895930E+01 +1.501243E+02 +9.972495E+00 +6.271276E+00 +8.436263E+00 +4.481319E+00 +1.353506E+02 +1.146040E+03 +7.309382E+01 +3.341751E+02 +3.389861E+01 +7.205501E+01 +5.005946E+01 +1.571210E+02 +1.041650E+01 +6.810868E+00 +8.839753E+00 +4.897617E+00 +1.344145E+02 +1.130242E+03 +7.270373E+01 +3.307223E+02 +3.347928E+01 +7.040185E+01 +4.940585E+01 +1.535767E+02 +9.898649E+00 +6.175319E+00 +8.406032E+00 +4.442856E+00 +1.374544E+02 +1.182191E+03 +7.334301E+01 +3.365399E+02 tally 3: -4.858880E+01 -1.488705E+02 +4.755532E+01 +1.419592E+02 0.000000E+00 0.000000E+00 -8.148667E-03 -1.337050E-05 +1.628248E-02 +3.680742E-05 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -3.347376E+00 -7.045574E-01 -2.433484E+00 -3.727266E-01 +3.347160E+00 +7.104290E-01 +2.453669E+00 +3.797470E-01 0.000000E+00 0.000000E+00 -6.095478E+00 -2.332622E+00 +5.925795E+00 +2.220734E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -1.235421E-01 -1.205155E-03 -3.647699E-01 -8.953589E-03 +9.542527E-02 +1.118856E-03 +3.018759E-01 +6.371059E-03 0.000000E+00 0.000000E+00 -2.673965E+00 -4.517972E-01 +2.501316E+00 +3.938401E-01 0.000000E+00 0.000000E+00 -6.841105E+01 -2.929195E+02 -5.902473E-01 -2.307683E-02 -4.792291E+01 -1.444397E+02 +6.926265E+01 +3.001504E+02 +6.765221E-01 +2.991787E-02 +4.605523E+01 +1.328435E+02 0.000000E+00 0.000000E+00 -2.183275E-02 -8.061011E-05 +1.687782E-02 +3.921162E-05 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -3.435826E+00 -7.480244E-01 -2.450829E+00 -3.800327E-01 +3.481608E+00 +7.705602E-01 +2.439374E+00 +3.779705E-01 0.000000E+00 0.000000E+00 -6.331358E+00 -2.530492E+00 +5.855806E+00 +2.162361E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -1.012941E-01 -8.217580E-04 -2.981274E-01 -5.863186E-03 +1.016677E-01 +9.263706E-04 +3.264878E-01 +7.385168E-03 0.000000E+00 0.000000E+00 -2.535628E+00 -4.048310E-01 +2.519730E+00 +3.986182E-01 0.000000E+00 0.000000E+00 -6.912003E+01 -2.987684E+02 -5.984862E-01 -2.386115E-02 -4.822881E+01 -1.458309E+02 +6.920950E+01 +2.996184E+02 +5.985719E-01 +2.368062E-02 +4.730723E+01 +1.403550E+02 0.000000E+00 0.000000E+00 -1.525590E-02 -3.794082E-05 +6.800415E-03 +1.163614E-05 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -3.314494E+00 -6.944527E-01 -2.424209E+00 -3.691360E-01 +3.347607E+00 +7.085691E-01 +2.556997E+00 +4.109118E-01 0.000000E+00 0.000000E+00 -6.254897E+00 -2.474317E+00 +6.171063E+00 +2.391770E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -1.112542E-01 -1.051688E-03 -3.234880E-01 -7.156753E-03 +7.942016E-02 +5.628747E-04 +3.456912E-01 +7.940086E-03 0.000000E+00 0.000000E+00 -2.474142E+00 -3.837496E-01 +2.684459E+00 +4.546338E-01 0.000000E+00 0.000000E+00 -6.987095E+01 -3.053358E+02 -5.928782E-01 -2.368116E-02 -4.885415E+01 -1.499856E+02 +6.850588E+01 +2.936078E+02 +6.458806E-01 +2.672541E-02 +4.673301E+01 +1.374202E+02 0.000000E+00 0.000000E+00 -1.262416E-02 -2.486286E-05 +1.504681E-02 +4.202606E-05 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -3.426826E+00 -7.480396E-01 -2.487209E+00 -3.903882E-01 +3.139138E+00 +6.206027E-01 +2.341735E+00 +3.454035E-01 0.000000E+00 0.000000E+00 -6.127303E+00 -2.364605E+00 +5.923755E+00 +2.216341E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -9.439007E-02 -1.082564E-03 -2.963491E-01 -5.652952E-03 +7.030156E-02 +4.283974E-04 +3.247594E-01 +7.133772E-03 0.000000E+00 0.000000E+00 -2.620696E+00 -4.311792E-01 +2.559691E+00 +4.119674E-01 0.000000E+00 0.000000E+00 -7.030725E+01 -3.091241E+02 -5.986966E-01 -2.352487E-02 +6.938051E+01 +3.012078E+02 +5.159565E-01 +1.730381E-02 tally 4: 0.000000E+00 0.000000E+00 @@ -216,18 +216,18 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -7.028624E+00 -3.105990E+00 -2.154648E+00 -2.948865E-01 -2.714077E+01 -4.607926E+01 -7.035506E+00 -3.118549E+00 -2.085916E+00 -2.730884E-01 -2.750091E+01 -4.731304E+01 +7.028166E+00 +3.103666E+00 +2.028371E+00 +2.606104E-01 +2.715466E+01 +4.614452E+01 +6.981028E+00 +3.059096E+00 +2.032450E+00 +2.610410E-01 +2.734281E+01 +4.675062E+01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -240,18 +240,18 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -7.170567E+00 -3.240715E+00 -2.131758E+00 -2.862355E-01 -2.747702E+01 -4.722977E+01 -7.068817E+00 -3.139275E+00 -2.095865E+00 -2.762179E-01 -2.737835E+01 -4.688689E+01 +6.969559E+00 +3.054867E+00 +2.042871E+00 +2.624815E-01 +2.766332E+01 +4.787778E+01 +7.022610E+00 +3.098329E+00 +2.109973E+00 +2.824233E-01 +2.733826E+01 +4.676309E+01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -276,18 +276,18 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -7.035506E+00 -3.118549E+00 -2.085916E+00 -2.730884E-01 -2.750091E+01 -4.731304E+01 -7.028624E+00 -3.105990E+00 -2.154648E+00 -2.948865E-01 -2.714077E+01 -4.607926E+01 +6.981028E+00 +3.059096E+00 +2.032450E+00 +2.610410E-01 +2.734281E+01 +4.675062E+01 +7.028166E+00 +3.103666E+00 +2.028371E+00 +2.606104E-01 +2.715466E+01 +4.614452E+01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -312,18 +312,18 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -7.103896E+00 -3.171147E+00 -2.095666E+00 -2.756673E-01 -2.711842E+01 -4.600196E+01 -7.197270E+00 -3.255501E+00 -2.046179E+00 -2.630301E-01 -2.729901E+01 -4.662030E+01 +6.782152E+00 +2.885448E+00 +1.951138E+00 +2.400912E-01 +2.739652E+01 +4.697696E+01 +6.873220E+00 +2.965563E+00 +1.999066E+00 +2.521586E-01 +2.732700E+01 +4.670990E+01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -360,30 +360,30 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -7.240906E+00 -3.296285E+00 -2.130816E+00 -2.850713E-01 -2.761433E+01 -4.771548E+01 -7.126427E+00 -3.199209E+00 -2.177254E+00 -2.998765E-01 -2.754936E+01 -4.748447E+01 -7.068817E+00 -3.139275E+00 -2.095865E+00 -2.762179E-01 -2.737835E+01 -4.688689E+01 -7.170567E+00 -3.240715E+00 -2.131758E+00 -2.862355E-01 -2.747702E+01 -4.722977E+01 +6.933695E+00 +3.028826E+00 +2.080336E+00 +2.719620E-01 +2.726925E+01 +4.650782E+01 +6.836291E+00 +2.935998E+00 +2.124868E+00 +2.841370E-01 +2.709685E+01 +4.591604E+01 +7.022610E+00 +3.098329E+00 +2.109973E+00 +2.824233E-01 +2.733826E+01 +4.676309E+01 +6.969559E+00 +3.054867E+00 +2.042871E+00 +2.624815E-01 +2.766332E+01 +4.787778E+01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -420,18 +420,18 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -7.126427E+00 -3.199209E+00 -2.177254E+00 -2.998765E-01 -2.754936E+01 -4.748447E+01 -7.240906E+00 -3.296285E+00 -2.130816E+00 -2.850713E-01 -2.761433E+01 -4.771548E+01 +6.836291E+00 +2.935998E+00 +2.124868E+00 +2.841370E-01 +2.709685E+01 +4.591604E+01 +6.933695E+00 +3.028826E+00 +2.080336E+00 +2.719620E-01 +2.726925E+01 +4.650782E+01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -444,18 +444,18 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -7.197270E+00 -3.255501E+00 -2.046179E+00 -2.630301E-01 -2.729901E+01 -4.662030E+01 -7.103896E+00 -3.171147E+00 -2.095666E+00 -2.756673E-01 -2.711842E+01 -4.600196E+01 +6.873220E+00 +2.965563E+00 +1.999066E+00 +2.521586E-01 +2.732700E+01 +4.670990E+01 +6.782152E+00 +2.885448E+00 +1.951138E+00 +2.400912E-01 +2.739652E+01 +4.697696E+01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -493,124 +493,124 @@ tally 4: 0.000000E+00 0.000000E+00 tally 5: -4.859695E+01 -1.489217E+02 -8.528963E+00 -4.561881E+00 -7.144500E+01 -3.194467E+02 -1.120265E+01 -7.944038E+00 -4.009821E+00 -1.012575E+00 -3.235456E+01 -6.558658E+01 -4.794474E+01 -1.445671E+02 -8.782187E+00 -4.852477E+00 -7.195036E+01 -3.237389E+02 -1.075572E+01 -7.333822E+00 -4.084680E+00 -1.054714E+00 -3.267154E+01 -6.675266E+01 -4.824407E+01 -1.459220E+02 -8.679106E+00 -4.742342E+00 -7.266858E+01 -3.302641E+02 -1.094872E+01 -7.536318E+00 -3.935828E+00 -9.749543E-01 -3.319517E+01 -6.894791E+01 -4.886677E+01 -1.500624E+02 -8.614512E+00 -4.662618E+00 -7.321408E+01 -3.352172E+02 -1.095123E+01 -7.574359E+00 -3.885927E+00 -9.539315E-01 -3.334065E+01 -6.953215E+01 +4.757160E+01 +1.420561E+02 +8.379464E+00 +4.426892E+00 +7.205748E+01 +3.248178E+02 +1.047742E+01 +6.922945E+00 +3.879420E+00 +9.517577E-01 +3.297227E+01 +6.802001E+01 +4.607211E+01 +1.329402E+02 +8.295180E+00 +4.334618E+00 +7.205259E+01 +3.247324E+02 +1.059307E+01 +7.039382E+00 +3.783039E+00 +9.030658E-01 +3.288052E+01 +6.762048E+01 +4.731403E+01 +1.403940E+02 +8.728060E+00 +4.774750E+00 +7.152809E+01 +3.200993E+02 +1.074636E+01 +7.270116E+00 +4.007351E+00 +1.010562E+00 +3.249303E+01 +6.611829E+01 +4.674806E+01 +1.375015E+02 +8.265491E+00 +4.296947E+00 +7.226174E+01 +3.267127E+02 +1.079228E+01 +7.340408E+00 +3.843888E+00 +9.273339E-01 +3.300391E+01 +6.823122E+01 cmfd indices 2.000000E+00 2.000000E+00 1.000000E+00 3.000000E+00 k cmfd -1.026473E+00 -1.024183E+00 -1.023151E+00 -1.025047E+00 -1.019801E+00 -1.020492E+00 -1.015249E+00 -1.016714E+00 -1.016047E+00 -1.019687E+00 -1.020955E+00 +1.011190E+00 +1.010705E+00 +1.014132E+00 +1.015900E+00 +1.019132E+00 +1.022616E+00 +1.023007E+00 +1.022300E+00 +1.014692E+00 +1.007628E+00 +1.006204E+00 cmfd entropy -1.999640E+00 -1.999556E+00 -1.999484E+00 -1.999718E+00 -1.999697E+00 -1.999657E+00 -1.999883E+00 -1.999902E+00 -1.999977E+00 -1.999977E+00 -1.999906E+00 +1.999167E+00 +1.999076E+00 +1.998507E+00 +1.997924E+00 +1.997814E+00 +1.997752E+00 +1.997882E+00 +1.998074E+00 +1.998109E+00 +1.998301E+00 +1.998581E+00 cmfd balance -8.10090E-04 -1.28103E-03 -7.97200E-04 -5.82188E-04 -7.20670E-04 -7.31475E-04 -5.71904E-04 -6.14057E-04 -6.00142E-04 -5.47870E-04 -3.53604E-04 +9.30124E-04 +2.56632E-04 +3.62598E-04 +4.17543E-04 +5.25720E-04 +4.90208E-04 +3.61304E-04 +2.24090E-04 +1.86602E-04 +1.78395E-04 +6.42497E-05 cmfd dominance ratio -3.977E-03 -4.018E-03 -3.950E-03 -3.866E-03 -3.840E-03 -3.888E-03 -3.867E-03 -3.896E-03 -3.924E-03 -3.885E-03 -3.913E-03 +4.194E-03 +4.234E-03 +4.149E-03 +4.209E-03 +4.185E-03 +4.197E-03 +4.175E-03 +4.105E-03 +4.056E-03 +4.122E-03 +4.113E-03 cmfd openmc source comparison -4.787501E-05 -4.450525E-05 -2.532345E-05 -3.844307E-05 -4.821504E-05 -4.840760E-05 -3.739246E-05 -3.957960E-05 -4.521480E-05 -4.072007E-05 -2.532636E-05 +2.078995E-05 +2.415218E-05 +3.311536E-05 +3.598613E-05 +3.156455E-05 +2.737017E-05 +2.468500E-05 +2.514215E-05 +1.601626E-05 +1.424027E-05 +4.201148E-06 cmfd source -2.486236E-01 -2.531628E-01 -2.460219E-01 -2.521918E-01 +2.558585E-01 +2.597562E-01 +2.529866E-01 +2.313986E-01 0.000000E+00 0.000000E+00 0.000000E+00 diff --git a/tests/regression_tests/cmfd_feed_rectlin/results_true.dat b/tests/regression_tests/cmfd_feed_rectlin/results_true.dat index 600b5d152..a98f3fbd3 100644 --- a/tests/regression_tests/cmfd_feed_rectlin/results_true.dat +++ b/tests/regression_tests/cmfd_feed_rectlin/results_true.dat @@ -1,149 +1,149 @@ k-combined: -1.160561E+00 1.029736E-02 +1.157362E+00 9.651846E-03 tally 1: -1.089904E+01 -1.193573E+01 -2.026534E+01 -4.113383E+01 -2.723584E+01 -7.440537E+01 -3.309956E+01 -1.101184E+02 -3.659327E+01 -1.341221E+02 -3.780158E+01 -1.430045E+02 -3.520883E+01 -1.241772E+02 -2.961801E+01 -8.784675E+01 -2.182029E+01 -4.781083E+01 -1.180347E+01 -1.399970E+01 +1.160989E+01 +1.351117E+01 +2.127132E+01 +4.540172E+01 +2.903242E+01 +8.450044E+01 +3.443549E+01 +1.188763E+02 +3.678332E+01 +1.355586E+02 +3.760088E+01 +1.418740E+02 +3.433077E+01 +1.181837E+02 +2.861986E+01 +8.231285E+01 +2.182277E+01 +4.792086E+01 +1.138713E+01 +1.304425E+01 tally 2: -8.794706E+00 -3.939413E+00 -6.131113E+00 -1.913116E+00 -3.265522E+01 -5.364042E+01 -2.304238E+01 -2.672742E+01 -2.250225E+01 -2.541491E+01 -1.601668E+01 -1.288405E+01 -5.525355E+01 -1.531915E+02 -3.929637E+01 -7.748545E+01 -3.222711E+01 -5.216630E+01 -2.285375E+01 -2.623641E+01 -7.051908E+01 -2.495413E+02 -5.010064E+01 -1.259701E+02 -3.728726E+01 -6.974440E+01 -2.652872E+01 -3.530919E+01 -3.747306E+01 -7.058235E+01 -2.681415E+01 -3.613314E+01 -7.296802E+01 -2.669214E+02 -5.202502E+01 -1.356733E+02 -3.333947E+01 -5.579355E+01 -2.361733E+01 -2.800800E+01 -5.785916E+01 -1.680561E+02 -4.093282E+01 -8.410711E+01 -2.377151E+01 -2.842464E+01 -1.681789E+01 -1.423646E+01 -3.422028E+01 -5.880493E+01 -2.415199E+01 -2.930240E+01 -8.890608E+00 -3.986356E+00 -6.140159E+00 -1.897764E+00 +8.861425E+00 +3.953963E+00 +6.090757E+00 +1.866235E+00 +3.309260E+01 +5.493482E+01 +2.330765E+01 +2.725350E+01 +2.295343E+01 +2.647375E+01 +1.629166E+01 +1.334081E+01 +5.714234E+01 +1.640293E+02 +4.054051E+01 +8.261123E+01 +3.331786E+01 +5.565082E+01 +2.366345E+01 +2.807637E+01 +7.034800E+01 +2.485209E+02 +5.001286E+01 +1.256087E+02 +3.651223E+01 +6.686058E+01 +2.606851E+01 +3.408881E+01 +3.729833E+01 +6.997492E+01 +2.657970E+01 +3.553107E+01 +7.212382E+01 +2.611253E+02 +5.124647E+01 +1.318756E+02 +3.304529E+01 +5.486643E+01 +2.347504E+01 +2.771353E+01 +5.711252E+01 +1.640619E+02 +4.060288E+01 +8.298231E+01 +2.384078E+01 +2.855909E+01 +1.684046E+01 +1.426180E+01 +3.329487E+01 +5.573544E+01 +2.349871E+01 +2.776487E+01 +8.676886E+00 +3.814132E+00 +5.980976E+00 +1.815143E+00 tally 3: -5.925339E+00 -1.788596E+00 -3.912632E-01 -8.061838E-03 -2.215544E+01 -2.471404E+01 -1.465191E+00 -1.092622E-01 -1.542988E+01 -1.195626E+01 -1.022876E+00 -5.356825E-02 -3.792029E+01 -7.218149E+01 -2.370476E+00 -2.839465E-01 -2.200154E+01 -2.432126E+01 -1.360836E+00 -9.402424E-02 -4.824980E+01 -1.168447E+02 -3.124366E+00 -4.907460E-01 -2.557420E+01 -3.282066E+01 -1.725855E+00 -1.519830E-01 -2.577963E+01 -3.341077E+01 -1.654042E+00 -1.386845E-01 -5.008220E+01 -1.257610E+02 -3.223857E+00 -5.237360E-01 -2.273380E+01 -2.595325E+01 -1.438369E+00 -1.050840E-01 -3.938822E+01 -7.789691E+01 -2.648324E+00 -3.559703E-01 -1.623604E+01 -1.327214E+01 -1.058882E+00 -5.680630E-02 -2.325730E+01 -2.717892E+01 -1.584276E+00 -1.275868E-01 -5.937929E+00 -1.774847E+00 -3.866918E-01 -7.994353E-03 +5.847135E+00 +1.719612E+00 +3.960040E-01 +8.297721E-03 +2.245534E+01 +2.530222E+01 +1.468678E+00 +1.094031E-01 +1.571194E+01 +1.240597E+01 +1.004169E+00 +5.156464E-02 +3.901605E+01 +7.652715E+01 +2.648696E+00 +3.571840E-01 +2.275978E+01 +2.597555E+01 +1.456067E+00 +1.075035E-01 +4.821184E+01 +1.167725E+02 +3.105774E+00 +4.859873E-01 +2.519281E+01 +3.183845E+01 +1.595498E+00 +1.292133E-01 +2.560583E+01 +3.297409E+01 +1.673871E+00 +1.429651E-01 +4.930025E+01 +1.220909E+02 +3.206604E+00 +5.220919E-01 +2.255825E+01 +2.560134E+01 +1.422870E+00 +1.027151E-01 +3.910818E+01 +7.698933E+01 +2.568903E+00 +3.333385E-01 +1.620292E+01 +1.321173E+01 +1.068678E+00 +5.798793E-02 +2.264343E+01 +2.578648E+01 +1.503553E+00 +1.158411E-01 +5.751110E+00 +1.676910E+00 +3.450582E-01 +6.411784E-03 tally 4: -3.063235E+00 -4.714106E-01 +3.051764E+00 +4.671879E-01 0.000000E+00 0.000000E+00 -1.425705E+00 -1.043616E-01 -4.355515E+00 -9.538346E-01 +1.407008E+00 +1.004485E-01 +4.354708E+00 +9.506434E-01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -160,14 +160,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -4.355515E+00 -9.538346E-01 -1.425705E+00 -1.043616E-01 -3.859174E+00 -7.519499E-01 -6.350310E+00 -2.024214E+00 +4.354708E+00 +9.506434E-01 +1.407008E+00 +1.004485E-01 +3.852730E+00 +7.498016E-01 +6.382605E+00 +2.043123E+00 0.000000E+00 0.000000E+00 0.000000E+00 @@ -184,14 +184,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -6.350310E+00 -2.024214E+00 -3.859174E+00 -7.519499E-01 -4.993073E+00 -1.258264E+00 -7.194275E+00 -2.596886E+00 +6.382605E+00 +2.043123E+00 +3.852730E+00 +7.498016E-01 +5.061607E+00 +1.288306E+00 +7.281209E+00 +2.659444E+00 0.000000E+00 0.000000E+00 0.000000E+00 @@ -208,14 +208,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -7.194275E+00 -2.596886E+00 -4.993073E+00 -1.258264E+00 -6.786617E+00 -2.312259E+00 -8.306978E+00 -3.459668E+00 +7.281209E+00 +2.659444E+00 +5.061607E+00 +1.288306E+00 +7.096602E+00 +2.527474E+00 +8.632232E+00 +3.736665E+00 0.000000E+00 0.000000E+00 0.000000E+00 @@ -232,14 +232,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -8.306978E+00 -3.459668E+00 -6.786617E+00 -2.312259E+00 -7.603410E+00 -2.905228E+00 -8.791222E+00 -3.882935E+00 +8.632232E+00 +3.736665E+00 +7.096602E+00 +2.527474E+00 +7.759456E+00 +3.019026E+00 +8.968687E+00 +4.037738E+00 0.000000E+00 0.000000E+00 0.000000E+00 @@ -256,14 +256,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -8.791222E+00 -3.882935E+00 -7.603410E+00 -2.905228E+00 -8.867113E+00 -3.938503E+00 -9.302808E+00 -4.340042E+00 +8.968687E+00 +4.037738E+00 +7.759456E+00 +3.019026E+00 +8.749025E+00 +3.839161E+00 +9.126289E+00 +4.176440E+00 0.000000E+00 0.000000E+00 0.000000E+00 @@ -280,14 +280,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -9.302808E+00 -4.340042E+00 -8.867113E+00 -3.938503E+00 -9.270113E+00 -4.306513E+00 -9.263471E+00 -4.302184E+00 +9.126289E+00 +4.176440E+00 +8.749025E+00 +3.839161E+00 +9.259277E+00 +4.304020E+00 +9.165726E+00 +4.216173E+00 0.000000E+00 0.000000E+00 0.000000E+00 @@ -304,14 +304,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -9.263471E+00 -4.302184E+00 -9.270113E+00 -4.306513E+00 -9.348712E+00 -4.388570E+00 -8.977713E+00 -4.047349E+00 +9.165726E+00 +4.216173E+00 +9.259277E+00 +4.304020E+00 +9.433925E+00 +4.473551E+00 +8.910566E+00 +3.991458E+00 0.000000E+00 0.000000E+00 0.000000E+00 @@ -328,14 +328,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -8.977713E+00 -4.047349E+00 -9.348712E+00 -4.388570E+00 -9.234380E+00 -4.280666E+00 -8.036978E+00 -3.239853E+00 +8.910566E+00 +3.991458E+00 +9.433925E+00 +4.473551E+00 +9.099397E+00 +4.154062E+00 +7.770126E+00 +3.029928E+00 0.000000E+00 0.000000E+00 0.000000E+00 @@ -352,14 +352,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -8.036978E+00 -3.239853E+00 -9.234380E+00 -4.280666E+00 -8.713633E+00 -3.808850E+00 -7.160878E+00 -2.572915E+00 +7.770126E+00 +3.029928E+00 +9.099397E+00 +4.154062E+00 +8.575842E+00 +3.694998E+00 +6.934243E+00 +2.418570E+00 0.000000E+00 0.000000E+00 0.000000E+00 @@ -376,14 +376,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -7.160878E+00 -2.572915E+00 -8.713633E+00 -3.808850E+00 -7.378538E+00 -2.732122E+00 -5.145728E+00 -1.329190E+00 +6.934243E+00 +2.418570E+00 +8.575842E+00 +3.694998E+00 +7.437526E+00 +2.780629E+00 +5.136923E+00 +1.331553E+00 0.000000E+00 0.000000E+00 0.000000E+00 @@ -400,14 +400,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -5.145728E+00 -1.329190E+00 -7.378538E+00 -2.732122E+00 -6.660125E+00 -2.228506E+00 -4.087925E+00 -8.435381E-01 +5.136923E+00 +1.331553E+00 +7.437526E+00 +2.780629E+00 +6.648582E+00 +2.216687E+00 +4.050691E+00 +8.279789E-01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -424,14 +424,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -4.087925E+00 -8.435381E-01 -6.660125E+00 -2.228506E+00 -4.466295E+00 -1.002320E+00 -1.468481E+00 -1.099604E-01 +4.050691E+00 +8.279789E-01 +6.648582E+00 +2.216687E+00 +4.390906E+00 +9.686686E-01 +1.391624E+00 +9.861955E-02 0.000000E+00 0.000000E+00 0.000000E+00 @@ -448,12 +448,12 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -1.468481E+00 -1.099604E-01 -4.466295E+00 -1.002320E+00 -3.139355E+00 -4.955456E-01 +1.391624E+00 +9.861955E-02 +4.390906E+00 +9.686686E-01 +3.113477E+00 +4.874296E-01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -473,164 +473,164 @@ tally 4: 0.000000E+00 0.000000E+00 tally 5: -5.925339E+00 -1.788596E+00 -8.954773E-01 -4.217679E-02 -2.215054E+01 -2.470273E+01 -2.944747E+00 -4.443186E-01 -1.542658E+01 -1.195085E+01 -1.950262E+00 -1.946340E-01 -3.791137E+01 -7.214779E+01 -4.955741E+00 -1.254830E+00 -2.200054E+01 -2.431894E+01 -3.031040E+00 -4.685971E-01 -4.823946E+01 -1.167941E+02 -6.226321E+00 -1.956308E+00 -2.556930E+01 -3.280828E+01 -3.582546E+00 -6.505962E-01 -2.577249E+01 -3.339204E+01 -3.316825E+00 -5.676842E-01 -5.007249E+01 -1.257124E+02 -6.462364E+00 -2.120157E+00 -2.273285E+01 -2.595106E+01 -2.960964E+00 -4.496277E-01 -3.937362E+01 -7.783849E+01 -5.339336E+00 -1.449257E+00 -1.623315E+01 -1.326746E+01 -2.289661E+00 -2.698618E-01 -2.325250E+01 -2.716827E+01 -3.253010E+00 -5.413837E-01 -5.937929E+00 -1.774847E+00 -9.208589E-01 -4.421403E-02 +5.846103E+00 +1.718959E+00 +8.952028E-01 +4.184063E-02 +2.245226E+01 +2.529524E+01 +3.092645E+00 +4.848878E-01 +1.571095E+01 +1.240426E+01 +2.178244E+00 +2.438479E-01 +3.900638E+01 +7.648853E+01 +5.265574E+00 +1.401505E+00 +2.275895E+01 +2.597348E+01 +3.067909E+00 +4.810969E-01 +4.820213E+01 +1.167232E+02 +6.403602E+00 +2.070034E+00 +2.519091E+01 +3.183360E+01 +3.463531E+00 +6.097568E-01 +2.560388E+01 +3.296889E+01 +3.456252E+00 +6.101655E-01 +4.929539E+01 +1.220666E+02 +6.629094E+00 +2.223366E+00 +2.255498E+01 +2.559363E+01 +2.833426E+00 +4.150907E-01 +3.909813E+01 +7.694976E+01 +5.582222E+00 +1.584757E+00 +1.620082E+01 +1.320814E+01 +2.282196E+00 +2.703156E-01 +2.263498E+01 +2.576758E+01 +3.162736E+00 +5.145038E-01 +5.750110E+00 +1.676357E+00 +9.181679E-01 +4.562885E-02 cmfd indices 1.400000E+01 1.000000E+00 1.000000E+00 1.000000E+00 k cmfd -1.125528E+00 -1.145509E+00 -1.158948E+00 -1.171983E+00 -1.180649E+00 -1.184072E+00 -1.188112E+00 -1.183095E+00 -1.182269E+00 -1.175467E+00 -1.175184E+00 -1.172637E+00 -1.171593E+00 -1.175439E+00 -1.174650E+00 -1.176474E+00 +1.166740E+00 +1.184008E+00 +1.166534E+00 +1.155559E+00 +1.164960E+00 +1.163229E+00 +1.165897E+00 +1.170104E+00 +1.170207E+00 +1.168091E+00 +1.170940E+00 +1.174589E+00 +1.174609E+00 +1.171505E+00 +1.174456E+00 +1.178370E+00 cmfd entropy -3.607059E+00 -3.604890E+00 -3.601329E+00 -3.597776E+00 -3.597360E+00 -3.597387E+00 -3.595379E+00 -3.596995E+00 -3.600901E+00 -3.601832E+00 -3.601426E+00 -3.604521E+00 -3.602848E+00 -3.603875E+00 -3.605213E+00 -3.606699E+00 +3.594757E+00 +3.587018E+00 +3.590385E+00 +3.595101E+00 +3.592151E+00 +3.600294E+00 +3.602102E+00 +3.604941E+00 +3.605897E+00 +3.604880E+00 +3.601658E+00 +3.602551E+00 +3.600160E+00 +3.604540E+00 +3.604094E+00 +3.602509E+00 cmfd balance -4.46212E-03 -4.66648E-03 -5.04274E-03 -5.21553E-03 -3.92498E-03 -2.97185E-03 -2.79785E-03 -2.66951E-03 -2.17472E-03 -1.98009E-03 -1.77035E-03 -1.51281E-03 -1.52807E-03 -1.33341E-03 -1.18155E-03 -1.07752E-03 +5.52960E-03 +5.42154E-03 +3.62152E-03 +2.92850E-03 +4.08642E-03 +2.07444E-03 +2.03704E-03 +2.06886E-03 +2.09646E-03 +1.94256E-03 +2.02728E-03 +1.89830E-03 +1.83910E-03 +1.48140E-03 +1.47034E-03 +1.64452E-03 cmfd dominance ratio -6.136E-01 -6.127E-01 -6.137E-01 -6.102E-01 -6.067E-01 -6.061E-01 -6.031E-01 6.046E-01 -6.071E-01 -6.089E-01 -6.073E-01 -6.080E-01 -6.080E-01 +6.015E-01 +6.059E-01 +6.060E-01 +6.061E-01 +6.109E-01 +6.110E-01 +6.108E-01 +6.120E-01 +6.124E-01 +6.109E-01 6.090E-01 -6.092E-01 -6.094E-01 +6.116E-01 +6.137E-01 +6.117E-01 +6.131E-01 cmfd openmc source comparison -1.043027E-02 -1.278226E-02 -1.184867E-02 -1.017186E-02 -1.099696E-02 -7.955341E-03 -8.360344E-03 -6.875508E-03 -4.824018E-03 -4.915363E-03 -5.371647E-03 -4.593100E-03 -4.894955E-03 -4.928253E-03 -4.292171E-03 -4.018545E-03 +1.035187E-02 +9.394886E-03 +6.879487E-03 +7.236029E-03 +6.543528E-03 +3.600620E-03 +2.859638E-03 +2.230047E-03 +2.180643E-03 +1.638534E-03 +1.764349E-03 +1.621487E-03 +1.221762E-03 +1.626297E-03 +1.951813E-03 +9.584126E-04 cmfd source -1.600876E-02 -6.000305E-02 -4.248071E-02 -9.935789E-02 -5.768092E-02 -1.338593E-01 -7.417398E-02 -7.102984E-02 -1.382563E-01 -6.181889E-02 -1.142473E-01 -4.571447E-02 -6.864655E-02 -1.672206E-02 +1.677059E-02 +6.229453E-02 +4.278394E-02 +1.134852E-01 +6.231020E-02 +1.327286E-01 +6.808362E-02 +7.130954E-02 +1.362127E-01 +6.048013E-02 +1.094460E-01 +4.546687E-02 +6.403310E-02 +1.459510E-02 diff --git a/tests/regression_tests/cmfd_feed_ref_d/results_true.dat b/tests/regression_tests/cmfd_feed_ref_d/results_true.dat index 9cc26b8cf..34cde1a46 100644 --- a/tests/regression_tests/cmfd_feed_ref_d/results_true.dat +++ b/tests/regression_tests/cmfd_feed_ref_d/results_true.dat @@ -1,117 +1,117 @@ k-combined: -1.167869E+00 7.492916E-03 +1.162249E+00 5.812620E-03 tally 1: -1.146821E+01 -1.318787E+01 -2.161476E+01 -4.685066E+01 -2.951084E+01 -8.733116E+01 -3.521523E+01 -1.242762E+02 -3.774181E+01 -1.426460E+02 -3.727924E+01 -1.391162E+02 -3.377236E+01 -1.143877E+02 -2.904590E+01 -8.453427E+01 -2.090941E+01 -4.384824E+01 -1.078680E+01 -1.168172E+01 +1.153831E+01 +1.338142E+01 +2.155552E+01 +4.659071E+01 +2.813997E+01 +7.941672E+01 +3.270996E+01 +1.073664E+02 +3.639852E+01 +1.329148E+02 +3.729637E+01 +1.393474E+02 +3.443129E+01 +1.186461E+02 +2.832690E+01 +8.040998E+01 +2.177527E+01 +4.771147E+01 +1.146822E+01 +1.328252E+01 tally 2: -1.136805E+00 -1.292326E+00 -7.987282E-01 -6.379667E-01 -2.266961E+00 -5.139112E+00 -1.613498E+00 -2.603376E+00 -3.046379E+00 -9.280427E+00 -2.182480E+00 -4.763219E+00 -3.568101E+00 -1.273134E+01 -2.532478E+00 -6.413444E+00 -3.989532E+00 -1.591637E+01 -2.848319E+00 -8.112921E+00 -3.853139E+00 -1.484668E+01 -2.718497E+00 -7.390223E+00 -3.478134E+00 -1.209742E+01 -2.467279E+00 -6.087465E+00 -2.952214E+00 -8.715569E+00 -2.103257E+00 -4.423688E+00 -1.917446E+00 -3.676599E+00 -1.378361E+00 -1.899878E+00 -1.048230E+00 -1.098785E+00 -7.511876E-01 -5.642828E-01 +1.024353E+00 +1.049299E+00 +6.991057E-01 +4.887487E-01 +2.200432E+00 +4.841901E+00 +1.561655E+00 +2.438768E+00 +2.910400E+00 +8.470426E+00 +2.095155E+00 +4.389674E+00 +3.466006E+00 +1.201320E+01 +2.480456E+00 +6.152662E+00 +3.711781E+00 +1.377732E+01 +2.646019E+00 +7.001418E+00 +3.953648E+00 +1.563133E+01 +2.832759E+00 +8.024524E+00 +3.597870E+00 +1.294467E+01 +2.555396E+00 +6.530048E+00 +2.860871E+00 +8.184585E+00 +2.032282E+00 +4.130169E+00 +2.006740E+00 +4.027007E+00 +1.408150E+00 +1.982886E+00 +1.035163E+00 +1.071562E+00 +7.084068E-01 +5.018402E-01 tally 3: -7.701212E-01 -5.930866E-01 -4.481580E-02 -2.008456E-03 -1.547321E+00 -2.394203E+00 -1.226538E-01 -1.504395E-02 -2.106393E+00 -4.436893E+00 -1.450617E-01 -2.104289E-02 -2.437675E+00 -5.942260E+00 -1.521379E-01 -2.314593E-02 -2.754657E+00 -7.588135E+00 -1.745458E-01 -3.046622E-02 -2.623856E+00 -6.884619E+00 -1.851600E-01 -3.428423E-02 -2.376884E+00 -5.649579E+00 -1.615728E-01 -2.610576E-02 -2.021851E+00 -4.087882E+00 -1.533172E-01 -2.350617E-02 -1.333182E+00 -1.777374E+00 -7.076179E-02 -5.007231E-03 -7.258458E-01 -5.268521E-01 -3.656026E-02 -1.336653E-03 +6.713566E-01 +4.507196E-01 +5.581718E-02 +3.115557E-03 +1.508976E+00 +2.277009E+00 +1.139601E-01 +1.298690E-02 +2.035529E+00 +4.143377E+00 +1.221001E-01 +1.490843E-02 +2.385217E+00 +5.689262E+00 +1.500087E-01 +2.250260E-02 +2.546286E+00 +6.483574E+00 +1.546601E-01 +2.391975E-02 +2.726427E+00 +7.433407E+00 +1.686144E-01 +2.843081E-02 +2.466613E+00 +6.084179E+00 +1.558230E-01 +2.428079E-02 +1.951251E+00 +3.807379E+00 +1.197744E-01 +1.434590E-02 +1.347903E+00 +1.816842E+00 +9.419149E-02 +8.872037E-03 +6.840490E-01 +4.679231E-01 +5.000289E-02 +2.500289E-03 tally 4: -1.667426E-01 -2.780308E-02 +1.561665E-01 +2.438798E-02 0.000000E+00 0.000000E+00 -1.292556E-01 -1.670700E-02 -2.813401E-01 -7.915227E-02 +1.307011E-01 +1.708276E-02 +2.703168E-01 +7.307115E-02 0.000000E+00 0.000000E+00 0.000000E+00 @@ -128,14 +128,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -2.813401E-01 -7.915227E-02 -1.292556E-01 -1.670700E-02 -2.670582E-01 -7.132006E-02 -4.055365E-01 -1.644599E-01 +2.703168E-01 +7.307115E-02 +1.307011E-01 +1.708276E-02 +2.637619E-01 +6.957033E-02 +3.685390E-01 +1.358210E-01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -152,14 +152,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -4.055365E-01 -1.644599E-01 -2.670582E-01 -7.132006E-02 -3.848164E-01 -1.480837E-01 -4.809472E-01 -2.313102E-01 +3.685390E-01 +1.358210E-01 +2.637619E-01 +6.957033E-02 +3.887017E-01 +1.510890E-01 +4.439407E-01 +1.970834E-01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -176,14 +176,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -4.809472E-01 -2.313102E-01 -3.848164E-01 -1.480837E-01 -4.543959E-01 -2.064756E-01 -5.106174E-01 -2.607301E-01 +4.439407E-01 +1.970834E-01 +3.887017E-01 +1.510890E-01 +4.456116E-01 +1.985697E-01 +4.737035E-01 +2.243950E-01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -200,14 +200,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -5.106174E-01 -2.607301E-01 -4.543959E-01 -2.064756E-01 -4.543155E-01 -2.064026E-01 -4.626331E-01 -2.140294E-01 +4.737035E-01 +2.243950E-01 +4.456116E-01 +1.985697E-01 +4.760577E-01 +2.266309E-01 +4.703245E-01 +2.212052E-01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -224,14 +224,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -4.626331E-01 -2.140294E-01 -4.543155E-01 -2.064026E-01 -4.827763E-01 -2.330729E-01 -4.442611E-01 -1.973679E-01 +4.703245E-01 +2.212052E-01 +4.760577E-01 +2.266309E-01 +4.878056E-01 +2.379543E-01 +4.373120E-01 +1.912418E-01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -248,14 +248,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -4.442611E-01 -1.973679E-01 -4.827763E-01 -2.330729E-01 -4.630415E-01 -2.144074E-01 -3.886521E-01 -1.510505E-01 +4.373120E-01 +1.912418E-01 +4.878056E-01 +2.379543E-01 +4.262194E-01 +1.816630E-01 +3.334152E-01 +1.111657E-01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -272,14 +272,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -3.886521E-01 -1.510505E-01 -4.630415E-01 -2.144074E-01 -3.535862E-01 -1.250232E-01 -2.530293E-01 -6.402384E-02 +3.334152E-01 +1.111657E-01 +4.262194E-01 +1.816630E-01 +3.560156E-01 +1.267471E-01 +2.409954E-01 +5.807879E-02 0.000000E+00 0.000000E+00 0.000000E+00 @@ -296,14 +296,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -2.530293E-01 -6.402384E-02 -3.535862E-01 -1.250232E-01 -2.465508E-01 -6.078730E-02 -1.197139E-01 -1.433141E-02 +2.409954E-01 +5.807879E-02 +3.560156E-01 +1.267471E-01 +2.646501E-01 +7.003965E-02 +1.327244E-01 +1.761576E-02 0.000000E+00 0.000000E+00 0.000000E+00 @@ -320,12 +320,12 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -1.197139E-01 -1.433141E-02 -2.465508E-01 -6.078730E-02 -1.369614E-01 -1.875841E-02 +1.327244E-01 +1.761576E-02 +2.646501E-01 +7.003965E-02 +1.480567E-01 +2.192079E-02 0.000000E+00 0.000000E+00 0.000000E+00 @@ -345,119 +345,119 @@ tally 4: 0.000000E+00 0.000000E+00 tally 5: -7.701212E-01 -5.930866E-01 -1.386254E-01 -1.921700E-02 -1.547321E+00 -2.394203E+00 -2.630318E-01 -6.918571E-02 -2.106393E+00 -4.436893E+00 -2.807911E-01 -7.884363E-02 -2.435870E+00 -5.933464E+00 -3.322093E-01 -1.103630E-01 -2.753652E+00 -7.582597E+00 -3.825961E-01 -1.463797E-01 -2.623856E+00 -6.884619E+00 -3.888719E-01 -1.512213E-01 -2.376884E+00 -5.649579E+00 -3.196211E-01 -1.021576E-01 -2.021851E+00 -4.087882E+00 -2.897873E-01 -8.397667E-02 -1.333182E+00 -1.777374E+00 -1.627096E-01 -2.647441E-02 -7.258458E-01 -5.268521E-01 -9.348575E-02 -8.739586E-03 +6.713566E-01 +4.507196E-01 +9.805793E-02 +9.615358E-03 +1.508976E+00 +2.277009E+00 +1.968348E-01 +3.874394E-02 +2.032573E+00 +4.131353E+00 +2.120922E-01 +4.498309E-02 +2.385217E+00 +5.689262E+00 +2.863031E-01 +8.196946E-02 +2.545200E+00 +6.478041E+00 +3.278920E-01 +1.075131E-01 +2.726427E+00 +7.433407E+00 +3.770758E-01 +1.421861E-01 +2.466613E+00 +6.084179E+00 +3.593230E-01 +1.291130E-01 +1.951251E+00 +3.807379E+00 +2.474112E-01 +6.121229E-02 +1.347903E+00 +1.816842E+00 +2.127109E-01 +4.524594E-02 +6.823620E-01 +4.656179E-01 +1.249863E-01 +1.562159E-02 cmfd indices 1.000000E+01 1.000000E+00 1.000000E+00 1.000000E+00 k cmfd -1.149087E+00 -1.156777E+00 -1.158641E+00 -1.159507E+00 -1.156564E+00 -1.160257E+00 -1.150344E+00 -1.149854E+00 -1.151616E+00 -1.164575E+00 -1.174683E+00 +1.181365E+00 +1.176693E+00 +1.161946E+00 +1.163565E+00 +1.163043E+00 +1.169908E+00 +1.149155E+00 +1.142379E+00 +1.152957E+00 +1.137602E+00 +1.141883E+00 cmfd entropy -3.216202E+00 -3.228703E+00 -3.220414E+00 -3.214361E+00 -3.215642E+00 -3.213607E+00 -3.212862E+00 -3.213128E+00 -3.213189E+00 -3.205465E+00 -3.202859E+00 +3.246422E+00 +3.246496E+00 +3.252238E+00 +3.240920E+00 +3.237606E+00 +3.234301E+00 +3.234103E+00 +3.229918E+00 +3.226983E+00 +3.221321E+00 +3.223622E+00 cmfd balance -3.08825E-03 -1.42554E-03 -1.21448E-03 -1.17859E-03 -1.06034E-03 -9.30949E-04 -1.35713E-03 -1.13694E-03 -1.14938E-03 -1.29296E-03 -1.46518E-03 +4.18486E-03 +1.72126E-03 +1.10906E-03 +1.88158E-03 +1.31626E-03 +1.30818E-03 +1.77315E-03 +2.16148E-03 +1.67789E-03 +2.31333E-03 +1.94932E-03 cmfd dominance ratio -5.503E-01 -5.596E-01 5.505E-01 -5.471E-01 -5.468E-01 -5.427E-01 -5.421E-01 -5.412E-01 -5.389E-01 -5.371E-01 -5.329E-01 +5.580E-01 +5.610E-01 +5.526E-01 +5.519E-01 +5.499E-01 +5.504E-01 +5.504E-01 +5.475E-01 +5.465E-01 +5.477E-01 cmfd openmc source comparison -1.571006E-02 -6.945629E-03 -6.838511E-03 -6.183655E-03 -5.138825E-03 -4.362701E-03 -5.558586E-03 -4.188314E-03 -1.837101E-03 -2.737321E-03 -2.529244E-03 +1.902234E-03 +4.110960E-03 +2.452031E-03 +2.337951E-03 +1.838979E-03 +3.138637E-03 +2.684401E-03 +2.912891E-03 +2.823494E-03 +6.391584E-03 +5.904139E-03 cmfd source -4.240947E-02 -8.226746E-02 -1.180848E-01 -1.328470E-01 -1.412449E-01 -1.424870E-01 -1.269297E-01 -1.096476E-01 -6.953001E-02 -3.455212E-02 +4.488002E-02 +8.895136E-02 +1.085930E-01 +1.229651E-01 +1.330479E-01 +1.497140E-01 +1.309102E-01 +1.028556E-01 +7.738878E-02 +4.069397E-02 diff --git a/tests/regression_tests/cmfd_feed_rolling_window/results_true.dat b/tests/regression_tests/cmfd_feed_rolling_window/results_true.dat index 5ff4a132f..2e31b35ba 100644 --- a/tests/regression_tests/cmfd_feed_rolling_window/results_true.dat +++ b/tests/regression_tests/cmfd_feed_rolling_window/results_true.dat @@ -1,117 +1,117 @@ k-combined: -1.173626E+00 1.098719E-02 +1.158333E+00 1.402684E-02 tally 1: -1.101892E+01 -1.218768E+01 -2.036233E+01 -4.152577E+01 -2.937587E+01 -8.637268E+01 -3.502389E+01 -1.231700E+02 -3.804803E+01 -1.453948E+02 -3.822561E+01 -1.465677E+02 -3.456290E+01 -1.198651E+02 -2.904088E+01 -8.470264E+01 -2.111529E+01 -4.463713E+01 -1.147633E+01 -1.326012E+01 +1.169478E+01 +1.373162E+01 +2.192038E+01 +4.844559E+01 +2.913292E+01 +8.542569E+01 +3.446069E+01 +1.201782E+02 +3.624088E+01 +1.320213E+02 +3.569791E+01 +1.278170E+02 +3.340601E+01 +1.119165E+02 +2.908648E+01 +8.514603E+01 +2.175458E+01 +4.767916E+01 +1.171268E+01 +1.378033E+01 tally 2: -1.010478E+00 -1.021066E+00 -6.902031E-01 -4.763804E-01 -1.899891E+00 -3.609584E+00 -1.322615E+00 -1.749312E+00 -2.756419E+00 -7.597845E+00 -1.955934E+00 -3.825676E+00 -3.818740E+00 -1.458278E+01 -2.704746E+00 -7.315652E+00 -3.920857E+00 -1.537312E+01 -2.843144E+00 -8.083470E+00 -3.835060E+00 -1.470768E+01 -2.728705E+00 -7.445831E+00 -3.510590E+00 -1.232424E+01 -2.497237E+00 -6.236191E+00 -2.717388E+00 -7.384198E+00 -1.903638E+00 -3.623837E+00 -2.207863E+00 -4.874659E+00 -1.563588E+00 -2.444808E+00 -1.289027E+00 -1.661591E+00 -9.022714E-01 -8.140937E-01 +1.132414E+00 +1.282361E+00 +7.822980E-01 +6.119901E-01 +2.124428E+00 +4.513196E+00 +1.490832E+00 +2.222581E+00 +3.158472E+00 +9.975946E+00 +2.221665E+00 +4.935795E+00 +3.994786E+00 +1.595831E+01 +2.828109E+00 +7.998199E+00 +3.491035E+00 +1.218732E+01 +2.461223E+00 +6.057617E+00 +3.461784E+00 +1.198395E+01 +2.473337E+00 +6.117398E+00 +3.027132E+00 +9.163527E+00 +2.150455E+00 +4.624458E+00 +2.471217E+00 +6.106911E+00 +1.737168E+00 +3.017752E+00 +1.880969E+00 +3.538044E+00 +1.316574E+00 +1.733367E+00 +1.233103E+00 +1.520543E+00 +8.543318E-01 +7.298828E-01 tally 3: -6.593197E-01 -4.347024E-01 -5.216387E-02 -2.721069E-03 -1.266446E+00 -1.603885E+00 -8.298797E-02 -6.887003E-03 -1.888709E+00 -3.567222E+00 -1.398940E-01 -1.957033E-02 -2.616078E+00 -6.843867E+00 -1.588627E-01 -2.523735E-02 -2.733300E+00 -7.470927E+00 -1.944290E-01 -3.780262E-02 -2.643656E+00 -6.988917E+00 -1.612338E-01 -2.599633E-02 -2.410643E+00 -5.811199E+00 -1.754603E-01 -3.078631E-02 -1.838012E+00 -3.378288E+00 -1.126265E-01 -1.268473E-02 -1.500033E+00 -2.250100E+00 -1.102554E-01 -1.215626E-02 -8.750096E-01 -7.656418E-01 -6.757592E-02 -4.566505E-03 +7.540113E-01 +5.685330E-01 +6.367610E-02 +4.054646E-03 +1.436984E+00 +2.064922E+00 +8.961822E-02 +8.031425E-03 +2.132240E+00 +4.546449E+00 +1.356065E-01 +1.838913E-02 +2.726356E+00 +7.433016E+00 +1.780572E-01 +3.170438E-02 +2.379700E+00 +5.662970E+00 +1.544735E-01 +2.386206E-02 +2.383471E+00 +5.680933E+00 +1.568319E-01 +2.459624E-02 +2.047271E+00 +4.191318E+00 +1.662654E-01 +2.764418E-02 +1.673107E+00 +2.799287E+00 +1.132020E-01 +1.281468E-02 +1.271576E+00 +1.616906E+00 +7.546797E-02 +5.695415E-03 +8.249906E-01 +6.806094E-01 +5.660098E-02 +3.203671E-03 tally 4: -1.490605E-01 -2.221904E-02 +1.551630E-01 +2.407556E-02 0.000000E+00 0.000000E+00 -1.139233E-01 -1.297851E-02 -2.549497E-01 -6.499934E-02 +1.487992E-01 +2.214121E-02 +2.878091E-01 +8.283409E-02 0.000000E+00 0.000000E+00 0.000000E+00 @@ -128,14 +128,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -2.549497E-01 -6.499934E-02 -1.139233E-01 -1.297851E-02 -2.191337E-01 -4.801958E-02 -3.295187E-01 -1.085826E-01 +2.878091E-01 +8.283409E-02 +1.487992E-01 +2.214121E-02 +2.936596E-01 +8.623595E-02 +3.954149E-01 +1.563529E-01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -152,14 +152,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -3.295187E-01 -1.085826E-01 -2.191337E-01 -4.801958E-02 -3.872400E-01 -1.499548E-01 -4.595835E-01 -2.112170E-01 +3.954149E-01 +1.563529E-01 +2.936596E-01 +8.623595E-02 +3.991153E-01 +1.592930E-01 +4.758410E-01 +2.264247E-01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -176,14 +176,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -4.595835E-01 -2.112170E-01 -3.872400E-01 -1.499548E-01 -4.668106E-01 -2.179121E-01 -5.112307E-01 -2.613569E-01 +4.758410E-01 +2.264247E-01 +3.991153E-01 +1.592930E-01 +4.850882E-01 +2.353106E-01 +5.210840E-01 +2.715285E-01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -200,14 +200,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -5.112307E-01 -2.613569E-01 -4.668106E-01 -2.179121E-01 -4.716605E-01 -2.224636E-01 -4.916148E-01 -2.416851E-01 +5.210840E-01 +2.715285E-01 +4.850882E-01 +2.353106E-01 +4.790245E-01 +2.294645E-01 +4.570092E-01 +2.088574E-01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -224,14 +224,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -4.916148E-01 -2.416851E-01 -4.716605E-01 -2.224636E-01 -4.696777E-01 -2.205972E-01 -4.365150E-01 -1.905453E-01 +4.570092E-01 +2.088574E-01 +4.790245E-01 +2.294645E-01 +4.505886E-01 +2.030301E-01 +3.884038E-01 +1.508575E-01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -248,14 +248,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -4.365150E-01 -1.905453E-01 -4.696777E-01 -2.205972E-01 -4.179902E-01 -1.747158E-01 -3.350564E-01 -1.122628E-01 +3.884038E-01 +1.508575E-01 +4.505886E-01 +2.030301E-01 +3.986999E-01 +1.589616E-01 +3.220889E-01 +1.037412E-01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -272,14 +272,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -3.350564E-01 -1.122628E-01 -4.179902E-01 -1.747158E-01 -3.743487E-01 -1.401370E-01 -2.400661E-01 -5.763172E-02 +3.220889E-01 +1.037412E-01 +3.986999E-01 +1.589616E-01 +3.319083E-01 +1.101631E-01 +2.101261E-01 +4.415297E-02 0.000000E+00 0.000000E+00 0.000000E+00 @@ -296,14 +296,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -2.400661E-01 -5.763172E-02 -3.743487E-01 -1.401370E-01 -3.063657E-01 -9.385994E-02 -1.605078E-01 -2.576275E-02 +2.101261E-01 +4.415297E-02 +3.319083E-01 +1.101631E-01 +2.795459E-01 +7.814588E-02 +1.306499E-01 +1.706938E-02 0.000000E+00 0.000000E+00 0.000000E+00 @@ -320,12 +320,12 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -1.605078E-01 -2.576275E-02 -3.063657E-01 -9.385994E-02 -1.700639E-01 -2.892174E-02 +1.306499E-01 +1.706938E-02 +2.795459E-01 +7.814588E-02 +1.585507E-01 +2.513833E-02 0.000000E+00 0.000000E+00 0.000000E+00 @@ -345,119 +345,119 @@ tally 4: 0.000000E+00 0.000000E+00 tally 5: -6.593197E-01 -4.347024E-01 -1.314196E-01 -1.727112E-02 -1.266446E+00 -1.603885E+00 -2.002491E-01 -4.009970E-02 -1.888709E+00 -3.567222E+00 -2.444522E-01 -5.975686E-02 -2.616078E+00 -6.843867E+00 -3.234935E-01 -1.046481E-01 -2.733300E+00 -7.470927E+00 -3.309500E-01 -1.095279E-01 -2.643656E+00 -6.988917E+00 -4.025014E-01 -1.620074E-01 -2.410643E+00 -5.811199E+00 -3.050040E-01 -9.302747E-02 -1.838012E+00 -3.378288E+00 -2.800764E-01 -7.844279E-02 -1.500033E+00 -2.250100E+00 -2.324765E-01 -5.404531E-02 -8.750096E-01 -7.656418E-01 -1.256919E-01 -1.579844E-02 +7.530237E-01 +5.670447E-01 +1.178984E-01 +1.390004E-02 +1.436984E+00 +2.064922E+00 +1.458395E-01 +2.126916E-02 +2.132240E+00 +4.546449E+00 +2.950109E-01 +8.703141E-02 +2.726356E+00 +7.433016E+00 +3.397288E-01 +1.154157E-01 +2.379700E+00 +5.662970E+00 +3.113206E-01 +9.692053E-02 +2.383471E+00 +5.680933E+00 +3.455611E-01 +1.194125E-01 +2.047271E+00 +4.191318E+00 +2.910986E-01 +8.473841E-02 +1.673107E+00 +2.799287E+00 +2.381996E-01 +5.673907E-02 +1.270672E+00 +1.614606E+00 +1.795241E-01 +3.222889E-02 +8.249906E-01 +6.806094E-01 +1.201397E-01 +1.443354E-02 cmfd indices 1.000000E+01 1.000000E+00 1.000000E+00 1.000000E+00 k cmfd -1.166297E+00 -1.148237E+00 -1.162472E+00 -1.187078E+00 -1.188411E+00 -1.194879E+00 -1.216739E+00 -1.216829E+00 -1.196596E+00 -1.199223E+00 -1.211817E+00 +1.184474E+00 +1.188170E+00 +1.165127E+00 +1.135010E+00 +1.145439E+00 +1.158451E+00 +1.154420E+00 +1.179615E+00 +1.197843E+00 +1.181252E+00 +1.186316E+00 cmfd entropy -3.215349E+00 -3.225577E+00 -3.223357E+00 -3.208828E+00 -3.211072E+00 -3.206578E+00 -3.195799E+00 -3.198236E+00 -3.220074E+00 -3.230249E+00 -3.238015E+00 +3.243654E+00 +3.244091E+00 +3.249203E+00 +3.249952E+00 +3.245538E+00 +3.240838E+00 +3.238919E+00 +3.223131E+00 +3.216002E+00 +3.220324E+00 +3.224804E+00 cmfd balance -2.07468E-03 -2.39687E-03 -1.51020E-03 -2.07618E-03 -1.89367E-03 -2.00902E-03 -2.54856E-03 -2.43636E-03 -2.48527E-03 -3.07775E-03 -3.37967E-03 +4.21104E-03 +1.38052E-03 +1.34642E-03 +2.39255E-03 +2.07426E-03 +1.27927E-03 +2.26249E-03 +2.72103E-03 +2.71504E-03 +2.19156E-03 +1.91989E-03 cmfd dominance ratio -5.505E-01 -5.558E-01 -5.584E-01 -5.477E-01 -5.477E-01 -5.426E-01 -5.335E-01 -5.305E-01 -5.427E-01 +5.520E-01 +5.535E-01 +5.628E-01 +5.696E-01 +5.723E-01 +5.651E-01 +5.648E-01 +5.555E-01 +5.448E-01 +5.488E-01 5.484E-01 -5.465E-01 cmfd openmc source comparison -5.598628E-03 -1.162952E-02 -1.083004E-02 -1.037470E-02 -5.649750E-03 -5.137914E-03 -3.868209E-03 -1.208756E-02 -5.398131E-03 -8.119598E-03 -4.573105E-03 +1.713810E-03 +2.429503E-03 +4.526209E-03 +7.978149E-03 +3.320012E-03 +3.880041E-03 +1.580215E-02 +1.663452E-02 +1.878103E-02 +7.436342E-03 +3.724478E-03 cmfd source -4.219187E-02 -8.692096E-02 -1.061389E-01 -1.199181E-01 -1.377328E-01 -1.326161E-01 -1.345872E-01 -1.112871E-01 -7.569533E-02 -5.291175E-02 +4.688167E-02 +9.066303E-02 +1.150679E-01 +1.430247E-01 +1.370466E-01 +1.267615E-01 +1.244218E-01 +1.048774E-01 +7.083441E-02 +4.042108E-02 diff --git a/tests/regression_tests/cmfd_nofeed/results_true.dat b/tests/regression_tests/cmfd_nofeed/results_true.dat index 756aa4570..ea1a0230b 100644 --- a/tests/regression_tests/cmfd_nofeed/results_true.dat +++ b/tests/regression_tests/cmfd_nofeed/results_true.dat @@ -1,117 +1,117 @@ k-combined: -1.172893E+00 8.095197E-03 +1.169143E+00 7.248013E-03 tally 1: -1.156995E+01 -1.347019E+01 -2.120053E+01 -4.531200E+01 -2.995993E+01 -8.997889E+01 -3.498938E+01 -1.226414E+02 -3.794510E+01 -1.442188E+02 -3.798115E+01 -1.446436E+02 -3.415954E+01 -1.171635E+02 -2.960329E+01 -8.785532E+01 -2.182231E+01 -4.782353E+01 -1.147379E+01 -1.321150E+01 +1.115130E+01 +1.249933E+01 +2.147608E+01 +4.643964E+01 +2.923697E+01 +8.598273E+01 +3.439175E+01 +1.189653E+02 +3.729169E+01 +1.395456E+02 +3.709975E+01 +1.380839E+02 +3.415420E+01 +1.168226E+02 +2.895696E+01 +8.419764E+01 +2.140382E+01 +4.646784E+01 +1.125483E+01 +1.275812E+01 tally 2: -2.345900E+01 -2.783672E+01 -1.627300E+01 -1.339749E+01 -4.127267E+01 -8.563716E+01 -2.934800E+01 -4.334439E+01 -5.742644E+01 -1.658158E+02 -4.092600E+01 -8.423842E+01 -6.740126E+01 -2.279288E+02 -4.796500E+01 -1.154602E+02 -7.340327E+01 -2.701349E+02 -5.235900E+01 -1.374186E+02 -7.387392E+01 -2.740829E+02 -5.277400E+01 -1.398425E+02 -6.733428E+01 -2.274414E+02 -4.800100E+01 -1.156206E+02 -5.794970E+01 -1.685421E+02 -4.124600E+01 -8.540686E+01 -4.257013E+01 -9.092401E+01 -3.014500E+01 -4.566369E+01 -2.300274E+01 -2.659051E+01 -1.613400E+01 -1.307448E+01 +2.275147E+01 +2.604974E+01 +1.587800E+01 +1.271197E+01 +4.191959E+01 +8.846441E+01 +2.966500E+01 +4.430669E+01 +5.699815E+01 +1.637359E+02 +4.037600E+01 +8.219353E+01 +6.656851E+01 +2.228703E+02 +4.718000E+01 +1.119941E+02 +7.334215E+01 +2.701014E+02 +5.223500E+01 +1.370726E+02 +7.394394E+01 +2.748295E+02 +5.273400E+01 +1.397334E+02 +6.931604E+01 +2.406234E+02 +4.949000E+01 +1.226886E+02 +5.799672E+01 +1.687992E+02 +4.142300E+01 +8.612116E+01 +4.320102E+01 +9.402138E+01 +3.068300E+01 +4.749148E+01 +2.295257E+01 +2.657057E+01 +1.606200E+01 +1.301453E+01 tally 3: -1.564900E+01 -1.239852E+01 -1.086873E+00 -6.047264E-02 -2.821700E+01 -4.006730E+01 -1.855830E+00 -1.755984E-01 -3.946300E+01 -7.833997E+01 -2.523142E+00 -3.210725E-01 -4.622500E+01 -1.072588E+02 -2.919735E+00 -4.340292E-01 -5.033400E+01 -1.270010E+02 -3.243022E+00 -5.318534E-01 -5.082400E+01 -1.297502E+02 -3.313898E+00 -5.546608E-01 -4.623700E+01 -1.072944E+02 -2.887766E+00 -4.203084E-01 -3.975000E+01 -7.934279E+01 -2.567158E+00 -3.333121E-01 -2.903500E+01 -4.237270E+01 -1.852070E+00 -1.733821E-01 -1.557800E+01 -1.219084E+01 -9.951884E-01 -5.121758E-02 +1.528200E+01 +1.177982E+01 +1.040687E+00 +5.586386E-02 +2.857900E+01 +4.113603E+01 +1.871515E+00 +1.774689E-01 +3.888800E+01 +7.626262E+01 +2.534433E+00 +3.274088E-01 +4.541400E+01 +1.037867E+02 +2.926509E+00 +4.319780E-01 +5.034500E+01 +1.273517E+02 +3.215813E+00 +5.215716E-01 +5.076100E+01 +1.295218E+02 +3.194424E+00 +5.165993E-01 +4.768100E+01 +1.138949E+02 +3.058255E+00 +4.732131E-01 +3.995800E+01 +8.015691E+01 +2.454286E+00 +3.044948E-01 +2.957000E+01 +4.412743E+01 +1.938963E+00 +1.908501E-01 +1.544000E+01 +1.202869E+01 +1.038073E+00 +5.487827E-02 tally 4: -3.111000E+00 -4.872850E-01 +3.086000E+00 +4.780160E-01 0.000000E+00 0.000000E+00 -2.794000E+00 -3.972060E-01 -5.520000E+00 -1.535670E+00 +2.739000E+00 +3.790990E-01 +5.478000E+00 +1.505928E+00 0.000000E+00 0.000000E+00 0.000000E+00 @@ -128,14 +128,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -5.520000E+00 -1.535670E+00 -2.794000E+00 -3.972060E-01 -5.071000E+00 -1.305697E+00 -7.303000E+00 -2.685365E+00 +5.478000E+00 +1.505928E+00 +2.739000E+00 +3.790990E-01 +5.094000E+00 +1.310476E+00 +7.282000E+00 +2.669810E+00 0.000000E+00 0.000000E+00 0.000000E+00 @@ -152,14 +152,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -7.303000E+00 -2.685365E+00 -5.071000E+00 -1.305697E+00 -7.015000E+00 -2.471981E+00 -8.545000E+00 -3.670539E+00 +7.282000E+00 +2.669810E+00 +5.094000E+00 +1.310476E+00 +6.987000E+00 +2.461137E+00 +8.487000E+00 +3.624153E+00 0.000000E+00 0.000000E+00 0.000000E+00 @@ -176,14 +176,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -8.545000E+00 -3.670539E+00 -7.015000E+00 -2.471981E+00 -8.431000E+00 -3.570057E+00 -9.224000E+00 -4.268004E+00 +8.487000E+00 +3.624153E+00 +6.987000E+00 +2.461137E+00 +8.250000E+00 +3.421824E+00 +9.022000E+00 +4.088536E+00 0.000000E+00 0.000000E+00 0.000000E+00 @@ -200,14 +200,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -9.224000E+00 -4.268004E+00 -8.431000E+00 -3.570057E+00 -9.217000E+00 -4.259749E+00 -9.305000E+00 -4.340149E+00 +9.022000E+00 +4.088536E+00 +8.250000E+00 +3.421824E+00 +9.300000E+00 +4.344142E+00 +9.262000E+00 +4.308946E+00 0.000000E+00 0.000000E+00 0.000000E+00 @@ -224,14 +224,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -9.305000E+00 -4.340149E+00 -9.217000E+00 -4.259749E+00 -9.374000E+00 -4.415290E+00 -8.611000E+00 -3.718227E+00 +9.262000E+00 +4.308946E+00 +9.300000E+00 +4.344142E+00 +9.267000E+00 +4.310941E+00 +8.487000E+00 +3.613257E+00 0.000000E+00 0.000000E+00 0.000000E+00 @@ -248,14 +248,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -8.611000E+00 -3.718227E+00 -9.374000E+00 -4.415290E+00 -8.515000E+00 -3.639945E+00 -7.056000E+00 -2.501658E+00 +8.487000E+00 +3.613257E+00 +9.267000E+00 +4.310941E+00 +8.682000E+00 +3.778194E+00 +7.123000E+00 +2.544345E+00 0.000000E+00 0.000000E+00 0.000000E+00 @@ -272,14 +272,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -7.056000E+00 -2.501658E+00 -8.515000E+00 -3.639945E+00 -7.385000E+00 -2.737677E+00 -5.194000E+00 -1.356022E+00 +7.123000E+00 +2.544345E+00 +8.682000E+00 +3.778194E+00 +7.421000E+00 +2.773897E+00 +5.198000E+00 +1.369216E+00 0.000000E+00 0.000000E+00 0.000000E+00 @@ -296,14 +296,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -5.194000E+00 -1.356022E+00 -7.385000E+00 -2.737677E+00 -5.436000E+00 -1.481654E+00 -2.756000E+00 -3.843860E-01 +5.198000E+00 +1.369216E+00 +7.421000E+00 +2.773897E+00 +5.567000E+00 +1.561013E+00 +2.763000E+00 +3.882750E-01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -320,12 +320,12 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -2.756000E+00 -3.843860E-01 -5.436000E+00 -1.481654E+00 -3.030000E+00 -4.643920E-01 +2.763000E+00 +3.882750E-01 +5.567000E+00 +1.561013E+00 +3.106000E+00 +4.853380E-01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -345,144 +345,144 @@ tally 4: 0.000000E+00 0.000000E+00 tally 5: -1.564300E+01 -1.238861E+01 -2.090227E+00 -2.262627E-01 -2.821400E+01 -4.005826E+01 -3.870834E+00 -7.614623E-01 -3.945400E+01 -7.830326E+01 -5.290557E+00 -1.422339E+00 -4.621500E+01 -1.072116E+02 -6.144745E+00 -1.903309E+00 -5.032900E+01 -1.269756E+02 -6.867524E+00 -2.373593E+00 -5.081000E+01 -1.296784E+02 -6.456283E+00 -2.130767E+00 -4.623000E+01 -1.072613E+02 -5.931623E+00 -1.776451E+00 -3.974500E+01 -7.932288E+01 -5.339603E+00 -1.456812E+00 -2.902800E+01 -4.235232E+01 -4.102240E+00 -8.519551E-01 -1.557800E+01 -1.219084E+01 -2.137954E+00 -2.347770E-01 +1.527700E+01 +1.177204E+01 +2.285003E+00 +2.661382E-01 +2.857200E+01 +4.111506E+01 +4.126099E+00 +8.737996E-01 +3.887800E+01 +7.622094E+01 +5.121343E+00 +1.333837E+00 +4.540600E+01 +1.037492E+02 +6.160114E+00 +1.913665E+00 +5.033400E+01 +1.272949E+02 +6.859861E+00 +2.384476E+00 +5.075800E+01 +1.295055E+02 +6.929393E+00 +2.443364E+00 +4.767500E+01 +1.138658E+02 +6.385463E+00 +2.080293E+00 +3.995300E+01 +8.013651E+01 +5.620641E+00 +1.603844E+00 +2.956200E+01 +4.410395E+01 +3.952701E+00 +7.877105E-01 +1.543500E+01 +1.202080E+01 +2.203583E+00 +2.512936E-01 cmfd indices 1.000000E+01 1.000000E+00 1.000000E+00 1.000000E+00 k cmfd -1.129918E+00 -1.148352E+00 -1.143137E+00 -1.145795E+00 -1.147285E+00 -1.148588E+00 -1.148151E+00 -1.162118E+00 -1.165380E+00 -1.162851E+00 -1.163379E+00 -1.166986E+00 -1.167838E+00 -1.171743E+00 -1.170398E+00 -1.169773E+00 +1.169107E+00 +1.173852E+00 +1.181921E+00 +1.187733E+00 +1.185766E+00 +1.177020E+00 +1.181200E+00 +1.180088E+00 +1.180676E+00 +1.174948E+00 +1.174167E+00 +1.174935E+00 +1.169912E+00 +1.169058E+00 +1.170366E+00 +1.169774E+00 cmfd entropy -3.224769E+00 -3.222795E+00 -3.221174E+00 -3.222164E+00 -3.221025E+00 -3.220967E+00 -3.223497E+00 -3.219213E+00 -3.221679E+00 -3.222084E+00 -3.222281E+00 -3.222540E+00 -3.224614E+00 -3.224193E+00 -3.224925E+00 -3.224367E+00 +3.207640E+00 +3.212075E+00 +3.215463E+00 +3.219545E+00 +3.225225E+00 +3.227103E+00 +3.229048E+00 +3.228263E+00 +3.229077E+00 +3.229932E+00 +3.229351E+00 +3.228195E+00 +3.228493E+00 +3.227823E+00 +3.225830E+00 +3.227270E+00 cmfd balance -3.90454E-03 -4.33180E-03 -3.77057E-03 -3.16391E-03 -3.11765E-03 -2.59886E-03 -2.81060E-03 -3.25473E-03 -2.68544E-03 -2.01716E-03 -1.89350E-03 -1.79159E-03 -1.51353E-03 -1.48514E-03 -1.50207E-03 -1.44045E-03 +4.88208E-03 +4.63702E-03 +3.41158E-03 +2.99755E-03 +2.78360E-03 +3.31542E-03 +2.64344E-03 +2.04609E-03 +1.84340E-03 +1.65450E-03 +1.70816E-03 +1.69952E-03 +1.51417E-03 +1.32738E-03 +1.41435E-03 +1.01462E-03 cmfd dominance ratio -5.539E-01 -5.522E-01 -5.491E-01 -5.511E-01 -5.506E-01 -5.523E-01 -5.523E-01 +5.467E-01 +5.468E-01 +5.448E-01 +5.457E-01 +5.457E-01 +5.485E-01 +5.500E-01 +5.497E-01 +5.495E-01 +5.499E-01 +5.502E-01 +5.485E-01 +5.492E-01 +5.483E-01 5.473E-01 -5.478E-01 -5.461E-01 -5.462E-01 -5.459E-01 -5.475E-01 -5.463E-01 5.466E-01 -5.469E-01 cmfd openmc source comparison -9.875240E-03 -1.119358E-02 -8.513903E-03 -7.728971E-03 -5.993771E-03 -5.837301E-03 -4.861789E-03 -5.624038E-03 -4.297229E-03 -4.029732E-03 -3.669197E-03 -3.598834E-03 -3.023310E-03 -3.347346E-03 -2.943658E-03 -2.764986E-03 +9.587418E-03 +7.785087E-03 +6.798967E-03 +5.947641E-03 +4.980801E-03 +4.272665E-03 +4.073759E-03 +4.305612E-03 +3.572759E-03 +3.785830E-03 +3.766828E-03 +3.495462E-03 +3.017281E-03 +2.857633E-03 +2.858606E-03 +2.449010E-03 cmfd source -4.561921E-02 -7.896381E-02 -1.084687E-01 -1.264057E-01 -1.408942E-01 -1.438180E-01 -1.247333E-01 -1.100896E-01 -7.897187E-02 -4.203556E-02 +4.390084E-02 +7.966902E-02 +1.087889E-01 +1.263915E-01 +1.394331E-01 +1.383156E-01 +1.319970E-01 +1.051339E-01 +8.248244E-02 +4.388774E-02 diff --git a/tests/regression_tests/cmfd_restart/results_true.dat b/tests/regression_tests/cmfd_restart/results_true.dat index f5f22d9ac..1ef9624d4 100644 --- a/tests/regression_tests/cmfd_restart/results_true.dat +++ b/tests/regression_tests/cmfd_restart/results_true.dat @@ -1,117 +1,117 @@ k-combined: -1.164262E+00 9.207592E-03 +1.181723E+00 9.944883E-03 tally 1: -1.156972E+01 -1.339924E+01 -2.136306E+01 -4.567185E+01 -2.859527E+01 -8.195821E+01 -3.470754E+01 -1.207851E+02 -3.766403E+01 -1.422263E+02 -3.778821E+01 -1.432660E+02 -3.573197E+01 -1.278854E+02 -2.849979E+01 -8.135515E+01 -2.073803E+01 -4.303374E+01 -1.112117E+01 -1.242944E+01 +1.169899E+01 +1.373251E+01 +2.142380E+01 +4.605511E+01 +2.968085E+01 +8.838716E+01 +3.561418E+01 +1.271206E+02 +3.777783E+01 +1.428817E+02 +3.805832E+01 +1.450213E+02 +3.439836E+01 +1.184892E+02 +2.852438E+01 +8.161896E+01 +2.088423E+01 +4.376204E+01 +1.076670E+01 +1.168108E+01 tally 2: -2.388054E+01 -2.875255E+01 -1.667791E+01 -1.403426E+01 -4.224771E+01 -8.942109E+01 -2.993088E+01 -4.490335E+01 -5.689839E+01 -1.625557E+02 -4.043633E+01 -8.212299E+01 -6.764024E+01 -2.297126E+02 -4.807902E+01 -1.161468E+02 -7.314835E+01 -2.684645E+02 -5.203584E+01 -1.359261E+02 -7.375727E+01 -2.733105E+02 -5.252944E+01 -1.386205E+02 -6.909571E+01 -2.397721E+02 -4.922548E+01 -1.217465E+02 -5.685978E+01 -1.621746E+02 -4.051938E+01 -8.237277E+01 -4.185562E+01 -8.784067E+01 -2.983570E+01 -4.467414E+01 -2.238373E+01 -2.520356E+01 -1.566758E+01 -1.234103E+01 +2.321241E+01 +2.702156E+01 +1.620912E+01 +1.317752E+01 +4.197404E+01 +8.845008E+01 +2.982666E+01 +4.469221E+01 +5.810089E+01 +1.695857E+02 +4.134123E+01 +8.588866E+01 +6.982488E+01 +2.447068E+02 +4.966939E+01 +1.238763E+02 +7.428421E+01 +2.767613E+02 +5.287955E+01 +1.403163E+02 +7.447402E+01 +2.785012E+02 +5.324628E+01 +1.423393E+02 +6.895164E+01 +2.381937E+02 +4.916366E+01 +1.211701E+02 +5.679253E+01 +1.617881E+02 +4.043125E+01 +8.204061E+01 +4.218618E+01 +8.933666E+01 +2.978592E+01 +4.456592E+01 +2.196426E+01 +2.435867E+01 +1.525576E+01 +1.175879E+01 tally 3: -1.609520E+01 -1.307542E+01 -1.033429E+00 -5.510889E-02 -2.877073E+01 -4.149542E+01 -1.964219E+00 -1.954692E-01 -3.896816E+01 -7.629752E+01 -2.484053E+00 -3.103733E-01 -4.634285E+01 -1.079367E+02 -2.974750E+00 -4.468223E-01 -5.007964E+01 -1.259202E+02 -3.181802E+00 -5.103621E-01 -5.058915E+01 -1.286193E+02 -3.249442E+00 -5.337712E-01 -4.744464E+01 -1.131026E+02 -3.067644E+00 -4.736335E-01 -3.900632E+01 -7.634433E+01 -2.443552E+00 -3.028060E-01 -2.874166E+01 -4.146375E+01 -1.810421E+00 -1.671667E-01 -1.509222E+01 -1.145579E+01 -1.014919E+00 -5.391053E-02 +1.563788E+01 +1.226528E+01 +1.053289E+00 +5.666942E-02 +2.870755E+01 +4.139654E+01 +1.838017E+00 +1.710528E-01 +3.978616E+01 +7.955764E+01 +2.560657E+00 +3.334449E-01 +4.780385E+01 +1.147770E+02 +3.139243E+00 +4.967628E-01 +5.106650E+01 +1.308704E+02 +3.170056E+00 +5.078920E-01 +5.123992E+01 +1.318586E+02 +3.211706E+00 +5.205979E-01 +4.729862E+01 +1.121695E+02 +3.068662E+00 +4.749488E-01 +3.898816E+01 +7.630564E+01 +2.516911E+00 +3.199696E-01 +2.865357E+01 +4.125742E+01 +1.852314E+00 +1.741116E-01 +1.467340E+01 +1.088460E+01 +9.268633E-01 +4.450662E-02 tally 4: -3.148231E+00 -4.974555E-01 +3.029754E+00 +4.613561E-01 0.000000E+00 0.000000E+00 -2.805439E+00 -3.982239E-01 -5.574031E+00 -1.561105E+00 +2.832501E+00 +4.049252E-01 +5.517243E+00 +1.527794E+00 0.000000E+00 0.000000E+00 0.000000E+00 @@ -128,14 +128,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -5.574031E+00 -1.561105E+00 -2.805439E+00 -3.982239E-01 -5.171038E+00 -1.344877E+00 -7.372031E+00 -2.725420E+00 +5.517243E+00 +1.527794E+00 +2.832501E+00 +4.049252E-01 +5.117178E+00 +1.316972E+00 +7.333303E+00 +2.701677E+00 0.000000E+00 0.000000E+00 0.000000E+00 @@ -152,14 +152,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -7.372031E+00 -2.725420E+00 -5.171038E+00 -1.344877E+00 -6.946847E+00 -2.424850E+00 -8.496610E+00 -3.627542E+00 +7.333303E+00 +2.701677E+00 +5.117178E+00 +1.316972E+00 +7.248464E+00 +2.641591E+00 +8.817788E+00 +3.905530E+00 0.000000E+00 0.000000E+00 0.000000E+00 @@ -176,14 +176,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -8.496610E+00 -3.627542E+00 -6.946847E+00 -2.424850E+00 -8.479501E+00 -3.607280E+00 -9.261869E+00 -4.305912E+00 +8.817788E+00 +3.905530E+00 +7.248464E+00 +2.641591E+00 +8.646465E+00 +3.749847E+00 +9.460948E+00 +4.495388E+00 0.000000E+00 0.000000E+00 0.000000E+00 @@ -200,14 +200,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -9.261869E+00 -4.305912E+00 -8.479501E+00 -3.607280E+00 -9.232858E+00 -4.278432E+00 -9.306384E+00 -4.348594E+00 +9.460948E+00 +4.495388E+00 +8.646465E+00 +3.749847E+00 +9.379341E+00 +4.415049E+00 +9.278640E+00 +4.320720E+00 0.000000E+00 0.000000E+00 0.000000E+00 @@ -224,14 +224,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -9.306384E+00 -4.348594E+00 -9.232858E+00 -4.278432E+00 -9.299764E+00 -4.347828E+00 -8.511976E+00 -3.639893E+00 +9.278640E+00 +4.320720E+00 +9.379341E+00 +4.415049E+00 +9.465746E+00 +4.498591E+00 +8.656146E+00 +3.760545E+00 0.000000E+00 0.000000E+00 0.000000E+00 @@ -248,14 +248,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -8.511976E+00 -3.639893E+00 -9.299764E+00 -4.347828E+00 -8.726086E+00 -3.819567E+00 -7.147277E+00 -2.562747E+00 +8.656146E+00 +3.760545E+00 +9.465746E+00 +4.498591E+00 +8.589782E+00 +3.700308E+00 +6.996002E+00 +2.456935E+00 0.000000E+00 0.000000E+00 0.000000E+00 @@ -272,14 +272,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -7.147277E+00 -2.562747E+00 -8.726086E+00 -3.819567E+00 -7.218790E+00 -2.612243E+00 -5.018287E+00 -1.263077E+00 +6.996002E+00 +2.456935E+00 +8.589782E+00 +3.700308E+00 +7.352050E+00 +2.714808E+00 +5.105164E+00 +1.312559E+00 0.000000E+00 0.000000E+00 0.000000E+00 @@ -296,14 +296,14 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -5.018287E+00 -1.263077E+00 -7.218790E+00 -2.612243E+00 -5.443494E+00 -1.487018E+00 -2.732334E+00 -3.773047E-01 +5.105164E+00 +1.312559E+00 +7.352050E+00 +2.714808E+00 +5.442756E+00 +1.486776E+00 +2.697305E+00 +3.675580E-01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -320,12 +320,12 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -2.732334E+00 -3.773047E-01 -5.443494E+00 -1.487018E+00 -3.044773E+00 -4.655756E-01 +2.697305E+00 +3.675580E-01 +5.442756E+00 +1.486776E+00 +3.017025E+00 +4.571443E-01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -345,144 +345,144 @@ tally 4: 0.000000E+00 0.000000E+00 tally 5: -1.609029E+01 -1.306718E+01 -2.230601E+00 -2.559496E-01 -2.876780E+01 -4.148686E+01 -3.835952E+00 -7.456562E-01 -3.895738E+01 -7.625344E+01 -4.841024E+00 -1.197335E+00 -4.633595E+01 -1.079043E+02 -6.236821E+00 -1.963311E+00 -5.007472E+01 -1.258967E+02 -6.749745E+00 -2.297130E+00 -5.058336E+01 -1.285894E+02 -6.727612E+00 -2.315656E+00 -4.743869E+01 -1.130735E+02 -6.338193E+00 -2.042159E+00 -3.899838E+01 -7.631289E+01 -5.187573E+00 -1.359733E+00 -2.873434E+01 -4.144233E+01 -3.815610E+00 -7.367619E-01 -1.509020E+01 -1.145268E+01 -2.125767E+00 -2.341894E-01 +1.563588E+01 +1.226217E+01 +2.209027E+00 +2.507131E-01 +2.870034E+01 +4.137550E+01 +3.726620E+00 +7.021948E-01 +3.977762E+01 +7.952285E+01 +5.304975E+00 +1.427333E+00 +4.779747E+01 +1.147456E+02 +6.528302E+00 +2.151715E+00 +5.105366E+01 +1.308037E+02 +6.986782E+00 +2.467487E+00 +5.123380E+01 +1.318264E+02 +6.845633E+00 +2.383542E+00 +4.729296E+01 +1.121433E+02 +6.252695E+00 +1.977351E+00 +3.898236E+01 +7.628315E+01 +5.461495E+00 +1.528579E+00 +2.864576E+01 +4.123538E+01 +3.857301E+00 +7.581323E-01 +1.467047E+01 +1.088031E+01 +2.277024E+00 +2.679801E-01 cmfd indices 1.000000E+01 1.000000E+00 1.000000E+00 1.000000E+00 k cmfd -1.129918E+00 -1.143848E+00 -1.147976E+00 -1.151534E+00 -1.152378E+00 -1.148219E+00 -1.150402E+00 -1.154647E+00 -1.156159E+00 -1.160048E+00 -1.167441E+00 -1.168163E+00 -1.168629E+00 -1.164120E+00 -1.165051E+00 -1.169177E+00 +1.169107E+00 +1.175079E+00 +1.173912E+00 +1.175368E+00 +1.174026E+00 +1.181745E+00 +1.182261E+00 +1.183559E+00 +1.178691E+00 +1.179222E+00 +1.179017E+00 +1.172979E+00 +1.175043E+00 +1.173458E+00 +1.174152E+00 +1.171451E+00 cmfd entropy -3.224769E+00 -3.225945E+00 -3.227421E+00 -3.226174E+00 -3.224429E+00 -3.227049E+00 -3.230710E+00 -3.230315E+00 -3.226825E+00 -3.226655E+00 -3.226588E+00 -3.224155E+00 -3.223246E+00 -3.222640E+00 -3.223920E+00 -3.222838E+00 +3.207640E+00 +3.210547E+00 +3.212218E+00 +3.209573E+00 +3.211619E+00 +3.212126E+00 +3.213163E+00 +3.214288E+00 +3.215737E+00 +3.213677E+00 +3.214925E+00 +3.215612E+00 +3.216708E+00 +3.221454E+00 +3.219048E+00 +3.218387E+00 cmfd balance -3.90454E-03 -4.08089E-03 -3.46511E-03 -4.09535E-03 -2.62009E-03 -2.23559E-03 -2.54033E-03 -2.12799E-03 -2.25864E-03 -1.85766E-03 -1.49916E-03 -1.63471E-03 -1.48377E-03 -1.59800E-03 -1.37354E-03 -1.32853E-03 +4.88208E-03 +4.75139E-03 +3.15783E-03 +3.67091E-03 +2.99797E-03 +2.91060E-03 +2.06576E-03 +1.83482E-03 +1.56292E-03 +1.58659E-03 +2.32986E-03 +1.47376E-03 +1.46673E-03 +1.22627E-03 +1.31963E-03 +1.26456E-03 cmfd dominance ratio -5.539E-01 -5.537E-01 -5.536E-01 -5.515E-01 -5.512E-01 -5.514E-01 -5.518E-01 -5.507E-01 -5.500E-01 -5.497E-01 -5.477E-01 -5.461E-01 -5.444E-01 -5.445E-01 -5.454E-01 +5.467E-01 +5.453E-01 +5.458E-01 +5.436E-01 +5.442E-01 +5.406E-01 +5.401E-01 +5.413E-01 +4.995E-01 +5.396E-01 +5.409E-01 +5.414E-01 +5.423E-01 +5.456E-01 +5.442E-01 5.441E-01 cmfd openmc source comparison -9.875240E-03 -1.106163E-02 -9.847628E-03 -6.065921E-03 -5.772039E-03 -4.615656E-03 -4.244331E-03 -3.694299E-03 -3.545814E-03 -3.213063E-03 -3.467537E-03 -3.383489E-03 -3.697591E-03 -3.937358E-03 -3.369124E-03 -3.190359E-03 +9.587418E-03 +8.150978E-03 +6.677661E-03 +6.334727E-03 +5.153692E-03 +5.082964E-03 +4.633153E-03 +4.037383E-03 +3.528742E-03 +4.559089E-03 +3.517370E-03 +3.306117E-03 +2.913809E-03 +1.906045E-03 +1.932794E-03 +1.711341E-03 cmfd source -4.360494E-02 -8.397599E-02 -1.074181E-01 -1.294531E-01 -1.385611E-01 -1.407934E-01 -1.325191E-01 -1.044311E-01 -7.660359E-02 -4.263941E-02 +4.496492E-02 +7.869674E-02 +1.100280E-01 +1.354045E-01 +1.363339E-01 +1.380533E-01 +1.314512E-01 +1.077480E-01 +7.847306E-02 +3.884630E-02 diff --git a/tests/regression_tests/statepoint_batch/__init__.py b/tests/regression_tests/collision_track/__init__.py similarity index 100% rename from tests/regression_tests/statepoint_batch/__init__.py rename to tests/regression_tests/collision_track/__init__.py diff --git a/tests/regression_tests/collision_track/case_1_Reactions/inputs_true.dat b/tests/regression_tests/collision_track/case_1_Reactions/inputs_true.dat new file mode 100644 index 000000000..7533616c0 --- /dev/null +++ b/tests/regression_tests/collision_track/case_1_Reactions/inputs_true.dat @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + eigenvalue + 100 + 5 + 1 + + + -2.0 -2.0 -2.0 2.0 2.0 2.0 + + + true + + + + (n,fission) 101 + 300 + + 1 + + diff --git a/tests/regression_tests/collision_track/case_1_Reactions/results_true.dat b/tests/regression_tests/collision_track/case_1_Reactions/results_true.dat new file mode 100644 index 000000000..d4d1d1e5a --- /dev/null +++ b/tests/regression_tests/collision_track/case_1_Reactions/results_true.dat @@ -0,0 +1,2 @@ +k-combined: +5.642735E-02 1.494035E-02 diff --git a/tests/regression_tests/collision_track/case_2_Cell_ID/inputs_true.dat b/tests/regression_tests/collision_track/case_2_Cell_ID/inputs_true.dat new file mode 100644 index 000000000..55fb835de --- /dev/null +++ b/tests/regression_tests/collision_track/case_2_Cell_ID/inputs_true.dat @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + eigenvalue + 100 + 5 + 1 + + + -2.0 -2.0 -2.0 2.0 2.0 2.0 + + + true + + + + 22 + 300 + + 1 + + diff --git a/tests/regression_tests/collision_track/case_2_Cell_ID/results_true.dat b/tests/regression_tests/collision_track/case_2_Cell_ID/results_true.dat new file mode 100644 index 000000000..d4d1d1e5a --- /dev/null +++ b/tests/regression_tests/collision_track/case_2_Cell_ID/results_true.dat @@ -0,0 +1,2 @@ +k-combined: +5.642735E-02 1.494035E-02 diff --git a/tests/regression_tests/collision_track/case_3_Material_ID/inputs_true.dat b/tests/regression_tests/collision_track/case_3_Material_ID/inputs_true.dat new file mode 100644 index 000000000..61890414b --- /dev/null +++ b/tests/regression_tests/collision_track/case_3_Material_ID/inputs_true.dat @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + eigenvalue + 100 + 5 + 1 + + + -2.0 -2.0 -2.0 2.0 2.0 2.0 + + + true + + + + 1 + 300 + + 1 + + diff --git a/tests/regression_tests/collision_track/case_3_Material_ID/results_true.dat b/tests/regression_tests/collision_track/case_3_Material_ID/results_true.dat new file mode 100644 index 000000000..d4d1d1e5a --- /dev/null +++ b/tests/regression_tests/collision_track/case_3_Material_ID/results_true.dat @@ -0,0 +1,2 @@ +k-combined: +5.642735E-02 1.494035E-02 diff --git a/tests/regression_tests/collision_track/case_4_Nuclide_ID/inputs_true.dat b/tests/regression_tests/collision_track/case_4_Nuclide_ID/inputs_true.dat new file mode 100644 index 000000000..8960dde5c --- /dev/null +++ b/tests/regression_tests/collision_track/case_4_Nuclide_ID/inputs_true.dat @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + eigenvalue + 100 + 5 + 1 + + + -2.0 -2.0 -2.0 2.0 2.0 2.0 + + + true + + + + O16 U235 + 300 + + 1 + + diff --git a/tests/regression_tests/collision_track/case_4_Nuclide_ID/results_true.dat b/tests/regression_tests/collision_track/case_4_Nuclide_ID/results_true.dat new file mode 100644 index 000000000..d4d1d1e5a --- /dev/null +++ b/tests/regression_tests/collision_track/case_4_Nuclide_ID/results_true.dat @@ -0,0 +1,2 @@ +k-combined: +5.642735E-02 1.494035E-02 diff --git a/tests/regression_tests/collision_track/case_5_Universe_ID/inputs_true.dat b/tests/regression_tests/collision_track/case_5_Universe_ID/inputs_true.dat new file mode 100644 index 000000000..8c0d7aa8e --- /dev/null +++ b/tests/regression_tests/collision_track/case_5_Universe_ID/inputs_true.dat @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + eigenvalue + 100 + 5 + 1 + + + -2.0 -2.0 -2.0 2.0 2.0 2.0 + + + true + + + + 22 + 77 + 300 + + 1 + + diff --git a/tests/regression_tests/collision_track/case_5_Universe_ID/results_true.dat b/tests/regression_tests/collision_track/case_5_Universe_ID/results_true.dat new file mode 100644 index 000000000..d4d1d1e5a --- /dev/null +++ b/tests/regression_tests/collision_track/case_5_Universe_ID/results_true.dat @@ -0,0 +1,2 @@ +k-combined: +5.642735E-02 1.494035E-02 diff --git a/tests/regression_tests/collision_track/case_6_deposited_energy_threshold/inputs_true.dat b/tests/regression_tests/collision_track/case_6_deposited_energy_threshold/inputs_true.dat new file mode 100644 index 000000000..5173dc35c --- /dev/null +++ b/tests/regression_tests/collision_track/case_6_deposited_energy_threshold/inputs_true.dat @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + eigenvalue + 100 + 5 + 1 + + + -2.0 -2.0 -2.0 2.0 2.0 2.0 + + + true + + + + 550000.0 + 300 + + 1 + + diff --git a/tests/regression_tests/collision_track/case_6_deposited_energy_threshold/results_true.dat b/tests/regression_tests/collision_track/case_6_deposited_energy_threshold/results_true.dat new file mode 100644 index 000000000..d4d1d1e5a --- /dev/null +++ b/tests/regression_tests/collision_track/case_6_deposited_energy_threshold/results_true.dat @@ -0,0 +1,2 @@ +k-combined: +5.642735E-02 1.494035E-02 diff --git a/tests/regression_tests/collision_track/case_7_all_parameters_used_together/inputs_true.dat b/tests/regression_tests/collision_track/case_7_all_parameters_used_together/inputs_true.dat new file mode 100644 index 000000000..005d9feb2 --- /dev/null +++ b/tests/regression_tests/collision_track/case_7_all_parameters_used_together/inputs_true.dat @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + eigenvalue + 100 + 5 + 1 + + + -2.0 -2.0 -2.0 2.0 2.0 2.0 + + + true + + + + 22 33 + elastic 18 (n,disappear) + 77 + 1 11 + U238 U235 H1 U234 + 100000.0 + 300 + + 1 + + diff --git a/tests/regression_tests/collision_track/case_7_all_parameters_used_together/results_true.dat b/tests/regression_tests/collision_track/case_7_all_parameters_used_together/results_true.dat new file mode 100644 index 000000000..d4d1d1e5a --- /dev/null +++ b/tests/regression_tests/collision_track/case_7_all_parameters_used_together/results_true.dat @@ -0,0 +1,2 @@ +k-combined: +5.642735E-02 1.494035E-02 diff --git a/tests/regression_tests/collision_track/case_8_2threads/inputs_true.dat b/tests/regression_tests/collision_track/case_8_2threads/inputs_true.dat new file mode 100644 index 000000000..514932c1a --- /dev/null +++ b/tests/regression_tests/collision_track/case_8_2threads/inputs_true.dat @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + eigenvalue + 100 + 5 + 1 + + + -2.0 -2.0 -2.0 2.0 2.0 2.0 + + + true + + + + 200 + + 1 + + diff --git a/tests/regression_tests/collision_track/case_8_2threads/results_true.dat b/tests/regression_tests/collision_track/case_8_2threads/results_true.dat new file mode 100644 index 000000000..d4d1d1e5a --- /dev/null +++ b/tests/regression_tests/collision_track/case_8_2threads/results_true.dat @@ -0,0 +1,2 @@ +k-combined: +5.642735E-02 1.494035E-02 diff --git a/tests/regression_tests/collision_track/test.py b/tests/regression_tests/collision_track/test.py new file mode 100644 index 000000000..00e1e3de4 --- /dev/null +++ b/tests/regression_tests/collision_track/test.py @@ -0,0 +1,255 @@ +"""Test the 'collision_track' setting. + +Results +------- + +All results are generated using only 1 MPI process. + +All results are generated using 1 thread except for "test_consistency_low_realization_number". +This specific test verifies that when the number of realization (i.e., point being candidate +to be stored) is lower than the capacity, results are reproducible even with multiple +threads (i.e., there is no potential thread competition that would produce different +results in that case). + +All results are generated using the history-based mode except for cases e01 to e03. + +All results are visually verified using the '_visualize.py' script in the regression test folder. + +OpenMC models +------------- + +Four OpenMC models with CSG-only geometries are used to cover the transmission, vacuum, +reflective and periodic Boundary Conditions (BC): + +- model_1: cylindrical core in 2 boxes (vacuum and transmission BC), + +# Test cases for simulation parameters using CSG-only geometries +# ============================================================ +# Each test case is defined by a combination of folder name, model name, and specific parameters. +# Below is a summary of the parameters used in the test cases: +# +# - max_collisions: Maximum number of particles to track in the simulation. +# - reactions: List of MT numbers (reaction types- 2 for scattering, 18 for fission, 101 for absorbtion). +# - cell_ids: IDs of specific cells in the model. +# - mat_ids: Material IDs for filtering particles. +# - nuclides: Nuclides for filtering particles. +# - univ_ids: Universe IDs for filtering particles. +# - E_threshold: Energy threshold for filtering particles (optional). +# +# The test cases are designed to validate the behavior of the simulation under various configurations. + +*: BC stands for Boundary Conditions, T for Transmission, R for Reflective, and V for Vacuum. + +An additional case, called 'case-a01', is used to check that the results are comparable when +the number of threads is set to 2 if the number of realization is lower than the capacity. + + +*: BC stands for Boundary Conditions, T for Transmission, and V for Vacuum. + +Notes: + +- The test cases list is non-exhaustive compared to the number of possible combinations. + Test cases have been selected based on use and internal code logic. + + + +TODO: + +- Test with a lattice. + +""" + +import os + +import openmc +import openmc.lib +import pytest + +from tests.testing_harness import CollisionTrackTestHarness +from tests.regression_tests import config + + +@pytest.fixture(scope="function") +def two_threads(monkeypatch): + """Set the number of OMP threads to 2 for the test.""" + monkeypatch.setenv("OMP_NUM_THREADS", "2") + + +@pytest.fixture(scope="function") +def single_process(monkeypatch): + """Set the number of MPI process to 1 for the test.""" + monkeypatch.setitem(config, "mpi_np", "1") + + +@pytest.fixture(scope="module") +def model_1(): + """Cylindrical core contained in a first box which is contained in a larger box. + A lower universe is used to describe the interior of the first box which + contains the core and its surrounding space. + + """ + openmc.reset_auto_ids() + model = openmc.Model() + + # ============================================================================= + # Materials + # ============================================================================= + + fuel = openmc.Material(material_id=1) + fuel.add_nuclide("U234", 0.0004524) + fuel.add_nuclide("U235", 0.0506068) + fuel.add_nuclide("U238", 0.9487090) + fuel.add_nuclide("U236", 0.0002318) + fuel.add_nuclide("O16", 2.0) + fuel.set_density("g/cm3", 11.0) + + water = openmc.Material(material_id=11) + water.add_nuclide("H1", 2.0) + water.add_nuclide("O16", 1.0) + water.set_density("g/cm3", 1.0) + + # ============================================================================= + # Geometry + # ============================================================================= + + # ----------------------------------------------------------------------------- + # Cylindrical core + # ----------------------------------------------------------------------------- + + # Parameters + core_radius = 2.0 + core_height = 4.0 + + # Surfaces + core_cylinder = openmc.ZCylinder(r=core_radius) + core_lower_plane = openmc.ZPlane(-core_height / 2.0) + core_upper_plane = openmc.ZPlane(core_height / 2.0) + + # Region + core_region = -core_cylinder & +core_lower_plane & -core_upper_plane + + # Cells + core = openmc.Cell(fill=fuel, region=core_region, cell_id=22) + outside_core_region = +core_cylinder | -core_lower_plane | +core_upper_plane + outside_core = openmc.Cell( + fill=water, region=outside_core_region, cell_id=33) + + # Universe + inside_box1_universe = openmc.Universe( + cells=[core, outside_core], universe_id=77) + + # ----------------------------------------------------------------------------- + # Box 1 + # ----------------------------------------------------------------------------- + + # Parameters + box1_size = 6.0 + + # Surfaces + box1_rpp = openmc.model.RectangularParallelepiped( + -box1_size / 2.0, box1_size / 2.0, + -box1_size / 2.0, box1_size / 2.0, + -box1_size / 2.0, box1_size / 2.0, + ) + + # Cell + box1 = openmc.Cell(fill=inside_box1_universe, region=-box1_rpp, cell_id=5) + + # ----------------------------------------------------------------------------- + # Box 2 + # ----------------------------------------------------------------------------- + + # Parameters + box2_size = 8 + + # Surfaces + box2_rpp = openmc.model.RectangularParallelepiped( + -box2_size / 2.0, box2_size / 2.0, + -box2_size / 2.0, box2_size / 2.0, + -box2_size / 2.0, box2_size / 2.0, + boundary_type="vacuum" + ) + + # Cell + box2 = openmc.Cell(fill=water, region=-box2_rpp & +box1_rpp, cell_id=8) + + # Register geometry + model.geometry = openmc.Geometry([box1, box2]) + + # ============================================================================= + # Settings + # ============================================================================= + + model.settings = openmc.Settings() + model.settings.particles = 100 + model.settings.batches = 5 + model.settings.inactive = 1 + model.settings.seed = 1 + + bounds = [ + -core_radius, + -core_radius, + -core_height / 2.0, + core_radius, + core_radius, + core_height / 2.0, + ] + distribution = openmc.stats.Box(bounds[:3], bounds[3:]) + model.settings.source = openmc.IndependentSource( + space=distribution, constraints={'fissionable': True}) + + return model + + +@pytest.mark.parametrize( + "folder, model_name, parameter", + [("case_1_Reactions", "model_1", {"max_collisions": 300, "reactions": ["(n,fission)", 101]}), + ("case_2_Cell_ID", "model_1", { + "max_collisions": 300, "cell_ids": [22]}), + ("case_3_Material_ID", "model_1", { + "max_collisions": 300, "material_ids": [1]}), + ("case_4_Nuclide_ID", "model_1", { + "max_collisions": 300, "nuclides": ["O16", "U235"]}), + ("case_5_Universe_ID", "model_1", { + "max_collisions": 300, "cell_ids": [22], "universe_ids": [77]}), + ("case_6_deposited_energy_threshold", "model_1", { + "max_collisions": 300, "deposited_E_threshold": 5.5e5}), + ("case_7_all_parameters_used_together", "model_1", { + "max_collisions": 300, + "reactions": ["elastic", 18, "(n,disappear)"], + "material_ids": [1, 11], + "universe_ids": [77], + "nuclides": ["U238", "U235", "H1", "U234"], + "cell_ids": [22, 33], + "deposited_E_threshold": 1e5}) + ], +) +def test_collision_track_several_cases( + folder, model_name, parameter, request +): + # Since for these tests the actual number of collisions recorded is < max_collisions, + # we can run them with 1 or 2 threads, and in history or event mode. + model = request.getfixturevalue(model_name) + model.settings.collision_track = parameter + harness = CollisionTrackTestHarness( + "statepoint.5.h5", model=model, workdir=folder + ) + harness.main() + + +@pytest.mark.skipif(config["event"], reason="Results from history-based mode.") +def test_collision_track_2threads(model_1, two_threads, single_process): + # This test checks that the `max_collisions` setting is honored: + # no collisions beyond the specified limit should be recorded. + # + # For the result to be reproducible, the number of threads and + # the transport mode (history vs. event) must remain fixed. + assert os.environ["OMP_NUM_THREADS"] == "2" + assert config["mpi_np"] == "1" + model_1.settings.collision_track = { + "max_collisions": 200 + } + harness = CollisionTrackTestHarness( + "statepoint.5.h5", model=model_1, workdir="case_8_2threads" + ) + harness.main() diff --git a/tests/regression_tests/complex_cell/results_true.dat b/tests/regression_tests/complex_cell/results_true.dat index 3ce3d7cbc..ddedb07ff 100644 --- a/tests/regression_tests/complex_cell/results_true.dat +++ b/tests/regression_tests/complex_cell/results_true.dat @@ -1,11 +1,11 @@ k-combined: -2.564169E-01 4.095378E-03 +2.603220E-01 1.429366E-03 tally 1: -2.607144E+00 -1.360414E+00 -2.681079E+00 -1.439354E+00 -9.627534E-01 -1.855496E-01 -1.123751E-01 +2.624819E+00 +1.378200E+00 +2.730035E+00 +1.492361E+00 +1.013707E+00 +2.055807E-01 +1.123257E-01 2.530233E-03 diff --git a/tests/regression_tests/confidence_intervals/results_true.dat b/tests/regression_tests/confidence_intervals/results_true.dat index 6a906d07e..8ca256624 100644 --- a/tests/regression_tests/confidence_intervals/results_true.dat +++ b/tests/regression_tests/confidence_intervals/results_true.dat @@ -1,5 +1,5 @@ k-combined: -2.759923E-01 6.988588E-03 +2.850178E-01 9.646334E-03 tally 1: -6.167984E+01 -4.772717E+02 +6.234169E+01 +4.884167E+02 diff --git a/tests/regression_tests/cpp_driver/driver.cpp b/tests/regression_tests/cpp_driver/driver.cpp index 48ed7f317..a99c97b64 100644 --- a/tests/regression_tests/cpp_driver/driver.cpp +++ b/tests/regression_tests/cpp_driver/driver.cpp @@ -15,14 +15,16 @@ using namespace openmc; -int main(int argc, char** argv) { +int main(int argc, char** argv) +{ #ifdef OPENMC_MPI MPI_Comm world {MPI_COMM_WORLD}; int err = openmc_init(argc, argv, &world); #else int err = openmc_init(argc, argv, nullptr); #endif - if (err) fatal_error(openmc_err_msg); + if (err) + fatal_error(openmc_err_msg); // create a new cell filter auto cell_filter = Filter::create(); @@ -30,7 +32,7 @@ int main(int argc, char** argv) { // add all cells to the cell filter std::vector cell_indices; for (auto& entry : openmc::model::cell_map) { - cell_indices.push_back(entry.second); + cell_indices.push_back(entry.second); } // enable distribcells offsets for all cells prepare_distribcell(&cell_indices); @@ -39,7 +41,6 @@ int main(int argc, char** argv) { 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}; @@ -60,14 +61,19 @@ int main(int argc, char** argv) { } } - // set a higher temperature for only one of the lattice cells (ID is 4 in the model) + // 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); + // set the density of another lattice cell to 2 + model::cells[model::cell_map[4]]->set_density(2.0, 2, true); + // the summary file will be used to check that // temperatures were set correctly so clear // error output can be provided #ifdef OPENMC_MPI - if (openmc::mpi::master) openmc::write_summary(); + if (openmc::mpi::master) + openmc::write_summary(); #else openmc::write_summary(); #endif diff --git a/tests/regression_tests/cpp_driver/inputs_true.dat b/tests/regression_tests/cpp_driver/inputs_true.dat index 5d067cb68..fd450428a 100644 --- a/tests/regression_tests/cpp_driver/inputs_true.dat +++ b/tests/regression_tests/cpp_driver/inputs_true.dat @@ -1,26 +1,26 @@ - - - + + + - - + + - - - + + + - - + + 4.0 4.0 2 2 @@ -29,12 +29,12 @@ 2 2 2 2 - - - - - - + + + + + + eigenvalue diff --git a/tests/regression_tests/cpp_driver/results_true.dat b/tests/regression_tests/cpp_driver/results_true.dat index c2b0b8d6f..09f188db6 100644 --- a/tests/regression_tests/cpp_driver/results_true.dat +++ b/tests/regression_tests/cpp_driver/results_true.dat @@ -1,13 +1,13 @@ k-combined: -1.933305E+00 1.300360E-02 +1.874924E+00 2.180236E-02 tally 1: -9.552846E+01 -1.019358E+03 -2.887973E+01 -9.308509E+01 -9.732441E+01 -1.059022E+03 -2.217326E+02 -5.486892E+03 -2.217326E+02 -5.486892E+03 +9.484447E+01 +1.002269E+03 +2.746252E+01 +8.406603E+01 +9.833099E+01 +1.076376E+03 +2.206380E+02 +5.417609E+03 +2.206380E+02 +5.417609E+03 diff --git a/tests/regression_tests/create_fission_neutrons/inputs_true.dat b/tests/regression_tests/create_fission_neutrons/inputs_true.dat index 9e44a0224..47e8c3830 100644 --- a/tests/regression_tests/create_fission_neutrons/inputs_true.dat +++ b/tests/regression_tests/create_fission_neutrons/inputs_true.dat @@ -1,30 +1,30 @@ - - - - + + + + - - - - - - - + + + + + + + fixed source 100 10 - + -1 -1 -1 1 1 1 - + false diff --git a/tests/regression_tests/dagmc/external/inputs_true.dat b/tests/regression_tests/dagmc/external/inputs_true.dat index 31f4c1f88..8a6c6fe74 100644 --- a/tests/regression_tests/dagmc/external/inputs_true.dat +++ b/tests/regression_tests/dagmc/external/inputs_true.dat @@ -1,26 +1,26 @@ - - - + + + - - - + + + - + eigenvalue 100 5 0 - + -4 -4 -4 4 4 4 diff --git a/tests/regression_tests/dagmc/external/main.cpp b/tests/regression_tests/dagmc/external/main.cpp index 3765cf79a..e78ab03fa 100644 --- a/tests/regression_tests/dagmc/external/main.cpp +++ b/tests/regression_tests/dagmc/external/main.cpp @@ -100,6 +100,9 @@ int main(int argc, char* argv[]) } } + // Finalize cell densities + openmc::finalize_cell_densities(); + // Run OpenMC openmc_err = openmc_run(); if (openmc_err) diff --git a/tests/regression_tests/dagmc/external/results_true.dat b/tests/regression_tests/dagmc/external/results_true.dat index cda656937..9a6b481b7 100644 --- a/tests/regression_tests/dagmc/external/results_true.dat +++ b/tests/regression_tests/dagmc/external/results_true.dat @@ -1,5 +1,5 @@ k-combined: -9.118190E-01 3.615552E-02 +1.083415E+00 5.991738E-02 tally 1: -8.430103E+00 -1.442878E+01 +8.862860E+00 +1.602117E+01 diff --git a/tests/regression_tests/dagmc/external/test.py b/tests/regression_tests/dagmc/external/test.py index 57bc9ea7f..3580bfa11 100644 --- a/tests/regression_tests/dagmc/external/test.py +++ b/tests/regression_tests/dagmc/external/test.py @@ -32,7 +32,7 @@ def cpp_driver(request): target_link_libraries(main OpenMC::libopenmc) target_compile_features(main PUBLIC cxx_std_14) set(CMAKE_CXX_FLAGS "-pedantic-errors") - add_compile_definitions(DAGMC=1) + add_compile_definitions(OPENMC_DAGMC_ENABLED=1) """.format(openmc_dir))) # Create temporary build directory and change to there diff --git a/tests/regression_tests/dagmc/legacy/inputs_true.dat b/tests/regression_tests/dagmc/legacy/inputs_true.dat index b06516cb1..ad2f8e54d 100644 --- a/tests/regression_tests/dagmc/legacy/inputs_true.dat +++ b/tests/regression_tests/dagmc/legacy/inputs_true.dat @@ -1,26 +1,26 @@ - - - + + + - - - + + + - + eigenvalue 100 5 0 - + -4 -4 -4 4 4 4 diff --git a/tests/regression_tests/dagmc/legacy/results_true.dat b/tests/regression_tests/dagmc/legacy/results_true.dat index cda656937..9a6b481b7 100644 --- a/tests/regression_tests/dagmc/legacy/results_true.dat +++ b/tests/regression_tests/dagmc/legacy/results_true.dat @@ -1,5 +1,5 @@ k-combined: -9.118190E-01 3.615552E-02 +1.083415E+00 5.991738E-02 tally 1: -8.430103E+00 -1.442878E+01 +8.862860E+00 +1.602117E+01 diff --git a/tests/regression_tests/dagmc/refl/inputs_true.dat b/tests/regression_tests/dagmc/refl/inputs_true.dat index 979eeb492..58cb9e66f 100644 --- a/tests/regression_tests/dagmc/refl/inputs_true.dat +++ b/tests/regression_tests/dagmc/refl/inputs_true.dat @@ -3,14 +3,14 @@ - + eigenvalue 100 5 0 - + -4 -4 -4 4 4 4 diff --git a/tests/regression_tests/dagmc/refl/results_true.dat b/tests/regression_tests/dagmc/refl/results_true.dat index 533c62a90..b49a4a7a4 100644 --- a/tests/regression_tests/dagmc/refl/results_true.dat +++ b/tests/regression_tests/dagmc/refl/results_true.dat @@ -1,5 +1,5 @@ k-combined: -2.035173E+00 3.967029E-02 +2.047107E+00 8.605767E-02 tally 1: -1.064492E+01 -2.301019E+01 +1.145034E+01 +2.636875E+01 diff --git a/tests/regression_tests/dagmc/universes/inputs_true.dat b/tests/regression_tests/dagmc/universes/inputs_true.dat index 4b5be3612..be1a17383 100644 --- a/tests/regression_tests/dagmc/universes/inputs_true.dat +++ b/tests/regression_tests/dagmc/universes/inputs_true.dat @@ -1,33 +1,33 @@ - - - - - - + + + + + + - - - - - - + + + + + + - - - - - + + + + + - - + + 24.0 24.0 2 2 @@ -36,18 +36,26 @@ 1 1 1 1 - - - - - - + + + + + + eigenvalue 100 10 5 + + + -10.0 -10.0 -24.0 10.0 10.0 24.0 + + + true + + false diff --git a/tests/regression_tests/dagmc/universes/results_true.dat b/tests/regression_tests/dagmc/universes/results_true.dat index 76cbc9db0..aacb7d1ab 100644 --- a/tests/regression_tests/dagmc/universes/results_true.dat +++ b/tests/regression_tests/dagmc/universes/results_true.dat @@ -1,13 +1,13 @@ k-combined: -9.887663E-01 1.510336E-02 +9.719586E-01 3.630894E-02 tally 1: -4.340758E+00 -4.265459E+00 -4.712319E+00 -4.654778E+00 -4.151897E+00 -3.588090E+00 -2.965925E+00 -1.852746E+00 +4.463288E+00 +4.136647E+00 +4.769631E+00 +4.622840E+00 +4.315273E+00 +3.871129E+00 +4.091804E+00 +3.582192E+00 0.000000E+00 0.000000E+00 diff --git a/tests/regression_tests/dagmc/universes/test.py b/tests/regression_tests/dagmc/universes/test.py index 057a7b0d4..d68c6b11c 100644 --- a/tests/regression_tests/dagmc/universes/test.py +++ b/tests/regression_tests/dagmc/universes/test.py @@ -11,81 +11,87 @@ pytestmark = pytest.mark.skipif( reason="DAGMC CAD geometry is not enabled.") -class DAGMCUniverseTest(PyAPITestHarness): - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) +@pytest.fixture +def pin_lattice_model(): + ### MATERIALS ### + fuel = openmc.Material(name='no-void fuel') + fuel.set_density('g/cc', 10.29769) + fuel.add_nuclide('U234', 0.93120485) + fuel.add_nuclide('U235', 0.00055815) + fuel.add_nuclide('U238', 0.022408) + fuel.add_nuclide('O16', 0.045829) - ### MATERIALS ### - fuel = openmc.Material(name='no-void fuel') - fuel.set_density('g/cc', 10.29769) - fuel.add_nuclide('U234', 0.93120485) - fuel.add_nuclide('U235', 0.00055815) - fuel.add_nuclide('U238', 0.022408) - fuel.add_nuclide('O16', 0.045829) + cladding = openmc.Material(name='clad') + cladding.set_density('g/cc', 6.55) + cladding.add_nuclide('Zr90', 0.021827) + cladding.add_nuclide('Zr91', 0.00476) + cladding.add_nuclide('Zr92', 0.0072758) + cladding.add_nuclide('Zr94', 0.0073734) + cladding.add_nuclide('Zr96', 0.0011879) - cladding = openmc.Material(name='clad') - cladding.set_density('g/cc', 6.55) - cladding.add_nuclide('Zr90', 0.021827) - cladding.add_nuclide('Zr91', 0.00476) - cladding.add_nuclide('Zr92', 0.0072758) - cladding.add_nuclide('Zr94', 0.0073734) - cladding.add_nuclide('Zr96', 0.0011879) + water = openmc.Material(name='water') + water.set_density('g/cc', 0.740582) + water.add_nuclide('H1', 0.049457) + water.add_nuclide('O16', 0.024672) + water.add_nuclide('B10', 8.0042e-06) + water.add_nuclide('B11', 3.2218e-05) + water.add_s_alpha_beta('c_H_in_H2O') - water = openmc.Material(name='water') - water.set_density('g/cc', 0.740582) - water.add_nuclide('H1', 0.049457) - water.add_nuclide('O16', 0.024672) - water.add_nuclide('B10', 8.0042e-06) - water.add_nuclide('B11', 3.2218e-05) - water.add_s_alpha_beta('c_H_in_H2O') + model = openmc.Model() + model.materials = openmc.Materials([fuel, cladding, water]) - self._model.materials = openmc.Materials([fuel, cladding, water]) + ### GEOMETRY ### + # create the DAGMC universe + pincell_univ = openmc.DAGMCUniverse(filename='dagmc.h5m', auto_geom_ids=True) - ### GEOMETRY ### - # create the DAGMC universe - pincell_univ = openmc.DAGMCUniverse(filename='dagmc.h5m', auto_geom_ids=True) + # creates another DAGMC universe, this time with within a bounded cell + bound_pincell_universe = openmc.DAGMCUniverse(filename='dagmc.h5m').bounded_universe() + # uses the bound_dag_cell as the root argument to test the type checks in openmc.Geometry + bound_pincell_geometry = openmc.Geometry(root=bound_pincell_universe) + # assigns the bound_dag_geometry to the model to test the type checks in model.Geometry setter + model.geometry = bound_pincell_geometry - # creates another DAGMC universe, this time with within a bounded cell - bound_pincell_universe = openmc.DAGMCUniverse(filename='dagmc.h5m').bounded_universe() - # uses the bound_dag_cell as the root argument to test the type checks in openmc.Geometry - bound_pincell_geometry = openmc.Geometry(root=bound_pincell_universe) - # assigns the bound_dag_geometry to the model to test the type checks in model.Geometry setter - self._model.geometry = bound_pincell_geometry + # create a 2 x 2 lattice using the DAGMC pincell + pitch = np.asarray((24.0, 24.0)) + lattice = openmc.RectLattice() + lattice.pitch = pitch + lattice.universes = [[pincell_univ] * 2] * 2 + lattice.lower_left = -pitch - # create a 2 x 2 lattice using the DAGMC pincell - pitch = np.asarray((24.0, 24.0)) - lattice = openmc.RectLattice() - lattice.pitch = pitch - lattice.universes = [[pincell_univ] * 2] * 2 - lattice.lower_left = -pitch + left = openmc.XPlane(x0=-pitch[0], name='left', boundary_type='reflective') + right = openmc.XPlane(x0=pitch[0], name='right', boundary_type='reflective') + front = openmc.YPlane(y0=-pitch[1], name='front', boundary_type='reflective') + back = openmc.YPlane(y0=pitch[1], name='back', boundary_type='reflective') + # clip the DAGMC geometry at +/- 10 cm w/ CSG planes + bottom = openmc.ZPlane(z0=-10.0, name='bottom', boundary_type='reflective') + top = openmc.ZPlane(z0=10.0, name='top', boundary_type='reflective') - left = openmc.XPlane(x0=-pitch[0], name='left', boundary_type='reflective') - right = openmc.XPlane(x0=pitch[0], name='right', boundary_type='reflective') - front = openmc.YPlane(y0=-pitch[1], name='front', boundary_type='reflective') - back = openmc.YPlane(y0=pitch[1], name='back', boundary_type='reflective') - # clip the DAGMC geometry at +/- 10 cm w/ CSG planes - bottom = openmc.ZPlane(z0=-10.0, name='bottom', boundary_type='reflective') - top = openmc.ZPlane(z0=10.0, name='top', boundary_type='reflective') + bounding_region = +left & -right & +front & -back & +bottom & -top + bounding_cell = openmc.Cell(fill=lattice, region=bounding_region) - bounding_region = +left & -right & +front & -back & +bottom & -top - bounding_cell = openmc.Cell(fill=lattice, region=bounding_region) + model.geometry = openmc.Geometry([bounding_cell]) - self._model.geometry = openmc.Geometry([bounding_cell]) + # add a cell instance tally + tally = openmc.Tally(name='cell instance tally') + # using scattering + cell_instance_filter = openmc.CellInstanceFilter(((4, 0), (4, 1), (4, 2), (4, 3), (4, 4))) + tally.filters = [cell_instance_filter] + tally.scores = ['scatter'] + model.tallies = [tally] - # add a cell instance tally - tally = openmc.Tally(name='cell instance tally') - # using scattering - cell_instance_filter = openmc.CellInstanceFilter(((4, 0), (4, 1), (4, 2), (4, 3), (4, 4))) - tally.filters = [cell_instance_filter] - tally.scores = ['scatter'] - self._model.tallies = [tally] + # settings + model.settings.particles = 100 + model.settings.batches = 10 + model.settings.inactive = 5 + model.settings.output = {'summary' : False} + model.settings.source = openmc.IndependentSource( + space=openmc.stats.Box((-10., -10., -24.), (10., 10., 24.)), + constraints={'fissionable': True}, + ) - # settings - self._model.settings.particles = 100 - self._model.settings.batches = 10 - self._model.settings.inactive = 5 - self._model.settings.output = {'summary' : False} + return model -def test_univ(): - harness = DAGMCUniverseTest('statepoint.10.h5', model=openmc.Model()) + +def test_univ(pin_lattice_model): + harness = PyAPITestHarness('statepoint.10.h5', model=pin_lattice_model) harness.main() diff --git a/tests/regression_tests/dagmc/uwuw/inputs_true.dat b/tests/regression_tests/dagmc/uwuw/inputs_true.dat index d7e4a12aa..01082cb23 100644 --- a/tests/regression_tests/dagmc/uwuw/inputs_true.dat +++ b/tests/regression_tests/dagmc/uwuw/inputs_true.dat @@ -3,14 +3,14 @@ - + eigenvalue 100 5 0 - + -4 -4 -4 4 4 4 diff --git a/tests/regression_tests/density/results_true.dat b/tests/regression_tests/density/results_true.dat index c8e3b1ede..42dc0c19f 100644 --- a/tests/regression_tests/density/results_true.dat +++ b/tests/regression_tests/density/results_true.dat @@ -1,2 +1,2 @@ k-combined: -1.110057E+00 1.303260E-02 +1.082191E+00 3.064029E-02 diff --git a/tests/regression_tests/deplete_no_transport/test.py b/tests/regression_tests/deplete_no_transport/test.py index 63ae584e1..5550ad048 100644 --- a/tests/regression_tests/deplete_no_transport/test.py +++ b/tests/regression_tests/deplete_no_transport/test.py @@ -76,6 +76,8 @@ def test_against_self(run_in_tmpdir, dt = [360] # single step # Perform simulation using the predictor algorithm + if config['mpi'] and multiproc: + pytest.skip("Multiprocessing depletion is disabled when MPI is enabled.") openmc.deplete.pool.USE_MULTIPROCESSING = multiproc openmc.deplete.PredictorIntegrator(op, dt, @@ -135,6 +137,8 @@ def test_against_coupled(run_in_tmpdir, dt = [dt] # single step # Perform simulation using the predictor algorithm + if config['mpi'] and multiproc: + pytest.skip("Multiprocessing depletion is disabled when MPI is enabled.") openmc.deplete.pool.USE_MULTIPROCESSING = multiproc openmc.deplete.PredictorIntegrator( op, dt, power=174, timestep_units=time_units).integrate() diff --git a/tests/regression_tests/deplete_no_transport/test_reference_coupled_days.h5 b/tests/regression_tests/deplete_no_transport/test_reference_coupled_days.h5 index 5fdc656d9..9757c9791 100644 Binary files a/tests/regression_tests/deplete_no_transport/test_reference_coupled_days.h5 and b/tests/regression_tests/deplete_no_transport/test_reference_coupled_days.h5 differ diff --git a/tests/regression_tests/deplete_no_transport/test_reference_coupled_hours.h5 b/tests/regression_tests/deplete_no_transport/test_reference_coupled_hours.h5 index 65bfc19a9..08d4d3eed 100644 Binary files a/tests/regression_tests/deplete_no_transport/test_reference_coupled_hours.h5 and b/tests/regression_tests/deplete_no_transport/test_reference_coupled_hours.h5 differ diff --git a/tests/regression_tests/deplete_no_transport/test_reference_coupled_minutes.h5 b/tests/regression_tests/deplete_no_transport/test_reference_coupled_minutes.h5 index 294cb589f..41b5235bb 100644 Binary files a/tests/regression_tests/deplete_no_transport/test_reference_coupled_minutes.h5 and b/tests/regression_tests/deplete_no_transport/test_reference_coupled_minutes.h5 differ diff --git a/tests/regression_tests/deplete_no_transport/test_reference_coupled_months.h5 b/tests/regression_tests/deplete_no_transport/test_reference_coupled_months.h5 index ed62e4610..53d80aff0 100644 Binary files a/tests/regression_tests/deplete_no_transport/test_reference_coupled_months.h5 and b/tests/regression_tests/deplete_no_transport/test_reference_coupled_months.h5 differ diff --git a/tests/regression_tests/deplete_no_transport/test_reference_fission_q.h5 b/tests/regression_tests/deplete_no_transport/test_reference_fission_q.h5 index 9d32d89fe..fe695692d 100644 Binary files a/tests/regression_tests/deplete_no_transport/test_reference_fission_q.h5 and b/tests/regression_tests/deplete_no_transport/test_reference_fission_q.h5 differ diff --git a/tests/regression_tests/deplete_no_transport/test_reference_source_rate.h5 b/tests/regression_tests/deplete_no_transport/test_reference_source_rate.h5 index 3f3b4aa2a..c9c7e9e36 100644 Binary files a/tests/regression_tests/deplete_no_transport/test_reference_source_rate.h5 and b/tests/regression_tests/deplete_no_transport/test_reference_source_rate.h5 differ diff --git a/tests/regression_tests/deplete_with_transfer_rates/ref_depletion_with_ext_source.h5 b/tests/regression_tests/deplete_with_transfer_rates/ref_depletion_with_ext_source.h5 new file mode 100644 index 000000000..2f9951a42 Binary files /dev/null and b/tests/regression_tests/deplete_with_transfer_rates/ref_depletion_with_ext_source.h5 differ diff --git a/tests/regression_tests/deplete_with_transfer_rates/ref_depletion_with_feed.h5 b/tests/regression_tests/deplete_with_transfer_rates/ref_depletion_with_feed.h5 index b9be76345..25ab31041 100644 Binary files a/tests/regression_tests/deplete_with_transfer_rates/ref_depletion_with_feed.h5 and b/tests/regression_tests/deplete_with_transfer_rates/ref_depletion_with_feed.h5 differ diff --git a/tests/regression_tests/deplete_with_transfer_rates/ref_depletion_with_redox.h5 b/tests/regression_tests/deplete_with_transfer_rates/ref_depletion_with_redox.h5 new file mode 100644 index 000000000..c7f002ba1 Binary files /dev/null and b/tests/regression_tests/deplete_with_transfer_rates/ref_depletion_with_redox.h5 differ diff --git a/tests/regression_tests/deplete_with_transfer_rates/ref_depletion_with_removal.h5 b/tests/regression_tests/deplete_with_transfer_rates/ref_depletion_with_removal.h5 index 4b24bed52..c3121a953 100644 Binary files a/tests/regression_tests/deplete_with_transfer_rates/ref_depletion_with_removal.h5 and b/tests/regression_tests/deplete_with_transfer_rates/ref_depletion_with_removal.h5 differ diff --git a/tests/regression_tests/deplete_with_transfer_rates/ref_depletion_with_removal_and_redox.h5 b/tests/regression_tests/deplete_with_transfer_rates/ref_depletion_with_removal_and_redox.h5 new file mode 100644 index 000000000..80ce771fc Binary files /dev/null and b/tests/regression_tests/deplete_with_transfer_rates/ref_depletion_with_removal_and_redox.h5 differ diff --git a/tests/regression_tests/deplete_with_transfer_rates/ref_depletion_with_transfer.h5 b/tests/regression_tests/deplete_with_transfer_rates/ref_depletion_with_transfer.h5 index 51173f778..2a4c227bb 100644 Binary files a/tests/regression_tests/deplete_with_transfer_rates/ref_depletion_with_transfer.h5 and b/tests/regression_tests/deplete_with_transfer_rates/ref_depletion_with_transfer.h5 differ diff --git a/tests/regression_tests/deplete_with_transfer_rates/ref_depletion_with_transfer_and_redox.h5 b/tests/regression_tests/deplete_with_transfer_rates/ref_depletion_with_transfer_and_redox.h5 new file mode 100644 index 000000000..6847fd7df Binary files /dev/null and b/tests/regression_tests/deplete_with_transfer_rates/ref_depletion_with_transfer_and_redox.h5 differ diff --git a/tests/regression_tests/deplete_with_transfer_rates/ref_no_depletion_only_feed.h5 b/tests/regression_tests/deplete_with_transfer_rates/ref_no_depletion_only_feed.h5 index d53adc7d8..af6733340 100644 Binary files a/tests/regression_tests/deplete_with_transfer_rates/ref_no_depletion_only_feed.h5 and b/tests/regression_tests/deplete_with_transfer_rates/ref_no_depletion_only_feed.h5 differ diff --git a/tests/regression_tests/deplete_with_transfer_rates/ref_no_depletion_only_removal.h5 b/tests/regression_tests/deplete_with_transfer_rates/ref_no_depletion_only_removal.h5 index 921755e15..59c65427c 100644 Binary files a/tests/regression_tests/deplete_with_transfer_rates/ref_no_depletion_only_removal.h5 and b/tests/regression_tests/deplete_with_transfer_rates/ref_no_depletion_only_removal.h5 differ diff --git a/tests/regression_tests/deplete_with_transfer_rates/ref_no_depletion_with_ext_source.h5 b/tests/regression_tests/deplete_with_transfer_rates/ref_no_depletion_with_ext_source.h5 new file mode 100644 index 000000000..cceb7fc78 Binary files /dev/null and b/tests/regression_tests/deplete_with_transfer_rates/ref_no_depletion_with_ext_source.h5 differ diff --git a/tests/regression_tests/deplete_with_transfer_rates/ref_no_depletion_with_transfer.h5 b/tests/regression_tests/deplete_with_transfer_rates/ref_no_depletion_with_transfer.h5 index 469149f67..a1c0e5b41 100644 Binary files a/tests/regression_tests/deplete_with_transfer_rates/ref_no_depletion_with_transfer.h5 and b/tests/regression_tests/deplete_with_transfer_rates/ref_no_depletion_with_transfer.h5 differ diff --git a/tests/regression_tests/deplete_with_transfer_rates/test.py b/tests/regression_tests/deplete_with_transfer_rates/test.py index 10d60866a..461287f6e 100644 --- a/tests/regression_tests/deplete_with_transfer_rates/test.py +++ b/tests/regression_tests/deplete_with_transfer_rates/test.py @@ -1,8 +1,7 @@ -""" TransferRates depletion test suite """ +""" ExternalRates depletion test suite """ from pathlib import Path import shutil -import sys import numpy as np import pytest @@ -11,8 +10,7 @@ import openmc.deplete from openmc.deplete import CoupledOperator from tests.regression_tests import config, assert_reaction_rates_equal, \ - assert_atoms_equal, assert_same_mats - + assert_atoms_equal @pytest.fixture def model(): @@ -41,12 +39,13 @@ def model(): geometry = openmc.Geometry([cell_f, cell_w]) settings = openmc.Settings() - settings.particles = 100 + settings.particles = 150 settings.inactive = 0 settings.batches = 10 return openmc.Model(geometry, materials, settings) + @pytest.mark.parametrize("rate, dest_mat, power, ref_result", [ (1e-5, None, 0.0, 'no_depletion_only_removal'), (-1e-5, None, 0.0, 'no_depletion_only_feed'), @@ -54,6 +53,9 @@ def model(): (-1e-5, None, 174.0, 'depletion_with_feed'), (-1e-5, 'w', 0.0, 'no_depletion_with_transfer'), (1e-5, 'w', 174.0, 'depletion_with_transfer'), + (0.0, None, 174.0, 'depletion_with_redox'), + (1e-5, None, 174.0, 'depletion_with_removal_and_redox'), + (1e-5, 'w', 174.0, 'depletion_with_transfer_and_redox'), ]) def test_transfer_rates(run_in_tmpdir, model, rate, dest_mat, power, ref_result): """Tests transfer_rates depletion class with transfer rates""" @@ -61,13 +63,18 @@ def test_transfer_rates(run_in_tmpdir, model, rate, dest_mat, power, ref_result) chain_file = Path(__file__).parents[2] / 'chain_simple.xml' transfer_elements = ['Xe'] + os = {'I': -1, 'Xe':0, 'Cs': 1, 'Gd': 3, 'U': 4} op = CoupledOperator(model, chain_file) op.round_number = True integrator = openmc.deplete.PredictorIntegrator( op, [1], power, timestep_units = 'd') - integrator.add_transfer_rate('f', transfer_elements, rate, - destination_material=dest_mat) + if rate != 0.0: + integrator.add_transfer_rate('f', transfer_elements, rate, + destination_material=dest_mat) + if 'redox' in ref_result.split('_'): + integrator.add_redox('f', {'Gd157':1}, os) + integrator.integrate() # Get path to test and reference results @@ -83,6 +90,39 @@ def test_transfer_rates(run_in_tmpdir, model, rate, dest_mat, power, ref_result) res_ref = openmc.deplete.Results(path_reference) res_test = openmc.deplete.Results(path_test) - assert_same_mats(res_ref, res_test) - assert_atoms_equal(res_ref, res_test, 1e-6) - assert_reaction_rates_equal(res_ref, res_test) + assert_atoms_equal(res_ref, res_test, tol=1e-3) + assert_reaction_rates_equal(res_ref, res_test, tol=1e-3) + +@pytest.mark.parametrize("rate, power, ref_result", [ + (1e-1, 0.0, 'no_depletion_with_ext_source'), + (1e-1, 174., 'depletion_with_ext_source'), +]) +def test_external_source_rates(run_in_tmpdir, model, rate, power, ref_result): + """Tests external_rates depletion class with external source rates""" + + chain_file = Path(__file__).parents[2] / 'chain_simple.xml' + + external_source_vector = {'U': 1} + + op = CoupledOperator(model, chain_file) + op.round_number = True + integrator = openmc.deplete.PredictorIntegrator( + op, [1], power, timestep_units='d') + integrator.add_external_source_rate('f', external_source_vector, rate) + integrator.integrate() + + # Get path to test and reference results + path_test = op.output_dir / 'depletion_results.h5' + path_reference = Path(__file__).with_name(f'ref_{ref_result}.h5') + + # If updating results, do so and return + if config['update']: + shutil.copyfile(str(path_test), str(path_reference)) + return + + # Load the reference/test results + res_ref = openmc.deplete.Results(path_reference) + res_test = openmc.deplete.Results(path_test) + + assert_atoms_equal(res_ref, res_test, tol=1e-3) + assert_reaction_rates_equal(res_ref, res_test, tol=1e-3) diff --git a/tests/regression_tests/deplete_with_transport/last_step_reference_materials.xml b/tests/regression_tests/deplete_with_transport/last_step_reference_materials.xml index f61595dd9..2dca55992 100644 --- a/tests/regression_tests/deplete_with_transport/last_step_reference_materials.xml +++ b/tests/regression_tests/deplete_with_transport/last_step_reference_materials.xml @@ -1,1049 +1,1049 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - + + + diff --git a/tests/regression_tests/deplete_with_transport/test.py b/tests/regression_tests/deplete_with_transport/test.py index 0f7ebf00f..a2be22c56 100644 --- a/tests/regression_tests/deplete_with_transport/test.py +++ b/tests/regression_tests/deplete_with_transport/test.py @@ -65,6 +65,8 @@ def test_full(run_in_tmpdir, problem, multiproc): power = 2.337e15*4*JOULE_PER_EV*1e6 # MeV/second cm from CASMO # Perform simulation using the predictor algorithm + if config['mpi'] and multiproc: + pytest.skip("Multiprocessing depletion is disabled when MPI is enabled.") openmc.deplete.pool.USE_MULTIPROCESSING = multiproc openmc.deplete.PredictorIntegrator(op, dt, power).integrate() diff --git a/tests/regression_tests/deplete_with_transport/test_reference.h5 b/tests/regression_tests/deplete_with_transport/test_reference.h5 index e8478250b..cc616e791 100644 Binary files a/tests/regression_tests/deplete_with_transport/test_reference.h5 and b/tests/regression_tests/deplete_with_transport/test_reference.h5 differ diff --git a/tests/regression_tests/diff_tally/inputs_true.dat b/tests/regression_tests/diff_tally/inputs_true.dat index 3ec4154e8..19356b64a 100644 --- a/tests/regression_tests/diff_tally/inputs_true.dat +++ b/tests/regression_tests/diff_tally/inputs_true.dat @@ -1,40 +1,40 @@ - - - - - - - + + + + + + + - - - - - - + + + + + + - - - - - + + + + + - - - - - + + + + + - + @@ -47,7 +47,7 @@ - + @@ -62,7 +62,7 @@ - + @@ -77,7 +77,7 @@ - + @@ -92,7 +92,7 @@ - + @@ -107,7 +107,7 @@ - + @@ -122,7 +122,7 @@ - + @@ -135,7 +135,7 @@ - + @@ -149,8 +149,8 @@ - - + + @@ -174,9 +174,9 @@ - + - + 1.26 1.26 17 17 @@ -277,30 +277,30 @@ 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + eigenvalue 100 3 0 - + -160 -160 -183 160 160 183 @@ -429,10 +429,10 @@ nu-fission scatter 5 - - - - - + + + + + diff --git a/tests/regression_tests/diff_tally/results_true.dat b/tests/regression_tests/diff_tally/results_true.dat index 14729c821..a88081b7c 100644 --- a/tests/regression_tests/diff_tally/results_true.dat +++ b/tests/regression_tests/diff_tally/results_true.dat @@ -1,27 +1,27 @@ d_material,d_nuclide,d_variable,score,mean,std. dev. -3,,density,flux,-8.7368155e+00,1.5577812e+00 -3,,density,flux,-1.4842625e+01,2.2947682e+00 -1,,density,flux,-2.0922686e-01,4.9935069e-02 -1,,density,flux,-3.4582490e-01,1.7454386e-01 -1,O16,nuclide_density,flux,1.1301782e+01,2.2440389e+01 -1,O16,nuclide_density,flux,3.2481563e+00,3.2342885e+01 -1,U235,nuclide_density,flux,-1.5048665e+03,5.9045681e+02 -1,U235,nuclide_density,flux,-1.6193231e+03,9.7230073e+02 -1,,temperature,flux,-1.0891931e-04,2.3076849e-04 -1,,temperature,flux,-1.3563853e-04,2.0952841e-04 -3,,density,total,-3.9155374e+00,5.4862771e-01 -3,,density,absorption,-4.9210534e-01,3.4700776e-02 -3,,density,scatter,-3.4234320e+00,5.1443821e-01 -3,,density,fission,-3.1088949e-01,8.0540906e-02 -3,,density,nu-fission,-7.6137447e-01,1.9548876e-01 -3,,density,total,-3.8615156e-01,1.0175701e-01 -3,,density,absorption,-3.4458071e-01,9.3381192e-02 -3,,density,scatter,-4.1570854e-02,8.6942039e-03 -3,,density,fission,-2.9864832e-01,8.4711885e-02 -3,,density,nu-fission,-7.2797006e-01,2.0640455e-01 -3,,density,total,1.0491251e+01,9.1787723e+00 -3,,density,absorption,2.9819000e-01,3.0887165e-01 -3,,density,scatter,1.0193061e+01,8.8715930e+00 +3,,density,flux,-9.2822822e+00,1.6880315e+00 +3,,density,flux,-2.0591270e+01,3.0043477e+00 +1,,density,flux,-2.9765141e-01,5.2949290e-02 +1,,density,flux,-4.0095723e-01,1.1716168e-01 +1,O16,nuclide_density,flux,-1.4245069e+01,6.3028710e+00 +1,O16,nuclide_density,flux,-2.5098326e+01,5.7525657e+00 +1,U235,nuclide_density,flux,-2.1513560e+03,6.7234014e+02 +1,U235,nuclide_density,flux,-2.4222736e+03,7.7715656e+02 +1,,temperature,flux,-1.1242141e-04,8.1692839e-05 +1,,temperature,flux,6.1357500e-06,7.4812624e-05 +3,,density,total,-4.2880614e+00,7.0021512e-01 +3,,density,absorption,-5.0324695e-01,4.9079615e-02 +3,,density,scatter,-3.7848144e+00,6.5868388e-01 +3,,density,fission,-2.7732455e-01,6.4647487e-02 +3,,density,nu-fission,-6.7990282e-01,1.5692707e-01 +3,,density,total,-3.8043572e-01,9.6222860e-02 +3,,density,absorption,-3.3518262e-01,8.6810436e-02 +3,,density,scatter,-4.5253106e-02,9.5205809e-03 +3,,density,fission,-2.6400028e-01,6.8175997e-02 +3,,density,nu-fission,-6.4353897e-01,1.6613026e-01 +3,,density,total,-3.2070285e-01,2.8328990e+00 +3,,density,absorption,2.5921007e-02,2.2141808e-02 +3,,density,scatter,-3.4662385e-01,2.8171749e+00 3,,density,fission,0.0000000e+00,0.0000000e+00 3,,density,nu-fission,0.0000000e+00,0.0000000e+00 3,,density,total,0.0000000e+00,0.0000000e+00 @@ -29,19 +29,19 @@ d_material,d_nuclide,d_variable,score,mean,std. dev. 3,,density,scatter,0.0000000e+00,0.0000000e+00 3,,density,fission,0.0000000e+00,0.0000000e+00 3,,density,nu-fission,0.0000000e+00,0.0000000e+00 -1,,density,total,4.7128871e-01,5.7197095e-02 -1,,density,absorption,2.1981833e-02,1.7427232e-02 -1,,density,scatter,4.4930687e-01,4.0030120e-02 -1,,density,fission,6.0712328e-03,1.3719512e-02 -1,,density,nu-fission,1.5474650e-02,3.3437103e-02 -1,,density,total,1.2203418e-02,1.5798741e-02 -1,,density,absorption,7.0228085e-03,1.5294984e-02 -1,,density,scatter,5.1806097e-03,5.0807003e-04 -1,,density,fission,4.1074923e-03,1.3759608e-02 -1,,density,nu-fission,1.0046778e-02,3.3529881e-02 -1,,density,total,-5.2100220e-01,2.7618985e-01 -1,,density,absorption,-1.1039048e-02,6.2043549e-03 -1,,density,scatter,-5.0996315e-01,2.7027892e-01 +1,,density,total,4.0321800e-01,3.5365140e-02 +1,,density,absorption,4.8426976e-03,8.3784362e-03 +1,,density,scatter,3.9837530e-01,2.9076664e-02 +1,,density,fission,-5.4793062e-03,7.1720201e-03 +1,,density,nu-fission,-1.2481616e-02,1.7542625e-02 +1,,density,total,-3.6063021e-03,7.1950060e-03 +1,,density,absorption,-8.2666439e-03,6.9274342e-03 +1,,density,scatter,4.6603417e-03,4.1803496e-04 +1,,density,fission,-7.6315741e-03,7.1774359e-03 +1,,density,nu-fission,-1.8551295e-02,1.7493106e-02 +1,,density,total,-6.2852725e-01,1.9776006e-01 +1,,density,absorption,-1.4850233e-02,4.3086611e-03 +1,,density,scatter,-6.1367701e-01,1.9363188e-01 1,,density,fission,0.0000000e+00,0.0000000e+00 1,,density,nu-fission,0.0000000e+00,0.0000000e+00 1,,density,total,0.0000000e+00,0.0000000e+00 @@ -49,19 +49,19 @@ d_material,d_nuclide,d_variable,score,mean,std. dev. 1,,density,scatter,0.0000000e+00,0.0000000e+00 1,,density,fission,0.0000000e+00,0.0000000e+00 1,,density,nu-fission,0.0000000e+00,0.0000000e+00 -1,O16,nuclide_density,total,5.5744608e+01,1.3811361e+01 -1,O16,nuclide_density,absorption,2.1284059e+00,3.3353171e+00 -1,O16,nuclide_density,scatter,5.3616202e+01,1.0494347e+01 -1,O16,nuclide_density,fission,6.6058671e-01,1.9263932e+00 -1,O16,nuclide_density,nu-fission,1.5973305e+00,4.6977280e+00 -1,O16,nuclide_density,total,9.8433784e-01,2.4053581e+00 -1,O16,nuclide_density,absorption,9.1167507e-01,2.2565683e+00 -1,O16,nuclide_density,scatter,7.2662768e-02,1.5198625e-01 -1,O16,nuclide_density,fission,6.8845700e-01,1.9451444e+00 -1,O16,nuclide_density,nu-fission,1.6768628e+00,4.7395897e+00 -1,O16,nuclide_density,total,8.1604245e+00,3.7248338e+01 -1,O16,nuclide_density,absorption,2.4903834e-01,4.5609671e-01 -1,O16,nuclide_density,scatter,7.9113862e+00,3.6811434e+01 +1,O16,nuclide_density,total,4.2608989e+01,2.6322158e+00 +1,O16,nuclide_density,absorption,-5.9877963e-01,4.2139216e-01 +1,O16,nuclide_density,scatter,4.3207769e+01,2.5312922e+00 +1,O16,nuclide_density,fission,-9.2838585e-01,4.3505041e-01 +1,O16,nuclide_density,nu-fission,-2.2834786e+00,1.0634300e+00 +1,O16,nuclide_density,total,-1.1195412e+00,3.3033730e-01 +1,O16,nuclide_density,absorption,-1.0650267e+00,3.2780477e-01 +1,O16,nuclide_density,scatter,-5.4514540e-02,2.4911965e-02 +1,O16,nuclide_density,fission,-8.6787386e-01,4.4270048e-01 +1,O16,nuclide_density,nu-fission,-2.1159252e+00,1.0787495e+00 +1,O16,nuclide_density,total,-3.1004750e+01,8.0776339e+00 +1,O16,nuclide_density,absorption,-5.0354237e-01,2.6144390e-01 +1,O16,nuclide_density,scatter,-3.0501208e+01,7.8176703e+00 1,O16,nuclide_density,fission,0.0000000e+00,0.0000000e+00 1,O16,nuclide_density,nu-fission,0.0000000e+00,0.0000000e+00 1,O16,nuclide_density,total,0.0000000e+00,0.0000000e+00 @@ -69,19 +69,19 @@ d_material,d_nuclide,d_variable,score,mean,std. dev. 1,O16,nuclide_density,scatter,0.0000000e+00,0.0000000e+00 1,O16,nuclide_density,fission,0.0000000e+00,0.0000000e+00 1,O16,nuclide_density,nu-fission,0.0000000e+00,0.0000000e+00 -1,U235,nuclide_density,total,-2.8654443e+02,3.3721470e+02 -1,U235,nuclide_density,absorption,2.0329180e+02,1.0522263e+02 -1,U235,nuclide_density,scatter,-4.8983623e+02,2.3237977e+02 -1,U235,nuclide_density,fission,2.6089045e+02,7.2578344e+01 -1,U235,nuclide_density,nu-fission,6.3692044e+02,1.7710877e+02 -1,U235,nuclide_density,total,4.5611633e+02,9.1682367e+01 -1,U235,nuclide_density,absorption,3.3831545e+02,8.5035501e+01 -1,U235,nuclide_density,scatter,1.1780088e+02,7.4128809e+00 -1,U235,nuclide_density,fission,2.6094461e+02,7.2102445e+01 -1,U235,nuclide_density,nu-fission,6.3705705e+02,1.7578950e+02 -1,U235,nuclide_density,total,-4.1342174e+03,1.4666097e+03 -1,U235,nuclide_density,absorption,-1.1329170e+02,3.5066579e+01 -1,U235,nuclide_density,scatter,-4.0209257e+03,1.4320401e+03 +1,U235,nuclide_density,total,-5.3578869e+02,3.4044374e+02 +1,U235,nuclide_density,absorption,2.0769087e+02,1.0873543e+02 +1,U235,nuclide_density,scatter,-7.4347956e+02,2.5966153e+02 +1,U235,nuclide_density,fission,2.8982867e+02,8.5348425e+01 +1,U235,nuclide_density,nu-fission,7.0772332e+02,2.0847449e+02 +1,U235,nuclide_density,total,4.8356107e+02,1.0276621e+02 +1,U235,nuclide_density,absorption,3.6683548e+02,9.6924085e+01 +1,U235,nuclide_density,scatter,1.1672558e+02,6.1773010e+00 +1,U235,nuclide_density,fission,2.8941699e+02,8.4475937e+01 +1,U235,nuclide_density,nu-fission,7.0639136e+02,2.0594285e+02 +1,U235,nuclide_density,total,-4.6777522e+03,1.5037171e+03 +1,U235,nuclide_density,absorption,-1.1585081e+02,3.8299177e+01 +1,U235,nuclide_density,scatter,-4.5619014e+03,1.4660078e+03 1,U235,nuclide_density,fission,0.0000000e+00,0.0000000e+00 1,U235,nuclide_density,nu-fission,0.0000000e+00,0.0000000e+00 1,U235,nuclide_density,total,0.0000000e+00,0.0000000e+00 @@ -89,19 +89,19 @@ d_material,d_nuclide,d_variable,score,mean,std. dev. 1,U235,nuclide_density,scatter,0.0000000e+00,0.0000000e+00 1,U235,nuclide_density,fission,0.0000000e+00,0.0000000e+00 1,U235,nuclide_density,nu-fission,0.0000000e+00,0.0000000e+00 -1,,temperature,total,5.3733744e-05,1.1785516e-04 -1,,temperature,absorption,-1.3987780e-05,1.9819801e-05 -1,,temperature,scatter,6.7721524e-05,9.9934995e-05 -1,,temperature,fission,-1.4882696e-05,1.6930666e-05 -1,,temperature,nu-fission,-3.6272065e-05,4.1250892e-05 -1,,temperature,total,-1.8119796e-05,2.2651409e-05 -1,,temperature,absorption,-1.7632076e-05,2.1825006e-05 -1,,temperature,scatter,-4.8771972e-07,1.4270133e-06 -1,,temperature,fission,-1.4890811e-05,1.6935899e-05 -1,,temperature,nu-fission,-3.6292215e-05,4.1263951e-05 -1,,temperature,total,-2.0776498e-04,2.9286552e-04 -1,,temperature,absorption,-3.9068381e-06,3.4912438e-06 -1,,temperature,scatter,-2.0385814e-04,2.8941307e-04 +1,,temperature,total,8.2134941e-05,1.3941434e-05 +1,,temperature,absorption,4.1502002e-05,3.5967068e-05 +1,,temperature,scatter,4.0632939e-05,2.6595574e-05 +1,,temperature,fission,3.1768469e-06,2.1582455e-05 +1,,temperature,nu-fission,7.7368345e-06,5.2593375e-05 +1,,temperature,total,1.0834099e-06,2.6707333e-05 +1,,temperature,absorption,1.6240165e-06,2.6844372e-05 +1,,temperature,scatter,-5.4060665e-07,2.5905412e-07 +1,,temperature,fission,3.1674458e-06,2.1588836e-05 +1,,temperature,nu-fission,7.7134913e-06,5.2609321e-05 +1,,temperature,total,9.5175179e-05,1.0549922e-04 +1,,temperature,absorption,4.3553888e-06,2.9261613e-06 +1,,temperature,scatter,9.0819790e-05,1.0362538e-04 1,,temperature,fission,0.0000000e+00,0.0000000e+00 1,,temperature,nu-fission,0.0000000e+00,0.0000000e+00 1,,temperature,total,0.0000000e+00,0.0000000e+00 @@ -109,68 +109,68 @@ d_material,d_nuclide,d_variable,score,mean,std. dev. 1,,temperature,scatter,0.0000000e+00,0.0000000e+00 1,,temperature,fission,0.0000000e+00,0.0000000e+00 1,,temperature,nu-fission,0.0000000e+00,0.0000000e+00 -3,,density,absorption,-4.5579543e-01,5.5532252e-02 -3,,density,absorption,-1.3526251e-02,1.3917291e-01 -1,,density,absorption,3.8695654e-02,1.5823093e-02 -1,,density,absorption,-1.8171150e-02,1.2999773e-03 -1,O16,nuclide_density,absorption,2.0992238e+00,2.7230754e+00 -1,O16,nuclide_density,absorption,-6.8956953e-01,3.3064989e-01 -1,U235,nuclide_density,absorption,2.5000417e+02,7.3334295e+01 -1,U235,nuclide_density,absorption,-1.0832917e+02,1.1517513e+01 -1,,temperature,absorption,1.1819459e-05,4.2090670e-05 -1,,temperature,absorption,-7.2302974e-06,1.5200299e-05 +3,,density,absorption,-5.4897740e-01,8.6529144e-02 +3,,density,absorption,1.3410763e-01,5.6235628e-02 +1,,density,absorption,2.9551566e-02,1.5215007e-02 +1,,density,absorption,-8.6382033e-03,5.5181454e-03 +1,O16,nuclide_density,absorption,2.7111116e-01,9.6922067e-01 +1,O16,nuclide_density,absorption,-7.3785997e-01,7.7252792e-01 +1,U235,nuclide_density,absorption,2.7361252e+02,1.6168134e+02 +1,U235,nuclide_density,absorption,-9.6885408e+01,1.9390948e+01 +1,,temperature,absorption,1.0054736e-05,4.2876538e-05 +1,,temperature,absorption,-1.8280609e-06,1.0133065e-05 3,,density,nu-fission,0.0000000e+00,0.0000000e+00 -3,,density,scatter,-7.6858714e-01,3.2467801e-01 +3,,density,scatter,-5.4273849e-01,1.8081153e-01 3,,density,nu-fission,0.0000000e+00,0.0000000e+00 -3,,density,scatter,3.2513857e-04,3.2513857e-04 -3,,density,nu-fission,-6.4963717e-01,1.8008086e-01 -3,,density,scatter,-2.6911548e+00,2.6336008e-01 -3,,density,nu-fission,-6.3014524e-01,1.8056453e-01 -3,,density,scatter,-3.4247012e-02,2.2649385e-02 +3,,density,scatter,1.3451827e-02,7.2870304e-03 +3,,density,nu-fission,-8.4200508e-01,3.4267126e-01 +3,,density,scatter,-3.1963455e+00,5.0369564e-01 +3,,density,nu-fission,-8.2934702e-01,3.4526131e-01 +3,,density,scatter,-7.0221960e-02,6.8067882e-02 3,,density,nu-fission,0.0000000e+00,0.0000000e+00 -3,,density,scatter,1.0254549e+01,1.1054242e+01 +3,,density,scatter,1.1368387e+00,1.2091778e+00 3,,density,nu-fission,0.0000000e+00,0.0000000e+00 3,,density,scatter,0.0000000e+00,0.0000000e+00 3,,density,nu-fission,0.0000000e+00,0.0000000e+00 -3,,density,scatter,2.5022850e-01,2.1207285e+00 +3,,density,scatter,-1.5916491e+00,2.3551913e+00 3,,density,nu-fission,0.0000000e+00,0.0000000e+00 3,,density,scatter,0.0000000e+00,0.0000000e+00 1,,density,nu-fission,0.0000000e+00,0.0000000e+00 -1,,density,scatter,8.1153611e-03,3.1226564e-02 +1,,density,scatter,-1.8655633e-03,2.4061808e-02 1,,density,nu-fission,0.0000000e+00,0.0000000e+00 -1,,density,scatter,2.3728497e-04,9.7166041e-04 -1,,density,nu-fission,2.6248459e-02,3.9328080e-02 -1,,density,scatter,4.2447769e-01,1.2580873e-02 -1,,density,nu-fission,1.9600074e-02,3.8118776e-02 -1,,density,scatter,8.0978391e-03,2.6585488e-03 +1,,density,scatter,-1.7672807e-04,7.4702879e-04 +1,,density,nu-fission,4.4506944e-03,3.1478180e-02 +1,,density,scatter,3.7553200e-01,2.3420342e-02 +1,,density,nu-fission,-1.3567324e-03,3.0610901e-02 +1,,density,scatter,6.9330560e-03,4.6649873e-03 1,,density,nu-fission,0.0000000e+00,0.0000000e+00 -1,,density,scatter,-3.8358302e-01,2.1525401e-01 +1,,density,scatter,-5.1560927e-01,1.4846253e-01 1,,density,nu-fission,0.0000000e+00,0.0000000e+00 1,,density,scatter,0.0000000e+00,0.0000000e+00 1,,density,nu-fission,0.0000000e+00,0.0000000e+00 -1,,density,scatter,-1.1924803e-01,9.1254221e-02 +1,,density,scatter,-1.0427977e-01,6.6396271e-02 1,,density,nu-fission,0.0000000e+00,0.0000000e+00 1,,density,scatter,0.0000000e+00,0.0000000e+00 1,O16,nuclide_density,nu-fission,0.0000000e+00,0.0000000e+00 -1,O16,nuclide_density,scatter,-1.6577061e-01,1.0793192e-01 -1,O16,nuclide_density,nu-fission,2.4995074e+00,5.7946039e+00 -1,O16,nuclide_density,scatter,5.5800956e-01,5.7675606e-01 +1,O16,nuclide_density,scatter,4.6587151e-02,9.0232672e-02 +1,O16,nuclide_density,nu-fission,-2.1162226e+00,2.4773842e+00 +1,O16,nuclide_density,scatter,6.6533325e-01,2.4693113e-01 1,O16,nuclide_density,nu-fission,0.0000000e+00,0.0000000e+00 1,O16,nuclide_density,scatter,0.0000000e+00,0.0000000e+00 1,O16,nuclide_density,nu-fission,0.0000000e+00,0.0000000e+00 1,O16,nuclide_density,scatter,0.0000000e+00,0.0000000e+00 1,U235,nuclide_density,nu-fission,0.0000000e+00,0.0000000e+00 -1,U235,nuclide_density,scatter,5.8641633e+00,2.9488422e+00 -1,U235,nuclide_density,nu-fission,6.7444160e+02,1.1308014e+02 -1,U235,nuclide_density,scatter,1.1592472e+02,2.8886339e+01 +1,U235,nuclide_density,scatter,2.8979849e+01,2.0235325e+01 +1,U235,nuclide_density,nu-fission,8.1210341e+02,2.9252040e+02 +1,U235,nuclide_density,scatter,1.0307302e+02,4.4919960e+01 1,U235,nuclide_density,nu-fission,0.0000000e+00,0.0000000e+00 1,U235,nuclide_density,scatter,0.0000000e+00,0.0000000e+00 1,U235,nuclide_density,nu-fission,0.0000000e+00,0.0000000e+00 1,U235,nuclide_density,scatter,0.0000000e+00,0.0000000e+00 1,,temperature,nu-fission,0.0000000e+00,0.0000000e+00 -1,,temperature,scatter,-7.7511866e-07,6.4761261e-07 -1,,temperature,nu-fission,-9.5466386e-05,3.1033330e-05 -1,,temperature,scatter,-2.7127084e-06,2.0699253e-07 +1,,temperature,scatter,-3.3782154e-06,3.8240314e-06 +1,,temperature,nu-fission,-6.8920903e-05,4.4384761e-05 +1,,temperature,scatter,1.6325729e-07,2.3270228e-06 1,,temperature,nu-fission,0.0000000e+00,0.0000000e+00 1,,temperature,scatter,0.0000000e+00,0.0000000e+00 1,,temperature,nu-fission,0.0000000e+00,0.0000000e+00 diff --git a/tests/regression_tests/distribmat/inputs_true.dat b/tests/regression_tests/distribmat/inputs_true.dat index ade86999d..35b3b5b9f 100644 --- a/tests/regression_tests/distribmat/inputs_true.dat +++ b/tests/regression_tests/distribmat/inputs_true.dat @@ -2,24 +2,24 @@ - - - + + + - - - + + + - - - + + + - + 2.0 2.0 1 @@ -29,30 +29,30 @@ 11 11 11 11 - - - - - + + + + + eigenvalue 1000 5 0 - + -1 -1 -1 1 1 1 - + 400 400 0 0 0 7 7 - + 400 400 0 0 0 7 7 diff --git a/tests/regression_tests/distribmat/results_true.dat b/tests/regression_tests/distribmat/results_true.dat index af7b27fe7..166fd4662 100644 --- a/tests/regression_tests/distribmat/results_true.dat +++ b/tests/regression_tests/distribmat/results_true.dat @@ -1,5 +1,5 @@ k-combined: -1.257344E+00 6.246360E-04 +1.246391E+00 1.414798E-02 Cell ID = 11 Name = diff --git a/tests/regression_tests/distribmat/test.py b/tests/regression_tests/distribmat/test.py index 02f7e773e..dd09eec36 100644 --- a/tests/regression_tests/distribmat/test.py +++ b/tests/regression_tests/distribmat/test.py @@ -73,7 +73,7 @@ class DistribmatTestHarness(PyAPITestHarness): # Plots #################### - plot1 = openmc.Plot(plot_id=1) + plot1 = openmc.SlicePlot(plot_id=1) plot1.basis = 'xy' plot1.color_by = 'cell' plot1.filename = 'cellplot' @@ -81,7 +81,7 @@ class DistribmatTestHarness(PyAPITestHarness): plot1.width = (7, 7) plot1.pixels = (400, 400) - plot2 = openmc.Plot(plot_id=2) + plot2 = openmc.SlicePlot(plot_id=2) plot2.basis = 'xy' plot2.color_by = 'material' plot2.filename = 'matplot' diff --git a/tests/regression_tests/eigenvalue_genperbatch/inputs_true.dat b/tests/regression_tests/eigenvalue_genperbatch/inputs_true.dat index a3e67d62f..15b810a62 100644 --- a/tests/regression_tests/eigenvalue_genperbatch/inputs_true.dat +++ b/tests/regression_tests/eigenvalue_genperbatch/inputs_true.dat @@ -1,14 +1,14 @@ - - - + + + - + eigenvalue @@ -16,7 +16,7 @@ 7 3 3 - + -4.0 -4.0 -4.0 4.0 4.0 4.0 diff --git a/tests/regression_tests/eigenvalue_genperbatch/results_true.dat b/tests/regression_tests/eigenvalue_genperbatch/results_true.dat index 3f7ea801a..d171c5e87 100644 --- a/tests/regression_tests/eigenvalue_genperbatch/results_true.dat +++ b/tests/regression_tests/eigenvalue_genperbatch/results_true.dat @@ -1,5 +1,5 @@ k-combined: -3.037481E-01 1.247474E-04 +2.975937E-01 1.293390E-03 tally 1: -3.211129E+01 -2.578396E+02 +3.173222E+01 +2.517683E+02 diff --git a/tests/regression_tests/eigenvalue_no_inactive/results_true.dat b/tests/regression_tests/eigenvalue_no_inactive/results_true.dat index 2b1021608..3ba7485a9 100644 --- a/tests/regression_tests/eigenvalue_no_inactive/results_true.dat +++ b/tests/regression_tests/eigenvalue_no_inactive/results_true.dat @@ -1,2 +1,2 @@ k-combined: -2.998284E-01 7.587782E-03 +3.072780E-01 6.882841E-03 diff --git a/tests/regression_tests/electron_heating/__init__.py b/tests/regression_tests/electron_heating/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/regression_tests/electron_heating/inputs_true.dat b/tests/regression_tests/electron_heating/inputs_true.dat new file mode 100644 index 000000000..ec8e5a837 --- /dev/null +++ b/tests/regression_tests/electron_heating/inputs_true.dat @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + fixed source + 10000 + 1 + + + 10000000.0 1.0 + + + + 1000.0 + + + + + heating + + + diff --git a/tests/regression_tests/electron_heating/results_true.dat b/tests/regression_tests/electron_heating/results_true.dat new file mode 100644 index 000000000..4f54ceaa4 --- /dev/null +++ b/tests/regression_tests/electron_heating/results_true.dat @@ -0,0 +1,3 @@ +tally 1: +1.000000E+07 +1.000000E+14 diff --git a/tests/regression_tests/electron_heating/test.py b/tests/regression_tests/electron_heating/test.py new file mode 100644 index 000000000..e7a58560c --- /dev/null +++ b/tests/regression_tests/electron_heating/test.py @@ -0,0 +1,40 @@ +import pytest +import openmc + +from tests.testing_harness import PyAPITestHarness + + +@pytest.fixture +def water_model(): + # Define materals and geometry + water = openmc.Material() + water.add_nuclide("H1", 2.0) + water.add_nuclide("O16", 1.0) + water.set_density("g/cc", 1.0) + sphere = openmc.Sphere(r=1.0, boundary_type="reflective") + sph = openmc.Cell(fill=water, region=-sphere) + geometry = openmc.Geometry([sph]) + source = openmc.IndependentSource( + energy=openmc.stats.delta_function(10.0e6), + particle="electron" + ) + + # Define settings + settings = openmc.Settings() + settings.particles = 10000 + settings.batches = 1 + settings.cutoff = {"energy_photon": 1000.0} + settings.run_mode = "fixed source" + settings.source = source + + # Define tallies + tally = openmc.Tally() + tally.scores = ["heating"] + tallies = openmc.Tallies([tally]) + + return openmc.Model(geometry=geometry, settings=settings, tallies=tallies) + + +def test_electron_heating_calc(water_model): + harness = PyAPITestHarness("statepoint.1.h5", water_model) + harness.main() diff --git a/tests/regression_tests/energy_cutoff/inputs_true.dat b/tests/regression_tests/energy_cutoff/inputs_true.dat index af8f86b67..557cb7a3b 100644 --- a/tests/regression_tests/energy_cutoff/inputs_true.dat +++ b/tests/regression_tests/energy_cutoff/inputs_true.dat @@ -2,28 +2,28 @@ - - + + - - - - - - - + + + + + + + fixed source 100 10 - + -1 -1 -1 1 1 1 - + 4.0 diff --git a/tests/regression_tests/energy_grid/results_true.dat b/tests/regression_tests/energy_grid/results_true.dat index deab1e28b..3a042d882 100644 --- a/tests/regression_tests/energy_grid/results_true.dat +++ b/tests/regression_tests/energy_grid/results_true.dat @@ -1,2 +1,2 @@ k-combined: -3.152586E-01 1.458068E-03 +3.218009E-01 4.687417E-03 diff --git a/tests/regression_tests/energy_laws/inputs_true.dat b/tests/regression_tests/energy_laws/inputs_true.dat index 4d8e825d1..8c5191217 100644 --- a/tests/regression_tests/energy_laws/inputs_true.dat +++ b/tests/regression_tests/energy_laws/inputs_true.dat @@ -1,18 +1,18 @@ - - - - - - - + + + + + + + - + eigenvalue diff --git a/tests/regression_tests/energy_laws/results_true.dat b/tests/regression_tests/energy_laws/results_true.dat index 534a299b5..780278683 100644 --- a/tests/regression_tests/energy_laws/results_true.dat +++ b/tests/regression_tests/energy_laws/results_true.dat @@ -1,2 +1,2 @@ k-combined: -2.444000E+00 1.044626E-02 +2.458770E+00 9.422203E-03 diff --git a/tests/regression_tests/entropy/results_true.dat b/tests/regression_tests/entropy/results_true.dat index 1c8b2908b..92d7f091d 100644 --- a/tests/regression_tests/entropy/results_true.dat +++ b/tests/regression_tests/entropy/results_true.dat @@ -1,13 +1,13 @@ k-combined: -3.070134E-01 3.900396E-03 +2.940336E-01 7.338463E-04 entropy: 7.688862E+00 -8.237960E+00 -8.314772E+00 -8.285254E+00 -8.271486E+00 -8.291355E+00 -8.253349E+00 -8.336726E+00 -8.284741E+00 -8.328102E+00 +8.226316E+00 +8.308355E+00 +8.243413E+00 +8.369345E+00 +8.304865E+00 +8.230689E+00 +8.338304E+00 +8.270630E+00 +8.386598E+00 diff --git a/tests/regression_tests/external_moab/inputs_true.dat b/tests/regression_tests/external_moab/inputs_true.dat index 23b656bce..ed035f897 100644 --- a/tests/regression_tests/external_moab/inputs_true.dat +++ b/tests/regression_tests/external_moab/inputs_true.dat @@ -1,63 +1,63 @@ - - - + + + - - - - - - + + + + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + fixed source 100 10 - + 0.0 0.0 0.0 - + 15000000.0 1.0 - + test_mesh_tets.h5m diff --git a/tests/regression_tests/external_moab/test.py b/tests/regression_tests/external_moab/test.py index ce4e78a2c..2d64eb14b 100644 --- a/tests/regression_tests/external_moab/test.py +++ b/tests/regression_tests/external_moab/test.py @@ -39,7 +39,7 @@ def cpp_driver(request): target_link_libraries(main OpenMC::libopenmc) target_compile_features(main PUBLIC cxx_std_14) set(CMAKE_CXX_FLAGS "-pedantic-errors") - add_compile_definitions(DAGMC=1) + add_compile_definitions(OPENMC_DAGMC_ENABLED=1) """.format(openmc_dir))) # Create temporary build directory and change to there diff --git a/tests/regression_tests/filter_cellfrom/inputs_true.dat b/tests/regression_tests/filter_cellfrom/inputs_true.dat index b85f63c6e..20d0d69d4 100644 --- a/tests/regression_tests/filter_cellfrom/inputs_true.dat +++ b/tests/regression_tests/filter_cellfrom/inputs_true.dat @@ -1,54 +1,54 @@ - - - - - - - + + + + + + + - - - + + + - - - - - + + + + + - + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + eigenvalue 2000 15 5 - + -2.0 -2.0 -2.0 2.0 2.0 2.0 diff --git a/tests/regression_tests/filter_cellfrom/results_true.dat b/tests/regression_tests/filter_cellfrom/results_true.dat index 5dd43e1f3..408a4965b 100644 --- a/tests/regression_tests/filter_cellfrom/results_true.dat +++ b/tests/regression_tests/filter_cellfrom/results_true.dat @@ -1,53 +1,53 @@ k-combined: -9.640806E-02 2.655206E-03 +9.035025E-02 2.654309E-03 tally 1: -6.025999E+00 -3.635317E+00 +5.994069E+00 +3.594398E+00 tally 2: -4.523606E-04 -2.051522E-08 +4.559707E-04 +2.080739E-08 tally 3: -6.026452E+00 -3.635862E+00 +5.994525E+00 +3.594945E+00 tally 4: 0.000000E+00 0.000000E+00 tally 5: -1.530903E+00 -2.357048E-01 +1.473892E+00 +2.187509E-01 tally 6: -4.992646E-05 -2.600391E-10 +5.223875E-05 +2.992861E-10 tally 7: -1.530953E+00 -2.357201E-01 +1.473945E+00 +2.187663E-01 tally 8: -1.889115E+01 -3.574727E+01 +1.885798E+01 +3.558423E+01 tally 9: -7.556902E+00 -5.717680E+00 +7.467961E+00 +5.580255E+00 tally 10: -5.022871E-04 -2.531352E-08 +5.082094E-04 +2.584432E-08 tally 11: -7.557405E+00 -5.718440E+00 +7.468470E+00 +5.581014E+00 tally 12: -1.889115E+01 -3.574727E+01 +1.885798E+01 +3.558423E+01 tally 13: 0.000000E+00 0.000000E+00 tally 14: -2.663407E-04 -7.161725E-09 +2.739543E-04 +7.600983E-09 tally 15: -2.663407E-04 -7.161725E-09 +2.739543E-04 +7.600983E-09 tally 16: -8.025710E+01 -6.459305E+02 +7.881296E+01 +6.221087E+02 tally 17: -1.067059E+02 -1.140939E+03 +1.051397E+02 +1.106292E+03 diff --git a/tests/regression_tests/filter_cellinstance/inputs_true.dat b/tests/regression_tests/filter_cellinstance/inputs_true.dat index b17cc0eb5..2677d7ad2 100644 --- a/tests/regression_tests/filter_cellinstance/inputs_true.dat +++ b/tests/regression_tests/filter_cellinstance/inputs_true.dat @@ -1,22 +1,22 @@ - - - + + + - - + + - + - + 2 2 4 4 @@ -27,19 +27,19 @@ 3 3 2 3 3 3 3 2 - - - - - - + + + + + + eigenvalue 1000 5 0 - + 0.0 0.0 0.0 diff --git a/tests/regression_tests/filter_cellinstance/results_true.dat b/tests/regression_tests/filter_cellinstance/results_true.dat index 079b7d3d2..152986595 100644 --- a/tests/regression_tests/filter_cellinstance/results_true.dat +++ b/tests/regression_tests/filter_cellinstance/results_true.dat @@ -1,84 +1,84 @@ k-combined: -1.050139E+00 1.886614E-02 +1.097679E+00 8.074294E-03 tally 1: -9.724996E-02 -2.784804E-03 -1.146976E-01 -3.173782E-03 -1.698297E-01 -6.569993E-03 -1.158802E-01 -2.959280E-03 -2.533354E-01 -1.539905E-02 -1.908717E-01 -8.360058E-03 -1.738899E-01 -6.713494E-03 -3.172247E-01 -2.124184E-02 -1.363012E-01 -4.653519E-03 -1.698720E-01 -6.753819E-03 -9.934671E-02 -2.371660E-03 -6.038075E-02 -1.204656E-03 -1.038793E+01 -2.590382E+01 -2.841397E+01 -1.865709E+02 -2.786916E+01 -1.923869E+02 -1.085149E+01 -2.907194E+01 -1.038793E+01 -2.590382E+01 -2.841397E+01 -1.865709E+02 -2.786916E+01 -1.923869E+02 -1.085149E+01 -2.907194E+01 +7.125168E-02 +1.412152E-03 +1.254059E-01 +4.145686E-03 +1.609454E-01 +6.174116E-03 +1.444278E-01 +4.523981E-03 +3.363588E-01 +2.342988E-02 +1.751677E-01 +7.108034E-03 +1.384074E-01 +3.949804E-03 +2.856450E-01 +1.824185E-02 +9.680810E-02 +2.256338E-03 +1.691663E-01 +6.456530E-03 +1.160968E-01 +3.233815E-03 +7.334131E-02 +1.456688E-03 +1.168548E+01 +3.210924E+01 +2.860162E+01 +1.876786E+02 +2.857267E+01 +1.996553E+02 +1.050245E+01 +2.569953E+01 +1.168548E+01 +3.210924E+01 +2.860162E+01 +1.876786E+02 +2.857267E+01 +1.996553E+02 +1.050245E+01 +2.569953E+01 tally 2: -1.085149E+01 -2.907194E+01 -2.786916E+01 -1.923869E+02 -2.841397E+01 -1.865709E+02 -1.038793E+01 -2.590382E+01 -1.085149E+01 -2.907194E+01 -2.786916E+01 -1.923869E+02 -2.841397E+01 -1.865709E+02 -1.038793E+01 -2.590382E+01 -6.038075E-02 -1.204656E-03 -9.934671E-02 -2.371660E-03 -1.698720E-01 -6.753819E-03 -1.363012E-01 -4.653519E-03 -3.172247E-01 -2.124184E-02 -1.738899E-01 -6.713494E-03 -1.908717E-01 -8.360058E-03 -2.533354E-01 -1.539905E-02 -1.158802E-01 -2.959280E-03 -1.698297E-01 -6.569993E-03 -1.146976E-01 -3.173782E-03 -9.724996E-02 -2.784804E-03 +1.050245E+01 +2.569953E+01 +2.857267E+01 +1.996553E+02 +2.860162E+01 +1.876786E+02 +1.168548E+01 +3.210924E+01 +1.050245E+01 +2.569953E+01 +2.857267E+01 +1.996553E+02 +2.860162E+01 +1.876786E+02 +1.168548E+01 +3.210924E+01 +7.334131E-02 +1.456688E-03 +1.160968E-01 +3.233815E-03 +1.691663E-01 +6.456530E-03 +9.680810E-02 +2.256338E-03 +2.856450E-01 +1.824185E-02 +1.384074E-01 +3.949804E-03 +1.751677E-01 +7.108034E-03 +3.363588E-01 +2.342988E-02 +1.444278E-01 +4.523981E-03 +1.609454E-01 +6.174116E-03 +1.254059E-01 +4.145686E-03 +7.125168E-02 +1.412152E-03 diff --git a/tests/regression_tests/filter_distribcell/case-3/results_true.dat b/tests/regression_tests/filter_distribcell/case-3/results_true.dat index f30e858f0..77f2a2a87 100644 --- a/tests/regression_tests/filter_distribcell/case-3/results_true.dat +++ b/tests/regression_tests/filter_distribcell/case-3/results_true.dat @@ -1 +1 @@ -1d09084dc41305687d53d1e800fb3d0ac3949aa4e1cb0bfbb327d0ec1ad4b74fc97ee73da84b910529296b858aab9b8a5d0924d17ca2cc373625e1a9e197aa94 \ No newline at end of file +93c1efbc586874a715982d26609e9e79232de25a0b73093a00938d658440644f0ee6bb823902a6ef1b7a2a855e67b2da0a0e767ef550f9ffa4dea723e35af6f5 \ No newline at end of file diff --git a/tests/regression_tests/filter_distribcell/case-4/results_true.dat b/tests/regression_tests/filter_distribcell/case-4/results_true.dat index 228456c58..ed84838ee 100644 --- a/tests/regression_tests/filter_distribcell/case-4/results_true.dat +++ b/tests/regression_tests/filter_distribcell/case-4/results_true.dat @@ -1,12 +1,12 @@ k-combined: -1.068596E-01 INF +1.069692E-01 INF tally 1: 1.812612E-02 3.285561E-04 2.870442E-02 8.239436E-04 -1.807689E-02 -3.267740E-04 +1.824058E-02 +3.327188E-04 2.660796E-02 7.079835E-04 1.961572E-02 diff --git a/tests/regression_tests/filter_energyfun/inputs_true.dat b/tests/regression_tests/filter_energyfun/inputs_true.dat index 4b7b74d28..b7a70290f 100644 --- a/tests/regression_tests/filter_energyfun/inputs_true.dat +++ b/tests/regression_tests/filter_energyfun/inputs_true.dat @@ -1,14 +1,14 @@ - - - + + + - + eigenvalue diff --git a/tests/regression_tests/filter_energyfun/results_true.dat b/tests/regression_tests/filter_energyfun/results_true.dat index 0aadac82e..d64de58a6 100644 --- a/tests/regression_tests/filter_energyfun/results_true.dat +++ b/tests/regression_tests/filter_energyfun/results_true.dat @@ -1,10 +1,10 @@ energyfunction nuclide score mean std. dev. -0 448ee8dfd19c4f Am241 ((n,gamma) / (n,gamma)) 1.74e-01 6.83e-03 +0 448ee8dfd19c4f Am241 ((n,gamma) / (n,gamma)) 1.74e-01 5.44e-03 energyfunction nuclide score mean std. dev. -0 37e006ae6b2e74 Am241 (n,gamma) 8.16e-02 2.24e-03 +0 37e006ae6b2e74 Am241 (n,gamma) 8.35e-02 1.83e-03 energyfunction nuclide score mean std. dev. -0 b4e2ac84068d2d Am241 (n,gamma) 8.19e-02 2.25e-03 +0 b4e2ac84068d2d Am241 (n,gamma) 8.39e-02 1.84e-03 energyfunction nuclide score mean std. dev. -0 dacf88242512ea Am241 (n,gamma) 7.95e-02 2.19e-03 +0 dacf88242512ea Am241 (n,gamma) 8.14e-02 1.78e-03 energyfunction nuclide score mean std. dev. -0 fe168c70d9e078 Am241 (n,gamma) 1.06e-01 2.96e-03 +0 fe168c70d9e078 Am241 (n,gamma) 1.09e-01 2.41e-03 diff --git a/tests/regression_tests/filter_mesh/inputs_true.dat b/tests/regression_tests/filter_mesh/inputs_true.dat index 0667c0341..10f70a720 100644 --- a/tests/regression_tests/filter_mesh/inputs_true.dat +++ b/tests/regression_tests/filter_mesh/inputs_true.dat @@ -1,28 +1,28 @@ - - - + + + - - + + - - - - - - - - - - + + + + + + + + + + eigenvalue @@ -54,8 +54,8 @@ 0.0 0.4411764705882353 0.8823529411764706 1.3235294117647058 1.7647058823529411 2.2058823529411766 2.6470588235294117 3.0882352941176467 3.5294117647058822 3.9705882352941178 4.411764705882353 4.852941176470588 5.294117647058823 5.735294117647059 6.1764705882352935 6.617647058823529 7.0588235294117645 7.5 0.0 0.3490658503988659 0.6981317007977318 1.0471975511965976 1.3962634015954636 1.7453292519943295 2.0943951023931953 2.443460952792061 2.792526803190927 3.141592653589793 3.490658503988659 3.839724354387525 4.1887902047863905 4.537856055185257 4.886921905584122 5.235987755982989 5.585053606381854 5.93411945678072 6.283185307179586 - -7.5 -6.5625 -5.625 -4.6875 -3.75 -2.8125 -1.875 -0.9375 0.0 0.9375 1.875 2.8125 3.75 4.6875 5.625 6.5625 7.5 - 0.0 0.0 0.0 + 0.0 0.9375 1.875 2.8125 3.75 4.6875 5.625 6.5625 7.5 8.4375 9.375 10.3125 11.25 12.1875 13.125 14.0625 15.0 + 0.0 0.0 -7.5 0.0 0.4411764705882353 0.8823529411764706 1.3235294117647058 1.7647058823529411 2.2058823529411766 2.6470588235294117 3.0882352941176467 3.5294117647058822 3.9705882352941178 4.411764705882353 4.852941176470588 5.294117647058823 5.735294117647059 6.1764705882352935 6.617647058823529 7.0588235294117645 7.5 diff --git a/tests/regression_tests/filter_mesh/results_true.dat b/tests/regression_tests/filter_mesh/results_true.dat index a91eadb35..34e99c17e 100644 --- a/tests/regression_tests/filter_mesh/results_true.dat +++ b/tests/regression_tests/filter_mesh/results_true.dat @@ -1 +1 @@ -bd55ee25094f9ad04fda4439f58ef0fed718632c88b9fde411a484dc624dedcd45dee643e14d8b107d8b92757737b8bb3d9a667de5482457d6d8346afffdf657 \ No newline at end of file +e07ed2bc8893c69721abf61b123336f1f6128a3bee6ec63b84d1f549f31707a74a6ce885091ccc0eac6b7f16f7cab39ede4784584c08825829e108de878ea5fb \ No newline at end of file diff --git a/tests/regression_tests/filter_mesh/test.py b/tests/regression_tests/filter_mesh/test.py index 6214e0486..165ba2a0c 100644 --- a/tests/regression_tests/filter_mesh/test.py +++ b/tests/regression_tests/filter_mesh/test.py @@ -61,9 +61,10 @@ def model(): np.testing.assert_allclose(recti_mesh.volumes, recti_mesh_exp_vols) cyl_mesh = openmc.CylindricalMesh( + origin=(0, 0, -7.5), r_grid=np.linspace(0, 7.5, 18), phi_grid=np.linspace(0, 2*pi, 19), - z_grid=np.linspace(-7.5, 7.5, 17), + z_grid=np.linspace(0, 15, 17), ) dr = 0.5 * np.diff(np.linspace(0, 7.5, 18)**2) dp = np.full(cyl_mesh.dimension[1], 2*pi / 18) diff --git a/tests/regression_tests/filter_meshborn/inputs_true.dat b/tests/regression_tests/filter_meshborn/inputs_true.dat index 3ba38d56e..a94646ec8 100644 --- a/tests/regression_tests/filter_meshborn/inputs_true.dat +++ b/tests/regression_tests/filter_meshborn/inputs_true.dat @@ -2,19 +2,19 @@ - - + + - + fixed source 2000 8 - + 0.0 -10.0 -10.0 10.0 10.0 10.0 diff --git a/tests/regression_tests/filter_musurface/inputs_true.dat b/tests/regression_tests/filter_musurface/inputs_true.dat index 031f62159..6db8543c2 100644 --- a/tests/regression_tests/filter_musurface/inputs_true.dat +++ b/tests/regression_tests/filter_musurface/inputs_true.dat @@ -1,20 +1,20 @@ - - - + + + - - + + - - + + eigenvalue diff --git a/tests/regression_tests/filter_musurface/results_true.dat b/tests/regression_tests/filter_musurface/results_true.dat index 39c9f2b92..4cdd7dbf5 100644 --- a/tests/regression_tests/filter_musurface/results_true.dat +++ b/tests/regression_tests/filter_musurface/results_true.dat @@ -1,11 +1,11 @@ k-combined: -1.157005E-01 7.587090E-03 +1.202075E-01 1.113188E-02 tally 1: 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -8.770000E-01 -1.608710E-01 -3.909000E+00 -3.063035E+00 +9.230000E-01 +1.791510E-01 +3.869000E+00 +3.002523E+00 diff --git a/tests/regression_tests/filter_rotations/__init__.py b/tests/regression_tests/filter_rotations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/regression_tests/filter_rotations/inputs_true.dat b/tests/regression_tests/filter_rotations/inputs_true.dat new file mode 100644 index 000000000..1ad2b9e86 --- /dev/null +++ b/tests/regression_tests/filter_rotations/inputs_true.dat @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + eigenvalue + 1000 + 5 + 0 + + + + 3 4 5 + -9 -9 -9 + 9 9 9 + + + 3 4 5 + -9 -9 -9 + 9 9 9 + + + 1 + + + 2 + + + 1 + total + + + 2 + total + + + diff --git a/tests/regression_tests/filter_rotations/results_true.dat b/tests/regression_tests/filter_rotations/results_true.dat new file mode 100644 index 000000000..5c8b83b76 --- /dev/null +++ b/tests/regression_tests/filter_rotations/results_true.dat @@ -0,0 +1,244 @@ +k-combined: +7.729082E-01 3.775399E-02 +tally 1: +5.296804E-02 +5.661701E-04 +8.356446E-02 +1.412139E-03 +5.041335E-02 +5.143568E-04 +1.299348E-01 +3.467618E-03 +3.929702E-01 +3.147038E-02 +1.379707E-01 +3.888484E-03 +1.405034E-01 +4.473799E-03 +3.785796E-01 +2.940585E-02 +1.422010E-01 +4.113723E-03 +5.647073E-02 +6.735251E-04 +7.911154E-02 +1.329137E-03 +5.160755E-02 +5.361448E-04 +6.669424E-02 +9.090832E-04 +1.008621E-01 +2.134534E-03 +6.808932E-02 +9.355993E-04 +1.873006E-01 +7.135961E-03 +6.221575E-01 +7.819842E-02 +1.856653E-01 +6.954762E-03 +2.014929E-01 +8.327845E-03 +5.853251E-01 +6.945708E-02 +1.709645E-01 +5.917124E-03 +7.214913E-02 +1.058962E-03 +1.027720E-01 +2.138475E-03 +6.099853E-02 +7.493941E-04 +6.892071E-02 +9.630680E-04 +1.035459E-01 +2.173883E-03 +6.973870E-02 +9.904237E-04 +2.125703E-01 +9.112659E-03 +9.012205E-01 +2.163546E-01 +2.066426E-01 +8.617414E-03 +2.258950E-01 +1.039607E-02 +9.476792E-01 +2.350708E-01 +2.225585E-01 +1.017898E-02 +7.111503E-02 +1.036847E-03 +1.117012E-01 +2.530040E-03 +6.870474E-02 +9.551035E-04 +5.738897E-02 +6.699030E-04 +9.522335E-02 +1.835769E-03 +6.570917E-02 +8.656870E-04 +1.945592E-01 +7.593336E-03 +5.514753E-01 +6.122981E-02 +2.144202E-01 +9.421739E-03 +1.971631E-01 +7.944046E-03 +6.088996E-01 +7.442954E-02 +1.965447E-01 +7.765628E-03 +7.005494E-02 +1.012891E-03 +1.010633E-01 +2.084095E-03 +6.145926E-02 +7.694351E-04 +4.999479E-02 +5.129164E-04 +7.238243E-02 +1.062921E-03 +4.902309E-02 +4.852193E-04 +1.324655E-01 +3.642431E-03 +3.305312E-01 +2.265726E-02 +1.332993E-01 +3.728385E-03 +1.547469E-01 +4.894837E-03 +3.625944E-01 +2.747313E-02 +1.435761E-01 +4.334405E-03 +5.789603E-02 +7.065383E-04 +7.589559E-02 +1.205386E-03 +5.210018E-02 +5.790843E-04 +tally 2: +4.597932E-02 +4.246849E-04 +8.494738E-02 +1.467238E-03 +5.155072E-02 +5.373129E-04 +1.479395E-01 +4.468164E-03 +3.931843E-01 +3.141943E-02 +1.264081E-01 +3.243689E-03 +1.229742E-01 +3.276501E-03 +3.768427E-01 +2.927971E-02 +1.574908E-01 +5.079304E-03 +5.621044E-02 +6.877866E-04 +8.490616E-02 +1.510673E-03 +4.709600E-02 +4.576632E-04 +5.382674E-02 +5.890600E-04 +1.116560E-01 +2.599817E-03 +6.648634E-02 +8.862677E-04 +1.996861E-01 +8.137198E-03 +6.218616E-01 +7.805532E-02 +1.672379E-01 +5.667797E-03 +1.841275E-01 +6.936896E-03 +5.887874E-01 +7.031665E-02 +1.872574E-01 +7.086584E-03 +7.574698E-02 +1.160992E-03 +1.100173E-01 +2.453972E-03 +5.427866E-02 +5.955556E-04 +5.644318E-02 +6.503634E-04 +1.058628E-01 +2.254338E-03 +8.012794E-02 +1.297032E-03 +2.292757E-01 +1.064490E-02 +9.001874E-01 +2.153097E-01 +1.921874E-01 +7.537343E-03 +2.058642E-01 +8.537136E-03 +9.442653E-01 +2.359241E-01 +2.419900E-01 +1.202201E-02 +7.563876E-02 +1.169874E-03 +1.165428E-01 +2.750405E-03 +5.646354E-02 +6.408683E-04 +4.963879E-02 +4.975915E-04 +1.005478E-01 +2.046400E-03 +7.041191E-02 +1.002590E-03 +1.959123E-01 +7.727902E-03 +5.625596E-01 +6.366248E-02 +1.987313E-01 +8.108832E-03 +1.922194E-01 +7.602752E-03 +6.062527E-01 +7.384124E-02 +2.039506E-01 +8.379010E-03 +7.019905E-02 +1.034239E-03 +1.081383E-01 +2.344040E-03 +5.125142E-02 +5.430397E-04 +4.230495E-02 +3.666730E-04 +7.722275E-02 +1.208856E-03 +4.998937E-02 +5.049355E-04 +1.461632E-01 +4.456332E-03 +3.315459E-01 +2.288314E-02 +1.238273E-01 +3.205844E-03 +1.355317E-01 +3.754923E-03 +3.646520E-01 +2.766067E-02 +1.543013E-01 +5.044487E-03 +6.082173E-02 +7.636985E-04 +8.490569E-02 +1.506309E-03 +4.046126E-02 +3.495832E-04 diff --git a/tests/regression_tests/filter_rotations/test.py b/tests/regression_tests/filter_rotations/test.py new file mode 100644 index 000000000..f5d63d6b4 --- /dev/null +++ b/tests/regression_tests/filter_rotations/test.py @@ -0,0 +1,72 @@ +import numpy as np + +import openmc +import pytest + +from tests.testing_harness import PyAPITestHarness + + +@pytest.fixture +def model(): + + model = openmc.model.Model() + + fuel = openmc.Material() + fuel.set_density('g/cm3', 10.0) + fuel.add_nuclide('U235', 1.0) + zr = openmc.Material() + zr.set_density('g/cm3', 1.0) + zr.add_nuclide('Zr90', 1.0) + model.materials.extend([fuel, zr]) + + box1 = openmc.model.RectangularPrism(10.0, 10.0) + box2 = openmc.model.RectangularPrism(20.0, 20.0, boundary_type='reflective') + top = openmc.ZPlane(z0=10.0, boundary_type='vacuum') + bottom = openmc.ZPlane(z0=-10.0, boundary_type='vacuum') + cell1 = openmc.Cell(fill=fuel, region=-box1 & +bottom & -top) + cell2 = openmc.Cell(fill=zr, region=+box1 & -box2 & +bottom & -top) + model.geometry = openmc.Geometry([cell1, cell2]) + + model.settings.batches = 5 + model.settings.inactive = 0 + model.settings.particles = 1000 + + rotation = np.array((0, 0, 10)) + + llc = np.array([-9, -9, -9]) + urc = np.array([9, 9, 9]) + + mesh_dims = (3, 4, 5) + + filters = [] + + # un-rotated meshes + reg_mesh = openmc.RegularMesh() + reg_mesh.dimension = mesh_dims + reg_mesh.lower_left = llc + reg_mesh.upper_right = urc + + filters.append(openmc.MeshFilter(reg_mesh)) + + # rotated meshes + rotated_reg_mesh = openmc.RegularMesh() + rotated_reg_mesh.dimension = mesh_dims + rotated_reg_mesh.lower_left = llc + rotated_reg_mesh.upper_right = urc + + filters.append(openmc.MeshFilter(rotated_reg_mesh)) + filters[-1].rotation = rotation + + # Create tallies + for f in filters: + tally = openmc.Tally() + tally.filters = [f] + tally.scores = ['total'] + model.tallies.append(tally) + + return model + + +def test_filter_mesh_rotations(model): + harness = PyAPITestHarness('statepoint.5.h5', model) + harness.main() diff --git a/tests/regression_tests/filter_translations/inputs_true.dat b/tests/regression_tests/filter_translations/inputs_true.dat index 5004c3217..41ae9b6dc 100644 --- a/tests/regression_tests/filter_translations/inputs_true.dat +++ b/tests/regression_tests/filter_translations/inputs_true.dat @@ -1,28 +1,28 @@ - - - + + + - - + + - - - - - - - - - - + + + + + + + + + + eigenvalue @@ -57,10 +57,10 @@ 2 - + 3 - + 4 diff --git a/tests/regression_tests/filter_translations/results_true.dat b/tests/regression_tests/filter_translations/results_true.dat index d257d71a6..a63586d2d 100644 --- a/tests/regression_tests/filter_translations/results_true.dat +++ b/tests/regression_tests/filter_translations/results_true.dat @@ -1,342 +1,342 @@ k-combined: -2.298294E-01 3.256961E-01 +7.729082E-01 3.775399E-02 tally 1: -4.880089E-02 -4.894233E-04 -8.221192E-02 -1.373712E-03 -5.205261E-02 -5.584673E-04 -1.272758E-01 -3.371623E-03 -3.599375E-01 -2.655645E-02 -1.377572E-01 -3.835778E-03 -1.646205E-01 -5.916595E-03 -3.806765E-01 -2.947576E-02 -1.470573E-01 -4.360385E-03 -5.568294E-02 -6.368003E-04 -6.775790E-02 -9.447074E-04 -5.580909E-02 -6.303584E-04 -6.674847E-02 -9.080853E-04 -9.747628E-02 -1.934325E-03 -6.824062E-02 -9.908844E-04 -1.891692E-01 -7.211874E-03 -5.976566E-01 -7.206211E-02 -1.805640E-01 -6.599680E-03 -2.114692E-01 -9.202185E-03 -6.514433E-01 -8.523087E-02 -1.905740E-01 -7.287607E-03 -7.633486E-02 -1.216488E-03 -1.117747E-01 -2.538705E-03 -7.438042E-02 -1.127109E-03 -7.356007E-02 -1.090617E-03 -1.161258E-01 -2.734941E-03 -6.745417E-02 -9.371031E-04 -2.153323E-01 -9.293477E-03 -9.414362E-01 -2.261845E-01 -2.016933E-01 -8.270477E-03 -2.370758E-01 -1.150628E-02 -9.973982E-01 -2.489516E-01 -2.152505E-01 -9.424546E-03 -7.502684E-02 -1.208304E-03 -1.244515E-01 -3.168682E-03 -7.515812E-02 -1.151397E-03 -6.355178E-02 -8.423316E-04 -1.040915E-01 -2.224064E-03 -6.902234E-02 -9.843766E-04 -1.978591E-01 -7.894161E-03 -5.162186E-01 -5.357742E-02 -1.897326E-01 -7.231935E-03 -1.827950E-01 -6.839560E-03 -5.780661E-01 -6.799910E-02 -1.881215E-01 -7.093746E-03 -6.083700E-02 -7.861240E-04 -9.978991E-02 -2.022733E-03 -6.004653E-02 -7.428556E-04 -4.951220E-02 -4.952385E-04 -7.401227E-02 -1.124154E-03 -5.151090E-02 -5.339359E-04 -1.356118E-01 -3.711749E-03 -3.400140E-01 -2.367518E-02 -1.385305E-01 -4.060592E-03 -1.438711E-01 -4.191824E-03 -3.276170E-01 -2.210924E-02 -1.279501E-01 -3.435254E-03 -4.852204E-02 -4.919417E-04 -7.229090E-02 -1.062894E-03 -4.344414E-02 -3.825354E-04 +5.296804E-02 +5.661701E-04 +8.356446E-02 +1.412139E-03 +5.041335E-02 +5.143568E-04 +1.299348E-01 +3.467618E-03 +3.929702E-01 +3.147038E-02 +1.379707E-01 +3.888484E-03 +1.405034E-01 +4.473799E-03 +3.785796E-01 +2.940585E-02 +1.422010E-01 +4.113723E-03 +5.647073E-02 +6.735251E-04 +7.911154E-02 +1.329137E-03 +5.160755E-02 +5.361448E-04 +6.669424E-02 +9.090832E-04 +1.008621E-01 +2.134534E-03 +6.808932E-02 +9.355993E-04 +1.873006E-01 +7.135961E-03 +6.221575E-01 +7.819842E-02 +1.856653E-01 +6.954762E-03 +2.014929E-01 +8.327845E-03 +5.853251E-01 +6.945708E-02 +1.709645E-01 +5.917124E-03 +7.214913E-02 +1.058962E-03 +1.027720E-01 +2.138475E-03 +6.099853E-02 +7.493941E-04 +6.892071E-02 +9.630680E-04 +1.035459E-01 +2.173883E-03 +6.973870E-02 +9.904237E-04 +2.125703E-01 +9.112659E-03 +9.012205E-01 +2.163546E-01 +2.066426E-01 +8.617414E-03 +2.258950E-01 +1.039607E-02 +9.476792E-01 +2.350708E-01 +2.225585E-01 +1.017898E-02 +7.111503E-02 +1.036847E-03 +1.117012E-01 +2.530040E-03 +6.870474E-02 +9.551035E-04 +5.738897E-02 +6.699030E-04 +9.522335E-02 +1.835769E-03 +6.570917E-02 +8.656870E-04 +1.945592E-01 +7.593336E-03 +5.514753E-01 +6.122981E-02 +2.144202E-01 +9.421739E-03 +1.971631E-01 +7.944046E-03 +6.088996E-01 +7.442954E-02 +1.965447E-01 +7.765628E-03 +7.005494E-02 +1.012891E-03 +1.010633E-01 +2.084095E-03 +6.145926E-02 +7.694351E-04 +4.999479E-02 +5.129164E-04 +7.238243E-02 +1.062921E-03 +4.902309E-02 +4.852193E-04 +1.324655E-01 +3.642431E-03 +3.305312E-01 +2.265726E-02 +1.332993E-01 +3.728385E-03 +1.547469E-01 +4.894837E-03 +3.625944E-01 +2.747313E-02 +1.435761E-01 +4.334405E-03 +5.789603E-02 +7.065383E-04 +7.589559E-02 +1.205386E-03 +5.210018E-02 +5.790843E-04 tally 2: -2.379877E-01 -1.141258E-02 -2.376600E-01 -1.137350E-02 -6.546514E-01 -8.852321E-02 -5.823862E-01 -6.810779E-02 -2.692631E-01 -1.479426E-02 -2.360469E-01 -1.124950E-02 -3.534788E-01 -2.528363E-02 -3.247931E-01 -2.160130E-02 -1.181513E+00 -2.959140E-01 -1.078874E+00 -2.467321E-01 -3.743375E-01 -2.859905E-02 -3.468123E-01 -2.427809E-02 -3.203903E-01 -2.109786E-02 -3.315547E-01 -2.216053E-02 -1.039077E+00 -2.294722E-01 -1.091786E+00 -2.572834E-01 -3.615960E-01 -2.678347E-02 -3.323317E-01 -2.226424E-02 -2.519726E-01 -1.279098E-02 -2.332385E-01 -1.101251E-02 -5.587247E-01 -6.293355E-02 -5.426859E-01 -6.010041E-02 -2.332981E-01 -1.097940E-02 -2.239951E-01 -1.043440E-02 +2.572693E-01 +1.338921E-02 +2.567576E-01 +1.333558E-02 +6.127899E-01 +7.781914E-02 +6.163075E-01 +7.600273E-02 +2.566545E-01 +1.372553E-02 +2.509744E-01 +1.286275E-02 +3.366720E-01 +2.282560E-02 +3.216175E-01 +2.103222E-02 +1.118187E+00 +2.697988E-01 +1.050003E+00 +2.391098E-01 +3.407360E-01 +2.332214E-02 +3.150094E-01 +2.006040E-02 +3.130223E-01 +2.001074E-02 +3.238651E-01 +2.101351E-02 +1.061186E+00 +2.372828E-01 +1.099461E+00 +2.597134E-01 +3.445524E-01 +2.400393E-02 +3.429055E-01 +2.372392E-02 +2.299776E-01 +1.064851E-02 +2.208901E-01 +9.829109E-03 +6.015657E-01 +7.399276E-02 +5.851229E-01 +7.165716E-02 +2.583609E-01 +1.364046E-02 +2.456380E-01 +1.257735E-02 tally 3: -4.880089E-02 -4.894233E-04 -8.221192E-02 -1.373712E-03 -5.205261E-02 -5.584673E-04 -1.272758E-01 -3.371623E-03 -3.599375E-01 -2.655645E-02 -1.377572E-01 -3.835778E-03 -1.646205E-01 -5.916595E-03 -3.806765E-01 -2.947576E-02 -1.470573E-01 -4.360385E-03 -5.568294E-02 -6.368003E-04 -6.775790E-02 -9.447074E-04 -5.580909E-02 -6.303584E-04 -6.674847E-02 -9.080853E-04 -9.747628E-02 -1.934325E-03 -6.824062E-02 -9.908844E-04 -1.891692E-01 -7.211874E-03 -5.976566E-01 -7.206211E-02 -1.805640E-01 -6.599680E-03 -2.114692E-01 -9.202185E-03 -6.514433E-01 -8.523087E-02 -1.905740E-01 -7.287607E-03 -7.633486E-02 -1.216488E-03 -1.117747E-01 -2.538705E-03 -7.438042E-02 -1.127109E-03 -7.356007E-02 -1.090617E-03 -1.161258E-01 -2.734941E-03 -6.745417E-02 -9.371031E-04 -2.153323E-01 -9.293477E-03 -9.414362E-01 -2.261845E-01 -2.016933E-01 -8.270477E-03 -2.370758E-01 -1.150628E-02 -9.973982E-01 -2.489516E-01 -2.152505E-01 -9.424546E-03 -7.502684E-02 -1.208304E-03 -1.244515E-01 -3.168682E-03 -7.515812E-02 -1.151397E-03 -6.355178E-02 -8.423316E-04 -1.040915E-01 -2.224064E-03 -6.902234E-02 -9.843766E-04 -1.978591E-01 -7.894161E-03 -5.162186E-01 -5.357742E-02 -1.897326E-01 -7.231935E-03 -1.827950E-01 -6.839560E-03 -5.780661E-01 -6.799910E-02 -1.881215E-01 -7.093746E-03 -6.083700E-02 -7.861240E-04 -9.978991E-02 -2.022733E-03 -6.004653E-02 -7.428556E-04 -4.951220E-02 -4.952385E-04 -7.401227E-02 -1.124154E-03 -5.151090E-02 -5.339359E-04 -1.356118E-01 -3.711749E-03 -3.400140E-01 -2.367518E-02 -1.385305E-01 -4.060592E-03 -1.438711E-01 -4.191824E-03 -3.276170E-01 -2.210924E-02 -1.279501E-01 -3.435254E-03 -4.852204E-02 -4.919417E-04 -7.229090E-02 -1.062894E-03 -4.344414E-02 -3.825354E-04 +5.296804E-02 +5.661701E-04 +8.356446E-02 +1.412139E-03 +5.041335E-02 +5.143568E-04 +1.299348E-01 +3.467618E-03 +3.929702E-01 +3.147038E-02 +1.379707E-01 +3.888484E-03 +1.405034E-01 +4.473799E-03 +3.785796E-01 +2.940585E-02 +1.422010E-01 +4.113723E-03 +5.647073E-02 +6.735251E-04 +7.911154E-02 +1.329137E-03 +5.160755E-02 +5.361448E-04 +6.669424E-02 +9.090832E-04 +1.008621E-01 +2.134534E-03 +6.808932E-02 +9.355993E-04 +1.873006E-01 +7.135961E-03 +6.221575E-01 +7.819842E-02 +1.856653E-01 +6.954762E-03 +2.014929E-01 +8.327845E-03 +5.853251E-01 +6.945708E-02 +1.709645E-01 +5.917124E-03 +7.214913E-02 +1.058962E-03 +1.027720E-01 +2.138475E-03 +6.099853E-02 +7.493941E-04 +6.892071E-02 +9.630680E-04 +1.035459E-01 +2.173883E-03 +6.973870E-02 +9.904237E-04 +2.125703E-01 +9.112659E-03 +9.012205E-01 +2.163546E-01 +2.066426E-01 +8.617414E-03 +2.258950E-01 +1.039607E-02 +9.476792E-01 +2.350708E-01 +2.225585E-01 +1.017898E-02 +7.111503E-02 +1.036847E-03 +1.117012E-01 +2.530040E-03 +6.870474E-02 +9.551035E-04 +5.738897E-02 +6.699030E-04 +9.522335E-02 +1.835769E-03 +6.570917E-02 +8.656870E-04 +1.945592E-01 +7.593336E-03 +5.514753E-01 +6.122981E-02 +2.144202E-01 +9.421739E-03 +1.971631E-01 +7.944046E-03 +6.088996E-01 +7.442954E-02 +1.965447E-01 +7.765628E-03 +7.005494E-02 +1.012891E-03 +1.010633E-01 +2.084095E-03 +6.145926E-02 +7.694351E-04 +4.999479E-02 +5.129164E-04 +7.238243E-02 +1.062921E-03 +4.902309E-02 +4.852193E-04 +1.324655E-01 +3.642431E-03 +3.305312E-01 +2.265726E-02 +1.332993E-01 +3.728385E-03 +1.547469E-01 +4.894837E-03 +3.625944E-01 +2.747313E-02 +1.435761E-01 +4.334405E-03 +5.789603E-02 +7.065383E-04 +7.589559E-02 +1.205386E-03 +5.210018E-02 +5.790843E-04 tally 4: -2.379877E-01 -1.141258E-02 -2.376600E-01 -1.137350E-02 -6.546514E-01 -8.852321E-02 -5.823862E-01 -6.810779E-02 -2.692631E-01 -1.479426E-02 -2.360469E-01 -1.124950E-02 -3.534788E-01 -2.528363E-02 -3.247931E-01 -2.160130E-02 -1.181513E+00 -2.959140E-01 -1.078874E+00 -2.467321E-01 -3.743375E-01 -2.859905E-02 -3.468123E-01 -2.427809E-02 -3.203903E-01 -2.109786E-02 -3.315547E-01 -2.216053E-02 -1.039077E+00 -2.294722E-01 -1.091786E+00 -2.572834E-01 -3.615960E-01 -2.678347E-02 -3.323317E-01 -2.226424E-02 -2.519726E-01 -1.279098E-02 -2.332385E-01 -1.101251E-02 -5.587247E-01 -6.293355E-02 -5.426859E-01 -6.010041E-02 -2.332981E-01 -1.097940E-02 -2.239951E-01 -1.043440E-02 +2.572693E-01 +1.338921E-02 +2.567576E-01 +1.333558E-02 +6.127899E-01 +7.781914E-02 +6.163075E-01 +7.600273E-02 +2.566545E-01 +1.372553E-02 +2.509744E-01 +1.286275E-02 +3.366720E-01 +2.282560E-02 +3.216175E-01 +2.103222E-02 +1.118187E+00 +2.697988E-01 +1.050003E+00 +2.391098E-01 +3.407360E-01 +2.332214E-02 +3.150094E-01 +2.006040E-02 +3.130223E-01 +2.001074E-02 +3.238651E-01 +2.101351E-02 +1.061186E+00 +2.372828E-01 +1.099461E+00 +2.597134E-01 +3.445524E-01 +2.400393E-02 +3.429055E-01 +2.372392E-02 +2.299776E-01 +1.064851E-02 +2.208901E-01 +9.829109E-03 +6.015657E-01 +7.399276E-02 +5.851229E-01 +7.165716E-02 +2.583609E-01 +1.364046E-02 +2.456380E-01 +1.257735E-02 diff --git a/tests/regression_tests/fixed_source/inputs_true.dat b/tests/regression_tests/fixed_source/inputs_true.dat index 0fdb1466e..a36741775 100644 --- a/tests/regression_tests/fixed_source/inputs_true.dat +++ b/tests/regression_tests/fixed_source/inputs_true.dat @@ -1,21 +1,21 @@ - - - - + + + + - + fixed source 100 10 - + 0.0 0.0 0.0 diff --git a/tests/regression_tests/ifp/__init__.py b/tests/regression_tests/ifp/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/regression_tests/ifp/groupwise/__init__.py b/tests/regression_tests/ifp/groupwise/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/regression_tests/ifp/groupwise/inputs_true.dat b/tests/regression_tests/ifp/groupwise/inputs_true.dat new file mode 100644 index 000000000..6d7e20717 --- /dev/null +++ b/tests/regression_tests/ifp/groupwise/inputs_true.dat @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + eigenvalue + 1000 + 20 + 5 + + + -10.0 -10.0 -10.0 10.0 10.0 10.0 + + + true + + + 5 + + + + 1 2 3 4 5 6 + + + ifp-time-numerator + + + 1 + ifp-beta-numerator + + + ifp-denominator + + + diff --git a/tests/regression_tests/ifp/groupwise/results_true.dat b/tests/regression_tests/ifp/groupwise/results_true.dat new file mode 100644 index 000000000..ea66a8de3 --- /dev/null +++ b/tests/regression_tests/ifp/groupwise/results_true.dat @@ -0,0 +1,21 @@ +k-combined: +1.006559E+00 5.389391E-03 +tally 1: +9.109384E-08 +5.667165E-16 +tally 2: +3.000000E-03 +9.000000E-06 +0.000000E+00 +0.000000E+00 +2.100000E-02 +1.370000E-04 +2.800000E-02 +2.220000E-04 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +tally 3: +1.489000E+01 +1.480036E+01 diff --git a/tests/regression_tests/ifp/groupwise/test.py b/tests/regression_tests/ifp/groupwise/test.py new file mode 100644 index 000000000..a1a0ebefb --- /dev/null +++ b/tests/regression_tests/ifp/groupwise/test.py @@ -0,0 +1,40 @@ +"""Test the Iterated Fission Probability (IFP) method to compute adjoint-weighted +kinetics parameters using dedicated tallies.""" + +import openmc +import pytest + +from tests.testing_harness import PyAPITestHarness + +@pytest.fixture() +def ifp_model(): + # Material + material = openmc.Material(name="core") + material.add_nuclide("U235", 1.0) + material.set_density('g/cm3', 16.0) + + # Geometry + radius = 10.0 + sphere = openmc.Sphere(r=radius, boundary_type="vacuum") + cell = openmc.Cell(region=-sphere, fill=material) + geometry = openmc.Geometry([cell]) + + # Settings + settings = openmc.Settings() + settings.particles = 1000 + settings.batches = 20 + settings.inactive = 5 + settings.ifp_n_generation = 5 + + model = openmc.Model(settings=settings, geometry=geometry) + + space = openmc.stats.Box(*cell.bounding_box) + model.settings.source = openmc.IndependentSource( + space=space, constraints={'fissionable': True}) + model.add_kinetics_parameters_tallies(num_groups=6) + return model + + +def test_iterated_fission_probability(ifp_model): + harness = PyAPITestHarness("statepoint.20.h5", model=ifp_model) + harness.main() diff --git a/tests/regression_tests/ifp/total/__init__.py b/tests/regression_tests/ifp/total/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/regression_tests/ifp/total/inputs_true.dat b/tests/regression_tests/ifp/total/inputs_true.dat new file mode 100644 index 000000000..2d69b29ab --- /dev/null +++ b/tests/regression_tests/ifp/total/inputs_true.dat @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + eigenvalue + 1000 + 20 + 5 + + + -10.0 -10.0 -10.0 10.0 10.0 10.0 + + + true + + + 5 + + + + ifp-time-numerator ifp-beta-numerator ifp-denominator + + + diff --git a/tests/regression_tests/ifp/total/results_true.dat b/tests/regression_tests/ifp/total/results_true.dat new file mode 100644 index 000000000..466ca1f01 --- /dev/null +++ b/tests/regression_tests/ifp/total/results_true.dat @@ -0,0 +1,9 @@ +k-combined: +1.006559E+00 5.389391E-03 +tally 1: +9.109384E-08 +5.667165E-16 +5.200000E-02 +5.420000E-04 +1.489000E+01 +1.480036E+01 diff --git a/tests/regression_tests/ifp/total/test.py b/tests/regression_tests/ifp/total/test.py new file mode 100644 index 000000000..18b89cfc0 --- /dev/null +++ b/tests/regression_tests/ifp/total/test.py @@ -0,0 +1,44 @@ +"""Test the Iterated Fission Probability (IFP) method to compute adjoint-weighted +kinetics parameters using dedicated tallies.""" + +import openmc +import pytest + +from tests.testing_harness import PyAPITestHarness + +@pytest.fixture() +def ifp_model(): + model = openmc.Model() + + # Material + material = openmc.Material(name="core") + material.add_nuclide("U235", 1.0) + material.set_density('g/cm3', 16.0) + + # Geometry + radius = 10.0 + sphere = openmc.Sphere(r=radius, boundary_type="vacuum") + cell = openmc.Cell(region=-sphere, fill=material) + model.geometry = openmc.Geometry([cell]) + + # Settings + model.settings.particles = 1000 + model.settings.batches = 20 + model.settings.inactive = 5 + model.settings.ifp_n_generation = 5 + + space = openmc.stats.Box(*cell.bounding_box) + model.settings.source = openmc.IndependentSource( + space=space, constraints={'fissionable': True}) + + # Tally IFP scores + tally = openmc.Tally(name="ifp-scores") + tally.scores = ["ifp-time-numerator", "ifp-beta-numerator", "ifp-denominator"] + model.tallies = [tally] + + return model + + +def test_iterated_fission_probability(ifp_model): + harness = PyAPITestHarness("statepoint.20.h5", model=ifp_model) + harness.main() diff --git a/tests/regression_tests/infinite_cell/results_true.dat b/tests/regression_tests/infinite_cell/results_true.dat index 2c4ce082d..4cdbcaf88 100644 --- a/tests/regression_tests/infinite_cell/results_true.dat +++ b/tests/regression_tests/infinite_cell/results_true.dat @@ -1,2 +1,2 @@ k-combined: -9.589951E-02 8.489144E-04 +9.603664E-02 1.050772E-03 diff --git a/tests/regression_tests/iso_in_lab/inputs_true.dat b/tests/regression_tests/iso_in_lab/inputs_true.dat index bb6494ada..adfcf7e51 100644 --- a/tests/regression_tests/iso_in_lab/inputs_true.dat +++ b/tests/regression_tests/iso_in_lab/inputs_true.dat @@ -1,44 +1,44 @@ - - - - - - - + + + + + + + U234 U235 U238 Xe135 O16 - - - - - - + + + + + + Zr90 Zr91 Zr92 Zr94 Zr96 - - - - - + + + + + H1 O16 B10 B11 - - - - - + + + + + H1 O16 B10 B11 - + @@ -52,7 +52,7 @@ Fe54 Fe56 Fe57 Fe58 Ni58 Ni60 Mn55 Cr52 C0 Cu63 - + @@ -68,7 +68,7 @@ H1 O16 B10 B11 Fe54 Fe56 Fe57 Fe58 Ni58 Mn55 Cr52 - + @@ -84,7 +84,7 @@ H1 O16 B10 B11 Fe54 Fe56 Fe57 Fe58 Ni58 Mn55 Cr52 - + @@ -100,7 +100,7 @@ H1 O16 B10 B11 Fe54 Fe56 Fe57 Fe58 Ni58 Mn55 Cr52 - + @@ -116,7 +116,7 @@ H1 O16 B10 B11 Fe54 Fe56 Fe57 Fe58 Ni58 Mn55 Cr52 - + @@ -132,7 +132,7 @@ H1 O16 B10 B11 Fe54 Fe56 Fe57 Fe58 Ni58 Mn55 Cr52 - + @@ -146,7 +146,7 @@ H1 O16 B10 B11 Zr90 Zr91 Zr92 Zr94 Zr96 - + @@ -161,8 +161,8 @@ - - + + @@ -186,9 +186,9 @@ - + - + 1.26 1.26 17 17 @@ -289,30 +289,30 @@ 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + eigenvalue 100 10 5 - + -160 -160 -183 160 160 183 diff --git a/tests/regression_tests/iso_in_lab/results_true.dat b/tests/regression_tests/iso_in_lab/results_true.dat index aaef22623..0378ec86d 100644 --- a/tests/regression_tests/iso_in_lab/results_true.dat +++ b/tests/regression_tests/iso_in_lab/results_true.dat @@ -1,2 +1,2 @@ k-combined: -9.015537E-01 1.086850E-01 +9.365837E-01 5.366122E-02 diff --git a/tests/regression_tests/lattice/results_true.dat b/tests/regression_tests/lattice/results_true.dat index f3e937b36..dca84bd6a 100644 --- a/tests/regression_tests/lattice/results_true.dat +++ b/tests/regression_tests/lattice/results_true.dat @@ -1,2 +1,2 @@ k-combined: -9.610829E-01 2.522714E-02 +9.182679E-01 5.270201E-02 diff --git a/tests/regression_tests/lattice_corner_crossing/__init__.py b/tests/regression_tests/lattice_corner_crossing/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/regression_tests/lattice_corner_crossing/inputs_true.dat b/tests/regression_tests/lattice_corner_crossing/inputs_true.dat new file mode 100644 index 000000000..4b49b1403 --- /dev/null +++ b/tests/regression_tests/lattice_corner_crossing/inputs_true.dat @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + 10.0 10.0 + 2 2 + -10.0 -10.0 + +1 2 +2 1 + + + + + + + + + fixed source + 1000 + 10 + + + -0.7071067811865476 -0.7071067811865475 0.0 + + + + + + + 10 10 + -20.0 -20.0 + 20.0 20.0 + + + 1 + + + 1 + flux + tracklength + + + diff --git a/tests/regression_tests/lattice_corner_crossing/results_true.dat b/tests/regression_tests/lattice_corner_crossing/results_true.dat new file mode 100644 index 000000000..bd81cf535 --- /dev/null +++ b/tests/regression_tests/lattice_corner_crossing/results_true.dat @@ -0,0 +1,201 @@ +tally 1: +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.648775E-03 +7.016009E-06 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.981847E-03 +8.891414E-06 +3.331677E-03 +1.110007E-05 +6.742237E-03 +4.545776E-05 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +4.388206E-03 +1.925636E-05 +2.032104E-03 +4.129446E-06 +3.014946E-03 +9.089898E-06 +7.058968E-03 +4.982903E-05 +9.013188E-04 +8.123755E-07 +7.501461E-04 +5.627191E-07 +0.000000E+00 +0.000000E+00 +5.134898E-03 +2.636718E-05 +1.207302E-03 +1.457579E-06 +3.045925E-03 +9.277657E-06 +4.132399E-03 +1.707672E-05 +1.055271E-02 +5.829711E-05 +4.014909E-03 +1.611949E-05 +2.698215E-03 +7.280363E-06 +1.751215E-02 +1.073504E-04 +1.356908E-02 +9.589157E-05 +5.451466E-03 +2.971848E-05 +3.165676E-04 +1.002151E-07 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +3.724938E-03 +1.387516E-05 +2.812863E-03 +7.278837E-06 +1.000700E+01 +1.001402E+01 +2.345904E-02 +2.127641E-04 +2.451653E-02 +1.750725E-04 +8.695904E-03 +5.553981E-05 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +4.947565E-03 +2.447840E-05 +1.725721E-02 +8.878803E-05 +5.656444E+01 +3.199538E+02 +2.159961E-02 +1.034364E-04 +3.091063E-02 +5.543317E-04 +4.232209E-03 +1.791159E-05 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +4.716170E-03 +2.224226E-05 +1.321855E-02 +5.288265E-05 +5.309576E-02 +7.984865E-04 +5.656179E+01 +3.199238E+02 +2.399311E-02 +2.936670E-04 +4.680753E-02 +9.526509E-04 +1.074699E-02 +1.154978E-04 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +4.526425E-03 +2.048853E-05 +3.983003E-03 +9.553596E-06 +1.726789E-02 +9.579848E-05 +3.355605E-02 +3.331438E-04 +3.578422E-02 +3.560242E-04 +5.649209E+01 +3.191358E+02 +2.591495E-02 +4.169753E-04 +9.484744E-03 +8.065715E-05 +0.000000E+00 +0.000000E+00 +4.232587E-03 +9.113263E-06 +5.787378E-03 +2.194940E-05 +6.193626E-03 +2.357423E-05 +4.552787E-03 +6.987360E-06 +9.641308E-03 +3.506339E-05 +1.303892E-02 +4.378408E-05 +1.831744E-02 +8.836683E-05 +3.024725E+01 +9.148969E+01 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.488204E-03 +2.214752E-06 +5.067487E-03 +1.520987E-05 +7.550927E-03 +2.993991E-05 +3.215559E-03 +1.033982E-05 +4.258525E-03 +1.205064E-05 +2.115487E-03 +4.475286E-06 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 diff --git a/tests/regression_tests/lattice_corner_crossing/test.py b/tests/regression_tests/lattice_corner_crossing/test.py new file mode 100644 index 000000000..4684d144e --- /dev/null +++ b/tests/regression_tests/lattice_corner_crossing/test.py @@ -0,0 +1,83 @@ +""" +This test is designed to ensure that we account for potential corner crossings +in floating point precision. + +""" + +from math import pi, cos, sin + +import openmc +import pytest + +from tests.testing_harness import PyAPITestHarness + + +@pytest.fixture +def model(): + model = openmc.Model() + + # Length of lattice on each side + lat_size = 20.0 + + # Angle that we're crossing the corner at + phi = pi/4.0 + + air = openmc.Material() + air.set_density('g/cm3', 0.001) + air.add_nuclide('N14', 1.0) + metal = openmc.Material() + metal.set_density('g/cm3', 7.0) + metal.add_nuclide('Fe56', 1.0) + + metal_cell = openmc.Cell(fill=metal) + metal_uni = openmc.Universe(cells=[metal_cell]) + + air_cell = openmc.Cell(fill=air) + air_uni = openmc.Universe(cells=[air_cell]) + + # Define a checkerboard lattice + lattice = openmc.RectLattice() + lattice.lower_left = (-lat_size/2.0, -lat_size/2.0) + lattice.pitch = (lat_size/2, lat_size/2) + lattice.universes = [ + [metal_uni, air_uni], + [air_uni, metal_uni] + ] + + box = openmc.model.RectangularPrism(lat_size, lat_size) + cyl = openmc.ZCylinder(r=lat_size, boundary_type='vacuum') + outside_lattice = openmc.Cell(region=-cyl & +box, fill=air) + inside_lattice = openmc.Cell(region=-box, fill=lattice) + + model.geometry = openmc.Geometry([outside_lattice, inside_lattice]) + + # Set all runtime parameters + model.settings.run_mode = 'fixed source' + model.settings.batches = 10 + model.settings.particles = 1000 + + # Define a source located outside the lattice and pointing straight into its + # corner at 45 degrees + model.settings.source = openmc.IndependentSource( + space=openmc.stats.Point((-cos(phi), -sin(phi), 0.0)), + angle=openmc.stats.Monodirectional((cos(phi), sin(phi), 0.0)) + ) + + # Create a mesh tally + mesh = openmc.RegularMesh() + mesh.dimension = (10, 10) + mesh.lower_left = (-lat_size, -lat_size) + mesh.upper_right = (lat_size, lat_size) + mesh_filter = openmc.MeshFilter(mesh) + tally = openmc.Tally(tally_id=1) + tally.filters = [mesh_filter] + tally.scores = ['flux'] + tally.estimator = 'tracklength' + model.tallies = [tally] + + return model + + +def test_lattice_corner_crossing(model): + harness = PyAPITestHarness('statepoint.10.h5', model) + harness.main() diff --git a/tests/regression_tests/lattice_distribmat/False/inputs_true.dat b/tests/regression_tests/lattice_distribmat/False/inputs_true.dat new file mode 100644 index 000000000..783989057 --- /dev/null +++ b/tests/regression_tests/lattice_distribmat/False/inputs_true.dat @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + 1.0 1.0 + 1 + 1 1 + -1.0 -1.0 + +1 + + + 1.0 1.0 + 1 + 1 1 + -1.0 0 + +1 + + + 1.0 1.0 + 1 + 1 1 + 0 -1.0 + +1 + + + 1.0 1.0 + 1 + 1 1 + 0 0 + +1 + + + + + + + + + + + + + + + eigenvalue + 1000 + 10 + 5 + + diff --git a/tests/regression_tests/lattice_distribmat/False/results_true.dat b/tests/regression_tests/lattice_distribmat/False/results_true.dat new file mode 100644 index 000000000..9ebbb43b8 --- /dev/null +++ b/tests/regression_tests/lattice_distribmat/False/results_true.dat @@ -0,0 +1,2 @@ +k-combined: +1.848895E+00 1.480242E-02 diff --git a/tests/regression_tests/lattice_distribmat/True/inputs_true.dat b/tests/regression_tests/lattice_distribmat/True/inputs_true.dat new file mode 100644 index 000000000..aec3a5400 --- /dev/null +++ b/tests/regression_tests/lattice_distribmat/True/inputs_true.dat @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1.0 1.0 + 8 + 1 1 + -1.0 -1.0 + +8 + + + 1.0 1.0 + 8 + 1 1 + -1.0 0 + +8 + + + 1.0 1.0 + 8 + 1 1 + 0 -1.0 + +8 + + + 1.0 1.0 + 8 + 1 1 + 0 0 + +8 + + + + + + + + + + + + + + + eigenvalue + 1000 + 10 + 5 + + diff --git a/tests/regression_tests/lattice_distribmat/True/results_true.dat b/tests/regression_tests/lattice_distribmat/True/results_true.dat new file mode 100644 index 000000000..9ebbb43b8 --- /dev/null +++ b/tests/regression_tests/lattice_distribmat/True/results_true.dat @@ -0,0 +1,2 @@ +k-combined: +1.848895E+00 1.480242E-02 diff --git a/tests/regression_tests/lattice_distribmat/__init__.py b/tests/regression_tests/lattice_distribmat/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/regression_tests/lattice_distribmat/test.py b/tests/regression_tests/lattice_distribmat/test.py new file mode 100644 index 000000000..4d0b6e156 --- /dev/null +++ b/tests/regression_tests/lattice_distribmat/test.py @@ -0,0 +1,83 @@ +import numpy as np +import openmc +from openmc.utility_funcs import change_directory +import pytest + +from tests.testing_harness import PyAPITestHarness + + +@pytest.fixture +def model(): + model = openmc.model.Model() + + uo2 = openmc.Material(name='UO2') + uo2.set_density('g/cm3', 10.0) + uo2.add_nuclide('U235', 1.0) + uo2.add_nuclide('O16', 2.0) + water = openmc.Material(name='light water') + water.add_nuclide('H1', 2.0) + water.add_nuclide('O16', 1.0) + water.set_density('g/cm3', 1.0) + water.add_s_alpha_beta('c_H_in_H2O') + model.materials.extend([uo2, water]) + + cyl = openmc.ZCylinder(r=0.4) + pin = openmc.model.pin([cyl], [uo2, water]) + d = 1.0 + + lattice00 = openmc.RectLattice() + lattice00.lower_left = (-d, -d) + lattice00.pitch = (d, d) + lattice00.outer = pin + lattice00.universes = [[pin]] + box00 = openmc.model.RectangularPrism(d, d, origin=(-d/2,-d/2)) + + lattice01 = openmc.RectLattice() + lattice01.lower_left = (-d, 0) + lattice01.pitch = (d, d) + lattice01.outer = pin + lattice01.universes = [[pin]] + box01 = openmc.model.RectangularPrism(d, d, origin=(-d/2,d/2)) + + lattice10 = openmc.RectLattice() + lattice10.lower_left = (0, -d) + lattice10.pitch = (d, d) + lattice10.outer = pin + lattice10.universes = [[pin]] + box10 = openmc.model.RectangularPrism(d, d, origin=(d/2,-d/2)) + + lattice11 = openmc.RectLattice() + lattice11.lower_left = (0, 0) + lattice11.pitch = (d, d) + lattice11.outer = pin + lattice11.universes = [[pin]] + box11 = openmc.model.RectangularPrism(d, d, origin=(d/2,d/2)) + + + cell00 = openmc.Cell(fill=lattice00, region = -box00) + cell01 = openmc.Cell(fill=lattice01, region = -box01) + cell10 = openmc.Cell(fill=lattice10, region = -box10) + cell11 = openmc.Cell(fill=lattice11, region = -box11) + + univ = openmc.Universe(cells=[cell00, cell01, cell10, cell11]) + + box = openmc.model.RectangularPrism(2*d, 2*d, boundary_type='reflective') + + main_cell = openmc.Cell(fill=univ, region=-box) + model.geometry = openmc.Geometry([main_cell]) + model.geometry.merge_surfaces = True + + model.settings.batches = 10 + model.settings.inactive = 5 + model.settings.particles = 1000 + + return model + +@pytest.mark.parametrize("distribmat", [False, True]) +def test_lattice(model, distribmat): + with change_directory(str(distribmat)): + openmc.reset_auto_ids() + if distribmat: + model.differentiate_mats(depletable_only=False) + harness = PyAPITestHarness('statepoint.10.h5', model) + harness.main() diff --git a/tests/regression_tests/lattice_distribrho/__init__.py b/tests/regression_tests/lattice_distribrho/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/regression_tests/lattice_distribrho/inputs_true.dat b/tests/regression_tests/lattice_distribrho/inputs_true.dat new file mode 100644 index 000000000..5031bea6e --- /dev/null +++ b/tests/regression_tests/lattice_distribrho/inputs_true.dat @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + 1.0 1.0 + 2 2 + -1.0 -1.0 + +1 1 +1 1 + + + + + + + + + eigenvalue + 1000 + 10 + 5 + + diff --git a/tests/regression_tests/lattice_distribrho/results_true.dat b/tests/regression_tests/lattice_distribrho/results_true.dat new file mode 100644 index 000000000..f7f3da8e6 --- /dev/null +++ b/tests/regression_tests/lattice_distribrho/results_true.dat @@ -0,0 +1,2 @@ +k-combined: +1.900249E+00 8.157834E-03 diff --git a/tests/regression_tests/lattice_distribrho/test.py b/tests/regression_tests/lattice_distribrho/test.py new file mode 100644 index 000000000..ec94fe96b --- /dev/null +++ b/tests/regression_tests/lattice_distribrho/test.py @@ -0,0 +1,51 @@ +import openmc +import pytest + +from tests.testing_harness import PyAPITestHarness + + +@pytest.fixture +def model(): + model = openmc.Model() + + uo2 = openmc.Material(name='UO2') + uo2.set_density('g/cm3', 10.0) + uo2.add_nuclide('U235', 1.0) + uo2.add_nuclide('O16', 2.0) + water = openmc.Material(name='light water') + water.add_nuclide('H1', 2.0) + water.add_nuclide('O16', 1.0) + water.set_density('g/cm3', 1.0) + water.add_s_alpha_beta('c_H_in_H2O') + model.materials.extend([uo2, water]) + + cyl = openmc.ZCylinder(r=0.4) + pin = openmc.model.pin([cyl], [uo2, water]) + d = 1.0 + + lattice = openmc.RectLattice() + lattice.lower_left = (-d, -d) + lattice.pitch = (d, d) + lattice.universes = [[pin, pin], + [pin, pin]] + box = openmc.model.RectangularPrism( + 2.0 * d, 2.0 * d, + origin=(0.0, 0.0), + boundary_type='reflective' + ) + + pin.cells[1].density = [10.0, 20.0, 10.0, 20.0] + + model.geometry = openmc.Geometry([openmc.Cell(fill=lattice, region=-box)]) + model.geometry.merge_surfaces = True + + model.settings.batches = 10 + model.settings.inactive = 5 + model.settings.particles = 1000 + + return model + + +def test_lattice_checkerboard(model): + harness = PyAPITestHarness('statepoint.10.h5', model) + harness.main() diff --git a/tests/regression_tests/lattice_hex/results_true.dat b/tests/regression_tests/lattice_hex/results_true.dat index 789bacc40..46db641eb 100644 --- a/tests/regression_tests/lattice_hex/results_true.dat +++ b/tests/regression_tests/lattice_hex/results_true.dat @@ -1,2 +1,2 @@ k-combined: -2.566607E-01 9.207770E-03 +2.595598E-01 9.089294E-03 diff --git a/tests/regression_tests/lattice_hex_coincident/inputs_true.dat b/tests/regression_tests/lattice_hex_coincident/inputs_true.dat index ac82de0ad..fafc03da1 100644 --- a/tests/regression_tests/lattice_hex_coincident/inputs_true.dat +++ b/tests/regression_tests/lattice_hex_coincident/inputs_true.dat @@ -1,45 +1,45 @@ - + - + - - + + - - - - - + + + + + - - + + - - - - - + + + + + - - - - + + + + - - + + 1.4 3
0.0 0.0
@@ -50,25 +50,25 @@ 2 2 2
- - - - - - - - - - - - + + + + + + + + + + + +
eigenvalue 1000 5 2 - + -0.9899494936611666 -0.9899494936611666 0.0 0.9899494936611666 0.9899494936611666 10.0 diff --git a/tests/regression_tests/lattice_hex_coincident/results_true.dat b/tests/regression_tests/lattice_hex_coincident/results_true.dat index c134e123f..c798b66e4 100644 --- a/tests/regression_tests/lattice_hex_coincident/results_true.dat +++ b/tests/regression_tests/lattice_hex_coincident/results_true.dat @@ -1,2 +1,2 @@ k-combined: -1.917792E+00 4.329425E-02 +1.931086E+00 5.968486E-02 diff --git a/tests/regression_tests/lattice_hex_x/inputs_true.dat b/tests/regression_tests/lattice_hex_x/inputs_true.dat index 252fbfc0b..b6536c6a8 100644 --- a/tests/regression_tests/lattice_hex_x/inputs_true.dat +++ b/tests/regression_tests/lattice_hex_x/inputs_true.dat @@ -1,32 +1,32 @@ - + - - - + + + - - - - + + + + - - - + + + - - - - - + + + + + @@ -42,8 +42,8 @@ - - + + 1.235 5.0 4
0.0 0.0 5.0
@@ -91,29 +91,29 @@ 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
- - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + +
eigenvalue 1000 10 5 - + -13.62546635287517 -13.62546635287517 0.0 13.62546635287517 13.62546635287517 10.0 diff --git a/tests/regression_tests/lattice_hex_x/results_true.dat b/tests/regression_tests/lattice_hex_x/results_true.dat index 174dc70cd..44f947283 100644 --- a/tests/regression_tests/lattice_hex_x/results_true.dat +++ b/tests/regression_tests/lattice_hex_x/results_true.dat @@ -1,2 +1,2 @@ k-combined: -1.367975E+00 2.264887E-02 +1.326294E+00 1.193578E-02 diff --git a/tests/regression_tests/lattice_multiple/inputs_true.dat b/tests/regression_tests/lattice_multiple/inputs_true.dat index b249d97c4..06abef582 100644 --- a/tests/regression_tests/lattice_multiple/inputs_true.dat +++ b/tests/regression_tests/lattice_multiple/inputs_true.dat @@ -1,15 +1,15 @@ - - - - + + + + - - - + + + @@ -18,8 +18,8 @@ - - + + 1.2 1.2 1 @@ -37,12 +37,12 @@ 4 4 4 4 - - - - - - + + + + + + eigenvalue diff --git a/tests/regression_tests/lattice_multiple/results_true.dat b/tests/regression_tests/lattice_multiple/results_true.dat index 7a06551bd..0866932d2 100644 --- a/tests/regression_tests/lattice_multiple/results_true.dat +++ b/tests/regression_tests/lattice_multiple/results_true.dat @@ -1,2 +1,2 @@ k-combined: -1.859911E+00 8.282311E-03 +1.843982E+00 5.815875E-03 diff --git a/tests/regression_tests/lattice_rotated/inputs_true.dat b/tests/regression_tests/lattice_rotated/inputs_true.dat index 1b7c74870..e53b93f93 100644 --- a/tests/regression_tests/lattice_rotated/inputs_true.dat +++ b/tests/regression_tests/lattice_rotated/inputs_true.dat @@ -1,18 +1,18 @@ - - - + + + - - - + + + - - - + + + @@ -22,8 +22,8 @@ - - + + 1.25 @@ -51,18 +51,18 @@ 1 1 1 1 1 1 1 1 - - - - - + + + + + eigenvalue 1000 5 0 - + 0.0 0.0 0.0 diff --git a/tests/regression_tests/lattice_rotated/results_true.dat b/tests/regression_tests/lattice_rotated/results_true.dat index eeaa268fb..9a96a9259 100644 --- a/tests/regression_tests/lattice_rotated/results_true.dat +++ b/tests/regression_tests/lattice_rotated/results_true.dat @@ -1,2 +1,2 @@ k-combined: -4.426784E-01 6.627506E-03 +4.515246E-01 2.358354E-02 diff --git a/tests/regression_tests/mg_basic/inputs_true.dat b/tests/regression_tests/mg_basic/inputs_true.dat index 8c6faaf07..aa2c2fa0a 100644 --- a/tests/regression_tests/mg_basic/inputs_true.dat +++ b/tests/regression_tests/mg_basic/inputs_true.dat @@ -3,29 +3,29 @@ 2g.h5 - + - + - + - + - + - - + + @@ -35,20 +35,20 @@ - - - - - - - + + + + + + + eigenvalue 1000 10 5 - + 0.0 -1000.0 -1000.0 154.90833333333333 1000.0 1000.0 diff --git a/tests/regression_tests/mg_basic/results_true.dat b/tests/regression_tests/mg_basic/results_true.dat index 15a9f2186..16980732d 100644 --- a/tests/regression_tests/mg_basic/results_true.dat +++ b/tests/regression_tests/mg_basic/results_true.dat @@ -1,2 +1,2 @@ k-combined: -1.009864E+00 1.107115E-02 +1.004679E+00 1.329350E-02 diff --git a/tests/regression_tests/mg_basic_delayed/inputs_true.dat b/tests/regression_tests/mg_basic_delayed/inputs_true.dat index e0bcad15c..cc3f2cfb2 100644 --- a/tests/regression_tests/mg_basic_delayed/inputs_true.dat +++ b/tests/regression_tests/mg_basic_delayed/inputs_true.dat @@ -3,27 +3,27 @@ 2g.h5 - + - + - + - + - + - + @@ -34,20 +34,20 @@ - - - - - - - + + + + + + + eigenvalue 1000 10 5 - + 0.0 -1000.0 -1000.0 154.90833333333333 1000.0 1000.0 diff --git a/tests/regression_tests/mg_basic_delayed/results_true.dat b/tests/regression_tests/mg_basic_delayed/results_true.dat index 6f7c79c1b..f150030b9 100644 --- a/tests/regression_tests/mg_basic_delayed/results_true.dat +++ b/tests/regression_tests/mg_basic_delayed/results_true.dat @@ -1,2 +1,2 @@ k-combined: -1.024610E+00 9.643746E-03 +1.017078E+00 1.181139E-02 diff --git a/tests/regression_tests/mg_convert/inputs_true.dat b/tests/regression_tests/mg_convert/inputs_true.dat index 4e51ec80c..3b1f511e6 100644 --- a/tests/regression_tests/mg_convert/inputs_true.dat +++ b/tests/regression_tests/mg_convert/inputs_true.dat @@ -3,23 +3,23 @@ mgxs.h5 - + - - - - - + + + + + eigenvalue 100 10 5 - + -5 -5 -5 5 5 5 diff --git a/tests/regression_tests/mg_convert/results_true.dat b/tests/regression_tests/mg_convert/results_true.dat index ff3d7bb91..f8f748cc7 100644 --- a/tests/regression_tests/mg_convert/results_true.dat +++ b/tests/regression_tests/mg_convert/results_true.dat @@ -1,24 +1,24 @@ k-combined: -9.984888E-01 1.558301E-03 +9.926427E-01 3.067527E-03 k-combined: -1.001035E+00 7.622447E-04 +9.932868E-01 2.780271E-03 k-combined: -9.984888E-01 1.558301E-03 +9.926427E-01 3.067527E-03 k-combined: -9.991101E-01 2.776191E-03 +1.000000E+00 0.000000E+00 k-combined: -9.965954E-01 5.185046E-03 +9.902969E-01 1.654717E-02 k-combined: -9.987613E-01 4.806845E-04 +9.882796E-01 1.929843E-03 k-combined: -9.991101E-01 2.776191E-03 +1.000000E+00 0.000000E+00 k-combined: -9.965954E-01 5.185315E-03 +9.902953E-01 1.654291E-02 k-combined: -9.987610E-01 4.791528E-04 +9.882814E-01 1.927488E-03 k-combined: -9.944808E-01 4.458524E-03 +9.893153E-01 7.576652E-03 k-combined: -9.984888E-01 1.558301E-03 +9.926427E-01 3.067527E-03 k-combined: -9.984888E-01 1.558301E-03 +9.926427E-01 3.067527E-03 diff --git a/tests/regression_tests/mg_convert/test.py b/tests/regression_tests/mg_convert/test.py index 8099c89a2..0e50f3a74 100755 --- a/tests/regression_tests/mg_convert/test.py +++ b/tests/regression_tests/mg_convert/test.py @@ -1,3 +1,4 @@ +from math import isnan import os import hashlib @@ -142,10 +143,13 @@ class MGXSTestHarness(PyAPITestHarness): openmc.run(openmc_exec=config['exe']) with openmc.StatePoint('statepoint.{}.h5'.format(batches)) as sp: + # Sometimes NaN results are produced; convert these to 0.0 + std_dev = 0.0 if isnan(sp.keff.s) else sp.keff.s + # Write out k-combined. outstr += 'k-combined:\n' form = '{:12.6E} {:12.6E}\n' - outstr += form.format(sp.keff.n, sp.keff.s) + outstr += form.format(sp.keff.n, std_dev) return outstr diff --git a/tests/regression_tests/mg_legendre/inputs_true.dat b/tests/regression_tests/mg_legendre/inputs_true.dat index 34ff7b630..81362f20a 100644 --- a/tests/regression_tests/mg_legendre/inputs_true.dat +++ b/tests/regression_tests/mg_legendre/inputs_true.dat @@ -3,21 +3,21 @@ 2g.h5 - + - - + + eigenvalue 1000 10 5 - + 0.0 -1000.0 -1000.0 929.45 1000.0 1000.0 diff --git a/tests/regression_tests/mg_legendre/results_true.dat b/tests/regression_tests/mg_legendre/results_true.dat index e2989469c..04d9c9874 100644 --- a/tests/regression_tests/mg_legendre/results_true.dat +++ b/tests/regression_tests/mg_legendre/results_true.dat @@ -1,2 +1,2 @@ k-combined: -1.003646E+00 9.134747E-03 +1.009220E+00 9.571832E-03 diff --git a/tests/regression_tests/mg_max_order/inputs_true.dat b/tests/regression_tests/mg_max_order/inputs_true.dat index b6d70dc4c..c8f42d1a3 100644 --- a/tests/regression_tests/mg_max_order/inputs_true.dat +++ b/tests/regression_tests/mg_max_order/inputs_true.dat @@ -3,21 +3,21 @@ 2g.h5 - + - - + + eigenvalue 1000 10 5 - + 0.0 -1000.0 -1000.0 929.45 1000.0 1000.0 diff --git a/tests/regression_tests/mg_max_order/results_true.dat b/tests/regression_tests/mg_max_order/results_true.dat index e2989469c..04d9c9874 100644 --- a/tests/regression_tests/mg_max_order/results_true.dat +++ b/tests/regression_tests/mg_max_order/results_true.dat @@ -1,2 +1,2 @@ k-combined: -1.003646E+00 9.134747E-03 +1.009220E+00 9.571832E-03 diff --git a/tests/regression_tests/mg_survival_biasing/inputs_true.dat b/tests/regression_tests/mg_survival_biasing/inputs_true.dat index 6529c60d8..bee69729d 100644 --- a/tests/regression_tests/mg_survival_biasing/inputs_true.dat +++ b/tests/regression_tests/mg_survival_biasing/inputs_true.dat @@ -3,21 +3,21 @@ 2g.h5 - + - - + + eigenvalue 1000 10 5 - + 0.0 -1000.0 -1000.0 929.45 1000.0 1000.0 diff --git a/tests/regression_tests/mg_survival_biasing/results_true.dat b/tests/regression_tests/mg_survival_biasing/results_true.dat index cddbdaceb..4b26978ad 100644 --- a/tests/regression_tests/mg_survival_biasing/results_true.dat +++ b/tests/regression_tests/mg_survival_biasing/results_true.dat @@ -1,2 +1,2 @@ k-combined: -9.878738E-01 8.326224E-03 +9.889968E-01 9.144186E-03 diff --git a/tests/regression_tests/mg_tallies/inputs_true.dat b/tests/regression_tests/mg_tallies/inputs_true.dat index c526b65a2..f4f154244 100644 --- a/tests/regression_tests/mg_tallies/inputs_true.dat +++ b/tests/regression_tests/mg_tallies/inputs_true.dat @@ -3,21 +3,21 @@ 2g.h5 - + - - + + eigenvalue 1000 10 5 - + 0.0 -1000.0 -1000.0 929.45 1000.0 1000.0 diff --git a/tests/regression_tests/mg_tallies/results_true.dat b/tests/regression_tests/mg_tallies/results_true.dat index 7484dd248..07fe22ce5 100644 --- a/tests/regression_tests/mg_tallies/results_true.dat +++ b/tests/regression_tests/mg_tallies/results_true.dat @@ -1,1324 +1,1324 @@ k-combined: -1.003646E+00 9.134747E-03 +1.012390E+00 9.679132E-03 tally 1: -5.220000E-01 -5.995400E-02 -1.400000E-02 -4.000000E-05 -6.718865E-03 -9.371695E-06 -1.106435E-02 -3.119729E-05 -1.216992E-07 -3.699412E-15 -1.106435E-02 -3.119729E-05 +1.342000E+00 +4.291640E-01 +7.000000E-02 +1.158000E-03 +2.919844E-02 +1.953371E-04 +5.372246E-02 +6.734832E-04 +2.939310E-07 +2.375686E-14 +5.372246E-02 +6.734832E-04 0.000000E+00 0.000000E+00 -1.343773E+06 -3.748678E+11 -5.220000E-01 -5.995400E-02 +5.839688E+06 +7.813485E+12 +1.342000E+00 +4.291640E-01 0.000000E+00 0.000000E+00 -1.520872E+00 -5.121226E-01 -2.564000E+00 -1.338762E+00 -1.160000E-01 -2.738000E-03 -4.593685E-02 -4.275719E-04 -1.360763E-01 -3.951569E-03 -8.079937E-07 -1.577355E-13 -1.350645E-01 -3.872739E-03 -1.011813E-03 -1.023765E-06 -9.187371E+06 -1.710288E+13 -2.564000E+00 -1.338762E+00 -8.595248E-04 -7.387829E-07 -7.412367E+00 -1.121746E+01 -2.184000E+00 -9.895940E-01 -1.080000E-01 -2.394000E-03 -4.782785E-02 -4.787428E-04 -1.140806E-01 -2.886440E-03 -6.242229E-07 -9.307161E-14 -1.130687E-01 -2.811706E-03 -1.011813E-03 -1.023765E-06 -9.565570E+06 -1.914971E+13 -2.184000E+00 -9.895940E-01 -3.312574E-05 -1.097314E-09 -6.331465E+00 -8.328826E+00 -5.970000E-01 -8.325100E-02 -3.500000E-02 -3.150000E-04 -1.514871E-02 -5.131352E-05 -3.795718E-02 -3.631435E-04 -2.299730E-07 -1.295603E-14 -3.795718E-02 -3.631435E-04 +3.915206E+00 +3.646810E+00 +2.701000E+00 +1.486587E+00 +1.340000E-01 +3.598000E-03 +5.583136E-02 +6.266530E-04 +1.267275E-01 +3.349463E-03 +7.209619E-07 +1.153253E-13 +1.267275E-01 +3.349463E-03 0.000000E+00 0.000000E+00 -3.029741E+06 -2.052541E+12 -5.970000E-01 -8.325100E-02 +1.116627E+07 +2.506612E+13 +2.701000E+00 +1.486587E+00 0.000000E+00 0.000000E+00 -1.714353E+00 -6.970480E-01 -1.852000E+00 -7.973360E-01 -7.900000E-02 -1.689000E-03 -2.755187E-02 -2.091740E-04 -5.453423E-02 -7.484037E-04 -2.368001E-07 -1.753710E-14 -5.453423E-02 -7.484037E-04 +7.844332E+00 +1.252301E+01 +2.791000E+00 +1.658877E+00 +1.240000E-01 +3.282000E-03 +5.173865E-02 +5.560435E-04 +1.292971E-01 +3.436301E-03 +6.920456E-07 +9.917496E-14 +1.263311E-01 +3.290664E-03 +2.965960E-03 +4.837204E-06 +1.034773E+07 +2.224174E+13 +2.791000E+00 +1.658877E+00 +7.133747E-04 +3.640977E-07 +8.120311E+00 +1.408288E+01 +3.169000E+00 +2.031747E+00 +1.620000E-01 +5.364000E-03 +6.707115E-02 +9.171975E-04 +1.648345E-01 +5.547084E-03 +1.008876E-06 +2.201766E-13 +1.638199E-01 +5.463700E-03 +1.014608E-03 +1.029429E-06 +1.341423E+07 +3.668790E+13 +3.169000E+00 +2.031747E+00 +8.618993E-04 +7.428703E-07 +9.158565E+00 +1.699756E+01 +3.660000E+00 +2.796494E+00 +1.580000E-01 +5.158000E-03 +6.719242E-02 +9.422093E-04 +1.591500E-01 +5.615224E-03 +8.020080E-07 +1.480166E-13 +1.581743E-01 +5.540021E-03 +9.756761E-04 +9.519438E-07 +1.343848E+07 +3.768837E+13 +3.660000E+00 +2.796494E+00 +2.954152E-04 +8.727014E-08 +1.067773E+01 +2.376726E+01 +2.527000E+00 +1.452369E+00 +1.140000E-01 +2.834000E-03 +4.984389E-02 +5.325247E-04 +1.111356E-01 +2.793586E-03 +7.289084E-07 +1.302125E-13 +1.111356E-01 +2.793586E-03 0.000000E+00 0.000000E+00 -5.510374E+06 -8.366961E+12 -1.852000E+00 -7.973360E-01 +9.968777E+06 +2.130099E+13 +2.527000E+00 +1.452369E+00 0.000000E+00 0.000000E+00 -5.449659E+00 -6.908544E+00 -4.177000E+00 -3.780409E+00 -1.760000E-01 -6.584000E-03 -7.049310E-02 -1.047700E-03 -2.082153E-01 -9.154274E-03 -1.090026E-06 -2.590031E-13 -2.082153E-01 -9.154274E-03 +7.323996E+00 +1.221424E+01 +3.204000E+00 +2.092834E+00 +1.500000E-01 +4.600000E-03 +6.029165E-02 +7.387235E-04 +1.410668E-01 +4.414885E-03 +8.384625E-07 +1.602532E-13 +1.400911E-01 +4.332066E-03 +9.756761E-04 +9.519438E-07 +1.205833E+07 +2.954894E+13 +3.204000E+00 +2.092834E+00 +3.194266E-05 +1.020333E-09 +9.309783E+00 +1.769870E+01 +3.463000E+00 +2.477679E+00 +1.670000E-01 +5.837000E-03 +6.829328E-02 +9.882225E-04 +1.758063E-01 +6.470636E-03 +9.887100E-07 +2.199856E-13 +1.737856E-01 +6.307226E-03 +2.020620E-03 +2.041459E-06 +1.365866E+07 +3.952890E+13 +3.463000E+00 +2.477679E+00 +4.276023E-04 +1.081885E-07 +1.003961E+01 +2.083120E+01 +2.970000E-01 +4.491300E-02 +1.500000E-02 +9.100000E-05 +4.215863E-03 +6.275840E-06 +6.040786E-03 +1.401662E-05 +2.142282E-08 +4.361920E-16 +6.040786E-03 +1.401662E-05 0.000000E+00 0.000000E+00 -1.409862E+07 -4.190799E+13 -4.177000E+00 -3.780409E+00 +8.431726E+05 +2.510336E+11 +2.970000E-01 +4.491300E-02 0.000000E+00 0.000000E+00 -1.213785E+01 -3.197979E+01 -2.287000E+00 -1.059809E+00 -1.040000E-01 -2.254000E-03 -4.025632E-02 -3.309459E-04 -9.479325E-02 -1.956154E-03 -4.705869E-07 -4.509695E-14 -9.479325E-02 -1.956154E-03 +8.785109E-01 +3.967096E-01 +1.250000E-01 +5.357000E-03 +2.000000E-03 +2.000000E-06 +4.888503E-04 +1.194873E-07 +2.028292E-03 +2.059943E-06 +8.582314E-09 +7.099216E-17 +2.028292E-03 +2.059943E-06 0.000000E+00 0.000000E+00 -8.051265E+06 -1.323783E+13 -2.287000E+00 -1.059809E+00 +9.777007E+04 +4.779493E+09 +1.250000E-01 +5.357000E-03 0.000000E+00 0.000000E+00 -6.680550E+00 -9.051488E+00 -6.398000E+00 -8.323220E+00 -2.580000E-01 -1.356600E-02 -1.070205E-01 -2.345401E-03 -2.825180E-01 -1.658268E-02 -1.510574E-06 -5.135513E-13 -2.805357E-01 -1.633928E-02 -1.982273E-03 -1.965559E-06 -2.140411E+07 -9.381603E+13 -6.398000E+00 -8.323220E+00 -6.001927E-04 -1.801940E-07 -1.863566E+01 -7.066273E+01 -1.167000E+00 -4.778410E-01 -5.100000E-02 -9.290000E-04 -1.851002E-02 -1.273765E-04 -3.405873E-02 -6.277248E-04 -1.688115E-07 -1.480555E-14 -3.195431E-02 -5.302962E-04 -2.104418E-03 -4.428574E-06 -3.702005E+06 -5.095061E+12 -1.167000E+00 -4.778410E-01 -3.530361E-04 -1.246345E-07 -3.428588E+00 -4.115657E+00 -3.630000E+00 -2.765806E+00 -1.490000E-01 -4.587000E-03 -5.894825E-02 -7.367371E-04 -1.434581E-01 -4.305327E-03 -7.603618E-07 -1.250071E-13 -1.414758E-01 -4.212618E-03 -1.982273E-03 -1.965559E-06 -1.178965E+07 -2.946948E+13 -3.630000E+00 -2.765806E+00 -4.160428E-04 -1.012741E-07 -1.059988E+01 -2.359174E+01 +3.698633E-01 +4.679347E-02 tally 2: -5.033991E-01 -5.701830E-02 -2.304219E-02 -1.162005E-04 -9.376617E-03 -1.933443E-05 -2.344154E-02 -1.208402E-04 -1.277674E-07 -3.888071E-15 -2.329292E-02 -1.193128E-04 -1.486195E-04 -4.857250E-09 -1.875323E+06 -7.733771E+11 -5.220000E-01 -5.995400E-02 -6.963583E-05 -1.066362E-09 -1.463809E+00 -4.840945E-01 -2.621546E+00 -1.396717E+00 -1.276380E-01 -3.311549E-03 -5.565805E-02 -6.598224E-04 -1.391451E-01 -4.123890E-03 -8.331879E-07 -1.660597E-13 -1.382629E-01 -4.071765E-03 -8.821806E-04 -1.657624E-07 -1.113161E+07 -2.639289E+13 -2.581000E+00 -1.357455E+00 -4.133468E-04 -3.639153E-08 -7.576783E+00 -1.169599E+01 -2.230626E+00 -1.033217E+00 -1.065165E-01 -2.416670E-03 -4.549248E-02 -4.740035E-04 -1.137312E-01 -2.962522E-03 -6.630810E-07 -1.170893E-13 -1.130101E-01 -2.925076E-03 -7.210562E-04 -1.190805E-07 -9.098495E+06 -1.896014E+13 -2.202000E+00 -1.007194E+00 -3.378518E-04 -2.614296E-08 -6.459596E+00 -8.662758E+00 -5.565395E-01 -7.242839E-02 -2.955239E-02 -1.840142E-04 -1.400990E-02 -4.103227E-05 -3.502476E-02 -2.564517E-04 -2.308081E-07 -1.205491E-14 -3.480270E-02 -2.532102E-04 -2.220571E-04 -1.030824E-08 -2.801981E+06 -1.641291E+12 -6.090000E-01 -8.636300E-02 -1.040451E-04 -2.263074E-09 -1.593637E+00 -6.040566E-01 -1.817267E+00 -7.710225E-01 -7.367627E-02 -1.267666E-03 -2.535616E-02 -1.551036E-04 -6.339039E-02 -9.693976E-04 -2.524798E-07 -1.896478E-14 -6.298850E-02 -9.571446E-04 -4.018954E-04 -3.896557E-08 -5.071232E+06 -6.204145E+12 -1.881000E+00 -8.206930E-01 -1.883086E-04 -8.554511E-09 -5.341905E+00 -6.666854E+00 -4.106914E+00 -3.704316E+00 -1.888617E-01 -7.777635E-03 -7.727973E-02 -1.309080E-03 -1.931993E-01 -8.181751E-03 -1.061590E-06 -2.554724E-13 -1.919744E-01 -8.078335E-03 -1.224884E-03 -3.288708E-07 -1.545595E+07 -5.236321E+13 -4.223000E+00 -3.850821E+00 -5.739211E-04 -7.220038E-08 -1.193698E+01 -3.133321E+01 -2.346339E+00 -1.119793E+00 -1.017476E-01 -2.080323E-03 -3.865443E-02 -3.024337E-04 -9.663608E-02 -1.890211E-03 -4.714003E-07 -4.853805E-14 -9.602340E-02 -1.866319E-03 -6.126731E-04 -7.597824E-08 -7.730886E+06 -1.209735E+13 -2.338000E+00 -1.106368E+00 -2.870687E-04 -1.668028E-08 -6.857029E+00 -9.581045E+00 -6.446883E+00 -8.447751E+00 -2.867793E-01 -1.670093E-02 -1.126541E-01 -2.611201E-03 -2.816352E-01 -1.632001E-02 -1.453669E-06 -4.585416E-13 -2.798496E-01 -1.611372E-02 -1.785568E-03 -6.559933E-07 -2.253081E+07 -1.044480E+14 -6.454000E+00 -8.471478E+00 -8.366302E-04 -1.440169E-07 -1.879692E+01 -7.185693E+01 -1.219419E+00 -5.127750E-01 -4.857020E-02 -8.389250E-04 -1.623897E-02 -1.008738E-04 -4.059741E-02 -6.304611E-04 -1.503579E-07 -1.146797E-14 -4.034003E-02 -6.224921E-04 -2.573878E-04 -2.534179E-08 -3.247793E+06 -4.034951E+12 -1.199000E+00 -4.975810E-01 -1.205994E-04 -5.563543E-09 -3.589772E+00 -4.434695E+00 -3.623361E+00 -2.780040E+00 -1.560708E-01 -5.162316E-03 -5.875078E-02 -7.419979E-04 -1.468770E-01 -4.637487E-03 -7.048177E-07 -1.136014E-13 -1.459458E-01 -4.578870E-03 -9.312005E-04 -1.864068E-07 -1.175016E+07 -2.967992E+13 -3.668000E+00 -2.824270E+00 -4.363151E-04 -4.092380E-08 -1.059543E+01 -2.377944E+01 +1.353006E+00 +4.298474E-01 +6.067126E-02 +9.182923E-04 +2.407597E-02 +1.589874E-04 +6.018994E-02 +9.936715E-04 +3.157310E-07 +3.268202E-14 +5.980833E-02 +9.811116E-04 +3.816044E-04 +3.994127E-08 +4.815195E+06 +6.359497E+12 +1.373000E+00 +4.448330E-01 +1.788012E-04 +8.768717E-09 +3.941968E+00 +3.631126E+00 +2.806910E+00 +1.600166E+00 +1.295488E-01 +3.449533E-03 +5.323702E-02 +5.945274E-04 +1.330925E-01 +3.715796E-03 +7.358638E-07 +1.182977E-13 +1.322487E-01 +3.668829E-03 +8.438073E-04 +1.493588E-07 +1.064740E+07 +2.378109E+13 +2.753000E+00 +1.542179E+00 +3.953669E-04 +3.279028E-08 +8.155605E+00 +1.349706E+01 +2.869647E+00 +1.739405E+00 +1.278179E-01 +3.407189E-03 +5.029332E-02 +5.252401E-04 +1.257333E-01 +3.282751E-03 +6.507109E-07 +8.979533E-14 +1.249362E-01 +3.241257E-03 +7.971497E-04 +1.319523E-07 +1.005866E+07 +2.100960E+13 +2.829000E+00 +1.702143E+00 +3.735055E-04 +2.896884E-08 +8.365907E+00 +1.480669E+01 +3.141043E+00 +1.981851E+00 +1.526263E-01 +4.699686E-03 +6.641498E-02 +9.211853E-04 +1.660374E-01 +5.757408E-03 +9.915981E-07 +2.229928E-13 +1.649848E-01 +5.684636E-03 +1.052678E-03 +2.314228E-07 +1.328300E+07 +3.684741E+13 +3.246000E+00 +2.132054E+00 +4.932336E-04 +5.080661E-08 +9.080077E+00 +1.658064E+01 +3.682383E+00 +2.808072E+00 +1.593265E-01 +5.346789E-03 +6.034523E-02 +7.901305E-04 +1.508631E-01 +4.938316E-03 +7.319663E-07 +1.246559E-13 +1.499066E-01 +4.875896E-03 +9.564725E-04 +1.984988E-07 +1.206905E+07 +3.160522E+13 +3.759000E+00 +2.944479E+00 +4.481564E-04 +4.357848E-08 +1.076370E+01 +2.396100E+01 +2.634850E+00 +1.584334E+00 +1.218122E-01 +3.391010E-03 +5.015643E-02 +5.871038E-04 +1.253911E-01 +3.669399E-03 +6.952485E-07 +1.202338E-13 +1.245961E-01 +3.623018E-03 +7.949798E-04 +1.474939E-07 +1.003129E+07 +2.348415E+13 +2.577000E+00 +1.509201E+00 +3.724888E-04 +3.238084E-08 +7.654439E+00 +1.338000E+01 +3.192584E+00 +2.071165E+00 +1.491327E-01 +4.485370E-03 +6.214556E-02 +7.933462E-04 +1.553639E-01 +4.958414E-03 +8.761442E-07 +1.691919E-13 +1.543789E-01 +4.895740E-03 +9.850078E-04 +1.993067E-07 +1.242911E+07 +3.173385E+13 +3.266000E+00 +2.172442E+00 +4.615266E-04 +4.375584E-08 +9.265396E+00 +1.747782E+01 +3.402213E+00 +2.415762E+00 +1.592235E-01 +5.219460E-03 +6.649290E-02 +9.066793E-04 +1.662323E-01 +5.666746E-03 +9.402303E-07 +1.840541E-13 +1.651783E-01 +5.595119E-03 +1.053913E-03 +2.277785E-07 +1.329858E+07 +3.626717E+13 +3.485000E+00 +2.510947E+00 +4.938123E-04 +5.000655E-08 +9.871966E+00 +2.037665E+01 +3.110378E-01 +5.227746E-02 +1.171121E-02 +6.542918E-05 +3.536640E-03 +5.149982E-06 +8.841599E-03 +3.218739E-05 +2.347065E-08 +5.243075E-16 +8.785544E-03 +3.178055E-05 +5.605578E-05 +1.293793E-09 +7.073280E+05 +2.059993E+11 +3.000000E-01 +4.514200E-02 +2.626500E-05 +2.840396E-10 +9.197485E-01 +4.619575E-01 +1.267544E-01 +5.491246E-03 +4.806410E-03 +8.161899E-06 +1.471497E-03 +8.779657E-07 +3.678743E-03 +5.487286E-06 +1.030812E-08 +1.028225E-16 +3.655420E-03 +5.417928E-06 +2.332325E-05 +2.205650E-10 +2.942995E+05 +3.511863E+10 +1.300000E-01 +5.822000E-03 +1.092814E-05 +4.842290E-11 +3.746117E-01 +4.790053E-02 tally 3: -1.092010E+02 -2.386227E+03 -4.975000E+00 -4.950147E+00 -2.009472E+00 -8.076733E-01 -5.000649E+00 -5.012321E+00 -2.728992E-05 -1.491241E-10 -4.964474E+00 -4.939215E+00 -3.617555E-02 -2.875519E-04 -4.018944E+08 -3.230693E+16 -1.092010E+02 -2.386227E+03 -1.333979E-02 -5.019969E-05 -3.176576E+02 -2.019260E+04 -1.042260E+02 -2.173864E+03 -1.042260E+02 -2.173864E+03 +1.098420E+02 +2.414277E+03 +4.993000E+00 +4.986021E+00 +2.023763E+00 +8.192234E-01 +5.037812E+00 +5.086734E+00 +2.745346E-05 +1.509092E-10 +5.002505E+00 +5.014944E+00 +3.530702E-02 +2.695026E-04 +4.047525E+08 +3.276894E+16 +1.098420E+02 +2.414277E+03 +1.059695E-02 +2.782849E-05 +3.195213E+02 +2.042961E+04 +1.048490E+02 +2.199887E+03 +1.048490E+02 +2.199887E+03 tally 4: -1.092010E+02 -2.386227E+03 -4.979068E+00 -4.959690E+00 -2.016700E+00 -8.137138E-01 -5.041749E+00 -5.085712E+00 -5.020635E-05 -5.047241E-10 -5.009785E+00 -5.021429E+00 -3.196471E-02 -2.044235E-04 -4.033399E+08 -3.254855E+16 -1.092010E+02 -2.386227E+03 -1.497710E-02 -4.487918E-05 -3.176576E+02 -2.019260E+04 +1.098420E+02 +2.414277E+03 +5.008447E+00 +5.018748E+00 +2.028674E+00 +8.234818E-01 +5.071684E+00 +5.146761E+00 +5.050718E-05 +5.107669E-10 +5.039530E+00 +5.081707E+00 +3.215450E-02 +2.068774E-04 +4.057347E+08 +3.293927E+16 +1.098420E+02 +2.414277E+03 +1.506603E-02 +4.541792E-05 +3.195213E+02 +2.042961E+04 tally 5: -1.097121E+02 -2.408636E+03 -5.009145E+00 -5.019563E+00 -2.032191E+00 -8.264420E-01 -5.080477E+00 -5.165263E+00 -2.756641E-05 -1.523527E-10 -5.048267E+00 -5.099975E+00 -3.221025E-02 -2.076211E-04 -4.064382E+08 -3.305768E+16 -1.093810E+02 -2.394075E+03 -1.509215E-02 -4.558119E-05 -3.191033E+02 -2.037736E+04 +1.103689E+02 +2.437562E+03 +5.035611E+00 +5.073005E+00 +2.041209E+00 +8.337913E-01 +5.103022E+00 +5.211196E+00 +2.765405E-05 +1.532759E-10 +5.070669E+00 +5.145327E+00 +3.235318E-02 +2.094674E-04 +4.082417E+08 +3.335165E+16 +1.098580E+02 +2.414983E+03 +1.515912E-02 +4.598653E-05 +3.210351E+02 +2.062463E+04 tally 6: -1.042260E+02 -2.173864E+03 -1.042260E+02 -2.173864E+03 -5.000649E+00 -5.012321E+00 +1.048490E+02 +2.199887E+03 +1.048490E+02 +2.199887E+03 +5.037812E+00 +5.086734E+00 tally 7: -6.507000E+00 -8.478423E+00 -1.444000E+00 -4.172780E-01 -1.146407E+00 -2.630079E-01 -2.867025E+00 -1.647980E+00 -2.707153E-05 -1.467503E-10 -2.848880E+00 -1.627146E+00 -1.814469E-02 -6.685238E-05 -2.292814E+08 -1.052031E+16 -6.507000E+00 -8.478423E+00 -9.467712E-03 -2.396878E-05 -1.191147E+01 -2.841087E+01 -5.063000E+00 -5.136983E+00 -5.063000E+00 -5.136983E+00 -1.026940E+02 -2.110535E+03 +6.546000E+00 +8.579894E+00 +1.462000E+00 +4.278220E-01 +1.160697E+00 +2.696537E-01 +2.879845E+00 +1.663297E+00 +2.723379E-05 +1.485067E-10 +2.862628E+00 +1.643479E+00 +1.721726E-02 +6.055382E-05 +2.321395E+08 +1.078615E+16 +6.546000E+00 +8.579894E+00 +6.709978E-03 +1.387848E-05 +1.198287E+01 +2.875089E+01 +5.084000E+00 +5.178800E+00 +5.084000E+00 +5.178800E+00 +1.032960E+02 +2.135240E+03 3.531000E+00 -2.493861E+00 +2.493943E+00 8.630652E-01 -1.489924E-01 -2.133624E+00 -9.150435E-01 -2.183901E-07 -9.544829E-15 -2.115593E+00 -8.991467E-01 -1.803087E-02 -8.677353E-05 +1.489973E-01 +2.157967E+00 +9.345420E-01 +2.196703E-07 +9.656558E-15 +2.139877E+00 +9.185178E-01 +1.808977E-02 +8.744581E-05 1.726130E+08 -5.959695E+15 -1.026940E+02 -2.110535E+03 -3.872081E-03 -5.919692E-06 -3.057461E+02 -1.870786E+04 -9.916300E+01 -1.968002E+03 -9.916300E+01 -1.968002E+03 +5.959891E+15 +1.032960E+02 +2.135240E+03 +3.886968E-03 +5.976458E-06 +3.075384E+02 +1.892685E+04 +9.976500E+01 +1.991860E+03 +9.976500E+01 +1.991860E+03 tally 8: -6.507000E+00 -8.478423E+00 -1.455344E+00 -4.241161E-01 -1.155413E+00 -2.673178E-01 -2.888532E+00 -1.670737E+00 -4.955615E-05 -4.917547E-10 -2.870219E+00 -1.649619E+00 -1.831331E-02 -6.715634E-05 -2.310826E+08 -1.069271E+16 -6.507000E+00 -8.478423E+00 -8.580723E-03 -1.474352E-05 -1.191147E+01 -2.841087E+01 -1.026940E+02 -2.110535E+03 -3.523724E+00 -2.484884E+00 -8.612868E-01 -1.484560E-01 -2.153217E+00 -9.278503E-01 -6.502027E-07 -8.460574E-14 -2.139566E+00 -9.161225E-01 -1.365140E-02 -3.729555E-05 -1.722574E+08 -5.938242E+15 -1.026940E+02 -2.110535E+03 -6.396382E-03 -8.187874E-06 -3.057461E+02 -1.870786E+04 +6.546000E+00 +8.579894E+00 +1.464067E+00 +4.291919E-01 +1.162338E+00 +2.705171E-01 +2.905845E+00 +1.690732E+00 +4.985316E-05 +4.976401E-10 +2.887422E+00 +1.669362E+00 +1.842307E-02 +6.796008E-05 +2.324676E+08 +1.082069E+16 +6.546000E+00 +8.579894E+00 +8.632151E-03 +1.491997E-05 +1.198287E+01 +2.875089E+01 +1.032960E+02 +2.135240E+03 +3.544380E+00 +2.513971E+00 +8.663357E-01 +1.501938E-01 +2.165839E+00 +9.387115E-01 +6.540142E-07 +8.559612E-14 +2.152108E+00 +9.268463E-01 +1.373143E-02 +3.773212E-05 +1.732671E+08 +6.007753E+15 +1.032960E+02 +2.135240E+03 +6.433878E-03 +8.283719E-06 +3.075384E+02 +1.892685E+04 tally 9: -6.573230E+00 -8.663027E+00 -1.470157E+00 -4.333505E-01 -1.167173E+00 -2.731383E-01 -2.917933E+00 -1.707114E+00 -2.734707E-05 -1.499456E-10 -2.899433E+00 -1.685536E+00 -1.849971E-02 -6.861856E-05 -2.334346E+08 -1.092553E+16 -6.518000E+00 -8.507644E+00 -8.668060E-03 -1.506454E-05 -1.203271E+01 -2.902947E+01 -1.031389E+02 -2.128993E+03 -3.538988E+00 -2.506616E+00 -8.650177E-01 -1.497544E-01 -2.162544E+00 -9.359650E-01 -2.193361E-07 -9.628305E-15 -2.148834E+00 -9.241346E-01 -1.371054E-02 -3.762172E-05 -1.730035E+08 -5.990176E+15 -1.028630E+02 -2.117467E+03 -6.424090E-03 -8.259483E-06 -3.070706E+02 -1.887148E+04 +6.593971E+00 +8.715030E+00 +1.474796E+00 +4.359519E-01 +1.170856E+00 +2.747779E-01 +2.927140E+00 +1.717362E+00 +2.743336E-05 +1.508457E-10 +2.908582E+00 +1.695655E+00 +1.855808E-02 +6.903047E-05 +2.341712E+08 +1.099112E+16 +6.547000E+00 +8.582573E+00 +8.695410E-03 +1.515497E-05 +1.207068E+01 +2.920373E+01 +1.037750E+02 +2.155274E+03 +3.560815E+00 +2.537559E+00 +8.703528E-01 +1.516031E-01 +2.175882E+00 +9.475192E-01 +2.206889E-07 +9.747163E-15 +2.162087E+00 +9.355427E-01 +1.379510E-02 +3.808615E-05 +1.740706E+08 +6.064123E+15 +1.033110E+02 +2.135863E+03 +6.463712E-03 +8.361443E-06 +3.089644E+02 +1.910444E+04 tally 10: -5.063000E+00 -5.136983E+00 -5.063000E+00 -5.136983E+00 +5.084000E+00 +5.178800E+00 +5.084000E+00 +5.178800E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -2.867025E+00 -1.647980E+00 -1.445000E+00 -4.178610E-01 -1.445000E+00 -4.178610E-01 +2.879845E+00 +1.663297E+00 +1.463000E+00 +4.284330E-01 +1.463000E+00 +4.284330E-01 0.000000E+00 0.000000E+00 -9.771800E+01 -1.911083E+03 -9.771800E+01 -1.911083E+03 -2.133624E+00 -9.150435E-01 +9.830200E+01 +1.933884E+03 +9.830200E+01 +1.933884E+03 +2.157967E+00 +9.345420E-01 tally 11: -5.220000E-01 -5.995400E-02 -1.400000E-02 -4.000000E-05 -6.718865E-03 -9.371695E-06 -1.106435E-02 -3.119729E-05 -1.216992E-07 -3.699412E-15 -1.106435E-02 -3.119729E-05 +1.342000E+00 +4.291640E-01 +7.000000E-02 +1.158000E-03 +2.919844E-02 +1.953371E-04 +5.372246E-02 +6.734832E-04 +2.939310E-07 +2.375686E-14 +5.372246E-02 +6.734832E-04 0.000000E+00 0.000000E+00 -1.343773E+06 -3.748678E+11 -5.220000E-01 -5.995400E-02 +5.839688E+06 +7.813485E+12 +1.342000E+00 +4.291640E-01 0.000000E+00 0.000000E+00 -2.564000E+00 -1.338762E+00 -1.160000E-01 -2.738000E-03 -4.593685E-02 -4.275719E-04 -1.360763E-01 -3.951569E-03 -8.079937E-07 -1.577355E-13 -1.350645E-01 -3.872739E-03 -1.011813E-03 -1.023765E-06 -9.187371E+06 -1.710288E+13 -2.564000E+00 -1.338762E+00 -8.595248E-04 -7.387829E-07 -2.184000E+00 -9.895940E-01 -1.080000E-01 -2.394000E-03 -4.782785E-02 -4.787428E-04 -1.140806E-01 -2.886440E-03 -6.242229E-07 -9.307161E-14 -1.130687E-01 -2.811706E-03 -1.011813E-03 -1.023765E-06 -9.565570E+06 -1.914971E+13 -2.184000E+00 -9.895940E-01 -3.312574E-05 -1.097314E-09 -5.970000E-01 -8.325100E-02 -3.500000E-02 -3.150000E-04 -1.514871E-02 -5.131352E-05 -3.795718E-02 -3.631435E-04 -2.299730E-07 -1.295603E-14 -3.795718E-02 -3.631435E-04 +2.701000E+00 +1.486587E+00 +1.340000E-01 +3.598000E-03 +5.583136E-02 +6.266530E-04 +1.267275E-01 +3.349463E-03 +7.209619E-07 +1.153253E-13 +1.267275E-01 +3.349463E-03 0.000000E+00 0.000000E+00 -3.029741E+06 -2.052541E+12 -5.970000E-01 -8.325100E-02 +1.116627E+07 +2.506612E+13 +2.701000E+00 +1.486587E+00 0.000000E+00 0.000000E+00 -1.852000E+00 -7.973360E-01 -7.900000E-02 -1.689000E-03 -2.755187E-02 -2.091740E-04 -5.453423E-02 -7.484037E-04 -2.368001E-07 -1.753710E-14 -5.453423E-02 -7.484037E-04 +2.791000E+00 +1.658877E+00 +1.240000E-01 +3.282000E-03 +5.173865E-02 +5.560435E-04 +1.292971E-01 +3.436301E-03 +6.920456E-07 +9.917496E-14 +1.263311E-01 +3.290664E-03 +2.965960E-03 +4.837204E-06 +1.034773E+07 +2.224174E+13 +2.791000E+00 +1.658877E+00 +7.133747E-04 +3.640977E-07 +3.169000E+00 +2.031747E+00 +1.620000E-01 +5.364000E-03 +6.707115E-02 +9.171975E-04 +1.648345E-01 +5.547084E-03 +1.008876E-06 +2.201766E-13 +1.638199E-01 +5.463700E-03 +1.014608E-03 +1.029429E-06 +1.341423E+07 +3.668790E+13 +3.169000E+00 +2.031747E+00 +8.618993E-04 +7.428703E-07 +3.660000E+00 +2.796494E+00 +1.580000E-01 +5.158000E-03 +6.719242E-02 +9.422093E-04 +1.591500E-01 +5.615224E-03 +8.020080E-07 +1.480166E-13 +1.581743E-01 +5.540021E-03 +9.756761E-04 +9.519438E-07 +1.343848E+07 +3.768837E+13 +3.660000E+00 +2.796494E+00 +2.954152E-04 +8.727014E-08 +2.527000E+00 +1.452369E+00 +1.140000E-01 +2.834000E-03 +4.984389E-02 +5.325247E-04 +1.111356E-01 +2.793586E-03 +7.289084E-07 +1.302125E-13 +1.111356E-01 +2.793586E-03 0.000000E+00 0.000000E+00 -5.510374E+06 -8.366961E+12 -1.852000E+00 -7.973360E-01 +9.968777E+06 +2.130099E+13 +2.527000E+00 +1.452369E+00 0.000000E+00 0.000000E+00 -4.177000E+00 -3.780409E+00 -1.760000E-01 -6.584000E-03 -7.049310E-02 -1.047700E-03 -2.082153E-01 -9.154274E-03 -1.090026E-06 -2.590031E-13 -2.082153E-01 -9.154274E-03 +3.204000E+00 +2.092834E+00 +1.500000E-01 +4.600000E-03 +6.029165E-02 +7.387235E-04 +1.410668E-01 +4.414885E-03 +8.384625E-07 +1.602532E-13 +1.400911E-01 +4.332066E-03 +9.756761E-04 +9.519438E-07 +1.205833E+07 +2.954894E+13 +3.204000E+00 +2.092834E+00 +3.194266E-05 +1.020333E-09 +3.463000E+00 +2.477679E+00 +1.670000E-01 +5.837000E-03 +6.829328E-02 +9.882225E-04 +1.758063E-01 +6.470636E-03 +9.887100E-07 +2.199856E-13 +1.737856E-01 +6.307226E-03 +2.020620E-03 +2.041459E-06 +1.365866E+07 +3.952890E+13 +3.463000E+00 +2.477679E+00 +4.276023E-04 +1.081885E-07 +2.970000E-01 +4.491300E-02 +1.500000E-02 +9.100000E-05 +4.215863E-03 +6.275840E-06 +6.040786E-03 +1.401662E-05 +2.142282E-08 +4.361920E-16 +6.040786E-03 +1.401662E-05 0.000000E+00 0.000000E+00 -1.409862E+07 -4.190799E+13 -4.177000E+00 -3.780409E+00 +8.431726E+05 +2.510336E+11 +2.970000E-01 +4.491300E-02 0.000000E+00 0.000000E+00 -2.287000E+00 -1.059809E+00 -1.040000E-01 -2.254000E-03 -4.025632E-02 -3.309459E-04 -9.479325E-02 -1.956154E-03 -4.705869E-07 -4.509695E-14 -9.479325E-02 -1.956154E-03 +1.250000E-01 +5.357000E-03 +2.000000E-03 +2.000000E-06 +4.888503E-04 +1.194873E-07 +2.028292E-03 +2.059943E-06 +8.582314E-09 +7.099216E-17 +2.028292E-03 +2.059943E-06 0.000000E+00 0.000000E+00 -8.051265E+06 -1.323783E+13 -2.287000E+00 -1.059809E+00 +9.777007E+04 +4.779493E+09 +1.250000E-01 +5.357000E-03 0.000000E+00 0.000000E+00 -6.398000E+00 -8.323220E+00 -2.580000E-01 -1.356600E-02 -1.070205E-01 -2.345401E-03 -2.825180E-01 -1.658268E-02 -1.510574E-06 -5.135513E-13 -2.805357E-01 -1.633928E-02 -1.982273E-03 -1.965559E-06 -2.140411E+07 -9.381603E+13 -6.398000E+00 -8.323220E+00 -6.001927E-04 -1.801940E-07 -1.167000E+00 -4.778410E-01 -5.100000E-02 -9.290000E-04 -1.851002E-02 -1.273765E-04 -3.405873E-02 -6.277248E-04 -1.688115E-07 -1.480555E-14 -3.195431E-02 -5.302962E-04 -2.104418E-03 -4.428574E-06 -3.702005E+06 -5.095061E+12 -1.167000E+00 -4.778410E-01 -3.530361E-04 -1.246345E-07 -3.630000E+00 -2.765806E+00 -1.490000E-01 -4.587000E-03 -5.894825E-02 -7.367371E-04 -1.434581E-01 -4.305327E-03 -7.603618E-07 -1.250071E-13 -1.414758E-01 -4.212618E-03 -1.982273E-03 -1.965559E-06 -1.178965E+07 -2.946948E+13 -3.630000E+00 -2.765806E+00 -4.160428E-04 -1.012741E-07 tally 12: -5.033991E-01 -5.701830E-02 -2.304219E-02 -1.162005E-04 -9.376617E-03 -1.933443E-05 -2.344154E-02 -1.208402E-04 -1.277674E-07 -3.888071E-15 -2.329292E-02 -1.193128E-04 -1.486195E-04 -4.857250E-09 -1.875323E+06 -7.733771E+11 -5.220000E-01 -5.995400E-02 -6.963583E-05 -1.066362E-09 -2.621546E+00 -1.396717E+00 -1.276380E-01 -3.311549E-03 -5.565805E-02 -6.598224E-04 -1.391451E-01 -4.123890E-03 -8.331879E-07 -1.660597E-13 -1.382629E-01 -4.071765E-03 -8.821806E-04 -1.657624E-07 -1.113161E+07 -2.639289E+13 -2.581000E+00 -1.357455E+00 -4.133468E-04 -3.639153E-08 -2.230626E+00 -1.033217E+00 -1.065165E-01 -2.416670E-03 -4.549248E-02 -4.740035E-04 -1.137312E-01 -2.962522E-03 -6.630810E-07 -1.170893E-13 -1.130101E-01 -2.925076E-03 -7.210562E-04 -1.190805E-07 -9.098495E+06 -1.896014E+13 -2.202000E+00 -1.007194E+00 -3.378518E-04 -2.614296E-08 -5.565395E-01 -7.242839E-02 -2.955239E-02 -1.840142E-04 -1.400990E-02 -4.103227E-05 -3.502476E-02 -2.564517E-04 -2.308081E-07 -1.205491E-14 -3.480270E-02 -2.532102E-04 -2.220571E-04 -1.030824E-08 -2.801981E+06 -1.641291E+12 -6.090000E-01 -8.636300E-02 -1.040451E-04 -2.263074E-09 -1.817267E+00 -7.710225E-01 -7.367627E-02 -1.267666E-03 -2.535616E-02 -1.551036E-04 -6.339039E-02 -9.693976E-04 -2.524798E-07 -1.896478E-14 -6.298850E-02 -9.571446E-04 -4.018954E-04 -3.896557E-08 -5.071232E+06 -6.204145E+12 -1.881000E+00 -8.206930E-01 -1.883086E-04 -8.554511E-09 -4.106914E+00 -3.704316E+00 -1.888617E-01 -7.777635E-03 -7.727973E-02 -1.309080E-03 -1.931993E-01 -8.181751E-03 -1.061590E-06 -2.554724E-13 -1.919744E-01 -8.078335E-03 -1.224884E-03 -3.288708E-07 -1.545595E+07 -5.236321E+13 -4.223000E+00 -3.850821E+00 -5.739211E-04 -7.220038E-08 -2.346339E+00 -1.119793E+00 -1.017476E-01 -2.080323E-03 -3.865443E-02 -3.024337E-04 -9.663608E-02 -1.890211E-03 -4.714003E-07 -4.853805E-14 -9.602340E-02 -1.866319E-03 -6.126731E-04 -7.597824E-08 -7.730886E+06 -1.209735E+13 -2.338000E+00 -1.106368E+00 -2.870687E-04 -1.668028E-08 -6.446883E+00 -8.447751E+00 -2.867793E-01 -1.670093E-02 -1.126541E-01 -2.611201E-03 -2.816352E-01 -1.632001E-02 -1.453669E-06 -4.585416E-13 -2.798496E-01 -1.611372E-02 -1.785568E-03 -6.559933E-07 -2.253081E+07 -1.044480E+14 -6.454000E+00 -8.471478E+00 -8.366302E-04 -1.440169E-07 -1.219419E+00 -5.127750E-01 -4.857020E-02 -8.389250E-04 -1.623897E-02 -1.008738E-04 -4.059741E-02 -6.304611E-04 -1.503579E-07 -1.146797E-14 -4.034003E-02 -6.224921E-04 -2.573878E-04 -2.534179E-08 -3.247793E+06 -4.034951E+12 -1.199000E+00 -4.975810E-01 -1.205994E-04 -5.563543E-09 -3.623361E+00 -2.780040E+00 -1.560708E-01 -5.162316E-03 -5.875078E-02 -7.419979E-04 -1.468770E-01 -4.637487E-03 -7.048177E-07 -1.136014E-13 -1.459458E-01 -4.578870E-03 -9.312005E-04 -1.864068E-07 -1.175016E+07 -2.967992E+13 -3.668000E+00 -2.824270E+00 -4.363151E-04 -4.092380E-08 +1.353006E+00 +4.298474E-01 +6.067126E-02 +9.182923E-04 +2.407597E-02 +1.589874E-04 +6.018994E-02 +9.936715E-04 +3.157310E-07 +3.268202E-14 +5.980833E-02 +9.811116E-04 +3.816044E-04 +3.994127E-08 +4.815195E+06 +6.359497E+12 +1.373000E+00 +4.448330E-01 +1.788012E-04 +8.768717E-09 +2.806910E+00 +1.600166E+00 +1.295488E-01 +3.449533E-03 +5.323702E-02 +5.945274E-04 +1.330925E-01 +3.715796E-03 +7.358638E-07 +1.182977E-13 +1.322487E-01 +3.668829E-03 +8.438073E-04 +1.493588E-07 +1.064740E+07 +2.378109E+13 +2.753000E+00 +1.542179E+00 +3.953669E-04 +3.279028E-08 +2.869647E+00 +1.739405E+00 +1.278179E-01 +3.407189E-03 +5.029332E-02 +5.252401E-04 +1.257333E-01 +3.282751E-03 +6.507109E-07 +8.979533E-14 +1.249362E-01 +3.241257E-03 +7.971497E-04 +1.319523E-07 +1.005866E+07 +2.100960E+13 +2.829000E+00 +1.702143E+00 +3.735055E-04 +2.896884E-08 +3.141043E+00 +1.981851E+00 +1.526263E-01 +4.699686E-03 +6.641498E-02 +9.211853E-04 +1.660374E-01 +5.757408E-03 +9.915981E-07 +2.229928E-13 +1.649848E-01 +5.684636E-03 +1.052678E-03 +2.314228E-07 +1.328300E+07 +3.684741E+13 +3.246000E+00 +2.132054E+00 +4.932336E-04 +5.080661E-08 +3.682383E+00 +2.808072E+00 +1.593265E-01 +5.346789E-03 +6.034523E-02 +7.901305E-04 +1.508631E-01 +4.938316E-03 +7.319663E-07 +1.246559E-13 +1.499066E-01 +4.875896E-03 +9.564725E-04 +1.984988E-07 +1.206905E+07 +3.160522E+13 +3.759000E+00 +2.944479E+00 +4.481564E-04 +4.357848E-08 +2.634850E+00 +1.584334E+00 +1.218122E-01 +3.391010E-03 +5.015643E-02 +5.871038E-04 +1.253911E-01 +3.669399E-03 +6.952485E-07 +1.202338E-13 +1.245961E-01 +3.623018E-03 +7.949798E-04 +1.474939E-07 +1.003129E+07 +2.348415E+13 +2.577000E+00 +1.509201E+00 +3.724888E-04 +3.238084E-08 +3.192584E+00 +2.071165E+00 +1.491327E-01 +4.485370E-03 +6.214556E-02 +7.933462E-04 +1.553639E-01 +4.958414E-03 +8.761442E-07 +1.691919E-13 +1.543789E-01 +4.895740E-03 +9.850078E-04 +1.993067E-07 +1.242911E+07 +3.173385E+13 +3.266000E+00 +2.172442E+00 +4.615266E-04 +4.375584E-08 +3.402213E+00 +2.415762E+00 +1.592235E-01 +5.219460E-03 +6.649290E-02 +9.066793E-04 +1.662323E-01 +5.666746E-03 +9.402303E-07 +1.840541E-13 +1.651783E-01 +5.595119E-03 +1.053913E-03 +2.277785E-07 +1.329858E+07 +3.626717E+13 +3.485000E+00 +2.510947E+00 +4.938123E-04 +5.000655E-08 +3.110378E-01 +5.227746E-02 +1.171121E-02 +6.542918E-05 +3.536640E-03 +5.149982E-06 +8.841599E-03 +3.218739E-05 +2.347065E-08 +5.243075E-16 +8.785544E-03 +3.178055E-05 +5.605578E-05 +1.293793E-09 +7.073280E+05 +2.059993E+11 +3.000000E-01 +4.514200E-02 +2.626500E-05 +2.840396E-10 +1.267544E-01 +5.491246E-03 +4.806410E-03 +8.161899E-06 +1.471497E-03 +8.779657E-07 +3.678743E-03 +5.487286E-06 +1.030812E-08 +1.028225E-16 +3.655420E-03 +5.417928E-06 +2.332325E-05 +2.205650E-10 +2.942995E+05 +3.511863E+10 +1.300000E-01 +5.822000E-03 +1.092814E-05 +4.842290E-11 tally 13: -1.092010E+02 -2.386227E+03 -4.975000E+00 -4.950147E+00 -2.009472E+00 -8.076733E-01 -5.000649E+00 -5.012321E+00 -2.728992E-05 -1.491241E-10 -4.964474E+00 -4.939215E+00 -3.617555E-02 -2.875519E-04 -4.018944E+08 -3.230693E+16 -1.092010E+02 -2.386227E+03 -1.333979E-02 -5.019969E-05 -1.042260E+02 -2.173864E+03 -1.042260E+02 -2.173864E+03 +1.098420E+02 +2.414277E+03 +4.993000E+00 +4.986021E+00 +2.023763E+00 +8.192234E-01 +5.037812E+00 +5.086734E+00 +2.745346E-05 +1.509092E-10 +5.002505E+00 +5.014944E+00 +3.530702E-02 +2.695026E-04 +4.047525E+08 +3.276894E+16 +1.098420E+02 +2.414277E+03 +1.059695E-02 +2.782849E-05 +1.048490E+02 +2.199887E+03 +1.048490E+02 +2.199887E+03 tally 14: -1.092010E+02 -2.386227E+03 -4.979068E+00 -4.959690E+00 -2.016700E+00 -8.137138E-01 -5.041749E+00 -5.085712E+00 -5.020635E-05 -5.047241E-10 -5.009785E+00 -5.021429E+00 -3.196471E-02 -2.044235E-04 -4.033399E+08 -3.254855E+16 -1.092010E+02 -2.386227E+03 -1.497710E-02 -4.487918E-05 +1.098420E+02 +2.414277E+03 +5.008447E+00 +5.018748E+00 +2.028674E+00 +8.234818E-01 +5.071684E+00 +5.146761E+00 +5.050718E-05 +5.107669E-10 +5.039530E+00 +5.081707E+00 +3.215450E-02 +2.068774E-04 +4.057347E+08 +3.293927E+16 +1.098420E+02 +2.414277E+03 +1.506603E-02 +4.541792E-05 tally 15: -1.097121E+02 -2.408636E+03 -5.009145E+00 -5.019563E+00 -2.032191E+00 -8.264420E-01 -5.080477E+00 -5.165263E+00 -2.756641E-05 -1.523527E-10 -5.048267E+00 -5.099975E+00 -3.221025E-02 -2.076211E-04 -4.064382E+08 -3.305768E+16 -1.093810E+02 -2.394075E+03 -1.509215E-02 -4.558119E-05 +1.103689E+02 +2.437562E+03 +5.035611E+00 +5.073005E+00 +2.041209E+00 +8.337913E-01 +5.103022E+00 +5.211196E+00 +2.765405E-05 +1.532759E-10 +5.070669E+00 +5.145327E+00 +3.235318E-02 +2.094674E-04 +4.082417E+08 +3.335165E+16 +1.098580E+02 +2.414983E+03 +1.515912E-02 +4.598653E-05 tally 16: -1.042260E+02 -2.173864E+03 -1.042260E+02 -2.173864E+03 -5.000649E+00 -5.012321E+00 +1.048490E+02 +2.199887E+03 +1.048490E+02 +2.199887E+03 +5.037812E+00 +5.086734E+00 tally 17: -6.507000E+00 -8.478423E+00 -1.444000E+00 -4.172780E-01 -1.146407E+00 -2.630079E-01 -2.867025E+00 -1.647980E+00 -2.707153E-05 -1.467503E-10 -2.848880E+00 -1.627146E+00 -1.814469E-02 -6.685238E-05 -2.292814E+08 -1.052031E+16 -6.507000E+00 -8.478423E+00 -9.467712E-03 -2.396878E-05 -5.063000E+00 -5.136983E+00 -5.063000E+00 -5.136983E+00 -1.026940E+02 -2.110535E+03 +6.546000E+00 +8.579894E+00 +1.462000E+00 +4.278220E-01 +1.160697E+00 +2.696537E-01 +2.879845E+00 +1.663297E+00 +2.723379E-05 +1.485067E-10 +2.862628E+00 +1.643479E+00 +1.721726E-02 +6.055382E-05 +2.321395E+08 +1.078615E+16 +6.546000E+00 +8.579894E+00 +6.709978E-03 +1.387848E-05 +5.084000E+00 +5.178800E+00 +5.084000E+00 +5.178800E+00 +1.032960E+02 +2.135240E+03 3.531000E+00 -2.493861E+00 +2.493943E+00 8.630652E-01 -1.489924E-01 -2.133624E+00 -9.150435E-01 -2.183901E-07 -9.544829E-15 -2.115593E+00 -8.991467E-01 -1.803087E-02 -8.677353E-05 +1.489973E-01 +2.157967E+00 +9.345420E-01 +2.196703E-07 +9.656558E-15 +2.139877E+00 +9.185178E-01 +1.808977E-02 +8.744581E-05 1.726130E+08 -5.959695E+15 -1.026940E+02 -2.110535E+03 -3.872081E-03 -5.919692E-06 -9.916300E+01 -1.968002E+03 -9.916300E+01 -1.968002E+03 +5.959891E+15 +1.032960E+02 +2.135240E+03 +3.886968E-03 +5.976458E-06 +9.976500E+01 +1.991860E+03 +9.976500E+01 +1.991860E+03 tally 18: -6.507000E+00 -8.478423E+00 -1.455344E+00 -4.241161E-01 -1.155413E+00 -2.673178E-01 -2.888532E+00 -1.670737E+00 -4.955615E-05 -4.917547E-10 -2.870219E+00 -1.649619E+00 -1.831331E-02 -6.715634E-05 -2.310826E+08 -1.069271E+16 -6.507000E+00 -8.478423E+00 -8.580723E-03 -1.474352E-05 -1.026940E+02 -2.110535E+03 -3.523724E+00 -2.484884E+00 -8.612868E-01 -1.484560E-01 -2.153217E+00 -9.278503E-01 -6.502027E-07 -8.460574E-14 -2.139566E+00 -9.161225E-01 -1.365140E-02 -3.729555E-05 -1.722574E+08 -5.938242E+15 -1.026940E+02 -2.110535E+03 -6.396382E-03 -8.187874E-06 +6.546000E+00 +8.579894E+00 +1.464067E+00 +4.291919E-01 +1.162338E+00 +2.705171E-01 +2.905845E+00 +1.690732E+00 +4.985316E-05 +4.976401E-10 +2.887422E+00 +1.669362E+00 +1.842307E-02 +6.796008E-05 +2.324676E+08 +1.082069E+16 +6.546000E+00 +8.579894E+00 +8.632151E-03 +1.491997E-05 +1.032960E+02 +2.135240E+03 +3.544380E+00 +2.513971E+00 +8.663357E-01 +1.501938E-01 +2.165839E+00 +9.387115E-01 +6.540142E-07 +8.559612E-14 +2.152108E+00 +9.268463E-01 +1.373143E-02 +3.773212E-05 +1.732671E+08 +6.007753E+15 +1.032960E+02 +2.135240E+03 +6.433878E-03 +8.283719E-06 tally 19: -6.573230E+00 -8.663027E+00 -1.470157E+00 -4.333505E-01 -1.167173E+00 -2.731383E-01 -2.917933E+00 -1.707114E+00 -2.734707E-05 -1.499456E-10 -2.899433E+00 -1.685536E+00 -1.849971E-02 -6.861856E-05 -2.334346E+08 -1.092553E+16 -6.518000E+00 -8.507644E+00 -8.668060E-03 -1.506454E-05 -1.031389E+02 -2.128993E+03 -3.538988E+00 -2.506616E+00 -8.650177E-01 -1.497544E-01 -2.162544E+00 -9.359650E-01 -2.193361E-07 -9.628305E-15 -2.148834E+00 -9.241346E-01 -1.371054E-02 -3.762172E-05 -1.730035E+08 -5.990176E+15 -1.028630E+02 -2.117467E+03 -6.424090E-03 -8.259483E-06 +6.593971E+00 +8.715030E+00 +1.474796E+00 +4.359519E-01 +1.170856E+00 +2.747779E-01 +2.927140E+00 +1.717362E+00 +2.743336E-05 +1.508457E-10 +2.908582E+00 +1.695655E+00 +1.855808E-02 +6.903047E-05 +2.341712E+08 +1.099112E+16 +6.547000E+00 +8.582573E+00 +8.695410E-03 +1.515497E-05 +1.037750E+02 +2.155274E+03 +3.560815E+00 +2.537559E+00 +8.703528E-01 +1.516031E-01 +2.175882E+00 +9.475192E-01 +2.206889E-07 +9.747163E-15 +2.162087E+00 +9.355427E-01 +1.379510E-02 +3.808615E-05 +1.740706E+08 +6.064123E+15 +1.033110E+02 +2.135863E+03 +6.463712E-03 +8.361443E-06 tally 20: -5.063000E+00 -5.136983E+00 -5.063000E+00 -5.136983E+00 +5.084000E+00 +5.178800E+00 +5.084000E+00 +5.178800E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -2.867025E+00 -1.647980E+00 -1.445000E+00 -4.178610E-01 -1.445000E+00 -4.178610E-01 +2.879845E+00 +1.663297E+00 +1.463000E+00 +4.284330E-01 +1.463000E+00 +4.284330E-01 0.000000E+00 0.000000E+00 -9.771800E+01 -1.911083E+03 -9.771800E+01 -1.911083E+03 -2.133624E+00 -9.150435E-01 +9.830200E+01 +1.933884E+03 +9.830200E+01 +1.933884E+03 +2.157967E+00 +9.345420E-01 diff --git a/tests/regression_tests/mg_temperature/results_true.dat b/tests/regression_tests/mg_temperature/results_true.dat index 19364e1d9..6de4c6bb1 100644 --- a/tests/regression_tests/mg_temperature/results_true.dat +++ b/tests/regression_tests/mg_temperature/results_true.dat @@ -1,40 +1,40 @@ micro, method: nearest, t: 300.0, k-combined: -1.439563E+00 4.526076E-04 +1.439913E+00 4.285638E-04 kanalyt 1.440410E+00 micro, method: nearest, t: 600.0, k-combined: -1.409389E+00 4.684481E-04 +1.410750E+00 4.829834E-04 kanalyt 1.410164E+00 micro, method: nearest, t: 900.0, k-combined: -1.407593E+00 4.410387E-04 +1.408232E+00 4.946310E-04 kanalyt 1.407830E+00 micro, method: interpolation, t: 520.0, k-combined: -1.418259E+00 4.242856E-04 +1.418877E+00 4.651822E-04 kanalyt 1.418514E+00 micro, method: interpolation, t: 600.0, k-combined: -1.409389E+00 4.684481E-04 +1.410750E+00 4.829834E-04 kanalyt 1.410164E+00 macro, method: nearest, t: 300.0, k-combined: -1.439563E+00 4.526076E-04 +1.439913E+00 4.285638E-04 kanalyt 1.440410E+00 macro, method: nearest, t: 600.0, k-combined: -1.409389E+00 4.684481E-04 +1.410750E+00 4.829834E-04 kanalyt 1.410164E+00 macro, method: nearest, t: 900.0, k-combined: -1.407593E+00 4.410387E-04 +1.408232E+00 4.946310E-04 kanalyt 1.407830E+00 macro, method: interpolation, t: 520.0, k-combined: -1.418259E+00 4.242856E-04 +1.418877E+00 4.651822E-04 kanalyt 1.418514E+00 macro, method: interpolation, t: 600, k-combined: -1.409389E+00 4.684481E-04 +1.410750E+00 4.829834E-04 kanalyt 1.410164E+00 diff --git a/tests/regression_tests/mg_temperature_multi/inputs_true.dat b/tests/regression_tests/mg_temperature_multi/inputs_true.dat index 0c452cd52..b84a6782b 100644 --- a/tests/regression_tests/mg_temperature_multi/inputs_true.dat +++ b/tests/regression_tests/mg_temperature_multi/inputs_true.dat @@ -3,31 +3,31 @@ mgxs.h5 - + - + - - - - - - - - - + + + + + + + + + eigenvalue 1000 10 5 - + -0.63 -0.63 -1 0.63 0.63 1 diff --git a/tests/regression_tests/mg_temperature_multi/results_true.dat b/tests/regression_tests/mg_temperature_multi/results_true.dat index 80c2f5622..3e2f990c8 100644 --- a/tests/regression_tests/mg_temperature_multi/results_true.dat +++ b/tests/regression_tests/mg_temperature_multi/results_true.dat @@ -1,8 +1,8 @@ k-combined: -1.337115E+00 7.221249E-03 +1.309371E+00 6.765039E-03 tally 1: -2.549066E+01 -1.299987E+02 +2.532303E+01 +1.282689E+02 tally 2: -9.276778E+01 -1.721791E+03 +9.336894E+01 +1.743765E+03 diff --git a/tests/regression_tests/mgxs_library_ce_to_mg/inputs_true.dat b/tests/regression_tests/mgxs_library_ce_to_mg/inputs_true.dat index 6c071263f..2f6dde1ab 100644 --- a/tests/regression_tests/mgxs_library_ce_to_mg/inputs_true.dat +++ b/tests/regression_tests/mgxs_library_ce_to_mg/inputs_true.dat @@ -1,47 +1,47 @@ - - - - - - + + + + + + - - - - - - + + + + + + - - - - - + + + + + - - - - - - - - - + + + + + + + + + eigenvalue 100 10 5 - + -0.63 -0.63 -1 0.63 0.63 1 diff --git a/tests/regression_tests/mgxs_library_ce_to_mg/results_true.dat b/tests/regression_tests/mgxs_library_ce_to_mg/results_true.dat index d95659534..7ce106314 100644 --- a/tests/regression_tests/mgxs_library_ce_to_mg/results_true.dat +++ b/tests/regression_tests/mgxs_library_ce_to_mg/results_true.dat @@ -1,2 +1,2 @@ k-combined: -1.158563E+00 3.354681E-02 +1.152065E+00 2.768158E-02 diff --git a/tests/regression_tests/mgxs_library_ce_to_mg/test.py b/tests/regression_tests/mgxs_library_ce_to_mg/test.py index 4dff67323..075167f58 100644 --- a/tests/regression_tests/mgxs_library_ce_to_mg/test.py +++ b/tests/regression_tests/mgxs_library_ce_to_mg/test.py @@ -28,7 +28,7 @@ class MGXSTestHarness(PyAPITestHarness): self.mgxs_lib.build_library() # Initialize a tallies file - self.mgxs_lib.add_to_tallies_file(self._model.tallies, merge=False) + self.mgxs_lib.add_to_tallies(self._model.tallies, merge=False) def _run_openmc(self): # Initial run @@ -40,8 +40,8 @@ class MGXSTestHarness(PyAPITestHarness): # Build MG Inputs # Get data needed to execute Library calculations. - sp = openmc.StatePoint(self._sp_name) - self.mgxs_lib.load_from_statepoint(sp) + with openmc.StatePoint(self._sp_name) as sp: + self.mgxs_lib.load_from_statepoint(sp) self._model.mgxs_file, self._model.materials, \ self._model.geometry = self.mgxs_lib.create_mg_mode() @@ -55,11 +55,6 @@ class MGXSTestHarness(PyAPITestHarness): self._model.export_to_model_xml() self._model.mgxs_file.export_to_hdf5() - # Enforce closing statepoint and summary files so HDF5 - # does not throw an error during the next OpenMC execution - sp._f.close() - sp._summary._f.close() - # Re-run MG mode. if config['mpi']: mpi_args = [config['mpiexec'], '-n', config['mpi_np']] diff --git a/tests/regression_tests/mgxs_library_ce_to_mg_nuclides/inputs_true.dat b/tests/regression_tests/mgxs_library_ce_to_mg_nuclides/inputs_true.dat index ad3d50974..e1f330cf9 100644 --- a/tests/regression_tests/mgxs_library_ce_to_mg_nuclides/inputs_true.dat +++ b/tests/regression_tests/mgxs_library_ce_to_mg_nuclides/inputs_true.dat @@ -1,47 +1,47 @@ - - - - - - + + + + + + - - - - - - + + + + + + - - - - - + + + + + - - - - - - - - - + + + + + + + + + eigenvalue 100 10 5 - + -0.63 -0.63 -1 0.63 0.63 1 diff --git a/tests/regression_tests/mgxs_library_ce_to_mg_nuclides/results_true.dat b/tests/regression_tests/mgxs_library_ce_to_mg_nuclides/results_true.dat index a4e9dafcc..50c8328c8 100644 --- a/tests/regression_tests/mgxs_library_ce_to_mg_nuclides/results_true.dat +++ b/tests/regression_tests/mgxs_library_ce_to_mg_nuclides/results_true.dat @@ -1,2 +1,2 @@ k-combined: -6.025533E-01 1.157401E-02 +4.139942E-01 1.181308E-02 diff --git a/tests/regression_tests/mgxs_library_ce_to_mg_nuclides/test.py b/tests/regression_tests/mgxs_library_ce_to_mg_nuclides/test.py index ee0cdf0d9..489105f8f 100644 --- a/tests/regression_tests/mgxs_library_ce_to_mg_nuclides/test.py +++ b/tests/regression_tests/mgxs_library_ce_to_mg_nuclides/test.py @@ -28,7 +28,7 @@ class MGXSTestHarness(PyAPITestHarness): self.mgxs_lib.build_library() # Initialize a tallies file - self.mgxs_lib.add_to_tallies_file(self._model.tallies, merge=False) + self.mgxs_lib.add_to_tallies(self._model.tallies, merge=False) def _run_openmc(self): # Initial run @@ -40,8 +40,8 @@ class MGXSTestHarness(PyAPITestHarness): # Build MG Inputs # Get data needed to execute Library calculations. - sp = openmc.StatePoint(self._sp_name) - self.mgxs_lib.load_from_statepoint(sp) + with openmc.StatePoint(self._sp_name) as sp: + self.mgxs_lib.load_from_statepoint(sp) self._model.mgxs_file, self._model.materials, \ self._model.geometry = self.mgxs_lib.create_mg_mode() @@ -55,11 +55,6 @@ class MGXSTestHarness(PyAPITestHarness): self._model.export_to_model_xml() self._model.mgxs_file.export_to_hdf5() - # Enforce closing statepoint and summary files so HDF5 - # does not throw an error during the next OpenMC execution - sp._f.close() - sp._summary._f.close() - # Re-run MG mode. if config['mpi']: mpi_args = [config['mpiexec'], '-n', config['mpi_np']] diff --git a/tests/regression_tests/mgxs_library_condense/inputs_true.dat b/tests/regression_tests/mgxs_library_condense/inputs_true.dat index 8606e9fdd..4451d214c 100644 --- a/tests/regression_tests/mgxs_library_condense/inputs_true.dat +++ b/tests/regression_tests/mgxs_library_condense/inputs_true.dat @@ -1,47 +1,47 @@ - - - - - - + + + + + + - - - - - - + + + + + + - - - - - + + + + + - - - - - - - - - + + + + + + + + + eigenvalue 100 10 5 - + -0.63 -0.63 -1 0.63 0.63 1 diff --git a/tests/regression_tests/mgxs_library_condense/results_true.dat b/tests/regression_tests/mgxs_library_condense/results_true.dat index ae5bff6e3..98b30932c 100644 --- a/tests/regression_tests/mgxs_library_condense/results_true.dat +++ b/tests/regression_tests/mgxs_library_condense/results_true.dat @@ -1,362 +1,362 @@ mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 0.699306 0.028642 -2 1 2 1 1 total 0.687913 0.025966 -1 2 1 1 1 total 0.716035 0.018945 -3 2 2 1 1 total 0.702630 0.028574 +0 1 1 1 1 total 0.702881 0.026175 +2 1 2 1 1 total 0.706921 0.029169 +1 2 1 1 1 total 0.707809 0.024766 +3 2 2 1 1 total 0.717967 0.024008 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 0.443642 0.030984 -2 1 2 1 1 total 0.429968 0.028072 -1 2 1 1 1 total 0.461535 0.021345 -3 2 2 1 1 total 0.439454 0.031232 +0 1 1 1 1 total 0.431023 0.028803 +2 1 2 1 1 total 0.451864 0.030748 +1 2 1 1 1 total 0.456990 0.026359 +3 2 2 1 1 total 0.450621 0.026744 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 0.443642 0.030984 -2 1 2 1 1 total 0.429968 0.028072 -1 2 1 1 1 total 0.461535 0.021345 -3 2 2 1 1 total 0.439454 0.031232 +0 1 1 1 1 total 0.431023 0.028803 +2 1 2 1 1 total 0.451864 0.030748 +1 2 1 1 1 total 0.456990 0.026359 +3 2 2 1 1 total 0.450621 0.026744 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 0.021895 0.001041 -2 1 2 1 1 total 0.021903 0.001108 -1 2 1 1 1 total 0.024895 0.001401 -3 2 2 1 1 total 0.022105 0.001198 +0 1 1 1 1 total 0.022398 0.001401 +2 1 2 1 1 total 0.022325 0.001371 +1 2 1 1 1 total 0.022942 0.000990 +3 2 2 1 1 total 0.022705 0.001322 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 0.021883 0.001040 -2 1 2 1 1 total 0.021879 0.001108 -1 2 1 1 1 total 0.024875 0.001401 -3 2 2 1 1 total 0.022071 0.001197 +0 1 1 1 1 total 0.022394 0.001401 +2 1 2 1 1 total 0.022321 0.001371 +1 2 1 1 1 total 0.022935 0.000990 +3 2 2 1 1 total 0.022699 0.001322 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 0.011219 0.000958 -2 1 2 1 1 total 0.011437 0.001013 -1 2 1 1 1 total 0.012947 0.001437 -3 2 2 1 1 total 0.011756 0.001144 +0 1 1 1 1 total 0.011562 0.001544 +2 1 2 1 1 total 0.011852 0.001418 +1 2 1 1 1 total 0.012168 0.000958 +3 2 2 1 1 total 0.011986 0.001418 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 0.010676 0.000481 -2 1 2 1 1 total 0.010466 0.000446 -1 2 1 1 1 total 0.011948 0.000517 -3 2 2 1 1 total 0.010350 0.000547 +0 1 1 1 1 total 0.010836 0.000803 +2 1 2 1 1 total 0.010473 0.000591 +1 2 1 1 1 total 0.010774 0.000415 +3 2 2 1 1 total 0.010719 0.000688 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 0.026218 0.001180 -2 1 2 1 1 total 0.025724 0.001093 -1 2 1 1 1 total 0.029326 0.001262 -3 2 2 1 1 total 0.025451 0.001338 +0 1 1 1 1 total 0.026602 0.001957 +2 1 2 1 1 total 0.025695 0.001442 +1 2 1 1 1 total 0.026454 0.001015 +3 2 2 1 1 total 0.026310 0.001678 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 2.067337e+06 93152.452502 -2 1 2 1 1 total 2.026907e+06 86377.585629 -1 2 1 1 1 total 2.313358e+06 99980.823985 -3 2 2 1 1 total 2.004370e+06 105820.022073 +0 1 1 1 1 total 2.098256e+06 155243.612264 +2 1 2 1 1 total 2.027699e+06 114334.400924 +1 2 1 1 1 total 2.086255e+06 80325.567787 +3 2 2 1 1 total 2.075596e+06 133128.805680 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 0.677411 0.027731 -2 1 2 1 1 total 0.666009 0.025155 -1 2 1 1 1 total 0.691140 0.018119 -3 2 2 1 1 total 0.680525 0.027587 +0 1 1 1 1 total 0.680483 0.025407 +2 1 2 1 1 total 0.684597 0.028126 +1 2 1 1 1 total 0.684867 0.024133 +3 2 2 1 1 total 0.695262 0.023087 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 0.679832 0.030242 -2 1 2 1 1 total 0.663143 0.019259 -1 2 1 1 1 total 0.679503 0.027107 -3 2 2 1 1 total 0.681909 0.033506 +0 1 1 1 1 total 0.678017 0.026288 +2 1 2 1 1 total 0.674888 0.033989 +1 2 1 1 1 total 0.681736 0.025618 +3 2 2 1 1 total 0.683701 0.023788 mesh 1 group in group out legendre nuclide mean std. dev. x y z -0 1 1 1 1 1 P0 total 0.679832 0.030426 -1 1 1 1 1 1 P1 total 0.255665 0.011704 -2 1 1 1 1 1 P2 total 0.087020 0.005603 -3 1 1 1 1 1 P3 total 0.006425 0.005919 -8 1 2 1 1 1 P0 total 0.663143 0.019088 -9 1 2 1 1 1 P1 total 0.257945 0.010887 -10 1 2 1 1 1 P2 total 0.095395 0.006988 -11 1 2 1 1 1 P3 total 0.009816 0.003950 -4 2 1 1 1 1 P0 total 0.679503 0.026695 -5 2 1 1 1 1 P1 total 0.254500 0.009901 -6 2 1 1 1 1 P2 total 0.093289 0.005481 -7 2 1 1 1 1 P3 total 0.004631 0.004081 -12 2 2 1 1 1 P0 total 0.681909 0.032740 -13 2 2 1 1 1 P1 total 0.263176 0.012659 -14 2 2 1 1 1 P2 total 0.093102 0.006603 -15 2 2 1 1 1 P3 total 0.007938 0.005673 +0 1 1 1 1 1 P0 total 0.678017 0.026290 +1 1 1 1 1 1 P1 total 0.271858 0.011693 +2 1 1 1 1 1 P2 total 0.095219 0.002950 +3 1 1 1 1 1 P3 total 0.012808 0.004686 +8 1 2 1 1 1 P0 total 0.674888 0.033578 +9 1 2 1 1 1 P1 total 0.255058 0.009912 +10 1 2 1 1 1 P2 total 0.098001 0.005459 +11 1 2 1 1 1 P3 total 0.012058 0.005439 +4 2 1 1 1 1 P0 total 0.681736 0.025439 +5 2 1 1 1 1 P1 total 0.250820 0.009035 +6 2 1 1 1 1 P2 total 0.092563 0.006549 +7 2 1 1 1 1 P3 total 0.008511 0.003905 +12 2 2 1 1 1 P0 total 0.683701 0.024254 +13 2 2 1 1 1 P1 total 0.267345 0.011695 +14 2 2 1 1 1 P2 total 0.096222 0.005551 +15 2 2 1 1 1 P3 total 0.011515 0.003236 mesh 1 group in group out legendre nuclide mean std. dev. x y z -0 1 1 1 1 1 P0 total 0.679832 0.030426 -1 1 1 1 1 1 P1 total 0.255665 0.011704 -2 1 1 1 1 1 P2 total 0.087020 0.005603 -3 1 1 1 1 1 P3 total 0.006425 0.005919 -8 1 2 1 1 1 P0 total 0.663143 0.019088 -9 1 2 1 1 1 P1 total 0.257945 0.010887 -10 1 2 1 1 1 P2 total 0.095395 0.006988 -11 1 2 1 1 1 P3 total 0.009816 0.003950 -4 2 1 1 1 1 P0 total 0.679503 0.026695 -5 2 1 1 1 1 P1 total 0.254500 0.009901 -6 2 1 1 1 1 P2 total 0.093289 0.005481 -7 2 1 1 1 1 P3 total 0.004631 0.004081 -12 2 2 1 1 1 P0 total 0.681909 0.032740 -13 2 2 1 1 1 P1 total 0.263176 0.012659 -14 2 2 1 1 1 P2 total 0.093102 0.006603 -15 2 2 1 1 1 P3 total 0.007938 0.005673 +0 1 1 1 1 1 P0 total 0.678017 0.026290 +1 1 1 1 1 1 P1 total 0.271858 0.011693 +2 1 1 1 1 1 P2 total 0.095219 0.002950 +3 1 1 1 1 1 P3 total 0.012808 0.004686 +8 1 2 1 1 1 P0 total 0.674888 0.033578 +9 1 2 1 1 1 P1 total 0.255058 0.009912 +10 1 2 1 1 1 P2 total 0.098001 0.005459 +11 1 2 1 1 1 P3 total 0.012058 0.005439 +4 2 1 1 1 1 P0 total 0.681736 0.025439 +5 2 1 1 1 1 P1 total 0.250820 0.009035 +6 2 1 1 1 1 P2 total 0.092563 0.006549 +7 2 1 1 1 1 P3 total 0.008511 0.003905 +12 2 2 1 1 1 P0 total 0.683701 0.024254 +13 2 2 1 1 1 P1 total 0.267345 0.011695 +14 2 2 1 1 1 P2 total 0.096222 0.005551 +15 2 2 1 1 1 P3 total 0.011515 0.003236 mesh 1 group in group out nuclide mean std. dev. x y z -0 1 1 1 1 1 total 1.0 0.041183 -2 1 2 1 1 1 total 1.0 0.021636 -1 2 1 1 1 1 total 1.0 0.046661 -3 2 2 1 1 1 total 1.0 0.041512 +0 1 1 1 1 1 total 1.0 0.041785 +2 1 2 1 1 1 total 1.0 0.057717 +1 2 1 1 1 1 total 1.0 0.040074 +3 2 2 1 1 1 total 1.0 0.042758 mesh 1 group in group out nuclide mean std. dev. x y z -0 1 1 1 1 1 total 0.027090 0.002808 -2 1 2 1 1 1 total 0.031522 0.004261 -1 2 1 1 1 1 total 0.021855 0.001457 -3 2 2 1 1 1 total 0.028262 0.002358 +0 1 1 1 1 1 total 0.028438 0.003513 +2 1 2 1 1 1 total 0.022222 0.001560 +1 2 1 1 1 1 total 0.025698 0.002756 +3 2 2 1 1 1 total 0.026501 0.002315 mesh 1 group in group out nuclide mean std. dev. x y z -0 1 1 1 1 1 total 1.0 0.041183 -2 1 2 1 1 1 total 1.0 0.021636 -1 2 1 1 1 1 total 1.0 0.046661 -3 2 2 1 1 1 total 1.0 0.041512 +0 1 1 1 1 1 total 1.0 0.041785 +2 1 2 1 1 1 total 1.0 0.057717 +1 2 1 1 1 1 total 1.0 0.040074 +3 2 2 1 1 1 total 1.0 0.042758 mesh 1 group in group out legendre nuclide mean std. dev. x y z -0 1 1 1 1 1 P0 total 0.677411 0.039336 -1 1 1 1 1 1 P1 total 0.254754 0.014995 -2 1 1 1 1 1 P2 total 0.086711 0.006439 -3 1 1 1 1 1 P3 total 0.006402 0.005903 -8 1 2 1 1 1 P0 total 0.666009 0.028990 -9 1 2 1 1 1 P1 total 0.259060 0.013824 -10 1 2 1 1 1 P2 total 0.095807 0.007684 -11 1 2 1 1 1 P3 total 0.009858 0.003980 -4 2 1 1 1 1 P0 total 0.691140 0.036991 -5 2 1 1 1 1 P1 total 0.258859 0.013782 -6 2 1 1 1 1 P2 total 0.094887 0.006555 -7 2 1 1 1 1 P3 total 0.004710 0.004154 -12 2 2 1 1 1 P0 total 0.680525 0.039486 -13 2 2 1 1 1 P1 total 0.262642 0.015259 -14 2 2 1 1 1 P2 total 0.092913 0.007251 -15 2 2 1 1 1 P3 total 0.007921 0.005668 +0 1 1 1 1 1 P0 total 0.680483 0.038131 +1 1 1 1 1 1 P1 total 0.272847 0.016111 +2 1 1 1 1 1 P2 total 0.095565 0.004869 +3 1 1 1 1 1 P3 total 0.012854 0.004731 +8 1 2 1 1 1 P0 total 0.684597 0.048501 +9 1 2 1 1 1 P1 total 0.258727 0.016473 +10 1 2 1 1 1 P2 total 0.099411 0.007470 +11 1 2 1 1 1 P3 total 0.012231 0.005552 +4 2 1 1 1 1 P0 total 0.684867 0.036546 +5 2 1 1 1 1 P1 total 0.251972 0.013220 +6 2 1 1 1 1 P2 total 0.092988 0.007474 +7 2 1 1 1 1 P3 total 0.008550 0.003936 +12 2 2 1 1 1 P0 total 0.695262 0.037640 +13 2 2 1 1 1 P1 total 0.271866 0.016280 +14 2 2 1 1 1 P2 total 0.097849 0.006919 +15 2 2 1 1 1 P3 total 0.011710 0.003325 mesh 1 group in group out legendre nuclide mean std. dev. x y z -0 1 1 1 1 1 P0 total 0.677411 0.048224 -1 1 1 1 1 1 P1 total 0.254754 0.018301 -2 1 1 1 1 1 P2 total 0.086711 0.007363 -3 1 1 1 1 1 P3 total 0.006402 0.005909 -8 1 2 1 1 1 P0 total 0.666009 0.032374 -9 1 2 1 1 1 P1 total 0.259060 0.014917 -10 1 2 1 1 1 P2 total 0.095807 0.007958 -11 1 2 1 1 1 P3 total 0.009858 0.003985 -4 2 1 1 1 1 P0 total 0.691140 0.049075 -5 2 1 1 1 1 P1 total 0.258859 0.018326 -6 2 1 1 1 1 P2 total 0.094887 0.007910 -7 2 1 1 1 1 P3 total 0.004710 0.004160 -12 2 2 1 1 1 P0 total 0.680525 0.048551 -13 2 2 1 1 1 P1 total 0.262642 0.018754 -14 2 2 1 1 1 P2 total 0.092913 0.008213 -15 2 2 1 1 1 P3 total 0.007921 0.005677 +0 1 1 1 1 1 P0 total 0.680483 0.047566 +1 1 1 1 1 1 P1 total 0.272847 0.019737 +2 1 1 1 1 1 P2 total 0.095565 0.006297 +3 1 1 1 1 1 P3 total 0.012854 0.004762 +8 1 2 1 1 1 P0 total 0.684597 0.062559 +9 1 2 1 1 1 P1 total 0.258727 0.022234 +10 1 2 1 1 1 P2 total 0.099411 0.009420 +11 1 2 1 1 1 P3 total 0.012231 0.005597 +4 2 1 1 1 1 P0 total 0.684867 0.045704 +5 2 1 1 1 1 P1 total 0.251972 0.016635 +6 2 1 1 1 1 P2 total 0.092988 0.008352 +7 2 1 1 1 1 P3 total 0.008550 0.003951 +12 2 2 1 1 1 P0 total 0.695262 0.047964 +13 2 2 1 1 1 P1 total 0.271866 0.020004 +14 2 2 1 1 1 P2 total 0.097849 0.008086 +15 2 2 1 1 1 P3 total 0.011710 0.003363 mesh 1 group out nuclide mean std. dev. x y z -0 1 1 1 1 total 1.0 0.103333 -2 1 2 1 1 total 1.0 0.118582 -1 2 1 1 1 total 1.0 0.112144 -3 2 2 1 1 total 1.0 0.130701 +0 1 1 1 1 total 1.0 0.142430 +2 1 2 1 1 total 1.0 0.112715 +1 2 1 1 1 total 1.0 0.192385 +3 2 2 1 1 total 1.0 0.109836 mesh 1 group out nuclide mean std. dev. x y z -0 1 1 1 1 total 1.0 0.103333 -2 1 2 1 1 total 1.0 0.118582 -1 2 1 1 1 total 1.0 0.112144 -3 2 2 1 1 total 1.0 0.130701 +0 1 1 1 1 total 1.0 0.143959 +2 1 2 1 1 total 1.0 0.102504 +1 2 1 1 1 total 1.0 0.188381 +3 2 2 1 1 total 1.0 0.116230 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 5.304285e-07 2.560239e-08 -2 1 2 1 1 total 4.940321e-07 2.410417e-08 -1 2 1 1 1 total 5.587365e-07 3.382787e-08 -3 2 2 1 1 total 5.232210e-07 2.482800e-08 +0 1 1 1 1 total 5.060544e-07 3.651604e-08 +2 1 2 1 1 total 5.101988e-07 4.947639e-08 +1 2 1 1 1 total 5.206450e-07 2.814648e-08 +3 2 2 1 1 total 5.278759e-07 3.171554e-08 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 0.026032 0.001172 -2 1 2 1 1 total 0.025542 0.001086 -1 2 1 1 1 total 0.029121 0.001254 -3 2 2 1 1 total 0.025271 0.001329 +0 1 1 1 1 total 0.026414 0.001944 +2 1 2 1 1 total 0.025515 0.001432 +1 2 1 1 1 total 0.026267 0.001008 +3 2 2 1 1 total 0.026125 0.001667 mesh 1 group in group out nuclide mean std. dev. x y z -0 1 1 1 1 1 total 0.027090 0.002808 -2 1 2 1 1 1 total 0.031522 0.004261 -1 2 1 1 1 1 total 0.021855 0.001457 -3 2 2 1 1 1 total 0.028262 0.002358 +0 1 1 1 1 1 total 0.028220 0.003510 +2 1 2 1 1 1 total 0.021754 0.001519 +1 2 1 1 1 1 total 0.025487 0.002676 +3 2 2 1 1 1 total 0.026281 0.002263 mesh 1 group in nuclide mean std. dev. x y surf -3 1 1 x-max in 1 total 4.280 0.164469 -2 1 1 x-max out 1 total 4.250 0.107135 +3 1 1 x-max in 1 total 4.244 0.096333 +2 1 1 x-max out 1 total 4.378 0.107210 1 1 1 x-min in 1 total 0.000 0.000000 0 1 1 x-min out 1 total 0.000 0.000000 -7 1 1 y-max in 1 total 4.364 0.105622 -6 1 1 y-max out 1 total 4.412 0.158019 +7 1 1 y-max in 1 total 4.388 0.116508 +6 1 1 y-max out 1 total 4.284 0.129066 5 1 1 y-min in 1 total 0.000 0.000000 4 1 1 y-min out 1 total 0.000 0.000000 -19 1 2 x-max in 1 total 4.388 0.102470 -18 1 2 x-max out 1 total 4.428 0.140228 +19 1 2 x-max in 1 total 4.280 0.139971 +18 1 2 x-max out 1 total 4.152 0.117141 17 1 2 x-min in 1 total 0.000 0.000000 16 1 2 x-min out 1 total 0.000 0.000000 23 1 2 y-max in 1 total 0.000 0.000000 22 1 2 y-max out 1 total 0.000 0.000000 -21 1 2 y-min in 1 total 4.412 0.158019 -20 1 2 y-min out 1 total 4.364 0.105622 +21 1 2 y-min in 1 total 4.284 0.129066 +20 1 2 y-min out 1 total 4.388 0.116508 11 2 1 x-max in 1 total 0.000 0.000000 10 2 1 x-max out 1 total 0.000 0.000000 -9 2 1 x-min in 1 total 4.250 0.107135 -8 2 1 x-min out 1 total 4.280 0.164469 -15 2 1 y-max in 1 total 4.402 0.182565 -14 2 1 y-max out 1 total 4.346 0.148189 +9 2 1 x-min in 1 total 4.378 0.107210 +8 2 1 x-min out 1 total 4.244 0.096333 +15 2 1 y-max in 1 total 4.280 0.079070 +14 2 1 y-max out 1 total 4.416 0.093648 13 2 1 y-min in 1 total 0.000 0.000000 12 2 1 y-min out 1 total 0.000 0.000000 27 2 2 x-max in 1 total 0.000 0.000000 26 2 2 x-max out 1 total 0.000 0.000000 -25 2 2 x-min in 1 total 4.428 0.140228 -24 2 2 x-min out 1 total 4.388 0.102470 +25 2 2 x-min in 1 total 4.152 0.117141 +24 2 2 x-min out 1 total 4.280 0.139971 31 2 2 y-max in 1 total 0.000 0.000000 30 2 2 y-max out 1 total 0.000 0.000000 -29 2 2 y-min in 1 total 4.346 0.148189 -28 2 2 y-min out 1 total 4.402 0.182565 +29 2 2 y-min in 1 total 4.416 0.093648 +28 2 2 y-min out 1 total 4.280 0.079070 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 0.950616 0.095874 -2 1 2 1 1 total 0.932532 0.086323 -1 2 1 1 1 total 0.885723 0.041074 -3 2 2 1 1 total 0.951783 0.101570 +0 1 1 1 1 total 0.943198 0.067915 +2 1 2 1 1 total 0.895741 0.058714 +1 2 1 1 1 total 0.911011 0.068461 +3 2 2 1 1 total 0.927611 0.066426 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 0.950616 0.095874 -2 1 2 1 1 total 0.932532 0.086323 -1 2 1 1 1 total 0.885723 0.041074 -3 2 2 1 1 total 0.951783 0.101570 +0 1 1 1 1 total 0.943198 0.067915 +2 1 2 1 1 total 0.895741 0.058714 +1 2 1 1 1 total 0.911011 0.068461 +3 2 2 1 1 total 0.927611 0.066426 mesh 1 delayedgroup group in nuclide mean std. dev. x y z -0 1 1 1 1 1 total 0.000006 2.679142e-07 -1 1 1 1 2 1 total 0.000032 1.417723e-06 -2 1 1 1 3 1 total 0.000031 1.376260e-06 -3 1 1 1 4 1 total 0.000072 3.185580e-06 -4 1 1 1 5 1 total 0.000032 1.433425e-06 -5 1 1 1 6 1 total 0.000013 5.956400e-07 -12 1 2 1 1 1 total 0.000006 2.486865e-07 -13 1 2 1 2 1 total 0.000031 1.323941e-06 -14 1 2 1 3 1 total 0.000030 1.292803e-06 -15 1 2 1 4 1 total 0.000071 3.032740e-06 -16 1 2 1 5 1 total 0.000031 1.426193e-06 -17 1 2 1 6 1 total 0.000013 5.903673e-07 -6 2 1 1 1 1 total 0.000007 2.871910e-07 -7 2 1 1 2 1 total 0.000035 1.501590e-06 -8 2 1 1 3 1 total 0.000034 1.448170e-06 -9 2 1 1 4 1 total 0.000079 3.318195e-06 -10 2 1 1 5 1 total 0.000035 1.465737e-06 -11 2 1 1 6 1 total 0.000015 6.097547e-07 -18 2 2 1 1 1 total 0.000006 3.042761e-07 -19 2 2 1 2 1 total 0.000031 1.603780e-06 -20 2 2 1 3 1 total 0.000030 1.553523e-06 -21 2 2 1 4 1 total 0.000070 3.583849e-06 -22 2 2 1 5 1 total 0.000031 1.602620e-06 -23 2 2 1 6 1 total 0.000013 6.662067e-07 +0 1 1 1 1 1 total 0.000006 4.453421e-07 +1 1 1 1 2 1 total 0.000032 2.303082e-06 +2 1 1 1 3 1 total 0.000031 2.202789e-06 +3 1 1 1 4 1 total 0.000072 4.961025e-06 +4 1 1 1 5 1 total 0.000032 2.071919e-06 +5 1 1 1 6 1 total 0.000013 8.662934e-07 +12 1 2 1 1 1 total 0.000006 3.282329e-07 +13 1 2 1 2 1 total 0.000031 1.701766e-06 +14 1 2 1 3 1 total 0.000030 1.629615e-06 +15 1 2 1 4 1 total 0.000070 3.675759e-06 +16 1 2 1 5 1 total 0.000031 1.536226e-06 +17 1 2 1 6 1 total 0.000013 6.423838e-07 +6 2 1 1 1 1 total 0.000006 2.308186e-07 +7 2 1 1 2 1 total 0.000032 1.211112e-06 +8 2 1 1 3 1 total 0.000031 1.169911e-06 +9 2 1 1 4 1 total 0.000072 2.685832e-06 +10 2 1 1 5 1 total 0.000032 1.187072e-06 +11 2 1 1 6 1 total 0.000013 4.939053e-07 +18 2 2 1 1 1 total 0.000006 3.819684e-07 +19 2 2 1 2 1 total 0.000032 1.976073e-06 +20 2 2 1 3 1 total 0.000031 1.889748e-06 +21 2 2 1 4 1 total 0.000072 4.252207e-06 +22 2 2 1 5 1 total 0.000032 1.765565e-06 +23 2 2 1 6 1 total 0.000013 7.386890e-07 mesh 1 delayedgroup group out nuclide mean std. dev. x y z -0 1 1 1 1 1 total 0.0 0.0 -1 1 1 1 2 1 total 0.0 0.0 -2 1 1 1 3 1 total 0.0 0.0 -3 1 1 1 4 1 total 0.0 0.0 -4 1 1 1 5 1 total 0.0 0.0 -5 1 1 1 6 1 total 0.0 0.0 -12 1 2 1 1 1 total 0.0 0.0 -13 1 2 1 2 1 total 0.0 0.0 -14 1 2 1 3 1 total 0.0 0.0 -15 1 2 1 4 1 total 0.0 0.0 -16 1 2 1 5 1 total 0.0 0.0 -17 1 2 1 6 1 total 0.0 0.0 -6 2 1 1 1 1 total 0.0 0.0 -7 2 1 1 2 1 total 0.0 0.0 -8 2 1 1 3 1 total 0.0 0.0 -9 2 1 1 4 1 total 0.0 0.0 -10 2 1 1 5 1 total 0.0 0.0 -11 2 1 1 6 1 total 0.0 0.0 -18 2 2 1 1 1 total 0.0 0.0 -19 2 2 1 2 1 total 0.0 0.0 -20 2 2 1 3 1 total 0.0 0.0 -21 2 2 1 4 1 total 0.0 0.0 -22 2 2 1 5 1 total 0.0 0.0 -23 2 2 1 6 1 total 0.0 0.0 +0 1 1 1 1 1 total 0.0 0.000000 +1 1 1 1 2 1 total 0.0 0.000000 +2 1 1 1 3 1 total 0.0 0.000000 +3 1 1 1 4 1 total 1.0 1.414214 +4 1 1 1 5 1 total 0.0 0.000000 +5 1 1 1 6 1 total 0.0 0.000000 +12 1 2 1 1 1 total 0.0 0.000000 +13 1 2 1 2 1 total 0.0 0.000000 +14 1 2 1 3 1 total 0.0 0.000000 +15 1 2 1 4 1 total 1.0 0.869026 +16 1 2 1 5 1 total 0.0 0.000000 +17 1 2 1 6 1 total 0.0 0.000000 +6 2 1 1 1 1 total 0.0 0.000000 +7 2 1 1 2 1 total 0.0 0.000000 +8 2 1 1 3 1 total 0.0 0.000000 +9 2 1 1 4 1 total 1.0 1.414214 +10 2 1 1 5 1 total 0.0 0.000000 +11 2 1 1 6 1 total 0.0 0.000000 +18 2 2 1 1 1 total 0.0 0.000000 +19 2 2 1 2 1 total 0.0 0.000000 +20 2 2 1 3 1 total 0.0 0.000000 +21 2 2 1 4 1 total 1.0 1.414214 +22 2 2 1 5 1 total 0.0 0.000000 +23 2 2 1 6 1 total 0.0 0.000000 mesh 1 delayedgroup group in nuclide mean std. dev. x y z -0 1 1 1 1 1 total 0.000227 0.000011 -1 1 1 1 2 1 total 0.001212 0.000058 -2 1 1 1 3 1 total 0.001180 0.000057 -3 1 1 1 4 1 total 0.002734 0.000131 -4 1 1 1 5 1 total 0.001215 0.000059 -5 1 1 1 6 1 total 0.000506 0.000024 -12 1 2 1 1 1 total 0.000227 0.000010 -13 1 2 1 2 1 total 0.001213 0.000052 -14 1 2 1 3 1 total 0.001182 0.000051 -15 1 2 1 4 1 total 0.002744 0.000120 -16 1 2 1 5 1 total 0.001223 0.000056 -17 1 2 1 6 1 total 0.000509 0.000023 -6 2 1 1 1 1 total 0.000227 0.000013 -7 2 1 1 2 1 total 0.001207 0.000067 -8 2 1 1 3 1 total 0.001173 0.000065 -9 2 1 1 4 1 total 0.002710 0.000150 -10 2 1 1 5 1 total 0.001195 0.000066 -11 2 1 1 6 1 total 0.000498 0.000027 -18 2 2 1 1 1 total 0.000227 0.000014 -19 2 2 1 2 1 total 0.001212 0.000073 -20 2 2 1 3 1 total 0.001180 0.000071 -21 2 2 1 4 1 total 0.002740 0.000163 -22 2 2 1 5 1 total 0.001221 0.000073 -23 2 2 1 6 1 total 0.000508 0.000030 +0 1 1 1 1 1 total 0.000227 0.000023 +1 1 1 1 2 1 total 0.001210 0.000119 +2 1 1 1 3 1 total 0.001176 0.000114 +3 1 1 1 4 1 total 0.002722 0.000261 +4 1 1 1 5 1 total 0.001204 0.000112 +5 1 1 1 6 1 total 0.000501 0.000047 +12 1 2 1 1 1 total 0.000227 0.000017 +13 1 2 1 2 1 total 0.001208 0.000087 +14 1 2 1 3 1 total 0.001174 0.000084 +15 1 2 1 4 1 total 0.002710 0.000192 +16 1 2 1 5 1 total 0.001194 0.000082 +17 1 2 1 6 1 total 0.000497 0.000034 +6 2 1 1 1 1 total 0.000227 0.000010 +7 2 1 1 2 1 total 0.001210 0.000053 +8 2 1 1 3 1 total 0.001177 0.000052 +9 2 1 1 4 1 total 0.002726 0.000119 +10 2 1 1 5 1 total 0.001208 0.000053 +11 2 1 1 6 1 total 0.000503 0.000022 +18 2 2 1 1 1 total 0.000227 0.000019 +19 2 2 1 2 1 total 0.001211 0.000102 +20 2 2 1 3 1 total 0.001178 0.000098 +21 2 2 1 4 1 total 0.002726 0.000223 +22 2 2 1 5 1 total 0.001207 0.000096 +23 2 2 1 6 1 total 0.000503 0.000040 mesh 1 delayedgroup nuclide mean std. dev. x y z -0 1 1 1 1 total 0.013354 0.000674 -1 1 1 1 2 total 0.032612 0.001720 -2 1 1 1 3 total 0.121057 0.006579 -3 1 1 1 4 total 0.305656 0.017398 -4 1 1 1 5 total 0.861000 0.053768 -5 1 1 1 6 total 2.891889 0.179407 -12 1 2 1 1 total 0.013354 0.000497 -13 1 2 1 2 total 0.032605 0.001150 -14 1 2 1 3 total 0.121071 0.004175 -15 1 2 1 4 total 0.305792 0.010484 -16 1 2 1 5 total 0.861500 0.032627 -17 1 2 1 6 total 2.893589 0.108347 -6 2 1 1 1 total 0.013352 0.000663 -7 2 1 1 2 total 0.032625 0.001570 -8 2 1 1 3 total 0.121029 0.005721 -9 2 1 1 4 total 0.305375 0.014144 -10 2 1 1 5 total 0.859955 0.039608 -11 2 1 1 6 total 2.888337 0.132844 -18 2 2 1 1 total 0.013354 0.000892 -19 2 2 1 2 total 0.032606 0.002209 -20 2 2 1 3 total 0.121069 0.008302 -21 2 2 1 4 total 0.305776 0.021416 -22 2 2 1 5 total 0.861442 0.063571 -23 2 2 1 6 total 2.893392 0.212640 - mesh 1 delayedgroup group in group out nuclide mean std. dev. - x y z -0 1 1 1 1 1 1 total 0.0 0.0 -1 1 1 1 2 1 1 total 0.0 0.0 -2 1 1 1 3 1 1 total 0.0 0.0 -3 1 1 1 4 1 1 total 0.0 0.0 -4 1 1 1 5 1 1 total 0.0 0.0 -5 1 1 1 6 1 1 total 0.0 0.0 -12 1 2 1 1 1 1 total 0.0 0.0 -13 1 2 1 2 1 1 total 0.0 0.0 -14 1 2 1 3 1 1 total 0.0 0.0 -15 1 2 1 4 1 1 total 0.0 0.0 -16 1 2 1 5 1 1 total 0.0 0.0 -17 1 2 1 6 1 1 total 0.0 0.0 -6 2 1 1 1 1 1 total 0.0 0.0 -7 2 1 1 2 1 1 total 0.0 0.0 -8 2 1 1 3 1 1 total 0.0 0.0 -9 2 1 1 4 1 1 total 0.0 0.0 -10 2 1 1 5 1 1 total 0.0 0.0 -11 2 1 1 6 1 1 total 0.0 0.0 -18 2 2 1 1 1 1 total 0.0 0.0 -19 2 2 1 2 1 1 total 0.0 0.0 -20 2 2 1 3 1 1 total 0.0 0.0 -21 2 2 1 4 1 1 total 0.0 0.0 -22 2 2 1 5 1 1 total 0.0 0.0 -23 2 2 1 6 1 1 total 0.0 0.0 +0 1 1 1 1 total 0.013353 0.001345 +1 1 1 1 2 total 0.032619 0.003120 +2 1 1 1 3 total 0.121042 0.011142 +3 1 1 1 4 total 0.305503 0.026418 +4 1 1 1 5 total 0.860433 0.064665 +5 1 1 1 6 total 2.889963 0.219527 +12 1 2 1 1 total 0.013352 0.001049 +13 1 2 1 2 total 0.032626 0.002465 +14 1 2 1 3 total 0.121027 0.008891 +15 1 2 1 4 total 0.305351 0.021426 +16 1 2 1 5 total 0.859866 0.054490 +17 1 2 1 6 total 2.888034 0.184436 +6 2 1 1 1 total 0.013353 0.000612 +7 2 1 1 2 total 0.032616 0.001412 +8 2 1 1 3 total 0.121047 0.005039 +9 2 1 1 4 total 0.305559 0.012002 +10 2 1 1 5 total 0.860640 0.030707 +11 2 1 1 6 total 2.890664 0.103692 +18 2 2 1 1 total 0.013353 0.001132 +19 2 2 1 2 total 0.032617 0.002633 +20 2 2 1 3 total 0.121046 0.009426 +21 2 2 1 4 total 0.305545 0.022417 +22 2 2 1 5 total 0.860588 0.055030 +23 2 2 1 6 total 2.890489 0.186821 + mesh 1 delayedgroup group in group out nuclide mean std. dev. + x y z +0 1 1 1 1 1 1 total 0.000000 0.000000 +1 1 1 1 2 1 1 total 0.000000 0.000000 +2 1 1 1 3 1 1 total 0.000000 0.000000 +3 1 1 1 4 1 1 total 0.000219 0.000219 +4 1 1 1 5 1 1 total 0.000000 0.000000 +5 1 1 1 6 1 1 total 0.000000 0.000000 +12 1 2 1 1 1 1 total 0.000000 0.000000 +13 1 2 1 2 1 1 total 0.000000 0.000000 +14 1 2 1 3 1 1 total 0.000000 0.000000 +15 1 2 1 4 1 1 total 0.000467 0.000287 +16 1 2 1 5 1 1 total 0.000000 0.000000 +17 1 2 1 6 1 1 total 0.000000 0.000000 +6 2 1 1 1 1 1 total 0.000000 0.000000 +7 2 1 1 2 1 1 total 0.000000 0.000000 +8 2 1 1 3 1 1 total 0.000000 0.000000 +9 2 1 1 4 1 1 total 0.000211 0.000211 +10 2 1 1 5 1 1 total 0.000000 0.000000 +11 2 1 1 6 1 1 total 0.000000 0.000000 +18 2 2 1 1 1 1 total 0.000000 0.000000 +19 2 2 1 2 1 1 total 0.000000 0.000000 +20 2 2 1 3 1 1 total 0.000000 0.000000 +21 2 2 1 4 1 1 total 0.000219 0.000219 +22 2 2 1 5 1 1 total 0.000000 0.000000 +23 2 2 1 6 1 1 total 0.000000 0.000000 diff --git a/tests/regression_tests/mgxs_library_condense/test.py b/tests/regression_tests/mgxs_library_condense/test.py index a7e60617f..bbc4c11bf 100644 --- a/tests/regression_tests/mgxs_library_condense/test.py +++ b/tests/regression_tests/mgxs_library_condense/test.py @@ -36,7 +36,7 @@ class MGXSTestHarness(PyAPITestHarness): self.mgxs_lib.build_library() # Add tallies - self.mgxs_lib.add_to_tallies_file(self._model.tallies, merge=False) + self.mgxs_lib.add_to_tallies(self._model.tallies, merge=False) def _get_results(self, hash_output=False): """Digest info in the statepoint and return as a string.""" diff --git a/tests/regression_tests/mgxs_library_correction/inputs_true.dat b/tests/regression_tests/mgxs_library_correction/inputs_true.dat index ea2d1b714..bb463778f 100644 --- a/tests/regression_tests/mgxs_library_correction/inputs_true.dat +++ b/tests/regression_tests/mgxs_library_correction/inputs_true.dat @@ -1,47 +1,47 @@ - - - - - - + + + + + + - - - - - - + + + + + + - - - - - + + + + + - - - - - - - - - + + + + + + + + + eigenvalue 100 10 5 - + -0.63 -0.63 -1 0.63 0.63 1 diff --git a/tests/regression_tests/mgxs_library_correction/results_true.dat b/tests/regression_tests/mgxs_library_correction/results_true.dat index ff4bd9746..b6aaad044 100644 --- a/tests/regression_tests/mgxs_library_correction/results_true.dat +++ b/tests/regression_tests/mgxs_library_correction/results_true.dat @@ -1,60 +1,60 @@ material group in group out nuclide mean std. dev. -3 1 1 1 total 0.342252 0.023795 -2 1 1 2 total 0.000695 0.000327 +3 1 1 1 total 0.353477 0.019952 +2 1 1 2 total 0.000522 0.000349 1 1 2 1 total 0.000000 0.000000 -0 1 2 2 total 0.388426 0.020840 +0 1 2 2 total 0.414134 0.029955 material group in group out nuclide mean std. dev. -3 1 1 1 total 0.342252 0.023795 -2 1 1 2 total 0.000695 0.000327 +3 1 1 1 total 0.353477 0.019952 +2 1 1 2 total 0.000522 0.000349 1 1 2 1 total 0.000000 0.000000 -0 1 2 2 total 0.388426 0.020840 +0 1 2 2 total 0.414134 0.029955 material group in group out nuclide mean std. dev. -3 1 1 1 total 0.343021 0.031016 -2 1 1 2 total 0.000697 0.000329 +3 1 1 1 total 0.356124 0.026110 +2 1 1 2 total 0.000526 0.000352 1 1 2 1 total 0.000000 0.000000 -0 1 2 2 total 0.376544 0.025156 +0 1 2 2 total 0.413622 0.044755 material group in group out nuclide mean std. dev. -3 1 1 1 total 0.343021 0.039761 -2 1 1 2 total 0.000697 0.000566 +3 1 1 1 total 0.356124 0.033873 +2 1 1 2 total 0.000526 0.000608 1 1 2 1 total 0.000000 0.000000 -0 1 2 2 total 0.376544 0.032140 +0 1 2 2 total 0.413622 0.054899 material group in group out nuclide mean std. dev. -3 2 1 1 total 0.271174 0.022374 +3 2 1 1 total 0.261901 0.016456 2 2 1 2 total 0.000000 0.000000 1 2 2 1 total 0.000000 0.000000 -0 2 2 2 total 0.295401 0.032831 +0 2 2 2 total 0.322376 0.044195 material group in group out nuclide mean std. dev. -3 2 1 1 total 0.271174 0.022374 +3 2 1 1 total 0.261901 0.016456 2 2 1 2 total 0.000000 0.000000 1 2 2 1 total 0.000000 0.000000 -0 2 2 2 total 0.295401 0.032831 +0 2 2 2 total 0.322376 0.044195 material group in group out nuclide mean std. dev. -3 2 1 1 total 0.264654 0.028288 +3 2 1 1 total 0.266612 0.021169 2 2 1 2 total 0.000000 0.000000 1 2 2 1 total 0.000000 0.000000 -0 2 2 2 total 0.295178 0.032530 +0 2 2 2 total 0.321966 0.054140 material group in group out nuclide mean std. dev. -3 2 1 1 total 0.264654 0.036081 +3 2 1 1 total 0.266612 0.025384 2 2 1 2 total 0.000000 0.000000 1 2 2 1 total 0.000000 0.000000 -0 2 2 2 total 0.295178 0.044676 +0 2 2 2 total 0.321966 0.068014 material group in group out nuclide mean std. dev. -3 3 1 1 total 0.257831 0.014436 -2 3 1 2 total 0.030826 0.000973 -1 3 2 1 total 0.000467 0.000467 -0 3 2 2 total 1.443057 0.119909 +3 3 1 1 total 0.259426 0.012116 +2 3 1 2 total 0.031650 0.000613 +1 3 2 1 total 0.000474 0.000475 +0 3 2 2 total 1.416407 0.162435 material group in group out nuclide mean std. dev. -3 3 1 1 total 0.257831 0.014436 -2 3 1 2 total 0.030826 0.000973 -1 3 2 1 total 0.000467 0.000467 -0 3 2 2 total 1.443057 0.119909 +3 3 1 1 total 0.259426 0.012116 +2 3 1 2 total 0.031650 0.000613 +1 3 2 1 total 0.000474 0.000475 +0 3 2 2 total 1.416407 0.162435 material group in group out nuclide mean std. dev. -3 3 1 1 total 0.267025 0.029512 -2 3 1 2 total 0.031268 0.001416 -1 3 2 1 total 0.000466 0.000467 -0 3 2 2 total 1.440250 0.164573 +3 3 1 1 total 0.266083 0.024503 +2 3 1 2 total 0.031973 0.001157 +1 3 2 1 total 0.000477 0.000480 +0 3 2 2 total 1.427932 0.269812 material group in group out nuclide mean std. dev. -3 3 1 1 total 0.267025 0.032860 -2 3 1 2 total 0.031268 0.001768 -1 3 2 1 total 0.000466 0.000808 -0 3 2 2 total 1.440250 0.212183 +3 3 1 1 total 0.266083 0.027910 +2 3 1 2 total 0.031973 0.001391 +1 3 2 1 total 0.000477 0.000827 +0 3 2 2 total 1.427932 0.328026 diff --git a/tests/regression_tests/mgxs_library_correction/test.py b/tests/regression_tests/mgxs_library_correction/test.py index 05eedfef8..64e638e44 100644 --- a/tests/regression_tests/mgxs_library_correction/test.py +++ b/tests/regression_tests/mgxs_library_correction/test.py @@ -29,7 +29,7 @@ class MGXSTestHarness(PyAPITestHarness): self.mgxs_lib.build_library() # Add tallies - self.mgxs_lib.add_to_tallies_file(self._model.tallies, merge=False) + self.mgxs_lib.add_to_tallies(self._model.tallies, merge=False) def _get_results(self, hash_output=False): """Digest info in the statepoint and return as a string.""" diff --git a/tests/regression_tests/mgxs_library_distribcell/inputs_true.dat b/tests/regression_tests/mgxs_library_distribcell/inputs_true.dat index f1a605334..e3826cc18 100644 --- a/tests/regression_tests/mgxs_library_distribcell/inputs_true.dat +++ b/tests/regression_tests/mgxs_library_distribcell/inputs_true.dat @@ -1,38 +1,38 @@ - - - - - - + + + + + + - - - - - - + + + + + + - - - - - + + + + + - - - - - - - + + + + + + + 1.26 1.26 17 17 @@ -56,19 +56,19 @@ 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 - - - - - - + + + + + + eigenvalue 100 10 5 - + -10.71 -10.71 -1 10.71 10.71 1 diff --git a/tests/regression_tests/mgxs_library_distribcell/results_true.dat b/tests/regression_tests/mgxs_library_distribcell/results_true.dat index ef7cb2b96..127df75c1 100644 --- a/tests/regression_tests/mgxs_library_distribcell/results_true.dat +++ b/tests/regression_tests/mgxs_library_distribcell/results_true.dat @@ -1,97 +1,97 @@ sum(distribcell) group in nuclide mean std. dev. -0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 total 0.455527 0.009851 +0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 total 0.459656 0.010039 sum(distribcell) group in nuclide mean std. dev. -0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 total 0.409242 0.011118 - sum(distribcell) group in nuclide mean std. dev. -0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 total 0.40929 0.011119 +0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 total 0.416327 0.01121 sum(distribcell) group in nuclide mean std. dev. -0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 total 0.066934 0.002424 +0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 total 0.416327 0.01121 sum(distribcell) group in nuclide mean std. dev. -0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 total 0.066764 0.002423 +0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 total 0.070545 0.002486 sum(distribcell) group in nuclide mean std. dev. -0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 total 0.028358 0.002669 +0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 total 0.070348 0.002485 sum(distribcell) group in nuclide mean std. dev. -0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 total 0.038576 0.001526 +0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 total 0.029374 0.002719 sum(distribcell) group in nuclide mean std. dev. -0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 total 0.094817 0.003725 +0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 total 0.041172 0.001562 + sum(distribcell) group in nuclide mean std. dev. +0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 total 0.101218 0.003812 sum(distribcell) group in nuclide mean std. dev. -0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 total 7.470225e+06 295170.385185 +0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 total 7.972654e+06 302079.851251 + sum(distribcell) group in nuclide mean std. dev. +0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 total 0.38911 0.00831 sum(distribcell) group in nuclide mean std. dev. -0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 total 0.388593 0.008156 - sum(distribcell) group in nuclide mean std. dev. -0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 total 0.388874 0.013889 +0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 total 0.394876 0.014019 sum(distribcell) group in group out legendre nuclide mean std. dev. -0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 P0 total 0.388711 0.013887 -1 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 P1 total 0.046285 0.005155 -2 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 P2 total 0.023632 0.003772 -3 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 P3 total 0.006997 0.003207 +0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 P0 total 0.394876 0.014019 +1 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 P1 total 0.043329 0.004988 +2 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 P2 total 0.027490 0.003974 +3 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 P3 total 0.016004 0.003232 sum(distribcell) group in group out legendre nuclide mean std. dev. -0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 P0 total 0.388874 0.013889 -1 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 P1 total 0.046237 0.005156 -2 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 P2 total 0.023571 0.003775 -3 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 P3 total 0.007058 0.003207 - sum(distribcell) group in group out nuclide mean std. dev. -0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 total 1.000418 0.036246 - sum(distribcell) group in group out nuclide mean std. dev. -0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 total 0.092139 0.005956 +0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 P0 total 0.394876 0.014019 +1 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 P1 total 0.043329 0.004988 +2 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 P2 total 0.027490 0.003974 +3 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 P3 total 0.016004 0.003232 sum(distribcell) group in group out nuclide mean std. dev. -0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 total 1.0 0.036242 - sum(distribcell) group in group out legendre nuclide mean std. dev. -0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 P0 total 0.388593 0.016275 -1 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 P1 total 0.046271 0.005251 -2 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 P2 total 0.023624 0.003806 -3 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 P3 total 0.006995 0.003209 - sum(distribcell) group in group out legendre nuclide mean std. dev. -0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 P0 total 0.388755 0.021528 -1 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 P1 total 0.046290 0.005515 -2 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 P2 total 0.023634 0.003903 -3 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 P3 total 0.006998 0.003221 - sum(distribcell) group out nuclide mean std. dev. -0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 total 1.0 0.084366 - sum(distribcell) group out nuclide mean std. dev. -0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 total 1.0 0.084331 - sum(distribcell) group in nuclide mean std. dev. -0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 total 5.253873e-07 2.168462e-08 - sum(distribcell) group in nuclide mean std. dev. -0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 total 0.094147 0.003701 +0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 total 1.0 0.036306 sum(distribcell) group in group out nuclide mean std. dev. -0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 total 0.091593 0.005919 +0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 total 0.097856 0.006191 + sum(distribcell) group in group out nuclide mean std. dev. +0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 total 1.0 0.036306 + sum(distribcell) group in group out legendre nuclide mean std. dev. +0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 P0 total 0.389110 0.016390 +1 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 P1 total 0.042696 0.005009 +2 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 P2 total 0.027088 0.003964 +3 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 P3 total 0.015770 0.003204 + sum(distribcell) group in group out legendre nuclide mean std. dev. +0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 P0 total 0.389110 0.021638 +1 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 P1 total 0.042696 0.005244 +2 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 P2 total 0.027088 0.004084 +3 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 P3 total 0.015770 0.003255 + sum(distribcell) group out nuclide mean std. dev. +0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 total 1.0 0.082469 + sum(distribcell) group out nuclide mean std. dev. +0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 total 1.0 0.082587 + sum(distribcell) group in nuclide mean std. dev. +0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 total 5.626624e-07 2.235532e-08 sum(distribcell) group in nuclide mean std. dev. -0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 total 0.814514 0.022129 +0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 total 0.100506 0.003787 + sum(distribcell) group in group out nuclide mean std. dev. +0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 total 0.097658 0.006185 sum(distribcell) group in nuclide mean std. dev. -0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 total 0.814419 0.022125 +0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 total 0.800653 0.021558 + sum(distribcell) group in nuclide mean std. dev. +0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 total 0.800653 0.021558 sum(distribcell) delayedgroup group in nuclide mean std. dev. -0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 total 0.000021 8.473275e-07 -1 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 2 1 total 0.000115 4.405467e-06 -2 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 3 1 total 0.000112 4.225826e-06 -3 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 4 1 total 0.000259 9.559952e-06 -4 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 5 1 total 0.000115 4.025369e-06 -5 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 6 1 total 0.000048 1.682226e-06 +0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 total 0.000023 8.667436e-07 +1 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 2 1 total 0.000122 4.499059e-06 +2 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 3 1 total 0.000119 4.311220e-06 +3 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 4 1 total 0.000275 9.735290e-06 +4 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 5 1 total 0.000122 4.078954e-06 +5 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 6 1 total 0.000051 1.705327e-06 sum(distribcell) delayedgroup group out nuclide mean std. dev. 0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 total 0.0 0.000000 -1 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 2 1 total 0.0 0.000000 -2 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 3 1 total 1.0 1.000002 -3 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 4 1 total 1.0 1.414214 +1 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 2 1 total 1.0 1.414214 +2 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 3 1 total 0.0 0.000000 +3 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 4 1 total 0.0 0.000000 4 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 5 1 total 0.0 0.000000 5 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 6 1 total 0.0 0.000000 sum(distribcell) delayedgroup group in nuclide mean std. dev. -0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 total 0.000227 0.000012 -1 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 2 1 total 0.001210 0.000062 -2 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 3 1 total 0.001177 0.000060 -3 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 4 1 total 0.002728 0.000136 -4 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 5 1 total 0.001211 0.000059 -5 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 6 1 total 0.000504 0.000025 +0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 total 0.000227 0.000011 +1 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 2 1 total 0.001208 0.000059 +2 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 3 1 total 0.001175 0.000056 +3 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 4 1 total 0.002721 0.000129 +4 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 5 1 total 0.001206 0.000055 +5 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 6 1 total 0.000502 0.000023 sum(distribcell) delayedgroup nuclide mean std. dev. -0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 total 0.013353 0.000692 -1 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 2 total 0.032613 0.001644 -2 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 3 total 0.121054 0.005983 -3 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 4 total 0.305630 0.014645 -4 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 5 total 0.860903 0.038693 -5 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 6 total 2.891558 0.130564 +0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 total 0.013353 0.000658 +1 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 2 total 0.032616 0.001562 +2 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 3 total 0.121048 0.005678 +3 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 4 total 0.305568 0.013868 +4 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 5 total 0.860675 0.036434 +5 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 6 total 2.890786 0.122997 sum(distribcell) delayedgroup group in group out nuclide mean std. dev. 0 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 1 1 1 total 0.000000 0.000000 -1 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 2 1 1 total 0.000000 0.000000 -2 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 3 1 1 total 0.000362 0.000256 -3 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 4 1 1 total 0.000185 0.000185 +1 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 2 1 1 total 0.000198 0.000198 +2 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 3 1 1 total 0.000000 0.000000 +3 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 4 1 1 total 0.000000 0.000000 4 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 5 1 1 total 0.000000 0.000000 5 ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...),) 6 1 1 total 0.000000 0.000000 diff --git a/tests/regression_tests/mgxs_library_distribcell/test.py b/tests/regression_tests/mgxs_library_distribcell/test.py index fd6c8e938..464b309c0 100644 --- a/tests/regression_tests/mgxs_library_distribcell/test.py +++ b/tests/regression_tests/mgxs_library_distribcell/test.py @@ -36,7 +36,7 @@ class MGXSTestHarness(PyAPITestHarness): self.mgxs_lib.build_library() # Add tallies - self.mgxs_lib.add_to_tallies_file(self._model.tallies, merge=False) + self.mgxs_lib.add_to_tallies(self._model.tallies, merge=False) self._model.tallies.export_to_xml() def _get_results(self, hash_output=False): diff --git a/tests/regression_tests/mgxs_library_hdf5/inputs_true.dat b/tests/regression_tests/mgxs_library_hdf5/inputs_true.dat index 8606e9fdd..4451d214c 100644 --- a/tests/regression_tests/mgxs_library_hdf5/inputs_true.dat +++ b/tests/regression_tests/mgxs_library_hdf5/inputs_true.dat @@ -1,47 +1,47 @@ - - - - - - + + + + + + - - - - - - + + + + + + - - - - - + + + + + - - - - - - - - - + + + + + + + + + eigenvalue 100 10 5 - + -0.63 -0.63 -1 0.63 0.63 1 diff --git a/tests/regression_tests/mgxs_library_hdf5/results_true.dat b/tests/regression_tests/mgxs_library_hdf5/results_true.dat index b2ef8eae9..14d7371fe 100644 --- a/tests/regression_tests/mgxs_library_hdf5/results_true.dat +++ b/tests/regression_tests/mgxs_library_hdf5/results_true.dat @@ -1,201 +1,201 @@ domain=1 type=total -[5.52629207e-01 1.46792426e+00] -[2.73983948e-02 9.30468557e-02] +[5.66580451e-01 1.44262943e+00] +[1.96770003e-02 1.46112369e-01] domain=1 type=transport -[3.09650231e-01 1.14528468e+00] -[2.96126059e-02 1.01957125e-01] +[3.14856281e-01 1.05346368e+00] +[2.15203447e-02 1.60562179e-01] domain=1 type=nu-transport -[3.09650231e-01 1.14528468e+00] -[2.96126059e-02 1.01957125e-01] +[3.14856281e-01 1.05346368e+00] +[2.15203447e-02 1.60562179e-01] domain=1 type=absorption -[7.90251362e-03 9.52195503e-02] -[7.77996866e-04 5.32017792e-03] +[8.63921263e-03 9.70718967e-02] +[7.09849180e-04 9.96697703e-03] domain=1 type=reduced absorption -[7.88836875e-03 9.52195503e-02] -[7.77877367e-04 5.32017792e-03] +[8.63459183e-03 9.70718967e-02] +[7.09826160e-04 9.96697703e-03] domain=1 type=capture -[5.66271991e-03 4.03380329e-02] -[7.65494411e-04 4.41129849e-03] +[6.29732743e-03 4.01344183e-02] +[7.03181817e-04 9.43458504e-03] domain=1 type=fission -[2.23979371e-03 5.48815174e-02] -[1.44808204e-04 3.21965557e-03] +[2.34188519e-03 5.69374784e-02] +[1.04006997e-04 6.19904834e-03] domain=1 type=nu-fission -[5.70078167e-03 1.33729794e-01] -[3.71908758e-04 7.84533474e-03] +[5.93985124e-03 1.38739554e-01] +[2.57215008e-04 1.51052211e-02] domain=1 type=kappa-fission -[4.36283087e+05 1.06143820e+07] -[2.81939099e+04 6.22698786e+05] +[4.55876276e+05 1.10120160e+07] +[2.00450394e+04 1.19892945e+06] domain=1 type=scatter -[5.44726693e-01 1.37270471e+00] -[2.67443307e-02 8.86578418e-02] +[5.57941239e-01 1.34555753e+00] +[1.96103602e-02 1.38008873e-01] domain=1 type=nu-scatter -[5.46058885e-01 1.38608802e+00] -[2.72733439e-02 9.59957737e-02] +[5.53883536e-01 1.40126963e+00] +[1.89917740e-02 1.62647765e-01] domain=1 type=scatter matrix -[[[5.25081070e-01 2.42978975e-01 9.65459393e-02 8.62265123e-03] - [2.09778151e-02 5.67750504e-03 -1.86093418e-03 -1.63034937e-03]] +[[[5.35878034e-01 2.51724170e-01 1.01011269e-01 1.03439439e-02] + [1.80055019e-02 5.80562809e-03 -1.57470166e-03 -2.27320020e-03]] [[0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00] - [1.38608802e+00 2.92665071e-01 4.65545679e-02 3.43129413e-03]]] -[[[2.68584158e-02 1.12354079e-02 5.95151250e-03 5.08213314e-03] - [1.69810442e-03 1.03379654e-03 3.35798077e-04 8.28775769e-04]] + [1.40126963e+00 3.55339640e-01 7.06453615e-02 4.04065595e-02]]] +[[[1.86010787e-02 8.71440749e-03 3.01351835e-03 5.22968320e-03] + [1.36795874e-03 6.67372701e-04 3.26122899e-04 8.68935369e-04]] [[0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00] - [9.59957737e-02 3.98634629e-02 1.79245433e-02 2.53788407e-02]]] + [1.62647765e-01 6.23420543e-02 9.61788834e-03 8.80966610e-03]]] domain=1 type=nu-scatter matrix -[[[5.25081070e-01 2.42978975e-01 9.65459393e-02 8.62265123e-03] - [2.09778151e-02 5.67750504e-03 -1.86093418e-03 -1.63034937e-03]] +[[[5.35878034e-01 2.51724170e-01 1.01011269e-01 1.03439439e-02] + [1.80055019e-02 5.80562809e-03 -1.57470166e-03 -2.27320020e-03]] [[0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00] - [1.38608802e+00 2.92665071e-01 4.65545679e-02 3.43129413e-03]]] -[[[2.68584158e-02 1.12354079e-02 5.95151250e-03 5.08213314e-03] - [1.69810442e-03 1.03379654e-03 3.35798077e-04 8.28775769e-04]] + [1.40126963e+00 3.55339640e-01 7.06453615e-02 4.04065595e-02]]] +[[[1.86010787e-02 8.71440749e-03 3.01351835e-03 5.22968320e-03] + [1.36795874e-03 6.67372701e-04 3.26122899e-04 8.68935369e-04]] [[0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00] - [9.59957737e-02 3.98634629e-02 1.79245433e-02 2.53788407e-02]]] + [1.62647765e-01 6.23420543e-02 9.61788834e-03 8.80966610e-03]]] domain=1 type=multiplicity matrix [[1.00000000e+00 1.00000000e+00] [0.00000000e+00 1.00000000e+00]] -[[4.49973217e-02 9.94834121e-02] - [0.00000000e+00 8.90267353e-02]] +[[3.27047397e-02 1.01015254e-01] + [0.00000000e+00 1.16966513e-01]] domain=1 type=nu-fission matrix -[[6.79725552e-03 0.00000000e+00] - [1.34226308e-01 0.00000000e+00]] -[[1.39232734e-03 0.00000000e+00] - [1.55126210e-02 0.00000000e+00]] +[[7.11392182e-03 0.00000000e+00] + [1.52683850e-01 0.00000000e+00]] +[[1.05605314e-03 0.00000000e+00] + [2.58713491e-02 0.00000000e+00]] domain=1 type=scatter probability matrix -[[9.61583236e-01 3.84167637e-02] +[[9.67492260e-01 3.25077399e-02] [0.00000000e+00 1.00000000e+00]] -[[4.25251594e-02 2.94881301e-03] - [0.00000000e+00 8.90267353e-02]] +[[3.12124830e-02 2.43439942e-03] + [0.00000000e+00 1.16966513e-01]] domain=1 type=consistent scatter matrix -[[[5.23800056e-01 2.42386192e-01 9.63104011e-02 8.60161499e-03] - [2.09266366e-02 5.66365392e-03 -1.85639416e-03 -1.62637189e-03]] +[[[5.39803830e-01 2.53568280e-01 1.01751269e-01 1.04197228e-02] + [1.81374087e-02 5.84815962e-03 -1.58623779e-03 -2.28985347e-03]] [[0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00] - [1.37270471e+00 2.89839256e-01 4.61050623e-02 3.39816342e-03]]] -[[[3.46115177e-02 1.51137129e-02 7.17487890e-03 5.08248710e-03] - [1.90677851e-03 1.05813829e-03 3.43862086e-04 8.29548315e-04]] + [1.34555753e+00 3.41211940e-01 6.78366221e-02 3.88000634e-02]]] +[[[2.57534994e-02 1.20804286e-02 4.50621873e-03 5.27902298e-03] + [1.50041314e-03 6.98980912e-04 3.32589287e-04 8.78503928e-04]] [[0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00] - [1.50979688e-01 4.66032426e-02 1.81833349e-02 2.51354735e-02]]] + [2.09324012e-01 6.95175402e-02 1.16044952e-02 9.36549883e-03]]] domain=1 type=consistent nu-scatter matrix -[[[5.23800056e-01 2.42386192e-01 9.63104011e-02 8.60161499e-03] - [2.09266366e-02 5.66365392e-03 -1.85639416e-03 -1.62637189e-03]] +[[[5.39803830e-01 2.53568280e-01 1.01751269e-01 1.04197228e-02] + [1.81374087e-02 5.84815962e-03 -1.58623779e-03 -2.28985347e-03]] [[0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00] - [1.37270471e+00 2.89839256e-01 4.61050623e-02 3.39816342e-03]]] -[[[4.18746126e-02 1.86381616e-02 8.38211969e-03 5.09720340e-03] - [2.82310416e-03 1.19879975e-03 3.90317811e-04 8.45179676e-04]] + [1.34555753e+00 3.41211940e-01 6.78366221e-02 3.88000634e-02]]] +[[[3.12235732e-02 1.46529414e-02 5.60177820e-03 5.29001047e-03] + [2.36812824e-03 9.15185125e-04 3.69175618e-04 9.08445666e-04]] [[0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00] - [1.94240879e-01 5.32698778e-02 1.86408495e-02 2.51372940e-02]]] + [2.61890501e-01 8.01593794e-02 1.40578233e-02 1.04071518e-02]]] domain=1 type=chi [1.00000000e+00 0.00000000e+00] -[1.03333203e-01 0.00000000e+00] +[1.42429813e-01 0.00000000e+00] domain=1 type=chi-prompt [1.00000000e+00 0.00000000e+00] -[1.03333203e-01 0.00000000e+00] +[1.43958515e-01 0.00000000e+00] domain=1 type=inverse-velocity -[5.72461488e-08 3.00999757e-06] -[2.80644407e-09 1.80993426e-07] +[6.05275939e-08 2.92408191e-06] +[4.98534008e-09 2.95326306e-07] domain=1 type=prompt-nu-fission -[5.64594959e-03 1.32859920e-01] -[3.68364598e-04 7.79430310e-03] +[5.88433433e-03 1.37837093e-01] +[2.56012352e-04 1.50069660e-02] domain=1 type=prompt-nu-fission matrix -[[6.79725552e-03 0.00000000e+00] - [1.34226308e-01 0.00000000e+00]] -[[1.39232734e-03 0.00000000e+00] - [1.55126210e-02 0.00000000e+00]] +[[7.11392182e-03 0.00000000e+00] + [1.51190909e-01 0.00000000e+00]] +[[1.05605314e-03 0.00000000e+00] + [2.57973847e-02 0.00000000e+00]] domain=1 type=current -[[[0.00000000e+00 0.00000000e+00 3.54200000e+00 3.59000000e+00 - 0.00000000e+00 0.00000000e+00 3.73400000e+00 3.69000000e+00] - [0.00000000e+00 0.00000000e+00 7.08000000e-01 6.90000000e-01 - 0.00000000e+00 0.00000000e+00 6.78000000e-01 6.74000000e-01]] +[[[0.00000000e+00 0.00000000e+00 3.71800000e+00 3.58600000e+00 + 0.00000000e+00 0.00000000e+00 3.62200000e+00 3.71800000e+00] + [0.00000000e+00 0.00000000e+00 6.60000000e-01 6.58000000e-01 + 0.00000000e+00 0.00000000e+00 6.62000000e-01 6.70000000e-01]] - [[3.59000000e+00 3.54200000e+00 0.00000000e+00 0.00000000e+00 - 0.00000000e+00 0.00000000e+00 3.65200000e+00 3.73800000e+00] - [6.90000000e-01 7.08000000e-01 0.00000000e+00 0.00000000e+00 - 0.00000000e+00 0.00000000e+00 6.94000000e-01 6.64000000e-01]] + [[3.58600000e+00 3.71800000e+00 0.00000000e+00 0.00000000e+00 + 0.00000000e+00 0.00000000e+00 3.71200000e+00 3.60600000e+00] + [6.58000000e-01 6.60000000e-01 0.00000000e+00 0.00000000e+00 + 0.00000000e+00 0.00000000e+00 7.04000000e-01 6.74000000e-01]] - [[0.00000000e+00 0.00000000e+00 3.76000000e+00 3.66600000e+00 - 3.69000000e+00 3.73400000e+00 0.00000000e+00 0.00000000e+00] - [0.00000000e+00 0.00000000e+00 6.68000000e-01 7.22000000e-01 - 6.74000000e-01 6.78000000e-01 0.00000000e+00 0.00000000e+00]] + [[0.00000000e+00 0.00000000e+00 3.48600000e+00 3.60600000e+00 + 3.71800000e+00 3.62200000e+00 0.00000000e+00 0.00000000e+00] + [0.00000000e+00 0.00000000e+00 6.66000000e-01 6.74000000e-01 + 6.70000000e-01 6.62000000e-01 0.00000000e+00 0.00000000e+00]] - [[3.66600000e+00 3.76000000e+00 0.00000000e+00 0.00000000e+00 - 3.73800000e+00 3.65200000e+00 0.00000000e+00 0.00000000e+00] - [7.22000000e-01 6.68000000e-01 0.00000000e+00 0.00000000e+00 - 6.64000000e-01 6.94000000e-01 0.00000000e+00 0.00000000e+00]]] -[[[0.00000000e+00 0.00000000e+00 1.04230514e-01 1.61183126e-01 - 0.00000000e+00 0.00000000e+00 1.50419414e-01 1.00498756e-01] - [0.00000000e+00 0.00000000e+00 2.47790234e-02 3.27108545e-02 - 0.00000000e+00 0.00000000e+00 4.84148737e-02 3.24961536e-02]] + [[3.60600000e+00 3.48600000e+00 0.00000000e+00 0.00000000e+00 + 3.60600000e+00 3.71200000e+00 0.00000000e+00 0.00000000e+00] + [6.74000000e-01 6.66000000e-01 0.00000000e+00 0.00000000e+00 + 6.74000000e-01 7.04000000e-01 0.00000000e+00 0.00000000e+00]]] +[[[0.00000000e+00 0.00000000e+00 9.96192752e-02 8.73269718e-02 + 0.00000000e+00 0.00000000e+00 1.22531629e-01 1.08369737e-01] + [0.00000000e+00 0.00000000e+00 3.96232255e-02 4.06693988e-02 + 0.00000000e+00 0.00000000e+00 4.05462699e-02 4.27784993e-02]] - [[1.61183126e-01 1.04230514e-01 0.00000000e+00 0.00000000e+00 - 0.00000000e+00 0.00000000e+00 1.44201248e-01 1.81229137e-01] - [3.27108545e-02 2.47790234e-02 0.00000000e+00 0.00000000e+00 - 0.00000000e+00 0.00000000e+00 3.41467422e-02 2.20454077e-02]] + [[8.73269718e-02 9.96192752e-02 0.00000000e+00 0.00000000e+00 + 0.00000000e+00 0.00000000e+00 7.09506871e-02 5.27825729e-02] + [4.06693988e-02 3.96232255e-02 0.00000000e+00 0.00000000e+00 + 0.00000000e+00 0.00000000e+00 6.11228272e-02 5.88727441e-02]] - [[0.00000000e+00 0.00000000e+00 1.39355660e-01 9.70875893e-02 - 1.00498756e-01 1.50419414e-01 0.00000000e+00 0.00000000e+00] - [0.00000000e+00 0.00000000e+00 1.56204994e-02 3.27719392e-02 - 3.24961536e-02 4.84148737e-02 0.00000000e+00 0.00000000e+00]] + [[0.00000000e+00 0.00000000e+00 1.00279609e-01 1.31209756e-01 + 1.08369737e-01 1.22531629e-01 0.00000000e+00 0.00000000e+00] + [0.00000000e+00 0.00000000e+00 6.05475020e-02 4.87442304e-02 + 4.27784993e-02 4.05462699e-02 0.00000000e+00 0.00000000e+00]] - [[9.70875893e-02 1.39355660e-01 0.00000000e+00 0.00000000e+00 - 1.81229137e-01 1.44201248e-01 0.00000000e+00 0.00000000e+00] - [3.27719392e-02 1.56204994e-02 0.00000000e+00 0.00000000e+00 - 2.20454077e-02 3.41467422e-02 0.00000000e+00 0.00000000e+00]]] + [[1.31209756e-01 1.00279609e-01 0.00000000e+00 0.00000000e+00 + 5.27825729e-02 7.09506871e-02 0.00000000e+00 0.00000000e+00] + [4.87442304e-02 6.05475020e-02 0.00000000e+00 0.00000000e+00 + 5.88727441e-02 6.11228272e-02 0.00000000e+00 0.00000000e+00]]] domain=1 type=diffusion-coefficient -[1.07648340e+00 2.91048451e-01] -[1.02946730e-01 2.59101197e-02] +[1.05868408e+00 3.16416542e-01] +[7.23607812e-02 4.82261806e-02] domain=1 type=nu-diffusion-coefficient -[1.07648340e+00 2.91048451e-01] -[1.02946730e-01 2.59101197e-02] +[1.05868408e+00 3.16416542e-01] +[7.23607812e-02 4.82261806e-02] domain=1 type=delayed-nu-fission -[[1.27862358e-06 3.04521075e-05] - [7.84219053e-06 1.57184471e-04] - [8.19703020e-06 1.50062017e-04] - [2.11585246e-05 3.36451683e-04] - [1.15983232e-05 1.37940708e-04] - [4.75823112e-06 5.77828684e-05]] -[[8.24665595e-08 1.78649023e-06] - [5.11270396e-07 9.22131636e-06] - [5.43215007e-07 8.80347339e-06] - [1.44919046e-06 1.97381285e-05] - [8.56858673e-07 8.09236929e-06] - [3.49663884e-07 3.38986452e-06]] +[[1.33370452e-06 3.15928985e-05] + [8.06563789e-06 1.63072885e-04] + [8.37555675e-06 1.55683610e-04] + [2.14225848e-05 3.49055766e-04] + [1.15633419e-05 1.43108212e-04] + [4.74849054e-06 5.99475175e-05]] +[[5.58190638e-08 3.43966581e-06] + [2.80924725e-07 1.77545031e-05] + [2.81900859e-07 1.69499982e-05] + [7.44207592e-07 3.80033227e-05] + [4.95821820e-07 1.55808550e-05] + [2.00315983e-07 6.52676436e-06]] domain=1 type=chi-delayed [[0.00000000e+00 0.00000000e+00] [0.00000000e+00 0.00000000e+00] [0.00000000e+00 0.00000000e+00] - [0.00000000e+00 0.00000000e+00] + [1.00000000e+00 0.00000000e+00] [0.00000000e+00 0.00000000e+00] [0.00000000e+00 0.00000000e+00]] [[0.00000000e+00 0.00000000e+00] [0.00000000e+00 0.00000000e+00] [0.00000000e+00 0.00000000e+00] - [0.00000000e+00 0.00000000e+00] + [1.41421356e+00 0.00000000e+00] [0.00000000e+00 0.00000000e+00] [0.00000000e+00 0.00000000e+00]] domain=1 type=beta -[[2.24289169e-04 2.27713711e-04] - [1.37563425e-03 1.17538857e-03] - [1.43787829e-03 1.12212853e-03] - [3.71151288e-03 2.51590669e-03] - [2.03451453e-03 1.03148823e-03] - [8.34662928e-04 4.32086724e-04]] -[[1.75760869e-05 1.28957660e-05] - [1.08591736e-04 6.65640010e-05] - [1.14785004e-04 6.35478047e-05] - [3.03169937e-04 1.42479528e-04] - [1.75476030e-04 5.84147049e-05] - [7.17094876e-05 2.44697107e-05]] +[[2.24535003e-04 2.27713710e-04] + [1.35788550e-03 1.17538857e-03] + [1.41006170e-03 1.12212852e-03] + [3.60658609e-03 2.51590665e-03] + [1.94673931e-03 1.03148820e-03] + [7.99429201e-04 4.32086711e-04]] +[[1.15072629e-05 2.77827007e-05] + [6.20475481e-05 1.43405806e-04] + [6.31808205e-05 1.36907698e-04] + [1.64551758e-04 3.06958585e-04] + [1.01406915e-04 1.25848924e-04] + [4.11875799e-05 5.27176635e-05]] domain=1 type=decay-rate -[1.33535692e-02 3.26115957e-02 1.21057117e-01 3.05655911e-01 - 8.60999995e-01 2.89188863e+00] -[6.74373067e-04 1.71978136e-03 6.57917554e-03 1.73982053e-02 - 5.37683207e-02 1.79407115e-01] +[1.33525569e-02 3.26187089e-02 1.21041926e-01 3.05503129e-01 + 8.60433350e-01 2.88996258e+00] +[1.34484408e-03 3.11955840e-03 1.11418058e-02 2.64184722e-02 + 6.46651447e-02 2.19526509e-01] domain=1 type=delayed-nu-fission matrix [[[0.00000000e+00 0.00000000e+00] [0.00000000e+00 0.00000000e+00]] @@ -207,7 +207,7 @@ domain=1 type=delayed-nu-fission matrix [0.00000000e+00 0.00000000e+00]] [[0.00000000e+00 0.00000000e+00] - [0.00000000e+00 0.00000000e+00]] + [1.49294023e-03 0.00000000e+00]] [[0.00000000e+00 0.00000000e+00] [0.00000000e+00 0.00000000e+00]] @@ -224,7 +224,7 @@ domain=1 type=delayed-nu-fission matrix [0.00000000e+00 0.00000000e+00]] [[0.00000000e+00 0.00000000e+00] - [0.00000000e+00 0.00000000e+00]] + [1.49788268e-03 0.00000000e+00]] [[0.00000000e+00 0.00000000e+00] [0.00000000e+00 0.00000000e+00]] diff --git a/tests/regression_tests/mgxs_library_hdf5/test.py b/tests/regression_tests/mgxs_library_hdf5/test.py index 06625c25f..4fb4bf093 100644 --- a/tests/regression_tests/mgxs_library_hdf5/test.py +++ b/tests/regression_tests/mgxs_library_hdf5/test.py @@ -40,7 +40,7 @@ class MGXSTestHarness(PyAPITestHarness): self.mgxs_lib.build_library() # Add tallies - self.mgxs_lib.add_to_tallies_file(self._model.tallies, merge=False) + self.mgxs_lib.add_to_tallies(self._model.tallies, merge=False) def _get_results(self, hash_output=False): """Digest info in the statepoint and return as a string.""" diff --git a/tests/regression_tests/mgxs_library_histogram/inputs_true.dat b/tests/regression_tests/mgxs_library_histogram/inputs_true.dat index 013fcd0fa..94c656418 100644 --- a/tests/regression_tests/mgxs_library_histogram/inputs_true.dat +++ b/tests/regression_tests/mgxs_library_histogram/inputs_true.dat @@ -1,47 +1,47 @@ - - - - - - + + + + + + - - - - - - + + + + + + - - - - - + + + + + - - - - - - - - - + + + + + + + + + eigenvalue 100 10 5 - + -0.63 -0.63 -1 0.63 0.63 1 diff --git a/tests/regression_tests/mgxs_library_histogram/results_true.dat b/tests/regression_tests/mgxs_library_histogram/results_true.dat index 2fa94cef5..f927d057e 100644 --- a/tests/regression_tests/mgxs_library_histogram/results_true.dat +++ b/tests/regression_tests/mgxs_library_histogram/results_true.dat @@ -1,18 +1,18 @@ material group in group out mu bin nuclide mean std. dev. -33 1 1 1 1 total 0.032861 0.003703 -34 1 1 1 2 total 0.026428 0.003637 -35 1 1 1 3 total 0.029210 0.001648 -36 1 1 1 4 total 0.032513 0.004770 -37 1 1 1 5 total 0.030949 0.003129 -38 1 1 1 6 total 0.027124 0.004029 -39 1 1 1 7 total 0.030079 0.002186 -40 1 1 1 8 total 0.037034 0.002198 -41 1 1 1 9 total 0.038251 0.003825 -42 1 1 1 10 total 0.039294 0.003626 -43 1 1 1 11 total 0.062593 0.005934 -22 1 1 2 1 total 0.000000 0.000000 -23 1 1 2 2 total 0.000174 0.000174 -24 1 1 2 3 total 0.000348 0.000213 +33 1 1 1 1 total 0.029945 0.003043 +34 1 1 1 2 total 0.028378 0.003793 +35 1 1 1 3 total 0.033079 0.002866 +36 1 1 1 4 total 0.030119 0.002259 +37 1 1 1 5 total 0.033601 0.003739 +38 1 1 1 6 total 0.035516 0.001929 +39 1 1 1 7 total 0.032382 0.001744 +40 1 1 1 8 total 0.031860 0.002565 +41 1 1 1 9 total 0.038302 0.004757 +42 1 1 1 10 total 0.041784 0.003047 +43 1 1 1 11 total 0.057453 0.003686 +22 1 1 2 1 total 0.000174 0.000174 +23 1 1 2 2 total 0.000000 0.000000 +24 1 1 2 3 total 0.000174 0.000174 25 1 1 2 4 total 0.000174 0.000174 26 1 1 2 5 total 0.000000 0.000000 27 1 1 2 6 total 0.000000 0.000000 @@ -32,32 +32,32 @@ 19 1 2 1 9 total 0.000000 0.000000 20 1 2 1 10 total 0.000000 0.000000 21 1 2 1 11 total 0.000000 0.000000 -0 1 2 2 1 total 0.032383 0.006826 -1 1 2 2 2 total 0.037146 0.001158 -2 1 2 2 3 total 0.036193 0.004463 -3 1 2 2 4 total 0.036193 0.007028 -4 1 2 2 5 total 0.038098 0.006769 -5 1 2 2 6 total 0.024764 0.004638 -6 1 2 2 7 total 0.034288 0.008049 -7 1 2 2 8 total 0.040003 0.007350 -8 1 2 2 9 total 0.032383 0.003211 -9 1 2 2 10 total 0.050480 0.005824 -10 1 2 2 11 total 0.045718 0.013291 +0 1 2 2 1 total 0.037212 0.004892 +1 1 2 2 2 total 0.039224 0.003682 +2 1 2 2 3 total 0.044253 0.005869 +3 1 2 2 4 total 0.043247 0.004970 +4 1 2 2 5 total 0.025144 0.006632 +5 1 2 2 6 total 0.037212 0.009199 +6 1 2 2 7 total 0.035201 0.008964 +7 1 2 2 8 total 0.041235 0.009733 +8 1 2 2 9 total 0.032184 0.002384 +9 1 2 2 10 total 0.026149 0.006714 +10 1 2 2 11 total 0.035201 0.008073 material group in group out mu bin nuclide mean std. dev. -33 1 1 1 1 total 0.032861 0.003703 -34 1 1 1 2 total 0.026428 0.003637 -35 1 1 1 3 total 0.029210 0.001648 -36 1 1 1 4 total 0.032513 0.004770 -37 1 1 1 5 total 0.030949 0.003129 -38 1 1 1 6 total 0.027124 0.004029 -39 1 1 1 7 total 0.030079 0.002186 -40 1 1 1 8 total 0.037034 0.002198 -41 1 1 1 9 total 0.038251 0.003825 -42 1 1 1 10 total 0.039294 0.003626 -43 1 1 1 11 total 0.062593 0.005934 -22 1 1 2 1 total 0.000000 0.000000 -23 1 1 2 2 total 0.000174 0.000174 -24 1 1 2 3 total 0.000348 0.000213 +33 1 1 1 1 total 0.029945 0.003043 +34 1 1 1 2 total 0.028378 0.003793 +35 1 1 1 3 total 0.033079 0.002866 +36 1 1 1 4 total 0.030119 0.002259 +37 1 1 1 5 total 0.033601 0.003739 +38 1 1 1 6 total 0.035516 0.001929 +39 1 1 1 7 total 0.032382 0.001744 +40 1 1 1 8 total 0.031860 0.002565 +41 1 1 1 9 total 0.038302 0.004757 +42 1 1 1 10 total 0.041784 0.003047 +43 1 1 1 11 total 0.057453 0.003686 +22 1 1 2 1 total 0.000174 0.000174 +23 1 1 2 2 total 0.000000 0.000000 +24 1 1 2 3 total 0.000174 0.000174 25 1 1 2 4 total 0.000174 0.000174 26 1 1 2 5 total 0.000000 0.000000 27 1 1 2 6 total 0.000000 0.000000 @@ -77,33 +77,33 @@ 19 1 2 1 9 total 0.000000 0.000000 20 1 2 1 10 total 0.000000 0.000000 21 1 2 1 11 total 0.000000 0.000000 -0 1 2 2 1 total 0.032383 0.006826 -1 1 2 2 2 total 0.037146 0.001158 -2 1 2 2 3 total 0.036193 0.004463 -3 1 2 2 4 total 0.036193 0.007028 -4 1 2 2 5 total 0.038098 0.006769 -5 1 2 2 6 total 0.024764 0.004638 -6 1 2 2 7 total 0.034288 0.008049 -7 1 2 2 8 total 0.040003 0.007350 -8 1 2 2 9 total 0.032383 0.003211 -9 1 2 2 10 total 0.050480 0.005824 -10 1 2 2 11 total 0.045718 0.013291 +0 1 2 2 1 total 0.037212 0.004892 +1 1 2 2 2 total 0.039224 0.003682 +2 1 2 2 3 total 0.044253 0.005869 +3 1 2 2 4 total 0.043247 0.004970 +4 1 2 2 5 total 0.025144 0.006632 +5 1 2 2 6 total 0.037212 0.009199 +6 1 2 2 7 total 0.035201 0.008964 +7 1 2 2 8 total 0.041235 0.009733 +8 1 2 2 9 total 0.032184 0.002384 +9 1 2 2 10 total 0.026149 0.006714 +10 1 2 2 11 total 0.035201 0.008073 material group in group out mu bin nuclide mean std. dev. -33 1 1 1 1 total 0.032927 0.003848 -34 1 1 1 2 total 0.026481 0.003736 -35 1 1 1 3 total 0.029268 0.001884 -36 1 1 1 4 total 0.032578 0.004885 -37 1 1 1 5 total 0.031010 0.003280 -38 1 1 1 6 total 0.027177 0.004124 -39 1 1 1 7 total 0.030139 0.002382 -40 1 1 1 8 total 0.037108 0.002485 -41 1 1 1 9 total 0.038327 0.004013 -42 1 1 1 10 total 0.039372 0.003833 -43 1 1 1 11 total 0.062717 0.006256 -22 1 1 2 1 total 0.000000 0.000000 -23 1 1 2 2 total 0.000174 0.000174 -24 1 1 2 3 total 0.000348 0.000214 -25 1 1 2 4 total 0.000174 0.000174 +33 1 1 1 1 total 0.030147 0.003165 +34 1 1 1 2 total 0.028570 0.003893 +35 1 1 1 3 total 0.033302 0.003016 +36 1 1 1 4 total 0.030322 0.002411 +37 1 1 1 5 total 0.033828 0.003868 +38 1 1 1 6 total 0.035756 0.002159 +39 1 1 1 7 total 0.032601 0.001955 +40 1 1 1 8 total 0.032075 0.002718 +41 1 1 1 9 total 0.038560 0.004896 +42 1 1 1 10 total 0.042066 0.003262 +43 1 1 1 11 total 0.057840 0.004013 +22 1 1 2 1 total 0.000175 0.000175 +23 1 1 2 2 total 0.000000 0.000000 +24 1 1 2 3 total 0.000175 0.000175 +25 1 1 2 4 total 0.000175 0.000175 26 1 1 2 5 total 0.000000 0.000000 27 1 1 2 6 total 0.000000 0.000000 28 1 1 2 7 total 0.000000 0.000000 @@ -122,33 +122,33 @@ 19 1 2 1 9 total 0.000000 0.000000 20 1 2 1 10 total 0.000000 0.000000 21 1 2 1 11 total 0.000000 0.000000 -0 1 2 2 1 total 0.031440 0.006860 -1 1 2 2 2 total 0.036063 0.002322 -2 1 2 2 3 total 0.035138 0.004763 -3 1 2 2 4 total 0.035138 0.007105 -4 1 2 2 5 total 0.036988 0.006894 -5 1 2 2 6 total 0.024042 0.004702 -6 1 2 2 7 total 0.033289 0.008036 -7 1 2 2 8 total 0.038837 0.007464 -8 1 2 2 9 total 0.031440 0.003585 -9 1 2 2 10 total 0.049009 0.006292 -10 1 2 2 11 total 0.044385 0.013144 +0 1 2 2 1 total 0.037164 0.005797 +1 1 2 2 2 total 0.039173 0.004933 +2 1 2 2 3 total 0.044195 0.006937 +3 1 2 2 4 total 0.043191 0.006147 +4 1 2 2 5 total 0.025111 0.006951 +5 1 2 2 6 total 0.037164 0.009702 +6 1 2 2 7 total 0.035155 0.009426 +7 1 2 2 8 total 0.041182 0.010317 +8 1 2 2 9 total 0.032142 0.003598 +9 1 2 2 10 total 0.026115 0.007055 +10 1 2 2 11 total 0.035155 0.008586 material group in group out mu bin nuclide mean std. dev. -33 1 1 1 1 total 0.032927 0.004236 -34 1 1 1 2 total 0.026481 0.003998 -35 1 1 1 3 total 0.029268 0.002455 -36 1 1 1 4 total 0.032578 0.005190 -37 1 1 1 5 total 0.031010 0.003679 -38 1 1 1 6 total 0.027177 0.004376 -39 1 1 1 7 total 0.030139 0.002881 -40 1 1 1 8 total 0.037108 0.003187 -41 1 1 1 9 total 0.038327 0.004511 -42 1 1 1 10 total 0.039372 0.004379 -43 1 1 1 11 total 0.062717 0.007108 -22 1 1 2 1 total 0.000000 0.000000 -23 1 1 2 2 total 0.000174 0.000209 -24 1 1 2 3 total 0.000348 0.000315 -25 1 1 2 4 total 0.000174 0.000209 +33 1 1 1 1 total 0.030147 0.003454 +34 1 1 1 2 total 0.028570 0.004107 +35 1 1 1 3 total 0.033302 0.003381 +36 1 1 1 4 total 0.030322 0.002783 +37 1 1 1 5 total 0.033828 0.004168 +38 1 1 1 6 total 0.035756 0.002711 +39 1 1 1 7 total 0.032601 0.002461 +40 1 1 1 8 total 0.032075 0.003090 +41 1 1 1 9 total 0.038560 0.005205 +42 1 1 1 10 total 0.042066 0.003790 +43 1 1 1 11 total 0.057840 0.004811 +22 1 1 2 1 total 0.000175 0.000234 +23 1 1 2 2 total 0.000000 0.000000 +24 1 1 2 3 total 0.000175 0.000234 +25 1 1 2 4 total 0.000175 0.000234 26 1 1 2 5 total 0.000000 0.000000 27 1 1 2 6 total 0.000000 0.000000 28 1 1 2 7 total 0.000000 0.000000 @@ -167,29 +167,29 @@ 19 1 2 1 9 total 0.000000 0.000000 20 1 2 1 10 total 0.000000 0.000000 21 1 2 1 11 total 0.000000 0.000000 -0 1 2 2 1 total 0.031440 0.007170 -1 1 2 2 2 total 0.036063 0.003334 -2 1 2 2 3 total 0.035138 0.005303 -3 1 2 2 4 total 0.035138 0.007478 -4 1 2 2 5 total 0.036988 0.007318 -5 1 2 2 6 total 0.024042 0.004965 -6 1 2 2 7 total 0.033289 0.008334 -7 1 2 2 8 total 0.038837 0.007896 -8 1 2 2 9 total 0.031440 0.004148 -9 1 2 2 10 total 0.049009 0.007083 -10 1 2 2 11 total 0.044385 0.013469 +0 1 2 2 1 total 0.037164 0.006511 +1 1 2 2 2 total 0.039173 0.005840 +2 1 2 2 3 total 0.044195 0.007782 +3 1 2 2 4 total 0.043191 0.007047 +4 1 2 2 5 total 0.025111 0.007234 +5 1 2 2 6 total 0.037164 0.010146 +6 1 2 2 7 total 0.035155 0.009835 +7 1 2 2 8 total 0.041182 0.010828 +8 1 2 2 9 total 0.032142 0.004419 +9 1 2 2 10 total 0.026115 0.007356 +10 1 2 2 11 total 0.035155 0.009032 material group in group out mu bin nuclide mean std. dev. -33 2 1 1 1 total 0.026798 0.002892 -34 2 1 1 2 total 0.021339 0.003475 -35 2 1 1 3 total 0.021835 0.003963 -36 2 1 1 4 total 0.018361 0.006133 -37 2 1 1 5 total 0.023820 0.003932 -38 2 1 1 6 total 0.025805 0.003808 -39 2 1 1 7 total 0.026798 0.002299 -40 2 1 1 8 total 0.029279 0.003939 -41 2 1 1 9 total 0.034738 0.004323 -42 2 1 1 10 total 0.032753 0.006086 -43 2 1 1 11 total 0.057069 0.003798 +33 2 1 1 1 total 0.025373 0.004281 +34 2 1 1 2 total 0.023909 0.004395 +35 2 1 1 3 total 0.019518 0.003911 +36 2 1 1 4 total 0.019518 0.003424 +37 2 1 1 5 total 0.020006 0.002901 +38 2 1 1 6 total 0.024885 0.005801 +39 2 1 1 7 total 0.019030 0.002566 +40 2 1 1 8 total 0.030741 0.001410 +41 2 1 1 9 total 0.034156 0.002902 +42 2 1 1 10 total 0.042939 0.004498 +43 2 1 1 11 total 0.054650 0.003865 22 2 1 2 1 total 0.000000 0.000000 23 2 1 2 2 total 0.000000 0.000000 24 2 1 2 3 total 0.000000 0.000000 @@ -212,29 +212,29 @@ 19 2 2 1 9 total 0.000000 0.000000 20 2 2 1 10 total 0.000000 0.000000 21 2 2 1 11 total 0.000000 0.000000 -0 2 2 2 1 total 0.032254 0.009449 -1 2 2 2 2 total 0.018815 0.005569 -2 2 2 2 3 total 0.032254 0.009449 -3 2 2 2 4 total 0.024191 0.006844 -4 2 2 2 5 total 0.013439 0.008563 -5 2 2 2 6 total 0.024191 0.005365 -6 2 2 2 7 total 0.043005 0.010420 -7 2 2 2 8 total 0.032254 0.012710 -8 2 2 2 9 total 0.034942 0.007365 -9 2 2 2 10 total 0.021503 0.007051 -10 2 2 2 11 total 0.018815 0.008193 +0 2 2 2 1 total 0.026892 0.012233 +1 2 2 2 2 total 0.034959 0.007449 +2 2 2 2 3 total 0.040337 0.009144 +3 2 2 2 4 total 0.021513 0.003750 +4 2 2 2 5 total 0.018824 0.005602 +5 2 2 2 6 total 0.026892 0.004806 +6 2 2 2 7 total 0.037648 0.012716 +7 2 2 2 8 total 0.026892 0.009768 +8 2 2 2 9 total 0.024202 0.005420 +9 2 2 2 10 total 0.018824 0.010183 +10 2 2 2 11 total 0.018824 0.007033 material group in group out mu bin nuclide mean std. dev. -33 2 1 1 1 total 0.026798 0.002892 -34 2 1 1 2 total 0.021339 0.003475 -35 2 1 1 3 total 0.021835 0.003963 -36 2 1 1 4 total 0.018361 0.006133 -37 2 1 1 5 total 0.023820 0.003932 -38 2 1 1 6 total 0.025805 0.003808 -39 2 1 1 7 total 0.026798 0.002299 -40 2 1 1 8 total 0.029279 0.003939 -41 2 1 1 9 total 0.034738 0.004323 -42 2 1 1 10 total 0.032753 0.006086 -43 2 1 1 11 total 0.057069 0.003798 +33 2 1 1 1 total 0.025373 0.004281 +34 2 1 1 2 total 0.023909 0.004395 +35 2 1 1 3 total 0.019518 0.003911 +36 2 1 1 4 total 0.019518 0.003424 +37 2 1 1 5 total 0.020006 0.002901 +38 2 1 1 6 total 0.024885 0.005801 +39 2 1 1 7 total 0.019030 0.002566 +40 2 1 1 8 total 0.030741 0.001410 +41 2 1 1 9 total 0.034156 0.002902 +42 2 1 1 10 total 0.042939 0.004498 +43 2 1 1 11 total 0.054650 0.003865 22 2 1 2 1 total 0.000000 0.000000 23 2 1 2 2 total 0.000000 0.000000 24 2 1 2 3 total 0.000000 0.000000 @@ -257,29 +257,29 @@ 19 2 2 1 9 total 0.000000 0.000000 20 2 2 1 10 total 0.000000 0.000000 21 2 2 1 11 total 0.000000 0.000000 -0 2 2 2 1 total 0.032254 0.009449 -1 2 2 2 2 total 0.018815 0.005569 -2 2 2 2 3 total 0.032254 0.009449 -3 2 2 2 4 total 0.024191 0.006844 -4 2 2 2 5 total 0.013439 0.008563 -5 2 2 2 6 total 0.024191 0.005365 -6 2 2 2 7 total 0.043005 0.010420 -7 2 2 2 8 total 0.032254 0.012710 -8 2 2 2 9 total 0.034942 0.007365 -9 2 2 2 10 total 0.021503 0.007051 -10 2 2 2 11 total 0.018815 0.008193 +0 2 2 2 1 total 0.026892 0.012233 +1 2 2 2 2 total 0.034959 0.007449 +2 2 2 2 3 total 0.040337 0.009144 +3 2 2 2 4 total 0.021513 0.003750 +4 2 2 2 5 total 0.018824 0.005602 +5 2 2 2 6 total 0.026892 0.004806 +6 2 2 2 7 total 0.037648 0.012716 +7 2 2 2 8 total 0.026892 0.009768 +8 2 2 2 9 total 0.024202 0.005420 +9 2 2 2 10 total 0.018824 0.010183 +10 2 2 2 11 total 0.018824 0.007033 material group in group out mu bin nuclide mean std. dev. -33 2 1 1 1 total 0.026249 0.003012 -34 2 1 1 2 total 0.020902 0.003500 -35 2 1 1 3 total 0.021388 0.003971 -36 2 1 1 4 total 0.017986 0.006048 -37 2 1 1 5 total 0.023333 0.003958 -38 2 1 1 6 total 0.025277 0.003858 -39 2 1 1 7 total 0.026249 0.002473 -40 2 1 1 8 total 0.028680 0.004017 -41 2 1 1 9 total 0.034027 0.004437 -42 2 1 1 10 total 0.032082 0.006091 -43 2 1 1 11 total 0.055901 0.004311 +33 2 1 1 1 total 0.025753 0.004484 +34 2 1 1 2 total 0.024267 0.004581 +35 2 1 1 3 total 0.019810 0.004060 +36 2 1 1 4 total 0.019810 0.003579 +37 2 1 1 5 total 0.020305 0.003071 +38 2 1 1 6 total 0.025258 0.005987 +39 2 1 1 7 total 0.019315 0.002734 +40 2 1 1 8 total 0.031201 0.001961 +41 2 1 1 9 total 0.034668 0.003301 +42 2 1 1 10 total 0.043582 0.004935 +43 2 1 1 11 total 0.055468 0.004591 22 2 1 2 1 total 0.000000 0.000000 23 2 1 2 2 total 0.000000 0.000000 24 2 1 2 3 total 0.000000 0.000000 @@ -302,29 +302,29 @@ 19 2 2 1 9 total 0.000000 0.000000 20 2 2 1 10 total 0.000000 0.000000 21 2 2 1 11 total 0.000000 0.000000 -0 2 2 2 1 total 0.032230 0.009604 -1 2 2 2 2 total 0.018801 0.005658 -2 2 2 2 3 total 0.032230 0.009604 -3 2 2 2 4 total 0.024172 0.006964 -4 2 2 2 5 total 0.013429 0.008588 -5 2 2 2 6 total 0.024172 0.005520 -6 2 2 2 7 total 0.042973 0.010671 -7 2 2 2 8 total 0.032230 0.012821 -8 2 2 2 9 total 0.034915 0.007601 -9 2 2 2 10 total 0.021486 0.007142 -10 2 2 2 11 total 0.018801 0.008251 +0 2 2 2 1 total 0.026854 0.012543 +1 2 2 2 2 total 0.034911 0.008307 +2 2 2 2 3 total 0.040281 0.010079 +3 2 2 2 4 total 0.021483 0.004382 +4 2 2 2 5 total 0.018798 0.005938 +5 2 2 2 6 total 0.026854 0.005579 +6 2 2 2 7 total 0.037596 0.013308 +7 2 2 2 8 total 0.026854 0.010161 +8 2 2 2 9 total 0.024169 0.005987 +9 2 2 2 10 total 0.018798 0.010362 +10 2 2 2 11 total 0.018798 0.007300 material group in group out mu bin nuclide mean std. dev. -33 2 1 1 1 total 0.026249 0.003460 -34 2 1 1 2 total 0.020902 0.003754 -35 2 1 1 3 total 0.021388 0.004206 -36 2 1 1 4 total 0.017986 0.006160 -37 2 1 1 5 total 0.023333 0.004238 -38 2 1 1 6 total 0.025277 0.004192 -39 2 1 1 7 total 0.026249 0.003003 -40 2 1 1 8 total 0.028680 0.004427 -41 2 1 1 9 total 0.034027 0.004956 -42 2 1 1 10 total 0.032082 0.006437 -43 2 1 1 11 total 0.055901 0.005636 +33 2 1 1 1 total 0.025753 0.004661 +34 2 1 1 2 total 0.024267 0.004736 +35 2 1 1 3 total 0.019810 0.004177 +36 2 1 1 4 total 0.019810 0.003711 +37 2 1 1 5 total 0.020305 0.003231 +38 2 1 1 6 total 0.025258 0.006117 +39 2 1 1 7 total 0.019315 0.002897 +40 2 1 1 8 total 0.031201 0.002497 +41 2 1 1 9 total 0.034668 0.003721 +42 2 1 1 10 total 0.043582 0.005386 +43 2 1 1 11 total 0.055468 0.005350 22 2 1 2 1 total 0.000000 0.000000 23 2 1 2 2 total 0.000000 0.000000 24 2 1 2 3 total 0.000000 0.000000 @@ -347,40 +347,40 @@ 19 2 2 1 9 total 0.000000 0.000000 20 2 2 1 10 total 0.000000 0.000000 21 2 2 1 11 total 0.000000 0.000000 -0 2 2 2 1 total 0.032230 0.010330 -1 2 2 2 2 total 0.018801 0.006077 -2 2 2 2 3 total 0.032230 0.010330 -3 2 2 2 4 total 0.024172 0.007526 -4 2 2 2 5 total 0.013429 0.008733 -5 2 2 2 6 total 0.024172 0.006213 -6 2 2 2 7 total 0.042973 0.011815 -7 2 2 2 8 total 0.032230 0.013373 -8 2 2 2 9 total 0.034915 0.008646 -9 2 2 2 10 total 0.021486 0.007579 -10 2 2 2 11 total 0.018801 0.008544 +0 2 2 2 1 total 0.026854 0.013054 +1 2 2 2 2 total 0.034911 0.009546 +2 2 2 2 3 total 0.040281 0.011446 +3 2 2 2 4 total 0.021483 0.005251 +4 2 2 2 5 total 0.018798 0.006456 +5 2 2 2 6 total 0.026854 0.006649 +6 2 2 2 7 total 0.037596 0.014239 +7 2 2 2 8 total 0.026854 0.010785 +8 2 2 2 9 total 0.024169 0.006815 +9 2 2 2 10 total 0.018798 0.010667 +10 2 2 2 11 total 0.018798 0.007727 material group in group out mu bin nuclide mean std. dev. -33 3 1 1 1 total 0.007006 0.000692 -34 3 1 1 2 total 0.006819 0.000431 -35 3 1 1 3 total 0.005511 0.000591 -36 3 1 1 4 total 0.006165 0.000470 -37 3 1 1 5 total 0.007660 0.000919 -38 3 1 1 6 total 0.012237 0.000938 -39 3 1 1 7 total 0.040914 0.002235 -40 3 1 1 8 total 0.074356 0.001968 -41 3 1 1 9 total 0.121622 0.004662 -42 3 1 1 10 total 0.158707 0.004147 -43 3 1 1 11 total 0.200742 0.007791 -22 3 1 2 1 total 0.000187 0.000187 -23 3 1 2 2 total 0.001028 0.000096 -24 3 1 2 3 total 0.000841 0.000176 -25 3 1 2 4 total 0.000841 0.000310 -26 3 1 2 5 total 0.001308 0.000274 -27 3 1 2 6 total 0.003736 0.000538 -28 3 1 2 7 total 0.003830 0.000703 -29 3 1 2 8 total 0.006259 0.000452 -30 3 1 2 9 total 0.005231 0.000510 -31 3 1 2 10 total 0.005044 0.000440 -32 3 1 2 11 total 0.002522 0.000194 +33 3 1 1 1 total 0.007681 0.001043 +34 3 1 1 2 total 0.005645 0.000710 +35 3 1 1 3 total 0.007403 0.000552 +36 3 1 1 4 total 0.007866 0.000512 +37 3 1 1 5 total 0.007589 0.000524 +38 3 1 1 6 total 0.011198 0.001548 +39 3 1 1 7 total 0.039701 0.002533 +40 3 1 1 8 total 0.075978 0.001897 +41 3 1 1 9 total 0.112532 0.003677 +42 3 1 1 10 total 0.166670 0.005003 +43 3 1 1 11 total 0.210443 0.005656 +22 3 1 2 1 total 0.000463 0.000207 +23 3 1 2 2 total 0.000555 0.000227 +24 3 1 2 3 total 0.000740 0.000429 +25 3 1 2 4 total 0.001111 0.000236 +26 3 1 2 5 total 0.002128 0.000631 +27 3 1 2 6 total 0.003146 0.000645 +28 3 1 2 7 total 0.004905 0.000561 +29 3 1 2 8 total 0.005738 0.000742 +30 3 1 2 9 total 0.005090 0.000672 +31 3 1 2 10 total 0.005367 0.000561 +32 3 1 2 11 total 0.002406 0.000593 11 3 2 1 1 total 0.000000 0.000000 12 3 2 1 2 total 0.000000 0.000000 13 3 2 1 3 total 0.000000 0.000000 @@ -390,42 +390,42 @@ 17 3 2 1 7 total 0.000000 0.000000 18 3 2 1 8 total 0.000000 0.000000 19 3 2 1 9 total 0.000000 0.000000 -20 3 2 1 10 total 0.000467 0.000467 -21 3 2 1 11 total 0.000000 0.000000 -0 3 2 2 1 total 0.084030 0.007630 -1 3 2 2 2 total 0.099902 0.010027 -2 3 2 2 3 total 0.112040 0.010928 -3 3 2 2 4 total 0.117642 0.008523 -4 3 2 2 5 total 0.139116 0.009002 -5 3 2 2 6 total 0.161057 0.013537 -6 3 2 2 7 total 0.180664 0.010135 -7 3 2 2 8 total 0.219411 0.014717 -8 3 2 2 9 total 0.239485 0.027005 -9 3 2 2 10 total 0.281033 0.021376 -10 3 2 2 11 total 0.369731 0.027200 +20 3 2 1 10 total 0.000000 0.000000 +21 3 2 1 11 total 0.000474 0.000475 +0 3 2 2 1 total 0.074402 0.007811 +1 3 2 2 2 total 0.103783 0.009042 +2 3 2 2 3 total 0.106153 0.012691 +3 3 2 2 4 total 0.115631 0.011475 +4 3 2 2 5 total 0.128900 0.014096 +5 3 2 2 6 total 0.169655 0.021010 +6 3 2 2 7 total 0.175816 0.016086 +7 3 2 2 8 total 0.217519 0.029631 +8 3 2 2 9 total 0.247374 0.021476 +9 3 2 2 10 total 0.299977 0.031756 +10 3 2 2 11 total 0.351157 0.027654 material group in group out mu bin nuclide mean std. dev. -33 3 1 1 1 total 0.007006 0.000692 -34 3 1 1 2 total 0.006819 0.000431 -35 3 1 1 3 total 0.005511 0.000591 -36 3 1 1 4 total 0.006165 0.000470 -37 3 1 1 5 total 0.007660 0.000919 -38 3 1 1 6 total 0.012237 0.000938 -39 3 1 1 7 total 0.040914 0.002235 -40 3 1 1 8 total 0.074356 0.001968 -41 3 1 1 9 total 0.121622 0.004662 -42 3 1 1 10 total 0.158707 0.004147 -43 3 1 1 11 total 0.200742 0.007791 -22 3 1 2 1 total 0.000187 0.000187 -23 3 1 2 2 total 0.001028 0.000096 -24 3 1 2 3 total 0.000841 0.000176 -25 3 1 2 4 total 0.000841 0.000310 -26 3 1 2 5 total 0.001308 0.000274 -27 3 1 2 6 total 0.003736 0.000538 -28 3 1 2 7 total 0.003830 0.000703 -29 3 1 2 8 total 0.006259 0.000452 -30 3 1 2 9 total 0.005231 0.000510 -31 3 1 2 10 total 0.005044 0.000440 -32 3 1 2 11 total 0.002522 0.000194 +33 3 1 1 1 total 0.007681 0.001043 +34 3 1 1 2 total 0.005645 0.000710 +35 3 1 1 3 total 0.007403 0.000552 +36 3 1 1 4 total 0.007866 0.000512 +37 3 1 1 5 total 0.007589 0.000524 +38 3 1 1 6 total 0.011198 0.001548 +39 3 1 1 7 total 0.039701 0.002533 +40 3 1 1 8 total 0.075978 0.001897 +41 3 1 1 9 total 0.112532 0.003677 +42 3 1 1 10 total 0.166670 0.005003 +43 3 1 1 11 total 0.210443 0.005656 +22 3 1 2 1 total 0.000463 0.000207 +23 3 1 2 2 total 0.000555 0.000227 +24 3 1 2 3 total 0.000740 0.000429 +25 3 1 2 4 total 0.001111 0.000236 +26 3 1 2 5 total 0.002128 0.000631 +27 3 1 2 6 total 0.003146 0.000645 +28 3 1 2 7 total 0.004905 0.000561 +29 3 1 2 8 total 0.005738 0.000742 +30 3 1 2 9 total 0.005090 0.000672 +31 3 1 2 10 total 0.005367 0.000561 +32 3 1 2 11 total 0.002406 0.000593 11 3 2 1 1 total 0.000000 0.000000 12 3 2 1 2 total 0.000000 0.000000 13 3 2 1 3 total 0.000000 0.000000 @@ -435,42 +435,42 @@ 17 3 2 1 7 total 0.000000 0.000000 18 3 2 1 8 total 0.000000 0.000000 19 3 2 1 9 total 0.000000 0.000000 -20 3 2 1 10 total 0.000467 0.000467 -21 3 2 1 11 total 0.000000 0.000000 -0 3 2 2 1 total 0.084030 0.007630 -1 3 2 2 2 total 0.099902 0.010027 -2 3 2 2 3 total 0.112040 0.010928 -3 3 2 2 4 total 0.117642 0.008523 -4 3 2 2 5 total 0.139116 0.009002 -5 3 2 2 6 total 0.161057 0.013537 -6 3 2 2 7 total 0.180664 0.010135 -7 3 2 2 8 total 0.219411 0.014717 -8 3 2 2 9 total 0.239485 0.027005 -9 3 2 2 10 total 0.281033 0.021376 -10 3 2 2 11 total 0.369731 0.027200 +20 3 2 1 10 total 0.000000 0.000000 +21 3 2 1 11 total 0.000474 0.000475 +0 3 2 2 1 total 0.074402 0.007811 +1 3 2 2 2 total 0.103783 0.009042 +2 3 2 2 3 total 0.106153 0.012691 +3 3 2 2 4 total 0.115631 0.011475 +4 3 2 2 5 total 0.128900 0.014096 +5 3 2 2 6 total 0.169655 0.021010 +6 3 2 2 7 total 0.175816 0.016086 +7 3 2 2 8 total 0.217519 0.029631 +8 3 2 2 9 total 0.247374 0.021476 +9 3 2 2 10 total 0.299977 0.031756 +10 3 2 2 11 total 0.351157 0.027654 material group in group out mu bin nuclide mean std. dev. -33 3 1 1 1 total 0.007106 0.000737 -34 3 1 1 2 total 0.006917 0.000488 -35 3 1 1 3 total 0.005590 0.000624 -36 3 1 1 4 total 0.006254 0.000516 -37 3 1 1 5 total 0.007770 0.000964 -38 3 1 1 6 total 0.012412 0.001029 -39 3 1 1 7 total 0.041501 0.002618 -40 3 1 1 8 total 0.075421 0.003106 -41 3 1 1 9 total 0.123365 0.006125 -42 3 1 1 10 total 0.160981 0.006595 -43 3 1 1 11 total 0.203618 0.010185 -22 3 1 2 1 total 0.000190 0.000190 -23 3 1 2 2 total 0.001042 0.000103 -24 3 1 2 3 total 0.000853 0.000180 -25 3 1 2 4 total 0.000853 0.000316 -26 3 1 2 5 total 0.001327 0.000281 -27 3 1 2 6 total 0.003790 0.000559 -28 3 1 2 7 total 0.003885 0.000724 -29 3 1 2 8 total 0.006348 0.000500 -30 3 1 2 9 total 0.005306 0.000544 -31 3 1 2 10 total 0.005117 0.000475 -32 3 1 2 11 total 0.002558 0.000213 +33 3 1 1 1 total 0.007759 0.001080 +34 3 1 1 2 total 0.005703 0.000738 +35 3 1 1 3 total 0.007479 0.000602 +36 3 1 1 4 total 0.007946 0.000571 +37 3 1 1 5 total 0.007666 0.000578 +38 3 1 1 6 total 0.011312 0.001601 +39 3 1 1 7 total 0.040106 0.002833 +40 3 1 1 8 total 0.076753 0.003016 +41 3 1 1 9 total 0.113680 0.005068 +42 3 1 1 10 total 0.168370 0.007185 +43 3 1 1 11 total 0.212589 0.008616 +22 3 1 2 1 total 0.000467 0.000210 +23 3 1 2 2 total 0.000561 0.000230 +24 3 1 2 3 total 0.000748 0.000434 +25 3 1 2 4 total 0.001122 0.000241 +26 3 1 2 5 total 0.002150 0.000641 +27 3 1 2 6 total 0.003179 0.000659 +28 3 1 2 7 total 0.004955 0.000586 +29 3 1 2 8 total 0.005796 0.000770 +30 3 1 2 9 total 0.005142 0.000697 +31 3 1 2 10 total 0.005422 0.000590 +32 3 1 2 11 total 0.002431 0.000604 11 3 2 1 1 total 0.000000 0.000000 12 3 2 1 2 total 0.000000 0.000000 13 3 2 1 3 total 0.000000 0.000000 @@ -480,42 +480,42 @@ 17 3 2 1 7 total 0.000000 0.000000 18 3 2 1 8 total 0.000000 0.000000 19 3 2 1 9 total 0.000000 0.000000 -20 3 2 1 10 total 0.000466 0.000467 -21 3 2 1 11 total 0.000000 0.000000 -0 3 2 2 1 total 0.083912 0.007782 -1 3 2 2 2 total 0.099762 0.010188 -2 3 2 2 3 total 0.111883 0.011115 -3 3 2 2 4 total 0.117477 0.008794 -4 3 2 2 5 total 0.138921 0.009363 -5 3 2 2 6 total 0.160831 0.013853 -6 3 2 2 7 total 0.180411 0.010676 -7 3 2 2 8 total 0.219104 0.015265 -8 3 2 2 9 total 0.239149 0.027341 -9 3 2 2 10 total 0.280639 0.021991 -10 3 2 2 11 total 0.369213 0.028038 +20 3 2 1 10 total 0.000000 0.000000 +21 3 2 1 11 total 0.000477 0.000479 +0 3 2 2 1 total 0.074833 0.009685 +1 3 2 2 2 total 0.104384 0.012046 +2 3 2 2 3 total 0.106768 0.015107 +3 3 2 2 4 total 0.116300 0.014515 +4 3 2 2 5 total 0.129646 0.017242 +5 3 2 2 6 total 0.170637 0.024765 +6 3 2 2 7 total 0.176834 0.020997 +7 3 2 2 8 total 0.218778 0.034093 +8 3 2 2 9 total 0.248807 0.028656 +9 3 2 2 10 total 0.301714 0.039263 +10 3 2 2 11 total 0.353191 0.038577 material group in group out mu bin nuclide mean std. dev. -33 3 1 1 1 total 0.007106 0.000751 -34 3 1 1 2 total 0.006917 0.000509 -35 3 1 1 3 total 0.005590 0.000635 -36 3 1 1 4 total 0.006254 0.000532 -37 3 1 1 5 total 0.007770 0.000977 -38 3 1 1 6 total 0.012412 0.001060 -39 3 1 1 7 total 0.041501 0.002755 -40 3 1 1 8 total 0.075421 0.003475 -41 3 1 1 9 total 0.123365 0.006634 -42 3 1 1 10 total 0.160981 0.007387 -43 3 1 1 11 total 0.203618 0.011019 -22 3 1 2 1 total 0.000190 0.000190 -23 3 1 2 2 total 0.001042 0.000114 -24 3 1 2 3 total 0.000853 0.000185 -25 3 1 2 4 total 0.000853 0.000319 -26 3 1 2 5 total 0.001327 0.000288 -27 3 1 2 6 total 0.003790 0.000588 -28 3 1 2 7 total 0.003885 0.000748 -29 3 1 2 8 total 0.006348 0.000587 -30 3 1 2 9 total 0.005306 0.000601 -31 3 1 2 10 total 0.005117 0.000535 -32 3 1 2 11 total 0.002558 0.000246 +33 3 1 1 1 total 0.007759 0.001091 +34 3 1 1 2 total 0.005703 0.000746 +35 3 1 1 3 total 0.007479 0.000619 +36 3 1 1 4 total 0.007946 0.000592 +37 3 1 1 5 total 0.007666 0.000598 +38 3 1 1 6 total 0.011312 0.001616 +39 3 1 1 7 total 0.040106 0.002941 +40 3 1 1 8 total 0.076753 0.003373 +41 3 1 1 9 total 0.113680 0.005540 +42 3 1 1 10 total 0.168370 0.007913 +43 3 1 1 11 total 0.212589 0.009578 +22 3 1 2 1 total 0.000467 0.000211 +23 3 1 2 2 total 0.000561 0.000232 +24 3 1 2 3 total 0.000748 0.000436 +25 3 1 2 4 total 0.001122 0.000250 +26 3 1 2 5 total 0.002150 0.000653 +27 3 1 2 6 total 0.003179 0.000684 +28 3 1 2 7 total 0.004955 0.000654 +29 3 1 2 8 total 0.005796 0.000841 +30 3 1 2 9 total 0.005142 0.000759 +31 3 1 2 10 total 0.005422 0.000670 +32 3 1 2 11 total 0.002431 0.000620 11 3 2 1 1 total 0.000000 0.000000 12 3 2 1 2 total 0.000000 0.000000 13 3 2 1 3 total 0.000000 0.000000 @@ -525,16 +525,16 @@ 17 3 2 1 7 total 0.000000 0.000000 18 3 2 1 8 total 0.000000 0.000000 19 3 2 1 9 total 0.000000 0.000000 -20 3 2 1 10 total 0.000466 0.000808 -21 3 2 1 11 total 0.000000 0.000000 -0 3 2 2 1 total 0.083912 0.008936 -1 3 2 2 2 total 0.099762 0.011448 -2 3 2 2 3 total 0.111883 0.012563 -3 3 2 2 4 total 0.117477 0.010731 -4 3 2 2 5 total 0.138921 0.011855 -5 3 2 2 6 total 0.160831 0.016211 -6 3 2 2 7 total 0.180411 0.014254 -7 3 2 2 8 total 0.219104 0.019093 -8 3 2 2 9 total 0.239149 0.030071 -9 3 2 2 10 total 0.280639 0.026447 -10 3 2 2 11 total 0.369213 0.034054 +20 3 2 1 10 total 0.000000 0.000000 +21 3 2 1 11 total 0.000477 0.000827 +0 3 2 2 1 total 0.074833 0.011051 +1 3 2 2 2 total 0.104384 0.014150 +2 3 2 2 3 total 0.106768 0.016908 +3 3 2 2 4 total 0.116300 0.016707 +4 3 2 2 5 total 0.129646 0.019553 +5 3 2 2 6 total 0.170637 0.027579 +6 3 2 2 7 total 0.176834 0.024476 +7 3 2 2 8 total 0.218778 0.037476 +8 3 2 2 9 total 0.248807 0.033680 +9 3 2 2 10 total 0.301714 0.044745 +10 3 2 2 11 total 0.353191 0.046035 diff --git a/tests/regression_tests/mgxs_library_histogram/test.py b/tests/regression_tests/mgxs_library_histogram/test.py index b9905910a..42fc1957a 100644 --- a/tests/regression_tests/mgxs_library_histogram/test.py +++ b/tests/regression_tests/mgxs_library_histogram/test.py @@ -30,7 +30,7 @@ class MGXSTestHarness(PyAPITestHarness): self.mgxs_lib.build_library() # Add tallies - self.mgxs_lib.add_to_tallies_file(self._model.tallies, merge=False) + self.mgxs_lib.add_to_tallies(self._model.tallies, merge=False) def _get_results(self, hash_output=False): """Digest info in the statepoint and return as a string.""" diff --git a/tests/regression_tests/mgxs_library_mesh/inputs_true.dat b/tests/regression_tests/mgxs_library_mesh/inputs_true.dat index 1ecb7a2d3..5a6e8a20a 100644 --- a/tests/regression_tests/mgxs_library_mesh/inputs_true.dat +++ b/tests/regression_tests/mgxs_library_mesh/inputs_true.dat @@ -1,28 +1,28 @@ - - - + + + - - + + - - - - - - - - - - + + + + + + + + + + eigenvalue diff --git a/tests/regression_tests/mgxs_library_mesh/results_true.dat b/tests/regression_tests/mgxs_library_mesh/results_true.dat index b1e8ac003..16b86870d 100644 --- a/tests/regression_tests/mgxs_library_mesh/results_true.dat +++ b/tests/regression_tests/mgxs_library_mesh/results_true.dat @@ -1,362 +1,362 @@ mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 0.102539 0.004894 -2 1 2 1 1 total 0.106476 0.007513 -1 2 1 1 1 total 0.101207 0.004814 -3 2 2 1 1 total 0.101733 0.004445 +0 1 1 1 1 total 0.103374 0.004981 +2 1 2 1 1 total 0.103852 0.004752 +1 2 1 1 1 total 0.103322 0.003613 +3 2 2 1 1 total 0.102889 0.003387 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 0.073423 0.005232 -2 1 2 1 1 total 0.077906 0.007749 -1 2 1 1 1 total 0.071315 0.005181 -3 2 2 1 1 total 0.071983 0.004856 +0 1 1 1 1 total 0.072760 0.005235 +2 1 2 1 1 total 0.074856 0.004972 +1 2 1 1 1 total 0.074583 0.004000 +3 2 2 1 1 total 0.072925 0.003485 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 0.073443 0.005235 -2 1 2 1 1 total 0.077909 0.007749 -1 2 1 1 1 total 0.071315 0.005181 -3 2 2 1 1 total 0.071928 0.004865 +0 1 1 1 1 total 0.072768 0.005236 +2 1 2 1 1 total 0.074864 0.004972 +1 2 1 1 1 total 0.074603 0.004002 +3 2 2 1 1 total 0.072881 0.003491 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 0.013089 0.000762 -2 1 2 1 1 total 0.013802 0.000950 -1 2 1 1 1 total 0.012818 0.000708 -3 2 2 1 1 total 0.012954 0.000699 +0 1 1 1 1 total 0.013309 0.000729 +2 1 2 1 1 total 0.013223 0.000707 +1 2 1 1 1 total 0.013222 0.000596 +3 2 2 1 1 total 0.013282 0.000564 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 0.013016 0.000761 -2 1 2 1 1 total 0.013715 0.000947 -1 2 1 1 1 total 0.012740 0.000707 -3 2 2 1 1 total 0.012886 0.000698 +0 1 1 1 1 total 0.013241 0.000728 +2 1 2 1 1 total 0.013142 0.000705 +1 2 1 1 1 total 0.013137 0.000596 +3 2 2 1 1 total 0.013221 0.000564 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 0.001244 0.000926 -2 1 2 1 1 total 0.001345 0.000851 -1 2 1 1 1 total 0.001196 0.000768 -3 2 2 1 1 total 0.001234 0.000843 +0 1 1 1 1 total 0.001281 0.000874 +2 1 2 1 1 total 0.001297 0.000731 +1 2 1 1 1 total 0.001281 0.000744 +3 2 2 1 1 total 0.001288 0.000719 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 0.011844 0.000690 -2 1 2 1 1 total 0.012457 0.000852 -1 2 1 1 1 total 0.011622 0.000636 -3 2 2 1 1 total 0.011719 0.000633 +0 1 1 1 1 total 0.012029 0.000664 +2 1 2 1 1 total 0.011926 0.000639 +1 2 1 1 1 total 0.011941 0.000545 +3 2 2 1 1 total 0.011994 0.000515 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 0.030919 0.001784 -2 1 2 1 1 total 0.032495 0.002202 -1 2 1 1 1 total 0.030363 0.001664 -3 2 2 1 1 total 0.030565 0.001671 +0 1 1 1 1 total 0.031361 0.001735 +2 1 2 1 1 total 0.031091 0.001675 +1 2 1 1 1 total 0.031169 0.001418 +3 2 2 1 1 total 0.031255 0.001366 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 2.290786e+06 133521.277651 -2 1 2 1 1 total 2.409292e+06 164752.430241 -1 2 1 1 1 total 2.247742e+06 123005.689035 -3 2 2 1 1 total 2.266603e+06 122428.448367 +0 1 1 1 1 total 2.326447e+06 128504.886535 +2 1 2 1 1 total 2.306518e+06 123638.096130 +1 2 1 1 1 total 2.309435e+06 105395.059055 +3 2 2 1 1 total 2.319667e+06 99692.620001 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 0.089450 0.004147 -2 1 2 1 1 total 0.092674 0.006571 -1 2 1 1 1 total 0.088389 0.004152 -3 2 2 1 1 total 0.088779 0.003763 +0 1 1 1 1 total 0.090065 0.004262 +2 1 2 1 1 total 0.090629 0.004086 +1 2 1 1 1 total 0.090100 0.003045 +3 2 2 1 1 total 0.089607 0.002828 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 0.089555 0.004061 -2 1 2 1 1 total 0.092658 0.006216 -1 2 1 1 1 total 0.088293 0.004423 -3 2 2 1 1 total 0.088717 0.004937 +0 1 1 1 1 total 0.090188 0.005151 +2 1 2 1 1 total 0.094339 0.004349 +1 2 1 1 1 total 0.088294 0.003953 +3 2 2 1 1 total 0.089633 0.002592 mesh 1 group in group out legendre nuclide mean std. dev. x y z -0 1 1 1 1 1 P0 total 0.089523 0.004070 -1 1 1 1 1 1 P1 total 0.029116 0.001851 -2 1 1 1 1 1 P2 total 0.016529 0.000827 -3 1 1 1 1 1 P3 total 0.009975 0.000731 -8 1 2 1 1 1 P0 total 0.092626 0.006233 -9 1 2 1 1 1 P1 total 0.028570 0.001899 -10 1 2 1 1 1 P2 total 0.015737 0.001986 -11 1 2 1 1 1 P3 total 0.008492 0.000859 -4 2 1 1 1 1 P0 total 0.088293 0.004423 -5 2 1 1 1 1 P1 total 0.029892 0.001916 -6 2 1 1 1 1 P2 total 0.016736 0.000714 -7 2 1 1 1 1 P3 total 0.009129 0.000509 -12 2 2 1 1 1 P0 total 0.088617 0.004889 -13 2 2 1 1 1 P1 total 0.029750 0.001954 -14 2 2 1 1 1 P2 total 0.016440 0.001320 -15 2 2 1 1 1 P3 total 0.009758 0.000538 +0 1 1 1 1 1 P0 total 0.090122 0.005149 +1 1 1 1 1 1 P1 total 0.030614 0.001612 +2 1 1 1 1 1 P2 total 0.016490 0.000897 +3 1 1 1 1 1 P3 total 0.010163 0.000829 +8 1 2 1 1 1 P0 total 0.094307 0.004337 +9 1 2 1 1 1 P1 total 0.028996 0.001462 +10 1 2 1 1 1 P2 total 0.017486 0.000808 +11 1 2 1 1 1 P3 total 0.009753 0.000742 +4 2 1 1 1 1 P0 total 0.088198 0.003959 +5 2 1 1 1 1 P1 total 0.028739 0.001715 +6 2 1 1 1 1 P2 total 0.015608 0.000680 +7 2 1 1 1 1 P3 total 0.008232 0.000363 +12 2 2 1 1 1 P0 total 0.089536 0.002551 +13 2 2 1 1 1 P1 total 0.029964 0.000821 +14 2 2 1 1 1 P2 total 0.015742 0.001260 +15 2 2 1 1 1 P3 total 0.008944 0.000385 mesh 1 group in group out legendre nuclide mean std. dev. x y z -0 1 1 1 1 1 P0 total 0.089555 0.004061 -1 1 1 1 1 1 P1 total 0.029096 0.001859 -2 1 1 1 1 1 P2 total 0.016532 0.000828 -3 1 1 1 1 1 P3 total 0.009986 0.000734 -8 1 2 1 1 1 P0 total 0.092658 0.006216 -9 1 2 1 1 1 P1 total 0.028567 0.001899 -10 1 2 1 1 1 P2 total 0.015721 0.001995 -11 1 2 1 1 1 P3 total 0.008496 0.000857 -4 2 1 1 1 1 P0 total 0.088293 0.004423 -5 2 1 1 1 1 P1 total 0.029892 0.001916 -6 2 1 1 1 1 P2 total 0.016736 0.000714 -7 2 1 1 1 1 P3 total 0.009129 0.000509 -12 2 2 1 1 1 P0 total 0.088717 0.004937 -13 2 2 1 1 1 P1 total 0.029805 0.001977 -14 2 2 1 1 1 P2 total 0.016448 0.001327 -15 2 2 1 1 1 P3 total 0.009752 0.000534 +0 1 1 1 1 1 P0 total 0.090188 0.005151 +1 1 1 1 1 1 P1 total 0.030606 0.001614 +2 1 1 1 1 1 P2 total 0.016462 0.000898 +3 1 1 1 1 1 P3 total 0.010173 0.000824 +8 1 2 1 1 1 P0 total 0.094339 0.004349 +9 1 2 1 1 1 P1 total 0.028988 0.001462 +10 1 2 1 1 1 P2 total 0.017473 0.000811 +11 1 2 1 1 1 P3 total 0.009763 0.000749 +4 2 1 1 1 1 P0 total 0.088294 0.003953 +5 2 1 1 1 1 P1 total 0.028719 0.001720 +6 2 1 1 1 1 P2 total 0.015571 0.000691 +7 2 1 1 1 1 P3 total 0.008255 0.000361 +12 2 2 1 1 1 P0 total 0.089633 0.002592 +13 2 2 1 1 1 P1 total 0.030008 0.000847 +14 2 2 1 1 1 P2 total 0.015748 0.001284 +15 2 2 1 1 1 P3 total 0.008951 0.000387 mesh 1 group in group out nuclide mean std. dev. x y z -0 1 1 1 1 1 total 1.000362 0.044694 -2 1 2 1 1 1 total 1.000346 0.059372 -1 2 1 1 1 1 total 1.000000 0.055277 -3 2 2 1 1 1 total 1.001132 0.057130 +0 1 1 1 1 1 total 1.000736 0.060260 +2 1 2 1 1 1 total 1.000346 0.042656 +1 2 1 1 1 1 total 1.001091 0.052736 +3 2 2 1 1 1 total 1.001078 0.038212 mesh 1 group in group out nuclide mean std. dev. x y z -0 1 1 1 1 1 total 0.031634 0.002236 -2 1 2 1 1 1 total 0.032561 0.002344 -1 2 1 1 1 1 total 0.030820 0.002579 -3 2 2 1 1 1 total 0.029308 0.002507 +0 1 1 1 1 1 total 0.031890 0.002523 +2 1 2 1 1 1 total 0.032714 0.001502 +1 2 1 1 1 1 total 0.030414 0.002369 +3 2 2 1 1 1 total 0.031051 0.001521 mesh 1 group in group out nuclide mean std. dev. x y z -0 1 1 1 1 1 total 1.0 0.044796 -2 1 2 1 1 1 total 1.0 0.059579 -1 2 1 1 1 1 total 1.0 0.055277 -3 2 2 1 1 1 total 1.0 0.056598 +0 1 1 1 1 1 total 1.0 0.060234 +2 1 2 1 1 1 total 1.0 0.042523 +1 2 1 1 1 1 total 1.0 0.052777 +3 2 2 1 1 1 total 1.0 0.037842 mesh 1 group in group out legendre nuclide mean std. dev. x y z -0 1 1 1 1 1 P0 total 0.089450 0.005766 -1 1 1 1 1 1 P1 total 0.029092 0.002277 -2 1 1 1 1 1 P2 total 0.016516 0.001119 -3 1 1 1 1 1 P3 total 0.009967 0.000861 -8 1 2 1 1 1 P0 total 0.092674 0.008583 -9 1 2 1 1 1 P1 total 0.028585 0.002630 -10 1 2 1 1 1 P2 total 0.015745 0.002226 -11 1 2 1 1 1 P3 total 0.008496 0.001015 -4 2 1 1 1 1 P0 total 0.088389 0.006412 -5 2 1 1 1 1 P1 total 0.029924 0.002479 -6 2 1 1 1 1 P2 total 0.016754 0.001133 -7 2 1 1 1 1 P3 total 0.009139 0.000699 -12 2 2 1 1 1 P0 total 0.088779 0.006278 -13 2 2 1 1 1 P1 total 0.029804 0.002360 -14 2 2 1 1 1 P2 total 0.016470 0.001510 -15 2 2 1 1 1 P3 total 0.009776 0.000691 +0 1 1 1 1 1 P0 total 0.090065 0.006899 +1 1 1 1 1 1 P1 total 0.030595 0.002243 +2 1 1 1 1 1 P2 total 0.016480 0.001229 +3 1 1 1 1 1 P3 total 0.010157 0.000977 +8 1 2 1 1 1 P0 total 0.090629 0.005616 +9 1 2 1 1 1 P1 total 0.027865 0.001820 +10 1 2 1 1 1 P2 total 0.016804 0.001044 +11 1 2 1 1 1 P3 total 0.009373 0.000813 +4 2 1 1 1 1 P0 total 0.090100 0.005647 +5 2 1 1 1 1 P1 total 0.029359 0.002172 +6 2 1 1 1 1 P2 total 0.015944 0.000984 +7 2 1 1 1 1 P3 total 0.008410 0.000523 +12 2 2 1 1 1 P0 total 0.089607 0.004415 +13 2 2 1 1 1 P1 total 0.029988 0.001459 +14 2 2 1 1 1 P2 total 0.015755 0.001411 +15 2 2 1 1 1 P3 total 0.008951 0.000528 mesh 1 group in group out legendre nuclide mean std. dev. x y z -0 1 1 1 1 1 P0 total 0.089483 0.007018 -1 1 1 1 1 1 P1 total 0.029103 0.002623 -2 1 1 1 1 1 P2 total 0.016522 0.001341 -3 1 1 1 1 1 P3 total 0.009971 0.000970 -8 1 2 1 1 1 P0 total 0.092706 0.010197 -9 1 2 1 1 1 P1 total 0.028595 0.003131 -10 1 2 1 1 1 P2 total 0.015750 0.002415 -11 1 2 1 1 1 P3 total 0.008499 0.001134 -4 2 1 1 1 1 P0 total 0.088389 0.008061 -5 2 1 1 1 1 P1 total 0.029924 0.002980 -6 2 1 1 1 1 P2 total 0.016754 0.001463 -7 2 1 1 1 1 P3 total 0.009139 0.000863 -12 2 2 1 1 1 P0 total 0.088880 0.008076 -13 2 2 1 1 1 P1 total 0.029838 0.002912 -14 2 2 1 1 1 P2 total 0.016489 0.001781 -15 2 2 1 1 1 P3 total 0.009787 0.000889 +0 1 1 1 1 1 P0 total 0.090131 0.008782 +1 1 1 1 1 1 P1 total 0.030617 0.002905 +2 1 1 1 1 1 P2 total 0.016492 0.001581 +3 1 1 1 1 1 P3 total 0.010164 0.001154 +8 1 2 1 1 1 P0 total 0.090661 0.006820 +9 1 2 1 1 1 P1 total 0.027875 0.002174 +10 1 2 1 1 1 P2 total 0.016810 0.001267 +11 1 2 1 1 1 P3 total 0.009376 0.000906 +4 2 1 1 1 1 P0 total 0.090199 0.007385 +5 2 1 1 1 1 P1 total 0.029391 0.002669 +6 2 1 1 1 1 P2 total 0.015962 0.001295 +7 2 1 1 1 1 P3 total 0.008419 0.000686 +12 2 2 1 1 1 P0 total 0.089704 0.005591 +13 2 2 1 1 1 P1 total 0.030020 0.001856 +14 2 2 1 1 1 P2 total 0.015772 0.001536 +15 2 2 1 1 1 P3 total 0.008961 0.000629 mesh 1 group out nuclide mean std. dev. x y z -0 1 1 1 1 total 1.0 0.088672 -2 1 2 1 1 total 1.0 0.069731 -1 2 1 1 1 total 1.0 0.109718 -3 2 2 1 1 total 1.0 0.108376 +0 1 1 1 1 total 1.0 0.098093 +2 1 2 1 1 total 1.0 0.042346 +1 2 1 1 1 total 1.0 0.104352 +3 2 2 1 1 total 1.0 0.067889 mesh 1 group out nuclide mean std. dev. x y z -0 1 1 1 1 total 1.0 0.091154 -2 1 2 1 1 total 1.0 0.069438 -1 2 1 1 1 total 1.0 0.109233 -3 2 2 1 1 total 1.0 0.108119 +0 1 1 1 1 total 1.0 0.099401 +2 1 2 1 1 total 1.0 0.042085 +1 2 1 1 1 total 1.0 0.104135 +3 2 2 1 1 total 1.0 0.067307 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 8.424136e-10 3.612697e-11 -2 1 2 1 1 total 8.884166e-10 6.324091e-11 -1 2 1 1 1 total 8.415613e-10 4.520088e-11 -3 2 2 1 1 total 8.557929e-10 2.898037e-11 +0 1 1 1 1 total 8.547713e-10 3.477664e-11 +2 1 2 1 1 total 9.057083e-10 4.171858e-11 +1 2 1 1 1 total 8.666731e-10 2.371072e-11 +3 2 2 1 1 total 8.532016e-10 1.638929e-11 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 0.030724 0.001773 -2 1 2 1 1 total 0.032290 0.002188 -1 2 1 1 1 total 0.030172 0.001654 -3 2 2 1 1 total 0.030372 0.001661 +0 1 1 1 1 total 0.031163 0.001724 +2 1 2 1 1 total 0.030895 0.001664 +1 2 1 1 1 total 0.030973 0.001409 +3 2 2 1 1 total 0.031058 0.001358 mesh 1 group in group out nuclide mean std. dev. x y z -0 1 1 1 1 1 total 0.031468 0.002273 -2 1 2 1 1 1 total 0.032418 0.002330 -1 2 1 1 1 1 total 0.030706 0.002559 -3 2 2 1 1 1 total 0.029134 0.002487 +0 1 1 1 1 1 total 0.031781 0.002541 +2 1 2 1 1 1 total 0.032490 0.001487 +1 2 1 1 1 1 total 0.030274 0.002354 +3 2 2 1 1 1 total 0.030882 0.001500 mesh 1 group in nuclide mean std. dev. x y surf -3 1 1 x-max in 1 total 0.1884 0.010255 -2 1 1 x-max out 1 total 0.1798 0.009646 +3 1 1 x-max in 1 total 0.1888 0.008218 +2 1 1 x-max out 1 total 0.1828 0.008212 1 1 1 x-min in 1 total 0.0000 0.000000 0 1 1 x-min out 1 total 0.0000 0.000000 -7 1 1 y-max in 1 total 0.1822 0.014739 -6 1 1 y-max out 1 total 0.1806 0.019423 +7 1 1 y-max in 1 total 0.1820 0.012534 +6 1 1 y-max out 1 total 0.1794 0.015302 5 1 1 y-min in 1 total 0.0000 0.000000 4 1 1 y-min out 1 total 0.0000 0.000000 -19 1 2 x-max in 1 total 0.1780 0.012514 -18 1 2 x-max out 1 total 0.1886 0.014979 +19 1 2 x-max in 1 total 0.1870 0.011696 +18 1 2 x-max out 1 total 0.1850 0.012919 17 1 2 x-min in 1 total 0.0000 0.000000 16 1 2 x-min out 1 total 0.0000 0.000000 23 1 2 y-max in 1 total 0.0000 0.000000 22 1 2 y-max out 1 total 0.0000 0.000000 -21 1 2 y-min in 1 total 0.1806 0.019423 -20 1 2 y-min out 1 total 0.1822 0.014739 +21 1 2 y-min in 1 total 0.1794 0.015302 +20 1 2 y-min out 1 total 0.1820 0.012534 11 2 1 x-max in 1 total 0.0000 0.000000 10 2 1 x-max out 1 total 0.0000 0.000000 -9 2 1 x-min in 1 total 0.1798 0.009646 -8 2 1 x-min out 1 total 0.1884 0.010255 -15 2 1 y-max in 1 total 0.1812 0.009583 -14 2 1 y-max out 1 total 0.1858 0.012018 +9 2 1 x-min in 1 total 0.1828 0.008212 +8 2 1 x-min out 1 total 0.1888 0.008218 +15 2 1 y-max in 1 total 0.1850 0.011256 +14 2 1 y-max out 1 total 0.1870 0.009597 13 2 1 y-min in 1 total 0.0000 0.000000 12 2 1 y-min out 1 total 0.0000 0.000000 27 2 2 x-max in 1 total 0.0000 0.000000 26 2 2 x-max out 1 total 0.0000 0.000000 -25 2 2 x-min in 1 total 0.1886 0.014979 -24 2 2 x-min out 1 total 0.1780 0.012514 +25 2 2 x-min in 1 total 0.1850 0.012919 +24 2 2 x-min out 1 total 0.1870 0.011696 31 2 2 y-max in 1 total 0.0000 0.000000 30 2 2 y-max out 1 total 0.0000 0.000000 -29 2 2 y-min in 1 total 0.1858 0.012018 -28 2 2 y-min out 1 total 0.1812 0.009583 +29 2 2 y-min in 1 total 0.1870 0.009597 +28 2 2 y-min out 1 total 0.1850 0.011256 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 4.539911 0.323493 -2 1 2 1 1 total 4.278655 0.425575 -1 2 1 1 1 total 4.674097 0.339600 -3 2 2 1 1 total 4.630700 0.312366 +0 1 1 1 1 total 4.581283 0.329623 +2 1 2 1 1 total 4.452968 0.295762 +1 2 1 1 1 total 4.469295 0.239674 +3 2 2 1 1 total 4.570894 0.218416 mesh 1 group in nuclide mean std. dev. x y z -0 1 1 1 1 total 4.538654 0.323497 -2 1 2 1 1 total 4.278494 0.425550 -1 2 1 1 1 total 4.674097 0.339600 -3 2 2 1 1 total 4.634259 0.313464 +0 1 1 1 1 total 4.580746 0.329583 +2 1 2 1 1 total 4.452519 0.295716 +1 2 1 1 1 total 4.468066 0.239680 +3 2 2 1 1 total 4.573657 0.219069 mesh 1 delayedgroup group in nuclide mean std. dev. x y z -0 1 1 1 1 1 total 0.000007 3.997262e-07 -1 1 1 1 2 1 total 0.000035 2.063264e-06 -2 1 1 1 3 1 total 0.000034 1.969771e-06 -3 1 1 1 4 1 total 0.000075 4.416388e-06 -4 1 1 1 5 1 total 0.000031 1.810657e-06 -5 1 1 1 6 1 total 0.000013 7.584779e-07 -12 1 2 1 1 1 total 0.000007 4.931656e-07 -13 1 2 1 2 1 total 0.000037 2.545569e-06 -14 1 2 1 3 1 total 0.000035 2.430221e-06 -15 1 2 1 4 1 total 0.000079 5.448757e-06 -16 1 2 1 5 1 total 0.000032 2.233913e-06 -17 1 2 1 6 1 total 0.000014 9.357785e-07 -6 2 1 1 1 1 total 0.000007 3.618632e-07 -7 2 1 1 2 1 total 0.000035 1.867826e-06 -8 2 1 1 3 1 total 0.000033 1.783189e-06 -9 2 1 1 4 1 total 0.000074 3.998058e-06 -10 2 1 1 5 1 total 0.000030 1.639147e-06 -11 2 1 1 6 1 total 0.000013 6.866331e-07 -18 2 2 1 1 1 total 0.000007 3.603080e-07 -19 2 2 1 2 1 total 0.000035 1.859799e-06 -20 2 2 1 3 1 total 0.000033 1.775526e-06 -21 2 2 1 4 1 total 0.000075 3.980875e-06 -22 2 2 1 5 1 total 0.000031 1.632103e-06 -23 2 2 1 6 1 total 0.000013 6.836821e-07 +0 1 1 1 1 1 total 0.000007 3.812309e-07 +1 1 1 1 2 1 total 0.000036 1.967797e-06 +2 1 1 1 3 1 total 0.000034 1.878630e-06 +3 1 1 1 4 1 total 0.000077 4.212043e-06 +4 1 1 1 5 1 total 0.000031 1.726878e-06 +5 1 1 1 6 1 total 0.000013 7.233832e-07 +12 1 2 1 1 1 total 0.000007 3.663985e-07 +13 1 2 1 2 1 total 0.000035 1.891236e-06 +14 1 2 1 3 1 total 0.000034 1.805539e-06 +15 1 2 1 4 1 total 0.000076 4.048166e-06 +16 1 2 1 5 1 total 0.000031 1.659691e-06 +17 1 2 1 6 1 total 0.000013 6.952388e-07 +6 2 1 1 1 1 total 0.000007 3.123173e-07 +7 2 1 1 2 1 total 0.000035 1.612086e-06 +8 2 1 1 3 1 total 0.000034 1.539037e-06 +9 2 1 1 4 1 total 0.000076 3.450649e-06 +10 2 1 1 5 1 total 0.000031 1.414717e-06 +11 2 1 1 6 1 total 0.000013 5.926201e-07 +18 2 2 1 1 1 total 0.000007 2.946716e-07 +19 2 2 1 2 1 total 0.000036 1.521004e-06 +20 2 2 1 3 1 total 0.000034 1.452083e-06 +21 2 2 1 4 1 total 0.000076 3.255689e-06 +22 2 2 1 5 1 total 0.000031 1.334787e-06 +23 2 2 1 6 1 total 0.000013 5.591374e-07 mesh 1 delayedgroup group out nuclide mean std. dev. x y z -0 1 1 1 1 1 total 0.0 0.000000 -1 1 1 1 2 1 total 1.0 0.866877 -2 1 1 1 3 1 total 1.0 0.866877 -3 1 1 1 4 1 total 1.0 1.414214 -4 1 1 1 5 1 total 1.0 1.414214 +0 1 1 1 1 1 total 1.0 1.414214 +1 1 1 1 2 1 total 0.0 0.000000 +2 1 1 1 3 1 total 0.0 0.000000 +3 1 1 1 4 1 total 1.0 0.578922 +4 1 1 1 5 1 total 0.0 0.000000 5 1 1 1 6 1 total 0.0 0.000000 12 1 2 1 1 1 total 0.0 0.000000 -13 1 2 1 2 1 total 0.0 0.000000 -14 1 2 1 3 1 total 0.0 0.000000 -15 1 2 1 4 1 total 1.0 0.579346 -16 1 2 1 5 1 total 1.0 1.414214 +13 1 2 1 2 1 total 1.0 0.578922 +14 1 2 1 3 1 total 1.0 1.414214 +15 1 2 1 4 1 total 1.0 1.414214 +16 1 2 1 5 1 total 1.0 0.875472 17 1 2 1 6 1 total 1.0 1.414214 -6 2 1 1 1 1 total 1.0 1.414214 -7 2 1 1 2 1 total 1.0 1.414214 -8 2 1 1 3 1 total 1.0 0.874781 -9 2 1 1 4 1 total 0.0 0.000000 -10 2 1 1 5 1 total 0.0 0.000000 +6 2 1 1 1 1 total 0.0 0.000000 +7 2 1 1 2 1 total 0.0 0.000000 +8 2 1 1 3 1 total 1.0 1.414214 +9 2 1 1 4 1 total 1.0 0.579392 +10 2 1 1 5 1 total 1.0 1.414214 11 2 1 1 6 1 total 0.0 0.000000 -18 2 2 1 1 1 total 1.0 1.414214 -19 2 2 1 2 1 total 1.0 0.867902 -20 2 2 1 3 1 total 1.0 1.414214 -21 2 2 1 4 1 total 1.0 1.414214 +18 2 2 1 1 1 total 1.0 0.868163 +19 2 2 1 2 1 total 1.0 1.414214 +20 2 2 1 3 1 total 0.0 0.000000 +21 2 2 1 4 1 total 1.0 0.868969 22 2 2 1 5 1 total 1.0 1.414214 23 2 2 1 6 1 total 0.0 0.000000 mesh 1 delayedgroup group in nuclide mean std. dev. x y z -0 1 1 1 1 1 total 0.000221 0.000016 -1 1 1 1 2 1 total 0.001138 0.000084 -2 1 1 1 3 1 total 0.001087 0.000080 -3 1 1 1 4 1 total 0.002437 0.000180 -4 1 1 1 5 1 total 0.000999 0.000074 -5 1 1 1 6 1 total 0.000418 0.000031 -12 1 2 1 1 1 total 0.000221 0.000014 -13 1 2 1 2 1 total 0.001138 0.000073 -14 1 2 1 3 1 total 0.001087 0.000069 -15 1 2 1 4 1 total 0.002436 0.000155 -16 1 2 1 5 1 total 0.000999 0.000064 -17 1 2 1 6 1 total 0.000418 0.000027 -6 2 1 1 1 1 total 0.000220 0.000014 -7 2 1 1 2 1 total 0.001137 0.000070 -8 2 1 1 3 1 total 0.001086 0.000067 -9 2 1 1 4 1 total 0.002435 0.000150 -10 2 1 1 5 1 total 0.000998 0.000062 -11 2 1 1 6 1 total 0.000418 0.000026 -18 2 2 1 1 1 total 0.000221 0.000015 -19 2 2 1 2 1 total 0.001141 0.000078 -20 2 2 1 3 1 total 0.001089 0.000074 -21 2 2 1 4 1 total 0.002442 0.000167 -22 2 2 1 5 1 total 0.001001 0.000068 -23 2 2 1 6 1 total 0.000419 0.000029 +0 1 1 1 1 1 total 0.000221 0.000015 +1 1 1 1 2 1 total 0.001140 0.000079 +2 1 1 1 3 1 total 0.001088 0.000075 +3 1 1 1 4 1 total 0.002440 0.000169 +4 1 1 1 5 1 total 0.001001 0.000069 +5 1 1 1 6 1 total 0.000419 0.000029 +12 1 2 1 1 1 total 0.000221 0.000013 +13 1 2 1 2 1 total 0.001139 0.000066 +14 1 2 1 3 1 total 0.001088 0.000063 +15 1 2 1 4 1 total 0.002439 0.000142 +16 1 2 1 5 1 total 0.001000 0.000058 +17 1 2 1 6 1 total 0.000419 0.000024 +6 2 1 1 1 1 total 0.000220 0.000013 +7 2 1 1 2 1 total 0.001138 0.000067 +8 2 1 1 3 1 total 0.001086 0.000064 +9 2 1 1 4 1 total 0.002435 0.000144 +10 2 1 1 5 1 total 0.000998 0.000059 +11 2 1 1 6 1 total 0.000418 0.000025 +18 2 2 1 1 1 total 0.000221 0.000013 +19 2 2 1 2 1 total 0.001141 0.000066 +20 2 2 1 3 1 total 0.001090 0.000063 +21 2 2 1 4 1 total 0.002443 0.000141 +22 2 2 1 5 1 total 0.001002 0.000058 +23 2 2 1 6 1 total 0.000420 0.000024 mesh 1 delayedgroup nuclide mean std. dev. x y z -0 1 1 1 1 total 0.013336 0.000997 -1 1 1 1 2 total 0.032739 0.002447 -2 1 1 1 3 total 0.120780 0.009028 -3 1 1 1 4 total 0.302780 0.022633 -4 1 1 1 5 total 0.849490 0.063500 -5 1 1 1 6 total 2.853000 0.213262 -12 1 2 1 1 total 0.013336 0.000866 -13 1 2 1 2 total 0.032739 0.002126 -14 1 2 1 3 total 0.120780 0.007843 -15 1 2 1 4 total 0.302780 0.019661 -16 1 2 1 5 total 0.849490 0.055163 -17 1 2 1 6 total 2.853000 0.185263 -6 2 1 1 1 total 0.013336 0.000814 -7 2 1 1 2 total 0.032739 0.001999 -8 2 1 1 3 total 0.120780 0.007373 -9 2 1 1 4 total 0.302780 0.018483 -10 2 1 1 5 total 0.849490 0.051857 -11 2 1 1 6 total 2.853000 0.174163 -18 2 2 1 1 total 0.013336 0.000896 -19 2 2 1 2 total 0.032739 0.002200 -20 2 2 1 3 total 0.120780 0.008117 -21 2 2 1 4 total 0.302780 0.020349 -22 2 2 1 5 total 0.849490 0.057091 -23 2 2 1 6 total 2.853000 0.191738 +0 1 1 1 1 total 0.013336 0.000919 +1 1 1 1 2 total 0.032739 0.002257 +2 1 1 1 3 total 0.120780 0.008325 +3 1 1 1 4 total 0.302780 0.020871 +4 1 1 1 5 total 0.849490 0.058555 +5 1 1 1 6 total 2.853000 0.196656 +12 1 2 1 1 total 0.013336 0.000770 +13 1 2 1 2 total 0.032739 0.001891 +14 1 2 1 3 total 0.120780 0.006977 +15 1 2 1 4 total 0.302780 0.017490 +16 1 2 1 5 total 0.849490 0.049071 +17 1 2 1 6 total 2.853000 0.164804 +6 2 1 1 1 total 0.013336 0.000790 +7 2 1 1 2 total 0.032739 0.001940 +8 2 1 1 3 total 0.120780 0.007157 +9 2 1 1 4 total 0.302780 0.017942 +10 2 1 1 5 total 0.849490 0.050338 +11 2 1 1 6 total 2.853000 0.169061 +18 2 2 1 1 total 0.013336 0.000757 +19 2 2 1 2 total 0.032739 0.001858 +20 2 2 1 3 total 0.120780 0.006855 +21 2 2 1 4 total 0.302780 0.017186 +22 2 2 1 5 total 0.849490 0.048217 +23 2 2 1 6 total 2.853000 0.161935 mesh 1 delayedgroup group in group out nuclide mean std. dev. x y z -0 1 1 1 1 1 1 total 0.000000 0.000000 -1 1 1 1 2 1 1 total 0.000056 0.000034 -2 1 1 1 3 1 1 total 0.000056 0.000034 -3 1 1 1 4 1 1 total 0.000029 0.000029 -4 1 1 1 5 1 1 total 0.000026 0.000026 +0 1 1 1 1 1 1 total 0.000026 0.000026 +1 1 1 1 2 1 1 total 0.000000 0.000000 +2 1 1 1 3 1 1 total 0.000000 0.000000 +3 1 1 1 4 1 1 total 0.000083 0.000034 +4 1 1 1 5 1 1 total 0.000000 0.000000 5 1 1 1 6 1 1 total 0.000000 0.000000 12 1 2 1 1 1 1 total 0.000000 0.000000 -13 1 2 1 2 1 1 total 0.000000 0.000000 -14 1 2 1 3 1 1 total 0.000000 0.000000 -15 1 2 1 4 1 1 total 0.000079 0.000033 -16 1 2 1 5 1 1 total 0.000032 0.000032 -17 1 2 1 6 1 1 total 0.000032 0.000032 -6 2 1 1 1 1 1 total 0.000029 0.000029 -7 2 1 1 2 1 1 total 0.000027 0.000027 -8 2 1 1 3 1 1 total 0.000058 0.000036 -9 2 1 1 4 1 1 total 0.000000 0.000000 -10 2 1 1 5 1 1 total 0.000000 0.000000 +13 1 2 1 2 1 1 total 0.000081 0.000033 +14 1 2 1 3 1 1 total 0.000026 0.000026 +15 1 2 1 4 1 1 total 0.000026 0.000026 +16 1 2 1 5 1 1 total 0.000059 0.000036 +17 1 2 1 6 1 1 total 0.000033 0.000033 +6 2 1 1 1 1 1 total 0.000000 0.000000 +7 2 1 1 2 1 1 total 0.000000 0.000000 +8 2 1 1 3 1 1 total 0.000032 0.000032 +9 2 1 1 4 1 1 total 0.000080 0.000033 +10 2 1 1 5 1 1 total 0.000028 0.000028 11 2 1 1 6 1 1 total 0.000000 0.000000 -18 2 2 1 1 1 1 total 0.000027 0.000027 -19 2 2 1 2 1 1 total 0.000056 0.000035 -20 2 2 1 3 1 1 total 0.000028 0.000028 -21 2 2 1 4 1 1 total 0.000030 0.000030 -22 2 2 1 5 1 1 total 0.000033 0.000033 +18 2 2 1 1 1 1 total 0.000054 0.000033 +19 2 2 1 2 1 1 total 0.000029 0.000029 +20 2 2 1 3 1 1 total 0.000000 0.000000 +21 2 2 1 4 1 1 total 0.000054 0.000033 +22 2 2 1 5 1 1 total 0.000032 0.000032 23 2 2 1 6 1 1 total 0.000000 0.000000 diff --git a/tests/regression_tests/mgxs_library_mesh/test.py b/tests/regression_tests/mgxs_library_mesh/test.py index 89c68a75a..c1a5980b5 100644 --- a/tests/regression_tests/mgxs_library_mesh/test.py +++ b/tests/regression_tests/mgxs_library_mesh/test.py @@ -57,7 +57,7 @@ def model(): model.mgxs_lib.build_library() # Add tallies - model.mgxs_lib.add_to_tallies_file(model.tallies, merge=False) + model.mgxs_lib.add_to_tallies(model.tallies, merge=False) return model diff --git a/tests/regression_tests/mgxs_library_no_nuclides/inputs_true.dat b/tests/regression_tests/mgxs_library_no_nuclides/inputs_true.dat index 5cad36b7e..af09268cd 100644 --- a/tests/regression_tests/mgxs_library_no_nuclides/inputs_true.dat +++ b/tests/regression_tests/mgxs_library_no_nuclides/inputs_true.dat @@ -1,47 +1,47 @@ - - - - - - + + + + + + - - - - - - + + + + + + - - - - - + + + + + - - - - - - - - - + + + + + + + + + eigenvalue 100 10 5 - + -0.63 -0.63 -1 0.63 0.63 1 diff --git a/tests/regression_tests/mgxs_library_no_nuclides/results_true.dat b/tests/regression_tests/mgxs_library_no_nuclides/results_true.dat index c0dba7c0f..aec8e8bbc 100644 --- a/tests/regression_tests/mgxs_library_no_nuclides/results_true.dat +++ b/tests/regression_tests/mgxs_library_no_nuclides/results_true.dat @@ -1,227 +1,227 @@ total material group in nuclide mean std. dev. -1 1 1 total 0.413814 0.018434 -0 1 2 total 0.663001 0.012535 +1 1 1 total 0.422772 0.014069 +0 1 2 total 0.661309 0.049458 transport material group in nuclide mean std. dev. -1 1 1 total 0.369730 0.019494 -0 1 2 total 0.643777 0.018246 +1 1 1 total 0.383831 0.015331 +0 1 2 total 0.679181 0.050786 nu-transport material group in nuclide mean std. dev. -1 1 1 total 0.369730 0.019494 -0 1 2 total 0.643777 0.018246 +1 1 1 total 0.383831 0.015331 +0 1 2 total 0.679181 0.050786 absorption material group in nuclide mean std. dev. -1 1 1 total 0.026013 0.001851 -0 1 2 total 0.267233 0.007475 +1 1 1 total 0.027181 0.001539 +0 1 2 total 0.265559 0.020699 reduced absorption material group in nuclide mean std. dev. -1 1 1 total 0.025932 0.001850 -0 1 2 total 0.267233 0.007475 +1 1 1 total 0.027162 0.001538 +0 1 2 total 0.265559 0.020699 capture material group in nuclide mean std. dev. -1 1 1 total 0.018869 0.001758 -0 1 2 total 0.072358 0.008204 +1 1 1 total 0.019717 0.001492 +0 1 2 total 0.072029 0.019378 fission material group in nuclide mean std. dev. -1 1 1 total 0.007144 0.000317 -0 1 2 total 0.194875 0.005528 +1 1 1 total 0.007464 0.000222 +0 1 2 total 0.193530 0.015119 nu-fission material group in nuclide mean std. dev. -1 1 1 total 0.018243 0.000827 -0 1 2 total 0.474851 0.013471 +1 1 1 total 0.018925 0.000543 +0 1 2 total 0.471574 0.036840 kappa-fission material group in nuclide mean std. dev. -1 1 1 total 1.391782e+06 6.192598e+04 -0 1 2 total 3.768981e+07 1.069211e+06 +1 1 1 total 1.453014e+06 4.287190e+04 +0 1 2 total 3.742974e+07 2.924022e+06 scatter material group in nuclide mean std. dev. -1 1 1 total 0.387802 0.017462 -0 1 2 total 0.395768 0.007541 +1 1 1 total 0.395591 0.013417 +0 1 2 total 0.395750 0.029309 nu-scatter material group in nuclide mean std. dev. -1 1 1 total 0.387032 0.024325 -0 1 2 total 0.407651 0.016266 +1 1 1 total 0.392941 0.019689 +0 1 2 total 0.396262 0.027471 scatter matrix material group in group out legendre nuclide mean std. dev. -12 1 1 1 P0 total 0.386336 0.024297 -13 1 1 1 P1 total 0.044084 0.006343 -14 1 1 1 P2 total 0.027336 0.006403 -15 1 1 1 P3 total 0.011672 0.004897 -8 1 1 2 P0 total 0.000695 0.000327 -9 1 1 2 P1 total -0.000359 0.000201 -10 1 1 2 P2 total -0.000047 0.000081 -11 1 1 2 P3 total 0.000239 0.000099 +12 1 1 1 P0 total 0.392419 0.019837 +13 1 1 1 P1 total 0.038941 0.006089 +14 1 1 1 P2 total 0.019512 0.003548 +15 1 1 1 P3 total 0.012951 0.002399 +8 1 1 2 P0 total 0.000522 0.000349 +9 1 1 2 P1 total -0.000301 0.000185 +10 1 1 2 P2 total 0.000045 0.000147 +11 1 1 2 P3 total 0.000069 0.000162 4 1 2 1 P0 total 0.000000 0.000000 5 1 2 1 P1 total 0.000000 0.000000 6 1 2 1 P2 total 0.000000 0.000000 7 1 2 1 P3 total 0.000000 0.000000 -0 1 2 2 P0 total 0.407651 0.016266 -1 1 2 2 P1 total 0.021192 0.013171 -2 1 2 2 P2 total 0.010327 0.017230 -3 1 2 2 P3 total 0.005148 0.013732 +0 1 2 2 P0 total 0.396262 0.027471 +1 1 2 2 P1 total -0.016133 0.010911 +2 1 2 2 P2 total -0.001147 0.010536 +3 1 2 2 P3 total 0.005359 0.008143 nu-scatter matrix material group in group out legendre nuclide mean std. dev. -12 1 1 1 P0 total 0.386336 0.024297 -13 1 1 1 P1 total 0.044084 0.006343 -14 1 1 1 P2 total 0.027336 0.006403 -15 1 1 1 P3 total 0.011672 0.004897 -8 1 1 2 P0 total 0.000695 0.000327 -9 1 1 2 P1 total -0.000359 0.000201 -10 1 1 2 P2 total -0.000047 0.000081 -11 1 1 2 P3 total 0.000239 0.000099 +12 1 1 1 P0 total 0.392419 0.019837 +13 1 1 1 P1 total 0.038941 0.006089 +14 1 1 1 P2 total 0.019512 0.003548 +15 1 1 1 P3 total 0.012951 0.002399 +8 1 1 2 P0 total 0.000522 0.000349 +9 1 1 2 P1 total -0.000301 0.000185 +10 1 1 2 P2 total 0.000045 0.000147 +11 1 1 2 P3 total 0.000069 0.000162 4 1 2 1 P0 total 0.000000 0.000000 5 1 2 1 P1 total 0.000000 0.000000 6 1 2 1 P2 total 0.000000 0.000000 7 1 2 1 P3 total 0.000000 0.000000 -0 1 2 2 P0 total 0.407651 0.016266 -1 1 2 2 P1 total 0.021192 0.013171 -2 1 2 2 P2 total 0.010327 0.017230 -3 1 2 2 P3 total 0.005148 0.013732 +0 1 2 2 P0 total 0.396262 0.027471 +1 1 2 2 P1 total -0.016133 0.010911 +2 1 2 2 P2 total -0.001147 0.010536 +3 1 2 2 P3 total 0.005359 0.008143 multiplicity matrix material group in group out nuclide mean std. dev. -3 1 1 1 total 1.0 0.064268 -2 1 1 2 total 1.0 0.661438 +3 1 1 1 total 1.0 0.054620 +2 1 1 2 total 1.0 0.942809 1 1 2 1 total 0.0 0.000000 -0 1 2 2 total 1.0 0.050545 +0 1 2 2 total 1.0 0.080341 nu-fission matrix material group in group out nuclide mean std. dev. -3 1 1 1 total 0.024633 0.002205 +3 1 1 1 total 0.019257 0.001831 2 1 1 2 total 0.000000 0.000000 -1 1 2 1 total 0.435159 0.014743 +1 1 2 1 total 0.459401 0.022054 0 1 2 2 total 0.000000 0.000000 scatter probability matrix material group in group out nuclide mean std. dev. -3 1 1 1 total 0.998203 0.064101 -2 1 1 2 total 0.001797 0.000844 +3 1 1 1 total 0.998671 0.054518 +2 1 1 2 total 0.001329 0.000888 1 1 2 1 total 0.000000 0.000000 -0 1 2 2 total 1.000000 0.050545 +0 1 2 2 total 1.000000 0.080341 consistent scatter matrix material group in group out legendre nuclide mean std. dev. -12 1 1 1 P0 total 0.387105 0.030361 -13 1 1 1 P1 total 0.044172 0.006684 -14 1 1 1 P2 total 0.027391 0.006543 -15 1 1 1 P3 total 0.011695 0.004937 -8 1 1 2 P0 total 0.000697 0.000329 -9 1 1 2 P1 total -0.000360 0.000202 -10 1 1 2 P2 total -0.000047 0.000082 -11 1 1 2 P3 total 0.000239 0.000100 +12 1 1 1 P0 total 0.395065 0.025390 +13 1 1 1 P1 total 0.039204 0.006325 +14 1 1 1 P2 total 0.019644 0.003656 +15 1 1 1 P3 total 0.013039 0.002470 +8 1 1 2 P0 total 0.000526 0.000352 +9 1 1 2 P1 total -0.000303 0.000186 +10 1 1 2 P2 total 0.000045 0.000148 +11 1 1 2 P3 total 0.000069 0.000163 4 1 2 1 P0 total 0.000000 0.000000 5 1 2 1 P1 total 0.000000 0.000000 6 1 2 1 P2 total 0.000000 0.000000 7 1 2 1 P3 total 0.000000 0.000000 -0 1 2 2 P0 total 0.395768 0.021378 -1 1 2 2 P1 total 0.020575 0.012809 -2 1 2 2 P2 total 0.010026 0.016732 -3 1 2 2 P3 total 0.004998 0.013333 +0 1 2 2 P0 total 0.395750 0.043243 +1 1 2 2 P1 total -0.016112 0.010982 +2 1 2 2 P2 total -0.001146 0.010523 +3 1 2 2 P3 total 0.005353 0.008145 consistent nu-scatter matrix material group in group out legendre nuclide mean std. dev. -12 1 1 1 P0 total 0.387105 0.039252 -13 1 1 1 P1 total 0.044172 0.007262 -14 1 1 1 P2 total 0.027391 0.006776 -15 1 1 1 P3 total 0.011695 0.004994 -8 1 1 2 P0 total 0.000697 0.000566 -9 1 1 2 P1 total -0.000360 0.000313 -10 1 1 2 P2 total -0.000047 0.000087 -11 1 1 2 P3 total 0.000239 0.000187 +12 1 1 1 P0 total 0.395065 0.033321 +13 1 1 1 P1 total 0.039204 0.006677 +14 1 1 1 P2 total 0.019644 0.003810 +15 1 1 1 P3 total 0.013039 0.002571 +8 1 1 2 P0 total 0.000526 0.000608 +9 1 1 2 P1 total -0.000303 0.000341 +10 1 1 2 P2 total 0.000045 0.000154 +11 1 1 2 P3 total 0.000069 0.000175 4 1 2 1 P0 total 0.000000 0.000000 5 1 2 1 P1 total 0.000000 0.000000 6 1 2 1 P2 total 0.000000 0.000000 7 1 2 1 P3 total 0.000000 0.000000 -0 1 2 2 P0 total 0.395768 0.029278 -1 1 2 2 P1 total 0.020575 0.012851 -2 1 2 2 P2 total 0.010026 0.016739 -3 1 2 2 P3 total 0.004998 0.013335 +0 1 2 2 P0 total 0.395750 0.053673 +1 1 2 2 P1 total -0.016112 0.011058 +2 1 2 2 P2 total -0.001146 0.010523 +3 1 2 2 P3 total 0.005353 0.008157 chi material group out nuclide mean std. dev. -1 1 1 total 1.0 0.039887 +1 1 1 total 1.0 0.015644 0 1 2 total 0.0 0.000000 chi-prompt material group out nuclide mean std. dev. -1 1 1 total 1.0 0.039887 +1 1 1 total 1.0 0.017529 0 1 2 total 0.0 0.000000 inverse-velocity material group in nuclide mean std. dev. -1 1 1 total 5.956290e-08 2.255751e-09 -0 1 2 total 2.886630e-06 7.418452e-08 +1 1 1 total 6.047675e-08 4.367288e-09 +0 1 2 total 2.861927e-06 2.241423e-07 prompt-nu-fission material group in nuclide mean std. dev. -1 1 1 total 0.018067 0.000817 -0 1 2 total 0.471762 0.013383 +1 1 1 total 0.018748 0.00054 +0 1 2 total 0.468507 0.03660 prompt-nu-fission matrix material group in group out nuclide mean std. dev. -3 1 1 1 total 0.024633 0.002205 +3 1 1 1 total 0.019049 0.001675 2 1 1 2 total 0.000000 0.000000 -1 1 2 1 total 0.435159 0.014743 +1 1 2 1 total 0.454399 0.022578 0 1 2 2 total 0.000000 0.000000 diffusion-coefficient material group in nuclide mean std. dev. -1 1 1 total 0.901559 0.047536 -0 1 2 total 0.517778 0.014675 +1 1 1 total 0.868438 0.034686 +0 1 2 total 0.490787 0.036698 nu-diffusion-coefficient material group in nuclide mean std. dev. -1 1 1 total 0.901559 0.047536 -0 1 2 total 0.517778 0.014675 +1 1 1 total 0.868438 0.034686 +0 1 2 total 0.490787 0.036698 (n,elastic) material group in nuclide mean std. dev. -1 1 1 total 0.360179 0.016169 -0 1 2 total 0.395768 0.007541 +1 1 1 total 0.368341 0.013033 +0 1 2 total 0.395750 0.029309 (n,level) material group in nuclide mean std. dev. -1 1 1 total 0.000568 0.000028 +1 1 1 total 0.000518 0.000016 0 1 2 total 0.000000 0.000000 (n,2n) material group in nuclide mean std. dev. -1 1 1 total 0.000079 0.000042 +1 1 1 total 0.000019 0.000012 0 1 2 total 0.000000 0.000000 (n,na) - material group in nuclide mean std. dev. -1 1 1 total 8.510945e-07 8.515320e-07 -0 1 2 total 0.000000e+00 0.000000e+00 + material group in nuclide mean std. dev. +1 1 1 total 0.0 0.0 +0 1 2 total 0.0 0.0 (n,nc) material group in nuclide mean std. dev. -1 1 1 total 0.008258 0.000928 +1 1 1 total 0.007599 0.000559 0 1 2 total 0.000000 0.000000 (n,gamma) material group in nuclide mean std. dev. -1 1 1 total 0.018749 0.001838 -0 1 2 total 0.072358 0.001951 +1 1 1 total 0.019608 0.001470 +0 1 2 total 0.072029 0.005584 (n,a) material group in nuclide mean std. dev. -1 1 1 total 0.000119 0.000023 -0 1 2 total 0.000000 0.000000 +1 1 1 total 0.000109 0.00002 +0 1 2 total 0.000000 0.00000 (n,Xa) - material group in nuclide mean std. dev. -1 1 1 total 0.00012 0.000022 -0 1 2 total 0.00000 0.000000 + material group in nuclide mean std. dev. +1 1 1 total 0.000109 0.00002 +0 1 2 total 0.000000 0.00000 heating - material group in nuclide mean std. dev. -1 1 1 total 1.216089e+06 54827.397330 -0 1 2 total 3.262993e+07 904277.817101 + material group in nuclide mean std. dev. +1 1 1 total 1.270644e+06 3.732629e+04 +0 1 2 total 3.241569e+07 2.530346e+06 damage-energy material group in nuclide mean std. dev. -1 1 1 total 2317.176742 165.734097 -0 1 2 total 1371.933922 38.919660 +1 1 1 total 2405.735342 79.042000 +0 1 2 total 1362.470597 106.435803 (n,n1) material group in nuclide mean std. dev. -1 1 1 total 0.012055 0.000759 +1 1 1 total 0.011931 0.000455 0 1 2 total 0.000000 0.000000 (n,a0) material group in nuclide mean std. dev. -1 1 1 total 0.000109 0.000028 -0 1 2 total 0.000000 0.000000 +1 1 1 total 0.000108 0.00002 +0 1 2 total 0.000000 0.00000 (n,nc) matrix material group in group out nuclide mean std. dev. -3 1 1 1 total 0.009563 0.001002 +3 1 1 1 total 0.005745 0.001068 2 1 1 2 total 0.000000 0.000000 1 1 2 1 total 0.000000 0.000000 0 1 2 2 total 0.000000 0.000000 (n,n1) matrix material group in group out nuclide mean std. dev. -3 1 1 1 total 0.013909 0.00145 -2 1 1 2 total 0.000000 0.00000 -1 1 2 1 total 0.000000 0.00000 -0 1 2 2 total 0.000000 0.00000 +3 1 1 1 total 0.013232 0.001025 +2 1 1 2 total 0.000000 0.000000 +1 1 2 1 total 0.000000 0.000000 +0 1 2 2 total 0.000000 0.000000 (n,2n) matrix material group in group out nuclide mean std. dev. 3 1 1 1 total 0.0 0.0 @@ -230,104 +230,104 @@ damage-energy 0 1 2 2 total 0.0 0.0 delayed-nu-fission material delayedgroup group in nuclide mean std. dev. -1 1 1 1 total 0.000004 1.857100e-07 -3 1 2 1 total 0.000025 1.293123e-06 -5 1 3 1 total 0.000026 1.448812e-06 -7 1 4 1 total 0.000068 4.132525e-06 -9 1 5 1 total 0.000037 2.670208e-06 -11 1 6 1 total 0.000015 1.084541e-06 -0 1 1 2 total 0.000108 3.067510e-06 -2 1 2 2 total 0.000558 1.583355e-05 -4 1 3 2 total 0.000533 1.511609e-05 -6 1 4 2 total 0.001195 3.389154e-05 -8 1 5 2 total 0.000490 1.389508e-05 -10 1 6 2 total 0.000205 5.820598e-06 +1 1 1 1 total 0.000004 1.226367e-07 +3 1 2 1 total 0.000026 6.725093e-07 +5 1 3 1 total 0.000027 7.028316e-07 +7 1 4 1 total 0.000068 1.919534e-06 +9 1 5 1 total 0.000037 1.268939e-06 +11 1 6 1 total 0.000015 5.136452e-07 +0 1 1 2 total 0.000107 8.388866e-06 +2 1 2 2 total 0.000554 4.330076e-05 +4 1 3 2 total 0.000529 4.133869e-05 +6 1 4 2 total 0.001186 9.268481e-05 +8 1 5 2 total 0.000486 3.799954e-05 +10 1 6 2 total 0.000204 1.591787e-05 chi-delayed material delayedgroup group out nuclide mean std. dev. -1 1 1 1 total 0.0 0.0 -3 1 2 1 total 0.0 0.0 -5 1 3 1 total 0.0 0.0 -7 1 4 1 total 0.0 0.0 -9 1 5 1 total 0.0 0.0 -11 1 6 1 total 0.0 0.0 -0 1 1 2 total 0.0 0.0 -2 1 2 2 total 0.0 0.0 -4 1 3 2 total 0.0 0.0 -6 1 4 2 total 0.0 0.0 -8 1 5 2 total 0.0 0.0 -10 1 6 2 total 0.0 0.0 +1 1 1 1 total 0.0 0.000000 +3 1 2 1 total 0.0 0.000000 +5 1 3 1 total 0.0 0.000000 +7 1 4 1 total 1.0 0.433956 +9 1 5 1 total 0.0 0.000000 +11 1 6 1 total 0.0 0.000000 +0 1 1 2 total 0.0 0.000000 +2 1 2 2 total 0.0 0.000000 +4 1 3 2 total 0.0 0.000000 +6 1 4 2 total 0.0 0.000000 +8 1 5 2 total 0.0 0.000000 +10 1 6 2 total 0.0 0.000000 beta material delayedgroup group in nuclide mean std. dev. -1 1 1 1 total 0.000223 0.000009 -3 1 2 1 total 0.001375 0.000067 -5 1 3 1 total 0.001439 0.000076 -7 1 4 1 total 0.003724 0.000217 -9 1 5 1 total 0.002049 0.000142 -11 1 6 1 total 0.000840 0.000058 -0 1 1 2 total 0.000228 0.000008 -2 1 2 2 total 0.001175 0.000041 -4 1 3 2 total 0.001122 0.000040 -6 1 4 2 total 0.002516 0.000089 -8 1 5 2 total 0.001031 0.000036 -10 1 6 2 total 0.000432 0.000015 +1 1 1 1 total 0.000225 0.000006 +3 1 2 1 total 0.001359 0.000033 +5 1 3 1 total 0.001412 0.000034 +7 1 4 1 total 0.003611 0.000094 +9 1 5 1 total 0.001950 0.000064 +11 1 6 1 total 0.000801 0.000026 +0 1 1 2 total 0.000228 0.000019 +2 1 2 2 total 0.001175 0.000096 +4 1 3 2 total 0.001122 0.000092 +6 1 4 2 total 0.002516 0.000206 +8 1 5 2 total 0.001031 0.000085 +10 1 6 2 total 0.000432 0.000035 decay-rate material delayedgroup nuclide mean std. dev. -0 1 1 total 0.013353 0.000379 -1 1 2 total 0.032612 0.001002 -2 1 3 total 0.121056 0.003938 -3 1 4 total 0.305642 0.010892 -4 1 5 total 0.860947 0.036893 -5 1 6 total 2.891708 0.122310 +0 1 1 total 0.013352 0.000905 +1 1 2 total 0.032619 0.002094 +2 1 3 total 0.121041 0.007464 +3 1 4 total 0.305491 0.017639 +4 1 5 total 0.860388 0.042833 +5 1 6 total 2.889807 0.145503 delayed-nu-fission matrix - material delayedgroup group in group out nuclide mean std. dev. -3 1 1 1 1 total 0.0 0.0 -7 1 2 1 1 total 0.0 0.0 -11 1 3 1 1 total 0.0 0.0 -15 1 4 1 1 total 0.0 0.0 -19 1 5 1 1 total 0.0 0.0 -23 1 6 1 1 total 0.0 0.0 -2 1 1 1 2 total 0.0 0.0 -6 1 2 1 2 total 0.0 0.0 -10 1 3 1 2 total 0.0 0.0 -14 1 4 1 2 total 0.0 0.0 -18 1 5 1 2 total 0.0 0.0 -22 1 6 1 2 total 0.0 0.0 -1 1 1 2 1 total 0.0 0.0 -5 1 2 2 1 total 0.0 0.0 -9 1 3 2 1 total 0.0 0.0 -13 1 4 2 1 total 0.0 0.0 -17 1 5 2 1 total 0.0 0.0 -21 1 6 2 1 total 0.0 0.0 -0 1 1 2 2 total 0.0 0.0 -4 1 2 2 2 total 0.0 0.0 -8 1 3 2 2 total 0.0 0.0 -12 1 4 2 2 total 0.0 0.0 -16 1 5 2 2 total 0.0 0.0 -20 1 6 2 2 total 0.0 0.0 + material delayedgroup group in group out nuclide mean std. dev. +3 1 1 1 1 total 0.000000 0.000000 +7 1 2 1 1 total 0.000000 0.000000 +11 1 3 1 1 total 0.000000 0.000000 +15 1 4 1 1 total 0.000207 0.000207 +19 1 5 1 1 total 0.000000 0.000000 +23 1 6 1 1 total 0.000000 0.000000 +2 1 1 1 2 total 0.000000 0.000000 +6 1 2 1 2 total 0.000000 0.000000 +10 1 3 1 2 total 0.000000 0.000000 +14 1 4 1 2 total 0.000000 0.000000 +18 1 5 1 2 total 0.000000 0.000000 +22 1 6 1 2 total 0.000000 0.000000 +1 1 1 2 1 total 0.000000 0.000000 +5 1 2 2 1 total 0.000000 0.000000 +9 1 3 2 1 total 0.000000 0.000000 +13 1 4 2 1 total 0.005002 0.001278 +17 1 5 2 1 total 0.000000 0.000000 +21 1 6 2 1 total 0.000000 0.000000 +0 1 1 2 2 total 0.000000 0.000000 +4 1 2 2 2 total 0.000000 0.000000 +8 1 3 2 2 total 0.000000 0.000000 +12 1 4 2 2 total 0.000000 0.000000 +16 1 5 2 2 total 0.000000 0.000000 +20 1 6 2 2 total 0.000000 0.000000 total material group in nuclide mean std. dev. -1 2 1 total 0.313574 0.016009 -0 2 2 total 0.300858 0.005911 +1 2 1 total 0.320478 0.012201 +0 2 2 total 0.300681 0.029685 transport material group in nuclide mean std. dev. -1 2 1 total 0.266154 0.017348 -0 2 2 total 0.300597 0.011062 +1 2 1 total 0.267653 0.015887 +0 2 2 total 0.327250 0.035614 nu-transport material group in nuclide mean std. dev. -1 2 1 total 0.266154 0.017348 -0 2 2 total 0.300597 0.011062 +1 2 1 total 0.267653 0.015887 +0 2 2 total 0.327250 0.035614 absorption - material group in nuclide mean std. dev. -1 2 1 total 0.00150 0.000118 -0 2 2 total 0.00542 0.000201 + material group in nuclide mean std. dev. +1 2 1 total 0.001040 0.000121 +0 2 2 total 0.005284 0.000548 reduced absorption material group in nuclide mean std. dev. -1 2 1 total 0.001481 0.000119 -0 2 2 total 0.005420 0.000201 +1 2 1 total 0.001040 0.000121 +0 2 2 total 0.005284 0.000548 capture - material group in nuclide mean std. dev. -1 2 1 total 0.00150 0.000118 -0 2 2 total 0.00542 0.000201 + material group in nuclide mean std. dev. +1 2 1 total 0.001040 0.000121 +0 2 2 total 0.005284 0.000548 fission material group in nuclide mean std. dev. 1 2 1 total 0.0 0.0 @@ -342,18 +342,18 @@ kappa-fission 0 2 2 total 0.0 0.0 scatter material group in nuclide mean std. dev. -1 2 1 total 0.312074 0.015934 -0 2 2 total 0.295438 0.005743 +1 2 1 total 0.319438 0.012181 +0 2 2 total 0.295397 0.029142 nu-scatter material group in nuclide mean std. dev. -1 2 1 total 0.318594 0.023203 -0 2 2 total 0.295662 0.031486 +1 2 1 total 0.314727 0.014272 +0 2 2 total 0.295807 0.038170 scatter matrix material group in group out legendre nuclide mean std. dev. -12 2 1 1 P0 total 0.318594 0.023203 -13 2 1 1 P1 total 0.047420 0.006684 -14 2 1 1 P2 total 0.029426 0.008048 -15 2 1 1 P3 total 0.007335 0.004092 +12 2 1 1 P0 total 0.314727 0.014272 +13 2 1 1 P1 total 0.052826 0.010175 +14 2 1 1 P2 total 0.033176 0.002264 +15 2 1 1 P3 total 0.006129 0.004317 8 2 1 2 P0 total 0.000000 0.000000 9 2 1 2 P1 total 0.000000 0.000000 10 2 1 2 P2 total 0.000000 0.000000 @@ -362,16 +362,16 @@ scatter matrix 5 2 2 1 P1 total 0.000000 0.000000 6 2 2 1 P2 total 0.000000 0.000000 7 2 2 1 P3 total 0.000000 0.000000 -0 2 2 2 P0 total 0.295662 0.031486 -1 2 2 2 P1 total 0.000261 0.009350 -2 2 2 2 P2 total -0.004912 0.007866 -3 2 2 2 P3 total -0.018278 0.012339 +0 2 2 2 P0 total 0.295807 0.038170 +1 2 2 2 P1 total -0.026569 0.019676 +2 2 2 2 P2 total -0.005395 0.007578 +3 2 2 2 P3 total -0.005680 0.012737 nu-scatter matrix material group in group out legendre nuclide mean std. dev. -12 2 1 1 P0 total 0.318594 0.023203 -13 2 1 1 P1 total 0.047420 0.006684 -14 2 1 1 P2 total 0.029426 0.008048 -15 2 1 1 P3 total 0.007335 0.004092 +12 2 1 1 P0 total 0.314727 0.014272 +13 2 1 1 P1 total 0.052826 0.010175 +14 2 1 1 P2 total 0.033176 0.002264 +15 2 1 1 P3 total 0.006129 0.004317 8 2 1 2 P0 total 0.000000 0.000000 9 2 1 2 P1 total 0.000000 0.000000 10 2 1 2 P2 total 0.000000 0.000000 @@ -380,16 +380,16 @@ nu-scatter matrix 5 2 2 1 P1 total 0.000000 0.000000 6 2 2 1 P2 total 0.000000 0.000000 7 2 2 1 P3 total 0.000000 0.000000 -0 2 2 2 P0 total 0.295662 0.031486 -1 2 2 2 P1 total 0.000261 0.009350 -2 2 2 2 P2 total -0.004912 0.007866 -3 2 2 2 P3 total -0.018278 0.012339 +0 2 2 2 P0 total 0.295807 0.038170 +1 2 2 2 P1 total -0.026569 0.019676 +2 2 2 2 P2 total -0.005395 0.007578 +3 2 2 2 P3 total -0.005680 0.012737 multiplicity matrix material group in group out nuclide mean std. dev. -3 2 1 1 total 1.0 0.071770 +3 2 1 1 total 1.0 0.043852 2 2 1 2 total 0.0 0.000000 1 2 2 1 total 0.0 0.000000 -0 2 2 2 total 1.0 0.103652 +0 2 2 2 total 1.0 0.139361 nu-fission matrix material group in group out nuclide mean std. dev. 3 2 1 1 total 0.0 0.0 @@ -398,16 +398,16 @@ nu-fission matrix 0 2 2 2 total 0.0 0.0 scatter probability matrix material group in group out nuclide mean std. dev. -3 2 1 1 total 1.0 0.071770 +3 2 1 1 total 1.0 0.043852 2 2 1 2 total 0.0 0.000000 1 2 2 1 total 0.0 0.000000 -0 2 2 2 total 1.0 0.103652 +0 2 2 2 total 1.0 0.139361 consistent scatter matrix material group in group out legendre nuclide mean std. dev. -12 2 1 1 P0 total 0.312074 0.027487 -13 2 1 1 P1 total 0.046450 0.006939 -14 2 1 1 P2 total 0.028824 0.008012 -15 2 1 1 P3 total 0.007185 0.004024 +12 2 1 1 P0 total 0.319438 0.018563 +13 2 1 1 P1 total 0.053616 0.010510 +14 2 1 1 P2 total 0.033673 0.002604 +15 2 1 1 P3 total 0.006221 0.004387 8 2 1 2 P0 total 0.000000 0.000000 9 2 1 2 P1 total 0.000000 0.000000 10 2 1 2 P2 total 0.000000 0.000000 @@ -416,16 +416,16 @@ consistent scatter matrix 5 2 2 1 P1 total 0.000000 0.000000 6 2 2 1 P2 total 0.000000 0.000000 7 2 2 1 P3 total 0.000000 0.000000 -0 2 2 2 P0 total 0.295438 0.031157 -1 2 2 2 P1 total 0.000261 0.009343 -2 2 2 2 P2 total -0.004909 0.007859 -3 2 2 2 P3 total -0.018264 0.012327 +0 2 2 2 P0 total 0.295397 0.050438 +1 2 2 2 P1 total -0.026532 0.019872 +2 2 2 2 P2 total -0.005388 0.007591 +3 2 2 2 P3 total -0.005672 0.012735 consistent nu-scatter matrix material group in group out legendre nuclide mean std. dev. -12 2 1 1 P0 total 0.312074 0.035456 -13 2 1 1 P1 total 0.046450 0.007699 -14 2 1 1 P2 total 0.028824 0.008274 -15 2 1 1 P3 total 0.007185 0.004057 +12 2 1 1 P0 total 0.319438 0.023255 +13 2 1 1 P1 total 0.053616 0.010769 +14 2 1 1 P2 total 0.033673 0.002993 +15 2 1 1 P3 total 0.006221 0.004396 8 2 1 2 P0 total 0.000000 0.000000 9 2 1 2 P1 total 0.000000 0.000000 10 2 1 2 P2 total 0.000000 0.000000 @@ -434,10 +434,10 @@ consistent nu-scatter matrix 5 2 2 1 P1 total 0.000000 0.000000 6 2 2 1 P2 total 0.000000 0.000000 7 2 2 1 P3 total 0.000000 0.000000 -0 2 2 2 P0 total 0.295438 0.043686 -1 2 2 2 P1 total 0.000261 0.009343 -2 2 2 2 P2 total -0.004909 0.007876 -3 2 2 2 P3 total -0.018264 0.012471 +0 2 2 2 P0 total 0.295397 0.065105 +1 2 2 2 P1 total -0.026532 0.020213 +2 2 2 2 P2 total -0.005388 0.007628 +3 2 2 2 P3 total -0.005672 0.012759 chi material group out nuclide mean std. dev. 1 2 1 total 0.0 0.0 @@ -448,8 +448,8 @@ chi-prompt 0 2 2 total 0.0 0.0 inverse-velocity material group in nuclide mean std. dev. -1 2 1 total 6.076563e-08 2.727519e-09 -0 2 2 total 2.996176e-06 1.110139e-07 +1 2 1 total 6.068670e-08 4.861582e-09 +0 2 2 total 2.921021e-06 3.028269e-07 prompt-nu-fission material group in nuclide mean std. dev. 1 2 1 total 0.0 0.0 @@ -462,72 +462,72 @@ prompt-nu-fission matrix 0 2 2 2 total 0.0 0.0 diffusion-coefficient material group in nuclide mean std. dev. -1 2 1 total 1.252406 0.081631 -0 2 2 total 1.108904 0.040809 +1 2 1 total 1.245396 0.073923 +0 2 2 total 1.018589 0.110853 nu-diffusion-coefficient material group in nuclide mean std. dev. -1 2 1 total 1.252406 0.081631 -0 2 2 total 1.108904 0.040809 +1 2 1 total 1.245396 0.073923 +0 2 2 total 1.018589 0.110853 (n,elastic) material group in nuclide mean std. dev. -1 2 1 total 0.302664 0.015531 -0 2 2 total 0.295438 0.005743 +1 2 1 total 0.310592 0.012188 +0 2 2 total 0.295397 0.029142 (n,level) material group in nuclide mean std. dev. 1 2 1 total 0.0 0.0 0 2 2 total 0.0 0.0 (n,2n) - material group in nuclide mean std. dev. -1 2 1 total 0.000019 0.000017 -0 2 2 total 0.000000 0.000000 + material group in nuclide mean std. dev. +1 2 1 total 0.0 0.0 +0 2 2 total 0.0 0.0 (n,na) material group in nuclide mean std. dev. -1 2 1 total 4.892570e-09 4.436228e-09 +1 2 1 total 2.157338e-13 1.864239e-13 0 2 2 total 0.000000e+00 0.000000e+00 (n,nc) - material group in nuclide mean std. dev. -1 2 1 total 0.001998 0.000408 -0 2 2 total 0.000000 0.000000 + material group in nuclide mean std. dev. +1 2 1 total 0.00187 0.000152 +0 2 2 total 0.00000 0.000000 (n,gamma) material group in nuclide mean std. dev. -1 2 1 total 0.001497 0.000118 -0 2 2 total 0.005419 0.000201 +1 2 1 total 0.001038 0.000121 +0 2 2 total 0.005283 0.000548 (n,a) material group in nuclide mean std. dev. -1 2 1 total 9.546292e-07 9.180854e-08 -0 2 2 total 2.736059e-07 5.318732e-09 +1 2 1 total 7.402079e-07 3.197538e-08 +0 2 2 total 2.735682e-07 2.698845e-08 (n,Xa) material group in nuclide mean std. dev. -1 2 1 total 9.595218e-07 9.558005e-08 -0 2 2 total 2.736059e-07 5.318732e-09 +1 2 1 total 7.402081e-07 3.197534e-08 +0 2 2 total 2.735682e-07 2.698845e-08 heating material group in nuclide mean std. dev. -1 2 1 total 2551.878627 212.765665 -0 2 2 total 2.332139 0.087384 +1 2 1 total 2479.710231 157.161879 +0 2 2 total 2.314706 0.265682 damage-energy - material group in nuclide mean std. dev. -1 2 1 total 1585.677533 130.382718 -0 2 2 total 0.295108 0.010079 + material group in nuclide mean std. dev. +1 2 1 total 1566.139383 61.602407 +0 2 2 total 0.288739 0.029698 (n,n1) material group in nuclide mean std. dev. -1 2 1 total 0.002835 0.000246 +1 2 1 total 0.002897 0.000181 0 2 2 total 0.000000 0.000000 (n,a0) material group in nuclide mean std. dev. -1 2 1 total 7.169006e-07 6.251188e-08 -0 2 2 total 2.733303e-07 5.313375e-09 +1 2 1 total 6.646569e-07 2.959064e-08 +0 2 2 total 2.732927e-07 2.696126e-08 (n,nc) matrix material group in group out nuclide mean std. dev. -3 2 1 1 total 0.001489 0.001491 +3 2 1 1 total 0.000488 0.000488 2 2 1 2 total 0.000000 0.000000 1 2 2 1 total 0.000000 0.000000 0 2 2 2 total 0.000000 0.000000 (n,n1) matrix - material group in group out nuclide mean std. dev. -3 2 1 1 total 0.001985 0.000507 -2 2 1 2 total 0.000000 0.000000 -1 2 2 1 total 0.000000 0.000000 -0 2 2 2 total 0.000000 0.000000 + material group in group out nuclide mean std. dev. +3 2 1 1 total 0.00244 0.001094 +2 2 1 2 total 0.00000 0.000000 +1 2 2 1 total 0.00000 0.000000 +0 2 2 2 total 0.00000 0.000000 (n,2n) matrix material group in group out nuclide mean std. dev. 3 2 1 1 total 0.0 0.0 @@ -612,28 +612,28 @@ delayed-nu-fission matrix 20 2 6 2 2 total 0.0 0.0 total material group in nuclide mean std. dev. -1 3 1 total 0.682896 0.024140 -0 3 2 total 2.032938 0.085675 +1 3 1 total 0.692034 0.019973 +0 3 2 total 2.033425 0.189463 transport material group in nuclide mean std. dev. -1 3 1 total 0.298986 0.026905 -0 3 2 total 1.471887 0.096907 +1 3 1 total 0.298754 0.021602 +0 3 2 total 1.459465 0.197868 nu-transport material group in nuclide mean std. dev. -1 3 1 total 0.298986 0.026905 -0 3 2 total 1.471887 0.096907 +1 3 1 total 0.298754 0.021602 +0 3 2 total 1.459465 0.197868 absorption material group in nuclide mean std. dev. -1 3 1 total 0.000693 0.000020 -0 3 2 total 0.031171 0.001403 +1 3 1 total 0.000699 0.000035 +0 3 2 total 0.031056 0.003017 reduced absorption material group in nuclide mean std. dev. -1 3 1 total 0.000693 0.000020 -0 3 2 total 0.031171 0.001403 +1 3 1 total 0.000699 0.000035 +0 3 2 total 0.031056 0.003017 capture material group in nuclide mean std. dev. -1 3 1 total 0.000693 0.000020 -0 3 2 total 0.031171 0.001403 +1 3 1 total 0.000699 0.000035 +0 3 2 total 0.031056 0.003017 fission material group in nuclide mean std. dev. 1 3 1 total 0.0 0.0 @@ -648,54 +648,54 @@ kappa-fission 0 3 2 total 0.0 0.0 scatter material group in nuclide mean std. dev. -1 3 1 total 0.682202 0.024123 -0 3 2 total 2.001768 0.084281 +1 3 1 total 0.691336 0.019945 +0 3 2 total 2.002368 0.186454 nu-scatter material group in nuclide mean std. dev. -1 3 1 total 0.672567 0.017434 -0 3 2 total 2.004576 0.129211 +1 3 1 total 0.684356 0.011639 +0 3 2 total 1.990840 0.178205 scatter matrix material group in group out legendre nuclide mean std. dev. -12 3 1 1 P0 total 0.641741 0.016600 -13 3 1 1 P1 total 0.383841 0.011878 -14 3 1 1 P2 total 0.149909 0.005512 -15 3 1 1 P3 total 0.004238 0.002485 -8 3 1 2 P0 total 0.030826 0.000973 -9 3 1 2 P1 total 0.009943 0.000415 -10 3 1 2 P2 total -0.003002 0.000628 -11 3 1 2 P3 total -0.004234 0.000393 -4 3 2 1 P0 total 0.000467 0.000467 -5 3 2 1 P1 total 0.000345 0.000345 -6 3 2 1 P2 total 0.000149 0.000149 -7 3 2 1 P3 total -0.000047 0.000047 -0 3 2 2 P0 total 2.004109 0.129225 -1 3 2 2 P1 total 0.511363 0.043448 -2 3 2 2 P2 total 0.108599 0.014070 -3 3 2 2 P3 total 0.035733 0.021921 +12 3 1 1 P0 total 0.652706 0.011111 +13 3 1 1 P1 total 0.393203 0.008164 +14 3 1 1 P2 total 0.162146 0.003332 +15 3 1 1 P3 total 0.014967 0.004773 +8 3 1 2 P0 total 0.031650 0.000613 +9 3 1 2 P1 total 0.009845 0.000647 +10 3 1 2 P2 total -0.003284 0.000758 +11 3 1 2 P3 total -0.003971 0.000187 +4 3 2 1 P0 total 0.000474 0.000475 +5 3 2 1 P1 total 0.000396 0.000397 +6 3 2 1 P2 total 0.000260 0.000261 +7 3 2 1 P3 total 0.000099 0.000099 +0 3 2 2 P0 total 1.990366 0.178042 +1 3 2 2 P1 total 0.523546 0.053239 +2 3 2 2 P2 total 0.101180 0.015832 +3 3 2 2 P3 total 0.017873 0.005685 nu-scatter matrix material group in group out legendre nuclide mean std. dev. -12 3 1 1 P0 total 0.641741 0.016600 -13 3 1 1 P1 total 0.383841 0.011878 -14 3 1 1 P2 total 0.149909 0.005512 -15 3 1 1 P3 total 0.004238 0.002485 -8 3 1 2 P0 total 0.030826 0.000973 -9 3 1 2 P1 total 0.009943 0.000415 -10 3 1 2 P2 total -0.003002 0.000628 -11 3 1 2 P3 total -0.004234 0.000393 -4 3 2 1 P0 total 0.000467 0.000467 -5 3 2 1 P1 total 0.000345 0.000345 -6 3 2 1 P2 total 0.000149 0.000149 -7 3 2 1 P3 total -0.000047 0.000047 -0 3 2 2 P0 total 2.004109 0.129225 -1 3 2 2 P1 total 0.511363 0.043448 -2 3 2 2 P2 total 0.108599 0.014070 -3 3 2 2 P3 total 0.035733 0.021921 +12 3 1 1 P0 total 0.652706 0.011111 +13 3 1 1 P1 total 0.393203 0.008164 +14 3 1 1 P2 total 0.162146 0.003332 +15 3 1 1 P3 total 0.014967 0.004773 +8 3 1 2 P0 total 0.031650 0.000613 +9 3 1 2 P1 total 0.009845 0.000647 +10 3 1 2 P2 total -0.003284 0.000758 +11 3 1 2 P3 total -0.003971 0.000187 +4 3 2 1 P0 total 0.000474 0.000475 +5 3 2 1 P1 total 0.000396 0.000397 +6 3 2 1 P2 total 0.000260 0.000261 +7 3 2 1 P3 total 0.000099 0.000099 +0 3 2 2 P0 total 1.990366 0.178042 +1 3 2 2 P1 total 0.523546 0.053239 +2 3 2 2 P2 total 0.101180 0.015832 +3 3 2 2 P3 total 0.017873 0.005685 multiplicity matrix material group in group out nuclide mean std. dev. -3 3 1 1 total 1.0 0.022200 -2 3 1 2 total 1.0 0.033880 +3 3 1 1 total 1.0 0.020267 +2 3 1 2 total 1.0 0.024112 1 3 2 1 total 1.0 1.414214 -0 3 2 2 total 1.0 0.066922 +0 3 2 2 total 1.0 0.093189 nu-fission matrix material group in group out nuclide mean std. dev. 3 3 1 1 total 0.0 0.0 @@ -704,46 +704,46 @@ nu-fission matrix 0 3 2 2 total 0.0 0.0 scatter probability matrix material group in group out nuclide mean std. dev. -3 3 1 1 total 0.954167 0.020729 -2 3 1 2 total 0.045833 0.001296 -1 3 2 1 total 0.000233 0.000233 -0 3 2 2 total 0.999767 0.066899 +3 3 1 1 total 0.953753 0.018903 +2 3 1 2 total 0.046247 0.001011 +1 3 2 1 total 0.000238 0.000239 +0 3 2 2 total 0.999762 0.093156 consistent scatter matrix material group in group out legendre nuclide mean std. dev. -12 3 1 1 P0 total 0.650935 0.027014 -13 3 1 1 P1 total 0.389340 0.017459 -14 3 1 1 P2 total 0.152056 0.007457 -15 3 1 1 P3 total 0.004299 0.002525 -8 3 1 2 P0 total 0.031268 0.001416 -9 3 1 2 P1 total 0.010085 0.000533 -10 3 1 2 P2 total -0.003045 0.000645 -11 3 1 2 P3 total -0.004295 0.000423 -4 3 2 1 P0 total 0.000466 0.000467 -5 3 2 1 P1 total 0.000344 0.000345 -6 3 2 1 P2 total 0.000148 0.000149 -7 3 2 1 P3 total -0.000047 0.000047 -0 3 2 2 P0 total 2.001301 0.158219 -1 3 2 2 P1 total 0.510647 0.049275 -2 3 2 2 P2 total 0.108446 0.014900 -3 3 2 2 P3 total 0.035683 0.021951 +12 3 1 1 P0 total 0.659363 0.023079 +13 3 1 1 P1 total 0.397213 0.014683 +14 3 1 1 P2 total 0.163800 0.006035 +15 3 1 1 P3 total 0.015120 0.004843 +8 3 1 2 P0 total 0.031973 0.001157 +9 3 1 2 P1 total 0.009945 0.000721 +10 3 1 2 P2 total -0.003318 0.000772 +11 3 1 2 P3 total -0.004011 0.000225 +4 3 2 1 P0 total 0.000477 0.000480 +5 3 2 1 P1 total 0.000399 0.000401 +6 3 2 1 P2 total 0.000262 0.000264 +7 3 2 1 P3 total 0.000099 0.000100 +0 3 2 2 P0 total 2.001892 0.263710 +1 3 2 2 P1 total 0.526577 0.073894 +2 3 2 2 P2 total 0.101766 0.018719 +3 3 2 2 P3 total 0.017976 0.005976 consistent nu-scatter matrix material group in group out legendre nuclide mean std. dev. -12 3 1 1 P0 total 0.650935 0.030637 -13 3 1 1 P1 total 0.389340 0.019481 -14 3 1 1 P2 total 0.152056 0.008185 -15 3 1 1 P3 total 0.004299 0.002526 -8 3 1 2 P0 total 0.031268 0.001768 -9 3 1 2 P1 total 0.010085 0.000633 -10 3 1 2 P2 total -0.003045 0.000653 -11 3 1 2 P3 total -0.004295 0.000447 -4 3 2 1 P0 total 0.000466 0.000808 -5 3 2 1 P1 total 0.000344 0.000597 -6 3 2 1 P2 total 0.000148 0.000257 -7 3 2 1 P3 total -0.000047 0.000081 -0 3 2 2 P0 total 2.001301 0.207294 -1 3 2 2 P1 total 0.510647 0.059966 -2 3 2 2 P2 total 0.108446 0.016574 -3 3 2 2 P3 total 0.035683 0.022080 +12 3 1 1 P0 total 0.659363 0.026669 +13 3 1 1 P1 total 0.397213 0.016746 +14 3 1 1 P2 total 0.163800 0.006888 +15 3 1 1 P3 total 0.015120 0.004853 +8 3 1 2 P0 total 0.031973 0.001391 +9 3 1 2 P1 total 0.009945 0.000759 +10 3 1 2 P2 total -0.003318 0.000776 +11 3 1 2 P3 total -0.004011 0.000245 +4 3 2 1 P0 total 0.000477 0.000827 +5 3 2 1 P1 total 0.000399 0.000692 +6 3 2 1 P2 total 0.000262 0.000455 +7 3 2 1 P3 total 0.000099 0.000172 +0 3 2 2 P0 total 2.001892 0.323026 +1 3 2 2 P1 total 0.526577 0.088703 +2 3 2 2 P2 total 0.101766 0.020985 +3 3 2 2 P3 total 0.017976 0.006207 chi material group out nuclide mean std. dev. 1 3 1 total 0.0 0.0 @@ -754,8 +754,8 @@ chi-prompt 0 3 2 total 0.0 0.0 inverse-velocity material group in nuclide mean std. dev. -1 3 1 total 6.023693e-08 1.678511e-09 -0 3 2 total 2.995346e-06 1.347817e-07 +1 3 1 total 6.187551e-08 3.945367e-09 +0 3 2 total 2.984343e-06 2.898715e-07 prompt-nu-fission material group in nuclide mean std. dev. 1 3 1 total 0.0 0.0 @@ -768,60 +768,60 @@ prompt-nu-fission matrix 0 3 2 2 total 0.0 0.0 diffusion-coefficient material group in nuclide mean std. dev. -1 3 1 total 1.114881 0.100326 -0 3 2 total 0.226467 0.014910 +1 3 1 total 1.115746 0.080676 +0 3 2 total 0.228394 0.030965 nu-diffusion-coefficient material group in nuclide mean std. dev. -1 3 1 total 1.114881 0.100326 -0 3 2 total 0.226467 0.014910 +1 3 1 total 1.115746 0.080676 +0 3 2 total 0.228394 0.030965 (n,elastic) material group in nuclide mean std. dev. -1 3 1 total 0.682168 0.024125 -0 3 2 total 2.001768 0.084281 +1 3 1 total 0.691333 0.019945 +0 3 2 total 2.002368 0.186454 (n,level) material group in nuclide mean std. dev. -1 3 1 total 0.000033 0.000019 +1 3 1 total 0.000003 0.000002 0 3 2 total 0.000000 0.000000 (n,2n) material group in nuclide mean std. dev. 1 3 1 total 0.0 0.0 0 3 2 total 0.0 0.0 (n,na) - material group in nuclide mean std. dev. -1 3 1 total 9.967562e-07 9.970492e-07 -0 3 2 total 0.000000e+00 0.000000e+00 + material group in nuclide mean std. dev. +1 3 1 total 0.0 0.0 +0 3 2 total 0.0 0.0 (n,nc) - material group in nuclide mean std. dev. -1 3 1 total 8.867935e-07 8.870902e-07 -0 3 2 total 0.000000e+00 0.000000e+00 + material group in nuclide mean std. dev. +1 3 1 total 0.0 0.0 +0 3 2 total 0.0 0.0 (n,gamma) material group in nuclide mean std. dev. -1 3 1 total 0.000219 0.000006 -0 3 2 total 0.010855 0.000488 +1 3 1 total 0.000225 0.000014 +0 3 2 total 0.010815 0.001050 (n,a) material group in nuclide mean std. dev. -1 3 1 total 0.000474 0.000015 -0 3 2 total 0.020316 0.000914 +1 3 1 total 0.000474 0.000021 +0 3 2 total 0.020241 0.001966 (n,Xa) material group in nuclide mean std. dev. -1 3 1 total 0.000475 0.000015 -0 3 2 total 0.020316 0.000914 +1 3 1 total 0.000474 0.000021 +0 3 2 total 0.020242 0.001966 heating material group in nuclide mean std. dev. -1 3 1 total 77986.174023 6103.108384 -0 3 2 total 59060.658662 3576.641806 +1 3 1 total 74978.139095 3970.725596 +0 3 2 total 58539.697122 6443.645451 damage-energy material group in nuclide mean std. dev. -1 3 1 total 1107.847239 59.901669 -0 3 2 total 331.691439 14.926212 +1 3 1 total 1161.596397 41.187452 +0 3 2 total 330.473159 32.100259 (n,n1) - material group in nuclide mean std. dev. -1 3 1 total 0.000001 3.988839e-07 -0 3 2 total 0.000000 0.000000e+00 + material group in nuclide mean std. dev. +1 3 1 total 2.912377e-07 3.897408e-08 +0 3 2 total 0.000000e+00 0.000000e+00 (n,a0) material group in nuclide mean std. dev. -1 3 1 total 0.000084 0.000016 -0 3 2 total 0.001278 0.000058 +1 3 1 total 0.000082 0.000009 +0 3 2 total 0.001273 0.000124 (n,nc) matrix material group in group out nuclide mean std. dev. 3 3 1 1 total 0.0 0.0 diff --git a/tests/regression_tests/mgxs_library_no_nuclides/test.py b/tests/regression_tests/mgxs_library_no_nuclides/test.py index af14a5dc8..a02086af3 100644 --- a/tests/regression_tests/mgxs_library_no_nuclides/test.py +++ b/tests/regression_tests/mgxs_library_no_nuclides/test.py @@ -39,7 +39,7 @@ class MGXSTestHarness(PyAPITestHarness): self.mgxs_lib.build_library() # Add tallies - self.mgxs_lib.add_to_tallies_file(self._model.tallies, merge=False) + self.mgxs_lib.add_to_tallies(self._model.tallies, merge=False) def _get_results(self, hash_output=False): """Digest info in the statepoint and return as a string.""" diff --git a/tests/regression_tests/mgxs_library_nuclides/inputs_true.dat b/tests/regression_tests/mgxs_library_nuclides/inputs_true.dat index 9b3a22510..c35e57f0e 100644 --- a/tests/regression_tests/mgxs_library_nuclides/inputs_true.dat +++ b/tests/regression_tests/mgxs_library_nuclides/inputs_true.dat @@ -1,47 +1,47 @@ - - - - - - + + + + + + - - - - - - + + + + + + - - - - - + + + + + - - - - - - - - - + + + + + + + + + eigenvalue 100 10 5 - + -0.63 -0.63 -1 0.63 0.63 1 diff --git a/tests/regression_tests/mgxs_library_nuclides/results_true.dat b/tests/regression_tests/mgxs_library_nuclides/results_true.dat index c2188997d..c05ec9b48 100644 --- a/tests/regression_tests/mgxs_library_nuclides/results_true.dat +++ b/tests/regression_tests/mgxs_library_nuclides/results_true.dat @@ -1 +1 @@ -4ae3b5a70ad72b1be261aee3ab19e0261d1c12f4d4ca50b712d1ba76041bd5387c69fa9fa326619ad588db206cd9aaf464b0025d71ea9b8b1137af0102bca87f \ No newline at end of file +d1e4ab2c0d85bb5da617db9c7a3731494114e2fd3ba75ae8eaa1f0a36648f73fcbcfb487390789b0124719cabdcbfa84af4bb118f11bdc548d1065e1b5af836a \ No newline at end of file diff --git a/tests/regression_tests/mgxs_library_nuclides/test.py b/tests/regression_tests/mgxs_library_nuclides/test.py index 8a7673565..a10070358 100644 --- a/tests/regression_tests/mgxs_library_nuclides/test.py +++ b/tests/regression_tests/mgxs_library_nuclides/test.py @@ -36,7 +36,7 @@ class MGXSTestHarness(PyAPITestHarness): self.mgxs_lib.build_library() # Add tallies - self.mgxs_lib.add_to_tallies_file(self._model.tallies, merge=False) + self.mgxs_lib.add_to_tallies(self._model.tallies, merge=False) def _get_results(self, hash_output=True): """Digest info in the statepoint and return as a string.""" diff --git a/tests/regression_tests/mgxs_library_specific_nuclides/inputs_true.dat b/tests/regression_tests/mgxs_library_specific_nuclides/inputs_true.dat index 1372741c9..dd9d1ceb0 100644 --- a/tests/regression_tests/mgxs_library_specific_nuclides/inputs_true.dat +++ b/tests/regression_tests/mgxs_library_specific_nuclides/inputs_true.dat @@ -1,47 +1,47 @@ - - - - - - + + + + + + - - - - - - + + + + + + - - - - - + + + + + - - - - - - - - - + + + + + + + + + eigenvalue 100 10 5 - + -0.63 -0.63 -1 0.63 0.63 1 diff --git a/tests/regression_tests/mgxs_library_specific_nuclides/results_true.dat b/tests/regression_tests/mgxs_library_specific_nuclides/results_true.dat index eaf56b966..0c44eb132 100644 --- a/tests/regression_tests/mgxs_library_specific_nuclides/results_true.dat +++ b/tests/regression_tests/mgxs_library_specific_nuclides/results_true.dat @@ -1 +1 @@ -08d5c199c51496f86fdd739bf7ee0e143a9a159da0f4d364ec970557e5c1fc92a202d906dcae91812e665fd2e88dd7db1e4913ef6b91f456f23b52093c83f483 \ No newline at end of file +efcd9fd6be2ed6c98bbe5279cbacdb287597fcbbc4ed49e164b07e0861f28877b1bef2ad82d70fdac95965f7ed0d0990f77c8545718836b1b55a16b4243208d0 \ No newline at end of file diff --git a/tests/regression_tests/mgxs_library_specific_nuclides/test.py b/tests/regression_tests/mgxs_library_specific_nuclides/test.py index 61910e539..0ccbb83bd 100644 --- a/tests/regression_tests/mgxs_library_specific_nuclides/test.py +++ b/tests/regression_tests/mgxs_library_specific_nuclides/test.py @@ -37,7 +37,7 @@ class MGXSTestHarness(PyAPITestHarness): self.mgxs_lib.build_library() # Add tallies - self.mgxs_lib.add_to_tallies_file(self._model.tallies, merge=True) + self.mgxs_lib.add_to_tallies(self._model.tallies, merge=True) def _get_results(self, hash_output=True): """Digest info in the statepoint and return as a string.""" diff --git a/tests/regression_tests/microxs/test.py b/tests/regression_tests/microxs/test.py index a35150a1b..70833bb39 100644 --- a/tests/regression_tests/microxs/test.py +++ b/tests/regression_tests/microxs/test.py @@ -13,55 +13,56 @@ CHAIN_FILE = Path(__file__).parents[2] / "chain_simple.xml" @pytest.fixture(scope="module") def model(): fuel = openmc.Material(name="uo2") - fuel.add_element("U", 1, percent_type="ao", enrichment=4.25) - fuel.add_element("O", 2) + fuel.add_nuclide("U235", 1.0) + fuel.add_nuclide("O16", 2.0) fuel.set_density("g/cc", 10.4) - clad = openmc.Material(name="clad") - clad.add_element("Zr", 1) - clad.set_density("g/cc", 6) - - water = openmc.Material(name="water") - water.add_element("O", 1) - water.add_element("H", 2) - water.set_density("g/cc", 1.0) - water.add_s_alpha_beta("c_H_in_H2O") - - radii = [0.42, 0.45] - fuel.volume = np.pi * radii[0] ** 2 - - materials = openmc.Materials([fuel, clad, water]) - - pin_surfaces = [openmc.ZCylinder(r=r) for r in radii] - pin_univ = openmc.model.pin(pin_surfaces, materials) - bound_box = openmc.model.RectangularPrism(1.24, 1.24, boundary_type="reflective") - root_cell = openmc.Cell(fill=pin_univ, region=-bound_box) - geometry = openmc.Geometry([root_cell]) + sphere = openmc.Sphere(r=10.0, boundary_type='vacuum') + cell = openmc.Cell(region=-sphere, fill=fuel) + geometry = openmc.Geometry([cell]) settings = openmc.Settings() settings.particles = 1000 settings.inactive = 5 settings.batches = 10 - return openmc.Model(geometry, materials, settings) + return openmc.Model(geometry, settings=settings) -@pytest.mark.parametrize("domain_type", ["materials", "mesh"]) -def test_from_model(model, domain_type): +@pytest.mark.parametrize( + "domain_type, rr_mode", + [ + ("materials", "direct"), + ("materials", "flux"), + ("mesh", "direct"), + ("mesh", "flux"), + ] +) +def test_from_model(model, domain_type, rr_mode): if domain_type == 'materials': - domains = model.materials[:1] + domains = list(model.geometry.get_all_materials().values()) elif domain_type == 'mesh': mesh = openmc.RegularMesh() - mesh.lower_left = (-0.62, -0.62) - mesh.upper_right = (0.62, 0.62) - mesh.dimension = (3, 3) + mesh.lower_left = (-10., -10.) + mesh.upper_right = (10., 10.) + mesh.dimension = (1, 1) domains = mesh - nuclides = ['U234', 'U235', 'U238', 'U236', 'O16', 'O17', 'I135', 'Xe135', - 'Xe136', 'Cs135', 'Gd157', 'Gd156'] - _, test_xs = get_microxs_and_flux(model, domains, nuclides, chain_file=CHAIN_FILE) + nuclides = ['U235', 'O16', 'Xe135'] + kwargs = { + 'reaction_rate_mode': rr_mode, + 'chain_file': CHAIN_FILE, + 'path_statepoint': 'neutron_transport.h5', + } + if rr_mode == 'flux': + kwargs['energies'] = 'CASMO-40' + _, test_xs = get_microxs_and_flux(model, domains, nuclides, **kwargs) if config['update']: - test_xs[0].to_csv(f'test_reference_{domain_type}.csv') - - ref_xs = MicroXS.from_csv(f'test_reference_{domain_type}.csv') + test_xs[0].to_csv(f'test_reference_{domain_type}_{rr_mode}.csv') + # Make sure results match reference results + ref_xs = MicroXS.from_csv(f'test_reference_{domain_type}_{rr_mode}.csv') np.testing.assert_allclose(test_xs[0].data, ref_xs.data, rtol=1e-11) + + # Make sure statepoint file was saved + assert Path('neutron_transport.h5').exists() + Path('neutron_transport.h5').unlink() diff --git a/tests/regression_tests/microxs/test_reference_materials.csv b/tests/regression_tests/microxs/test_reference_materials.csv deleted file mode 100644 index 3e679f980..000000000 --- a/tests/regression_tests/microxs/test_reference_materials.csv +++ /dev/null @@ -1,25 +0,0 @@ -nuclides,reactions,groups,xs -U234,"(n,gamma)",1,21.418670317831076 -U234,fission,1,0.5014588470882162 -U235,"(n,gamma)",1,10.343944102483215 -U235,fission,1,47.46718472611895 -U238,"(n,gamma)",1,0.8741166723597229 -U238,fission,1,0.10829568455139067 -U236,"(n,gamma)",1,9.08348678468935 -U236,fission,1,0.3325287927011424 -O16,"(n,gamma)",1,7.548646353912426e-05 -O16,fission,1,0.0 -O17,"(n,gamma)",1,0.00040184862213103105 -O17,fission,1,0.0 -I135,"(n,gamma)",1,6.691256508942912 -I135,fission,1,0.0 -Xe135,"(n,gamma)",1,223998.6418566729 -Xe135,fission,1,0.0 -Xe136,"(n,gamma)",1,0.022934362666193503 -Xe136,fission,1,0.0 -Cs135,"(n,gamma)",1,2.2845395222353204 -Cs135,fission,1,0.0 -Gd157,"(n,gamma)",1,12582.07962003624 -Gd157,fission,1,0.0 -Gd156,"(n,gamma)",1,2.942112751533234 -Gd156,fission,1,0.0 diff --git a/tests/regression_tests/microxs/test_reference_materials_direct.csv b/tests/regression_tests/microxs/test_reference_materials_direct.csv new file mode 100644 index 000000000..4a63fed85 --- /dev/null +++ b/tests/regression_tests/microxs/test_reference_materials_direct.csv @@ -0,0 +1,7 @@ +nuclides,reactions,groups,xs +U235,"(n,gamma)",1,0.1475718536187164 +U235,fission,1,1.2504996049257149 +O16,"(n,gamma)",1,0.00010981236259441559 +O16,fission,1,0.0 +Xe135,"(n,gamma)",1,0.014570546772870611 +Xe135,fission,1,0.0 diff --git a/tests/regression_tests/microxs/test_reference_materials_flux.csv b/tests/regression_tests/microxs/test_reference_materials_flux.csv new file mode 100644 index 000000000..5eb29902e --- /dev/null +++ b/tests/regression_tests/microxs/test_reference_materials_flux.csv @@ -0,0 +1,7 @@ +nuclides,reactions,groups,xs +U235,"(n,gamma)",1,0.15003016703758473 +U235,fission,1,1.2646269005413537 +O16,"(n,gamma)",1,0.00012069778439640301 +O16,fission,1,0.0 +Xe135,"(n,gamma)",1,0.014820264774863562 +Xe135,fission,1,0.0 diff --git a/tests/regression_tests/microxs/test_reference_mesh.csv b/tests/regression_tests/microxs/test_reference_mesh.csv deleted file mode 100644 index 1882372b1..000000000 --- a/tests/regression_tests/microxs/test_reference_mesh.csv +++ /dev/null @@ -1,25 +0,0 @@ -nuclides,reactions,groups,xs -U234,"(n,gamma)",1,27.027171724208227 -U234,fission,1,0.04333740860093498 -U235,"(n,gamma)",1,12.683875995776193 -U235,fission,1,4.2596665957162605 -U238,"(n,gamma)",1,4.479719141496804 -U238,fission,1,0.009460665924409056 -U236,"(n,gamma)",1,8.469286849810802 -U236,fission,1,0.027373590840715795 -O16,"(n,gamma)",1,7.478160204479271e-05 -O16,fission,1,0.0 -O17,"(n,gamma)",1,0.0004743959164164789 -O17,fission,1,0.0 -I135,"(n,gamma)",1,8.33959524761822 -I135,fission,1,0.0 -Xe135,"(n,gamma)",1,282068.447252079 -Xe135,fission,1,0.0 -Xe136,"(n,gamma)",1,0.02888928065916194 -Xe136,fission,1,0.0 -Cs135,"(n,gamma)",1,2.5863526577468408 -Cs135,fission,1,0.0 -Gd157,"(n,gamma)",1,16518.24083307153 -Gd157,fission,1,0.0 -Gd156,"(n,gamma)",1,2.838514589417232 -Gd156,fission,1,0.0 diff --git a/tests/regression_tests/microxs/test_reference_mesh_direct.csv b/tests/regression_tests/microxs/test_reference_mesh_direct.csv new file mode 100644 index 000000000..60160ee51 --- /dev/null +++ b/tests/regression_tests/microxs/test_reference_mesh_direct.csv @@ -0,0 +1,7 @@ +nuclides,reactions,groups,xs +U235,"(n,gamma)",1,0.14757185361871633 +U235,fission,1,1.2504996049257142 +O16,"(n,gamma)",1,0.0001098123625944155 +O16,fission,1,0.0 +Xe135,"(n,gamma)",1,0.0145705467728706 +Xe135,fission,1,0.0 diff --git a/tests/regression_tests/microxs/test_reference_mesh_flux.csv b/tests/regression_tests/microxs/test_reference_mesh_flux.csv new file mode 100644 index 000000000..5eb29902e --- /dev/null +++ b/tests/regression_tests/microxs/test_reference_mesh_flux.csv @@ -0,0 +1,7 @@ +nuclides,reactions,groups,xs +U235,"(n,gamma)",1,0.15003016703758473 +U235,fission,1,1.2646269005413537 +O16,"(n,gamma)",1,0.00012069778439640301 +O16,fission,1,0.0 +Xe135,"(n,gamma)",1,0.014820264774863562 +Xe135,fission,1,0.0 diff --git a/tests/regression_tests/model_xml/adj_cell_rotation_inputs_true.dat b/tests/regression_tests/model_xml/adj_cell_rotation_inputs_true.dat index 7e2a0cf62..18c0552ce 100644 --- a/tests/regression_tests/model_xml/adj_cell_rotation_inputs_true.dat +++ b/tests/regression_tests/model_xml/adj_cell_rotation_inputs_true.dat @@ -1,35 +1,35 @@ - - - + + + - - + + - - - - - - - - - - + + + + + + + + + + eigenvalue 10000 10 5 - + -4.0 -4.0 -4.0 4.0 4.0 4.0 diff --git a/tests/regression_tests/model_xml/energy_laws_inputs_true.dat b/tests/regression_tests/model_xml/energy_laws_inputs_true.dat index 4d8e825d1..8c5191217 100644 --- a/tests/regression_tests/model_xml/energy_laws_inputs_true.dat +++ b/tests/regression_tests/model_xml/energy_laws_inputs_true.dat @@ -1,18 +1,18 @@ - - - - - - - + + + + + + + - + eigenvalue diff --git a/tests/regression_tests/model_xml/lattice_multiple_inputs_true.dat b/tests/regression_tests/model_xml/lattice_multiple_inputs_true.dat index b249d97c4..06abef582 100644 --- a/tests/regression_tests/model_xml/lattice_multiple_inputs_true.dat +++ b/tests/regression_tests/model_xml/lattice_multiple_inputs_true.dat @@ -1,15 +1,15 @@ - - - - + + + + - - - + + + @@ -18,8 +18,8 @@ - - + + 1.2 1.2 1 @@ -37,12 +37,12 @@ 4 4 4 4 - - - - - - + + + + + + eigenvalue diff --git a/tests/regression_tests/model_xml/photon_production_inputs_true.dat b/tests/regression_tests/model_xml/photon_production_inputs_true.dat index 10f0bad98..07eebaa3e 100644 --- a/tests/regression_tests/model_xml/photon_production_inputs_true.dat +++ b/tests/regression_tests/model_xml/photon_production_inputs_true.dat @@ -2,28 +2,28 @@ - - + + - - - - + + + + fixed source 10000 1 - + 0 0 0 - + 14000000.0 1.0 diff --git a/tests/regression_tests/multipole/inputs_true.dat b/tests/regression_tests/multipole/inputs_true.dat index 7bea66930..22a351240 100644 --- a/tests/regression_tests/multipole/inputs_true.dat +++ b/tests/regression_tests/multipole/inputs_true.dat @@ -2,21 +2,21 @@ - - - + + + - - - + + + - + 2.0 2.0 1 @@ -26,18 +26,18 @@ 11 11 11 11 - - - - - + + + + + eigenvalue 1000 5 0 - + -1 -1 -1 1 1 1 diff --git a/tests/regression_tests/multipole/results_true.dat b/tests/regression_tests/multipole/results_true.dat index 8e82655ce..40b42b1a0 100644 --- a/tests/regression_tests/multipole/results_true.dat +++ b/tests/regression_tests/multipole/results_true.dat @@ -1,36 +1,36 @@ k-combined: -1.354889E+00 8.437211E-03 +1.315804E+00 7.070811E-02 tally 1: -3.869969E+00 -3.000421E+00 -2.800393E+00 -1.570851E+00 -5.399091E-01 -5.842233E-02 -4.577147E-01 -4.203362E-02 +3.840178E+00 +2.953217E+00 +2.769369E+00 +1.535605E+00 +5.400560E-01 +5.840168E-02 +4.595308E-01 +4.237758E-02 0.000000E+00 0.000000E+00 -2.286465E+01 -1.045869E+02 +2.283789E+01 +1.044032E+02 0.000000E+00 0.000000E+00 -6.971793E-04 -9.724819E-08 -2.283955E+01 -1.043576E+02 -4.659256E-06 -2.170865E-11 -3.663230E+02 -2.685383E+04 -2.800393E+00 -1.570851E+00 -2.204999E+00 -9.728014E-01 -3.612213E+02 -2.611152E+04 -4.659256E-06 -2.170865E-11 +6.960971E-04 +9.704386E-08 +2.281620E+01 +1.042051E+02 +3.667073E-05 +1.048567E-09 +3.655557E+02 +2.676173E+04 +2.769369E+00 +1.535605E+00 +2.199058E+00 +9.681253E-01 +3.604950E+02 +2.602657E+04 +3.667073E-05 +1.048567E-09 Cell ID = 11 Name = @@ -38,5 +38,6 @@ Cell Region = -1 Rotation = None Temperature = [500. 700. 0. 800.] + Density = None Translation = None Volume = None diff --git a/tests/regression_tests/ncrystal/inputs_true.dat b/tests/regression_tests/ncrystal/inputs_true.dat index ecbc3c54f..81ee2e312 100644 --- a/tests/regression_tests/ncrystal/inputs_true.dat +++ b/tests/regression_tests/ncrystal/inputs_true.dat @@ -1,26 +1,26 @@ - - - + + + - - + + fixed source 100000 10 - + 0 0 -20 - + 0.012 1.0 diff --git a/tests/regression_tests/output/results_true.dat b/tests/regression_tests/output/results_true.dat index bbf03de94..97b997ae6 100644 --- a/tests/regression_tests/output/results_true.dat +++ b/tests/regression_tests/output/results_true.dat @@ -1,2 +1,2 @@ k-combined: -3.070134E-01 3.900396E-03 +2.940336E-01 7.338463E-04 diff --git a/tests/regression_tests/particle_restart_eigval/results_true.dat b/tests/regression_tests/particle_restart_eigval/results_true.dat index bd81920ca..3feeb5e74 100644 --- a/tests/regression_tests/particle_restart_eigval/results_true.dat +++ b/tests/regression_tests/particle_restart_eigval/results_true.dat @@ -1,16 +1,16 @@ current batch: -1.100000E+01 +8.000000E+00 current generation: 1.000000E+00 particle id: -2.540000E+02 +6.000000E+01 run mode: eigenvalue particle weight: 1.000000E+00 particle energy: -2.220048E+06 +2.028153E+06 particle xyz: --4.820850E+01 2.432936E+01 4.397668E+01 +-3.678172E+01 -6.073321E+01 2.756488E+01 particle uvw: --3.148565E-01 9.184190E-01 2.395245E-01 +-3.284774E-01 -8.920284E-01 3.104639E-01 diff --git a/tests/regression_tests/particle_restart_eigval/settings.xml b/tests/regression_tests/particle_restart_eigval/settings.xml index 64b1a4dd4..de580e4c4 100644 --- a/tests/regression_tests/particle_restart_eigval/settings.xml +++ b/tests/regression_tests/particle_restart_eigval/settings.xml @@ -6,7 +6,7 @@ 12 5 1200 - + 1000000 -10 -10 -5 10 10 5 diff --git a/tests/regression_tests/particle_restart_eigval/test.py b/tests/regression_tests/particle_restart_eigval/test.py index f9d22edb8..bad3f158c 100644 --- a/tests/regression_tests/particle_restart_eigval/test.py +++ b/tests/regression_tests/particle_restart_eigval/test.py @@ -2,5 +2,5 @@ from tests.testing_harness import ParticleRestartTestHarness def test_particle_restart_eigval(): - harness = ParticleRestartTestHarness('particle_11_254.h5') + harness = ParticleRestartTestHarness('particle_8_60.h5') harness.main() diff --git a/tests/regression_tests/periodic/inputs_true.dat b/tests/regression_tests/periodic/inputs_true.dat index 65e1b5ce3..9183db3c4 100644 --- a/tests/regression_tests/periodic/inputs_true.dat +++ b/tests/regression_tests/periodic/inputs_true.dat @@ -2,33 +2,33 @@ - - - + + + - - - + + + - - - - - - - + + + + + + + eigenvalue 1000 4 0 - + 0 0 0 5 5 0 diff --git a/tests/regression_tests/periodic/results_true.dat b/tests/regression_tests/periodic/results_true.dat index 2189597e1..626004b16 100644 --- a/tests/regression_tests/periodic/results_true.dat +++ b/tests/regression_tests/periodic/results_true.dat @@ -1,2 +1,2 @@ k-combined: -1.623300E+00 2.572983E-02 +1.624889E+00 1.108153E-02 diff --git a/tests/regression_tests/periodic_6fold/False-False/inputs_true.dat b/tests/regression_tests/periodic_6fold/False-False/inputs_true.dat new file mode 100644 index 000000000..075cffc12 --- /dev/null +++ b/tests/regression_tests/periodic_6fold/False-False/inputs_true.dat @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + eigenvalue + 1000 + 4 + 0 + + + 0 0 0 5 5 0 + + + + diff --git a/tests/regression_tests/periodic_6fold/False-False/results_true.dat b/tests/regression_tests/periodic_6fold/False-False/results_true.dat new file mode 100644 index 000000000..04aa30878 --- /dev/null +++ b/tests/regression_tests/periodic_6fold/False-False/results_true.dat @@ -0,0 +1,2 @@ +k-combined: +1.848492E+00 2.933785E-03 diff --git a/tests/regression_tests/periodic_6fold/False-True/inputs_true.dat b/tests/regression_tests/periodic_6fold/False-True/inputs_true.dat new file mode 100644 index 000000000..cbc1e9100 --- /dev/null +++ b/tests/regression_tests/periodic_6fold/False-True/inputs_true.dat @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + eigenvalue + 1000 + 4 + 0 + + + 0 0 0 5 5 0 + + + + diff --git a/tests/regression_tests/periodic_6fold/False-True/results_true.dat b/tests/regression_tests/periodic_6fold/False-True/results_true.dat new file mode 100644 index 000000000..04aa30878 --- /dev/null +++ b/tests/regression_tests/periodic_6fold/False-True/results_true.dat @@ -0,0 +1,2 @@ +k-combined: +1.848492E+00 2.933785E-03 diff --git a/tests/regression_tests/periodic_6fold/True-False/inputs_true.dat b/tests/regression_tests/periodic_6fold/True-False/inputs_true.dat new file mode 100644 index 000000000..675a8b300 --- /dev/null +++ b/tests/regression_tests/periodic_6fold/True-False/inputs_true.dat @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + eigenvalue + 1000 + 4 + 0 + + + 0 0 0 5 5 0 + + + + diff --git a/tests/regression_tests/periodic_6fold/True-False/results_true.dat b/tests/regression_tests/periodic_6fold/True-False/results_true.dat new file mode 100644 index 000000000..04aa30878 --- /dev/null +++ b/tests/regression_tests/periodic_6fold/True-False/results_true.dat @@ -0,0 +1,2 @@ +k-combined: +1.848492E+00 2.933785E-03 diff --git a/tests/regression_tests/periodic_6fold/True-True/inputs_true.dat b/tests/regression_tests/periodic_6fold/True-True/inputs_true.dat new file mode 100644 index 000000000..e5ac03b48 --- /dev/null +++ b/tests/regression_tests/periodic_6fold/True-True/inputs_true.dat @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + eigenvalue + 1000 + 4 + 0 + + + 0 0 0 5 5 0 + + + + diff --git a/tests/regression_tests/periodic_6fold/True-True/results_true.dat b/tests/regression_tests/periodic_6fold/True-True/results_true.dat new file mode 100644 index 000000000..04aa30878 --- /dev/null +++ b/tests/regression_tests/periodic_6fold/True-True/results_true.dat @@ -0,0 +1,2 @@ +k-combined: +1.848492E+00 2.933785E-03 diff --git a/tests/regression_tests/periodic_6fold/inputs_true.dat b/tests/regression_tests/periodic_6fold/inputs_true.dat deleted file mode 100644 index f7f413d09..000000000 --- a/tests/regression_tests/periodic_6fold/inputs_true.dat +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - eigenvalue - 1000 - 4 - 0 - - - 0 0 0 5 5 0 - - - - diff --git a/tests/regression_tests/periodic_6fold/results_true.dat b/tests/regression_tests/periodic_6fold/results_true.dat deleted file mode 100644 index e60182809..000000000 --- a/tests/regression_tests/periodic_6fold/results_true.dat +++ /dev/null @@ -1,2 +0,0 @@ -k-combined: -1.858730E+00 6.824588E-03 diff --git a/tests/regression_tests/periodic_6fold/test.py b/tests/regression_tests/periodic_6fold/test.py index 272c65df5..bded1c465 100644 --- a/tests/regression_tests/periodic_6fold/test.py +++ b/tests/regression_tests/periodic_6fold/test.py @@ -1,14 +1,16 @@ from math import sin, cos, pi import openmc +from openmc.utility_funcs import change_directory import pytest from tests.testing_harness import PyAPITestHarness -@pytest.fixture -def model(): - model = openmc.model.Model() +@pytest.mark.parametrize("flip1", [False, True]) +@pytest.mark.parametrize("flip2", [False, True]) +def test_periodic(flip1, flip2): + model = openmc.Model() # Define materials water = openmc.Material() @@ -27,31 +29,52 @@ def model(): # answers. theta1 = (-1/6 + 1/2) * pi theta2 = (1/6 - 1/2) * pi - plane1 = openmc.Plane(a=cos(theta1), b=sin(theta1), boundary_type='periodic') - plane2 = openmc.Plane(a=cos(theta2), b=sin(theta2), boundary_type='periodic') + if flip1: + plane1 = openmc.Plane(a=-cos(theta1), b=-sin(theta1), boundary_type='periodic') + else: + plane1 = openmc.Plane(a=cos(theta1), b=sin(theta1), boundary_type='periodic') + if flip2: + plane2 = openmc.Plane(a=-cos(theta2), b=-sin(theta2), boundary_type='periodic') + else: + plane2 = openmc.Plane(a=cos(theta2), b=sin(theta2), boundary_type='periodic') x_max = openmc.XPlane(5., boundary_type='reflective') z_cyl = openmc.ZCylinder(x0=3*cos(pi/6), y0=3*sin(pi/6), r=2.0) - outside_cyl = openmc.Cell(1, fill=water, region=( - +plane1 & +plane2 & -x_max & +z_cyl)) - inside_cyl = openmc.Cell(2, fill=fuel, region=( - +plane1 & +plane2 & -z_cyl)) + match (flip1, flip2): + case (False, False): + outside_cyl = openmc.Cell(1, fill=water, region=( + +plane1 & +plane2 & -x_max & +z_cyl)) + inside_cyl = openmc.Cell(2, fill=fuel, region=( + +plane1 & +plane2 & -z_cyl)) + case (False, True): + outside_cyl = openmc.Cell(1, fill=water, region=( + +plane1 & -plane2 & -x_max & +z_cyl)) + inside_cyl = openmc.Cell(2, fill=fuel, region=( + +plane1 & -plane2 & -z_cyl)) + case (True, False): + outside_cyl = openmc.Cell(1, fill=water, region=( + -plane1 & +plane2 & -x_max & +z_cyl)) + inside_cyl = openmc.Cell(2, fill=fuel, region=( + -plane1 & +plane2 & -z_cyl)) + case (True, True): + outside_cyl = openmc.Cell(1, fill=water, region=( + -plane1 & -plane2 & -x_max & +z_cyl)) + inside_cyl = openmc.Cell(2, fill=fuel, region=( + -plane1 & -plane2 & -z_cyl)) root_universe = openmc.Universe(0, cells=(outside_cyl, inside_cyl)) model.geometry = openmc.Geometry(root_universe) # Define settings - model.settings = openmc.Settings() model.settings.particles = 1000 model.settings.batches = 4 model.settings.inactive = 0 - model.settings.source = openmc.IndependentSource(space=openmc.stats.Box( - (0, 0, 0), (5, 5, 0)) + model.settings.source = openmc.IndependentSource( + space=openmc.stats.Box((0, 0, 0), (5, 5, 0)) ) - return model + with change_directory(f'{flip1}-{flip2}'): + harness = PyAPITestHarness('statepoint.4.h5', model) + harness.main() -def test_periodic(model): - harness = PyAPITestHarness('statepoint.4.h5', model) - harness.main() diff --git a/tests/regression_tests/periodic_cyls/__init__.py b/tests/regression_tests/periodic_cyls/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/regression_tests/periodic_cyls/test.py b/tests/regression_tests/periodic_cyls/test.py new file mode 100644 index 000000000..a341e3799 --- /dev/null +++ b/tests/regression_tests/periodic_cyls/test.py @@ -0,0 +1,91 @@ +import openmc +import numpy as np +import pytest +from openmc.utility_funcs import change_directory +from tests.testing_harness import PyAPITestHarness + + +@pytest.fixture +def xcyl_model(): + model = openmc.Model() + # Define materials + fuel = openmc.Material() + fuel.add_nuclide('U235', 0.2) + fuel.add_nuclide('U238', 0.8) + fuel.set_density('g/cc', 19.1) + model.materials = openmc.Materials([fuel]) + + # Define geometry + # finite cylinder + x_min = openmc.XPlane(x0=0.0, boundary_type='reflective') + x_max = openmc.XPlane(x0=20.0, boundary_type='reflective') + x_cyl = openmc.XCylinder(r=20.0,boundary_type='vacuum') + # slice cylinder for periodic BC + periodic_bounding_yplane = openmc.YPlane(y0=0, boundary_type='periodic') + periodic_bounding_plane = openmc.Plane( + a=0.0, b=-np.sqrt(3) / 3, c=1, boundary_type='periodic', + ) + sixth_cyl_cell = openmc.Cell(1, fill=fuel, region = + +x_min &- x_max & -x_cyl & +periodic_bounding_yplane & +periodic_bounding_plane) + periodic_bounding_yplane.periodic_surface = periodic_bounding_plane + periodic_bounding_plane.periodic_surface = periodic_bounding_yplane + + model.geometry = openmc.Geometry([sixth_cyl_cell]) + + + # Define settings + model.settings.particles = 1000 + model.settings.batches = 4 + model.settings.inactive = 0 + model.settings.source = openmc.IndependentSource(space=openmc.stats.Box( + (0, 0, 0), (20, 20, 20)) + ) + return model + +@pytest.fixture +def ycyl_model(): + model = openmc.Model() + # Define materials + fuel = openmc.Material() + fuel.add_nuclide('U235', 0.2) + fuel.add_nuclide('U238', 0.8) + fuel.set_density('g/cc', 19.1) + model.materials = openmc.Materials([fuel]) + + # Define geometry + # finite cylinder + y_min = openmc.YPlane(y0=0.0, boundary_type='reflective') + y_max = openmc.YPlane(y0=20.0, boundary_type='reflective') + y_cyl = openmc.YCylinder(r=20.0,boundary_type='vacuum') + # slice cylinder for periodic BC + periodic_bounding_xplane = openmc.XPlane(x0=0, boundary_type='periodic') + periodic_bounding_plane = openmc.Plane( + a=-np.sqrt(3) / 3, b=0.0, c=1, boundary_type='periodic', + ) + sixth_cyl_cell = openmc.Cell(1, fill=fuel, region = + +y_min &- y_max & -y_cyl & +periodic_bounding_xplane & +periodic_bounding_plane) + periodic_bounding_xplane.periodic_surface = periodic_bounding_plane + periodic_bounding_plane.periodic_surface = periodic_bounding_xplane + model.geometry = openmc.Geometry([sixth_cyl_cell]) + + + # Define settings + model.settings.particles = 1000 + model.settings.batches = 4 + model.settings.inactive = 0 + model.settings.source = openmc.IndependentSource(space=openmc.stats.Box( + (0, 0, 0), (20, 20, 20)) + ) + return model + +def test_xcyl(xcyl_model): + with change_directory("xcyl_model"): + openmc.reset_auto_ids() + harness = PyAPITestHarness('statepoint.4.h5', xcyl_model) + harness.main() + +def test_ycyl(ycyl_model): + with change_directory("ycyl_model"): + openmc.reset_auto_ids() + harness = PyAPITestHarness('statepoint.4.h5', ycyl_model) + harness.main() \ No newline at end of file diff --git a/tests/regression_tests/periodic_cyls/xcyl_model/inputs_true.dat b/tests/regression_tests/periodic_cyls/xcyl_model/inputs_true.dat new file mode 100644 index 000000000..7d1ecf426 --- /dev/null +++ b/tests/regression_tests/periodic_cyls/xcyl_model/inputs_true.dat @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + eigenvalue + 1000 + 4 + 0 + + + 0 0 0 20 20 20 + + + + diff --git a/tests/regression_tests/periodic_cyls/xcyl_model/results_true.dat b/tests/regression_tests/periodic_cyls/xcyl_model/results_true.dat new file mode 100644 index 000000000..c7e3eb670 --- /dev/null +++ b/tests/regression_tests/periodic_cyls/xcyl_model/results_true.dat @@ -0,0 +1,2 @@ +k-combined: +1.082283E+00 6.676373E-02 diff --git a/tests/regression_tests/periodic_cyls/ycyl_model/inputs_true.dat b/tests/regression_tests/periodic_cyls/ycyl_model/inputs_true.dat new file mode 100644 index 000000000..f3ca7e0f4 --- /dev/null +++ b/tests/regression_tests/periodic_cyls/ycyl_model/inputs_true.dat @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + eigenvalue + 1000 + 4 + 0 + + + 0 0 0 20 20 20 + + + + diff --git a/tests/regression_tests/periodic_cyls/ycyl_model/results_true.dat b/tests/regression_tests/periodic_cyls/ycyl_model/results_true.dat new file mode 100644 index 000000000..562467f2c --- /dev/null +++ b/tests/regression_tests/periodic_cyls/ycyl_model/results_true.dat @@ -0,0 +1,2 @@ +k-combined: +1.082652E+00 3.316031E-02 diff --git a/tests/regression_tests/periodic_hex/inputs_true.dat b/tests/regression_tests/periodic_hex/inputs_true.dat index 188c8dfa9..e65af3d94 100644 --- a/tests/regression_tests/periodic_hex/inputs_true.dat +++ b/tests/regression_tests/periodic_hex/inputs_true.dat @@ -1,19 +1,19 @@ - - - + + + - - - - - - + + + + + + eigenvalue diff --git a/tests/regression_tests/periodic_hex/results_true.dat b/tests/regression_tests/periodic_hex/results_true.dat index 584089a15..eff00b6e1 100644 --- a/tests/regression_tests/periodic_hex/results_true.dat +++ b/tests/regression_tests/periodic_hex/results_true.dat @@ -1,2 +1,2 @@ k-combined: -2.284468E+00 2.781588E-02 +2.285622E+00 2.576768E-03 diff --git a/tests/regression_tests/photon_production/inputs_true.dat b/tests/regression_tests/photon_production/inputs_true.dat index 10f0bad98..07eebaa3e 100644 --- a/tests/regression_tests/photon_production/inputs_true.dat +++ b/tests/regression_tests/photon_production/inputs_true.dat @@ -2,28 +2,28 @@ - - + + - - - - + + + + fixed source 10000 1 - + 0 0 0 - + 14000000.0 1.0 diff --git a/tests/regression_tests/photon_production/results_true.dat b/tests/regression_tests/photon_production/results_true.dat index 398deeed8..413f6f0ca 100644 --- a/tests/regression_tests/photon_production/results_true.dat +++ b/tests/regression_tests/photon_production/results_true.dat @@ -1,8 +1,8 @@ tally 1: 8.610000E-01 7.413210E-01 -9.493000E-01 -9.011705E-01 +9.491000E-01 +9.007908E-01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -16,12 +16,12 @@ tally 2: 1.573004E+00 4.296434E-04 1.845934E-07 -2.337049E-01 -5.461796E-02 +2.350047E-01 +5.522722E-02 0.000000E+00 0.000000E+00 -2.337049E-01 -5.461796E-02 +2.350047E-01 +5.522722E-02 0.000000E+00 0.000000E+00 0.000000E+00 @@ -53,40 +53,40 @@ tally 3: 4.104374E+12 4.296582E-04 1.846062E-07 -2.286000E-01 -5.225796E-02 -7.054033E+03 -4.975938E+07 +2.297000E-01 +5.276209E-02 +4.196651E+00 +1.761188E+01 0.000000E+00 0.000000E+00 -2.286000E-01 -5.225796E-02 -7.054033E+03 -4.975938E+07 +2.297000E-01 +5.276209E-02 +4.196651E+00 +1.761188E+01 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 +1.774484E+05 +3.148794E+10 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -0.000000E+00 -0.000000E+00 -1.764573E+05 -3.113718E+10 +1.774484E+05 +3.148794E+10 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 +1.474427E+04 +2.173936E+08 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -0.000000E+00 -0.000000E+00 -7.691658E+03 -5.916160E+07 +1.474427E+04 +2.173936E+08 0.000000E+00 0.000000E+00 tally 4: @@ -102,16 +102,16 @@ tally 4: 4.104374E+12 0.000000E+00 0.000000E+00 -2.286000E-01 -5.225796E-02 -7.054033E+03 -4.975938E+07 +2.297000E-01 +5.276209E-02 +4.196651E+00 +1.761188E+01 0.000000E+00 0.000000E+00 -2.286000E-01 -5.225796E-02 -7.054033E+03 -4.975938E+07 +2.297000E-01 +5.276209E-02 +4.196651E+00 +1.761188E+01 0.000000E+00 0.000000E+00 0.000000E+00 @@ -122,8 +122,8 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -1.764573E+05 -3.113718E+10 +1.774484E+05 +3.148794E+10 0.000000E+00 0.000000E+00 0.000000E+00 @@ -134,7 +134,7 @@ tally 4: 0.000000E+00 0.000000E+00 0.000000E+00 -7.691658E+03 -5.916160E+07 +1.474427E+04 +2.173936E+08 0.000000E+00 0.000000E+00 diff --git a/tests/regression_tests/photon_production_fission/inputs_true.dat b/tests/regression_tests/photon_production_fission/inputs_true.dat index fa379b39e..11a194e3c 100644 --- a/tests/regression_tests/photon_production_fission/inputs_true.dat +++ b/tests/regression_tests/photon_production_fission/inputs_true.dat @@ -1,21 +1,21 @@ - - - + + + - + eigenvalue 1000 5 2 - + 0 0 0 diff --git a/tests/regression_tests/photon_production_fission/results_true.dat b/tests/regression_tests/photon_production_fission/results_true.dat index 1aa08b147..af325d4b0 100644 --- a/tests/regression_tests/photon_production_fission/results_true.dat +++ b/tests/regression_tests/photon_production_fission/results_true.dat @@ -1,12 +1,12 @@ k-combined: -2.272421E+00 4.418825E-02 +2.297165E+00 1.955494E-02 tally 1: -2.665301E+00 -2.369839E+00 +2.696393E+00 +2.423937E+00 0.000000E+00 0.000000E+00 -2.665301E+00 -2.369839E+00 +2.696393E+00 +2.423937E+00 0.000000E+00 0.000000E+00 0.000000E+00 @@ -18,52 +18,52 @@ tally 1: 0.000000E+00 0.000000E+00 tally 2: -2.637532E+00 -2.320051E+00 -4.231377E+08 -5.971498E+16 +2.672029E+00 +2.380251E+00 +4.288244E+08 +6.130569E+16 0.000000E+00 0.000000E+00 -2.637532E+00 -2.320051E+00 -4.231377E+08 -5.971498E+16 +2.672029E+00 +2.380251E+00 +4.288244E+08 +6.130569E+16 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -2.448745E+06 -2.005297E+12 +1.711908E+05 +9.769096E+09 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -2.448745E+06 -2.005297E+12 +1.711908E+05 +9.769096E+09 0.000000E+00 0.000000E+00 tally 3: -2.660000E+00 -2.358558E+00 -4.231377E+08 -5.971498E+16 +2.649127E+00 +2.339294E+00 +4.288244E+08 +6.130569E+16 0.000000E+00 0.000000E+00 -2.660000E+00 -2.358558E+00 -4.231377E+08 -5.971498E+16 +2.649127E+00 +2.339294E+00 +4.288244E+08 +6.130569E+16 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -2.448745E+06 -2.005297E+12 +1.711908E+05 +9.769096E+09 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -2.448745E+06 -2.005297E+12 +1.711908E+05 +9.769096E+09 0.000000E+00 0.000000E+00 diff --git a/tests/regression_tests/photon_source/inputs_true.dat b/tests/regression_tests/photon_source/inputs_true.dat index 3d2e05243..adaa5fb42 100644 --- a/tests/regression_tests/photon_source/inputs_true.dat +++ b/tests/regression_tests/photon_source/inputs_true.dat @@ -2,22 +2,22 @@ - - - - - + + + + + - + fixed source 10000 1 - + 0 0 0 diff --git a/tests/regression_tests/photon_source/results_true.dat b/tests/regression_tests/photon_source/results_true.dat index fcc75cbca..8d934afc6 100644 --- a/tests/regression_tests/photon_source/results_true.dat +++ b/tests/regression_tests/photon_source/results_true.dat @@ -1,5 +1,5 @@ tally 1: -2.263938E+02 -5.125417E+04 +2.263761E+02 +5.124615E+04 0.000000E+00 0.000000E+00 diff --git a/tests/regression_tests/ptables_off/results_true.dat b/tests/regression_tests/ptables_off/results_true.dat index 1652088ce..374274862 100644 --- a/tests/regression_tests/ptables_off/results_true.dat +++ b/tests/regression_tests/ptables_off/results_true.dat @@ -1,2 +1,2 @@ k-combined: -2.978318E-01 1.560055E-03 +2.968228E-01 1.770320E-03 diff --git a/tests/regression_tests/pulse_height/inputs_true.dat b/tests/regression_tests/pulse_height/inputs_true.dat index 544ddb097..590928e43 100644 --- a/tests/regression_tests/pulse_height/inputs_true.dat +++ b/tests/regression_tests/pulse_height/inputs_true.dat @@ -2,22 +2,22 @@ - - - + + + - - - - + + + + fixed source 100 5 - + 0.0 0.0 0.0 diff --git a/tests/regression_tests/quadric_surfaces/results_true.dat b/tests/regression_tests/quadric_surfaces/results_true.dat index 382c4241e..6fb569f52 100644 --- a/tests/regression_tests/quadric_surfaces/results_true.dat +++ b/tests/regression_tests/quadric_surfaces/results_true.dat @@ -1,2 +1,2 @@ k-combined: -1.193830E+00 1.824184E-02 +1.216213E+00 2.789559E-02 diff --git a/tests/regression_tests/random_ray_adjoint_fixed_source/inputs_true.dat b/tests/regression_tests/random_ray_adjoint_fixed_source/inputs_true.dat index 65ffd5af7..0adfc5488 100644 --- a/tests/regression_tests/random_ray_adjoint_fixed_source/inputs_true.dat +++ b/tests/regression_tests/random_ray_adjoint_fixed_source/inputs_true.dat @@ -3,24 +3,24 @@ mgxs.h5 - + - + - + - - - - - + + + + + 2.5 2.5 2.5 12 12 12 @@ -182,19 +182,19 @@ 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - - - - - - + + + + + + fixed source 500 10 5 - + 100.0 1.0 @@ -207,13 +207,13 @@ 500.0 100.0 - + 0.0 0.0 0.0 30.0 30.0 30.0 - True - True + true + true naive diff --git a/tests/regression_tests/random_ray_adjoint_fixed_source/results_true.dat b/tests/regression_tests/random_ray_adjoint_fixed_source/results_true.dat index 7178e2f11..e9aa9015b 100644 --- a/tests/regression_tests/random_ray_adjoint_fixed_source/results_true.dat +++ b/tests/regression_tests/random_ray_adjoint_fixed_source/results_true.dat @@ -6,4 +6,4 @@ tally 2: 9.482551E+08 tally 3: 1.956327E+05 -7.654469E+09 +7.654468E+09 diff --git a/tests/regression_tests/random_ray_adjoint_k_eff/inputs_true.dat b/tests/regression_tests/random_ray_adjoint_k_eff/inputs_true.dat index 725702a49..073348c41 100644 --- a/tests/regression_tests/random_ray_adjoint_k_eff/inputs_true.dat +++ b/tests/regression_tests/random_ray_adjoint_k_eff/inputs_true.dat @@ -3,32 +3,32 @@ mgxs.h5 - + - + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + 0.126 0.126 10 10 @@ -53,23 +53,23 @@ 2 2 2 5 - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + eigenvalue @@ -80,13 +80,13 @@ 100.0 20.0 - + -1.26 -1.26 -1 1.26 1.26 1 - True - True + true + true diff --git a/tests/regression_tests/random_ray_adjoint_k_eff/results_true.dat b/tests/regression_tests/random_ray_adjoint_k_eff/results_true.dat index 657c841b5..dfef53cd2 100644 --- a/tests/regression_tests/random_ray_adjoint_k_eff/results_true.dat +++ b/tests/regression_tests/random_ray_adjoint_k_eff/results_true.dat @@ -1,171 +1,171 @@ k-combined: 1.006640E+00 1.812969E-03 tally 1: -6.684129E+00 -8.939821E+00 -2.685967E+00 -1.443592E+00 +1.208044E+00 +2.920182E-01 +4.854426E-01 +4.715453E-02 0.000000E+00 0.000000E+00 -6.358774E+00 -8.091444E+00 -9.687217E-01 -1.878029E-01 +1.149242E+00 +2.643067E-01 +1.750801E-01 +6.134563E-03 0.000000E+00 0.000000E+00 -5.963160E+00 -7.117108E+00 -1.932332E-01 -7.473914E-03 +1.077743E+00 +2.324814E-01 +3.492371E-02 +2.441363E-04 0.000000E+00 0.000000E+00 -5.137593E+00 -5.283310E+00 -1.714616E-01 -5.884834E-03 -1.086218E-06 -2.361752E-13 -4.857253E+00 -4.719856E+00 -5.689580E-02 -6.476286E-04 -2.989356E-03 -1.787808E-06 -4.830516E+00 -4.666801E+00 -7.203015E-03 -1.037676E-05 -3.620020E+00 -2.620927E+00 -5.161382E+00 -5.328124E+00 -6.786255E-02 -9.210763E-04 -5.531943E+00 -6.120553E+00 -5.414034E+00 -5.864661E+00 +9.285362E-01 +1.725808E-01 +3.098889E-02 +1.922297E-04 +1.963161E-07 +7.714727E-15 +8.778641E-01 +1.541719E-01 +1.028293E-02 +2.115448E-05 +5.402741E-04 +5.839789E-08 +8.730274E-01 +1.524358E-01 +1.301813E-03 +3.389450E-07 +6.542525E-01 +8.560964E-02 +9.328247E-01 +1.740366E-01 +1.226491E-02 +3.008584E-05 +9.997969E-01 +1.999204E-01 +9.784958E-01 +1.915688E-01 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -5.632338E+00 -6.347626E+00 +1.017952E+00 +2.073461E-01 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -5.682608E+00 -6.462382E+00 +1.027039E+00 +2.110955E-01 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -5.310716E+00 -5.645180E+00 +9.598240E-01 +1.844004E-01 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -4.945409E+00 -4.893171E+00 +8.937969E-01 +1.598332E-01 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -4.842688E+00 -4.690352E+00 +8.752275E-01 +1.532052E-01 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -5.117198E+00 -5.237280E+00 +9.248400E-01 +1.710699E-01 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -6.938711E+00 -9.633345E+00 -2.835258E+00 -1.608212E+00 +1.254054E+00 +3.146708E-01 +5.124223E-01 +5.253093E-02 0.000000E+00 0.000000E+00 -6.549505E+00 -8.584036E+00 -1.015138E+00 -2.061993E-01 +1.183712E+00 +2.803961E-01 +1.834683E-01 +6.735381E-03 0.000000E+00 0.000000E+00 -6.050651E+00 -7.327711E+00 -1.992816E-01 -7.948424E-03 +1.093555E+00 +2.393604E-01 +3.601678E-02 +2.596341E-04 0.000000E+00 0.000000E+00 -5.113981E+00 -5.234801E+00 -1.732323E-01 -6.006619E-03 -1.097435E-06 -2.410627E-13 -4.837033E+00 -4.680541E+00 -5.760042E-02 -6.637112E-04 -3.026377E-03 -1.832205E-06 -4.827049E+00 -4.660105E+00 -7.319913E-03 -1.071647E-05 -3.678770E+00 -2.706730E+00 -5.175337E+00 -5.356957E+00 -6.923046E-02 -9.586177E-04 -5.643451E+00 -6.370016E+00 -6.693323E+00 -8.964322E+00 -2.753307E+00 -1.516683E+00 +9.242694E-01 +1.709967E-01 +3.130894E-02 +1.962084E-04 +1.983437E-07 +7.874400E-15 +8.742100E-01 +1.528879E-01 +1.041026E-02 +2.167970E-05 +5.469644E-04 +5.984780E-08 +8.724009E-01 +1.522171E-01 +1.322938E-03 +3.500386E-07 +6.648691E-01 +8.841161E-02 +9.353464E-01 +1.749781E-01 +1.251209E-02 +3.131171E-05 +1.019947E+00 +2.080664E-01 +1.209708E+00 +2.928214E-01 +4.976146E-01 +4.954258E-02 0.000000E+00 0.000000E+00 -6.358384E+00 -8.090233E+00 -9.912008E-01 -1.965868E-01 +1.149174E+00 +2.642694E-01 +1.791431E-01 +6.421530E-03 0.000000E+00 0.000000E+00 -5.957484E+00 -7.103246E+00 -1.974033E-01 -7.798286E-03 +1.076718E+00 +2.320295E-01 +3.567737E-02 +2.547314E-04 0.000000E+00 0.000000E+00 -5.130744E+00 -5.268844E+00 -1.749233E-01 -6.123348E-03 -1.108148E-06 -2.457474E-13 -4.857340E+00 -4.720019E+00 -5.816659E-02 -6.768049E-04 -3.056125E-03 -1.868351E-06 -4.830629E+00 -4.667018E+00 -7.366289E-03 -1.085264E-05 -3.702077E+00 -2.741125E+00 -5.164864E+00 -5.335279E+00 -6.947917E-02 -9.655086E-04 -5.663725E+00 -6.415806E+00 +9.272977E-01 +1.721077E-01 +3.161443E-02 +2.000179E-04 +2.002789E-07 +8.027290E-15 +8.778794E-01 +1.541769E-01 +1.051257E-02 +2.210729E-05 +5.523400E-04 +6.102818E-08 +8.730477E-01 +1.524429E-01 +1.331320E-03 +3.544869E-07 +6.690816E-01 +8.953516E-02 +9.334544E-01 +1.742707E-01 +1.255707E-02 +3.153710E-05 +1.023613E+00 +2.095641E-01 diff --git a/tests/regression_tests/random_ray_auto_convert/__init__.py b/tests/regression_tests/random_ray_auto_convert/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/regression_tests/random_ray_auto_convert/infinite_medium/inputs_true.dat b/tests/regression_tests/random_ray_auto_convert/infinite_medium/inputs_true.dat new file mode 100644 index 000000000..464c89a5d --- /dev/null +++ b/tests/regression_tests/random_ray_auto_convert/infinite_medium/inputs_true.dat @@ -0,0 +1,64 @@ + + + + mgxs.h5 + + + + + + + + + + + + + + + + + + + + + + + + + + eigenvalue + 100 + 10 + 5 + + + -0.63 -0.63 -1 0.63 0.63 1 + + + true + + + multi-group + + + + -0.63 -0.63 -1.0 0.63 0.63 1.0 + + + 30.0 + 150.0 + + + + + + linear + + + 2 2 + -0.63 -0.63 + 0.63 0.63 + + + diff --git a/tests/regression_tests/random_ray_auto_convert/infinite_medium/results_true.dat b/tests/regression_tests/random_ray_auto_convert/infinite_medium/results_true.dat new file mode 100644 index 000000000..f984f3718 --- /dev/null +++ b/tests/regression_tests/random_ray_auto_convert/infinite_medium/results_true.dat @@ -0,0 +1,2 @@ +k-combined: +7.479770E-01 1.624548E-02 diff --git a/tests/regression_tests/random_ray_auto_convert/material_wise/inputs_true.dat b/tests/regression_tests/random_ray_auto_convert/material_wise/inputs_true.dat new file mode 100644 index 000000000..464c89a5d --- /dev/null +++ b/tests/regression_tests/random_ray_auto_convert/material_wise/inputs_true.dat @@ -0,0 +1,64 @@ + + + + mgxs.h5 + + + + + + + + + + + + + + + + + + + + + + + + + + eigenvalue + 100 + 10 + 5 + + + -0.63 -0.63 -1 0.63 0.63 1 + + + true + + + multi-group + + + + -0.63 -0.63 -1.0 0.63 0.63 1.0 + + + 30.0 + 150.0 + + + + + + linear + + + 2 2 + -0.63 -0.63 + 0.63 0.63 + + + diff --git a/tests/regression_tests/random_ray_auto_convert/material_wise/results_true.dat b/tests/regression_tests/random_ray_auto_convert/material_wise/results_true.dat new file mode 100644 index 000000000..3bade01e0 --- /dev/null +++ b/tests/regression_tests/random_ray_auto_convert/material_wise/results_true.dat @@ -0,0 +1,2 @@ +k-combined: +7.372542E-01 6.967831E-03 diff --git a/tests/regression_tests/random_ray_auto_convert/stochastic_slab/inputs_true.dat b/tests/regression_tests/random_ray_auto_convert/stochastic_slab/inputs_true.dat new file mode 100644 index 000000000..464c89a5d --- /dev/null +++ b/tests/regression_tests/random_ray_auto_convert/stochastic_slab/inputs_true.dat @@ -0,0 +1,64 @@ + + + + mgxs.h5 + + + + + + + + + + + + + + + + + + + + + + + + + + eigenvalue + 100 + 10 + 5 + + + -0.63 -0.63 -1 0.63 0.63 1 + + + true + + + multi-group + + + + -0.63 -0.63 -1.0 0.63 0.63 1.0 + + + 30.0 + 150.0 + + + + + + linear + + + 2 2 + -0.63 -0.63 + 0.63 0.63 + + + diff --git a/tests/regression_tests/random_ray_auto_convert/stochastic_slab/results_true.dat b/tests/regression_tests/random_ray_auto_convert/stochastic_slab/results_true.dat new file mode 100644 index 000000000..674dee4aa --- /dev/null +++ b/tests/regression_tests/random_ray_auto_convert/stochastic_slab/results_true.dat @@ -0,0 +1,2 @@ +k-combined: +6.413334E-01 2.083132E-02 diff --git a/tests/regression_tests/random_ray_auto_convert/test.py b/tests/regression_tests/random_ray_auto_convert/test.py new file mode 100644 index 000000000..99a931dce --- /dev/null +++ b/tests/regression_tests/random_ray_auto_convert/test.py @@ -0,0 +1,54 @@ +import os + +import openmc +from openmc.examples import pwr_pin_cell +from openmc import RegularMesh +from openmc.utility_funcs import change_directory +import pytest + +from tests.testing_harness import TolerantPyAPITestHarness + + +class MGXSTestHarness(TolerantPyAPITestHarness): + def _cleanup(self): + super()._cleanup() + f = 'mgxs.h5' + if os.path.exists(f): + os.remove(f) + + +@pytest.mark.parametrize("method", ["material_wise", "stochastic_slab", "infinite_medium"]) +def test_random_ray_auto_convert(method): + with change_directory(method): + openmc.reset_auto_ids() + + # Start with a normal continuous energy model + model = pwr_pin_cell() + + # Convert to a multi-group model + model.convert_to_multigroup( + method=method, groups='CASMO-2', nparticles=100, + overwrite_mgxs_library=False, mgxs_path="mgxs.h5" + ) + + # Convert to a random ray model + model.convert_to_random_ray() + + # Set the number of particles + model.settings.particles = 100 + + # Overlay a basic 2x2 mesh + n = 2 + mesh = RegularMesh() + mesh.dimension = (n, n) + bbox = model.geometry.bounding_box + mesh.lower_left = (bbox.lower_left[0], bbox.lower_left[1]) + mesh.upper_right = (bbox.upper_right[0], bbox.upper_right[1]) + model.settings.random_ray['source_region_meshes'] = [ + (mesh, [model.geometry.root_universe])] + + # Set the source shape to linear + model.settings.random_ray['source_shape'] = 'linear' + + harness = MGXSTestHarness('statepoint.10.h5', model) + harness.main() diff --git a/tests/regression_tests/random_ray_auto_convert_source_energy/__init__.py b/tests/regression_tests/random_ray_auto_convert_source_energy/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/regression_tests/random_ray_auto_convert_source_energy/infinite_medium/model/inputs_true.dat b/tests/regression_tests/random_ray_auto_convert_source_energy/infinite_medium/model/inputs_true.dat new file mode 100644 index 000000000..80a166c67 --- /dev/null +++ b/tests/regression_tests/random_ray_auto_convert_source_energy/infinite_medium/model/inputs_true.dat @@ -0,0 +1,61 @@ + + + + mgxs.h5 + + + + + + + + + + + + + + + + + + + + + + + + + + eigenvalue + 100 + 10 + 5 + + + 7000000.0 1.0 + + + multi-group + + + + -0.63 -0.63 -1.0 0.63 0.63 1.0 + + + 30.0 + 150.0 + + + + + + linear + + + 2 2 + -0.63 -0.63 + 0.63 0.63 + + + diff --git a/tests/regression_tests/random_ray_auto_convert_source_energy/infinite_medium/model/results_true.dat b/tests/regression_tests/random_ray_auto_convert_source_energy/infinite_medium/model/results_true.dat new file mode 100644 index 000000000..1fb09fd68 --- /dev/null +++ b/tests/regression_tests/random_ray_auto_convert_source_energy/infinite_medium/model/results_true.dat @@ -0,0 +1,2 @@ +k-combined: +7.657815E-01 2.317564E-02 diff --git a/tests/regression_tests/random_ray_auto_convert_source_energy/infinite_medium/user/inputs_true.dat b/tests/regression_tests/random_ray_auto_convert_source_energy/infinite_medium/user/inputs_true.dat new file mode 100644 index 000000000..464c89a5d --- /dev/null +++ b/tests/regression_tests/random_ray_auto_convert_source_energy/infinite_medium/user/inputs_true.dat @@ -0,0 +1,64 @@ + + + + mgxs.h5 + + + + + + + + + + + + + + + + + + + + + + + + + + eigenvalue + 100 + 10 + 5 + + + -0.63 -0.63 -1 0.63 0.63 1 + + + true + + + multi-group + + + + -0.63 -0.63 -1.0 0.63 0.63 1.0 + + + 30.0 + 150.0 + + + + + + linear + + + 2 2 + -0.63 -0.63 + 0.63 0.63 + + + diff --git a/tests/regression_tests/random_ray_auto_convert_source_energy/infinite_medium/user/results_true.dat b/tests/regression_tests/random_ray_auto_convert_source_energy/infinite_medium/user/results_true.dat new file mode 100644 index 000000000..073c5c99f --- /dev/null +++ b/tests/regression_tests/random_ray_auto_convert_source_energy/infinite_medium/user/results_true.dat @@ -0,0 +1,2 @@ +k-combined: +7.827784E-01 2.062954E-02 diff --git a/tests/regression_tests/random_ray_auto_convert_source_energy/stochastic_slab/model/inputs_true.dat b/tests/regression_tests/random_ray_auto_convert_source_energy/stochastic_slab/model/inputs_true.dat new file mode 100644 index 000000000..80a166c67 --- /dev/null +++ b/tests/regression_tests/random_ray_auto_convert_source_energy/stochastic_slab/model/inputs_true.dat @@ -0,0 +1,61 @@ + + + + mgxs.h5 + + + + + + + + + + + + + + + + + + + + + + + + + + eigenvalue + 100 + 10 + 5 + + + 7000000.0 1.0 + + + multi-group + + + + -0.63 -0.63 -1.0 0.63 0.63 1.0 + + + 30.0 + 150.0 + + + + + + linear + + + 2 2 + -0.63 -0.63 + 0.63 0.63 + + + diff --git a/tests/regression_tests/random_ray_auto_convert_source_energy/stochastic_slab/model/results_true.dat b/tests/regression_tests/random_ray_auto_convert_source_energy/stochastic_slab/model/results_true.dat new file mode 100644 index 000000000..c5cdf8e29 --- /dev/null +++ b/tests/regression_tests/random_ray_auto_convert_source_energy/stochastic_slab/model/results_true.dat @@ -0,0 +1,2 @@ +k-combined: +7.479571E-01 2.398563E-02 diff --git a/tests/regression_tests/random_ray_auto_convert_source_energy/stochastic_slab/user/inputs_true.dat b/tests/regression_tests/random_ray_auto_convert_source_energy/stochastic_slab/user/inputs_true.dat new file mode 100644 index 000000000..464c89a5d --- /dev/null +++ b/tests/regression_tests/random_ray_auto_convert_source_energy/stochastic_slab/user/inputs_true.dat @@ -0,0 +1,64 @@ + + + + mgxs.h5 + + + + + + + + + + + + + + + + + + + + + + + + + + eigenvalue + 100 + 10 + 5 + + + -0.63 -0.63 -1 0.63 0.63 1 + + + true + + + multi-group + + + + -0.63 -0.63 -1.0 0.63 0.63 1.0 + + + 30.0 + 150.0 + + + + + + linear + + + 2 2 + -0.63 -0.63 + 0.63 0.63 + + + diff --git a/tests/regression_tests/random_ray_auto_convert_source_energy/stochastic_slab/user/results_true.dat b/tests/regression_tests/random_ray_auto_convert_source_energy/stochastic_slab/user/results_true.dat new file mode 100644 index 000000000..c6cce2e39 --- /dev/null +++ b/tests/regression_tests/random_ray_auto_convert_source_energy/stochastic_slab/user/results_true.dat @@ -0,0 +1,2 @@ +k-combined: +7.620306E-01 2.175179E-02 diff --git a/tests/regression_tests/random_ray_auto_convert_source_energy/test.py b/tests/regression_tests/random_ray_auto_convert_source_energy/test.py new file mode 100644 index 000000000..bb9119d89 --- /dev/null +++ b/tests/regression_tests/random_ray_auto_convert_source_energy/test.py @@ -0,0 +1,66 @@ +import os + +import openmc +from openmc.examples import pwr_pin_cell +from openmc import RegularMesh +from openmc.utility_funcs import change_directory +import pytest + +from tests.testing_harness import TolerantPyAPITestHarness + + +class MGXSTestHarness(TolerantPyAPITestHarness): + def _cleanup(self): + super()._cleanup() + f = 'mgxs.h5' + if os.path.exists(f): + os.remove(f) + + +@pytest.mark.parametrize("source_type", ["model", "user"]) +@pytest.mark.parametrize("method", ["stochastic_slab", "infinite_medium"]) +def test_random_ray_auto_convert_source_energy(method, source_type): + dirname = f"{method}/{source_type}" + with change_directory(dirname): + openmc.reset_auto_ids() + + # Start with a normal continuous energy model + model = pwr_pin_cell() + + # Define the source energy distribution, using different methods + source_energy = None + if source_type == "model": + model.settings.source = openmc.IndependentSource( + energy=openmc.stats.delta_function(7.0e6) + ) + elif source_type == "user": + source_energy = openmc.stats.delta_function(1.0e4) + + # Convert to a multi-group model + model.convert_to_multigroup( + method=method, groups='CASMO-8', nparticles=100, + overwrite_mgxs_library=False, mgxs_path="mgxs.h5", + source_energy=source_energy + ) + + # Convert to a random ray model + model.convert_to_random_ray() + + # Set the number of particles + model.settings.particles = 100 + + # Overlay a basic 2x2 mesh + n = 2 + mesh = RegularMesh() + mesh.dimension = (n, n) + bbox = model.geometry.bounding_box + mesh.lower_left = (bbox.lower_left[0], bbox.lower_left[1]) + mesh.upper_right = (bbox.upper_right[0], bbox.upper_right[1]) + model.settings.random_ray['source_region_meshes'] = [ + (mesh, [model.geometry.root_universe])] + + # Set the source shape to linear + model.settings.random_ray['source_shape'] = 'linear' + + harness = MGXSTestHarness('statepoint.10.h5', model) + harness.main() diff --git a/tests/regression_tests/random_ray_diagonal_stabilization/__init__.py b/tests/regression_tests/random_ray_diagonal_stabilization/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/regression_tests/random_ray_diagonal_stabilization/inputs_true.dat b/tests/regression_tests/random_ray_diagonal_stabilization/inputs_true.dat new file mode 100644 index 000000000..47325ebd7 --- /dev/null +++ b/tests/regression_tests/random_ray_diagonal_stabilization/inputs_true.dat @@ -0,0 +1,65 @@ + + + + mgxs.h5 + + + + + + + + + + + + + + + + + + + + + + + + + + eigenvalue + 100 + 20 + 15 + + + -0.63 -0.63 -1 0.63 0.63 1 + + + true + + + multi-group + + + + -0.63 -0.63 -1.0 0.63 0.63 1.0 + + + 30.0 + 150.0 + + + + + + linear + 0.5 + + + 2 2 + -0.63 -0.63 + 0.63 0.63 + + + diff --git a/tests/regression_tests/random_ray_diagonal_stabilization/results_true.dat b/tests/regression_tests/random_ray_diagonal_stabilization/results_true.dat new file mode 100644 index 000000000..034d7f7c6 --- /dev/null +++ b/tests/regression_tests/random_ray_diagonal_stabilization/results_true.dat @@ -0,0 +1,2 @@ +k-combined: +7.134473E-01 1.422763E-02 diff --git a/tests/regression_tests/random_ray_diagonal_stabilization/test.py b/tests/regression_tests/random_ray_diagonal_stabilization/test.py new file mode 100644 index 000000000..8d36e1d25 --- /dev/null +++ b/tests/regression_tests/random_ray_diagonal_stabilization/test.py @@ -0,0 +1,61 @@ +import os + +from openmc.examples import pwr_pin_cell +from openmc import RegularMesh + +from tests.testing_harness import TolerantPyAPITestHarness + + +class MGXSTestHarness(TolerantPyAPITestHarness): + def _cleanup(self): + super()._cleanup() + f = 'mgxs.h5' + if os.path.exists(f): + os.remove(f) + + +def test_random_ray_diagonal_stabilization(): + # Start with a normal continuous energy model + model = pwr_pin_cell() + + # Convert to a multi-group model, with 70 group XS + # and transport correction enabled. This will generate + # MGXS data with some negatives on the diagonal, in order + # to trigger diagonal correction. + model.convert_to_multigroup( + method='material_wise', groups='CASMO-70', nparticles=13, + overwrite_mgxs_library=True, mgxs_path="mgxs.h5", correction='P0' + ) + + # Convert to a random ray model + model.convert_to_random_ray() + + # Set the number of particles + model.settings.particles = 100 + + # Overlay a basic 2x2 mesh + n = 2 + mesh = RegularMesh() + mesh.dimension = (n, n) + bbox = model.geometry.bounding_box + mesh.lower_left = (bbox.lower_left[0], bbox.lower_left[1]) + mesh.upper_right = (bbox.upper_right[0], bbox.upper_right[1]) + model.settings.random_ray['source_region_meshes'] = [ + (mesh, [model.geometry.root_universe])] + + # Set the source shape to linear + model.settings.random_ray['source_shape'] = 'linear' + + # Explicitly set the diagonal stabilization rho (default is otherwise 1.0). + # Note that if we set this to 0.0 (thus distabling stabilization), the + # problem should fail due to instability, so this is actually a good test + # problem. + model.settings.random_ray['diagonal_stabilization_rho'] = 0.5 + + # If rho was 0.0, the instability would cause failure after iteration 14, + # so we go a little past that. + model.settings.inactive = 15 + model.settings.batches = 20 + + harness = MGXSTestHarness('statepoint.20.h5', model) + harness.main() diff --git a/tests/regression_tests/random_ray_fixed_source_domain/cell/inputs_true.dat b/tests/regression_tests/random_ray_fixed_source_domain/cell/inputs_true.dat index d6ca8918c..9f1987f3a 100644 --- a/tests/regression_tests/random_ray_fixed_source_domain/cell/inputs_true.dat +++ b/tests/regression_tests/random_ray_fixed_source_domain/cell/inputs_true.dat @@ -3,24 +3,24 @@ mgxs.h5 - + - + - + - - - - - + + + + + 2.5 2.5 2.5 12 12 12 @@ -182,19 +182,19 @@ 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - - - - - - + + + + + + fixed source 90 10 5 - + 100.0 1.0 @@ -207,12 +207,12 @@ 500.0 100.0 - + 0.0 0.0 0.0 30.0 30.0 30.0 - True + true diff --git a/tests/regression_tests/random_ray_fixed_source_domain/material/inputs_true.dat b/tests/regression_tests/random_ray_fixed_source_domain/material/inputs_true.dat index 7fae491ae..b4f57dbfa 100644 --- a/tests/regression_tests/random_ray_fixed_source_domain/material/inputs_true.dat +++ b/tests/regression_tests/random_ray_fixed_source_domain/material/inputs_true.dat @@ -3,24 +3,24 @@ mgxs.h5 - + - + - + - - - - - + + + + + 2.5 2.5 2.5 12 12 12 @@ -182,19 +182,19 @@ 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - - - - - - + + + + + + fixed source 90 10 5 - + 100.0 1.0 @@ -207,12 +207,12 @@ 500.0 100.0 - + 0.0 0.0 0.0 30.0 30.0 30.0 - True + true diff --git a/tests/regression_tests/random_ray_fixed_source_domain/universe/inputs_true.dat b/tests/regression_tests/random_ray_fixed_source_domain/universe/inputs_true.dat index 75d84efe9..ab91f74e5 100644 --- a/tests/regression_tests/random_ray_fixed_source_domain/universe/inputs_true.dat +++ b/tests/regression_tests/random_ray_fixed_source_domain/universe/inputs_true.dat @@ -3,24 +3,24 @@ mgxs.h5 - + - + - + - - - - - + + + + + 2.5 2.5 2.5 12 12 12 @@ -182,19 +182,19 @@ 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - - - - - - + + + + + + fixed source 90 10 5 - + 100.0 1.0 @@ -207,12 +207,12 @@ 500.0 100.0 - + 0.0 0.0 0.0 30.0 30.0 30.0 - True + true diff --git a/tests/regression_tests/random_ray_fixed_source_linear/linear/inputs_true.dat b/tests/regression_tests/random_ray_fixed_source_linear/linear/inputs_true.dat index 6ef3f0871..220fa7db6 100644 --- a/tests/regression_tests/random_ray_fixed_source_linear/linear/inputs_true.dat +++ b/tests/regression_tests/random_ray_fixed_source_linear/linear/inputs_true.dat @@ -3,24 +3,24 @@ mgxs.h5 - + - + - + - - - - - + + + + + 2.5 2.5 2.5 12 12 12 @@ -182,19 +182,19 @@ 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - - - - - - + + + + + + fixed source 90 40 20 - + 100.0 1.0 @@ -207,12 +207,12 @@ 500.0 100.0 - + 0.0 0.0 0.0 30.0 30.0 30.0 - True + true linear diff --git a/tests/regression_tests/random_ray_fixed_source_linear/linear/results_true.dat b/tests/regression_tests/random_ray_fixed_source_linear/linear/results_true.dat index 2fc08d0a4..e90d6bfdc 100644 --- a/tests/regression_tests/random_ray_fixed_source_linear/linear/results_true.dat +++ b/tests/regression_tests/random_ray_fixed_source_linear/linear/results_true.dat @@ -1,6 +1,6 @@ tally 1: -2.339085E+00 -2.747304E-01 +2.339086E+00 +2.747305E-01 tally 2: 1.089827E-01 6.069324E-04 diff --git a/tests/regression_tests/random_ray_fixed_source_linear/linear_xy/inputs_true.dat b/tests/regression_tests/random_ray_fixed_source_linear/linear_xy/inputs_true.dat index 805c53fe6..f8c443085 100644 --- a/tests/regression_tests/random_ray_fixed_source_linear/linear_xy/inputs_true.dat +++ b/tests/regression_tests/random_ray_fixed_source_linear/linear_xy/inputs_true.dat @@ -3,24 +3,24 @@ mgxs.h5 - + - + - + - - - - - + + + + + 2.5 2.5 2.5 12 12 12 @@ -182,19 +182,19 @@ 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - - - - - - + + + + + + fixed source 90 40 20 - + 100.0 1.0 @@ -207,12 +207,12 @@ 500.0 100.0 - + 0.0 0.0 0.0 30.0 30.0 30.0 - True + true linear_xy diff --git a/tests/regression_tests/random_ray_fixed_source_mesh/flat/inputs_true.dat b/tests/regression_tests/random_ray_fixed_source_mesh/flat/inputs_true.dat index 67c2ffc15..c84e544fc 100644 --- a/tests/regression_tests/random_ray_fixed_source_mesh/flat/inputs_true.dat +++ b/tests/regression_tests/random_ray_fixed_source_mesh/flat/inputs_true.dat @@ -3,24 +3,24 @@ mgxs.h5 - + - + - + - - - - - + + + + + 2.5 2.5 2.5 12 12 12 @@ -182,19 +182,19 @@ 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - - - - - - + + + + + + fixed source 90 30 15 - + 100.0 1.0 @@ -207,12 +207,12 @@ 500.0 100.0 - + 0.0 0.0 0.0 30.0 30.0 30.0 - True + true diff --git a/tests/regression_tests/random_ray_fixed_source_mesh/linear/inputs_true.dat b/tests/regression_tests/random_ray_fixed_source_mesh/linear/inputs_true.dat index 10b7c74f1..05c4846e6 100644 --- a/tests/regression_tests/random_ray_fixed_source_mesh/linear/inputs_true.dat +++ b/tests/regression_tests/random_ray_fixed_source_mesh/linear/inputs_true.dat @@ -3,24 +3,24 @@ mgxs.h5 - + - + - + - - - - - + + + + + 2.5 2.5 2.5 12 12 12 @@ -182,19 +182,19 @@ 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - - - - - - + + + + + + fixed source 90 30 15 - + 100.0 1.0 @@ -207,12 +207,12 @@ 500.0 100.0 - + 0.0 0.0 0.0 30.0 30.0 30.0 - True + true diff --git a/tests/regression_tests/random_ray_fixed_source_normalization/False/inputs_true.dat b/tests/regression_tests/random_ray_fixed_source_normalization/False/inputs_true.dat index 559cff0f0..0c870e100 100644 --- a/tests/regression_tests/random_ray_fixed_source_normalization/False/inputs_true.dat +++ b/tests/regression_tests/random_ray_fixed_source_normalization/False/inputs_true.dat @@ -3,24 +3,24 @@ mgxs.h5 - + - + - + - - - - - + + + + + 2.5 2.5 2.5 12 12 12 @@ -182,19 +182,19 @@ 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - - - - - - + + + + + + fixed source 90 10 5 - + 100.0 1.0 @@ -207,12 +207,12 @@ 500.0 100.0 - + 0.0 0.0 0.0 30.0 30.0 30.0 - False + false diff --git a/tests/regression_tests/random_ray_fixed_source_normalization/True/inputs_true.dat b/tests/regression_tests/random_ray_fixed_source_normalization/True/inputs_true.dat index 75d84efe9..ab91f74e5 100644 --- a/tests/regression_tests/random_ray_fixed_source_normalization/True/inputs_true.dat +++ b/tests/regression_tests/random_ray_fixed_source_normalization/True/inputs_true.dat @@ -3,24 +3,24 @@ mgxs.h5 - + - + - + - - - - - + + + + + 2.5 2.5 2.5 12 12 12 @@ -182,19 +182,19 @@ 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - - - - - - + + + + + + fixed source 90 10 5 - + 100.0 1.0 @@ -207,12 +207,12 @@ 500.0 100.0 - + 0.0 0.0 0.0 30.0 30.0 30.0 - True + true diff --git a/tests/regression_tests/random_ray_fixed_source_subcritical/flat/inputs_true.dat b/tests/regression_tests/random_ray_fixed_source_subcritical/flat/inputs_true.dat index 0bf4cfdc9..0c05a71df 100644 --- a/tests/regression_tests/random_ray_fixed_source_subcritical/flat/inputs_true.dat +++ b/tests/regression_tests/random_ray_fixed_source_subcritical/flat/inputs_true.dat @@ -3,34 +3,34 @@ mgxs.h5 - + - + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + 0.126 0.126 10 10 @@ -71,30 +71,30 @@ 2 12 12 13 - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + fixed source 30 125 100 - + 1.134 -1.26 -1.0 1.26 -1.134 1.0 @@ -110,12 +110,12 @@ 40.0 40.0 - + -1.26 -1.26 -1 1.26 1.26 1 - False + false flat diff --git a/tests/regression_tests/random_ray_fixed_source_subcritical/flat/results_true.dat b/tests/regression_tests/random_ray_fixed_source_subcritical/flat/results_true.dat index 831eac501..4d2fb6c57 100644 --- a/tests/regression_tests/random_ray_fixed_source_subcritical/flat/results_true.dat +++ b/tests/regression_tests/random_ray_fixed_source_subcritical/flat/results_true.dat @@ -83,7 +83,7 @@ tally 1: 0.000000E+00 0.000000E+00 0.000000E+00 -1.073356E+02 +1.073355E+02 4.630895E+02 1.263975E+01 6.427678E+00 @@ -107,7 +107,7 @@ tally 1: 2.388612E-03 5.941898E-01 1.414866E-02 -5.319555E+01 +5.319554E+01 1.134034E+02 1.967517E-01 1.551313E-03 @@ -122,7 +122,7 @@ tally 1: 8.044764E+01 2.602455E+02 3.474828E-01 -4.908567E-03 +4.908566E-03 9.665057E-01 3.797493E-02 1.561720E+02 diff --git a/tests/regression_tests/random_ray_fixed_source_subcritical/linear_xy/inputs_true.dat b/tests/regression_tests/random_ray_fixed_source_subcritical/linear_xy/inputs_true.dat index f7572a072..a67495bf1 100644 --- a/tests/regression_tests/random_ray_fixed_source_subcritical/linear_xy/inputs_true.dat +++ b/tests/regression_tests/random_ray_fixed_source_subcritical/linear_xy/inputs_true.dat @@ -3,34 +3,34 @@ mgxs.h5 - + - + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + 0.126 0.126 10 10 @@ -71,30 +71,30 @@ 2 12 12 13 - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + fixed source 30 125 100 - + 1.134 -1.26 -1.0 1.26 -1.134 1.0 @@ -110,12 +110,12 @@ 40.0 40.0 - + -1.26 -1.26 -1 1.26 1.26 1 - False + false linear_xy diff --git a/tests/regression_tests/random_ray_fixed_source_subcritical/linear_xy/results_true.dat b/tests/regression_tests/random_ray_fixed_source_subcritical/linear_xy/results_true.dat index 49813144d..bf602d3e2 100644 --- a/tests/regression_tests/random_ray_fixed_source_subcritical/linear_xy/results_true.dat +++ b/tests/regression_tests/random_ray_fixed_source_subcritical/linear_xy/results_true.dat @@ -23,7 +23,7 @@ tally 1: 0.000000E+00 0.000000E+00 0.000000E+00 -5.235812E+01 +5.235813E+01 1.099243E+02 0.000000E+00 0.000000E+00 @@ -72,12 +72,12 @@ tally 1: 0.000000E+00 0.000000E+00 9.495275E+01 -3.613372E+02 +3.613373E+02 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -5.799250E+01 +5.799251E+01 1.356178E+02 0.000000E+00 0.000000E+00 @@ -86,7 +86,7 @@ tally 1: 1.066414E+02 4.570291E+02 1.254014E+01 -6.325640E+00 +6.325641E+00 3.052020E+01 3.746918E+01 4.977302E+01 @@ -107,7 +107,7 @@ tally 1: 2.371074E-03 5.920173E-01 1.404478E-02 -5.299862E+01 +5.299863E+01 1.125576E+02 1.959914E-01 1.539191E-03 @@ -118,11 +118,11 @@ tally 1: 5.781230E-02 1.341759E-04 1.430525E-01 -8.215326E-04 +8.215327E-04 7.995734E+01 2.570099E+02 3.452934E-01 -4.844058E-03 +4.844059E-03 9.604162E-01 3.747587E-02 1.556795E+02 diff --git a/tests/regression_tests/random_ray_halton_samples/inputs_true.dat b/tests/regression_tests/random_ray_halton_samples/inputs_true.dat index 624ab495f..36d5f6f22 100644 --- a/tests/regression_tests/random_ray_halton_samples/inputs_true.dat +++ b/tests/regression_tests/random_ray_halton_samples/inputs_true.dat @@ -3,32 +3,32 @@ mgxs.h5 - + - + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + 0.126 0.126 10 10 @@ -53,23 +53,23 @@ 2 2 2 5 - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + eigenvalue @@ -80,12 +80,12 @@ 100.0 20.0 - + -1.26 -1.26 -1 1.26 1.26 1 - True + true halton diff --git a/tests/regression_tests/random_ray_halton_samples/results_true.dat b/tests/regression_tests/random_ray_halton_samples/results_true.dat index 7eb307da0..256f8a744 100644 --- a/tests/regression_tests/random_ray_halton_samples/results_true.dat +++ b/tests/regression_tests/random_ray_halton_samples/results_true.dat @@ -1,171 +1,171 @@ k-combined: 8.388051E-01 7.383265E-03 tally 1: -5.033308E+00 -5.072162E+00 -1.917335E+00 -7.360725E-01 -4.666410E+00 -4.360038E+00 -2.851812E+00 -1.629362E+00 -4.365590E-01 -3.818884E-02 -1.062497E+00 -2.262071E-01 -1.697621E+00 -5.829333E-01 -5.639912E-02 -6.427568E-04 -1.372642E-01 -3.807294E-03 -2.376683E+00 -1.151027E+00 -8.060902E-02 -1.323179E-03 -1.961862E-01 -7.837693E-03 -7.145452E+00 -1.037540E+01 -8.551803E-02 -1.486269E-03 -2.081363E-01 -8.803955E-03 -2.053205E+01 -8.469498E+01 -3.235618E-02 -2.102891E-04 -8.006311E-02 -1.287559E-03 -1.326545E+01 -3.519484E+01 -1.867471E-01 -6.975133E-03 -5.194275E-01 -5.396284E-02 -7.558115E+00 -1.142535E+01 +1.065839E+00 +2.274384E-01 +4.060094E-01 +3.300592E-02 +9.881457E-01 +1.955066E-01 +6.038893E-01 +7.306038E-02 +9.244411E-02 +1.712380E-03 +2.249905E-01 +1.014308E-02 +3.594916E-01 +2.614145E-02 +1.194318E-02 +2.882412E-05 +2.906731E-02 +1.707363E-04 +5.032954E-01 +5.161897E-02 +1.707007E-02 +5.933921E-05 +4.154514E-02 +3.514889E-04 +1.513147E+00 +4.652938E-01 +1.810962E-02 +6.665306E-05 +4.407572E-02 +3.948212E-04 +4.347893E+00 +3.798064E+00 +6.851785E-03 +9.430195E-06 +1.695426E-02 +5.773923E-05 +2.809071E+00 +1.578195E+00 +3.954523E-02 +3.127754E-04 +1.099931E-01 +2.419775E-03 +1.600493E+00 +5.123291E-01 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -3.386211E+00 -2.294414E+00 +7.170555E-01 +1.028835E-01 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -1.827274E+00 -6.782305E-01 +3.869491E-01 +3.041553E-02 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -2.702858E+00 -1.489752E+00 +5.723683E-01 +6.680970E-02 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -7.475537E+00 -1.133971E+01 +1.583046E+00 +5.085372E-01 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -1.828685E+01 -6.719606E+01 +3.872447E+00 +3.013344E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -1.143600E+01 -2.615734E+01 +2.421670E+00 +1.172938E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -4.590713E+00 -4.224107E+00 -1.705847E+00 -5.831967E-01 -4.151691E+00 -3.454497E+00 -2.730853E+00 -1.495413E+00 -4.072633E-01 -3.325944E-02 -9.911973E-01 -1.970084E-01 -1.664732E+00 -5.598668E-01 -5.385645E-02 -5.858353E-04 -1.310758E-01 -3.470126E-03 -2.312239E+00 -1.088485E+00 -7.662778E-02 -1.195422E-03 -1.864967E-01 -7.080943E-03 -7.105765E+00 -1.025960E+01 -8.287512E-02 -1.396474E-03 -2.017039E-01 -8.272053E-03 -2.099024E+01 -8.854251E+01 -3.191885E-02 -2.048368E-04 -7.898095E-02 -1.254175E-03 -1.355820E+01 -3.676862E+01 -1.815102E-01 -6.590727E-03 -5.048614E-01 -5.098890E-02 -5.093659E+00 -5.192360E+00 -1.874632E+00 -7.031793E-01 -4.562478E+00 -4.165199E+00 -2.870213E+00 -1.650126E+00 -4.244068E-01 -3.608745E-02 -1.032921E+00 -2.137598E-01 -1.703400E+00 -5.873029E-01 -5.464557E-02 -6.042855E-04 -1.329964E-01 -3.579413E-03 -2.389118E+00 -1.163674E+00 -7.832237E-02 -1.251254E-03 -1.906210E-01 -7.411654E-03 -7.162706E+00 -1.042515E+01 -8.273831E-02 -1.391799E-03 -2.013709E-01 -8.244359E-03 -2.043145E+01 -8.383557E+01 -3.096158E-02 -1.924116E-04 -7.661226E-02 -1.178098E-03 -1.314148E+01 -3.454143E+01 -1.771732E-01 -6.279887E-03 -4.927984E-01 -4.858410E-02 +9.721128E-01 +1.894086E-01 +3.612242E-01 +2.615053E-02 +8.791475E-01 +1.548996E-01 +5.782742E-01 +6.705354E-02 +8.624040E-02 +1.491336E-03 +2.098919E-01 +8.833753E-03 +3.525265E-01 +2.510689E-02 +1.140473E-02 +2.627142E-05 +2.775683E-02 +1.556157E-04 +4.896481E-01 +4.881407E-02 +1.622698E-02 +5.360976E-05 +3.949322E-02 +3.175511E-04 +1.504743E+00 +4.601003E-01 +1.754995E-02 +6.262618E-05 +4.271358E-02 +3.709679E-04 +4.444922E+00 +3.970609E+00 +6.759184E-03 +9.185746E-06 +1.672513E-02 +5.624252E-05 +2.871068E+00 +1.648778E+00 +3.843643E-02 +2.955428E-04 +1.069090E-01 +2.286455E-03 +1.078620E+00 +2.328291E-01 +3.969671E-01 +3.153110E-02 +9.661384E-01 +1.867708E-01 +6.077864E-01 +7.399164E-02 +8.987086E-02 +1.618157E-03 +2.187277E-01 +9.584966E-03 +3.607158E-01 +2.633746E-02 +1.157185E-02 +2.709895E-05 +2.816358E-02 +1.605174E-04 +5.059289E-01 +5.218618E-02 +1.658585E-02 +5.611375E-05 +4.036663E-02 +3.323832E-04 +1.516801E+00 +4.675245E-01 +1.752096E-02 +6.241641E-05 +4.264304E-02 +3.697253E-04 +4.326588E+00 +3.759517E+00 +6.556454E-03 +8.628460E-06 +1.622349E-02 +5.283037E-05 +2.782815E+00 +1.548888E+00 +3.751781E-02 +2.815972E-04 +1.043539E-01 +2.178566E-03 diff --git a/tests/regression_tests/random_ray_k_eff/inputs_true.dat b/tests/regression_tests/random_ray_k_eff/inputs_true.dat index a2b058f2b..545bd1d45 100644 --- a/tests/regression_tests/random_ray_k_eff/inputs_true.dat +++ b/tests/regression_tests/random_ray_k_eff/inputs_true.dat @@ -3,32 +3,32 @@ mgxs.h5 - + - + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + 0.126 0.126 10 10 @@ -53,23 +53,23 @@ 2 2 2 5 - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + eigenvalue @@ -80,12 +80,12 @@ 100.0 20.0 - + -1.26 -1.26 -1 1.26 1.26 1 - True + true diff --git a/tests/regression_tests/random_ray_k_eff/results_true.dat b/tests/regression_tests/random_ray_k_eff/results_true.dat index a21929d53..ace18df8c 100644 --- a/tests/regression_tests/random_ray_k_eff/results_true.dat +++ b/tests/regression_tests/random_ray_k_eff/results_true.dat @@ -1,171 +1,171 @@ k-combined: -8.400321E-01 8.023358E-03 +8.400321E-01 8.023357E-03 tally 1: -5.086559E+00 -5.180935E+00 -1.885166E+00 -7.115503E-01 -4.588116E+00 -4.214784E+00 -2.860400E+00 -1.639328E+00 -4.245221E-01 -3.610929E-02 -1.033202E+00 -2.138892E-01 -1.692631E+00 -5.793966E-01 -5.445818E-02 -5.996625E-04 -1.325403E-01 -3.552030E-03 -2.372248E+00 -1.146944E+00 -7.808142E-02 -1.242278E-03 -1.900346E-01 -7.358490E-03 -7.134948E+00 -1.034824E+01 -8.272647E-02 -1.391871E-03 -2.013421E-01 -8.244788E-03 -2.043539E+01 -8.389902E+01 -3.099367E-02 -1.930673E-04 -7.669167E-02 -1.182113E-03 -1.313212E+01 -3.449537E+01 -1.764293E-01 -6.225586E-03 -4.907292E-01 -4.816400E-02 -7.567715E+00 -1.145439E+01 +1.075769E+00 +2.317354E-01 +3.986991E-01 +3.182682E-02 +9.703538E-01 +1.885224E-01 +6.049423E-01 +7.331941E-02 +8.978161E-02 +1.614997E-03 +2.185105E-01 +9.566247E-03 +3.579852E-01 +2.591721E-02 +1.151770E-02 +2.682363E-05 +2.803176E-02 +1.588866E-04 +5.017326E-01 +5.130808E-02 +1.651428E-02 +5.557274E-05 +4.019245E-02 +3.291786E-04 +1.509054E+00 +4.629325E-01 +1.749679E-02 +6.226587E-05 +4.258421E-02 +3.688336E-04 +4.322054E+00 +3.753085E+00 +6.555113E-03 +8.636537E-06 +1.622017E-02 +5.287982E-05 +2.777351E+00 +1.542942E+00 +3.731363E-02 +2.784662E-04 +1.037860E-01 +2.154343E-03 +1.600522E+00 +5.123477E-01 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -3.383194E+00 -2.290468E+00 +7.155116E-01 +1.024445E-01 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -1.819672E+00 -6.726158E-01 +3.848568E-01 +3.008769E-02 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -2.693683E+00 -1.480961E+00 +5.697160E-01 +6.624996E-02 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -7.453758E+00 -1.128171E+01 +1.576480E+00 +5.046890E-01 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -1.823561E+01 -6.681652E+01 +3.856827E+00 +2.989000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -1.137517E+01 -2.588512E+01 +2.405807E+00 +1.157889E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -4.601916E+00 -4.242624E+00 -1.719723E+00 -5.923465E-01 -4.185462E+00 -3.508695E+00 -2.730305E+00 -1.494324E+00 -4.108214E-01 -3.383938E-02 -9.998572E-01 -2.004436E-01 -1.660852E+00 -5.570432E-01 -5.428709E-02 -5.947848E-04 -1.321239E-01 -3.523137E-03 -2.306069E+00 -1.082855E+00 -7.697031E-02 -1.206036E-03 -1.873303E-01 -7.143815E-03 -7.075194E+00 -1.017519E+01 -8.322052E-02 -1.408294E-03 -2.025446E-01 -8.342070E-03 -2.094832E+01 -8.816715E+01 -3.234739E-02 -2.101889E-04 -8.004135E-02 -1.286945E-03 -1.357413E+01 -3.685983E+01 -1.861680E-01 -6.934827E-03 -5.178169E-01 -5.365102E-02 -5.072149E+00 -5.151429E+00 -1.916643E+00 -7.358710E-01 -4.664726E+00 -4.358845E+00 -2.859464E+00 -1.638250E+00 -4.332944E-01 -3.763170E-02 -1.054552E+00 -2.229070E-01 -1.693008E+00 -5.796671E-01 -5.561096E-02 -6.247543E-04 -1.353459E-01 -3.700658E-03 -2.368860E+00 -1.143296E+00 -7.951819E-02 -1.286690E-03 -1.935314E-01 -7.621556E-03 -7.119586E+00 -1.030023E+01 -8.428175E-02 -1.442931E-03 -2.051274E-01 -8.547243E-03 -2.046758E+01 -8.418767E+01 -3.181946E-02 -2.034766E-04 -7.873502E-02 -1.245847E-03 -1.325834E+01 -3.515919E+01 -1.832838E-01 -6.720555E-03 -5.097947E-01 -5.199331E-02 +9.732717E-01 +1.897670E-01 +3.637108E-01 +2.649544E-02 +8.851992E-01 +1.569426E-01 +5.774286E-01 +6.683395E-02 +8.688408E-02 +1.513473E-03 +2.114585E-01 +8.964883E-03 +3.512640E-01 +2.491729E-02 +1.148149E-02 +2.660532E-05 +2.794365E-02 +1.575935E-04 +4.877362E-01 +4.844138E-02 +1.627932E-02 +5.395212E-05 +3.962062E-02 +3.195790E-04 +1.496416E+00 +4.551920E-01 +1.760130E-02 +6.300084E-05 +4.283856E-02 +3.731872E-04 +4.430519E+00 +3.943947E+00 +6.841363E-03 +9.402132E-06 +1.692847E-02 +5.756741E-05 +2.870816E+00 +1.648662E+00 +3.937267E-02 +3.101707E-04 +1.095131E-01 +2.399624E-03 +1.072714E+00 +2.304093E-01 +4.053505E-01 +3.291277E-02 +9.865420E-01 +1.949549E-01 +6.047420E-01 +7.327008E-02 +9.163611E-02 +1.683034E-03 +2.230240E-01 +9.969255E-03 +3.580639E-01 +2.592902E-02 +1.176143E-02 +2.794541E-05 +2.862497E-02 +1.655313E-04 +5.010143E-01 +5.114429E-02 +1.681803E-02 +5.755790E-05 +4.093173E-02 +3.409375E-04 +1.505803E+00 +4.607828E-01 +1.782566E-02 +6.454911E-05 +4.338462E-02 +3.823584E-04 +4.328879E+00 +3.766055E+00 +6.729800E-03 +9.102372E-06 +1.665242E-02 +5.573204E-05 +2.804070E+00 +1.572690E+00 +3.876396E-02 +3.006259E-04 +1.078200E-01 +2.325780E-03 diff --git a/tests/regression_tests/random_ray_k_eff_mesh/inputs_true.dat b/tests/regression_tests/random_ray_k_eff_mesh/inputs_true.dat index cdc717198..98badea18 100644 --- a/tests/regression_tests/random_ray_k_eff_mesh/inputs_true.dat +++ b/tests/regression_tests/random_ray_k_eff_mesh/inputs_true.dat @@ -3,32 +3,32 @@ mgxs.h5 - + - + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + 0.126 0.126 10 10 @@ -53,23 +53,23 @@ 2 2 2 5 - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + eigenvalue @@ -80,12 +80,12 @@ 100.0 20.0 - + -1.26 -1.26 -1 1.26 1.26 1 - True + true diff --git a/tests/regression_tests/random_ray_k_eff_mesh/results_true.dat b/tests/regression_tests/random_ray_k_eff_mesh/results_true.dat index 535db3b55..2ae8fad85 100644 --- a/tests/regression_tests/random_ray_k_eff_mesh/results_true.dat +++ b/tests/regression_tests/random_ray_k_eff_mesh/results_true.dat @@ -1,171 +1,171 @@ k-combined: 8.379203E-01 8.057199E-03 tally 1: -5.080171E+00 -5.167984E+00 -1.880341E+00 -7.079266E-01 -4.576373E+00 -4.193319E+00 -2.859914E+00 -1.638769E+00 -4.243332E-01 -3.607732E-02 -1.032742E+00 -2.136998E-01 -1.692643E+00 -5.794069E-01 -5.445214E-02 -5.995212E-04 -1.325256E-01 -3.551193E-03 -2.372336E+00 -1.147031E+00 -7.807378E-02 -1.242019E-03 -1.900160E-01 -7.356955E-03 -7.135636E+00 -1.035026E+01 -8.273225E-02 -1.392069E-03 -2.013562E-01 -8.245961E-03 -2.044034E+01 -8.394042E+01 -3.100485E-02 -1.932097E-04 -7.671933E-02 -1.182985E-03 -1.313652E+01 -3.451847E+01 -1.764978E-01 -6.230420E-03 -4.909196E-01 -4.820140E-02 -7.585874E+00 -1.150936E+01 +1.073897E+00 +2.309328E-01 +3.974859E-01 +3.163415E-02 +9.674011E-01 +1.873811E-01 +6.045463E-01 +7.322367E-02 +8.969819E-02 +1.612011E-03 +2.183075E-01 +9.548557E-03 +3.578121E-01 +2.589198E-02 +1.151076E-02 +2.679073E-05 +2.801489E-02 +1.586917E-04 +5.015038E-01 +5.126076E-02 +1.650453E-02 +5.550572E-05 +4.016872E-02 +3.287816E-04 +1.508456E+00 +4.625615E-01 +1.748939E-02 +6.221267E-05 +4.256620E-02 +3.685184E-04 +4.320984E+00 +3.751237E+00 +6.554265E-03 +8.634389E-06 +1.621807E-02 +5.286667E-05 +2.776930E+00 +1.542475E+00 +3.730995E-02 +2.784113E-04 +1.037757E-01 +2.153918E-03 +1.603583E+00 +5.143065E-01 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -3.386790E+00 -2.295327E+00 +7.159242E-01 +1.025623E-01 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -1.820058E+00 -6.729238E-01 +3.847488E-01 +3.007151E-02 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -2.694013E+00 -1.481363E+00 +5.695050E-01 +6.620177E-02 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -7.453818E+00 -1.128202E+01 +1.575716E+00 +5.042003E-01 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -1.823642E+01 -6.682239E+01 +3.855109E+00 +2.986316E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -1.137903E+01 -2.590265E+01 +2.405453E+00 +1.157547E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -4.589529E+00 -4.219985E+00 -1.712446E+00 -5.873675E-01 -4.167750E+00 -3.479202E+00 -2.728285E+00 -1.492132E+00 -4.104063E-01 -3.377132E-02 -9.988468E-01 -2.000404E-01 -1.660506E+00 -5.567967E-01 -5.427391E-02 -5.944708E-04 -1.320918E-01 -3.521277E-03 -2.305889E+00 -1.082691E+00 -7.695793E-02 -1.205644E-03 -1.873002E-01 -7.141490E-03 -7.076637E+00 -1.017946E+01 -8.323139E-02 -1.408687E-03 -2.025710E-01 -8.344398E-03 -2.095897E+01 -8.825741E+01 -3.236513E-02 -2.104220E-04 -8.008525E-02 -1.288373E-03 -1.358006E+01 -3.689205E+01 -1.862562E-01 -6.941428E-03 -5.180621E-01 -5.370209E-02 -5.067386E+00 -5.141748E+00 -1.912704E+00 -7.328484E-01 -4.655140E+00 -4.340941E+00 -2.858992E+00 -1.637705E+00 -4.331050E-01 -3.759875E-02 -1.054091E+00 -2.227118E-01 -1.692974E+00 -5.796396E-01 -5.560487E-02 -6.246120E-04 -1.353311E-01 -3.699815E-03 -2.368737E+00 -1.143184E+00 -7.950085E-02 -1.286135E-03 -1.934892E-01 -7.618268E-03 -7.119767E+00 -1.030095E+01 -8.427627E-02 -1.442764E-03 -2.051141E-01 -8.546249E-03 -2.047651E+01 -8.426275E+01 -3.183786E-02 -2.037156E-04 -7.878057E-02 -1.247311E-03 -1.326415E+01 -3.519010E+01 -1.833688E-01 -6.726832E-03 -5.100312E-01 -5.204188E-02 +9.701818E-01 +1.885724E-01 +3.619962E-01 +2.624740E-02 +8.810264E-01 +1.554734E-01 +5.767221E-01 +6.667165E-02 +8.675429E-02 +1.508976E-03 +2.111426E-01 +8.938242E-03 +3.510185E-01 +2.488161E-02 +1.147307E-02 +2.656498E-05 +2.792316E-02 +1.573545E-04 +4.874578E-01 +4.838573E-02 +1.626869E-02 +5.388082E-05 +3.959473E-02 +3.191567E-04 +1.495984E+00 +4.549294E-01 +1.759493E-02 +6.295564E-05 +4.282306E-02 +3.729194E-04 +4.430601E+00 +3.944093E+00 +6.841763E-03 +9.403281E-06 +1.692946E-02 +5.757445E-05 +2.870670E+00 +1.648496E+00 +3.937215E-02 +3.101637E-04 +1.095116E-01 +2.399569E-03 +1.071187E+00 +2.297540E-01 +4.043214E-01 +3.274592E-02 +9.840375E-01 +1.939666E-01 +6.043491E-01 +7.317500E-02 +9.155169E-02 +1.679939E-03 +2.228185E-01 +9.950920E-03 +3.578809E-01 +2.590208E-02 +1.175437E-02 +2.791136E-05 +2.860779E-02 +1.653296E-04 +5.007414E-01 +5.108824E-02 +1.680608E-02 +5.747571E-05 +4.090264E-02 +3.404506E-04 +1.505100E+00 +4.603562E-01 +1.781573E-02 +6.447733E-05 +4.336044E-02 +3.819332E-04 +4.328647E+00 +3.765700E+00 +6.730396E-03 +9.104085E-06 +1.665389E-02 +5.574253E-05 +2.803934E+00 +1.572540E+00 +3.876306E-02 +3.006136E-04 +1.078175E-01 +2.325685E-03 diff --git a/tests/regression_tests/random_ray_linear/linear/inputs_true.dat b/tests/regression_tests/random_ray_linear/linear/inputs_true.dat index 4df51bad5..a43a66e71 100644 --- a/tests/regression_tests/random_ray_linear/linear/inputs_true.dat +++ b/tests/regression_tests/random_ray_linear/linear/inputs_true.dat @@ -3,32 +3,32 @@ mgxs.h5 - + - + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + 0.126 0.126 10 10 @@ -53,23 +53,23 @@ 2 2 2 5 - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + eigenvalue @@ -80,12 +80,12 @@ 100.0 20.0 - + -1.26 -1.26 -1 1.26 1.26 1 - True + true linear diff --git a/tests/regression_tests/random_ray_linear/linear/results_true.dat b/tests/regression_tests/random_ray_linear/linear/results_true.dat index 6617c7821..77d41f373 100644 --- a/tests/regression_tests/random_ray_linear/linear/results_true.dat +++ b/tests/regression_tests/random_ray_linear/linear/results_true.dat @@ -1,171 +1,171 @@ k-combined: 1.095967E+00 1.543581E-02 tally 1: -2.548108E+01 -3.269093E+01 -9.271804E+00 -4.327275E+00 -2.256572E+01 -2.563210E+01 -1.816107E+01 -1.653421E+01 -2.659203E+00 -3.544951E-01 -6.471969E+00 -2.099810E+00 -1.364193E+01 -9.308675E+00 -4.362828E-01 -9.521133E-03 -1.061825E+00 -5.639730E-02 -1.746102E+01 -1.524680E+01 -5.733016E-01 -1.643671E-02 -1.395301E+00 -9.736091E-02 -4.539598E+01 -1.030472E+02 -5.263055E-01 -1.385088E-02 -1.280938E+00 -8.204609E-02 -9.945736E+01 -4.946716E+02 -1.505228E-01 -1.133424E-03 -3.724582E-01 -6.939732E-03 -5.324914E+01 -1.418809E+02 -7.219589E-01 -2.614875E-02 -2.008092E+00 -2.022988E-01 -4.188246E+01 -8.843468E+01 +5.425537E+00 +1.482137E+00 +1.974189E+00 +1.961888E-01 +4.804781E+00 +1.162101E+00 +3.866915E+00 +7.496163E-01 +5.662059E-01 +1.607180E-02 +1.378032E+00 +9.519943E-02 +2.904666E+00 +4.220197E-01 +9.289413E-02 +4.316514E-04 +2.260857E-01 +2.556836E-03 +3.717829E+00 +6.912286E-01 +1.220682E-01 +7.451721E-04 +2.970897E-01 +4.413940E-03 +9.665773E+00 +4.671720E+00 +1.120617E-01 +6.279393E-04 +2.727390E-01 +3.719615E-03 +2.117656E+01 +2.242614E+01 +3.204951E-02 +5.138445E-05 +7.930426E-02 +3.146169E-04 +1.133784E+01 +6.432186E+00 +1.537206E-01 +1.185474E-03 +4.275660E-01 +9.171376E-03 +8.917756E+00 +4.009380E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -2.224363E+01 -2.481131E+01 +4.736166E+00 +1.124858E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -1.436097E+01 -1.031496E+01 +3.057755E+00 +4.676344E-01 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -1.901248E+01 -1.807657E+01 +4.048156E+00 +8.195089E-01 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -4.559337E+01 -1.039424E+02 +9.707791E+00 +4.712281E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -8.802992E+01 -3.874925E+02 +1.874344E+01 +1.756722E+01 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -4.506602E+01 -1.016497E+02 +9.595520E+00 +4.608366E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -2.207833E+01 -2.455068E+01 -8.139772E+00 -3.337974E+00 -1.981058E+01 -1.977210E+01 -1.710407E+01 -1.466648E+01 -2.542287E+00 -3.240467E-01 -6.187418E+00 -1.919453E+00 -1.342690E+01 -9.017908E+00 -4.362263E-01 -9.518695E-03 -1.061688E+00 -5.638286E-02 -1.713924E+01 -1.469065E+01 -5.714028E-01 -1.632839E-02 -1.390680E+00 -9.671931E-02 -4.539193E+01 -1.030326E+02 -5.345253E-01 -1.428719E-02 -1.300944E+00 -8.463057E-02 -1.013270E+02 -5.134168E+02 -1.555517E-01 -1.210145E-03 -3.849017E-01 -7.409480E-03 -5.377836E+01 -1.446537E+02 -7.374053E-01 -2.722908E-02 -2.051056E+00 -2.106567E-01 -2.522726E+01 -3.202007E+01 -9.366659E+00 -4.412278E+00 -2.279657E+01 -2.613561E+01 -1.803368E+01 -1.629756E+01 -2.696490E+00 -3.643066E-01 -6.562716E+00 -2.157928E+00 -1.357447E+01 -9.216150E+00 -4.437305E-01 -9.847287E-03 -1.079951E+00 -5.832923E-02 -1.735848E+01 -1.506775E+01 -5.825173E-01 -1.696803E-02 -1.417731E+00 -1.005081E-01 -4.519297E+01 -1.021280E+02 -5.357712E-01 -1.435322E-02 -1.303976E+00 -8.502167E-02 -9.934508E+01 -4.935314E+02 -1.538761E-01 -1.184229E-03 -3.807556E-01 -7.250804E-03 -5.335839E+01 -1.424221E+02 -7.404823E-01 -2.747396E-02 -2.059614E+00 -2.125512E-01 +4.701002E+00 +1.113069E+00 +1.733152E+00 +1.513360E-01 +4.218145E+00 +8.964208E-01 +3.641849E+00 +6.649342E-01 +5.413112E-01 +1.469131E-02 +1.317443E+00 +8.702223E-02 +2.858878E+00 +4.088359E-01 +9.288202E-02 +4.315389E-04 +2.260562E-01 +2.556170E-03 +3.649312E+00 +6.660131E-01 +1.216639E-01 +7.402611E-04 +2.961057E-01 +4.384849E-03 +9.664912E+00 +4.671059E+00 +1.138118E-01 +6.477188E-04 +2.769985E-01 +3.836780E-03 +2.157464E+01 +2.327600E+01 +3.312018E-02 +5.486221E-05 +8.195357E-02 +3.359106E-04 +1.145052E+01 +6.557893E+00 +1.570084E-01 +1.234420E-03 +4.367109E-01 +9.550040E-03 +5.371474E+00 +1.451702E+00 +1.994382E+00 +2.000414E-01 +4.853928E+00 +1.184921E+00 +3.839778E+00 +7.388780E-01 +5.741437E-01 +1.651648E-02 +1.397351E+00 +9.783345E-02 +2.890296E+00 +4.178220E-01 +9.447974E-02 +4.464346E-04 +2.299448E-01 +2.644403E-03 +3.695989E+00 +6.831063E-01 +1.240303E-01 +7.692555E-04 +3.018649E-01 +4.556594E-03 +9.622545E+00 +4.630042E+00 +1.140770E-01 +6.507108E-04 +2.776440E-01 +3.854503E-03 +2.115266E+01 +2.237450E+01 +3.276343E-02 +5.368742E-05 +8.107083E-02 +3.287176E-04 +1.136109E+01 +6.456700E+00 +1.576636E-01 +1.245524E-03 +4.385334E-01 +9.635950E-03 diff --git a/tests/regression_tests/random_ray_linear/linear_xy/inputs_true.dat b/tests/regression_tests/random_ray_linear/linear_xy/inputs_true.dat index 113771438..7f76f2fd1 100644 --- a/tests/regression_tests/random_ray_linear/linear_xy/inputs_true.dat +++ b/tests/regression_tests/random_ray_linear/linear_xy/inputs_true.dat @@ -3,32 +3,32 @@ mgxs.h5 - + - + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + 0.126 0.126 10 10 @@ -53,23 +53,23 @@ 2 2 2 5 - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + eigenvalue @@ -80,12 +80,12 @@ 100.0 20.0 - + -1.26 -1.26 -1 1.26 1.26 1 - True + true linear_xy diff --git a/tests/regression_tests/random_ray_linear/linear_xy/results_true.dat b/tests/regression_tests/random_ray_linear/linear_xy/results_true.dat index abfd03c06..052608b42 100644 --- a/tests/regression_tests/random_ray_linear/linear_xy/results_true.dat +++ b/tests/regression_tests/random_ray_linear/linear_xy/results_true.dat @@ -1,171 +1,171 @@ k-combined: 1.104727E+00 1.593303E-02 tally 1: -2.566934E+01 -3.317503E+01 -9.417202E+00 -4.465518E+00 -2.291958E+01 -2.645097E+01 -1.823903E+01 -1.667438E+01 -2.679931E+00 -3.600420E-01 -6.522415E+00 -2.132667E+00 -1.365623E+01 -9.327448E+00 -4.370682E-01 -9.554968E-03 -1.063736E+00 -5.659772E-02 -1.750634E+01 -1.532609E+01 -5.762870E-01 -1.660889E-02 -1.402567E+00 -9.838082E-02 -4.543609E+01 -1.032286E+02 -5.271287E-01 -1.389456E-02 -1.282941E+00 -8.230483E-02 -9.881678E+01 -4.882586E+02 -1.487616E-01 -1.106634E-03 -3.681003E-01 -6.775702E-03 -5.260781E+01 -1.384126E+02 -7.018594E-01 -2.464953E-02 -1.952187E+00 -1.907001E-01 -4.184779E+01 -8.826530E+01 +5.465547E+00 +1.504031E+00 +2.005120E+00 +2.024490E-01 +4.880060E+00 +1.199182E+00 +3.883466E+00 +7.559482E-01 +5.706123E-01 +1.632280E-02 +1.388756E+00 +9.668619E-02 +2.907681E+00 +4.228621E-01 +9.306046E-02 +4.331768E-04 +2.264905E-01 +2.565871E-03 +3.727441E+00 +6.948089E-01 +1.227027E-01 +7.529631E-04 +2.986338E-01 +4.460088E-03 +9.674219E+00 +4.679846E+00 +1.122358E-01 +6.299070E-04 +2.731629E-01 +3.731271E-03 +2.103996E+01 +2.213497E+01 +3.167421E-02 +5.016895E-05 +7.837561E-02 +3.071747E-04 +1.120119E+01 +6.274853E+00 +1.494396E-01 +1.117486E-03 +4.156586E-01 +8.645390E-03 +8.910289E+00 +4.001626E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -2.226932E+01 -2.486554E+01 +4.741600E+00 +1.127303E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -1.441107E+01 -1.038682E+01 +3.068401E+00 +4.708885E-01 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -1.909194E+01 -1.822767E+01 +4.065045E+00 +8.263510E-01 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -4.579319E+01 -1.048559E+02 +9.750251E+00 +4.753623E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -8.833276E+01 -3.901410E+02 +1.880773E+01 +1.768690E+01 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -4.528911E+01 -1.025740E+02 +9.642921E+00 +4.650165E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -2.218278E+01 -2.477434E+01 -8.203467E+00 -3.389915E+00 -1.996560E+01 -2.007976E+01 -1.714818E+01 -1.473927E+01 -2.551034E+00 -3.262450E-01 -6.208707E+00 -1.932474E+00 -1.343470E+01 -9.027502E+00 -4.363259E-01 -9.522121E-03 -1.061930E+00 -5.640315E-02 -1.717034E+01 -1.474381E+01 -5.729720E-01 -1.641841E-02 -1.394499E+00 -9.725251E-02 -4.542715E+01 -1.031896E+02 -5.348128E-01 -1.430232E-02 -1.301643E+00 -8.472019E-02 -1.009076E+02 -5.091264E+02 -1.543547E-01 -1.191320E-03 -3.819398E-01 -7.294216E-03 -5.342751E+01 -1.427427E+02 -7.255554E-01 -2.633014E-02 -2.018096E+00 -2.037021E-01 -2.540053E+01 -3.247261E+01 -9.483956E+00 -4.526477E+00 -2.308205E+01 -2.681205E+01 -1.812760E+01 -1.646855E+01 -2.717374E+00 -3.700301E-01 -6.613545E+00 -2.191830E+00 -1.362672E+01 -9.286907E+00 -4.458292E-01 -9.940508E-03 -1.085059E+00 -5.888142E-02 -1.744511E+01 -1.521876E+01 -5.866632E-01 -1.721091E-02 -1.427821E+00 -1.019468E-01 -4.538426E+01 -1.029941E+02 -5.385934E-01 -1.450495E-02 -1.310845E+00 -8.592045E-02 -9.921424E+01 -4.921945E+02 -1.532444E-01 -1.174272E-03 -3.791926E-01 -7.189835E-03 -5.301633E+01 -1.405571E+02 -7.285745E-01 -2.655093E-02 -2.026493E+00 -2.054102E-01 +4.723189E+00 +1.123179E+00 +1.746692E+00 +1.536860E-01 +4.251098E+00 +9.103405E-01 +3.651202E+00 +6.682179E-01 +5.431675E-01 +1.479058E-02 +1.321961E+00 +8.761024E-02 +2.860513E+00 +4.092640E-01 +9.290237E-02 +4.316867E-04 +2.261058E-01 +2.557045E-03 +3.655900E+00 +6.684112E-01 +1.219969E-01 +7.443277E-04 +2.969160E-01 +4.408937E-03 +9.672316E+00 +4.678082E+00 +1.138719E-01 +6.483917E-04 +2.771448E-01 +3.840766E-03 +2.148514E+01 +2.308100E+01 +3.286501E-02 +5.400774E-05 +8.132216E-02 +3.306788E-04 +1.137571E+01 +6.471140E+00 +1.544841E-01 +1.193653E-03 +4.296897E-01 +9.234647E-03 +5.408307E+00 +1.472183E+00 +2.019332E+00 +2.052123E-01 +4.914651E+00 +1.215551E+00 +3.859737E+00 +7.466141E-01 +5.785840E-01 +1.677554E-02 +1.408158E+00 +9.936796E-02 +2.901397E+00 +4.210234E-01 +9.492573E-02 +4.506531E-04 +2.310302E-01 +2.669390E-03 +3.714401E+00 +6.899411E-01 +1.249118E-01 +7.802521E-04 +3.040104E-01 +4.621732E-03 +9.663183E+00 +4.669215E+00 +1.146768E-01 +6.575767E-04 +2.791038E-01 +3.895173E-03 +2.112461E+01 +2.231346E+01 +3.262864E-02 +5.323508E-05 +8.073730E-02 +3.259479E-04 +1.128817E+01 +6.372070E+00 +1.551272E-01 +1.203670E-03 +4.314785E-01 +9.312148E-03 diff --git a/tests/regression_tests/random_ray_low_density/__init__.py b/tests/regression_tests/random_ray_low_density/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/regression_tests/random_ray_low_density/inputs_true.dat b/tests/regression_tests/random_ray_low_density/inputs_true.dat new file mode 100644 index 000000000..ab91f74e5 --- /dev/null +++ b/tests/regression_tests/random_ray_low_density/inputs_true.dat @@ -0,0 +1,244 @@ + + + + mgxs.h5 + + + + + + + + + + + + + + + + + + + + + 2.5 2.5 2.5 + 12 12 12 + 0.0 0.0 0.0 + +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +1 1 2 2 2 2 2 2 2 2 3 3 +1 1 2 2 2 2 2 2 2 2 3 3 + +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +1 1 2 2 2 2 2 2 2 2 3 3 +1 1 2 2 2 2 2 2 2 2 3 3 + +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 + +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 + +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 + +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 + +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 + +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 + +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 + +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 + +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 + +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 + + + + + + + + + + fixed source + 90 + 10 + 5 + + + 100.0 1.0 + + + universe + 1 + + + multi-group + + 500.0 + 100.0 + + + 0.0 0.0 0.0 30.0 30.0 30.0 + + + true + + + + + 1 + + + 2 + + + 3 + + + 3 + flux + tracklength + + + 2 + flux + tracklength + + + 1 + flux + tracklength + + + diff --git a/tests/regression_tests/random_ray_low_density/results_true.dat b/tests/regression_tests/random_ray_low_density/results_true.dat new file mode 100644 index 000000000..a4b3ee1bc --- /dev/null +++ b/tests/regression_tests/random_ray_low_density/results_true.dat @@ -0,0 +1,9 @@ +tally 1: +5.973607E-01 +7.155477E-02 +tally 2: +3.206216E-02 +2.063375E-04 +tally 3: +2.096415E-03 +8.804963E-07 diff --git a/tests/regression_tests/random_ray_low_density/test.py b/tests/regression_tests/random_ray_low_density/test.py new file mode 100644 index 000000000..1b4ffb781 --- /dev/null +++ b/tests/regression_tests/random_ray_low_density/test.py @@ -0,0 +1,60 @@ +import os + +import numpy as np +import openmc +from openmc.examples import random_ray_three_region_cube + +from tests.testing_harness import TolerantPyAPITestHarness + + +class MGXSTestHarness(TolerantPyAPITestHarness): + def _cleanup(self): + super()._cleanup() + f = 'mgxs.h5' + if os.path.exists(f): + os.remove(f) + + +def test_random_ray_low_density(): + model = random_ray_three_region_cube() + + # Rebuild the MGXS library to have a material with very + # low macroscopic cross sections + ebins = [1e-5, 20.0e6] + groups = openmc.mgxs.EnergyGroups(group_edges=ebins) + + void_sigma_a = 4.0e-6 + void_sigma_s = 3.0e-4 + void_mat_data = openmc.XSdata('void', groups) + void_mat_data.order = 0 + void_mat_data.set_total([void_sigma_a + void_sigma_s]) + void_mat_data.set_absorption([void_sigma_a]) + void_mat_data.set_scatter_matrix( + np.rollaxis(np.array([[[void_sigma_s]]]), 0, 3)) + + absorber_sigma_a = 0.75 + absorber_sigma_s = 0.25 + absorber_mat_data = openmc.XSdata('absorber', groups) + absorber_mat_data.order = 0 + absorber_mat_data.set_total([absorber_sigma_a + absorber_sigma_s]) + absorber_mat_data.set_absorption([absorber_sigma_a]) + absorber_mat_data.set_scatter_matrix( + np.rollaxis(np.array([[[absorber_sigma_s]]]), 0, 3)) + + multiplier = 0.0000001 + source_sigma_a = void_sigma_a * multiplier + source_sigma_s = void_sigma_s * multiplier + source_mat_data = openmc.XSdata('source', groups) + source_mat_data.order = 0 + source_mat_data.set_total([source_sigma_a + source_sigma_s]) + source_mat_data.set_absorption([source_sigma_a]) + source_mat_data.set_scatter_matrix( + np.rollaxis(np.array([[[source_sigma_s]]]), 0, 3)) + + mg_cross_sections_file = openmc.MGXSLibrary(groups) + mg_cross_sections_file.add_xsdatas( + [source_mat_data, void_mat_data, absorber_mat_data]) + mg_cross_sections_file.export_to_hdf5() + + harness = MGXSTestHarness('statepoint.10.h5', model) + harness.main() diff --git a/tests/regression_tests/random_ray_point_source_locator/__init__.py b/tests/regression_tests/random_ray_point_source_locator/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/regression_tests/random_ray_point_source_locator/inputs_true.dat b/tests/regression_tests/random_ray_point_source_locator/inputs_true.dat new file mode 100644 index 000000000..088f803bf --- /dev/null +++ b/tests/regression_tests/random_ray_point_source_locator/inputs_true.dat @@ -0,0 +1,253 @@ + + + + mgxs.h5 + + + + + + + + + + + + + + + + + + + + + 2.5 2.5 2.5 + 12 12 12 + 0.0 0.0 0.0 + +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +1 1 2 2 2 2 2 2 2 2 3 3 +1 1 2 2 2 2 2 2 2 2 3 3 + +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +1 1 2 2 2 2 2 2 2 2 3 3 +1 1 2 2 2 2 2 2 2 2 3 3 + +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 + +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 + +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 + +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 + +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 + +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 + +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 + +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 +2 2 2 2 2 2 2 2 2 2 3 3 + +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 + +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 +3 3 3 3 3 3 3 3 3 3 3 3 + + + + + + + + + + fixed source + 90 + 30 + 15 + + + 2.5 2.5 2.5 + + + 100.0 1.0 + + + multi-group + + 500.0 + 100.0 + + + 0.0 0.0 0.0 30.0 30.0 30.0 + + + true + + + + + + + + 30 30 30 + 0.0 0.0 0.0 + 30.0 30.0 30.0 + + + + + 1 + + + 2 + + + 3 + + + 3 + flux + tracklength + + + 2 + flux + tracklength + + + 1 + flux + tracklength + + + diff --git a/tests/regression_tests/random_ray_point_source_locator/results_true.dat b/tests/regression_tests/random_ray_point_source_locator/results_true.dat new file mode 100644 index 000000000..8c6f358dd --- /dev/null +++ b/tests/regression_tests/random_ray_point_source_locator/results_true.dat @@ -0,0 +1,9 @@ +tally 1: +2.633923E+00 +2.948228E+00 +tally 2: +1.440456E-01 +3.293984E-03 +tally 3: +9.425207E-03 +1.089748E-05 diff --git a/tests/regression_tests/random_ray_point_source_locator/test.py b/tests/regression_tests/random_ray_point_source_locator/test.py new file mode 100644 index 000000000..fd3d8a18f --- /dev/null +++ b/tests/regression_tests/random_ray_point_source_locator/test.py @@ -0,0 +1,44 @@ +import os + +import openmc +from openmc.examples import random_ray_three_region_cube + +from tests.testing_harness import TolerantPyAPITestHarness + + +class MGXSTestHarness(TolerantPyAPITestHarness): + def _cleanup(self): + super()._cleanup() + f = 'mgxs.h5' + if os.path.exists(f): + os.remove(f) + + +def test_random_ray_point_source_locator(): + model = random_ray_three_region_cube() + + # Overlay subdivided SR mesh to reduce resolution from 2.5cm -> 1cm + width = 30.0 + mesh = openmc.RegularMesh() + mesh.dimension = (30, 30, 30) + mesh.lower_left = (0.0, 0.0, 0.0) + mesh.upper_right = (width, width, width) + model.settings.random_ray['source_region_meshes'] = [ + (mesh, [model.geometry.root_universe]), + ] + + # Define a point source + strengths = [1.0] + midpoints = [100.0] + energy_distribution = openmc.stats.Discrete(x=midpoints, p=strengths) + spatial_distribution = openmc.stats.Point([2.5, 2.5, 2.5]) + source = openmc.IndependentSource( + energy=energy_distribution, space=spatial_distribution, strength=3.14) + model.settings.source = [source] + + # Settings + model.settings.inactive = 15 + model.settings.batches = 30 + + harness = MGXSTestHarness('statepoint.30.h5', model) + harness.main() diff --git a/tests/regression_tests/random_ray_void/flat/inputs_true.dat b/tests/regression_tests/random_ray_void/flat/inputs_true.dat index 617a66053..aa28e7b68 100644 --- a/tests/regression_tests/random_ray_void/flat/inputs_true.dat +++ b/tests/regression_tests/random_ray_void/flat/inputs_true.dat @@ -3,24 +3,24 @@ mgxs.h5 - + - + - + - - - - - + + + + + 2.5 2.5 2.5 12 12 12 @@ -182,19 +182,19 @@ 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - - - - - - + + + + + + fixed source 90 40 20 - + 100.0 1.0 @@ -207,12 +207,12 @@ 500.0 100.0 - + 0.0 0.0 0.0 30.0 30.0 30.0 - True + true flat diff --git a/tests/regression_tests/random_ray_void/linear/inputs_true.dat b/tests/regression_tests/random_ray_void/linear/inputs_true.dat index 4b6a682d9..e4b2f22fa 100644 --- a/tests/regression_tests/random_ray_void/linear/inputs_true.dat +++ b/tests/regression_tests/random_ray_void/linear/inputs_true.dat @@ -3,24 +3,24 @@ mgxs.h5 - + - + - + - - - - - + + + + + 2.5 2.5 2.5 12 12 12 @@ -182,19 +182,19 @@ 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - - - - - - + + + + + + fixed source 90 40 20 - + 100.0 1.0 @@ -207,12 +207,12 @@ 500.0 100.0 - + 0.0 0.0 0.0 30.0 30.0 30.0 - True + true linear diff --git a/tests/regression_tests/random_ray_volume_estimator/hybrid/inputs_true.dat b/tests/regression_tests/random_ray_volume_estimator/hybrid/inputs_true.dat index 9c15ec97d..8e8a8ed9b 100644 --- a/tests/regression_tests/random_ray_volume_estimator/hybrid/inputs_true.dat +++ b/tests/regression_tests/random_ray_volume_estimator/hybrid/inputs_true.dat @@ -3,24 +3,24 @@ mgxs.h5 - + - + - + - - - - - + + + + + 2.5 2.5 2.5 12 12 12 @@ -182,19 +182,19 @@ 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - - - - - - + + + + + + fixed source 90 10 5 - + 100.0 1.0 @@ -207,12 +207,12 @@ 500.0 100.0 - + 0.0 0.0 0.0 30.0 30.0 30.0 - True + true hybrid diff --git a/tests/regression_tests/random_ray_volume_estimator/naive/inputs_true.dat b/tests/regression_tests/random_ray_volume_estimator/naive/inputs_true.dat index 7d05f0978..1e25b97da 100644 --- a/tests/regression_tests/random_ray_volume_estimator/naive/inputs_true.dat +++ b/tests/regression_tests/random_ray_volume_estimator/naive/inputs_true.dat @@ -3,24 +3,24 @@ mgxs.h5 - + - + - + - - - - - + + + + + 2.5 2.5 2.5 12 12 12 @@ -182,19 +182,19 @@ 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - - - - - - + + + + + + fixed source 90 10 5 - + 100.0 1.0 @@ -207,12 +207,12 @@ 500.0 100.0 - + 0.0 0.0 0.0 30.0 30.0 30.0 - True + true naive diff --git a/tests/regression_tests/random_ray_volume_estimator/simulation_averaged/inputs_true.dat b/tests/regression_tests/random_ray_volume_estimator/simulation_averaged/inputs_true.dat index 301671e6d..78c162697 100644 --- a/tests/regression_tests/random_ray_volume_estimator/simulation_averaged/inputs_true.dat +++ b/tests/regression_tests/random_ray_volume_estimator/simulation_averaged/inputs_true.dat @@ -3,24 +3,24 @@ mgxs.h5 - + - + - + - - - - - + + + + + 2.5 2.5 2.5 12 12 12 @@ -182,19 +182,19 @@ 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - - - - - - + + + + + + fixed source 90 10 5 - + 100.0 1.0 @@ -207,12 +207,12 @@ 500.0 100.0 - + 0.0 0.0 0.0 30.0 30.0 30.0 - True + true simulation_averaged diff --git a/tests/regression_tests/random_ray_volume_estimator_linear/hybrid/inputs_true.dat b/tests/regression_tests/random_ray_volume_estimator_linear/hybrid/inputs_true.dat index 6440cca04..47a8a7182 100644 --- a/tests/regression_tests/random_ray_volume_estimator_linear/hybrid/inputs_true.dat +++ b/tests/regression_tests/random_ray_volume_estimator_linear/hybrid/inputs_true.dat @@ -3,24 +3,24 @@ mgxs.h5 - + - + - + - - - - - + + + + + 2.5 2.5 2.5 12 12 12 @@ -182,19 +182,19 @@ 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - - - - - - + + + + + + fixed source 90 40 20 - + 100.0 1.0 @@ -207,12 +207,12 @@ 500.0 100.0 - + 0.0 0.0 0.0 30.0 30.0 30.0 - True + true linear hybrid diff --git a/tests/regression_tests/random_ray_volume_estimator_linear/hybrid/results_true.dat b/tests/regression_tests/random_ray_volume_estimator_linear/hybrid/results_true.dat index 2fc08d0a4..e90d6bfdc 100644 --- a/tests/regression_tests/random_ray_volume_estimator_linear/hybrid/results_true.dat +++ b/tests/regression_tests/random_ray_volume_estimator_linear/hybrid/results_true.dat @@ -1,6 +1,6 @@ tally 1: -2.339085E+00 -2.747304E-01 +2.339086E+00 +2.747305E-01 tally 2: 1.089827E-01 6.069324E-04 diff --git a/tests/regression_tests/random_ray_volume_estimator_linear/naive/inputs_true.dat b/tests/regression_tests/random_ray_volume_estimator_linear/naive/inputs_true.dat index fcf93b046..80a9ada4d 100644 --- a/tests/regression_tests/random_ray_volume_estimator_linear/naive/inputs_true.dat +++ b/tests/regression_tests/random_ray_volume_estimator_linear/naive/inputs_true.dat @@ -3,24 +3,24 @@ mgxs.h5 - + - + - + - - - - - + + + + + 2.5 2.5 2.5 12 12 12 @@ -182,19 +182,19 @@ 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - - - - - - + + + + + + fixed source 90 40 20 - + 100.0 1.0 @@ -207,12 +207,12 @@ 500.0 100.0 - + 0.0 0.0 0.0 30.0 30.0 30.0 - True + true linear naive diff --git a/tests/regression_tests/random_ray_volume_estimator_linear/simulation_averaged/inputs_true.dat b/tests/regression_tests/random_ray_volume_estimator_linear/simulation_averaged/inputs_true.dat index 1df3204a3..4f032a62a 100644 --- a/tests/regression_tests/random_ray_volume_estimator_linear/simulation_averaged/inputs_true.dat +++ b/tests/regression_tests/random_ray_volume_estimator_linear/simulation_averaged/inputs_true.dat @@ -3,24 +3,24 @@ mgxs.h5 - + - + - + - - - - - + + + + + 2.5 2.5 2.5 12 12 12 @@ -182,19 +182,19 @@ 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - - - - - - + + + + + + fixed source 90 40 20 - + 100.0 1.0 @@ -207,12 +207,12 @@ 500.0 100.0 - + 0.0 0.0 0.0 30.0 30.0 30.0 - True + true linear simulation_averaged diff --git a/tests/regression_tests/reflective_plane/results_true.dat b/tests/regression_tests/reflective_plane/results_true.dat index a1acfaad7..a4d6edb67 100644 --- a/tests/regression_tests/reflective_plane/results_true.dat +++ b/tests/regression_tests/reflective_plane/results_true.dat @@ -1,2 +1,2 @@ k-combined: -2.276857E+00 8.776678E-03 +2.279066E+00 4.793565E-03 diff --git a/tests/regression_tests/resonance_scattering/inputs_true.dat b/tests/regression_tests/resonance_scattering/inputs_true.dat index dba4535c2..ebe6a5dbe 100644 --- a/tests/regression_tests/resonance_scattering/inputs_true.dat +++ b/tests/regression_tests/resonance_scattering/inputs_true.dat @@ -1,24 +1,24 @@ - - - - - - + + + + + + - + eigenvalue 1000 10 5 - + -4 -4 -4 4 4 4 diff --git a/tests/regression_tests/resonance_scattering/results_true.dat b/tests/regression_tests/resonance_scattering/results_true.dat index 8316e720e..72f0933b8 100644 --- a/tests/regression_tests/resonance_scattering/results_true.dat +++ b/tests/regression_tests/resonance_scattering/results_true.dat @@ -1,2 +1,2 @@ k-combined: -1.462509E+00 2.205413E-02 +1.462428E+00 1.828903E-02 diff --git a/tests/regression_tests/rotation/results_true.dat b/tests/regression_tests/rotation/results_true.dat index 0fb8ba981..6db3d329a 100644 --- a/tests/regression_tests/rotation/results_true.dat +++ b/tests/regression_tests/rotation/results_true.dat @@ -1,2 +1,2 @@ k-combined: -4.175600E-01 1.117465E-02 +4.459219E-01 1.899168E-02 diff --git a/tests/regression_tests/salphabeta/inputs_true.dat b/tests/regression_tests/salphabeta/inputs_true.dat index ef0e843c2..56f4be375 100644 --- a/tests/regression_tests/salphabeta/inputs_true.dat +++ b/tests/regression_tests/salphabeta/inputs_true.dat @@ -1,36 +1,36 @@ - - - - - + + + + + - - - - + + + + - - - - - + + + + + - - - - - - - - - - + + + + + + + + + + @@ -40,18 +40,18 @@ - - - - - + + + + + eigenvalue 400 5 0 - + -4 -4 -4 4 4 4 diff --git a/tests/regression_tests/salphabeta/results_true.dat b/tests/regression_tests/salphabeta/results_true.dat index d5c7f66e9..75a81075e 100644 --- a/tests/regression_tests/salphabeta/results_true.dat +++ b/tests/regression_tests/salphabeta/results_true.dat @@ -1,2 +1,2 @@ k-combined: -8.694866E-01 2.033328E-02 +8.628529E-01 3.120924E-02 diff --git a/tests/regression_tests/score_current/inputs_true.dat b/tests/regression_tests/score_current/inputs_true.dat index ddbd6c24b..42c2d3df2 100644 --- a/tests/regression_tests/score_current/inputs_true.dat +++ b/tests/regression_tests/score_current/inputs_true.dat @@ -1,28 +1,28 @@ - - - + + + - - + + - - - - - - - - - - + + + + + + + + + + eigenvalue diff --git a/tests/regression_tests/score_current/results_true.dat b/tests/regression_tests/score_current/results_true.dat index ff939301d..6bb74445c 100644 --- a/tests/regression_tests/score_current/results_true.dat +++ b/tests/regression_tests/score_current/results_true.dat @@ -1,274 +1,490 @@ k-combined: -2.298294E-01 3.256961E-01 +7.729082E-01 3.775399E-02 tally 1: 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -1.150000E-01 -2.753000E-03 -1.820000E-01 -6.756000E-03 +1.200000E-01 +2.924000E-03 +1.740000E-01 +6.270000E-03 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -1.110000E-01 -2.601000E-03 -1.530000E-01 -4.865000E-03 -1.910000E-01 -7.535000E-03 +1.200000E-01 +3.044000E-03 +1.510000E-01 +4.615000E-03 +1.710000E-01 +6.067000E-03 0.000000E+00 0.000000E+00 -7.100000E-02 -1.079000E-03 -1.500000E-01 -4.606000E-03 -1.820000E-01 -6.756000E-03 -1.150000E-01 -2.753000E-03 -1.610000E-01 -5.383000E-03 -1.230000E-01 -3.141000E-03 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.370000E-01 -3.951000E-03 -2.600000E-01 -1.366400E-02 -1.930000E-01 -7.573000E-03 -0.000000E+00 -0.000000E+00 -8.500000E-02 -1.533000E-03 -2.040000E-01 -8.426000E-03 -1.230000E-01 -3.141000E-03 -1.610000E-01 -5.383000E-03 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.250000E-01 -3.311000E-03 -1.620000E-01 -5.346000E-03 -1.860000E-01 -6.932000E-03 -0.000000E+00 -0.000000E+00 -7.100000E-02 -1.083000E-03 -1.630000E-01 -5.617000E-03 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.800000E-01 -7.002000E-03 -2.980000E-01 -1.815000E-02 -1.530000E-01 -4.865000E-03 -1.110000E-01 -2.601000E-03 -1.890000E-01 -7.605000E-03 -1.330000E-01 -3.743000E-03 -1.790000E-01 -6.495000E-03 -0.000000E+00 -0.000000E+00 -1.080000E-01 -2.718000E-03 -2.160000E-01 -9.662000E-03 -2.980000E-01 -1.815000E-02 -1.800000E-01 -7.002000E-03 -2.650000E-01 -1.435500E-02 -1.590000E-01 -5.285000E-03 -2.600000E-01 -1.366400E-02 -1.370000E-01 -3.951000E-03 -2.670000E-01 -1.469300E-02 -1.940000E-01 -7.678000E-03 -2.390000E-01 -1.155500E-02 -0.000000E+00 -0.000000E+00 -2.410000E-01 -1.255900E-02 -5.510000E-01 -7.358900E-02 -1.590000E-01 -5.285000E-03 -2.650000E-01 -1.435500E-02 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.620000E-01 -5.346000E-03 -1.250000E-01 -3.311000E-03 -1.870000E-01 -7.083000E-03 +6.500000E-02 +9.390000E-04 1.410000E-01 -3.999000E-03 -2.040000E-01 -8.438000E-03 +4.001000E-03 +1.740000E-01 +6.270000E-03 +1.200000E-01 +2.924000E-03 +1.830000E-01 +6.879000E-03 +1.310000E-01 +3.541000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.750000E-01 +6.659000E-03 +2.820000E-01 +1.605400E-02 +1.980000E-01 +7.932000E-03 +0.000000E+00 +0.000000E+00 +9.400000E-02 +1.912000E-03 +2.200000E-01 +9.958000E-03 +1.310000E-01 +3.541000E-03 +1.830000E-01 +6.879000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.110000E-01 +2.639000E-03 +1.360000E-01 +3.890000E-03 +1.770000E-01 +6.551000E-03 +0.000000E+00 +0.000000E+00 +6.700000E-02 +9.310000E-04 +1.570000E-01 +4.975000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.480000E-01 +4.910000E-03 +2.720000E-01 +1.490600E-02 +1.510000E-01 +4.615000E-03 +1.200000E-01 +3.044000E-03 +1.800000E-01 +6.720000E-03 +1.050000E-01 +2.285000E-03 +1.790000E-01 +6.499000E-03 0.000000E+00 0.000000E+00 9.300000E-02 -1.829000E-03 -2.240000E-01 -1.015800E-02 +1.927000E-03 +2.160000E-01 +9.418000E-03 +2.720000E-01 +1.490600E-02 +1.480000E-01 +4.910000E-03 +2.680000E-01 +1.445800E-02 +1.480000E-01 +4.488000E-03 +2.820000E-01 +1.605400E-02 +1.750000E-01 +6.659000E-03 +2.510000E-01 +1.283100E-02 +1.870000E-01 +7.731000E-03 +2.340000E-01 +1.105000E-02 +0.000000E+00 +0.000000E+00 +2.110000E-01 +9.215000E-03 +5.470000E-01 +7.228300E-02 +1.480000E-01 +4.488000E-03 +2.680000E-01 +1.445800E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.360000E-01 +3.890000E-03 +1.110000E-01 +2.639000E-03 +1.540000E-01 +4.804000E-03 +1.280000E-01 +3.302000E-03 +2.200000E-01 +9.834000E-03 +0.000000E+00 +0.000000E+00 +9.900000E-02 +2.127000E-03 +1.860000E-01 +7.198000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.430000E-01 +4.337000E-03 +1.580000E-01 +5.104000E-03 +1.050000E-01 +2.285000E-03 +1.800000E-01 +6.720000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.860000E-01 +7.178000E-03 +0.000000E+00 +0.000000E+00 +7.000000E-02 +1.020000E-03 +1.610000E-01 +5.237000E-03 +1.580000E-01 +5.104000E-03 +1.430000E-01 +4.337000E-03 +1.580000E-01 +5.254000E-03 +1.230000E-01 +3.091000E-03 +1.870000E-01 +7.731000E-03 +2.510000E-01 +1.283100E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.980000E-01 +7.934000E-03 +0.000000E+00 +0.000000E+00 +9.500000E-02 +1.949000E-03 +2.150000E-01 +9.289000E-03 +1.230000E-01 +3.091000E-03 +1.580000E-01 +5.254000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.280000E-01 +3.302000E-03 +1.540000E-01 +4.804000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.640000E-01 +5.424000E-03 +0.000000E+00 +0.000000E+00 +6.200000E-02 +8.020000E-04 +1.500000E-01 +4.588000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.700000E-01 +5.884000E-03 +2.280000E-01 +1.084800E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.540000E-01 +4.856000E-03 +2.250000E-01 +1.047100E-02 +1.410000E-01 +4.001000E-03 +6.500000E-02 +9.390000E-04 +1.360000E-01 +3.852000E-03 +6.400000E-02 +8.700000E-04 +2.280000E-01 +1.084800E-02 +1.700000E-01 +5.884000E-03 +2.230000E-01 +1.001100E-02 +1.410000E-01 +4.185000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.980000E-01 +8.038000E-03 +5.030000E-01 +5.613900E-02 +2.200000E-01 +9.958000E-03 +9.400000E-02 +1.912000E-03 +2.140000E-01 +9.376000E-03 +7.300000E-02 +1.091000E-03 +1.410000E-01 +4.185000E-03 +2.230000E-01 +1.001100E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.540000E-01 +4.808000E-03 +2.340000E-01 +1.119400E-02 +1.570000E-01 +4.975000E-03 +6.700000E-02 +9.310000E-04 +1.600000E-01 +5.134000E-03 +5.300000E-02 +6.110000E-04 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.310000E-01 +1.084100E-02 +5.390000E-01 +6.215100E-02 +2.250000E-01 +1.047100E-02 +1.540000E-01 +4.856000E-03 +2.280000E-01 +1.059800E-02 +1.600000E-01 +5.214000E-03 +2.160000E-01 +9.418000E-03 +9.300000E-02 +1.927000E-03 +2.510000E-01 +1.271500E-02 +1.030000E-01 +2.229000E-03 +5.390000E-01 +6.215100E-02 +2.310000E-01 +1.084100E-02 +4.700000E-01 +4.972200E-02 +2.190000E-01 +9.821000E-03 +5.030000E-01 +5.613900E-02 +1.980000E-01 +8.038000E-03 +5.100000E-01 +5.929000E-02 +2.140000E-01 +9.406000E-03 +5.470000E-01 +7.228300E-02 +2.110000E-01 +9.215000E-03 +5.160000E-01 +5.892200E-02 +2.550000E-01 +1.480500E-02 +2.190000E-01 +9.821000E-03 +4.700000E-01 +4.972200E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.340000E-01 +1.119400E-02 +1.540000E-01 +4.808000E-03 +2.170000E-01 +9.509000E-03 +1.600000E-01 +5.156000E-03 +1.860000E-01 +7.198000E-03 +9.900000E-02 +2.127000E-03 +2.290000E-01 +1.058700E-02 +9.000000E-02 +1.780000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.550000E-01 +4.913000E-03 +2.380000E-01 +1.153400E-02 +1.600000E-01 +5.214000E-03 +2.280000E-01 +1.059800E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.610000E-01 +5.237000E-03 +7.000000E-02 +1.020000E-03 +1.410000E-01 +4.071000E-03 +6.100000E-02 +8.350000E-04 +2.380000E-01 +1.153400E-02 +1.550000E-01 +4.913000E-03 +2.320000E-01 +1.100400E-02 +1.460000E-01 +4.498000E-03 +2.140000E-01 +9.406000E-03 +5.100000E-01 +5.929000E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.150000E-01 +9.289000E-03 +9.500000E-02 +1.949000E-03 +1.870000E-01 +7.267000E-03 +1.030000E-01 +2.543000E-03 +1.460000E-01 +4.498000E-03 +2.320000E-01 +1.100400E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.600000E-01 +5.156000E-03 +2.170000E-01 +9.509000E-03 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 1.500000E-01 -4.522000E-03 -1.630000E-01 -5.439000E-03 -1.330000E-01 -3.743000E-03 -1.890000E-01 -7.605000E-03 +4.588000E-03 +6.200000E-02 +8.020000E-04 +1.290000E-01 +3.487000E-03 +6.000000E-02 +8.060000E-04 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 +1.090000E-01 +2.437000E-03 +1.650000E-01 +5.655000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.230000E-01 +3.065000E-03 +1.570000E-01 +4.999000E-03 +6.400000E-02 +8.700000E-04 +1.360000E-01 +3.852000E-03 +1.750000E-01 +6.299000E-03 +0.000000E+00 +0.000000E+00 1.650000E-01 -5.615000E-03 -0.000000E+00 -0.000000E+00 -7.100000E-02 -1.191000E-03 -1.550000E-01 -5.011000E-03 -1.630000E-01 -5.439000E-03 -1.500000E-01 -4.522000E-03 -1.680000E-01 -5.966000E-03 -1.290000E-01 -3.515000E-03 -1.940000E-01 -7.678000E-03 -2.670000E-01 -1.469300E-02 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.810000E-01 -6.765000E-03 -0.000000E+00 -0.000000E+00 -1.080000E-01 -2.694000E-03 -2.070000E-01 -8.673000E-03 -1.290000E-01 -3.515000E-03 -1.680000E-01 -5.966000E-03 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.410000E-01 -3.999000E-03 -1.870000E-01 -7.083000E-03 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.870000E-01 -7.213000E-03 -0.000000E+00 -0.000000E+00 -8.200000E-02 -1.536000E-03 -1.760000E-01 -6.550000E-03 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.750000E-01 -6.163000E-03 -2.570000E-01 -1.347100E-02 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.560000E-01 -4.914000E-03 -2.350000E-01 -1.135900E-02 -1.500000E-01 -4.606000E-03 -7.100000E-02 -1.079000E-03 -1.530000E-01 -4.837000E-03 -5.600000E-02 -7.260000E-04 -2.570000E-01 -1.347100E-02 -1.750000E-01 -6.163000E-03 -2.460000E-01 -1.235000E-02 -1.420000E-01 -4.326000E-03 +5.655000E-03 +1.090000E-01 +2.437000E-03 +1.480000E-01 +4.674000E-03 +1.320000E-01 +3.548000E-03 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 +1.440000E-01 +4.282000E-03 +2.190000E-01 +9.683000E-03 +7.300000E-02 +1.091000E-03 +2.140000E-01 +9.376000E-03 1.830000E-01 -7.133000E-03 -5.110000E-01 -5.696100E-02 -2.040000E-01 -8.426000E-03 -8.500000E-02 -1.533000E-03 -2.100000E-01 -8.928000E-03 -9.100000E-02 -1.807000E-03 -1.420000E-01 -4.326000E-03 -2.460000E-01 -1.235000E-02 +6.803000E-03 +0.000000E+00 +0.000000E+00 +1.320000E-01 +3.548000E-03 +1.480000E-01 +4.674000E-03 0.000000E+00 0.000000E+00 0.000000E+00 @@ -277,376 +493,160 @@ tally 1: 0.000000E+00 0.000000E+00 0.000000E+00 +1.350000E-01 +3.895000E-03 1.430000E-01 -4.207000E-03 -2.120000E-01 -9.278000E-03 -1.630000E-01 -5.617000E-03 -7.100000E-02 -1.083000E-03 -1.770000E-01 -6.293000E-03 -7.900000E-02 -1.495000E-03 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -2.300000E-01 -1.081000E-02 -5.200000E-01 -5.835000E-02 -2.350000E-01 -1.135900E-02 -1.560000E-01 -4.914000E-03 -2.370000E-01 -1.142300E-02 -1.360000E-01 -3.882000E-03 -2.160000E-01 -9.662000E-03 -1.080000E-01 -2.718000E-03 -2.090000E-01 -8.841000E-03 -1.030000E-01 -2.271000E-03 -5.200000E-01 -5.835000E-02 -2.300000E-01 -1.081000E-02 -5.110000E-01 -5.615900E-02 -2.430000E-01 -1.228300E-02 -5.110000E-01 -5.696100E-02 -1.830000E-01 -7.133000E-03 -5.130000E-01 -6.002100E-02 -2.420000E-01 -1.209200E-02 -5.510000E-01 -7.358900E-02 -2.410000E-01 -1.255900E-02 -5.140000E-01 -5.890200E-02 -2.100000E-01 -1.004600E-02 -2.430000E-01 -1.228300E-02 -5.110000E-01 -5.615900E-02 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -2.120000E-01 -9.278000E-03 -1.430000E-01 -4.207000E-03 -2.380000E-01 -1.133600E-02 -1.640000E-01 -5.444000E-03 -2.240000E-01 -1.015800E-02 -9.300000E-02 -1.829000E-03 -1.950000E-01 -7.705000E-03 -1.030000E-01 -2.191000E-03 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.680000E-01 -5.878000E-03 -2.230000E-01 -1.049900E-02 -1.360000E-01 -3.882000E-03 -2.370000E-01 -1.142300E-02 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.550000E-01 -5.011000E-03 -7.100000E-02 -1.191000E-03 -1.510000E-01 -4.845000E-03 -6.400000E-02 -9.460000E-04 -2.230000E-01 -1.049900E-02 -1.680000E-01 -5.878000E-03 -2.490000E-01 -1.255900E-02 -1.280000E-01 -3.448000E-03 -2.420000E-01 -1.209200E-02 -5.130000E-01 -6.002100E-02 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -2.070000E-01 -8.673000E-03 -1.080000E-01 -2.694000E-03 -2.000000E-01 -8.202000E-03 -9.600000E-02 -2.024000E-03 -1.280000E-01 -3.448000E-03 -2.490000E-01 -1.255900E-02 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.640000E-01 -5.444000E-03 -2.380000E-01 -1.133600E-02 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.760000E-01 -6.550000E-03 -8.200000E-02 -1.536000E-03 -1.670000E-01 -5.653000E-03 -4.900000E-02 -5.630000E-04 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.320000E-01 -3.626000E-03 -1.510000E-01 -4.831000E-03 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.370000E-01 -3.855000E-03 -1.610000E-01 -5.233000E-03 -5.600000E-02 -7.260000E-04 -1.530000E-01 -4.837000E-03 -1.610000E-01 -5.261000E-03 -0.000000E+00 -0.000000E+00 -1.510000E-01 -4.831000E-03 -1.320000E-01 -3.626000E-03 -1.490000E-01 -4.731000E-03 -1.320000E-01 -3.514000E-03 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.550000E-01 -4.921000E-03 -2.410000E-01 -1.168300E-02 -9.100000E-02 -1.807000E-03 -2.100000E-01 -8.928000E-03 -2.090000E-01 -8.775000E-03 -0.000000E+00 -0.000000E+00 -1.320000E-01 -3.514000E-03 -1.490000E-01 -4.731000E-03 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.150000E-01 -2.891000E-03 -1.560000E-01 -5.154000E-03 -7.900000E-02 -1.495000E-03 -1.770000E-01 -6.293000E-03 +4.297000E-03 +5.300000E-02 +6.110000E-04 1.600000E-01 -5.352000E-03 +5.134000E-03 +1.380000E-01 +4.220000E-03 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -1.610000E-01 -5.273000E-03 -2.310000E-01 -1.098100E-02 -1.610000E-01 -5.233000E-03 -1.370000E-01 -3.855000E-03 -1.760000E-01 -6.482000E-03 -1.340000E-01 -3.882000E-03 +1.900000E-01 +7.412000E-03 +2.420000E-01 +1.208400E-02 +1.570000E-01 +4.999000E-03 +1.230000E-01 +3.065000E-03 +1.730000E-01 +6.279000E-03 +1.330000E-01 +3.621000E-03 1.030000E-01 -2.271000E-03 -2.090000E-01 -8.841000E-03 -1.830000E-01 -6.761000E-03 -0.000000E+00 -0.000000E+00 -2.310000E-01 -1.098100E-02 -1.610000E-01 -5.273000E-03 -2.620000E-01 -1.380600E-02 -1.700000E-01 -5.970000E-03 -2.410000E-01 -1.168300E-02 -1.550000E-01 -4.921000E-03 -2.250000E-01 -1.014100E-02 -1.370000E-01 -3.805000E-03 +2.229000E-03 +2.510000E-01 +1.271500E-02 2.100000E-01 -1.004600E-02 -5.140000E-01 -5.890200E-02 -2.320000E-01 -1.093000E-02 +8.970000E-03 0.000000E+00 0.000000E+00 -1.700000E-01 -5.970000E-03 -2.620000E-01 -1.380600E-02 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.560000E-01 -5.154000E-03 -1.150000E-01 -2.891000E-03 -1.430000E-01 -4.163000E-03 -1.120000E-01 -2.640000E-03 -1.030000E-01 -2.191000E-03 -1.950000E-01 -7.705000E-03 -1.760000E-01 -6.392000E-03 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -9.200000E-02 -1.822000E-03 -1.370000E-01 -3.843000E-03 -1.340000E-01 -3.882000E-03 -1.760000E-01 -6.482000E-03 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -6.400000E-02 -9.460000E-04 -1.510000E-01 -4.845000E-03 -1.800000E-01 -6.520000E-03 -0.000000E+00 -0.000000E+00 -1.370000E-01 -3.843000E-03 -9.200000E-02 -1.822000E-03 -1.300000E-01 -3.604000E-03 -1.170000E-01 -2.789000E-03 -1.370000E-01 -3.805000E-03 -2.250000E-01 -1.014100E-02 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -9.600000E-02 -2.024000E-03 +2.420000E-01 +1.208400E-02 +1.900000E-01 +7.412000E-03 +2.610000E-01 +1.399900E-02 2.000000E-01 -8.202000E-03 -1.820000E-01 -6.660000E-03 +8.410000E-03 +2.190000E-01 +9.683000E-03 +1.440000E-01 +4.282000E-03 +2.690000E-01 +1.478100E-02 +1.540000E-01 +4.986000E-03 +2.550000E-01 +1.480500E-02 +5.160000E-01 +5.892200E-02 +2.310000E-01 +1.098900E-02 +0.000000E+00 +0.000000E+00 +2.000000E-01 +8.410000E-03 +2.610000E-01 +1.399900E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.430000E-01 +4.297000E-03 +1.350000E-01 +3.895000E-03 +1.760000E-01 +6.534000E-03 +1.170000E-01 +2.807000E-03 +9.000000E-02 +1.780000E-03 +2.290000E-01 +1.058700E-02 +2.080000E-01 +8.854000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.230000E-01 +3.305000E-03 +1.760000E-01 +6.598000E-03 +1.330000E-01 +3.621000E-03 +1.730000E-01 +6.279000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +6.100000E-02 +8.350000E-04 +1.410000E-01 +4.071000E-03 +1.800000E-01 +6.574000E-03 +0.000000E+00 +0.000000E+00 +1.760000E-01 +6.598000E-03 +1.230000E-01 +3.305000E-03 +1.690000E-01 +6.135000E-03 +1.220000E-01 +3.344000E-03 +1.540000E-01 +4.986000E-03 +2.690000E-01 +1.478100E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.030000E-01 +2.543000E-03 +1.870000E-01 +7.267000E-03 +1.690000E-01 +5.731000E-03 +0.000000E+00 +0.000000E+00 +1.220000E-01 +3.344000E-03 +1.690000E-01 +6.135000E-03 +0.000000E+00 +0.000000E+00 0.000000E+00 0.000000E+00 1.170000E-01 -2.789000E-03 -1.300000E-01 -3.604000E-03 +2.807000E-03 +1.760000E-01 +6.534000E-03 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -1.120000E-01 -2.640000E-03 -1.430000E-01 -4.163000E-03 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -4.900000E-02 -5.630000E-04 -1.670000E-01 -5.653000E-03 -1.670000E-01 -5.701000E-03 +6.000000E-02 +8.060000E-04 +1.290000E-01 +3.487000E-03 +1.790000E-01 +6.747000E-03 0.000000E+00 0.000000E+00 tally 2: @@ -660,12 +660,12 @@ tally 2: 0.000000E+00 0.000000E+00 0.000000E+00 -1.150000E-01 -2.753000E-03 +1.200000E-01 +2.924000E-03 0.000000E+00 0.000000E+00 -1.820000E-01 -6.756000E-03 +1.740000E-01 +6.270000E-03 0.000000E+00 0.000000E+00 0.000000E+00 @@ -676,256 +676,160 @@ tally 2: 0.000000E+00 0.000000E+00 0.000000E+00 -1.110000E-01 -2.601000E-03 +1.200000E-01 +3.044000E-03 0.000000E+00 0.000000E+00 -1.530000E-01 -4.865000E-03 +1.510000E-01 +4.615000E-03 0.000000E+00 0.000000E+00 -1.910000E-01 -7.535000E-03 +1.710000E-01 +6.067000E-03 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -7.100000E-02 -1.079000E-03 -0.000000E+00 -0.000000E+00 -1.500000E-01 -4.606000E-03 -0.000000E+00 -0.000000E+00 -1.820000E-01 -6.756000E-03 -0.000000E+00 -0.000000E+00 -1.150000E-01 -2.753000E-03 -0.000000E+00 -0.000000E+00 -1.610000E-01 -5.383000E-03 -0.000000E+00 -0.000000E+00 -1.230000E-01 -3.141000E-03 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.370000E-01 -3.951000E-03 -0.000000E+00 -0.000000E+00 -2.600000E-01 -1.366400E-02 -0.000000E+00 -0.000000E+00 -1.930000E-01 -7.573000E-03 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -8.500000E-02 -1.533000E-03 -0.000000E+00 -0.000000E+00 -2.040000E-01 -8.426000E-03 -0.000000E+00 -0.000000E+00 -1.230000E-01 -3.141000E-03 -0.000000E+00 -0.000000E+00 -1.610000E-01 -5.383000E-03 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.250000E-01 -3.311000E-03 -0.000000E+00 -0.000000E+00 -1.620000E-01 -5.346000E-03 -0.000000E+00 -0.000000E+00 -1.860000E-01 -6.932000E-03 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -7.100000E-02 -1.083000E-03 -0.000000E+00 -0.000000E+00 -1.630000E-01 -5.617000E-03 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.800000E-01 -7.002000E-03 -0.000000E+00 -0.000000E+00 -2.980000E-01 -1.815000E-02 -0.000000E+00 -0.000000E+00 -1.530000E-01 -4.865000E-03 -0.000000E+00 -0.000000E+00 -1.110000E-01 -2.601000E-03 -0.000000E+00 -0.000000E+00 -1.890000E-01 -7.605000E-03 -0.000000E+00 -0.000000E+00 -1.330000E-01 -3.743000E-03 -0.000000E+00 -0.000000E+00 -1.790000E-01 -6.495000E-03 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.080000E-01 -2.718000E-03 -0.000000E+00 -0.000000E+00 -2.160000E-01 -9.662000E-03 -0.000000E+00 -0.000000E+00 -2.980000E-01 -1.815000E-02 -0.000000E+00 -0.000000E+00 -1.800000E-01 -7.002000E-03 -0.000000E+00 -0.000000E+00 -2.650000E-01 -1.435500E-02 -0.000000E+00 -0.000000E+00 -1.590000E-01 -5.285000E-03 -0.000000E+00 -0.000000E+00 -2.600000E-01 -1.366400E-02 -0.000000E+00 -0.000000E+00 -1.370000E-01 -3.951000E-03 -0.000000E+00 -0.000000E+00 -2.670000E-01 -1.469300E-02 -0.000000E+00 -0.000000E+00 -1.940000E-01 -7.678000E-03 -0.000000E+00 -0.000000E+00 -2.390000E-01 -1.155500E-02 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -2.410000E-01 -1.255900E-02 -0.000000E+00 -0.000000E+00 -5.510000E-01 -7.358900E-02 -0.000000E+00 -0.000000E+00 -1.590000E-01 -5.285000E-03 -0.000000E+00 -0.000000E+00 -2.650000E-01 -1.435500E-02 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.620000E-01 -5.346000E-03 -0.000000E+00 -0.000000E+00 -1.250000E-01 -3.311000E-03 -0.000000E+00 -0.000000E+00 -1.870000E-01 -7.083000E-03 +6.500000E-02 +9.390000E-04 0.000000E+00 0.000000E+00 1.410000E-01 -3.999000E-03 +4.001000E-03 0.000000E+00 0.000000E+00 -2.040000E-01 -8.438000E-03 +1.740000E-01 +6.270000E-03 +0.000000E+00 +0.000000E+00 +1.200000E-01 +2.924000E-03 +0.000000E+00 +0.000000E+00 +1.830000E-01 +6.879000E-03 +0.000000E+00 +0.000000E+00 +1.310000E-01 +3.541000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.750000E-01 +6.659000E-03 +0.000000E+00 +0.000000E+00 +2.820000E-01 +1.605400E-02 +0.000000E+00 +0.000000E+00 +1.980000E-01 +7.932000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +9.400000E-02 +1.912000E-03 +0.000000E+00 +0.000000E+00 +2.200000E-01 +9.958000E-03 +0.000000E+00 +0.000000E+00 +1.310000E-01 +3.541000E-03 +0.000000E+00 +0.000000E+00 +1.830000E-01 +6.879000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.110000E-01 +2.639000E-03 +0.000000E+00 +0.000000E+00 +1.360000E-01 +3.890000E-03 +0.000000E+00 +0.000000E+00 +1.770000E-01 +6.551000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +6.700000E-02 +9.310000E-04 +0.000000E+00 +0.000000E+00 +1.570000E-01 +4.975000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.480000E-01 +4.910000E-03 +0.000000E+00 +0.000000E+00 +2.720000E-01 +1.490600E-02 +0.000000E+00 +0.000000E+00 +1.510000E-01 +4.615000E-03 +0.000000E+00 +0.000000E+00 +1.200000E-01 +3.044000E-03 +0.000000E+00 +0.000000E+00 +1.800000E-01 +6.720000E-03 +0.000000E+00 +0.000000E+00 +1.050000E-01 +2.285000E-03 +0.000000E+00 +0.000000E+00 +1.790000E-01 +6.499000E-03 0.000000E+00 0.000000E+00 0.000000E+00 @@ -933,11 +837,659 @@ tally 2: 0.000000E+00 0.000000E+00 9.300000E-02 -1.829000E-03 +1.927000E-03 0.000000E+00 0.000000E+00 -2.240000E-01 -1.015800E-02 +2.160000E-01 +9.418000E-03 +0.000000E+00 +0.000000E+00 +2.720000E-01 +1.490600E-02 +0.000000E+00 +0.000000E+00 +1.480000E-01 +4.910000E-03 +0.000000E+00 +0.000000E+00 +2.680000E-01 +1.445800E-02 +0.000000E+00 +0.000000E+00 +1.480000E-01 +4.488000E-03 +0.000000E+00 +0.000000E+00 +2.820000E-01 +1.605400E-02 +0.000000E+00 +0.000000E+00 +1.750000E-01 +6.659000E-03 +0.000000E+00 +0.000000E+00 +2.510000E-01 +1.283100E-02 +0.000000E+00 +0.000000E+00 +1.870000E-01 +7.731000E-03 +0.000000E+00 +0.000000E+00 +2.340000E-01 +1.105000E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.110000E-01 +9.215000E-03 +0.000000E+00 +0.000000E+00 +5.470000E-01 +7.228300E-02 +0.000000E+00 +0.000000E+00 +1.480000E-01 +4.488000E-03 +0.000000E+00 +0.000000E+00 +2.680000E-01 +1.445800E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.360000E-01 +3.890000E-03 +0.000000E+00 +0.000000E+00 +1.110000E-01 +2.639000E-03 +0.000000E+00 +0.000000E+00 +1.540000E-01 +4.804000E-03 +0.000000E+00 +0.000000E+00 +1.280000E-01 +3.302000E-03 +0.000000E+00 +0.000000E+00 +2.200000E-01 +9.834000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +9.900000E-02 +2.127000E-03 +0.000000E+00 +0.000000E+00 +1.860000E-01 +7.198000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.430000E-01 +4.337000E-03 +0.000000E+00 +0.000000E+00 +1.580000E-01 +5.104000E-03 +0.000000E+00 +0.000000E+00 +1.050000E-01 +2.285000E-03 +0.000000E+00 +0.000000E+00 +1.800000E-01 +6.720000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.860000E-01 +7.178000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +7.000000E-02 +1.020000E-03 +0.000000E+00 +0.000000E+00 +1.610000E-01 +5.237000E-03 +0.000000E+00 +0.000000E+00 +1.580000E-01 +5.104000E-03 +0.000000E+00 +0.000000E+00 +1.430000E-01 +4.337000E-03 +0.000000E+00 +0.000000E+00 +1.580000E-01 +5.254000E-03 +0.000000E+00 +0.000000E+00 +1.230000E-01 +3.091000E-03 +0.000000E+00 +0.000000E+00 +1.870000E-01 +7.731000E-03 +0.000000E+00 +0.000000E+00 +2.510000E-01 +1.283100E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.980000E-01 +7.934000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +9.500000E-02 +1.949000E-03 +0.000000E+00 +0.000000E+00 +2.150000E-01 +9.289000E-03 +0.000000E+00 +0.000000E+00 +1.230000E-01 +3.091000E-03 +0.000000E+00 +0.000000E+00 +1.580000E-01 +5.254000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.280000E-01 +3.302000E-03 +0.000000E+00 +0.000000E+00 +1.540000E-01 +4.804000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.640000E-01 +5.424000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +6.200000E-02 +8.020000E-04 +0.000000E+00 +0.000000E+00 +1.500000E-01 +4.588000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.700000E-01 +5.884000E-03 +0.000000E+00 +0.000000E+00 +2.280000E-01 +1.084800E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.540000E-01 +4.856000E-03 +0.000000E+00 +0.000000E+00 +2.250000E-01 +1.047100E-02 +0.000000E+00 +0.000000E+00 +1.410000E-01 +4.001000E-03 +0.000000E+00 +0.000000E+00 +6.500000E-02 +9.390000E-04 +0.000000E+00 +0.000000E+00 +1.360000E-01 +3.852000E-03 +0.000000E+00 +0.000000E+00 +6.400000E-02 +8.700000E-04 +0.000000E+00 +0.000000E+00 +2.280000E-01 +1.084800E-02 +0.000000E+00 +0.000000E+00 +1.700000E-01 +5.884000E-03 +0.000000E+00 +0.000000E+00 +2.230000E-01 +1.001100E-02 +0.000000E+00 +0.000000E+00 +1.410000E-01 +4.185000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.980000E-01 +8.038000E-03 +0.000000E+00 +0.000000E+00 +5.030000E-01 +5.613900E-02 +0.000000E+00 +0.000000E+00 +2.200000E-01 +9.958000E-03 +0.000000E+00 +0.000000E+00 +9.400000E-02 +1.912000E-03 +0.000000E+00 +0.000000E+00 +2.140000E-01 +9.376000E-03 +0.000000E+00 +0.000000E+00 +7.300000E-02 +1.091000E-03 +0.000000E+00 +0.000000E+00 +1.410000E-01 +4.185000E-03 +0.000000E+00 +0.000000E+00 +2.230000E-01 +1.001100E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.540000E-01 +4.808000E-03 +0.000000E+00 +0.000000E+00 +2.340000E-01 +1.119400E-02 +0.000000E+00 +0.000000E+00 +1.570000E-01 +4.975000E-03 +0.000000E+00 +0.000000E+00 +6.700000E-02 +9.310000E-04 +0.000000E+00 +0.000000E+00 +1.600000E-01 +5.134000E-03 +0.000000E+00 +0.000000E+00 +5.300000E-02 +6.110000E-04 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.310000E-01 +1.084100E-02 +0.000000E+00 +0.000000E+00 +5.390000E-01 +6.215100E-02 +0.000000E+00 +0.000000E+00 +2.250000E-01 +1.047100E-02 +0.000000E+00 +0.000000E+00 +1.540000E-01 +4.856000E-03 +0.000000E+00 +0.000000E+00 +2.280000E-01 +1.059800E-02 +0.000000E+00 +0.000000E+00 +1.600000E-01 +5.214000E-03 +0.000000E+00 +0.000000E+00 +2.160000E-01 +9.418000E-03 +0.000000E+00 +0.000000E+00 +9.300000E-02 +1.927000E-03 +0.000000E+00 +0.000000E+00 +2.510000E-01 +1.271500E-02 +0.000000E+00 +0.000000E+00 +1.030000E-01 +2.229000E-03 +0.000000E+00 +0.000000E+00 +5.390000E-01 +6.215100E-02 +0.000000E+00 +0.000000E+00 +2.310000E-01 +1.084100E-02 +0.000000E+00 +0.000000E+00 +4.700000E-01 +4.972200E-02 +0.000000E+00 +0.000000E+00 +2.190000E-01 +9.821000E-03 +0.000000E+00 +0.000000E+00 +5.030000E-01 +5.613900E-02 +0.000000E+00 +0.000000E+00 +1.980000E-01 +8.038000E-03 +0.000000E+00 +0.000000E+00 +5.100000E-01 +5.929000E-02 +0.000000E+00 +0.000000E+00 +2.140000E-01 +9.406000E-03 +0.000000E+00 +0.000000E+00 +5.470000E-01 +7.228300E-02 +0.000000E+00 +0.000000E+00 +2.110000E-01 +9.215000E-03 +0.000000E+00 +0.000000E+00 +5.160000E-01 +5.892200E-02 +0.000000E+00 +0.000000E+00 +2.550000E-01 +1.480500E-02 +0.000000E+00 +0.000000E+00 +2.190000E-01 +9.821000E-03 +0.000000E+00 +0.000000E+00 +4.700000E-01 +4.972200E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.340000E-01 +1.119400E-02 +0.000000E+00 +0.000000E+00 +1.540000E-01 +4.808000E-03 +0.000000E+00 +0.000000E+00 +2.170000E-01 +9.509000E-03 +0.000000E+00 +0.000000E+00 +1.600000E-01 +5.156000E-03 +0.000000E+00 +0.000000E+00 +1.860000E-01 +7.198000E-03 +0.000000E+00 +0.000000E+00 +9.900000E-02 +2.127000E-03 +0.000000E+00 +0.000000E+00 +2.290000E-01 +1.058700E-02 +0.000000E+00 +0.000000E+00 +9.000000E-02 +1.780000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.550000E-01 +4.913000E-03 +0.000000E+00 +0.000000E+00 +2.380000E-01 +1.153400E-02 +0.000000E+00 +0.000000E+00 +1.600000E-01 +5.214000E-03 +0.000000E+00 +0.000000E+00 +2.280000E-01 +1.059800E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.610000E-01 +5.237000E-03 +0.000000E+00 +0.000000E+00 +7.000000E-02 +1.020000E-03 +0.000000E+00 +0.000000E+00 +1.410000E-01 +4.071000E-03 +0.000000E+00 +0.000000E+00 +6.100000E-02 +8.350000E-04 +0.000000E+00 +0.000000E+00 +2.380000E-01 +1.153400E-02 +0.000000E+00 +0.000000E+00 +1.550000E-01 +4.913000E-03 +0.000000E+00 +0.000000E+00 +2.320000E-01 +1.100400E-02 +0.000000E+00 +0.000000E+00 +1.460000E-01 +4.498000E-03 +0.000000E+00 +0.000000E+00 +2.140000E-01 +9.406000E-03 +0.000000E+00 +0.000000E+00 +5.100000E-01 +5.929000E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.150000E-01 +9.289000E-03 +0.000000E+00 +0.000000E+00 +9.500000E-02 +1.949000E-03 +0.000000E+00 +0.000000E+00 +1.870000E-01 +7.267000E-03 +0.000000E+00 +0.000000E+00 +1.030000E-01 +2.543000E-03 +0.000000E+00 +0.000000E+00 +1.460000E-01 +4.498000E-03 +0.000000E+00 +0.000000E+00 +2.320000E-01 +1.100400E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.600000E-01 +5.156000E-03 +0.000000E+00 +0.000000E+00 +2.170000E-01 +9.509000E-03 0.000000E+00 0.000000E+00 0.000000E+00 @@ -949,19 +1501,19 @@ tally 2: 0.000000E+00 0.000000E+00 1.500000E-01 -4.522000E-03 +4.588000E-03 0.000000E+00 0.000000E+00 -1.630000E-01 -5.439000E-03 +6.200000E-02 +8.020000E-04 0.000000E+00 0.000000E+00 -1.330000E-01 -3.743000E-03 +1.290000E-01 +3.487000E-03 0.000000E+00 0.000000E+00 -1.890000E-01 -7.605000E-03 +6.000000E-02 +8.060000E-04 0.000000E+00 0.000000E+00 0.000000E+00 @@ -972,220 +1524,100 @@ tally 2: 0.000000E+00 0.000000E+00 0.000000E+00 +1.090000E-01 +2.437000E-03 +0.000000E+00 +0.000000E+00 +1.650000E-01 +5.655000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.230000E-01 +3.065000E-03 +0.000000E+00 +0.000000E+00 +1.570000E-01 +4.999000E-03 +0.000000E+00 +0.000000E+00 +6.400000E-02 +8.700000E-04 +0.000000E+00 +0.000000E+00 +1.360000E-01 +3.852000E-03 +0.000000E+00 +0.000000E+00 +1.750000E-01 +6.299000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 1.650000E-01 -5.615000E-03 +5.655000E-03 0.000000E+00 0.000000E+00 +1.090000E-01 +2.437000E-03 0.000000E+00 0.000000E+00 +1.480000E-01 +4.674000E-03 0.000000E+00 0.000000E+00 -7.100000E-02 -1.191000E-03 +1.320000E-01 +3.548000E-03 0.000000E+00 0.000000E+00 -1.550000E-01 -5.011000E-03 0.000000E+00 0.000000E+00 -1.630000E-01 -5.439000E-03 0.000000E+00 0.000000E+00 -1.500000E-01 -4.522000E-03 0.000000E+00 0.000000E+00 -1.680000E-01 -5.966000E-03 -0.000000E+00 -0.000000E+00 -1.290000E-01 -3.515000E-03 -0.000000E+00 -0.000000E+00 -1.940000E-01 -7.678000E-03 -0.000000E+00 -0.000000E+00 -2.670000E-01 -1.469300E-02 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.810000E-01 -6.765000E-03 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.080000E-01 -2.694000E-03 -0.000000E+00 -0.000000E+00 -2.070000E-01 -8.673000E-03 -0.000000E+00 -0.000000E+00 -1.290000E-01 -3.515000E-03 -0.000000E+00 -0.000000E+00 -1.680000E-01 -5.966000E-03 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.410000E-01 -3.999000E-03 -0.000000E+00 -0.000000E+00 -1.870000E-01 -7.083000E-03 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.870000E-01 -7.213000E-03 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -8.200000E-02 -1.536000E-03 -0.000000E+00 -0.000000E+00 -1.760000E-01 -6.550000E-03 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.750000E-01 -6.163000E-03 -0.000000E+00 -0.000000E+00 -2.570000E-01 -1.347100E-02 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.560000E-01 -4.914000E-03 -0.000000E+00 -0.000000E+00 -2.350000E-01 -1.135900E-02 -0.000000E+00 -0.000000E+00 -1.500000E-01 -4.606000E-03 -0.000000E+00 -0.000000E+00 -7.100000E-02 -1.079000E-03 -0.000000E+00 -0.000000E+00 -1.530000E-01 -4.837000E-03 -0.000000E+00 -0.000000E+00 -5.600000E-02 -7.260000E-04 -0.000000E+00 -0.000000E+00 -2.570000E-01 -1.347100E-02 -0.000000E+00 -0.000000E+00 -1.750000E-01 -6.163000E-03 -0.000000E+00 -0.000000E+00 -2.460000E-01 -1.235000E-02 -0.000000E+00 -0.000000E+00 -1.420000E-01 -4.326000E-03 0.000000E+00 0.000000E+00 +1.440000E-01 +4.282000E-03 0.000000E+00 0.000000E+00 +2.190000E-01 +9.683000E-03 0.000000E+00 0.000000E+00 +7.300000E-02 +1.091000E-03 0.000000E+00 0.000000E+00 +2.140000E-01 +9.376000E-03 0.000000E+00 0.000000E+00 1.830000E-01 -7.133000E-03 +6.803000E-03 0.000000E+00 0.000000E+00 -5.110000E-01 -5.696100E-02 0.000000E+00 0.000000E+00 -2.040000E-01 -8.426000E-03 0.000000E+00 0.000000E+00 -8.500000E-02 -1.533000E-03 +1.320000E-01 +3.548000E-03 0.000000E+00 0.000000E+00 -2.100000E-01 -8.928000E-03 -0.000000E+00 -0.000000E+00 -9.100000E-02 -1.807000E-03 -0.000000E+00 -0.000000E+00 -1.420000E-01 -4.326000E-03 -0.000000E+00 -0.000000E+00 -2.460000E-01 -1.235000E-02 +1.480000E-01 +4.674000E-03 0.000000E+00 0.000000E+00 0.000000E+00 @@ -1204,456 +1636,24 @@ tally 2: 0.000000E+00 0.000000E+00 0.000000E+00 +1.350000E-01 +3.895000E-03 +0.000000E+00 +0.000000E+00 1.430000E-01 -4.207000E-03 +4.297000E-03 0.000000E+00 0.000000E+00 -2.120000E-01 -9.278000E-03 -0.000000E+00 -0.000000E+00 -1.630000E-01 -5.617000E-03 -0.000000E+00 -0.000000E+00 -7.100000E-02 -1.083000E-03 -0.000000E+00 -0.000000E+00 -1.770000E-01 -6.293000E-03 -0.000000E+00 -0.000000E+00 -7.900000E-02 -1.495000E-03 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -2.300000E-01 -1.081000E-02 -0.000000E+00 -0.000000E+00 -5.200000E-01 -5.835000E-02 -0.000000E+00 -0.000000E+00 -2.350000E-01 -1.135900E-02 -0.000000E+00 -0.000000E+00 -1.560000E-01 -4.914000E-03 -0.000000E+00 -0.000000E+00 -2.370000E-01 -1.142300E-02 -0.000000E+00 -0.000000E+00 -1.360000E-01 -3.882000E-03 -0.000000E+00 -0.000000E+00 -2.160000E-01 -9.662000E-03 -0.000000E+00 -0.000000E+00 -1.080000E-01 -2.718000E-03 -0.000000E+00 -0.000000E+00 -2.090000E-01 -8.841000E-03 -0.000000E+00 -0.000000E+00 -1.030000E-01 -2.271000E-03 -0.000000E+00 -0.000000E+00 -5.200000E-01 -5.835000E-02 -0.000000E+00 -0.000000E+00 -2.300000E-01 -1.081000E-02 -0.000000E+00 -0.000000E+00 -5.110000E-01 -5.615900E-02 -0.000000E+00 -0.000000E+00 -2.430000E-01 -1.228300E-02 -0.000000E+00 -0.000000E+00 -5.110000E-01 -5.696100E-02 -0.000000E+00 -0.000000E+00 -1.830000E-01 -7.133000E-03 -0.000000E+00 -0.000000E+00 -5.130000E-01 -6.002100E-02 -0.000000E+00 -0.000000E+00 -2.420000E-01 -1.209200E-02 -0.000000E+00 -0.000000E+00 -5.510000E-01 -7.358900E-02 -0.000000E+00 -0.000000E+00 -2.410000E-01 -1.255900E-02 -0.000000E+00 -0.000000E+00 -5.140000E-01 -5.890200E-02 -0.000000E+00 -0.000000E+00 -2.100000E-01 -1.004600E-02 -0.000000E+00 -0.000000E+00 -2.430000E-01 -1.228300E-02 -0.000000E+00 -0.000000E+00 -5.110000E-01 -5.615900E-02 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -2.120000E-01 -9.278000E-03 -0.000000E+00 -0.000000E+00 -1.430000E-01 -4.207000E-03 -0.000000E+00 -0.000000E+00 -2.380000E-01 -1.133600E-02 -0.000000E+00 -0.000000E+00 -1.640000E-01 -5.444000E-03 -0.000000E+00 -0.000000E+00 -2.240000E-01 -1.015800E-02 -0.000000E+00 -0.000000E+00 -9.300000E-02 -1.829000E-03 -0.000000E+00 -0.000000E+00 -1.950000E-01 -7.705000E-03 -0.000000E+00 -0.000000E+00 -1.030000E-01 -2.191000E-03 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.680000E-01 -5.878000E-03 -0.000000E+00 -0.000000E+00 -2.230000E-01 -1.049900E-02 -0.000000E+00 -0.000000E+00 -1.360000E-01 -3.882000E-03 -0.000000E+00 -0.000000E+00 -2.370000E-01 -1.142300E-02 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.550000E-01 -5.011000E-03 -0.000000E+00 -0.000000E+00 -7.100000E-02 -1.191000E-03 -0.000000E+00 -0.000000E+00 -1.510000E-01 -4.845000E-03 -0.000000E+00 -0.000000E+00 -6.400000E-02 -9.460000E-04 -0.000000E+00 -0.000000E+00 -2.230000E-01 -1.049900E-02 -0.000000E+00 -0.000000E+00 -1.680000E-01 -5.878000E-03 -0.000000E+00 -0.000000E+00 -2.490000E-01 -1.255900E-02 -0.000000E+00 -0.000000E+00 -1.280000E-01 -3.448000E-03 -0.000000E+00 -0.000000E+00 -2.420000E-01 -1.209200E-02 -0.000000E+00 -0.000000E+00 -5.130000E-01 -6.002100E-02 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -2.070000E-01 -8.673000E-03 -0.000000E+00 -0.000000E+00 -1.080000E-01 -2.694000E-03 -0.000000E+00 -0.000000E+00 -2.000000E-01 -8.202000E-03 -0.000000E+00 -0.000000E+00 -9.600000E-02 -2.024000E-03 -0.000000E+00 -0.000000E+00 -1.280000E-01 -3.448000E-03 -0.000000E+00 -0.000000E+00 -2.490000E-01 -1.255900E-02 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.640000E-01 -5.444000E-03 -0.000000E+00 -0.000000E+00 -2.380000E-01 -1.133600E-02 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.760000E-01 -6.550000E-03 -0.000000E+00 -0.000000E+00 -8.200000E-02 -1.536000E-03 -0.000000E+00 -0.000000E+00 -1.670000E-01 -5.653000E-03 -0.000000E+00 -0.000000E+00 -4.900000E-02 -5.630000E-04 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.320000E-01 -3.626000E-03 -0.000000E+00 -0.000000E+00 -1.510000E-01 -4.831000E-03 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.370000E-01 -3.855000E-03 -0.000000E+00 -0.000000E+00 -1.610000E-01 -5.233000E-03 -0.000000E+00 -0.000000E+00 -5.600000E-02 -7.260000E-04 -0.000000E+00 -0.000000E+00 -1.530000E-01 -4.837000E-03 -0.000000E+00 -0.000000E+00 -1.610000E-01 -5.261000E-03 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.510000E-01 -4.831000E-03 -0.000000E+00 -0.000000E+00 -1.320000E-01 -3.626000E-03 -0.000000E+00 -0.000000E+00 -1.490000E-01 -4.731000E-03 -0.000000E+00 -0.000000E+00 -1.320000E-01 -3.514000E-03 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.550000E-01 -4.921000E-03 -0.000000E+00 -0.000000E+00 -2.410000E-01 -1.168300E-02 -0.000000E+00 -0.000000E+00 -9.100000E-02 -1.807000E-03 -0.000000E+00 -0.000000E+00 -2.100000E-01 -8.928000E-03 -0.000000E+00 -0.000000E+00 -2.090000E-01 -8.775000E-03 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.320000E-01 -3.514000E-03 -0.000000E+00 -0.000000E+00 -1.490000E-01 -4.731000E-03 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.150000E-01 -2.891000E-03 -0.000000E+00 -0.000000E+00 -1.560000E-01 -5.154000E-03 -0.000000E+00 -0.000000E+00 -7.900000E-02 -1.495000E-03 -0.000000E+00 -0.000000E+00 -1.770000E-01 -6.293000E-03 +5.300000E-02 +6.110000E-04 0.000000E+00 0.000000E+00 1.600000E-01 -5.352000E-03 +5.134000E-03 +0.000000E+00 +0.000000E+00 +1.380000E-01 +4.220000E-03 0.000000E+00 0.000000E+00 0.000000E+00 @@ -1668,232 +1668,248 @@ tally 2: 0.000000E+00 0.000000E+00 0.000000E+00 -1.610000E-01 -5.273000E-03 +1.900000E-01 +7.412000E-03 0.000000E+00 0.000000E+00 -2.310000E-01 -1.098100E-02 +2.420000E-01 +1.208400E-02 0.000000E+00 0.000000E+00 -1.610000E-01 -5.233000E-03 +1.570000E-01 +4.999000E-03 0.000000E+00 0.000000E+00 -1.370000E-01 -3.855000E-03 +1.230000E-01 +3.065000E-03 0.000000E+00 0.000000E+00 -1.760000E-01 -6.482000E-03 +1.730000E-01 +6.279000E-03 0.000000E+00 0.000000E+00 -1.340000E-01 -3.882000E-03 +1.330000E-01 +3.621000E-03 0.000000E+00 0.000000E+00 1.030000E-01 -2.271000E-03 +2.229000E-03 0.000000E+00 0.000000E+00 -2.090000E-01 -8.841000E-03 -0.000000E+00 -0.000000E+00 -1.830000E-01 -6.761000E-03 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -2.310000E-01 -1.098100E-02 -0.000000E+00 -0.000000E+00 -1.610000E-01 -5.273000E-03 -0.000000E+00 -0.000000E+00 -2.620000E-01 -1.380600E-02 -0.000000E+00 -0.000000E+00 -1.700000E-01 -5.970000E-03 -0.000000E+00 -0.000000E+00 -2.410000E-01 -1.168300E-02 -0.000000E+00 -0.000000E+00 -1.550000E-01 -4.921000E-03 -0.000000E+00 -0.000000E+00 -2.250000E-01 -1.014100E-02 -0.000000E+00 -0.000000E+00 -1.370000E-01 -3.805000E-03 +2.510000E-01 +1.271500E-02 0.000000E+00 0.000000E+00 2.100000E-01 -1.004600E-02 +8.970000E-03 0.000000E+00 0.000000E+00 -5.140000E-01 -5.890200E-02 0.000000E+00 0.000000E+00 -2.320000E-01 -1.093000E-02 0.000000E+00 0.000000E+00 +2.420000E-01 +1.208400E-02 0.000000E+00 0.000000E+00 +1.900000E-01 +7.412000E-03 0.000000E+00 0.000000E+00 -1.700000E-01 -5.970000E-03 -0.000000E+00 -0.000000E+00 -2.620000E-01 -1.380600E-02 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.560000E-01 -5.154000E-03 -0.000000E+00 -0.000000E+00 -1.150000E-01 -2.891000E-03 -0.000000E+00 -0.000000E+00 -1.430000E-01 -4.163000E-03 -0.000000E+00 -0.000000E+00 -1.120000E-01 -2.640000E-03 -0.000000E+00 -0.000000E+00 -1.030000E-01 -2.191000E-03 -0.000000E+00 -0.000000E+00 -1.950000E-01 -7.705000E-03 -0.000000E+00 -0.000000E+00 -1.760000E-01 -6.392000E-03 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -9.200000E-02 -1.822000E-03 -0.000000E+00 -0.000000E+00 -1.370000E-01 -3.843000E-03 -0.000000E+00 -0.000000E+00 -1.340000E-01 -3.882000E-03 -0.000000E+00 -0.000000E+00 -1.760000E-01 -6.482000E-03 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -6.400000E-02 -9.460000E-04 -0.000000E+00 -0.000000E+00 -1.510000E-01 -4.845000E-03 -0.000000E+00 -0.000000E+00 -1.800000E-01 -6.520000E-03 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.370000E-01 -3.843000E-03 -0.000000E+00 -0.000000E+00 -9.200000E-02 -1.822000E-03 -0.000000E+00 -0.000000E+00 -1.300000E-01 -3.604000E-03 -0.000000E+00 -0.000000E+00 -1.170000E-01 -2.789000E-03 -0.000000E+00 -0.000000E+00 -1.370000E-01 -3.805000E-03 -0.000000E+00 -0.000000E+00 -2.250000E-01 -1.014100E-02 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -9.600000E-02 -2.024000E-03 +2.610000E-01 +1.399900E-02 0.000000E+00 0.000000E+00 2.000000E-01 -8.202000E-03 +8.410000E-03 +0.000000E+00 +0.000000E+00 +2.190000E-01 +9.683000E-03 +0.000000E+00 +0.000000E+00 +1.440000E-01 +4.282000E-03 +0.000000E+00 +0.000000E+00 +2.690000E-01 +1.478100E-02 +0.000000E+00 +0.000000E+00 +1.540000E-01 +4.986000E-03 +0.000000E+00 +0.000000E+00 +2.550000E-01 +1.480500E-02 +0.000000E+00 +0.000000E+00 +5.160000E-01 +5.892200E-02 +0.000000E+00 +0.000000E+00 +2.310000E-01 +1.098900E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.000000E-01 +8.410000E-03 +0.000000E+00 +0.000000E+00 +2.610000E-01 +1.399900E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.430000E-01 +4.297000E-03 +0.000000E+00 +0.000000E+00 +1.350000E-01 +3.895000E-03 +0.000000E+00 +0.000000E+00 +1.760000E-01 +6.534000E-03 +0.000000E+00 +0.000000E+00 +1.170000E-01 +2.807000E-03 +0.000000E+00 +0.000000E+00 +9.000000E-02 +1.780000E-03 +0.000000E+00 +0.000000E+00 +2.290000E-01 +1.058700E-02 +0.000000E+00 +0.000000E+00 +2.080000E-01 +8.854000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.230000E-01 +3.305000E-03 +0.000000E+00 +0.000000E+00 +1.760000E-01 +6.598000E-03 +0.000000E+00 +0.000000E+00 +1.330000E-01 +3.621000E-03 +0.000000E+00 +0.000000E+00 +1.730000E-01 +6.279000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +6.100000E-02 +8.350000E-04 +0.000000E+00 +0.000000E+00 +1.410000E-01 +4.071000E-03 +0.000000E+00 +0.000000E+00 +1.800000E-01 +6.574000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.760000E-01 +6.598000E-03 +0.000000E+00 +0.000000E+00 +1.230000E-01 +3.305000E-03 +0.000000E+00 +0.000000E+00 +1.690000E-01 +6.135000E-03 +0.000000E+00 +0.000000E+00 +1.220000E-01 +3.344000E-03 +0.000000E+00 +0.000000E+00 +1.540000E-01 +4.986000E-03 +0.000000E+00 +0.000000E+00 +2.690000E-01 +1.478100E-02 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.030000E-01 +2.543000E-03 +0.000000E+00 +0.000000E+00 +1.870000E-01 +7.267000E-03 +0.000000E+00 +0.000000E+00 +1.690000E-01 +5.731000E-03 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.220000E-01 +3.344000E-03 +0.000000E+00 +0.000000E+00 +1.690000E-01 +6.135000E-03 +0.000000E+00 +0.000000E+00 0.000000E+00 0.000000E+00 -1.820000E-01 -6.660000E-03 0.000000E+00 0.000000E+00 0.000000E+00 @@ -1901,11 +1917,11 @@ tally 2: 0.000000E+00 0.000000E+00 1.170000E-01 -2.789000E-03 +2.807000E-03 0.000000E+00 0.000000E+00 -1.300000E-01 -3.604000E-03 +1.760000E-01 +6.534000E-03 0.000000E+00 0.000000E+00 0.000000E+00 @@ -1916,32 +1932,16 @@ tally 2: 0.000000E+00 0.000000E+00 0.000000E+00 -1.120000E-01 -2.640000E-03 +6.000000E-02 +8.060000E-04 0.000000E+00 0.000000E+00 -1.430000E-01 -4.163000E-03 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -4.900000E-02 -5.630000E-04 -0.000000E+00 -0.000000E+00 -1.670000E-01 -5.653000E-03 -0.000000E+00 -0.000000E+00 -1.670000E-01 -5.701000E-03 +1.290000E-01 +3.487000E-03 +0.000000E+00 +0.000000E+00 +1.790000E-01 +6.747000E-03 0.000000E+00 0.000000E+00 0.000000E+00 diff --git a/tests/regression_tests/seed/results_true.dat b/tests/regression_tests/seed/results_true.dat index bcd711825..ff34071c1 100644 --- a/tests/regression_tests/seed/results_true.dat +++ b/tests/regression_tests/seed/results_true.dat @@ -1,2 +1,2 @@ k-combined: -3.069730E-01 2.632099E-03 +3.015003E-01 5.094212E-03 diff --git a/tests/regression_tests/source/inputs_true.dat b/tests/regression_tests/source/inputs_true.dat index e787f24d4..0c3764ba6 100644 --- a/tests/regression_tests/source/inputs_true.dat +++ b/tests/regression_tests/source/inputs_true.dat @@ -1,150 +1,150 @@ - - - + + + - + eigenvalue 1000 10 5 - + - + -4.0 -1.0 3.0 0.2 0.3 0.5 - + -2.0 0.0 2.0 0.2 0.3 0.2 - + -1.0 0.0 1.0 0.5 0.25 0.25 - + - + - + -4.0 -4.0 -4.0 4.0 4.0 4.0 - - + + - + 1.2 -2.3 0.781 - + 1.0 1.3894954943731377 1.93069772888325 2.6826957952797255 3.72759372031494 5.17947467923121 7.196856730011519 10.0 13.894954943731374 19.306977288832496 26.826957952797247 37.2759372031494 51.7947467923121 71.96856730011518 100.0 138.94954943731375 193.06977288832496 268.26957952797244 372.7593720314938 517.9474679231207 719.6856730011514 1000.0 1389.4954943731375 1930.6977288832495 2682.6957952797247 3727.593720314938 5179.474679231207 7196.856730011514 10000.0 13894.95494373136 19306.977288832495 26826.95795279722 37275.93720314938 51794.74679231213 71968.56730011514 100000.0 138949.5494373136 193069.77288832495 268269.5795279722 372759.3720314938 517947.4679231202 719685.6730011514 1000000.0 1389495.494373136 1930697.7288832497 2682695.7952797217 3727593.720314938 5179474.679231202 7196856.730011513 10000000.0 0.0 2.9086439299358713e-08 5.80533561806147e-08 8.67817193689187e-08 1.1515347785771536e-07 1.4305204600565115e-07 1.7036278261198208e-07 1.9697346200185813e-07 2.227747351856934e-07 2.4766057919761985e-07 2.715287327665956e-07 2.9428111652990295e-07 3.1582423606228735e-07 3.360695660646056e-07 3.549339141332686e-07 3.723397626156721e-07 3.882155871468592e-07 4.024961505584776e-07 4.151227709522976e-07 4.260435628367196e-07 4.3521365033538783e-07 4.4259535159179273e-07 4.4815833361210174e-07 4.5187973690993757e-07 4.5374426944091084e-07 4.5374426944091084e-07 4.5187973690993757e-07 4.4815833361210174e-07 4.4259535159179273e-07 4.352136503353879e-07 4.2604356283671966e-07 4.1512277095229767e-07 4.0249615055847764e-07 3.8821558714685926e-07 3.723397626156722e-07 3.5493391413326864e-07 3.360695660646057e-07 3.158242360622874e-07 2.942811165299031e-07 2.715287327665957e-07 2.4766057919762e-07 2.2277473518569352e-07 1.9697346200185819e-07 1.7036278261198226e-07 1.4305204600565126e-07 1.1515347785771556e-07 8.678171936891881e-08 5.805335618061493e-08 2.9086439299358858e-08 5.559621115282002e-23 - - - + + + 0.7071067811865476 0.0 -0.7071067811865475 0.3 0.4 0.3 - + - + 1.0 1.3894954943731377 1.93069772888325 2.6826957952797255 3.72759372031494 5.17947467923121 7.196856730011519 10.0 13.894954943731374 19.306977288832496 26.826957952797247 37.2759372031494 51.7947467923121 71.96856730011518 100.0 138.94954943731375 193.06977288832496 268.26957952797244 372.7593720314938 517.9474679231207 719.6856730011514 1000.0 1389.4954943731375 1930.6977288832495 2682.6957952797247 3727.593720314938 5179.474679231207 7196.856730011514 10000.0 13894.95494373136 19306.977288832495 26826.95795279722 37275.93720314938 51794.74679231213 71968.56730011514 100000.0 138949.5494373136 193069.77288832495 268269.5795279722 372759.3720314938 517947.4679231202 719685.6730011514 1000000.0 1389495.494373136 1930697.7288832497 2682695.7952797217 3727593.720314938 5179474.679231202 7196856.730011513 10000000.0 0.0 2.9086439299358713e-08 5.80533561806147e-08 8.67817193689187e-08 1.1515347785771536e-07 1.4305204600565115e-07 1.7036278261198208e-07 1.9697346200185813e-07 2.227747351856934e-07 2.4766057919761985e-07 2.715287327665956e-07 2.9428111652990295e-07 3.1582423606228735e-07 3.360695660646056e-07 3.549339141332686e-07 3.723397626156721e-07 3.882155871468592e-07 4.024961505584776e-07 4.151227709522976e-07 4.260435628367196e-07 4.3521365033538783e-07 4.4259535159179273e-07 4.4815833361210174e-07 4.5187973690993757e-07 4.5374426944091084e-07 4.5374426944091084e-07 4.5187973690993757e-07 4.4815833361210174e-07 4.4259535159179273e-07 4.352136503353879e-07 4.2604356283671966e-07 4.1512277095229767e-07 4.0249615055847764e-07 3.8821558714685926e-07 3.723397626156722e-07 3.5493391413326864e-07 3.360695660646057e-07 3.158242360622874e-07 2.942811165299031e-07 2.715287327665957e-07 2.4766057919762e-07 2.2277473518569352e-07 1.9697346200185819e-07 1.7036278261198226e-07 1.4305204600565126e-07 1.1515347785771556e-07 8.678171936891881e-08 5.805335618061493e-08 2.9086439299358858e-08 5.559621115282002e-23 - - - - - + + + + + -2.0 0.0 2.0 0.2 0.3 0.2 - + 1.0 1.3894954943731377 1.93069772888325 2.6826957952797255 3.72759372031494 5.17947467923121 7.196856730011519 10.0 13.894954943731374 19.306977288832496 26.826957952797247 37.2759372031494 51.7947467923121 71.96856730011518 100.0 138.94954943731375 193.06977288832496 268.26957952797244 372.7593720314938 517.9474679231207 719.6856730011514 1000.0 1389.4954943731375 1930.6977288832495 2682.6957952797247 3727.593720314938 5179.474679231207 7196.856730011514 10000.0 13894.95494373136 19306.977288832495 26826.95795279722 37275.93720314938 51794.74679231213 71968.56730011514 100000.0 138949.5494373136 193069.77288832495 268269.5795279722 372759.3720314938 517947.4679231202 719685.6730011514 1000000.0 1389495.494373136 1930697.7288832497 2682695.7952797217 3727593.720314938 5179474.679231202 7196856.730011513 10000000.0 0.0 2.9086439299358713e-08 5.80533561806147e-08 8.67817193689187e-08 1.1515347785771536e-07 1.4305204600565115e-07 1.7036278261198208e-07 1.9697346200185813e-07 2.227747351856934e-07 2.4766057919761985e-07 2.715287327665956e-07 2.9428111652990295e-07 3.1582423606228735e-07 3.360695660646056e-07 3.549339141332686e-07 3.723397626156721e-07 3.882155871468592e-07 4.024961505584776e-07 4.151227709522976e-07 4.260435628367196e-07 4.3521365033538783e-07 4.4259535159179273e-07 4.4815833361210174e-07 4.5187973690993757e-07 4.5374426944091084e-07 4.5374426944091084e-07 4.5187973690993757e-07 4.4815833361210174e-07 4.4259535159179273e-07 4.352136503353879e-07 4.2604356283671966e-07 4.1512277095229767e-07 4.0249615055847764e-07 3.8821558714685926e-07 3.723397626156722e-07 3.5493391413326864e-07 3.360695660646057e-07 3.158242360622874e-07 2.942811165299031e-07 2.715287327665957e-07 2.4766057919762e-07 2.2277473518569352e-07 1.9697346200185819e-07 1.7036278261198226e-07 1.4305204600565126e-07 1.1515347785771556e-07 8.678171936891881e-08 5.805335618061493e-08 2.9086439299358858e-08 5.559621115282002e-23 - - - - - + + + + + -2.0 0.0 2.0 0.2 0.3 0.2 - + - + - + 1.0 1.3894954943731377 1.93069772888325 2.6826957952797255 3.72759372031494 5.17947467923121 7.196856730011519 10.0 13.894954943731374 19.306977288832496 26.826957952797247 37.2759372031494 51.7947467923121 71.96856730011518 100.0 138.94954943731375 193.06977288832496 268.26957952797244 372.7593720314938 517.9474679231207 719.6856730011514 1000.0 1389.4954943731375 1930.6977288832495 2682.6957952797247 3727.593720314938 5179.474679231207 7196.856730011514 10000.0 13894.95494373136 19306.977288832495 26826.95795279722 37275.93720314938 51794.74679231213 71968.56730011514 100000.0 138949.5494373136 193069.77288832495 268269.5795279722 372759.3720314938 517947.4679231202 719685.6730011514 1000000.0 1389495.494373136 1930697.7288832497 2682695.7952797217 3727593.720314938 5179474.679231202 7196856.730011513 10000000.0 0.0 2.9086439299358713e-08 5.80533561806147e-08 8.67817193689187e-08 1.1515347785771536e-07 1.4305204600565115e-07 1.7036278261198208e-07 1.9697346200185813e-07 2.227747351856934e-07 2.4766057919761985e-07 2.715287327665956e-07 2.9428111652990295e-07 3.1582423606228735e-07 3.360695660646056e-07 3.549339141332686e-07 3.723397626156721e-07 3.882155871468592e-07 4.024961505584776e-07 4.151227709522976e-07 4.260435628367196e-07 4.3521365033538783e-07 4.4259535159179273e-07 4.4815833361210174e-07 4.5187973690993757e-07 4.5374426944091084e-07 4.5374426944091084e-07 4.5187973690993757e-07 4.4815833361210174e-07 4.4259535159179273e-07 4.352136503353879e-07 4.2604356283671966e-07 4.1512277095229767e-07 4.0249615055847764e-07 3.8821558714685926e-07 3.723397626156722e-07 3.5493391413326864e-07 3.360695660646057e-07 3.158242360622874e-07 2.942811165299031e-07 2.715287327665957e-07 2.4766057919762e-07 2.2277473518569352e-07 1.9697346200185819e-07 1.7036278261198226e-07 1.4305204600565126e-07 1.1515347785771556e-07 8.678171936891881e-08 5.805335618061493e-08 2.9086439299358858e-08 5.559621115282002e-23 - - - + + + 0.7071067811865476 0.0 -0.7071067811865475 0.3 0.4 0.3 - + - + - + - + 1.0 1.3894954943731377 1.93069772888325 2.6826957952797255 3.72759372031494 5.17947467923121 7.196856730011519 10.0 13.894954943731374 19.306977288832496 26.826957952797247 37.2759372031494 51.7947467923121 71.96856730011518 100.0 138.94954943731375 193.06977288832496 268.26957952797244 372.7593720314938 517.9474679231207 719.6856730011514 1000.0 1389.4954943731375 1930.6977288832495 2682.6957952797247 3727.593720314938 5179.474679231207 7196.856730011514 10000.0 13894.95494373136 19306.977288832495 26826.95795279722 37275.93720314938 51794.74679231213 71968.56730011514 100000.0 138949.5494373136 193069.77288832495 268269.5795279722 372759.3720314938 517947.4679231202 719685.6730011514 1000000.0 1389495.494373136 1930697.7288832497 2682695.7952797217 3727593.720314938 5179474.679231202 7196856.730011513 10000000.0 0.0 2.9086439299358713e-08 5.80533561806147e-08 8.67817193689187e-08 1.1515347785771536e-07 1.4305204600565115e-07 1.7036278261198208e-07 1.9697346200185813e-07 2.227747351856934e-07 2.4766057919761985e-07 2.715287327665956e-07 2.9428111652990295e-07 3.1582423606228735e-07 3.360695660646056e-07 3.549339141332686e-07 3.723397626156721e-07 3.882155871468592e-07 4.024961505584776e-07 4.151227709522976e-07 4.260435628367196e-07 4.3521365033538783e-07 4.4259535159179273e-07 4.4815833361210174e-07 4.5187973690993757e-07 4.5374426944091084e-07 4.5374426944091084e-07 4.5187973690993757e-07 4.4815833361210174e-07 4.4259535159179273e-07 4.352136503353879e-07 4.2604356283671966e-07 4.1512277095229767e-07 4.0249615055847764e-07 3.8821558714685926e-07 3.723397626156722e-07 3.5493391413326864e-07 3.360695660646057e-07 3.158242360622874e-07 2.942811165299031e-07 2.715287327665957e-07 2.4766057919762e-07 2.2277473518569352e-07 1.9697346200185819e-07 1.7036278261198226e-07 1.4305204600565126e-07 1.1515347785771556e-07 8.678171936891881e-08 5.805335618061493e-08 2.9086439299358858e-08 5.559621115282002e-23 - diff --git a/tests/regression_tests/source/results_true.dat b/tests/regression_tests/source/results_true.dat index 673d27c8a..c671463be 100644 --- a/tests/regression_tests/source/results_true.dat +++ b/tests/regression_tests/source/results_true.dat @@ -1,2 +1,2 @@ k-combined: -2.959436E-01 2.782384E-03 +2.942254E-01 2.571435E-03 diff --git a/tests/regression_tests/source_dlopen/inputs_true.dat b/tests/regression_tests/source_dlopen/inputs_true.dat index 28d1e06e2..9b4601d9f 100644 --- a/tests/regression_tests/source_dlopen/inputs_true.dat +++ b/tests/regression_tests/source_dlopen/inputs_true.dat @@ -2,23 +2,23 @@ - - - - - + + + + + - + fixed source 1000 10 0 - + diff --git a/tests/regression_tests/source_file/results_true.dat b/tests/regression_tests/source_file/results_true.dat index 264e3d580..359e0526e 100644 --- a/tests/regression_tests/source_file/results_true.dat +++ b/tests/regression_tests/source_file/results_true.dat @@ -1,2 +1,2 @@ k-combined: -2.983135E-01 5.116978E-03 +2.827397E-01 1.150437E-03 diff --git a/tests/regression_tests/source_mcpl_file/results_true.dat b/tests/regression_tests/source_mcpl_file/results_true.dat index 264e3d580..3ba1a4520 100644 --- a/tests/regression_tests/source_mcpl_file/results_true.dat +++ b/tests/regression_tests/source_mcpl_file/results_true.dat @@ -1,2 +1,2 @@ k-combined: -2.983135E-01 5.116978E-03 +2.827397E-01 1.150438E-03 diff --git a/tests/regression_tests/source_mcpl_file/settings.xml b/tests/regression_tests/source_mcpl_file/settings.xml index 47b010bff..bb08e6fd7 100644 --- a/tests/regression_tests/source_mcpl_file/settings.xml +++ b/tests/regression_tests/source_mcpl_file/settings.xml @@ -1,12 +1,11 @@ + eigenvalue - - 10 - 5 - 1000 - + 10 + 5 + 1000 -4 -4 -4 4 4 4 diff --git a/tests/regression_tests/source_mcpl_file/test.py b/tests/regression_tests/source_mcpl_file/test.py index 84ec005ae..6e668ef19 100644 --- a/tests/regression_tests/source_mcpl_file/test.py +++ b/tests/regression_tests/source_mcpl_file/test.py @@ -1,23 +1,23 @@ #!/usr/bin/env python -import openmc.lib import pytest import glob import os - +import shutil from tests.testing_harness import * + pytestmark = pytest.mark.skipif( - not openmc.lib._mcpl_enabled(), - reason="MCPL is not enabled.") + shutil.which("mcpl-config") is None, + reason="mcpl-config command not found in PATH; MCPL is likely not available." +) settings1=""" + eigenvalue - - 10 - 5 - 1000 - + 10 + 5 + 1000 -4 -4 -4 4 4 4 @@ -28,11 +28,10 @@ settings1=""" settings2 = """ - - 10 - 5 - 1000 - + eigenvalue + 10 + 5 + 1000 source.10.{} diff --git a/tests/regression_tests/source_parameterized_dlopen/inputs_true.dat b/tests/regression_tests/source_parameterized_dlopen/inputs_true.dat index 6cf3473f9..088d65ada 100644 --- a/tests/regression_tests/source_parameterized_dlopen/inputs_true.dat +++ b/tests/regression_tests/source_parameterized_dlopen/inputs_true.dat @@ -2,23 +2,23 @@ - - - - - + + + + + - + fixed source 1000 10 0 - + diff --git a/tests/regression_tests/sourcepoint_batch/results_true.dat b/tests/regression_tests/sourcepoint_batch/results_true.dat index 2770f25ed..3665bdd08 100644 --- a/tests/regression_tests/sourcepoint_batch/results_true.dat +++ b/tests/regression_tests/sourcepoint_batch/results_true.dat @@ -1,3 +1,3 @@ k-combined: -3.074376E-01 3.049465E-03 -3.667754E+00 -7.701697E+00 2.213664E+00 +2.920435E-01 9.109227E-04 +1.101997E+00 -8.197502E+00 4.294606E+00 diff --git a/tests/regression_tests/sourcepoint_latest/results_true.dat b/tests/regression_tests/sourcepoint_latest/results_true.dat index bbf03de94..97b997ae6 100644 --- a/tests/regression_tests/sourcepoint_latest/results_true.dat +++ b/tests/regression_tests/sourcepoint_latest/results_true.dat @@ -1,2 +1,2 @@ k-combined: -3.070134E-01 3.900396E-03 +2.940336E-01 7.338463E-04 diff --git a/tests/regression_tests/sourcepoint_restart/results_true.dat b/tests/regression_tests/sourcepoint_restart/results_true.dat index b6d85872d..c20b5f2a0 100644 --- a/tests/regression_tests/sourcepoint_restart/results_true.dat +++ b/tests/regression_tests/sourcepoint_restart/results_true.dat @@ -1,46 +1,14 @@ k-combined: -3.070134E-01 3.900396E-03 +2.940336E-01 7.338463E-04 tally 1: 1.300000E-02 -4.700000E-05 -5.741381E-03 -9.030024E-06 +3.900000E-05 +5.833114E-03 +7.476880E-06 0.000000E+00 0.000000E+00 -3.067112E-04 -9.407179E-08 -1.000000E-03 -1.000000E-06 -3.015814E-04 -9.095135E-08 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -2.600000E-02 -1.420000E-04 -1.268989E-02 -3.464490E-05 -0.000000E+00 -0.000000E+00 -2.948908E-04 -8.696057E-08 -1.000000E-03 -1.000000E-06 -1.535009E-03 -1.224718E-06 -1.000000E-03 -1.000000E-06 -0.000000E+00 -0.000000E+00 -3.200000E-02 -2.760000E-04 -1.248507E-02 -3.714039E-05 -0.000000E+00 -0.000000E+00 -9.208601E-04 -4.708050E-07 +1.164000E-03 +5.072152E-07 0.000000E+00 0.000000E+00 0.000000E+00 @@ -49,602 +17,26 @@ tally 1: 0.000000E+00 0.000000E+00 0.000000E+00 -1.900000E-02 -7.500000E-05 -8.218811E-03 -1.462963E-05 +2.100000E-02 +1.110000E-04 +1.108363E-02 +2.889480E-05 0.000000E+00 0.000000E+00 -9.070399E-04 -2.743247E-07 -0.000000E+00 -0.000000E+00 -9.047443E-04 -8.185622E-07 -1.000000E-03 -1.000000E-06 -0.000000E+00 -0.000000E+00 -1.200000E-02 -5.000000E-05 -3.938144E-03 -5.245641E-06 -0.000000E+00 -0.000000E+00 -3.067112E-04 -9.407179E-08 -1.000000E-03 -1.000000E-06 -5.897816E-04 -3.478423E-07 -0.000000E+00 -0.000000E+00 -2.948908E-04 -8.696057E-08 -2.000000E-02 -1.260000E-04 -9.079852E-03 -2.657486E-05 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -3.100000E-02 -2.010000E-04 -1.336346E-02 -3.645780E-05 -0.000000E+00 -0.000000E+00 -2.102710E-03 -1.524522E-06 -1.000000E-03 -1.000000E-06 -9.083133E-04 -4.632477E-07 -1.000000E-03 -1.000000E-06 -0.000000E+00 -0.000000E+00 -2.300000E-02 -1.090000E-04 -1.334578E-02 -3.590708E-05 -0.000000E+00 -0.000000E+00 -6.031628E-04 -3.638054E-07 -1.000000E-03 -1.000000E-06 -1.530605E-03 -1.035684E-06 +5.861433E-04 +3.435640E-07 2.000000E-03 2.000000E-06 -6.082927E-04 -1.850231E-07 -1.400000E-02 -4.200000E-05 -7.257468E-03 -1.221578E-05 -0.000000E+00 -0.000000E+00 -2.948908E-04 -8.696057E-08 -0.000000E+00 -0.000000E+00 -8.980536E-04 -4.507660E-07 +2.043490E-03 +1.793389E-06 2.000000E-03 -4.000000E-06 -0.000000E+00 -0.000000E+00 -9.000000E-03 -2.700000E-05 -5.193169E-03 -1.187321E-05 -0.000000E+00 -0.000000E+00 -3.054379E-04 -9.329231E-08 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.000000E-02 -2.400000E-05 -5.170002E-03 -7.361546E-06 -0.000000E+00 -0.000000E+00 -6.003287E-04 -1.802529E-07 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -2.800000E-02 -1.720000E-04 -1.699195E-02 -6.267008E-05 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -2.800000E-02 -1.980000E-04 -1.338750E-02 -4.565234E-05 -0.000000E+00 -0.000000E+00 -9.183134E-04 -4.676871E-07 -1.000000E-03 -1.000000E-06 -1.537188E-03 -2.362946E-06 -2.000000E-03 -4.000000E-06 -0.000000E+00 -0.000000E+00 -2.900000E-02 -1.950000E-04 -1.178615E-02 -3.130999E-05 -0.000000E+00 -0.000000E+00 -3.015814E-04 -9.095135E-08 -0.000000E+00 -0.000000E+00 -1.179563E-03 -1.391369E-06 -1.000000E-03 -1.000000E-06 -0.000000E+00 -0.000000E+00 -1.500000E-02 -6.500000E-05 -5.706064E-03 -9.729293E-06 -0.000000E+00 -0.000000E+00 -2.948908E-04 -8.696057E-08 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -3.000000E-03 -9.000000E-06 -1.516642E-03 -1.579637E-06 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -5.897816E-04 -3.478423E-07 -1.000000E-03 -1.000000E-06 -0.000000E+00 -0.000000E+00 -2.900000E-02 -1.970000E-04 -1.274851E-02 -3.511219E-05 -0.000000E+00 -0.000000E+00 -9.057666E-04 -4.601298E-07 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.800000E-02 -7.600000E-05 -8.803642E-03 -1.730938E-05 -0.000000E+00 -0.000000E+00 -3.074376E-04 -9.451786E-08 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -2.900000E-02 -1.830000E-04 -1.245316E-02 -3.378176E-05 -0.000000E+00 -0.000000E+00 -6.016020E-04 -1.810324E-07 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.000000E-03 -1.000000E-06 -6.090190E-04 -1.854692E-07 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -6.031628E-04 -3.638054E-07 -1.000000E-03 -1.000000E-06 -0.000000E+00 -0.000000E+00 -1.900000E-02 -8.700000E-05 -8.781239E-03 -1.676750E-05 -0.000000E+00 -0.000000E+00 -6.128755E-04 -1.878102E-07 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -3.500000E-02 -2.930000E-04 -1.372494E-02 -4.750881E-05 -0.000000E+00 -0.000000E+00 -9.090396E-04 -2.755502E-07 -0.000000E+00 -0.000000E+00 -5.897816E-04 -3.478423E-07 -1.000000E-03 -1.000000E-06 -0.000000E+00 -0.000000E+00 -3.700000E-02 -3.270000E-04 -1.492073E-02 -5.134793E-05 -0.000000E+00 -0.000000E+00 -6.134225E-04 -3.762872E-07 -1.000000E-03 -1.000000E-06 -3.074376E-04 -9.451786E-08 -1.000000E-03 -1.000000E-06 -6.148751E-04 -3.780714E-07 -3.500000E-02 -2.810000E-04 -1.728232E-02 -6.621096E-05 -0.000000E+00 -0.000000E+00 -1.214477E-03 -3.688425E-07 -0.000000E+00 -0.000000E+00 -1.481145E-03 -1.482321E-06 -1.000000E-03 -1.000000E-06 -3.015814E-04 -9.095135E-08 -8.000000E-03 -1.800000E-05 -3.359923E-03 -3.081200E-06 -0.000000E+00 -0.000000E+00 -3.067112E-04 -9.407179E-08 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -7.000000E-03 -1.500000E-05 -3.660087E-03 -3.561493E-06 -0.000000E+00 -0.000000E+00 -9.203130E-04 -4.713637E-07 -1.000000E-03 -1.000000E-06 -3.015814E-04 -9.095135E-08 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -3.500000E-02 -2.630000E-04 -1.425810E-02 -4.231681E-05 -0.000000E+00 -0.000000E+00 -1.516059E-03 -4.597939E-07 -0.000000E+00 -0.000000E+00 -1.221752E-03 -1.492677E-06 -1.000000E-03 -1.000000E-06 -0.000000E+00 -0.000000E+00 -2.300000E-02 -1.110000E-04 -1.184871E-02 -2.918189E-05 -0.000000E+00 -0.000000E+00 -6.016020E-04 -1.810324E-07 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.600000E-02 -6.600000E-05 -7.879913E-03 -1.566560E-05 -0.000000E+00 -0.000000E+00 -9.039098E-04 -2.724298E-07 -0.000000E+00 -0.000000E+00 -3.067112E-04 -9.407179E-08 -1.000000E-03 -1.000000E-06 -0.000000E+00 -0.000000E+00 -9.000000E-03 -1.900000E-05 -4.256120E-03 -4.431220E-06 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -6.000000E-03 -1.200000E-05 -2.739774E-03 -2.333986E-06 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.400000E-02 -6.800000E-05 -7.182805E-03 -1.822340E-05 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.500000E-02 -6.300000E-05 -5.734575E-03 -9.207711E-06 -0.000000E+00 -0.000000E+00 -6.070193E-04 -1.842437E-07 -0.000000E+00 -0.000000E+00 -8.846723E-04 -7.826452E-07 -1.000000E-03 -1.000000E-06 -0.000000E+00 -0.000000E+00 +2.000000E-06 +2.930717E-04 +8.589100E-08 2.000000E-02 -8.800000E-05 -9.416733E-03 -2.020354E-05 -0.000000E+00 -0.000000E+00 -6.003287E-04 -1.802529E-07 -0.000000E+00 -0.000000E+00 -6.031628E-04 -3.638054E-07 -0.000000E+00 -0.000000E+00 -3.015814E-04 -9.095135E-08 -7.000000E-03 -1.500000E-05 -2.413278E-03 -1.439032E-06 -0.000000E+00 -0.000000E+00 -2.948908E-04 -8.696057E-08 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -7.000000E-03 -1.500000E-05 -4.226919E-03 -4.173413E-06 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -2.300000E-02 -1.590000E-04 -1.125341E-02 -3.890966E-05 -0.000000E+00 -0.000000E+00 -5.964722E-04 -1.779119E-07 -0.000000E+00 -0.000000E+00 -8.846723E-04 -7.826452E-07 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -3.200000E-02 -2.260000E-04 -1.458976E-02 -4.416780E-05 -0.000000E+00 -0.000000E+00 -1.814806E-03 -9.096012E-07 -1.000000E-03 -1.000000E-06 -6.031628E-04 -3.638054E-07 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -3.100000E-02 -2.050000E-04 -1.241089E-02 -3.545088E-05 -0.000000E+00 -0.000000E+00 -1.515620E-03 -1.191731E-06 -0.000000E+00 -0.000000E+00 -6.121491E-04 -1.873641E-07 -1.000000E-03 -1.000000E-06 -0.000000E+00 -0.000000E+00 -1.000000E-02 -2.600000E-05 -3.936862E-03 -3.749154E-06 -0.000000E+00 -0.000000E+00 -2.948908E-04 -8.696057E-08 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.100000E-02 -4.700000E-05 -5.084641E-03 -9.248485E-06 +9.000000E-05 +9.334862E-03 +1.853104E-05 0.000000E+00 0.000000E+00 0.000000E+00 @@ -658,45 +50,93 @@ tally 1: 0.000000E+00 0.000000E+00 2.500000E-02 -1.770000E-04 -1.021860E-02 -3.099521E-05 +1.430000E-04 +1.110224E-02 +2.872840E-05 0.000000E+00 0.000000E+00 -3.074376E-04 -9.451786E-08 +5.833203E-04 +1.701353E-07 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +5.000000E-03 +1.100000E-05 +1.752967E-03 +1.027501E-06 +0.000000E+00 +0.000000E+00 +2.930717E-04 +8.589100E-08 0.000000E+00 0.000000E+00 -9.086007E-04 -4.570977E-07 -2.000000E-03 -2.000000E-06 -3.054379E-04 -9.329231E-08 -1.500000E-02 -5.300000E-05 -7.584986E-03 -1.188822E-05 0.000000E+00 0.000000E+00 -6.128755E-04 -1.878102E-07 -1.000000E-03 -1.000000E-06 -6.108758E-04 -3.731692E-07 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 1.800000E-02 -8.600000E-05 -6.672457E-03 -1.369871E-05 +7.600000E-05 +7.300761E-03 +1.254112E-05 0.000000E+00 0.000000E+00 -6.141488E-04 -1.885896E-07 +5.841969E-04 +1.706438E-07 +0.000000E+00 +0.000000E+00 +5.861433E-04 +3.435640E-07 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +3.000000E-02 +1.820000E-04 +1.518122E-02 +4.757233E-05 +0.000000E+00 +0.000000E+00 +2.927374E-04 +8.569516E-08 +2.000000E-03 +2.000000E-06 +2.631167E-03 +3.503358E-06 +1.000000E-03 +1.000000E-06 +2.920435E-04 +8.528942E-08 +2.500000E-02 +1.390000E-04 +9.343205E-03 +1.910189E-05 +0.000000E+00 +0.000000E+00 +2.039724E-03 +1.271217E-06 +1.000000E-03 +1.000000E-06 +5.861433E-04 +3.435640E-07 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.400000E-02 +1.340000E-04 +1.080336E-02 +2.533338E-05 +0.000000E+00 +0.000000E+00 +2.914595E-04 +8.494867E-08 0.000000E+00 0.000000E+00 0.000000E+00 @@ -705,46 +145,14 @@ tally 1: 0.000000E+00 0.000000E+00 0.000000E+00 -1.100000E-02 -2.700000E-05 -3.927884E-03 -3.728010E-06 +1.400000E-02 +5.200000E-05 +6.711472E-03 +1.216306E-05 0.000000E+00 0.000000E+00 -3.074376E-04 -9.451786E-08 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -9.000000E-03 -1.900000E-05 -4.217645E-03 -4.306910E-06 -0.000000E+00 -0.000000E+00 -6.128755E-04 -1.878102E-07 +5.847809E-04 +1.709846E-07 0.000000E+00 0.000000E+00 0.000000E+00 @@ -754,37 +162,89 @@ tally 1: 0.000000E+00 0.000000E+00 1.700000E-02 -7.700000E-05 -7.235504E-03 -1.301737E-05 +7.900000E-05 +6.413106E-03 +1.186604E-05 0.000000E+00 0.000000E+00 -3.054379E-04 -9.329231E-08 -0.000000E+00 -0.000000E+00 -1.531736E-03 -8.439742E-07 -3.000000E-03 -3.000000E-06 -3.074376E-04 -9.451786E-08 -9.000000E-03 -1.900000E-05 -3.018298E-03 -2.174671E-06 +5.861433E-04 +3.435640E-07 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -6.141488E-04 -1.885896E-07 +0.000000E+00 +0.000000E+00 +2.900000E-02 +1.770000E-04 +1.314196E-02 +3.678739E-05 +0.000000E+00 +0.000000E+00 +1.167073E-03 +5.110971E-07 +0.000000E+00 +0.000000E+00 +5.861433E-04 +3.435640E-07 1.000000E-03 1.000000E-06 -3.074376E-04 -9.451786E-08 +0.000000E+00 +0.000000E+00 +2.900000E-02 +1.830000E-04 +1.372758E-02 +4.360498E-05 +0.000000E+00 +0.000000E+00 +5.858090E-04 +1.715862E-07 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.200000E-02 +1.000000E-04 +9.631311E-03 +2.001285E-05 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +5.829191E-04 +3.397947E-07 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +8.000000E-03 +1.800000E-05 +4.094439E-03 +4.622331E-06 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.170949E-03 +1.371123E-06 +1.000000E-03 +1.000000E-06 +0.000000E+00 +0.000000E+00 +9.000000E-03 +5.100000E-05 +4.664405E-03 +1.087264E-05 0.000000E+00 0.000000E+00 0.000000E+00 @@ -797,14 +257,362 @@ tally 1: 0.000000E+00 0.000000E+00 0.000000E+00 +2.200000E-02 +1.300000E-04 +9.644227E-03 +2.300481E-05 +0.000000E+00 +0.000000E+00 +8.771587E-04 +4.270487E-07 +0.000000E+00 +0.000000E+00 +2.927374E-04 +8.569516E-08 +1.000000E-03 +1.000000E-06 +0.000000E+00 +0.000000E+00 +2.500000E-02 +1.630000E-04 +1.257283E-02 +3.946813E-05 +0.000000E+00 +0.000000E+00 +1.171259E-03 +8.583084E-07 +0.000000E+00 +0.000000E+00 +1.462299E-03 +1.112414E-06 +1.000000E-03 +1.000000E-06 +0.000000E+00 +0.000000E+00 +2.400000E-02 +1.400000E-04 +1.138156E-02 +3.565057E-05 +0.000000E+00 +0.000000E+00 +2.930717E-04 +8.589100E-08 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +9.000000E-03 +2.100000E-05 +4.383252E-03 +6.073597E-06 +0.000000E+00 +0.000000E+00 +8.707460E-04 +7.581986E-07 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.100000E-02 +3.500000E-05 +6.410606E-03 +1.066242E-05 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.000000E-03 +1.000000E-06 +8.756564E-04 +4.254898E-07 +1.000000E-03 +1.000000E-06 +0.000000E+00 +0.000000E+00 +1.600000E-02 +6.000000E-05 +7.287540E-03 +1.279808E-05 +0.000000E+00 +0.000000E+00 +5.822922E-04 +1.695337E-07 +0.000000E+00 +0.000000E+00 +1.172287E-03 +1.374256E-06 +1.000000E-03 +1.000000E-06 +0.000000E+00 +0.000000E+00 +3.400000E-02 +2.820000E-04 +1.603656E-02 +6.229803E-05 +0.000000E+00 +0.000000E+00 +1.460479E-03 +7.689660E-07 +1.000000E-03 +1.000000E-06 +1.165972E-03 +6.797578E-07 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.900000E-02 +8.500000E-05 +7.880322E-03 +1.387762E-05 +0.000000E+00 +0.000000E+00 +8.755466E-04 +4.261064E-07 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +8.000000E-03 +2.400000E-05 +4.666802E-03 +4.926489E-06 +0.000000E+00 +0.000000E+00 +5.829191E-04 +3.397947E-07 +0.000000E+00 +0.000000E+00 +8.759908E-04 +4.256857E-07 2.000000E-03 2.000000E-06 -1.203204E-03 -7.241295E-07 +0.000000E+00 +0.000000E+00 +1.500000E-02 +5.900000E-05 +8.180347E-03 +1.622409E-05 +0.000000E+00 +0.000000E+00 +2.902487E-04 +8.424429E-08 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.300000E-02 +1.390000E-04 +7.593262E-03 +1.708292E-05 +0.000000E+00 +0.000000E+00 +1.750169E-03 +1.193182E-06 +1.000000E-03 +1.000000E-06 +1.461465E-03 +7.684663E-07 +2.000000E-03 +4.000000E-06 +2.914595E-04 +8.494867E-08 +2.300000E-02 +1.350000E-04 +9.639670E-03 +2.161898E-05 +0.000000E+00 +0.000000E+00 +8.781869E-04 +4.288534E-07 +0.000000E+00 +0.000000E+00 +8.707460E-04 +7.581986E-07 +1.000000E-03 +1.000000E-06 +0.000000E+00 +0.000000E+00 +2.100000E-02 +1.090000E-04 +9.045520E-03 +2.171457E-05 +0.000000E+00 +0.000000E+00 +5.851152E-04 +1.711804E-07 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.800000E-02 +7.000000E-05 +1.167023E-02 +2.840320E-05 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.000000E-03 +1.000000E-06 +5.854747E-04 +3.427806E-07 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +3.000000E-03 +5.000000E-06 +1.171618E-03 +6.863446E-07 +0.000000E+00 +0.000000E+00 +2.930717E-04 +8.589100E-08 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.300000E-02 +4.500000E-05 +6.428153E-03 +9.064469E-06 +0.000000E+00 +0.000000E+00 +2.927374E-04 +8.569516E-08 +1.000000E-03 +1.000000E-06 +2.920435E-04 +8.528942E-08 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.800000E-02 +9.000000E-05 +8.185938E-03 +1.967120E-05 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +9.000000E-03 +2.300000E-05 +4.665341E-03 +5.426897E-06 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +4.000000E-03 +4.000000E-06 +3.497088E-03 +3.563633E-06 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +5.000000E-03 +9.000000E-06 +2.333045E-03 +1.870613E-06 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.172287E-03 +1.374256E-06 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +8.000000E-03 +2.200000E-05 +6.413648E-03 +1.136518E-05 +0.000000E+00 +0.000000E+00 +2.927374E-04 +8.569516E-08 +0.000000E+00 +0.000000E+00 +2.930717E-04 +8.589100E-08 +1.000000E-03 +1.000000E-06 +0.000000E+00 +0.000000E+00 +2.000000E-02 +1.200000E-04 +7.007604E-03 +1.379504E-05 +0.000000E+00 +0.000000E+00 +5.851152E-04 +1.711804E-07 +0.000000E+00 +0.000000E+00 +5.861433E-04 +3.435640E-07 +1.000000E-03 +1.000000E-06 +0.000000E+00 +0.000000E+00 +1.700000E-02 +7.900000E-05 +7.281401E-03 +1.600845E-05 0.000000E+00 0.000000E+00 0.000000E+00 @@ -818,9 +626,9 @@ tally 1: 0.000000E+00 0.000000E+00 7.000000E-03 -1.500000E-05 -4.818843E-03 -6.474375E-06 +1.900000E-05 +3.218959E-03 +4.543526E-06 0.000000E+00 0.000000E+00 0.000000E+00 @@ -833,46 +641,10 @@ tally 1: 0.000000E+00 0.000000E+00 0.000000E+00 -2.400000E-02 -1.180000E-04 -1.088639E-02 -2.567229E-05 -0.000000E+00 -0.000000E+00 -3.067112E-04 -9.407179E-08 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.300000E-02 -5.100000E-05 -6.002667E-03 -1.149916E-05 -0.000000E+00 -0.000000E+00 -3.015814E-04 -9.095135E-08 -0.000000E+00 -0.000000E+00 -3.067112E-04 -9.407179E-08 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -2.948908E-04 -8.696057E-08 -0.000000E+00 -0.000000E+00 -2.948908E-04 -8.696057E-08 +9.000000E-03 +1.900000E-05 +4.380921E-03 +4.182826E-06 0.000000E+00 0.000000E+00 0.000000E+00 @@ -885,6 +657,42 @@ tally 1: 0.000000E+00 0.000000E+00 0.000000E+00 +2.100000E-02 +1.050000E-04 +9.932207E-03 +2.153598E-05 +0.000000E+00 +0.000000E+00 +5.854747E-04 +3.427806E-07 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.800000E-02 +7.400000E-05 +7.301011E-03 +1.358176E-05 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +5.804973E-04 +3.369772E-07 +1.000000E-03 +1.000000E-06 +0.000000E+00 +0.000000E+00 +2.300000E-02 +1.610000E-04 +9.647933E-03 +2.657983E-05 0.000000E+00 0.000000E+00 0.000000E+00 @@ -897,14 +705,110 @@ tally 1: 0.000000E+00 0.000000E+00 0.000000E+00 -1.300000E-02 -4.700000E-05 -5.486562E-03 -7.965488E-06 +9.000000E-03 +1.900000E-05 +2.915422E-03 +2.203274E-06 +0.000000E+00 +0.000000E+00 +8.775182E-04 +4.280701E-07 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.000000E-03 +1.000000E-06 +2.920435E-04 +8.528942E-08 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +5.000000E-03 +9.000000E-06 +2.044244E-03 +1.796182E-06 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.800000E-02 +9.000000E-05 +6.718632E-03 +1.203946E-05 +0.000000E+00 +0.000000E+00 +2.927374E-04 +8.569516E-08 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.100000E-02 +2.700000E-05 +4.675703E-03 +5.128811E-06 +0.000000E+00 +0.000000E+00 +2.914595E-04 +8.494867E-08 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.000000E-03 +1.000000E-06 +2.914595E-04 +8.494867E-08 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.000000E-03 +1.000000E-06 +2.920435E-04 +8.528942E-08 +0.000000E+00 +0.000000E+00 0.000000E+00 0.000000E+00 -3.054379E-04 -9.329231E-08 0.000000E+00 0.000000E+00 0.000000E+00 @@ -914,13 +818,9 @@ tally 1: 0.000000E+00 0.000000E+00 8.000000E-03 -1.800000E-05 -3.334317E-03 -3.609712E-06 -0.000000E+00 -0.000000E+00 -2.948908E-04 -8.696057E-08 +2.600000E-05 +4.670349E-03 +6.133014E-06 0.000000E+00 0.000000E+00 0.000000E+00 @@ -929,20 +829,120 @@ tally 1: 0.000000E+00 0.000000E+00 0.000000E+00 -2.000000E-02 -1.080000E-04 -9.741552E-03 -2.552400E-05 0.000000E+00 0.000000E+00 -3.015814E-04 -9.095135E-08 0.000000E+00 0.000000E+00 -1.800986E-03 -1.622276E-06 -1.000000E-03 -1.000000E-06 +1.500000E-02 +6.100000E-05 +8.751735E-03 +1.922421E-05 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.400000E-02 +5.000000E-05 +6.126605E-03 +9.620966E-06 +0.000000E+00 +0.000000E+00 +5.835031E-04 +1.702381E-07 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.000000E-03 +2.000000E-06 +5.847809E-04 +1.709846E-07 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.000000E-03 +2.000000E-06 +8.719569E-04 +4.219258E-07 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +9.000000E-03 +2.700000E-05 +4.085939E-03 +4.936434E-06 +0.000000E+00 +0.000000E+00 +2.930717E-04 +8.589100E-08 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +9.000000E-03 +2.500000E-05 +5.846700E-03 +9.739696E-06 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.300000E-02 +3.900000E-05 +6.128455E-03 +1.013669E-05 +0.000000E+00 +0.000000E+00 +5.851152E-04 +1.711804E-07 +0.000000E+00 +0.000000E+00 +1.172287E-03 +1.374256E-06 +0.000000E+00 +0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 @@ -962,11 +962,11 @@ tally 1: 0.000000E+00 0.000000E+00 tally 2: -5.818100E-01 -6.772558E-02 -6.344749E-01 -8.054355E-02 -3.690180E+00 -2.724752E+00 -4.102635E+01 -3.367908E+02 +5.554367E-01 +6.170503E-02 +6.055520E-01 +7.334109E-02 +3.526894E+00 +2.488065E+00 +3.925114E+01 +3.081807E+02 diff --git a/tests/regression_tests/statepoint_batch/geometry.xml b/tests/regression_tests/statepoint_batch/geometry.xml deleted file mode 100644 index bc56030e1..000000000 --- a/tests/regression_tests/statepoint_batch/geometry.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/tests/regression_tests/statepoint_batch/materials.xml b/tests/regression_tests/statepoint_batch/materials.xml deleted file mode 100644 index 2472a7471..000000000 --- a/tests/regression_tests/statepoint_batch/materials.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/tests/regression_tests/statepoint_batch/results_true.dat b/tests/regression_tests/statepoint_batch/results_true.dat deleted file mode 100644 index f5c855d77..000000000 --- a/tests/regression_tests/statepoint_batch/results_true.dat +++ /dev/null @@ -1,2 +0,0 @@ -k-combined: -3.048864E-01 1.689118E-03 diff --git a/tests/regression_tests/statepoint_batch/settings.xml b/tests/regression_tests/statepoint_batch/settings.xml deleted file mode 100644 index e2f8dad47..000000000 --- a/tests/regression_tests/statepoint_batch/settings.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - eigenvalue - 10 - 5 - 1000 - - - - -4 -4 -4 4 4 4 - - - - diff --git a/tests/regression_tests/statepoint_batch/test.py b/tests/regression_tests/statepoint_batch/test.py deleted file mode 100644 index 323b28fc6..000000000 --- a/tests/regression_tests/statepoint_batch/test.py +++ /dev/null @@ -1,18 +0,0 @@ -from tests.testing_harness import TestHarness - - -class StatepointTestHarness(TestHarness): - def __init__(self): - super().__init__(None) - - def _test_output_created(self): - """Make sure statepoint files have been created.""" - sps = ('statepoint.03.h5', 'statepoint.06.h5', 'statepoint.09.h5') - for sp in sps: - self._sp_name = sp - TestHarness._test_output_created(self) - - -def test_statepoint_batch(): - harness = StatepointTestHarness() - harness.main() diff --git a/tests/regression_tests/statepoint_restart/results_true.dat b/tests/regression_tests/statepoint_restart/results_true.dat index aebc971f4..b919b3000 100644 --- a/tests/regression_tests/statepoint_restart/results_true.dat +++ b/tests/regression_tests/statepoint_restart/results_true.dat @@ -1,66 +1,18 @@ k-combined: -3.070134E-01 3.900396E-03 +2.940336E-01 7.338463E-04 tally 1: 1.300000E-02 -4.700000E-05 +3.900000E-05 1.300000E-02 -4.700000E-05 -5.741381E-03 -9.030024E-06 +3.900000E-05 +5.833114E-03 +7.476880E-06 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -3.067112E-04 -9.407179E-08 -1.000000E-03 -1.000000E-06 -1.000000E-03 -1.000000E-06 -3.015814E-04 -9.095135E-08 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -2.600000E-02 -1.420000E-04 -2.600000E-02 -1.420000E-04 -1.268989E-02 -3.464490E-05 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -2.948908E-04 -8.696057E-08 -1.000000E-03 -1.000000E-06 -1.000000E-03 -1.000000E-06 -1.535009E-03 -1.224718E-06 -1.000000E-03 -1.000000E-06 -1.000000E-03 -1.000000E-06 -0.000000E+00 -0.000000E+00 -3.200000E-02 -2.760000E-04 -3.200000E-02 -2.760000E-04 -1.248507E-02 -3.714039E-05 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -9.208601E-04 -4.708050E-07 +1.164000E-03 +5.072152E-07 0.000000E+00 0.000000E+00 0.000000E+00 @@ -73,900 +25,36 @@ tally 1: 0.000000E+00 0.000000E+00 0.000000E+00 -1.900000E-02 -7.500000E-05 -1.900000E-02 -7.500000E-05 -8.218811E-03 -1.462963E-05 +2.100000E-02 +1.110000E-04 +2.100000E-02 +1.110000E-04 +1.108363E-02 +2.889480E-05 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -9.070399E-04 -2.743247E-07 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -9.047443E-04 -8.185622E-07 -1.000000E-03 -1.000000E-06 -1.000000E-03 -1.000000E-06 -0.000000E+00 -0.000000E+00 -1.200000E-02 -5.000000E-05 -1.200000E-02 -5.000000E-05 -3.938144E-03 -5.245641E-06 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -3.067112E-04 -9.407179E-08 -1.000000E-03 -1.000000E-06 +5.861433E-04 +3.435640E-07 2.000000E-03 -4.000000E-06 -5.897816E-04 -3.478423E-07 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -2.948908E-04 -8.696057E-08 -2.000000E-02 -1.260000E-04 -2.000000E-02 -1.260000E-04 -9.079852E-03 -2.657486E-05 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -3.100000E-02 -2.010000E-04 -3.100000E-02 -2.010000E-04 -1.336346E-02 -3.645780E-05 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -2.102710E-03 -1.524522E-06 -1.000000E-03 -1.000000E-06 -1.000000E-03 -1.000000E-06 -9.083133E-04 -4.632477E-07 -1.000000E-03 -1.000000E-06 -1.000000E-03 -1.000000E-06 -0.000000E+00 -0.000000E+00 -2.300000E-02 -1.090000E-04 -2.300000E-02 -1.090000E-04 -1.334578E-02 -3.590708E-05 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -6.031628E-04 -3.638054E-07 -1.000000E-03 -1.000000E-06 -1.000000E-03 -1.000000E-06 -1.530605E-03 -1.035684E-06 +2.000000E-06 +3.000000E-03 +5.000000E-06 +2.043490E-03 +1.793389E-06 2.000000E-03 2.000000E-06 2.000000E-03 2.000000E-06 -6.082927E-04 -1.850231E-07 -1.400000E-02 -4.200000E-05 -1.400000E-02 -4.200000E-05 -7.257468E-03 -1.221578E-05 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -2.948908E-04 -8.696057E-08 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -8.980536E-04 -4.507660E-07 -2.000000E-03 -4.000000E-06 -2.000000E-03 -4.000000E-06 -0.000000E+00 -0.000000E+00 -9.000000E-03 -2.700000E-05 -9.000000E-03 -2.700000E-05 -5.193169E-03 -1.187321E-05 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -3.054379E-04 -9.329231E-08 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.000000E-02 -2.400000E-05 -1.000000E-02 -2.400000E-05 -5.170002E-03 -7.361546E-06 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -6.003287E-04 -1.802529E-07 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -2.800000E-02 -1.720000E-04 -2.800000E-02 -1.720000E-04 -1.699195E-02 -6.267008E-05 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -2.800000E-02 -1.980000E-04 -2.800000E-02 -1.980000E-04 -1.338750E-02 -4.565234E-05 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -9.183134E-04 -4.676871E-07 -1.000000E-03 -1.000000E-06 -1.000000E-03 -1.000000E-06 -1.537188E-03 -2.362946E-06 -2.000000E-03 -4.000000E-06 -2.000000E-03 -4.000000E-06 -0.000000E+00 -0.000000E+00 -2.900000E-02 -1.950000E-04 -2.900000E-02 -1.950000E-04 -1.178615E-02 -3.130999E-05 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -3.015814E-04 -9.095135E-08 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.179563E-03 -1.391369E-06 -1.000000E-03 -1.000000E-06 -1.000000E-03 -1.000000E-06 -0.000000E+00 -0.000000E+00 -1.500000E-02 -6.500000E-05 -1.500000E-02 -6.500000E-05 -5.706064E-03 -9.729293E-06 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -2.948908E-04 -8.696057E-08 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -3.000000E-03 -9.000000E-06 -3.000000E-03 -9.000000E-06 -1.516642E-03 -1.579637E-06 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -5.897816E-04 -3.478423E-07 -1.000000E-03 -1.000000E-06 -1.000000E-03 -1.000000E-06 -0.000000E+00 -0.000000E+00 -2.900000E-02 -1.970000E-04 -2.900000E-02 -1.970000E-04 -1.274851E-02 -3.511219E-05 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -9.057666E-04 -4.601298E-07 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.800000E-02 -7.600000E-05 -1.800000E-02 -7.600000E-05 -8.803642E-03 -1.730938E-05 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -3.074376E-04 -9.451786E-08 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -2.900000E-02 -1.830000E-04 -2.900000E-02 -1.830000E-04 -1.245316E-02 -3.378176E-05 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -6.016020E-04 -1.810324E-07 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.000000E-03 -1.000000E-06 -1.000000E-03 -1.000000E-06 -6.090190E-04 -1.854692E-07 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -6.031628E-04 -3.638054E-07 -1.000000E-03 -1.000000E-06 -1.000000E-03 -1.000000E-06 -0.000000E+00 -0.000000E+00 -1.900000E-02 -8.700000E-05 -1.900000E-02 -8.700000E-05 -8.781239E-03 -1.676750E-05 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -6.128755E-04 -1.878102E-07 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -3.500000E-02 -2.930000E-04 -3.500000E-02 -2.930000E-04 -1.372494E-02 -4.750881E-05 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -9.090396E-04 -2.755502E-07 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -5.897816E-04 -3.478423E-07 -1.000000E-03 -1.000000E-06 -1.000000E-03 -1.000000E-06 -0.000000E+00 -0.000000E+00 -3.700000E-02 -3.270000E-04 -3.700000E-02 -3.270000E-04 -1.492073E-02 -5.134793E-05 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -6.134225E-04 -3.762872E-07 -1.000000E-03 -1.000000E-06 -1.000000E-03 -1.000000E-06 -3.074376E-04 -9.451786E-08 -1.000000E-03 -1.000000E-06 -1.000000E-03 -1.000000E-06 -6.148751E-04 -3.780714E-07 -3.500000E-02 -2.810000E-04 -3.500000E-02 -2.810000E-04 -1.728232E-02 -6.621096E-05 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.214477E-03 -3.688425E-07 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.481145E-03 -1.482321E-06 -1.000000E-03 -1.000000E-06 -1.000000E-03 -1.000000E-06 -3.015814E-04 -9.095135E-08 -8.000000E-03 -1.800000E-05 -8.000000E-03 -1.800000E-05 -3.359923E-03 -3.081200E-06 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -3.067112E-04 -9.407179E-08 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -7.000000E-03 -1.500000E-05 -7.000000E-03 -1.500000E-05 -3.660087E-03 -3.561493E-06 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -9.203130E-04 -4.713637E-07 -1.000000E-03 -1.000000E-06 -1.000000E-03 -1.000000E-06 -3.015814E-04 -9.095135E-08 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -3.500000E-02 -2.630000E-04 -3.500000E-02 -2.630000E-04 -1.425810E-02 -4.231681E-05 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.516059E-03 -4.597939E-07 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.221752E-03 -1.492677E-06 -1.000000E-03 -1.000000E-06 -1.000000E-03 -1.000000E-06 -0.000000E+00 -0.000000E+00 -2.300000E-02 -1.110000E-04 -2.300000E-02 -1.110000E-04 -1.184871E-02 -2.918189E-05 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -6.016020E-04 -1.810324E-07 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.600000E-02 -6.600000E-05 -1.600000E-02 -6.600000E-05 -7.879913E-03 -1.566560E-05 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -9.039098E-04 -2.724298E-07 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -3.067112E-04 -9.407179E-08 -1.000000E-03 -1.000000E-06 -1.000000E-03 -1.000000E-06 -0.000000E+00 -0.000000E+00 -9.000000E-03 -1.900000E-05 -9.000000E-03 -1.900000E-05 -4.256120E-03 -4.431220E-06 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -6.000000E-03 -1.200000E-05 -6.000000E-03 -1.200000E-05 -2.739774E-03 -2.333986E-06 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.400000E-02 -6.800000E-05 -1.400000E-02 -6.800000E-05 -7.182805E-03 -1.822340E-05 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.500000E-02 -6.300000E-05 -1.500000E-02 -6.300000E-05 -5.734575E-03 -9.207711E-06 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -6.070193E-04 -1.842437E-07 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -8.846723E-04 -7.826452E-07 -1.000000E-03 -1.000000E-06 -1.000000E-03 -1.000000E-06 -0.000000E+00 -0.000000E+00 +2.930717E-04 +8.589100E-08 2.000000E-02 -8.800000E-05 +9.000000E-05 2.000000E-02 -8.800000E-05 -9.416733E-03 -2.020354E-05 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -6.003287E-04 -1.802529E-07 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -6.031628E-04 -3.638054E-07 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -3.015814E-04 -9.095135E-08 -7.000000E-03 -1.500000E-05 -7.000000E-03 -1.500000E-05 -2.413278E-03 -1.439032E-06 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -2.948908E-04 -8.696057E-08 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -7.000000E-03 -1.500000E-05 -7.000000E-03 -1.500000E-05 -4.226919E-03 -4.173413E-06 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -2.300000E-02 -1.590000E-04 -2.300000E-02 -1.590000E-04 -1.125341E-02 -3.890966E-05 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -5.964722E-04 -1.779119E-07 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -8.846723E-04 -7.826452E-07 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -3.200000E-02 -2.260000E-04 -3.200000E-02 -2.260000E-04 -1.458976E-02 -4.416780E-05 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.814806E-03 -9.096012E-07 -1.000000E-03 -1.000000E-06 -1.000000E-03 -1.000000E-06 -6.031628E-04 -3.638054E-07 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -3.100000E-02 -2.050000E-04 -3.100000E-02 -2.050000E-04 -1.241089E-02 -3.545088E-05 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.515620E-03 -1.191731E-06 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -6.121491E-04 -1.873641E-07 -1.000000E-03 -1.000000E-06 -1.000000E-03 -1.000000E-06 -0.000000E+00 -0.000000E+00 -1.000000E-02 -2.600000E-05 -1.000000E-02 -2.600000E-05 -3.936862E-03 -3.749154E-06 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -2.948908E-04 -8.696057E-08 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.100000E-02 -4.700000E-05 -1.100000E-02 -4.700000E-05 -5.084641E-03 -9.248485E-06 +9.000000E-05 +9.334862E-03 +1.853104E-05 0.000000E+00 0.000000E+00 0.000000E+00 @@ -986,65 +74,401 @@ tally 1: 0.000000E+00 0.000000E+00 2.500000E-02 -1.770000E-04 +1.430000E-04 2.500000E-02 +1.430000E-04 +1.110224E-02 +2.872840E-05 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +5.833203E-04 +1.701353E-07 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +5.000000E-03 +1.100000E-05 +5.000000E-03 +1.100000E-05 +1.752967E-03 +1.027501E-06 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.930717E-04 +8.589100E-08 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.800000E-02 +7.600000E-05 +1.800000E-02 +7.600000E-05 +7.300761E-03 +1.254112E-05 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +5.841969E-04 +1.706438E-07 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +5.861433E-04 +3.435640E-07 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +3.000000E-02 +1.820000E-04 +3.000000E-02 +1.820000E-04 +1.518122E-02 +4.757233E-05 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.927374E-04 +8.569516E-08 +2.000000E-03 +2.000000E-06 +2.000000E-03 +2.000000E-06 +2.631167E-03 +3.503358E-06 +1.000000E-03 +1.000000E-06 +1.000000E-03 +1.000000E-06 +2.920435E-04 +8.528942E-08 +2.500000E-02 +1.390000E-04 +2.500000E-02 +1.390000E-04 +9.343205E-03 +1.910189E-05 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.039724E-03 +1.271217E-06 +1.000000E-03 +1.000000E-06 +1.000000E-03 +1.000000E-06 +5.861433E-04 +3.435640E-07 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.400000E-02 +1.340000E-04 +2.400000E-02 +1.340000E-04 +1.080336E-02 +2.533338E-05 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.914595E-04 +8.494867E-08 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.400000E-02 +5.200000E-05 +1.400000E-02 +5.200000E-05 +6.711472E-03 +1.216306E-05 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +5.847809E-04 +1.709846E-07 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.700000E-02 +7.900000E-05 +1.700000E-02 +7.900000E-05 +6.413106E-03 +1.186604E-05 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +5.861433E-04 +3.435640E-07 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.900000E-02 1.770000E-04 -1.021860E-02 -3.099521E-05 +2.900000E-02 +1.770000E-04 +1.314196E-02 +3.678739E-05 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -3.074376E-04 -9.451786E-08 +1.167073E-03 +5.110971E-07 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -9.086007E-04 -4.570977E-07 -2.000000E-03 -2.000000E-06 -2.000000E-03 -2.000000E-06 -3.054379E-04 -9.329231E-08 -1.500000E-02 -5.300000E-05 -1.500000E-02 -5.300000E-05 -7.584986E-03 -1.188822E-05 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -6.128755E-04 -1.878102E-07 +5.861433E-04 +3.435640E-07 1.000000E-03 1.000000E-06 1.000000E-03 1.000000E-06 -6.108758E-04 -3.731692E-07 +0.000000E+00 +0.000000E+00 +2.900000E-02 +1.830000E-04 +2.900000E-02 +1.830000E-04 +1.372758E-02 +4.360498E-05 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +5.858090E-04 +1.715862E-07 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -1.800000E-02 -8.600000E-05 -1.800000E-02 -8.600000E-05 -6.672457E-03 -1.369871E-05 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -6.141488E-04 -1.885896E-07 +0.000000E+00 +0.000000E+00 +2.200000E-02 +1.000000E-04 +2.200000E-02 +1.000000E-04 +9.631311E-03 +2.001285E-05 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +5.829191E-04 +3.397947E-07 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +8.000000E-03 +1.800000E-05 +8.000000E-03 +1.800000E-05 +4.094439E-03 +4.622331E-06 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.170949E-03 +1.371123E-06 +1.000000E-03 +1.000000E-06 +1.000000E-03 +1.000000E-06 +0.000000E+00 +0.000000E+00 +9.000000E-03 +5.100000E-05 +9.000000E-03 +5.100000E-05 +4.664405E-03 +1.087264E-05 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.200000E-02 +1.300000E-04 +2.200000E-02 +1.300000E-04 +9.644227E-03 +2.300481E-05 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +8.771587E-04 +4.270487E-07 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.927374E-04 +8.569516E-08 +1.000000E-03 +1.000000E-06 +1.000000E-03 +1.000000E-06 +0.000000E+00 +0.000000E+00 +2.500000E-02 +1.630000E-04 +2.500000E-02 +1.630000E-04 +1.257283E-02 +3.946813E-05 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.171259E-03 +8.583084E-07 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.462299E-03 +1.112414E-06 +1.000000E-03 +1.000000E-06 +1.000000E-03 +1.000000E-06 +0.000000E+00 +0.000000E+00 +2.400000E-02 +1.400000E-04 +2.400000E-02 +1.400000E-04 +1.138156E-02 +3.565057E-05 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.930717E-04 +8.589100E-08 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +9.000000E-03 +2.100000E-05 +9.000000E-03 +2.100000E-05 +4.383252E-03 +6.073597E-06 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +8.707460E-04 +7.581986E-07 0.000000E+00 0.000000E+00 0.000000E+00 @@ -1058,129 +482,89 @@ tally 1: 0.000000E+00 0.000000E+00 1.100000E-02 -2.700000E-05 +3.500000E-05 1.100000E-02 -2.700000E-05 -3.927884E-03 -3.728010E-06 +3.500000E-05 +6.410606E-03 +1.066242E-05 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -3.074376E-04 -9.451786E-08 0.000000E+00 0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -9.000000E-03 -1.900000E-05 -9.000000E-03 -1.900000E-05 -4.217645E-03 -4.306910E-06 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -6.128755E-04 -1.878102E-07 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.700000E-02 -7.700000E-05 -1.700000E-02 -7.700000E-05 -7.235504E-03 -1.301737E-05 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -3.054379E-04 -9.329231E-08 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -1.531736E-03 -8.439742E-07 -3.000000E-03 -3.000000E-06 -3.000000E-03 -3.000000E-06 -3.074376E-04 -9.451786E-08 -9.000000E-03 -1.900000E-05 -9.000000E-03 -1.900000E-05 -3.018298E-03 -2.174671E-06 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -6.141488E-04 -1.885896E-07 1.000000E-03 1.000000E-06 1.000000E-03 1.000000E-06 -3.074376E-04 -9.451786E-08 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 +8.756564E-04 +4.254898E-07 +1.000000E-03 +1.000000E-06 +1.000000E-03 +1.000000E-06 +0.000000E+00 +0.000000E+00 +1.600000E-02 +6.000000E-05 +1.600000E-02 +6.000000E-05 +7.287540E-03 +1.279808E-05 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +5.822922E-04 +1.695337E-07 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.172287E-03 +1.374256E-06 +1.000000E-03 +1.000000E-06 +1.000000E-03 +1.000000E-06 +0.000000E+00 +0.000000E+00 +3.400000E-02 +2.820000E-04 +3.400000E-02 +2.820000E-04 +1.603656E-02 +6.229803E-05 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.460479E-03 +7.689660E-07 +1.000000E-03 +1.000000E-06 +1.000000E-03 +1.000000E-06 +1.165972E-03 +6.797578E-07 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.900000E-02 +8.500000E-05 +1.900000E-02 +8.500000E-05 +7.880322E-03 +1.387762E-05 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +8.755466E-04 +4.261064E-07 0.000000E+00 0.000000E+00 0.000000E+00 @@ -1193,20 +577,348 @@ tally 1: 0.000000E+00 0.000000E+00 0.000000E+00 +8.000000E-03 +2.400000E-05 +8.000000E-03 +2.400000E-05 +4.666802E-03 +4.926489E-06 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 +5.829191E-04 +3.397947E-07 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 +8.759908E-04 +4.256857E-07 2.000000E-03 2.000000E-06 2.000000E-03 2.000000E-06 -1.203204E-03 -7.241295E-07 +0.000000E+00 +0.000000E+00 +1.500000E-02 +5.900000E-05 +1.500000E-02 +5.900000E-05 +8.180347E-03 +1.622409E-05 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.902487E-04 +8.424429E-08 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.300000E-02 +1.390000E-04 +2.300000E-02 +1.390000E-04 +7.593262E-03 +1.708292E-05 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.750169E-03 +1.193182E-06 +1.000000E-03 +1.000000E-06 +1.000000E-03 +1.000000E-06 +1.461465E-03 +7.684663E-07 +2.000000E-03 +4.000000E-06 +2.000000E-03 +4.000000E-06 +2.914595E-04 +8.494867E-08 +2.300000E-02 +1.350000E-04 +2.300000E-02 +1.350000E-04 +9.639670E-03 +2.161898E-05 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +8.781869E-04 +4.288534E-07 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +8.707460E-04 +7.581986E-07 +1.000000E-03 +1.000000E-06 +1.000000E-03 +1.000000E-06 +0.000000E+00 +0.000000E+00 +2.100000E-02 +1.090000E-04 +2.100000E-02 +1.090000E-04 +9.045520E-03 +2.171457E-05 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +5.851152E-04 +1.711804E-07 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.800000E-02 +7.000000E-05 +1.800000E-02 +7.000000E-05 +1.167023E-02 +2.840320E-05 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.000000E-03 +1.000000E-06 +1.000000E-03 +1.000000E-06 +5.854747E-04 +3.427806E-07 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +3.000000E-03 +5.000000E-06 +3.000000E-03 +5.000000E-06 +1.171618E-03 +6.863446E-07 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.930717E-04 +8.589100E-08 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.300000E-02 +4.500000E-05 +1.300000E-02 +4.500000E-05 +6.428153E-03 +9.064469E-06 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.927374E-04 +8.569516E-08 +1.000000E-03 +1.000000E-06 +1.000000E-03 +1.000000E-06 +2.920435E-04 +8.528942E-08 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.800000E-02 +9.000000E-05 +1.800000E-02 +9.000000E-05 +8.185938E-03 +1.967120E-05 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +9.000000E-03 +2.300000E-05 +9.000000E-03 +2.300000E-05 +4.665341E-03 +5.426897E-06 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +4.000000E-03 +4.000000E-06 +4.000000E-03 +4.000000E-06 +3.497088E-03 +3.563633E-06 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +5.000000E-03 +9.000000E-06 +5.000000E-03 +9.000000E-06 +2.333045E-03 +1.870613E-06 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.172287E-03 +1.374256E-06 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +8.000000E-03 +2.200000E-05 +8.000000E-03 +2.200000E-05 +6.413648E-03 +1.136518E-05 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.927374E-04 +8.569516E-08 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.930717E-04 +8.589100E-08 +1.000000E-03 +1.000000E-06 +1.000000E-03 +1.000000E-06 +0.000000E+00 +0.000000E+00 +2.000000E-02 +1.200000E-04 +2.000000E-02 +1.200000E-04 +7.007604E-03 +1.379504E-05 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +5.851152E-04 +1.711804E-07 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +5.861433E-04 +3.435640E-07 +1.000000E-03 +1.000000E-06 +1.000000E-03 +1.000000E-06 +0.000000E+00 +0.000000E+00 +1.700000E-02 +7.900000E-05 +1.700000E-02 +7.900000E-05 +7.281401E-03 +1.600845E-05 0.000000E+00 0.000000E+00 0.000000E+00 @@ -1226,11 +938,11 @@ tally 1: 0.000000E+00 0.000000E+00 7.000000E-03 -1.500000E-05 +1.900000E-05 7.000000E-03 -1.500000E-05 -4.818843E-03 -6.474375E-06 +1.900000E-05 +3.218959E-03 +4.543526E-06 0.000000E+00 0.000000E+00 0.000000E+00 @@ -1249,18 +961,16 @@ tally 1: 0.000000E+00 0.000000E+00 0.000000E+00 -2.400000E-02 -1.180000E-04 -2.400000E-02 -1.180000E-04 -1.088639E-02 -2.567229E-05 +9.000000E-03 +1.900000E-05 +9.000000E-03 +1.900000E-05 +4.380921E-03 +4.182826E-06 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -3.067112E-04 -9.407179E-08 0.000000E+00 0.000000E+00 0.000000E+00 @@ -1273,24 +983,22 @@ tally 1: 0.000000E+00 0.000000E+00 0.000000E+00 -1.300000E-02 -5.100000E-05 -1.300000E-02 -5.100000E-05 -6.002667E-03 -1.149916E-05 0.000000E+00 0.000000E+00 +2.100000E-02 +1.050000E-04 +2.100000E-02 +1.050000E-04 +9.932207E-03 +2.153598E-05 0.000000E+00 0.000000E+00 -3.015814E-04 -9.095135E-08 0.000000E+00 0.000000E+00 +5.854747E-04 +3.427806E-07 0.000000E+00 0.000000E+00 -3.067112E-04 -9.407179E-08 0.000000E+00 0.000000E+00 0.000000E+00 @@ -1301,22 +1009,36 @@ tally 1: 0.000000E+00 0.000000E+00 0.000000E+00 -2.948908E-04 -8.696057E-08 +1.800000E-02 +7.400000E-05 +1.800000E-02 +7.400000E-05 +7.301011E-03 +1.358176E-05 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -2.948908E-04 -8.696057E-08 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 +5.804973E-04 +3.369772E-07 +1.000000E-03 +1.000000E-06 +1.000000E-03 +1.000000E-06 0.000000E+00 0.000000E+00 +2.300000E-02 +1.610000E-04 +2.300000E-02 +1.610000E-04 +9.647933E-03 +2.657983E-05 0.000000E+00 0.000000E+00 0.000000E+00 @@ -1335,28 +1057,162 @@ tally 1: 0.000000E+00 0.000000E+00 0.000000E+00 +9.000000E-03 +1.900000E-05 +9.000000E-03 +1.900000E-05 +2.915422E-03 +2.203274E-06 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 +8.775182E-04 +4.280701E-07 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -1.300000E-02 -4.700000E-05 -1.300000E-02 -4.700000E-05 -5.486562E-03 -7.965488E-06 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -3.054379E-04 -9.329231E-08 +0.000000E+00 +0.000000E+00 +1.000000E-03 +1.000000E-06 +1.000000E-03 +1.000000E-06 +2.920435E-04 +8.528942E-08 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +5.000000E-03 +9.000000E-06 +5.000000E-03 +9.000000E-06 +2.044244E-03 +1.796182E-06 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.800000E-02 +9.000000E-05 +1.800000E-02 +9.000000E-05 +6.718632E-03 +1.203946E-05 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.927374E-04 +8.569516E-08 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.100000E-02 +2.700000E-05 +1.100000E-02 +2.700000E-05 +4.675703E-03 +5.128811E-06 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.914595E-04 +8.494867E-08 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.000000E-03 +1.000000E-06 +1.000000E-03 +1.000000E-06 +2.914595E-04 +8.494867E-08 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.000000E-03 +1.000000E-06 +1.000000E-03 +1.000000E-06 +2.920435E-04 +8.528942E-08 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 @@ -1370,17 +1226,11 @@ tally 1: 0.000000E+00 0.000000E+00 8.000000E-03 -1.800000E-05 +2.600000E-05 8.000000E-03 -1.800000E-05 -3.334317E-03 -3.609712E-06 -0.000000E+00 -0.000000E+00 -0.000000E+00 -0.000000E+00 -2.948908E-04 -8.696057E-08 +2.600000E-05 +4.670349E-03 +6.133014E-06 0.000000E+00 0.000000E+00 0.000000E+00 @@ -1393,28 +1243,178 @@ tally 1: 0.000000E+00 0.000000E+00 0.000000E+00 -2.000000E-02 -1.080000E-04 -2.000000E-02 -1.080000E-04 -9.741552E-03 -2.552400E-05 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -3.015814E-04 -9.095135E-08 +0.000000E+00 +0.000000E+00 +1.500000E-02 +6.100000E-05 +1.500000E-02 +6.100000E-05 +8.751735E-03 +1.922421E-05 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.400000E-02 +5.000000E-05 +1.400000E-02 +5.000000E-05 +6.126605E-03 +9.620966E-06 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +5.835031E-04 +1.702381E-07 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.000000E-03 +2.000000E-06 +2.000000E-03 +2.000000E-06 +5.847809E-04 +1.709846E-07 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.000000E-03 +2.000000E-06 +2.000000E-03 +2.000000E-06 +8.719569E-04 +4.219258E-07 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +9.000000E-03 +2.700000E-05 +9.000000E-03 +2.700000E-05 +4.085939E-03 +4.936434E-06 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +2.930717E-04 +8.589100E-08 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +9.000000E-03 +2.500000E-05 +9.000000E-03 +2.500000E-05 +5.846700E-03 +9.739696E-06 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.300000E-02 +3.900000E-05 +1.300000E-02 +3.900000E-05 +6.128455E-03 +1.013669E-05 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +5.851152E-04 +1.711804E-07 +0.000000E+00 +0.000000E+00 +0.000000E+00 +0.000000E+00 +1.172287E-03 +1.374256E-06 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -1.800986E-03 -1.622276E-06 -1.000000E-03 -1.000000E-06 -1.000000E-03 -1.000000E-06 0.000000E+00 0.000000E+00 0.000000E+00 @@ -1442,11 +1442,11 @@ tally 1: 0.000000E+00 0.000000E+00 tally 2: -5.818100E-01 -6.772558E-02 -6.344749E-01 -8.054355E-02 -3.690180E+00 -2.724752E+00 -4.102635E+01 -3.367908E+02 +5.554367E-01 +6.170503E-02 +6.055520E-01 +7.334109E-02 +3.526894E+00 +2.488065E+00 +3.925114E+01 +3.081807E+02 diff --git a/tests/regression_tests/statepoint_sourcesep/results_true.dat b/tests/regression_tests/statepoint_sourcesep/results_true.dat index bbf03de94..97b997ae6 100644 --- a/tests/regression_tests/statepoint_sourcesep/results_true.dat +++ b/tests/regression_tests/statepoint_sourcesep/results_true.dat @@ -1,2 +1,2 @@ k-combined: -3.070134E-01 3.900396E-03 +2.940336E-01 7.338463E-04 diff --git a/tests/regression_tests/stride/inputs_true.dat b/tests/regression_tests/stride/inputs_true.dat index f93ec33d1..ebae53c05 100644 --- a/tests/regression_tests/stride/inputs_true.dat +++ b/tests/regression_tests/stride/inputs_true.dat @@ -1,21 +1,21 @@ - - - + + + - + eigenvalue 1000 10 5 - + -4 -4 -4 4 4 4 diff --git a/tests/regression_tests/stride/results_true.dat b/tests/regression_tests/stride/results_true.dat index a65411150..825de3766 100644 --- a/tests/regression_tests/stride/results_true.dat +++ b/tests/regression_tests/stride/results_true.dat @@ -1,2 +1,2 @@ k-combined: -2.978080E-01 6.106774E-03 +2.953207E-01 2.874356E-03 diff --git a/tests/regression_tests/surface_source/inputs_true_read.dat b/tests/regression_tests/surface_source/inputs_true_read_h5.dat similarity index 74% rename from tests/regression_tests/surface_source/inputs_true_read.dat rename to tests/regression_tests/surface_source/inputs_true_read_h5.dat index 14a55f0bf..321c11d42 100644 --- a/tests/regression_tests/surface_source/inputs_true_read.dat +++ b/tests/regression_tests/surface_source/inputs_true_read_h5.dat @@ -7,10 +7,10 @@ - - - - + + + + fixed source diff --git a/tests/regression_tests/surface_source/inputs_true_read_mcpl.dat b/tests/regression_tests/surface_source/inputs_true_read_mcpl.dat new file mode 100644 index 000000000..2ee76f618 --- /dev/null +++ b/tests/regression_tests/surface_source/inputs_true_read_mcpl.dat @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + fixed source + 1000 + 10 + + surface_source_true.mcpl + + 1 + + + + 3 + + + 1 + flux + + + diff --git a/tests/regression_tests/surface_source/inputs_true_write.dat b/tests/regression_tests/surface_source/inputs_true_write_h5.dat similarity index 73% rename from tests/regression_tests/surface_source/inputs_true_write.dat rename to tests/regression_tests/surface_source/inputs_true_write_h5.dat index 5c85de631..10e3af0a7 100644 --- a/tests/regression_tests/surface_source/inputs_true_write.dat +++ b/tests/regression_tests/surface_source/inputs_true_write_h5.dat @@ -7,16 +7,16 @@ - - - - + + + + fixed source 1000 10 - + 0 0 0 diff --git a/tests/regression_tests/surface_source/inputs_true_write_mcpl.dat b/tests/regression_tests/surface_source/inputs_true_write_mcpl.dat new file mode 100644 index 000000000..e9758144d --- /dev/null +++ b/tests/regression_tests/surface_source/inputs_true_write_mcpl.dat @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + fixed source + 1000 + 10 + + + 0 0 0 + + + + 1 + true + 1000 + + 1 + + + + 3 + + + 1 + flux + + + diff --git a/tests/regression_tests/surface_source/surface_source_true.h5 b/tests/regression_tests/surface_source/surface_source_true.h5 index f2055d09d..d343d12ae 100644 Binary files a/tests/regression_tests/surface_source/surface_source_true.h5 and b/tests/regression_tests/surface_source/surface_source_true.h5 differ diff --git a/tests/regression_tests/surface_source/surface_source_true.mcpl b/tests/regression_tests/surface_source/surface_source_true.mcpl new file mode 100644 index 000000000..ca4b7c2c4 Binary files /dev/null and b/tests/regression_tests/surface_source/surface_source_true.mcpl differ diff --git a/tests/regression_tests/surface_source/test.py b/tests/regression_tests/surface_source/test.py index 83b78e61d..13966b26d 100644 --- a/tests/regression_tests/surface_source/test.py +++ b/tests/regression_tests/surface_source/test.py @@ -10,6 +10,25 @@ from tests.testing_harness import PyAPITestHarness from tests.regression_tests import config +def mcpl_to_array(filepath): + import mcpl + + source = [] + with mcpl.MCPLFile(filepath) as f: + for p in f.particles: + source.append( + [ + *tuple(p.position), + *tuple(p.direction), + 1.0e6 * p.ekin, + 1.0e-3 * p.time, + p.weight, + p.pdgcode, + ] + ) + return np.sort(np.array(source), axis=0) + + def assert_structured_arrays_close(arr1, arr2, rtol=1e-5, atol=1e-8): assert arr1.dtype == arr2.dtype @@ -24,8 +43,7 @@ def assert_structured_arrays_close(arr1, arr2, rtol=1e-5, atol=1e-8): @pytest.fixture def model(request): openmc.reset_auto_ids() - marker = request.node.get_closest_marker("surf_source_op") - surf_source_op = marker.args[0] + operation, file_format = request.node.get_closest_marker("params").args openmc_model = openmc.model.Model() @@ -54,15 +72,19 @@ def model(request): openmc_model.settings.batches = 10 openmc_model.settings.seed = 1 - if surf_source_op == 'write': + if operation == 'write': point = openmc.stats.Point((0, 0, 0)) pt_src = openmc.IndependentSource(space=point) openmc_model.settings.source = pt_src - openmc_model.settings.surf_source_write = {'surface_ids': [1], - 'max_particles': 1000} - elif surf_source_op == 'read': - openmc_model.settings.surf_source_read = {'path': 'surface_source_true.h5'} + surf_source_write_settings = {'surface_ids': [1], + 'max_particles': 1000} + if file_format == "mcpl": + surf_source_write_settings["mcpl"] = True + + openmc_model.settings.surf_source_write = surf_source_write_settings + elif operation == 'read': + openmc_model.settings.surf_source_read = {'path': f"surface_source_true.{file_format}"} # Tallies tal = openmc.Tally() @@ -75,22 +97,30 @@ def model(request): class SurfaceSourceTestHarness(PyAPITestHarness): + def __init__(self, statepoint_name, model=None, inputs_true=None, file_format="h5"): + super().__init__(statepoint_name, model, inputs_true) + self.file_format = file_format + def _test_output_created(self): - """Make sure surface_source.h5 has also been created.""" + """Make sure the surface_source file has also been created.""" super()._test_output_created() - # Check if 'surface_source.h5' has been created. if self._model.settings.surf_source_write: - assert os.path.exists('surface_source.h5'), \ + assert os.path.exists(f"surface_source.{self.file_format}"), \ 'Surface source file does not exist.' def _compare_output(self): """Make sure the current surface_source.h5 agree with the reference.""" if self._model.settings.surf_source_write: - with h5py.File("surface_source_true.h5", 'r') as f: - source_true = np.sort(f['source_bank'][()]) - with h5py.File("surface_source.h5", 'r') as f: - source_test = np.sort(f['source_bank'][()]) - assert_structured_arrays_close(source_true, source_test, atol=1e-07) + if self.file_format == "h5": + with h5py.File("surface_source_true.h5", 'r') as f: + source_true = np.sort(f['source_bank'][()]) + with h5py.File("surface_source.h5", 'r') as f: + source_test = np.sort(f['source_bank'][()]) + assert_structured_arrays_close(source_true, source_test, atol=1e-07) + elif self.file_format == "mcpl": + source_true = mcpl_to_array("surface_source_true.mcpl") + source_test = mcpl_to_array("surface_source.mcpl") + np.testing.assert_allclose(source_true, source_test, rtol=1e-5, atol=1e-7) def execute_test(self): """Build input XMLs, run OpenMC, check output and results.""" @@ -111,30 +141,56 @@ class SurfaceSourceTestHarness(PyAPITestHarness): def _overwrite_results(self): """Overwrite the results_true with the results_test.""" shutil.copyfile('results_test.dat', 'results_true.dat') - if os.path.exists('surface_source.h5'): - shutil.copyfile('surface_source.h5', 'surface_source_true.h5') + if os.path.exists(f"surface_source.{self.file_format}"): + shutil.copyfile(f"surface_source.{self.file_format}", f"surface_source_true.{self.file_format}") def _cleanup(self): """Delete statepoints, tally, and test files.""" super()._cleanup() - fs = 'surface_source.h5' + fs = f"surface_source.{self.file_format}" if os.path.exists(fs): os.remove(fs) -@pytest.mark.surf_source_op('write') -def test_surface_source_write(model, monkeypatch): - # Test result is based on 1 MPI process - monkeypatch.setitem(config, "mpi_np", "1") - harness = SurfaceSourceTestHarness('statepoint.10.h5', - model, - 'inputs_true_write.dat') +@pytest.mark.params('write', 'h5') +def test_surface_source_write(model, monkeypatch, request): + monkeypatch.setitem(config, "mpi_np", "1") # Results generated with 1 MPI process + operation, file_format = request.node.get_closest_marker("params").args + harness = SurfaceSourceTestHarness( + "statepoint.10.h5", model, f"inputs_true_{operation}_{file_format}.dat", + file_format=file_format + ) harness.main() -@pytest.mark.surf_source_op('read') -def test_surface_source_read(model): - harness = SurfaceSourceTestHarness('statepoint.10.h5', - model, - 'inputs_true_read.dat') +@pytest.mark.params('read', 'h5') +def test_surface_source_read(model, request): + operation, file_format = request.node.get_closest_marker("params").args + harness = SurfaceSourceTestHarness( + "statepoint.10.h5", model, f"inputs_true_{operation}_{file_format}.dat", + file_format=file_format + ) + harness.main() + + +@pytest.mark.skipif(shutil.which("mcpl-config") is None, reason="MCPL is not available.") +@pytest.mark.params('write', 'mcpl') +def test_surface_source_write_mcpl(model, monkeypatch, request): + monkeypatch.setitem(config, "mpi_np", "1") # Results generated with 1 MPI process + operation, file_format = request.node.get_closest_marker("params").args + harness = SurfaceSourceTestHarness( + "statepoint.10.h5", model, f"inputs_true_{operation}_{file_format}.dat", + file_format=file_format + ) + harness.main() + + +@pytest.mark.skipif(shutil.which("mcpl-config") is None, reason="MCPL is not available.") +@pytest.mark.params('read', 'mcpl') +def test_surface_source_read_mcpl(model, request): + operation, file_format = request.node.get_closest_marker("params").args + harness = SurfaceSourceTestHarness( + "statepoint.10.h5", model, f"inputs_true_{operation}_{file_format}.dat", + file_format=file_format + ) harness.main() diff --git a/tests/regression_tests/surface_source_write/case-01/inputs_true.dat b/tests/regression_tests/surface_source_write/case-01/inputs_true.dat index 7368debd5..2a67b03dd 100644 --- a/tests/regression_tests/surface_source_write/case-01/inputs_true.dat +++ b/tests/regression_tests/surface_source_write/case-01/inputs_true.dat @@ -1,47 +1,47 @@ - - - - - - - + + + + + + + - - - + + + - + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + eigenvalue 100 5 1 - + -2.0 -2.0 -2.0 2.0 2.0 2.0 diff --git a/tests/regression_tests/surface_source_write/case-01/results_true.dat b/tests/regression_tests/surface_source_write/case-01/results_true.dat index 8979eb554..d4d1d1e5a 100644 --- a/tests/regression_tests/surface_source_write/case-01/results_true.dat +++ b/tests/regression_tests/surface_source_write/case-01/results_true.dat @@ -1,2 +1,2 @@ k-combined: -5.169123E-02 9.144814E-03 +5.642735E-02 1.494035E-02 diff --git a/tests/regression_tests/surface_source_write/case-01/surface_source_true.h5 b/tests/regression_tests/surface_source_write/case-01/surface_source_true.h5 index 82dca4d03..3a2315acc 100644 Binary files a/tests/regression_tests/surface_source_write/case-01/surface_source_true.h5 and b/tests/regression_tests/surface_source_write/case-01/surface_source_true.h5 differ diff --git a/tests/regression_tests/surface_source_write/case-02/inputs_true.dat b/tests/regression_tests/surface_source_write/case-02/inputs_true.dat index 12f15499f..527f076b9 100644 --- a/tests/regression_tests/surface_source_write/case-02/inputs_true.dat +++ b/tests/regression_tests/surface_source_write/case-02/inputs_true.dat @@ -1,47 +1,47 @@ - - - - - - - + + + + + + + - - - + + + - + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + eigenvalue 100 5 1 - + -2.0 -2.0 -2.0 2.0 2.0 2.0 diff --git a/tests/regression_tests/surface_source_write/case-02/results_true.dat b/tests/regression_tests/surface_source_write/case-02/results_true.dat index 8979eb554..d4d1d1e5a 100644 --- a/tests/regression_tests/surface_source_write/case-02/results_true.dat +++ b/tests/regression_tests/surface_source_write/case-02/results_true.dat @@ -1,2 +1,2 @@ k-combined: -5.169123E-02 9.144814E-03 +5.642735E-02 1.494035E-02 diff --git a/tests/regression_tests/surface_source_write/case-02/surface_source_true.h5 b/tests/regression_tests/surface_source_write/case-02/surface_source_true.h5 index 872efa070..2c2d5bc00 100644 Binary files a/tests/regression_tests/surface_source_write/case-02/surface_source_true.h5 and b/tests/regression_tests/surface_source_write/case-02/surface_source_true.h5 differ diff --git a/tests/regression_tests/surface_source_write/case-03/inputs_true.dat b/tests/regression_tests/surface_source_write/case-03/inputs_true.dat index cd0f7deda..58c4e0a24 100644 --- a/tests/regression_tests/surface_source_write/case-03/inputs_true.dat +++ b/tests/regression_tests/surface_source_write/case-03/inputs_true.dat @@ -1,47 +1,47 @@ - - - - - - - + + + + + + + - - - + + + - + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + eigenvalue 100 5 1 - + -2.0 -2.0 -2.0 2.0 2.0 2.0 diff --git a/tests/regression_tests/surface_source_write/case-03/results_true.dat b/tests/regression_tests/surface_source_write/case-03/results_true.dat index 8979eb554..d4d1d1e5a 100644 --- a/tests/regression_tests/surface_source_write/case-03/results_true.dat +++ b/tests/regression_tests/surface_source_write/case-03/results_true.dat @@ -1,2 +1,2 @@ k-combined: -5.169123E-02 9.144814E-03 +5.642735E-02 1.494035E-02 diff --git a/tests/regression_tests/surface_source_write/case-03/surface_source_true.h5 b/tests/regression_tests/surface_source_write/case-03/surface_source_true.h5 index 04a6ac9a3..d14771f5a 100644 Binary files a/tests/regression_tests/surface_source_write/case-03/surface_source_true.h5 and b/tests/regression_tests/surface_source_write/case-03/surface_source_true.h5 differ diff --git a/tests/regression_tests/surface_source_write/case-04/inputs_true.dat b/tests/regression_tests/surface_source_write/case-04/inputs_true.dat index ac3c03e37..46701aea7 100644 --- a/tests/regression_tests/surface_source_write/case-04/inputs_true.dat +++ b/tests/regression_tests/surface_source_write/case-04/inputs_true.dat @@ -1,47 +1,47 @@ - - - - - - - + + + + + + + - - - + + + - + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + eigenvalue 100 5 1 - + -2.0 -2.0 -2.0 2.0 2.0 2.0 diff --git a/tests/regression_tests/surface_source_write/case-04/results_true.dat b/tests/regression_tests/surface_source_write/case-04/results_true.dat index 8979eb554..d4d1d1e5a 100644 --- a/tests/regression_tests/surface_source_write/case-04/results_true.dat +++ b/tests/regression_tests/surface_source_write/case-04/results_true.dat @@ -1,2 +1,2 @@ k-combined: -5.169123E-02 9.144814E-03 +5.642735E-02 1.494035E-02 diff --git a/tests/regression_tests/surface_source_write/case-04/surface_source_true.h5 b/tests/regression_tests/surface_source_write/case-04/surface_source_true.h5 index 75c309eb4..d2acc6991 100644 Binary files a/tests/regression_tests/surface_source_write/case-04/surface_source_true.h5 and b/tests/regression_tests/surface_source_write/case-04/surface_source_true.h5 differ diff --git a/tests/regression_tests/surface_source_write/case-05/inputs_true.dat b/tests/regression_tests/surface_source_write/case-05/inputs_true.dat index 143e85200..c420d797c 100644 --- a/tests/regression_tests/surface_source_write/case-05/inputs_true.dat +++ b/tests/regression_tests/surface_source_write/case-05/inputs_true.dat @@ -1,47 +1,47 @@ - - - - - - - + + + + + + + - - - + + + - + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + eigenvalue 100 5 1 - + -2.0 -2.0 -2.0 2.0 2.0 2.0 diff --git a/tests/regression_tests/surface_source_write/case-05/results_true.dat b/tests/regression_tests/surface_source_write/case-05/results_true.dat index 8979eb554..d4d1d1e5a 100644 --- a/tests/regression_tests/surface_source_write/case-05/results_true.dat +++ b/tests/regression_tests/surface_source_write/case-05/results_true.dat @@ -1,2 +1,2 @@ k-combined: -5.169123E-02 9.144814E-03 +5.642735E-02 1.494035E-02 diff --git a/tests/regression_tests/surface_source_write/case-05/surface_source_true.h5 b/tests/regression_tests/surface_source_write/case-05/surface_source_true.h5 index 1a2f54d76..553090b19 100644 Binary files a/tests/regression_tests/surface_source_write/case-05/surface_source_true.h5 and b/tests/regression_tests/surface_source_write/case-05/surface_source_true.h5 differ diff --git a/tests/regression_tests/surface_source_write/case-06/inputs_true.dat b/tests/regression_tests/surface_source_write/case-06/inputs_true.dat index f2dc7ea35..e02d5e90c 100644 --- a/tests/regression_tests/surface_source_write/case-06/inputs_true.dat +++ b/tests/regression_tests/surface_source_write/case-06/inputs_true.dat @@ -1,47 +1,47 @@ - - - - - - - + + + + + + + - - - + + + - + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + eigenvalue 100 5 1 - + -2.0 -2.0 -2.0 2.0 2.0 2.0 diff --git a/tests/regression_tests/surface_source_write/case-06/results_true.dat b/tests/regression_tests/surface_source_write/case-06/results_true.dat index 8979eb554..d4d1d1e5a 100644 --- a/tests/regression_tests/surface_source_write/case-06/results_true.dat +++ b/tests/regression_tests/surface_source_write/case-06/results_true.dat @@ -1,2 +1,2 @@ k-combined: -5.169123E-02 9.144814E-03 +5.642735E-02 1.494035E-02 diff --git a/tests/regression_tests/surface_source_write/case-06/surface_source_true.h5 b/tests/regression_tests/surface_source_write/case-06/surface_source_true.h5 index bef135e5a..60a9f4f82 100644 Binary files a/tests/regression_tests/surface_source_write/case-06/surface_source_true.h5 and b/tests/regression_tests/surface_source_write/case-06/surface_source_true.h5 differ diff --git a/tests/regression_tests/surface_source_write/case-07/inputs_true.dat b/tests/regression_tests/surface_source_write/case-07/inputs_true.dat index a6107d16f..a4588c8d0 100644 --- a/tests/regression_tests/surface_source_write/case-07/inputs_true.dat +++ b/tests/regression_tests/surface_source_write/case-07/inputs_true.dat @@ -1,47 +1,47 @@ - - - - - - - + + + + + + + - - - + + + - + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + eigenvalue 100 5 1 - + -2.0 -2.0 -2.0 2.0 2.0 2.0 diff --git a/tests/regression_tests/surface_source_write/case-07/results_true.dat b/tests/regression_tests/surface_source_write/case-07/results_true.dat index 8979eb554..d4d1d1e5a 100644 --- a/tests/regression_tests/surface_source_write/case-07/results_true.dat +++ b/tests/regression_tests/surface_source_write/case-07/results_true.dat @@ -1,2 +1,2 @@ k-combined: -5.169123E-02 9.144814E-03 +5.642735E-02 1.494035E-02 diff --git a/tests/regression_tests/surface_source_write/case-07/surface_source_true.h5 b/tests/regression_tests/surface_source_write/case-07/surface_source_true.h5 index f84a5c4c5..cb3079251 100644 Binary files a/tests/regression_tests/surface_source_write/case-07/surface_source_true.h5 and b/tests/regression_tests/surface_source_write/case-07/surface_source_true.h5 differ diff --git a/tests/regression_tests/surface_source_write/case-08/inputs_true.dat b/tests/regression_tests/surface_source_write/case-08/inputs_true.dat index b87e2b207..ecf3a6a2e 100644 --- a/tests/regression_tests/surface_source_write/case-08/inputs_true.dat +++ b/tests/regression_tests/surface_source_write/case-08/inputs_true.dat @@ -1,47 +1,47 @@ - - - - - - - + + + + + + + - - - + + + - + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + eigenvalue 100 5 1 - + -2.0 -2.0 -2.0 2.0 2.0 2.0 diff --git a/tests/regression_tests/surface_source_write/case-08/results_true.dat b/tests/regression_tests/surface_source_write/case-08/results_true.dat index 8979eb554..d4d1d1e5a 100644 --- a/tests/regression_tests/surface_source_write/case-08/results_true.dat +++ b/tests/regression_tests/surface_source_write/case-08/results_true.dat @@ -1,2 +1,2 @@ k-combined: -5.169123E-02 9.144814E-03 +5.642735E-02 1.494035E-02 diff --git a/tests/regression_tests/surface_source_write/case-08/surface_source_true.h5 b/tests/regression_tests/surface_source_write/case-08/surface_source_true.h5 index 1fd302a7c..ed3aba907 100644 Binary files a/tests/regression_tests/surface_source_write/case-08/surface_source_true.h5 and b/tests/regression_tests/surface_source_write/case-08/surface_source_true.h5 differ diff --git a/tests/regression_tests/surface_source_write/case-09/inputs_true.dat b/tests/regression_tests/surface_source_write/case-09/inputs_true.dat index f4f6ebd87..5d60f9dbe 100644 --- a/tests/regression_tests/surface_source_write/case-09/inputs_true.dat +++ b/tests/regression_tests/surface_source_write/case-09/inputs_true.dat @@ -1,47 +1,47 @@ - - - - - - - + + + + + + + - - - + + + - + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + eigenvalue 100 5 1 - + -2.0 -2.0 -2.0 2.0 2.0 2.0 diff --git a/tests/regression_tests/surface_source_write/case-09/results_true.dat b/tests/regression_tests/surface_source_write/case-09/results_true.dat index 8979eb554..d4d1d1e5a 100644 --- a/tests/regression_tests/surface_source_write/case-09/results_true.dat +++ b/tests/regression_tests/surface_source_write/case-09/results_true.dat @@ -1,2 +1,2 @@ k-combined: -5.169123E-02 9.144814E-03 +5.642735E-02 1.494035E-02 diff --git a/tests/regression_tests/surface_source_write/case-09/surface_source_true.h5 b/tests/regression_tests/surface_source_write/case-09/surface_source_true.h5 index af832f060..d62363f97 100644 Binary files a/tests/regression_tests/surface_source_write/case-09/surface_source_true.h5 and b/tests/regression_tests/surface_source_write/case-09/surface_source_true.h5 differ diff --git a/tests/regression_tests/surface_source_write/case-10/inputs_true.dat b/tests/regression_tests/surface_source_write/case-10/inputs_true.dat index 372e5c011..1940826c2 100644 --- a/tests/regression_tests/surface_source_write/case-10/inputs_true.dat +++ b/tests/regression_tests/surface_source_write/case-10/inputs_true.dat @@ -1,47 +1,47 @@ - - - - - - - + + + + + + + - - - + + + - + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + eigenvalue 100 5 1 - + -2.0 -2.0 -2.0 2.0 2.0 2.0 diff --git a/tests/regression_tests/surface_source_write/case-10/results_true.dat b/tests/regression_tests/surface_source_write/case-10/results_true.dat index 8979eb554..d4d1d1e5a 100644 --- a/tests/regression_tests/surface_source_write/case-10/results_true.dat +++ b/tests/regression_tests/surface_source_write/case-10/results_true.dat @@ -1,2 +1,2 @@ k-combined: -5.169123E-02 9.144814E-03 +5.642735E-02 1.494035E-02 diff --git a/tests/regression_tests/surface_source_write/case-10/surface_source_true.h5 b/tests/regression_tests/surface_source_write/case-10/surface_source_true.h5 index 1512d8692..acaf39cb4 100644 Binary files a/tests/regression_tests/surface_source_write/case-10/surface_source_true.h5 and b/tests/regression_tests/surface_source_write/case-10/surface_source_true.h5 differ diff --git a/tests/regression_tests/surface_source_write/case-11/inputs_true.dat b/tests/regression_tests/surface_source_write/case-11/inputs_true.dat index d5401dc87..a4feff1b1 100644 --- a/tests/regression_tests/surface_source_write/case-11/inputs_true.dat +++ b/tests/regression_tests/surface_source_write/case-11/inputs_true.dat @@ -1,47 +1,47 @@ - - - - - - - + + + + + + + - - - + + + - + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + eigenvalue 100 5 1 - + -2.0 -2.0 -2.0 2.0 2.0 2.0 diff --git a/tests/regression_tests/surface_source_write/case-11/results_true.dat b/tests/regression_tests/surface_source_write/case-11/results_true.dat index 8979eb554..d4d1d1e5a 100644 --- a/tests/regression_tests/surface_source_write/case-11/results_true.dat +++ b/tests/regression_tests/surface_source_write/case-11/results_true.dat @@ -1,2 +1,2 @@ k-combined: -5.169123E-02 9.144814E-03 +5.642735E-02 1.494035E-02 diff --git a/tests/regression_tests/surface_source_write/case-11/surface_source_true.h5 b/tests/regression_tests/surface_source_write/case-11/surface_source_true.h5 index 0edb06c88..962f95fdd 100644 Binary files a/tests/regression_tests/surface_source_write/case-11/surface_source_true.h5 and b/tests/regression_tests/surface_source_write/case-11/surface_source_true.h5 differ diff --git a/tests/regression_tests/surface_source_write/case-12/inputs_true.dat b/tests/regression_tests/surface_source_write/case-12/inputs_true.dat index cb8f87741..c069f425c 100644 --- a/tests/regression_tests/surface_source_write/case-12/inputs_true.dat +++ b/tests/regression_tests/surface_source_write/case-12/inputs_true.dat @@ -1,40 +1,40 @@ - - - - - - - + + + + + + + - - - + + + - - - - - - - - - - + + + + + + + + + + eigenvalue 100 5 1 - + -2.0 -2.0 -2.0 2.0 2.0 2.0 diff --git a/tests/regression_tests/surface_source_write/case-12/results_true.dat b/tests/regression_tests/surface_source_write/case-12/results_true.dat index d793a7e42..ad927bdf3 100644 --- a/tests/regression_tests/surface_source_write/case-12/results_true.dat +++ b/tests/regression_tests/surface_source_write/case-12/results_true.dat @@ -1,2 +1,2 @@ k-combined: -4.752377E-02 6.773395E-03 +4.929000E-02 8.212396E-03 diff --git a/tests/regression_tests/surface_source_write/case-12/surface_source_true.h5 b/tests/regression_tests/surface_source_write/case-12/surface_source_true.h5 index ea81a8250..4b830d057 100644 Binary files a/tests/regression_tests/surface_source_write/case-12/surface_source_true.h5 and b/tests/regression_tests/surface_source_write/case-12/surface_source_true.h5 differ diff --git a/tests/regression_tests/surface_source_write/case-13/inputs_true.dat b/tests/regression_tests/surface_source_write/case-13/inputs_true.dat index 23bbf0455..2a93fdb4d 100644 --- a/tests/regression_tests/surface_source_write/case-13/inputs_true.dat +++ b/tests/regression_tests/surface_source_write/case-13/inputs_true.dat @@ -1,40 +1,40 @@ - - - - - - - + + + + + + + - - - + + + - - - - - - - - - - + + + + + + + + + + eigenvalue 100 5 1 - + -2.0 -2.0 -2.0 2.0 2.0 2.0 diff --git a/tests/regression_tests/surface_source_write/case-13/results_true.dat b/tests/regression_tests/surface_source_write/case-13/results_true.dat index d793a7e42..ad927bdf3 100644 --- a/tests/regression_tests/surface_source_write/case-13/results_true.dat +++ b/tests/regression_tests/surface_source_write/case-13/results_true.dat @@ -1,2 +1,2 @@ k-combined: -4.752377E-02 6.773395E-03 +4.929000E-02 8.212396E-03 diff --git a/tests/regression_tests/surface_source_write/case-13/surface_source_true.h5 b/tests/regression_tests/surface_source_write/case-13/surface_source_true.h5 index 08bd80985..f53e2c3a2 100644 Binary files a/tests/regression_tests/surface_source_write/case-13/surface_source_true.h5 and b/tests/regression_tests/surface_source_write/case-13/surface_source_true.h5 differ diff --git a/tests/regression_tests/surface_source_write/case-14/inputs_true.dat b/tests/regression_tests/surface_source_write/case-14/inputs_true.dat index 29acd94f2..893f8ddc1 100644 --- a/tests/regression_tests/surface_source_write/case-14/inputs_true.dat +++ b/tests/regression_tests/surface_source_write/case-14/inputs_true.dat @@ -1,40 +1,40 @@ - - - - - - - + + + + + + + - - - + + + - - - - - - - - - - + + + + + + + + + + eigenvalue 100 5 1 - + -2.0 -2.0 -2.0 2.0 2.0 2.0 diff --git a/tests/regression_tests/surface_source_write/case-14/results_true.dat b/tests/regression_tests/surface_source_write/case-14/results_true.dat index d793a7e42..ad927bdf3 100644 --- a/tests/regression_tests/surface_source_write/case-14/results_true.dat +++ b/tests/regression_tests/surface_source_write/case-14/results_true.dat @@ -1,2 +1,2 @@ k-combined: -4.752377E-02 6.773395E-03 +4.929000E-02 8.212396E-03 diff --git a/tests/regression_tests/surface_source_write/case-14/surface_source_true.h5 b/tests/regression_tests/surface_source_write/case-14/surface_source_true.h5 index 50cddcc70..ec049fec4 100644 Binary files a/tests/regression_tests/surface_source_write/case-14/surface_source_true.h5 and b/tests/regression_tests/surface_source_write/case-14/surface_source_true.h5 differ diff --git a/tests/regression_tests/surface_source_write/case-15/inputs_true.dat b/tests/regression_tests/surface_source_write/case-15/inputs_true.dat index c775f2f52..875a2fb0b 100644 --- a/tests/regression_tests/surface_source_write/case-15/inputs_true.dat +++ b/tests/regression_tests/surface_source_write/case-15/inputs_true.dat @@ -1,40 +1,40 @@ - - - - - - - + + + + + + + - - - + + + - - - - - - - - - - + + + + + + + + + + eigenvalue 100 5 1 - + -2.0 -2.0 -2.0 2.0 2.0 2.0 diff --git a/tests/regression_tests/surface_source_write/case-15/results_true.dat b/tests/regression_tests/surface_source_write/case-15/results_true.dat index d793a7e42..ad927bdf3 100644 --- a/tests/regression_tests/surface_source_write/case-15/results_true.dat +++ b/tests/regression_tests/surface_source_write/case-15/results_true.dat @@ -1,2 +1,2 @@ k-combined: -4.752377E-02 6.773395E-03 +4.929000E-02 8.212396E-03 diff --git a/tests/regression_tests/surface_source_write/case-15/surface_source_true.h5 b/tests/regression_tests/surface_source_write/case-15/surface_source_true.h5 index 3e15017a1..fd5892096 100644 Binary files a/tests/regression_tests/surface_source_write/case-15/surface_source_true.h5 and b/tests/regression_tests/surface_source_write/case-15/surface_source_true.h5 differ diff --git a/tests/regression_tests/surface_source_write/case-16/inputs_true.dat b/tests/regression_tests/surface_source_write/case-16/inputs_true.dat index 969a8f31e..347855e90 100644 --- a/tests/regression_tests/surface_source_write/case-16/inputs_true.dat +++ b/tests/regression_tests/surface_source_write/case-16/inputs_true.dat @@ -1,40 +1,40 @@ - - - - - - - + + + + + + + - - - + + + - - - - - - - - - - + + + + + + + + + + eigenvalue 100 5 1 - + -2.0 -2.0 -2.0 2.0 2.0 2.0 diff --git a/tests/regression_tests/surface_source_write/case-16/results_true.dat b/tests/regression_tests/surface_source_write/case-16/results_true.dat index a97be70ca..cd0619c1f 100644 --- a/tests/regression_tests/surface_source_write/case-16/results_true.dat +++ b/tests/regression_tests/surface_source_write/case-16/results_true.dat @@ -1,2 +1,2 @@ k-combined: -1.496403E+00 3.891283E-02 +1.403371E+00 1.456192E-02 diff --git a/tests/regression_tests/surface_source_write/case-16/surface_source_true.h5 b/tests/regression_tests/surface_source_write/case-16/surface_source_true.h5 index 49f67e820..147ce0358 100644 Binary files a/tests/regression_tests/surface_source_write/case-16/surface_source_true.h5 and b/tests/regression_tests/surface_source_write/case-16/surface_source_true.h5 differ diff --git a/tests/regression_tests/surface_source_write/case-17/inputs_true.dat b/tests/regression_tests/surface_source_write/case-17/inputs_true.dat index 0a65db510..95d0a6712 100644 --- a/tests/regression_tests/surface_source_write/case-17/inputs_true.dat +++ b/tests/regression_tests/surface_source_write/case-17/inputs_true.dat @@ -1,40 +1,40 @@ - - - - - - - + + + + + + + - - - + + + - - - - - - - - - - + + + + + + + + + + eigenvalue 100 5 1 - + -2.0 -2.0 -2.0 2.0 2.0 2.0 diff --git a/tests/regression_tests/surface_source_write/case-17/results_true.dat b/tests/regression_tests/surface_source_write/case-17/results_true.dat index a97be70ca..cd0619c1f 100644 --- a/tests/regression_tests/surface_source_write/case-17/results_true.dat +++ b/tests/regression_tests/surface_source_write/case-17/results_true.dat @@ -1,2 +1,2 @@ k-combined: -1.496403E+00 3.891283E-02 +1.403371E+00 1.456192E-02 diff --git a/tests/regression_tests/surface_source_write/case-17/surface_source_true.h5 b/tests/regression_tests/surface_source_write/case-17/surface_source_true.h5 index 35878eeca..436063aee 100644 Binary files a/tests/regression_tests/surface_source_write/case-17/surface_source_true.h5 and b/tests/regression_tests/surface_source_write/case-17/surface_source_true.h5 differ diff --git a/tests/regression_tests/surface_source_write/case-18/inputs_true.dat b/tests/regression_tests/surface_source_write/case-18/inputs_true.dat index 89df27b47..807c72ae6 100644 --- a/tests/regression_tests/surface_source_write/case-18/inputs_true.dat +++ b/tests/regression_tests/surface_source_write/case-18/inputs_true.dat @@ -1,40 +1,40 @@ - - - - - - - + + + + + + + - - - + + + - - - - - - - - - - + + + + + + + + + + eigenvalue 100 5 1 - + -2.0 -2.0 -2.0 2.0 2.0 2.0 diff --git a/tests/regression_tests/surface_source_write/case-18/results_true.dat b/tests/regression_tests/surface_source_write/case-18/results_true.dat index a97be70ca..cd0619c1f 100644 --- a/tests/regression_tests/surface_source_write/case-18/results_true.dat +++ b/tests/regression_tests/surface_source_write/case-18/results_true.dat @@ -1,2 +1,2 @@ k-combined: -1.496403E+00 3.891283E-02 +1.403371E+00 1.456192E-02 diff --git a/tests/regression_tests/surface_source_write/case-18/surface_source_true.h5 b/tests/regression_tests/surface_source_write/case-18/surface_source_true.h5 index 36da9e7a7..436063aee 100644 Binary files a/tests/regression_tests/surface_source_write/case-18/surface_source_true.h5 and b/tests/regression_tests/surface_source_write/case-18/surface_source_true.h5 differ diff --git a/tests/regression_tests/surface_source_write/case-19/inputs_true.dat b/tests/regression_tests/surface_source_write/case-19/inputs_true.dat index 3ea7dbffe..42aa78a09 100644 --- a/tests/regression_tests/surface_source_write/case-19/inputs_true.dat +++ b/tests/regression_tests/surface_source_write/case-19/inputs_true.dat @@ -1,40 +1,40 @@ - - - - - - - + + + + + + + - - - + + + - - - - - - - - - - + + + + + + + + + + eigenvalue 100 5 1 - + -2.0 -2.0 -2.0 2.0 2.0 2.0 diff --git a/tests/regression_tests/surface_source_write/case-19/results_true.dat b/tests/regression_tests/surface_source_write/case-19/results_true.dat index a97be70ca..cd0619c1f 100644 --- a/tests/regression_tests/surface_source_write/case-19/results_true.dat +++ b/tests/regression_tests/surface_source_write/case-19/results_true.dat @@ -1,2 +1,2 @@ k-combined: -1.496403E+00 3.891283E-02 +1.403371E+00 1.456192E-02 diff --git a/tests/regression_tests/surface_source_write/case-19/surface_source_true.h5 b/tests/regression_tests/surface_source_write/case-19/surface_source_true.h5 index f4261451d..eda3e030b 100644 Binary files a/tests/regression_tests/surface_source_write/case-19/surface_source_true.h5 and b/tests/regression_tests/surface_source_write/case-19/surface_source_true.h5 differ diff --git a/tests/regression_tests/surface_source_write/case-20/inputs_true.dat b/tests/regression_tests/surface_source_write/case-20/inputs_true.dat index c3c768a3d..4c7a3f11d 100644 --- a/tests/regression_tests/surface_source_write/case-20/inputs_true.dat +++ b/tests/regression_tests/surface_source_write/case-20/inputs_true.dat @@ -1,40 +1,40 @@ - - - - - - - + + + + + + + - - - + + + - - - - - - - - - - + + + + + + + + + + eigenvalue 100 5 1 - + -2.0 -2.0 -2.0 2.0 2.0 2.0 diff --git a/tests/regression_tests/surface_source_write/case-20/results_true.dat b/tests/regression_tests/surface_source_write/case-20/results_true.dat index 7ccce7cc3..44293cf09 100644 --- a/tests/regression_tests/surface_source_write/case-20/results_true.dat +++ b/tests/regression_tests/surface_source_write/case-20/results_true.dat @@ -1,2 +1,2 @@ k-combined: -1.149925E+00 2.542255E-01 +1.266853E+00 4.552028E-02 diff --git a/tests/regression_tests/surface_source_write/case-20/surface_source_true.h5 b/tests/regression_tests/surface_source_write/case-20/surface_source_true.h5 index fa8a4e628..083ce90c8 100644 Binary files a/tests/regression_tests/surface_source_write/case-20/surface_source_true.h5 and b/tests/regression_tests/surface_source_write/case-20/surface_source_true.h5 differ diff --git a/tests/regression_tests/surface_source_write/case-21/inputs_true.dat b/tests/regression_tests/surface_source_write/case-21/inputs_true.dat index 5dae8374d..71f9aae6a 100644 --- a/tests/regression_tests/surface_source_write/case-21/inputs_true.dat +++ b/tests/regression_tests/surface_source_write/case-21/inputs_true.dat @@ -1,40 +1,40 @@ - - - - - - - + + + + + + + - - - + + + - - - - - - - - - - + + + + + + + + + + eigenvalue 100 5 1 - + -2.0 -2.0 -2.0 2.0 2.0 2.0 diff --git a/tests/regression_tests/surface_source_write/case-21/results_true.dat b/tests/regression_tests/surface_source_write/case-21/results_true.dat index 7ccce7cc3..44293cf09 100644 --- a/tests/regression_tests/surface_source_write/case-21/results_true.dat +++ b/tests/regression_tests/surface_source_write/case-21/results_true.dat @@ -1,2 +1,2 @@ k-combined: -1.149925E+00 2.542255E-01 +1.266853E+00 4.552028E-02 diff --git a/tests/regression_tests/surface_source_write/case-21/surface_source_true.h5 b/tests/regression_tests/surface_source_write/case-21/surface_source_true.h5 index ed87ce849..f7e886db4 100644 Binary files a/tests/regression_tests/surface_source_write/case-21/surface_source_true.h5 and b/tests/regression_tests/surface_source_write/case-21/surface_source_true.h5 differ diff --git a/tests/regression_tests/surface_source_write/case-a01/inputs_true.dat b/tests/regression_tests/surface_source_write/case-a01/inputs_true.dat index 5cec1b76f..e9840be87 100644 --- a/tests/regression_tests/surface_source_write/case-a01/inputs_true.dat +++ b/tests/regression_tests/surface_source_write/case-a01/inputs_true.dat @@ -1,47 +1,47 @@ - - - - - - - + + + + + + + - - - + + + - + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + eigenvalue 100 5 1 - + -2.0 -2.0 -2.0 2.0 2.0 2.0 diff --git a/tests/regression_tests/surface_source_write/case-a01/results_true.dat b/tests/regression_tests/surface_source_write/case-a01/results_true.dat index 8979eb554..d4d1d1e5a 100644 --- a/tests/regression_tests/surface_source_write/case-a01/results_true.dat +++ b/tests/regression_tests/surface_source_write/case-a01/results_true.dat @@ -1,2 +1,2 @@ k-combined: -5.169123E-02 9.144814E-03 +5.642735E-02 1.494035E-02 diff --git a/tests/regression_tests/surface_source_write/case-a01/surface_source_true.h5 b/tests/regression_tests/surface_source_write/case-a01/surface_source_true.h5 index 4a8623567..807211e3a 100644 Binary files a/tests/regression_tests/surface_source_write/case-a01/surface_source_true.h5 and b/tests/regression_tests/surface_source_write/case-a01/surface_source_true.h5 differ diff --git a/tests/regression_tests/surface_source_write/case-d01/inputs_true.dat b/tests/regression_tests/surface_source_write/case-d01/inputs_true.dat index b5452080c..04703acfe 100644 --- a/tests/regression_tests/surface_source_write/case-d01/inputs_true.dat +++ b/tests/regression_tests/surface_source_write/case-d01/inputs_true.dat @@ -1,26 +1,26 @@ - - - + + + - - - + + + - + eigenvalue 100 5 1 - + -4 -4 -20 4 4 20 diff --git a/tests/regression_tests/surface_source_write/case-d01/results_true.dat b/tests/regression_tests/surface_source_write/case-d01/results_true.dat index 7fb415cb1..26b9e30a3 100644 --- a/tests/regression_tests/surface_source_write/case-d01/results_true.dat +++ b/tests/regression_tests/surface_source_write/case-d01/results_true.dat @@ -1,2 +1,2 @@ k-combined: -9.263843E-01 3.193920E-02 +9.288719E-01 6.877101E-03 diff --git a/tests/regression_tests/surface_source_write/case-d01/surface_source_true.h5 b/tests/regression_tests/surface_source_write/case-d01/surface_source_true.h5 index 8f8cd604d..9a66315ff 100644 Binary files a/tests/regression_tests/surface_source_write/case-d01/surface_source_true.h5 and b/tests/regression_tests/surface_source_write/case-d01/surface_source_true.h5 differ diff --git a/tests/regression_tests/surface_source_write/case-d02/inputs_true.dat b/tests/regression_tests/surface_source_write/case-d02/inputs_true.dat index d6ca4143c..d8b4e6803 100644 --- a/tests/regression_tests/surface_source_write/case-d02/inputs_true.dat +++ b/tests/regression_tests/surface_source_write/case-d02/inputs_true.dat @@ -1,26 +1,26 @@ - - - + + + - - - + + + - + eigenvalue 100 5 1 - + -4 -4 -20 4 4 20 diff --git a/tests/regression_tests/surface_source_write/case-d02/results_true.dat b/tests/regression_tests/surface_source_write/case-d02/results_true.dat index 7fb415cb1..26b9e30a3 100644 --- a/tests/regression_tests/surface_source_write/case-d02/results_true.dat +++ b/tests/regression_tests/surface_source_write/case-d02/results_true.dat @@ -1,2 +1,2 @@ k-combined: -9.263843E-01 3.193920E-02 +9.288719E-01 6.877101E-03 diff --git a/tests/regression_tests/surface_source_write/case-d02/surface_source_true.h5 b/tests/regression_tests/surface_source_write/case-d02/surface_source_true.h5 index 3abc471e0..291062942 100644 Binary files a/tests/regression_tests/surface_source_write/case-d02/surface_source_true.h5 and b/tests/regression_tests/surface_source_write/case-d02/surface_source_true.h5 differ diff --git a/tests/regression_tests/surface_source_write/case-d03/inputs_true.dat b/tests/regression_tests/surface_source_write/case-d03/inputs_true.dat index ba326c978..d769184aa 100644 --- a/tests/regression_tests/surface_source_write/case-d03/inputs_true.dat +++ b/tests/regression_tests/surface_source_write/case-d03/inputs_true.dat @@ -1,26 +1,26 @@ - - - + + + - - - + + + - + eigenvalue 100 5 1 - + -4 -4 -20 4 4 20 diff --git a/tests/regression_tests/surface_source_write/case-d03/results_true.dat b/tests/regression_tests/surface_source_write/case-d03/results_true.dat index 7fb415cb1..26b9e30a3 100644 --- a/tests/regression_tests/surface_source_write/case-d03/results_true.dat +++ b/tests/regression_tests/surface_source_write/case-d03/results_true.dat @@ -1,2 +1,2 @@ k-combined: -9.263843E-01 3.193920E-02 +9.288719E-01 6.877101E-03 diff --git a/tests/regression_tests/surface_source_write/case-d03/surface_source_true.h5 b/tests/regression_tests/surface_source_write/case-d03/surface_source_true.h5 index 8435e8f17..0af7160d4 100644 Binary files a/tests/regression_tests/surface_source_write/case-d03/surface_source_true.h5 and b/tests/regression_tests/surface_source_write/case-d03/surface_source_true.h5 differ diff --git a/tests/regression_tests/surface_source_write/case-d04/inputs_true.dat b/tests/regression_tests/surface_source_write/case-d04/inputs_true.dat index c309dd155..abefc2692 100644 --- a/tests/regression_tests/surface_source_write/case-d04/inputs_true.dat +++ b/tests/regression_tests/surface_source_write/case-d04/inputs_true.dat @@ -1,26 +1,26 @@ - - - + + + - - - + + + - + eigenvalue 100 5 1 - + -4 -4 -20 4 4 20 diff --git a/tests/regression_tests/surface_source_write/case-d04/results_true.dat b/tests/regression_tests/surface_source_write/case-d04/results_true.dat index 7fb415cb1..26b9e30a3 100644 --- a/tests/regression_tests/surface_source_write/case-d04/results_true.dat +++ b/tests/regression_tests/surface_source_write/case-d04/results_true.dat @@ -1,2 +1,2 @@ k-combined: -9.263843E-01 3.193920E-02 +9.288719E-01 6.877101E-03 diff --git a/tests/regression_tests/surface_source_write/case-d04/surface_source_true.h5 b/tests/regression_tests/surface_source_write/case-d04/surface_source_true.h5 index 6c45d92e6..90ab00748 100644 Binary files a/tests/regression_tests/surface_source_write/case-d04/surface_source_true.h5 and b/tests/regression_tests/surface_source_write/case-d04/surface_source_true.h5 differ diff --git a/tests/regression_tests/surface_source_write/case-d05/inputs_true.dat b/tests/regression_tests/surface_source_write/case-d05/inputs_true.dat index c49703f83..8b46b2b4e 100644 --- a/tests/regression_tests/surface_source_write/case-d05/inputs_true.dat +++ b/tests/regression_tests/surface_source_write/case-d05/inputs_true.dat @@ -1,26 +1,26 @@ - - - + + + - - - + + + - + eigenvalue 100 5 1 - + -4 -4 -20 4 4 20 diff --git a/tests/regression_tests/surface_source_write/case-d05/results_true.dat b/tests/regression_tests/surface_source_write/case-d05/results_true.dat index 7fb415cb1..26b9e30a3 100644 --- a/tests/regression_tests/surface_source_write/case-d05/results_true.dat +++ b/tests/regression_tests/surface_source_write/case-d05/results_true.dat @@ -1,2 +1,2 @@ k-combined: -9.263843E-01 3.193920E-02 +9.288719E-01 6.877101E-03 diff --git a/tests/regression_tests/surface_source_write/case-d05/surface_source_true.h5 b/tests/regression_tests/surface_source_write/case-d05/surface_source_true.h5 index 24b04a862..2f5521679 100644 Binary files a/tests/regression_tests/surface_source_write/case-d05/surface_source_true.h5 and b/tests/regression_tests/surface_source_write/case-d05/surface_source_true.h5 differ diff --git a/tests/regression_tests/surface_source_write/case-d06/inputs_true.dat b/tests/regression_tests/surface_source_write/case-d06/inputs_true.dat index 48db2c30d..ca52cf455 100644 --- a/tests/regression_tests/surface_source_write/case-d06/inputs_true.dat +++ b/tests/regression_tests/surface_source_write/case-d06/inputs_true.dat @@ -1,26 +1,26 @@ - - - + + + - - - + + + - + eigenvalue 100 5 1 - + -4 -4 -20 4 4 20 diff --git a/tests/regression_tests/surface_source_write/case-d06/results_true.dat b/tests/regression_tests/surface_source_write/case-d06/results_true.dat index 7fb415cb1..26b9e30a3 100644 --- a/tests/regression_tests/surface_source_write/case-d06/results_true.dat +++ b/tests/regression_tests/surface_source_write/case-d06/results_true.dat @@ -1,2 +1,2 @@ k-combined: -9.263843E-01 3.193920E-02 +9.288719E-01 6.877101E-03 diff --git a/tests/regression_tests/surface_source_write/case-d06/surface_source_true.h5 b/tests/regression_tests/surface_source_write/case-d06/surface_source_true.h5 index 3eb95bef9..27227ad49 100644 Binary files a/tests/regression_tests/surface_source_write/case-d06/surface_source_true.h5 and b/tests/regression_tests/surface_source_write/case-d06/surface_source_true.h5 differ diff --git a/tests/regression_tests/surface_source_write/case-d07/inputs_true.dat b/tests/regression_tests/surface_source_write/case-d07/inputs_true.dat index e2897125b..40c439fe6 100644 --- a/tests/regression_tests/surface_source_write/case-d07/inputs_true.dat +++ b/tests/regression_tests/surface_source_write/case-d07/inputs_true.dat @@ -1,40 +1,40 @@ - - - + + + - - - + + + - + - - - - - - - - - - - - - + + + + + + + + + + + + + eigenvalue 100 5 1 - + -4 -4 -20 4 4 20 diff --git a/tests/regression_tests/surface_source_write/case-d07/results_true.dat b/tests/regression_tests/surface_source_write/case-d07/results_true.dat index 63ea1a64d..5a4ea6689 100644 --- a/tests/regression_tests/surface_source_write/case-d07/results_true.dat +++ b/tests/regression_tests/surface_source_write/case-d07/results_true.dat @@ -1,2 +1,2 @@ k-combined: -9.756086E-01 4.639209E-02 +9.947197E-01 3.711779E-02 diff --git a/tests/regression_tests/surface_source_write/case-d07/surface_source_true.h5 b/tests/regression_tests/surface_source_write/case-d07/surface_source_true.h5 index 0332f2dcf..fd9f0dc57 100644 Binary files a/tests/regression_tests/surface_source_write/case-d07/surface_source_true.h5 and b/tests/regression_tests/surface_source_write/case-d07/surface_source_true.h5 differ diff --git a/tests/regression_tests/surface_source_write/case-d08/inputs_true.dat b/tests/regression_tests/surface_source_write/case-d08/inputs_true.dat index 185b8629b..c81d21b97 100644 --- a/tests/regression_tests/surface_source_write/case-d08/inputs_true.dat +++ b/tests/regression_tests/surface_source_write/case-d08/inputs_true.dat @@ -1,40 +1,40 @@ - - - + + + - - - + + + - + - - - - - - - - - - - - - + + + + + + + + + + + + + eigenvalue 100 5 1 - + -4 -4 -20 4 4 20 diff --git a/tests/regression_tests/surface_source_write/case-d08/results_true.dat b/tests/regression_tests/surface_source_write/case-d08/results_true.dat index 63ea1a64d..5a4ea6689 100644 --- a/tests/regression_tests/surface_source_write/case-d08/results_true.dat +++ b/tests/regression_tests/surface_source_write/case-d08/results_true.dat @@ -1,2 +1,2 @@ k-combined: -9.756086E-01 4.639209E-02 +9.947197E-01 3.711779E-02 diff --git a/tests/regression_tests/surface_source_write/case-d08/surface_source_true.h5 b/tests/regression_tests/surface_source_write/case-d08/surface_source_true.h5 index 252559204..fd9f0dc57 100644 Binary files a/tests/regression_tests/surface_source_write/case-d08/surface_source_true.h5 and b/tests/regression_tests/surface_source_write/case-d08/surface_source_true.h5 differ diff --git a/tests/regression_tests/surface_source_write/case-e01/inputs_true.dat b/tests/regression_tests/surface_source_write/case-e01/inputs_true.dat index ac3c03e37..46701aea7 100644 --- a/tests/regression_tests/surface_source_write/case-e01/inputs_true.dat +++ b/tests/regression_tests/surface_source_write/case-e01/inputs_true.dat @@ -1,47 +1,47 @@ - - - - - - - + + + + + + + - - - + + + - + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + eigenvalue 100 5 1 - + -2.0 -2.0 -2.0 2.0 2.0 2.0 diff --git a/tests/regression_tests/surface_source_write/case-e01/results_true.dat b/tests/regression_tests/surface_source_write/case-e01/results_true.dat index 8979eb554..d4d1d1e5a 100644 --- a/tests/regression_tests/surface_source_write/case-e01/results_true.dat +++ b/tests/regression_tests/surface_source_write/case-e01/results_true.dat @@ -1,2 +1,2 @@ k-combined: -5.169123E-02 9.144814E-03 +5.642735E-02 1.494035E-02 diff --git a/tests/regression_tests/surface_source_write/case-e01/surface_source_true.h5 b/tests/regression_tests/surface_source_write/case-e01/surface_source_true.h5 index 3047519e8..bbfbd152b 100644 Binary files a/tests/regression_tests/surface_source_write/case-e01/surface_source_true.h5 and b/tests/regression_tests/surface_source_write/case-e01/surface_source_true.h5 differ diff --git a/tests/regression_tests/surface_source_write/case-e02/inputs_true.dat b/tests/regression_tests/surface_source_write/case-e02/inputs_true.dat index a6107d16f..a4588c8d0 100644 --- a/tests/regression_tests/surface_source_write/case-e02/inputs_true.dat +++ b/tests/regression_tests/surface_source_write/case-e02/inputs_true.dat @@ -1,47 +1,47 @@ - - - - - - - + + + + + + + - - - + + + - + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + eigenvalue 100 5 1 - + -2.0 -2.0 -2.0 2.0 2.0 2.0 diff --git a/tests/regression_tests/surface_source_write/case-e02/results_true.dat b/tests/regression_tests/surface_source_write/case-e02/results_true.dat index 8979eb554..d4d1d1e5a 100644 --- a/tests/regression_tests/surface_source_write/case-e02/results_true.dat +++ b/tests/regression_tests/surface_source_write/case-e02/results_true.dat @@ -1,2 +1,2 @@ k-combined: -5.169123E-02 9.144814E-03 +5.642735E-02 1.494035E-02 diff --git a/tests/regression_tests/surface_source_write/case-e02/surface_source_true.h5 b/tests/regression_tests/surface_source_write/case-e02/surface_source_true.h5 index 806152853..bbfbd152b 100644 Binary files a/tests/regression_tests/surface_source_write/case-e02/surface_source_true.h5 and b/tests/regression_tests/surface_source_write/case-e02/surface_source_true.h5 differ diff --git a/tests/regression_tests/surface_source_write/case-e03/inputs_true.dat b/tests/regression_tests/surface_source_write/case-e03/inputs_true.dat index 23bbf0455..2a93fdb4d 100644 --- a/tests/regression_tests/surface_source_write/case-e03/inputs_true.dat +++ b/tests/regression_tests/surface_source_write/case-e03/inputs_true.dat @@ -1,40 +1,40 @@ - - - - - - - + + + + + + + - - - + + + - - - - - - - - - - + + + + + + + + + + eigenvalue 100 5 1 - + -2.0 -2.0 -2.0 2.0 2.0 2.0 diff --git a/tests/regression_tests/surface_source_write/case-e03/results_true.dat b/tests/regression_tests/surface_source_write/case-e03/results_true.dat index d793a7e42..ad927bdf3 100644 --- a/tests/regression_tests/surface_source_write/case-e03/results_true.dat +++ b/tests/regression_tests/surface_source_write/case-e03/results_true.dat @@ -1,2 +1,2 @@ k-combined: -4.752377E-02 6.773395E-03 +4.929000E-02 8.212396E-03 diff --git a/tests/regression_tests/surface_source_write/case-e03/surface_source_true.h5 b/tests/regression_tests/surface_source_write/case-e03/surface_source_true.h5 index becc9254a..22e108745 100644 Binary files a/tests/regression_tests/surface_source_write/case-e03/surface_source_true.h5 and b/tests/regression_tests/surface_source_write/case-e03/surface_source_true.h5 differ diff --git a/tests/regression_tests/surface_tally/inputs_true.dat b/tests/regression_tests/surface_tally/inputs_true.dat index 192c2e89f..2b070c5a3 100644 --- a/tests/regression_tests/surface_tally/inputs_true.dat +++ b/tests/regression_tests/surface_tally/inputs_true.dat @@ -1,35 +1,35 @@ - - - - - + + + + + - - - - + + + + - - - - - - - - + + + + + + + + eigenvalue 1000 10 0 - + -0.62992 -0.62992 -1 0.62992 0.62992 1 diff --git a/tests/regression_tests/surface_tally/results_true.dat b/tests/regression_tests/surface_tally/results_true.dat index 8b27fa192..70d5cad2c 100644 --- a/tests/regression_tests/surface_tally/results_true.dat +++ b/tests/regression_tests/surface_tally/results_true.dat @@ -1,52 +1,52 @@ mean,std. dev. -2.1200000e-02,1.8366636e-03 -7.4900000e-02,2.2083176e-03 -1.6220000e-01,2.8079253e-03 -6.4010000e-01,8.6838931e-03 -2.1000000e-03,3.7859389e-04 -5.6000000e-03,6.8637534e-04 -1.1700000e-02,1.4456832e-03 -4.1700000e-02,2.7041121e-03 -2.1200000e-02,1.8366636e-03 -7.4900000e-02,2.2083176e-03 -1.6220000e-01,2.8079253e-03 -6.4010000e-01,8.6838931e-03 -2.1000000e-03,3.7859389e-04 -5.6000000e-03,6.8637534e-04 -1.1700000e-02,1.4456832e-03 -4.1700000e-02,2.7041121e-03 -5.2000000e-03,5.9254629e-04 -3.9200000e-02,2.5508169e-03 -4.0200000e-02,1.9310331e-03 -4.1360000e-01,8.0072190e-03 -0.0000000e+00,0.0000000e+00 -1.9000000e-03,3.7859389e-04 +2.4100000e-02,2.1052844e-03 +6.7900000e-02,2.3211587e-03 +1.6860000e-01,4.4800794e-03 +6.4710000e-01,9.1826527e-03 +2.2000000e-03,3.8873013e-04 +5.5000000e-03,1.0979779e-03 +1.2500000e-02,1.5438048e-03 +4.4700000e-02,1.9035055e-03 +2.4100000e-02,2.1052844e-03 +6.7900000e-02,2.3211587e-03 +1.6860000e-01,4.4800794e-03 +6.4710000e-01,9.1826527e-03 +2.2000000e-03,3.8873013e-04 +5.5000000e-03,1.0979779e-03 +1.2500000e-02,1.5438048e-03 +4.4700000e-02,1.9035055e-03 +7.3000000e-03,9.8938814e-04 +3.6600000e-02,2.5086517e-03 +4.1600000e-02,2.4864075e-03 +4.2380000e-01,9.6087923e-03 1.0000000e-04,1.0000000e-04 -1.6400000e-02,1.2840907e-03 --5.2000000e-03,5.9254629e-04 --3.9200000e-02,2.5508169e-03 --4.0200000e-02,1.9310331e-03 --4.1360000e-01,8.0072190e-03 -0.0000000e+00,0.0000000e+00 --1.9000000e-03,3.7859389e-04 +1.5000000e-03,4.5338235e-04 +3.0000000e-04,1.5275252e-04 +1.7300000e-02,1.4609738e-03 +-7.3000000e-03,9.8938814e-04 +-3.6600000e-02,2.5086517e-03 +-4.1600000e-02,2.4864075e-03 +-4.2380000e-01,9.6087923e-03 -1.0000000e-04,1.0000000e-04 --1.6400000e-02,1.2840907e-03 -1.6000000e-02,2.1602469e-03 -3.5700000e-02,2.9441090e-03 -1.2200000e-01,3.5932035e-03 -2.2650000e-01,9.2463206e-03 +-1.5000000e-03,4.5338235e-04 +-3.0000000e-04,1.5275252e-04 +-1.7300000e-02,1.4609738e-03 +1.6800000e-02,1.5902481e-03 +3.1300000e-02,3.8094911e-03 +1.2700000e-01,5.0990195e-03 +2.2330000e-01,9.3631073e-03 2.1000000e-03,3.7859389e-04 -3.7000000e-03,8.1717671e-04 -1.1600000e-02,1.4772347e-03 -2.5300000e-02,1.9723083e-03 +4.0000000e-03,1.0540926e-03 +1.2200000e-02,1.6110728e-03 +2.7400000e-02,1.6613248e-03 0.0000000e+00,0.0000000e+00 --2.9700000e-02,2.4587711e-03 +-3.2000000e-02,1.5634719e-03 0.0000000e+00,0.0000000e+00 --3.5090000e-01,3.7161808e-03 +-3.5400000e-01,7.5938572e-03 0.0000000e+00,0.0000000e+00 --2.1000000e-03,4.8189441e-04 +-3.0000000e-03,6.4978629e-04 0.0000000e+00,0.0000000e+00 --2.1400000e-02,1.7397318e-03 +-2.1800000e-02,1.4892205e-03 0.0000000e+00,0.0000000e+00 0.0000000e+00,0.0000000e+00 0.0000000e+00,0.0000000e+00 diff --git a/tests/regression_tests/survival_biasing/results_true.dat b/tests/regression_tests/survival_biasing/results_true.dat index 740272201..932414e98 100644 --- a/tests/regression_tests/survival_biasing/results_true.dat +++ b/tests/regression_tests/survival_biasing/results_true.dat @@ -1,20 +1,20 @@ k-combined: -9.879232E-01 8.097582E-03 +9.517646E-01 1.303111E-02 tally 1: -4.295331E+01 -3.691096E+02 -1.802724E+01 -6.501934E+01 -2.193500E+00 -9.627609E-01 -1.893529E+00 -7.174104E-01 -4.902380E+00 -4.808570E+00 -3.418014E-02 -2.337353E-04 -3.667128E+08 -2.690758E+16 +4.164635E+01 +3.470110E+02 +1.724300E+01 +5.949580E+01 +2.124917E+00 +9.034789E-01 +1.844790E+00 +6.809026E-01 +4.784396E+00 +4.579552E+00 +3.348849E-02 +2.243613E-04 +3.573090E+08 +2.554338E+16 tally 2: -1.802724E+01 -6.501934E+01 +1.724300E+01 +5.949580E+01 diff --git a/tests/regression_tests/tallies/inputs_true.dat b/tests/regression_tests/tallies/inputs_true.dat index 2ce36c5df..40829f865 100644 --- a/tests/regression_tests/tallies/inputs_true.dat +++ b/tests/regression_tests/tallies/inputs_true.dat @@ -1,40 +1,40 @@ - - - - - - - + + + + + + + - - - - - - + + + + + + - - - - - + + + + + - - - - - + + + + + - + @@ -47,7 +47,7 @@ - + @@ -62,7 +62,7 @@ - + @@ -77,7 +77,7 @@ - + @@ -92,7 +92,7 @@ - + @@ -107,7 +107,7 @@ - + @@ -122,7 +122,7 @@ - + @@ -135,7 +135,7 @@ - + @@ -149,8 +149,8 @@ - - + + @@ -174,9 +174,9 @@ - + - + 1.26 1.26 17 17 @@ -277,30 +277,30 @@ 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + eigenvalue 400 5 0 - + -160 -160 -183 160 160 183 @@ -342,7 +342,7 @@ 4 - + 4 diff --git a/tests/regression_tests/tallies/results_true.dat b/tests/regression_tests/tallies/results_true.dat index 3dda0f9b2..1d3aca4b0 100644 --- a/tests/regression_tests/tallies/results_true.dat +++ b/tests/regression_tests/tallies/results_true.dat @@ -1 +1 @@ -ddfbb0a6f5498eb8ff33bb10beb64e244b015861919eb4837bd82855e5fd87c3ff97dfa382d3d60afa81c48d9f857fba8e0b99263e7b35587f8adb75be1fc0ec \ No newline at end of file +d01c3accd5b4de2aa166a77df28cfe42f5738a44c2480752fcfae7564a507362fff006b6dffb7b1dfe248e14bacef0070cabacea5d75c5996653e5605f7c7384 \ No newline at end of file diff --git a/tests/regression_tests/tally_aggregation/inputs_true.dat b/tests/regression_tests/tally_aggregation/inputs_true.dat index 9f4f95655..7351b230c 100644 --- a/tests/regression_tests/tally_aggregation/inputs_true.dat +++ b/tests/regression_tests/tally_aggregation/inputs_true.dat @@ -1,24 +1,24 @@ - - - - - - + + + + + + - - - + + + - + 1.2 1.2 1 @@ -28,11 +28,11 @@ 1 1 1 1 - - - - - + + + + + eigenvalue diff --git a/tests/regression_tests/tally_aggregation/results_true.dat b/tests/regression_tests/tally_aggregation/results_true.dat index 172adbfe1..ee6263373 100644 --- a/tests/regression_tests/tally_aggregation/results_true.dat +++ b/tests/regression_tests/tally_aggregation/results_true.dat @@ -1,97 +1,97 @@ -[[1.6001087e-05 5.4190949e-04] - [3.2669968e-01 1.7730523e-01] - [1.8149266e-02 7.1525113e-01]], [[1.6239097e-05 5.7499676e-04] - [3.1268633e-01 1.7004165e-01] - [1.8873778e-02 7.0217885e-01]], [[1.6693071e-05 5.4106379e-04] - [3.3370208e-01 1.8051505e-01] - [1.9081306e-02 7.3647547e-01]], [[1.6725399e-05 5.1680146e-04] - [3.2854628e-01 1.7757185e-01] - [1.9529646e-02 7.1005198e-01]][[2.4751834e-07 4.3304565e-05] - [8.6840718e-03 4.3442535e-03] - [3.7054051e-04 6.5678133e-03]], [[4.0830852e-07 4.9612204e-05] - [1.2104241e-02 5.9708675e-03] - [7.1398189e-04 8.2408482e-03]], [[2.6546344e-07 2.5234256e-05] - [6.5083211e-03 3.2185071e-03] - [4.2935150e-04 5.1707774e-03]], [[2.7845203e-07 3.4453402e-05] - [3.3125427e-03 1.7749508e-03] - [6.0407731e-04 7.5353872e-03]][[1.0455251e-06 8.1938339e-04] - [1.1392765e+00 5.6434761e-01] - [1.4142831e-06 5.1213654e-01]], [[2.2009815e-06 1.0418935e-03] - [1.4422554e-01 1.0070647e-01] - [3.9488382e-05 7.9236390e-01]], [[1.4606612e-05 2.2374470e-04] - [1.2962842e-02 2.9268594e-02] - [3.1339824e-04 1.1056439e+00]], [[4.7805535e-05 8.9749934e-05] - [5.1694597e-03 1.1111105e-02] - [7.5279695e-02 4.5381305e-01]][[1.4955183e-08 1.1461548e-05] - [1.6454649e-02 8.1236707e-03] - [2.0028007e-08 6.8264819e-03]], [[1.6334486e-07 7.7617340e-05] - [2.1161584e-03 1.4078445e-03] - [1.4742097e-05 6.9350862e-03]], [[1.7444757e-07 1.9026095e-06] - [1.4084092e-04 2.0345990e-04] - [5.9546175e-06 8.6038812e-03]], [[5.6449127e-07 1.0110585e-06] - [5.9158873e-05 1.2485325e-04] - [1.0936497e-03 5.0836702e-03]][[0.2866239 0.2725595]], [[0.2729156 0.258831 ]], [[0.2920724 0.2755922]], [[0.287667 0.2703207]], [[0.035617 0.2232707]], [[0.0353082 0.2224423]], [[0.0370072 0.2288263]], [[0.0363348 0.219573 ]], [[0.0033013 0.2850034]], [[0.0032726 0.2771099]], [[0.0034234 0.2951295]], [[0.0032935 0.2778935]], [[0.0193227 0.1122647]], [[0.0200799 0.1144123]], [[0.0202971 0.1179836]], [[0.0207973 0.1203534]][[0.0086351 0.0061876]], [[0.0120688 0.0074831]], [[0.0064221 0.0035246]], [[0.0030483 0.0024267]], [[0.0009185 0.0033896]], [[0.0009223 0.0039584]], [[0.0010541 0.0038599]], [[0.0012934 0.0028331]], [[6.5126963e-05 2.8486593e-03]], [[7.1110242e-05 4.3424340e-03]], [[5.8911409e-05 2.4296178e-03]], [[8.4278765e-05 6.4182190e-03]], [[0.0003712 0.0020298]], [[0.0007152 0.0036115]], [[0.0004298 0.0019677]], [[0.0006046 0.0021965]][[2.0694650e-04] - [4.2868191e-01] - [1.3029457e-01]], [[1.9694048e-04] - [4.0809445e-01] - [1.2345525e-01]], [[2.1012645e-04] - [4.3670571e-01] - [1.3074883e-01]], [[2.0641548e-04] - [4.3014207e-01] - [1.2763930e-01]], [[0.0002584] - [0.0608867] - [0.1977426]], [[0.0003026] - [0.0602368] - [0.1972111]], [[0.0002509] - [0.0624699] - [0.2031126]], [[0.0002322] - [0.0613385] - [0.1943371]], [[5.9349736e-05] - [1.0506741e-02] - [2.7773865e-01]], [[5.7855564e-05] - [1.0389781e-02] - [2.6993483e-01]], [[6.1819700e-05] - [1.0910874e-02] - [2.8758020e-01]], [[5.9326317e-05] - [1.0424040e-02] - [2.7070367e-01]], [[3.3192167e-05] - [3.9295320e-03] - [1.2762462e-01]], [[3.3882691e-05] - [4.0069157e-03] - [1.3045143e-01]], [[3.4882103e-05] - [4.1306182e-03] - [1.3411514e-01]], [[3.5598508e-05] - [4.2134987e-03] - [1.3690156e-01]][[6.4505980e-06] - [9.6369034e-03] - [4.4700460e-03]], [[8.2880772e-06] - [1.3456171e-02] - [4.5368708e-03]], [[3.9384462e-06] - [7.1570638e-03] - [1.5629142e-03]], [[2.3565894e-06] - [3.4040401e-03] - [1.8956916e-03]], [[4.2806047e-05] - [1.1841015e-03] - [3.3058802e-03]], [[4.8905696e-05] - [1.0360139e-03] - [3.9298937e-03]], [[2.4911390e-05] - [1.2173305e-03] - [3.8114473e-03]], [[3.4347869e-05] - [1.5820360e-03] - [2.6824612e-03]], [[1.0809230e-06] - [1.0316180e-04] - [2.8475354e-03]], [[6.4150814e-07] - [1.1179425e-04] - [4.3415770e-03]], [[7.3848139e-07] - [9.3111666e-05] - [2.4285475e-03]], [[1.2349384e-06] - [1.7152843e-04] - [6.4164799e-03]], [[4.5871493e-07] - [5.4732075e-05] - [2.0627309e-03]], [[8.1649994e-07] - [9.7699188e-05] - [3.6803256e-03]], [[4.5174850e-07] - [5.3913784e-05] - [2.0133571e-03]], [[5.0962865e-07] - [6.0338032e-05] - [2.2773911e-03]] \ No newline at end of file +[[1.6242805e-05 6.2367673e-04] + [3.2895972e-01 1.7786452e-01] + [1.8044266e-02 7.0451122e-01]], [[1.6113947e-05 5.3572864e-04] + [3.1517504e-01 1.7132833e-01] + [1.8305682e-02 7.0072832e-01]], [[1.6472052e-05 5.5758006e-04] + [3.2362364e-01 1.7597163e-01] + [1.9107080e-02 7.2600440e-01]], [[1.6693277e-05 4.9204218e-04] + [3.2429262e-01 1.7600573e-01] + [1.9042489e-02 7.3053854e-01]][[2.9719061e-07 8.0925438e-05] + [8.9432259e-03 4.4057583e-03] + [5.2078407e-04 6.4387688e-03]], [[1.8572081e-07 2.5667235e-05] + [1.1641603e-02 5.7444311e-03] + [2.6983611e-04 6.9783224e-03]], [[2.4994113e-07 5.4993390e-05] + [6.0464041e-03 3.0764811e-03] + [2.6559118e-04 7.7279780e-03]], [[2.5965232e-07 3.9618775e-05] + [1.0409564e-02 5.1850104e-03] + [2.7831231e-04 7.4480576e-03]][[1.0329435e-06 8.0861229e-04] + [1.1265142e+00 5.5796079e-01] + [1.3965860e-06 5.0338828e-01]], [[2.2264172e-06 1.0828687e-03] + [1.4724979e-01 1.0226107e-01] + [2.2656045e-05 7.7618945e-01]], [[1.4789782e-05 2.2786630e-04] + [1.3149968e-02 2.9847169e-02] + [3.2638111e-04 1.1287326e+00]], [[4.7472938e-05 8.9680338e-05] + [5.1371041e-03 1.1101179e-02] + [7.4149084e-02 4.5347217e-01]][[1.7024771e-08 1.2878244e-05] + [1.8795566e-02 9.2705008e-03] + [2.2676749e-08 7.0878353e-03]], [[2.2018925e-07 1.0785388e-04] + [2.6715019e-03 1.6657928e-03] + [1.2479083e-05 8.6814018e-03]], [[2.0928485e-07 1.6600875e-06] + [1.1859535e-04 1.7969083e-04] + [1.5981387e-05 8.0489308e-03]], [[4.0016381e-07 7.6799157e-07] + [4.4157583e-05 9.4462925e-05] + [7.0115110e-04 3.8678806e-03]][[0.287433 0.2698042]], [[0.2751228 0.2598525]], [[0.280516 0.2648274]], [[0.2834448 0.2676736]], [[0.0370558 0.2148509]], [[0.0355217 0.2130189]], [[0.0385317 0.2292804]], [[0.0361655 0.2223832]], [[0.0033268 0.2855078]], [[0.0033498 0.2849403]], [[0.003359 0.2901157]], [[0.0034555 0.2982438]], [[0.0192046 0.1128364]], [[0.0195026 0.1147807]], [[0.0203405 0.1183102]], [[0.0202861 0.1187358]][[0.00889 0.0051934]], [[0.0115249 0.0072767]], [[0.0058841 0.0040289]], [[0.0103341 0.0063266]], [[0.0009734 0.0048865]], [[0.0016425 0.0038133]], [[0.0013902 0.0048875]], [[0.0012487 0.0039808]], [[1.8994140e-05 2.0410145e-03]], [[6.8277082e-05 3.4865782e-03]], [[6.1643568e-05 4.9220817e-03]], [[7.4147413e-05 4.9263295e-03]], [[0.0005213 0.0024208]], [[0.0002702 0.0014313]], [[0.0002665 0.0022006]], [[0.0002788 0.0014892]][[2.0601081e-04] + [4.2976789e-01] + [1.2726338e-01]], [[1.9802070e-04] + [4.1138025e-01] + [1.2339705e-01]], [[2.0174854e-04] + [4.1947542e-01] + [1.2566615e-01]], [[2.0386518e-04] + [4.2385140e-01] + [1.2706310e-01]], [[0.0003403] + [0.0624955] + [0.189071 ]], [[0.0002601] + [0.060449 ] + [0.1878314]], [[0.0002765] + [0.0652412] + [0.2022944]], [[0.0002082] + [0.0613252] + [0.1970153]], [[6.0336874e-05] + [1.0617692e-02] + [2.7815664e-01]], [[5.9823997e-05] + [1.0664059e-02] + [2.7756620e-01]], [[6.0873689e-05] + [1.0744209e-02] + [2.8266963e-01]], [[6.1621521e-05] + [1.0971177e-02] + [2.9066650e-01]], [[3.3297391e-05] + [3.9432037e-03] + [1.2806450e-01]], [[3.3863464e-05] + [4.0100180e-03] + [1.3023932e-01]], [[3.4930617e-05] + [4.1344613e-03] + [1.3448129e-01]], [[3.5061805e-05] + [4.1505999e-03] + [1.3483614e-01]][[5.8259835e-06] + [9.9096571e-03] + [2.7933778e-03]], [[8.0858909e-06] + [1.2843377e-02] + [4.5631248e-03]], [[4.3418585e-06] + [6.5638646e-03] + [2.7874612e-03]], [[6.9046376e-06] + [1.1531588e-02] + [3.7205377e-03]], [[8.0710599e-05] + [1.0889301e-03] + [4.8613465e-03]], [[2.4337121e-05] + [1.8861117e-03] + [3.6987509e-03]], [[5.4812439e-05] + [1.7085353e-03] + [4.7852139e-03]], [[3.9007791e-05] + [1.4998363e-03] + [3.8929646e-03]], [[7.5757577e-07] + [2.5845755e-05] + [2.0409391e-03]], [[1.0302346e-06] + [1.1907557e-04] + [3.4852130e-03]], [[9.1936614e-07] + [1.2974020e-04] + [4.9207575e-03]], [[5.6493555e-07] + [1.2113685e-04] + [4.9253980e-03]], [[5.4602210e-07] + [6.5233025e-05] + [2.4754550e-03]], [[3.2091909e-07] + [3.8472906e-05] + [1.4560974e-03]], [[4.8475651e-07] + [5.9108262e-05] + [2.2158781e-03]], [[3.3737822e-07] + [4.0544269e-05] + [1.5145628e-03]] \ No newline at end of file diff --git a/tests/regression_tests/tally_arithmetic/inputs_true.dat b/tests/regression_tests/tally_arithmetic/inputs_true.dat index 7669b4d03..2b5234c34 100644 --- a/tests/regression_tests/tally_arithmetic/inputs_true.dat +++ b/tests/regression_tests/tally_arithmetic/inputs_true.dat @@ -1,24 +1,24 @@ - - - - - + + + + + - - - + + + - - + + eigenvalue diff --git a/tests/regression_tests/tally_arithmetic/results_true.dat b/tests/regression_tests/tally_arithmetic/results_true.dat index 143930dd4..baa380587 100644 --- a/tests/regression_tests/tally_arithmetic/results_true.dat +++ b/tests/regression_tests/tally_arithmetic/results_true.dat @@ -1,49 +1,49 @@ -[2.04229e-07 1.28343e-13 1.79333e-04 1.12698e-10 1.89952e-07 1.51210e-07 - 1.66796e-04 1.32777e-04 6.13215e-03 3.85362e-09 3.14746e-03 1.97795e-09 - 5.70345e-03 4.54021e-03 2.92742e-03 2.33037e-03 2.10575e-07 1.28419e-13 - 1.84905e-04 1.12764e-10 1.89188e-07 1.50221e-07 1.66125e-04 1.31908e-04 - 6.32269e-03 3.85587e-09 3.24526e-03 1.97911e-09 5.68054e-03 4.51051e-03 - 2.91566e-03 2.31512e-03 1.96696e-07 1.26388e-13 1.72718e-04 1.10981e-10 - 1.91283e-07 1.53449e-07 1.67964e-04 1.34743e-04 5.90596e-03 3.79491e-09 - 3.03136e-03 1.94782e-09 5.74342e-03 4.60742e-03 2.94794e-03 2.36486e-03 - 2.06016e-07 1.35264e-13 1.80901e-04 1.18775e-10 2.05873e-07 1.65814e-07 - 1.80776e-04 1.45600e-04 6.18579e-03 4.06142e-09 3.17499e-03 2.08461e-09 - 6.18150e-03 4.97869e-03 3.17279e-03 2.55542e-03 2.36089e-03 4.46651e-05 - 1.02263e-02 1.93469e-04 1.18179e-04 2.62375e-05 5.11897e-04 1.13649e-04 - 2.56040e-02 4.84394e-04 4.55595e-02 8.61927e-04 1.28165e-03 2.84546e-04 - 2.28056e-03 5.06320e-04 2.29877e-03 4.53056e-05 9.95724e-03 1.96244e-04 - 1.14803e-04 2.57898e-05 4.97276e-04 1.11710e-04 2.49302e-02 4.91340e-04 - 4.43606e-02 8.74289e-04 1.24504e-03 2.79691e-04 2.21542e-03 4.97680e-04 - 2.31940e-03 4.34238e-05 1.00466e-02 1.88093e-04 1.17620e-04 2.69280e-05 - 5.09479e-04 1.16640e-04 2.51540e-02 4.70932e-04 4.47588e-02 8.37974e-04 - 1.27560e-03 2.92034e-04 2.26979e-03 5.19644e-04 2.19212e-03 4.53914e-05 - 9.49530e-03 1.96615e-04 1.09609e-04 2.41615e-05 4.74778e-04 1.04657e-04 - 2.37736e-02 4.92271e-04 4.23026e-02 8.75944e-04 1.18871e-03 2.62032e-04 - 2.11519e-03 4.66257e-04][2.04229e-07 1.28343e-13 1.79333e-04 1.12698e-10 1.89952e-07 1.51210e-07 - 1.66796e-04 1.32777e-04 6.13215e-03 3.85362e-09 3.14746e-03 1.97795e-09 - 5.70345e-03 4.54021e-03 2.92742e-03 2.33037e-03 2.10575e-07 1.28419e-13 - 1.84905e-04 1.12764e-10 1.89188e-07 1.50221e-07 1.66125e-04 1.31908e-04 - 6.32269e-03 3.85587e-09 3.24526e-03 1.97911e-09 5.68054e-03 4.51051e-03 - 2.91566e-03 2.31512e-03 1.96696e-07 1.26388e-13 1.72718e-04 1.10981e-10 - 1.91283e-07 1.53449e-07 1.67964e-04 1.34743e-04 5.90596e-03 3.79491e-09 - 3.03136e-03 1.94782e-09 5.74342e-03 4.60742e-03 2.94794e-03 2.36486e-03 - 2.06016e-07 1.35264e-13 1.80901e-04 1.18775e-10 2.05873e-07 1.65814e-07 - 1.80776e-04 1.45600e-04 6.18579e-03 4.06142e-09 3.17499e-03 2.08461e-09 - 6.18150e-03 4.97869e-03 3.17279e-03 2.55542e-03 2.36089e-03 4.46651e-05 - 1.02263e-02 1.93469e-04 1.18179e-04 2.62375e-05 5.11897e-04 1.13649e-04 - 2.56040e-02 4.84394e-04 4.55595e-02 8.61927e-04 1.28165e-03 2.84546e-04 - 2.28056e-03 5.06320e-04 2.29877e-03 4.53056e-05 9.95724e-03 1.96244e-04 - 1.14803e-04 2.57898e-05 4.97276e-04 1.11710e-04 2.49302e-02 4.91340e-04 - 4.43606e-02 8.74289e-04 1.24504e-03 2.79691e-04 2.21542e-03 4.97680e-04 - 2.31940e-03 4.34238e-05 1.00466e-02 1.88093e-04 1.17620e-04 2.69280e-05 - 5.09479e-04 1.16640e-04 2.51540e-02 4.70932e-04 4.47588e-02 8.37974e-04 - 1.27560e-03 2.92034e-04 2.26979e-03 5.19644e-04 2.19212e-03 4.53914e-05 - 9.49530e-03 1.96615e-04 1.09609e-04 2.41615e-05 4.74778e-04 1.04657e-04 - 2.37736e-02 4.92271e-04 4.23026e-02 8.75944e-04 1.18871e-03 2.62032e-04 - 2.11519e-03 4.66257e-04][0.0057 0.00454 0.00293 0.00233 0.00568 0.00451 0.00292 0.00232 0.00574 - 0.00461 0.00295 0.00236 0.00618 0.00498 0.00317 0.00256 0.00128 0.00028 - 0.00228 0.00051 0.00125 0.00028 0.00222 0.0005 0.00128 0.00029 0.00227 - 0.00052 0.00119 0.00026 0.00212 0.00047][0.00018 0.00017 0.00315 0.00293 0.00018 0.00017 0.00325 0.00292 0.00017 - 0.00017 0.00303 0.00295 0.00018 0.00018 0.00317 0.00317 0.01023 0.00051 - 0.04556 0.00228 0.00996 0.0005 0.04436 0.00222 0.01005 0.00051 0.04476 - 0.00227 0.0095 0.00047 0.0423 0.00212][0.00293 0.00292 0.00295 0.00317 0.00228 0.00222 0.00227 0.00212] \ No newline at end of file +[2.29467e-07 1.47622e-13 2.02646e-04 1.30367e-10 2.20704e-07 1.76624e-07 + 1.94907e-04 1.55980e-04 6.32267e-03 4.06754e-09 3.26873e-03 2.10286e-09 + 6.08121e-03 4.86666e-03 3.14390e-03 2.51599e-03 1.89223e-07 1.06256e-13 + 1.67106e-04 9.38364e-11 1.53300e-07 1.20220e-07 1.35382e-04 1.06168e-04 + 5.21380e-03 2.92775e-09 2.69546e-03 1.51361e-09 4.22399e-03 3.31252e-03 + 2.18374e-03 1.71253e-03 2.21146e-07 1.41349e-13 1.95297e-04 1.24828e-10 + 2.11844e-07 1.69398e-07 1.87083e-04 1.49598e-04 6.09339e-03 3.89470e-09 + 3.15020e-03 2.01351e-09 5.83710e-03 4.66754e-03 3.01770e-03 2.41305e-03 + 1.92872e-07 1.05908e-13 1.70328e-04 9.35293e-11 1.59466e-07 1.25399e-07 + 1.40827e-04 1.10741e-04 5.31433e-03 2.91817e-09 2.74744e-03 1.50865e-09 + 4.39388e-03 3.45520e-03 2.27158e-03 1.78629e-03 2.44601e-03 4.71663e-05 + 1.09430e-02 2.11013e-04 1.23573e-04 2.76181e-05 5.52841e-04 1.23558e-04 + 2.71755e-02 5.24023e-04 4.76200e-02 9.18253e-04 1.37291e-03 3.06841e-04 + 2.40577e-03 5.37681e-04 2.29014e-03 4.44674e-05 1.02456e-02 1.98938e-04 + 1.12524e-04 2.48126e-05 5.03411e-04 1.11007e-04 2.54438e-02 4.94038e-04 + 4.45855e-02 8.65710e-04 1.25016e-03 2.75671e-04 2.19067e-03 4.83061e-04 + 2.38500e-03 4.58053e-05 1.06700e-02 2.04924e-04 1.22899e-04 2.95267e-05 + 5.49826e-04 1.32097e-04 2.64977e-02 5.08903e-04 4.64323e-02 8.91758e-04 + 1.36542e-03 3.28045e-04 2.39265e-03 5.74839e-04 2.17094e-03 4.21772e-05 + 9.71236e-03 1.88693e-04 1.09358e-04 2.46984e-05 4.89245e-04 1.10496e-04 + 2.41194e-02 4.68594e-04 4.22648e-02 8.21124e-04 1.21498e-03 2.74402e-04 + 2.12902e-03 4.80839e-04][2.29467e-07 1.47622e-13 2.02646e-04 1.30367e-10 2.20704e-07 1.76624e-07 + 1.94907e-04 1.55980e-04 6.32267e-03 4.06754e-09 3.26873e-03 2.10286e-09 + 6.08121e-03 4.86666e-03 3.14390e-03 2.51599e-03 1.89223e-07 1.06256e-13 + 1.67106e-04 9.38364e-11 1.53300e-07 1.20220e-07 1.35382e-04 1.06168e-04 + 5.21380e-03 2.92775e-09 2.69546e-03 1.51361e-09 4.22399e-03 3.31252e-03 + 2.18374e-03 1.71253e-03 2.21146e-07 1.41349e-13 1.95297e-04 1.24828e-10 + 2.11844e-07 1.69398e-07 1.87083e-04 1.49598e-04 6.09339e-03 3.89470e-09 + 3.15020e-03 2.01351e-09 5.83710e-03 4.66754e-03 3.01770e-03 2.41305e-03 + 1.92872e-07 1.05908e-13 1.70328e-04 9.35293e-11 1.59466e-07 1.25399e-07 + 1.40827e-04 1.10741e-04 5.31433e-03 2.91817e-09 2.74744e-03 1.50865e-09 + 4.39388e-03 3.45520e-03 2.27158e-03 1.78629e-03 2.44601e-03 4.71663e-05 + 1.09430e-02 2.11013e-04 1.23573e-04 2.76181e-05 5.52841e-04 1.23558e-04 + 2.71755e-02 5.24023e-04 4.76200e-02 9.18253e-04 1.37291e-03 3.06841e-04 + 2.40577e-03 5.37681e-04 2.29014e-03 4.44674e-05 1.02456e-02 1.98938e-04 + 1.12524e-04 2.48126e-05 5.03411e-04 1.11007e-04 2.54438e-02 4.94038e-04 + 4.45855e-02 8.65710e-04 1.25016e-03 2.75671e-04 2.19067e-03 4.83061e-04 + 2.38500e-03 4.58053e-05 1.06700e-02 2.04924e-04 1.22899e-04 2.95267e-05 + 5.49826e-04 1.32097e-04 2.64977e-02 5.08903e-04 4.64323e-02 8.91758e-04 + 1.36542e-03 3.28045e-04 2.39265e-03 5.74839e-04 2.17094e-03 4.21772e-05 + 9.71236e-03 1.88693e-04 1.09358e-04 2.46984e-05 4.89245e-04 1.10496e-04 + 2.41194e-02 4.68594e-04 4.22648e-02 8.21124e-04 1.21498e-03 2.74402e-04 + 2.12902e-03 4.80839e-04][0.00608 0.00487 0.00314 0.00252 0.00422 0.00331 0.00218 0.00171 0.00584 + 0.00467 0.00302 0.00241 0.00439 0.00346 0.00227 0.00179 0.00137 0.00031 + 0.00241 0.00054 0.00125 0.00028 0.00219 0.00048 0.00137 0.00033 0.00239 + 0.00057 0.00121 0.00027 0.00213 0.00048][0.0002 0.00019 0.00327 0.00314 0.00017 0.00014 0.0027 0.00218 0.0002 + 0.00019 0.00315 0.00302 0.00017 0.00014 0.00275 0.00227 0.01094 0.00055 + 0.04762 0.00241 0.01025 0.0005 0.04459 0.00219 0.01067 0.00055 0.04643 + 0.00239 0.00971 0.00049 0.04226 0.00213][0.00314 0.00218 0.00302 0.00227 0.00241 0.00219 0.00239 0.00213] \ No newline at end of file diff --git a/tests/regression_tests/tally_assumesep/results_true.dat b/tests/regression_tests/tally_assumesep/results_true.dat index 9d7cbf9c3..c9ccf0928 100644 --- a/tests/regression_tests/tally_assumesep/results_true.dat +++ b/tests/regression_tests/tally_assumesep/results_true.dat @@ -1,11 +1,11 @@ k-combined: -5.683578E-01 1.129170E-02 +6.268465E-01 1.154810E-02 tally 1: -6.753950E+00 -9.188305E+00 +7.828708E+00 +1.230478E+01 tally 2: -2.278558E-01 -1.052944E-02 +2.582239E-01 +1.360117E-02 tally 3: -1.179091E+01 -2.795539E+01 +1.339335E+01 +3.663458E+01 diff --git a/tests/regression_tests/tally_nuclides/results_true.dat b/tests/regression_tests/tally_nuclides/results_true.dat index 7f9641fc8..93a0e03fb 100644 --- a/tests/regression_tests/tally_nuclides/results_true.dat +++ b/tests/regression_tests/tally_nuclides/results_true.dat @@ -1,28 +1,28 @@ k-combined: -1.132463E+00 5.721067E-02 +9.732610E-01 1.400780E-02 tally 1: -7.310528E+00 -1.080411E+01 -1.664215E+00 -5.567756E-01 -1.609340E+00 -5.205634E-01 -5.646313E+00 -6.459724E+00 -7.310528E+00 -1.080411E+01 -1.664215E+00 -5.567756E-01 -1.609340E+00 -5.205634E-01 -5.646313E+00 -6.459724E+00 +7.123025E+00 +1.021136E+01 +1.619905E+00 +5.258592E-01 +1.561322E+00 +4.881841E-01 +5.503120E+00 +6.105683E+00 +7.123025E+00 +1.021136E+01 +1.619905E+00 +5.258592E-01 +1.561322E+00 +4.881841E-01 +5.503120E+00 +6.105683E+00 tally 2: -7.310528E+00 -1.080411E+01 -1.664215E+00 -5.567756E-01 -1.609340E+00 -5.205634E-01 -5.646313E+00 -6.459724E+00 +7.123025E+00 +1.021136E+01 +1.619905E+00 +5.258592E-01 +1.561322E+00 +4.881841E-01 +5.503120E+00 +6.105683E+00 diff --git a/tests/regression_tests/tally_slice_merge/inputs_true.dat b/tests/regression_tests/tally_slice_merge/inputs_true.dat index 7159d833a..7a992cc39 100644 --- a/tests/regression_tests/tally_slice_merge/inputs_true.dat +++ b/tests/regression_tests/tally_slice_merge/inputs_true.dat @@ -1,40 +1,40 @@ - - - - - - - + + + + + + + - - - - - - + + + + + + - - - - - + + + + + - - - - - + + + + + - + @@ -47,7 +47,7 @@ - + @@ -62,7 +62,7 @@ - + @@ -77,7 +77,7 @@ - + @@ -92,7 +92,7 @@ - + @@ -107,7 +107,7 @@ - + @@ -122,7 +122,7 @@ - + @@ -135,7 +135,7 @@ - + @@ -149,8 +149,8 @@ - - + + @@ -174,9 +174,9 @@ - + - + 1.26 1.26 17 17 @@ -277,30 +277,30 @@ 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + eigenvalue 100 10 5 - + -160 -160 -183 160 160 183 diff --git a/tests/regression_tests/tally_slice_merge/results_true.dat b/tests/regression_tests/tally_slice_merge/results_true.dat index 58b15fc18..4b2cbdf1a 100644 --- a/tests/regression_tests/tally_slice_merge/results_true.dat +++ b/tests/regression_tests/tally_slice_merge/results_true.dat @@ -1,45 +1,45 @@ cell energy low [eV] energy high [eV] nuclide score mean std. dev. -0 21 0.00e+00 6.25e-01 U235 fission 1.75e-01 1.20e-02 cell energy low [eV] energy high [eV] nuclide score mean std. dev. -0 21 0.00e+00 6.25e-01 U235 nu-fission 4.26e-01 2.92e-02 cell energy low [eV] energy high [eV] nuclide score mean std. dev. -0 21 0.00e+00 6.25e-01 U238 fission 2.41e-07 1.61e-08 cell energy low [eV] energy high [eV] nuclide score mean std. dev. -0 21 0.00e+00 6.25e-01 U238 nu-fission 6.00e-07 4.01e-08 cell energy low [eV] energy high [eV] nuclide score mean std. dev. -0 21 6.25e-01 2.00e+07 U235 fission 2.89e-02 2.07e-03 cell energy low [eV] energy high [eV] nuclide score mean std. dev. -0 21 6.25e-01 2.00e+07 U235 nu-fission 7.07e-02 5.06e-03 cell energy low [eV] energy high [eV] nuclide score mean std. dev. -0 21 6.25e-01 2.00e+07 U238 fission 1.41e-02 5.76e-04 cell energy low [eV] energy high [eV] nuclide score mean std. dev. -0 21 6.25e-01 2.00e+07 U238 nu-fission 3.95e-02 1.90e-03 cell energy low [eV] energy high [eV] nuclide score mean std. dev. -0 27 0.00e+00 6.25e-01 U235 fission 1.51e-01 1.17e-02 cell energy low [eV] energy high [eV] nuclide score mean std. dev. -0 27 0.00e+00 6.25e-01 U235 nu-fission 3.69e-01 2.86e-02 cell energy low [eV] energy high [eV] nuclide score mean std. dev. -0 27 0.00e+00 6.25e-01 U238 fission 2.07e-07 1.47e-08 cell energy low [eV] energy high [eV] nuclide score mean std. dev. -0 27 0.00e+00 6.25e-01 U238 nu-fission 5.17e-07 3.66e-08 cell energy low [eV] energy high [eV] nuclide score mean std. dev. -0 27 6.25e-01 2.00e+07 U235 fission 2.57e-02 2.43e-03 cell energy low [eV] energy high [eV] nuclide score mean std. dev. -0 27 6.25e-01 2.00e+07 U235 nu-fission 6.30e-02 5.92e-03 cell energy low [eV] energy high [eV] nuclide score mean std. dev. -0 27 6.25e-01 2.00e+07 U238 fission 1.47e-02 1.41e-03 cell energy low [eV] energy high [eV] nuclide score mean std. dev. -0 27 6.25e-01 2.00e+07 U238 nu-fission 4.12e-02 4.02e-03 cell energy low [eV] energy high [eV] nuclide score mean std. dev. -0 21 0.00e+00 6.25e-01 U235 fission 1.75e-01 1.20e-02 -1 21 0.00e+00 6.25e-01 U235 nu-fission 4.26e-01 2.92e-02 -2 21 0.00e+00 6.25e-01 U238 fission 2.41e-07 1.61e-08 -3 21 0.00e+00 6.25e-01 U238 nu-fission 6.00e-07 4.01e-08 -4 21 6.25e-01 2.00e+07 U235 fission 2.89e-02 2.07e-03 -5 21 6.25e-01 2.00e+07 U235 nu-fission 7.07e-02 5.06e-03 -6 21 6.25e-01 2.00e+07 U238 fission 1.41e-02 5.76e-04 -7 21 6.25e-01 2.00e+07 U238 nu-fission 3.95e-02 1.90e-03 -8 27 0.00e+00 6.25e-01 U235 fission 1.51e-01 1.17e-02 -9 27 0.00e+00 6.25e-01 U235 nu-fission 3.69e-01 2.86e-02 -10 27 0.00e+00 6.25e-01 U238 fission 2.07e-07 1.47e-08 -11 27 0.00e+00 6.25e-01 U238 nu-fission 5.17e-07 3.66e-08 -12 27 6.25e-01 2.00e+07 U235 fission 2.57e-02 2.43e-03 -13 27 6.25e-01 2.00e+07 U235 nu-fission 6.30e-02 5.92e-03 -14 27 6.25e-01 2.00e+07 U238 fission 1.47e-02 1.41e-03 -15 27 6.25e-01 2.00e+07 U238 nu-fission 4.12e-02 4.02e-03 +0 21 0.00e+00 6.25e-01 U235 fission 1.93e-01 1.92e-02 cell energy low [eV] energy high [eV] nuclide score mean std. dev. +0 21 0.00e+00 6.25e-01 U235 nu-fission 4.70e-01 4.67e-02 cell energy low [eV] energy high [eV] nuclide score mean std. dev. +0 21 0.00e+00 6.25e-01 U238 fission 2.65e-07 2.60e-08 cell energy low [eV] energy high [eV] nuclide score mean std. dev. +0 21 0.00e+00 6.25e-01 U238 nu-fission 6.60e-07 6.47e-08 cell energy low [eV] energy high [eV] nuclide score mean std. dev. +0 21 6.25e-01 2.00e+07 U235 fission 3.39e-02 1.53e-03 cell energy low [eV] energy high [eV] nuclide score mean std. dev. +0 21 6.25e-01 2.00e+07 U235 nu-fission 8.30e-02 3.75e-03 cell energy low [eV] energy high [eV] nuclide score mean std. dev. +0 21 6.25e-01 2.00e+07 U238 fission 1.70e-02 2.01e-03 cell energy low [eV] energy high [eV] nuclide score mean std. dev. +0 21 6.25e-01 2.00e+07 U238 nu-fission 4.76e-02 6.12e-03 cell energy low [eV] energy high [eV] nuclide score mean std. dev. +0 27 0.00e+00 6.25e-01 U235 fission 7.61e-02 5.84e-03 cell energy low [eV] energy high [eV] nuclide score mean std. dev. +0 27 0.00e+00 6.25e-01 U235 nu-fission 1.85e-01 1.42e-02 cell energy low [eV] energy high [eV] nuclide score mean std. dev. +0 27 0.00e+00 6.25e-01 U238 fission 1.06e-07 7.62e-09 cell energy low [eV] energy high [eV] nuclide score mean std. dev. +0 27 0.00e+00 6.25e-01 U238 nu-fission 2.64e-07 1.90e-08 cell energy low [eV] energy high [eV] nuclide score mean std. dev. +0 27 6.25e-01 2.00e+07 U235 fission 1.69e-02 1.34e-03 cell energy low [eV] energy high [eV] nuclide score mean std. dev. +0 27 6.25e-01 2.00e+07 U235 nu-fission 4.15e-02 3.29e-03 cell energy low [eV] energy high [eV] nuclide score mean std. dev. +0 27 6.25e-01 2.00e+07 U238 fission 1.10e-02 1.69e-03 cell energy low [eV] energy high [eV] nuclide score mean std. dev. +0 27 6.25e-01 2.00e+07 U238 nu-fission 3.13e-02 5.35e-03 cell energy low [eV] energy high [eV] nuclide score mean std. dev. +0 21 0.00e+00 6.25e-01 U235 fission 1.93e-01 1.92e-02 +1 21 0.00e+00 6.25e-01 U235 nu-fission 4.70e-01 4.67e-02 +2 21 0.00e+00 6.25e-01 U238 fission 2.65e-07 2.60e-08 +3 21 0.00e+00 6.25e-01 U238 nu-fission 6.60e-07 6.47e-08 +4 21 6.25e-01 2.00e+07 U235 fission 3.39e-02 1.53e-03 +5 21 6.25e-01 2.00e+07 U235 nu-fission 8.30e-02 3.75e-03 +6 21 6.25e-01 2.00e+07 U238 fission 1.70e-02 2.01e-03 +7 21 6.25e-01 2.00e+07 U238 nu-fission 4.76e-02 6.12e-03 +8 27 0.00e+00 6.25e-01 U235 fission 7.61e-02 5.84e-03 +9 27 0.00e+00 6.25e-01 U235 nu-fission 1.85e-01 1.42e-02 +10 27 0.00e+00 6.25e-01 U238 fission 1.06e-07 7.62e-09 +11 27 0.00e+00 6.25e-01 U238 nu-fission 2.64e-07 1.90e-08 +12 27 6.25e-01 2.00e+07 U235 fission 1.69e-02 1.34e-03 +13 27 6.25e-01 2.00e+07 U235 nu-fission 4.15e-02 3.29e-03 +14 27 6.25e-01 2.00e+07 U238 fission 1.10e-02 1.69e-03 +15 27 6.25e-01 2.00e+07 U238 nu-fission 3.13e-02 5.35e-03 sum(distribcell) energy low [eV] energy high [eV] nuclide score mean std. dev. 0 (0, 100, 2000, 30000) 0.00e+00 6.25e-01 U235 fission 0.00e+00 0.00e+00 1 (0, 100, 2000, 30000) 0.00e+00 6.25e-01 U235 nu-fission 0.00e+00 0.00e+00 2 (0, 100, 2000, 30000) 0.00e+00 6.25e-01 U238 fission 0.00e+00 0.00e+00 3 (0, 100, 2000, 30000) 0.00e+00 6.25e-01 U238 nu-fission 0.00e+00 0.00e+00 -4 (0, 100, 2000, 30000) 6.25e-01 2.00e+07 U235 fission 9.53e-07 9.53e-07 -5 (0, 100, 2000, 30000) 6.25e-01 2.00e+07 U235 nu-fission 2.37e-06 2.37e-06 -6 (0, 100, 2000, 30000) 6.25e-01 2.00e+07 U238 fission 1.25e-08 1.25e-08 -7 (0, 100, 2000, 30000) 6.25e-01 2.00e+07 U238 nu-fission 3.15e-08 3.15e-08 +4 (0, 100, 2000, 30000) 6.25e-01 2.00e+07 U235 fission 0.00e+00 0.00e+00 +5 (0, 100, 2000, 30000) 6.25e-01 2.00e+07 U235 nu-fission 0.00e+00 0.00e+00 +6 (0, 100, 2000, 30000) 6.25e-01 2.00e+07 U238 fission 0.00e+00 0.00e+00 +7 (0, 100, 2000, 30000) 6.25e-01 2.00e+07 U238 nu-fission 0.00e+00 0.00e+00 8 (500, 5000, 50000) 0.00e+00 6.25e-01 U235 fission 0.00e+00 0.00e+00 9 (500, 5000, 50000) 0.00e+00 6.25e-01 U235 nu-fission 0.00e+00 0.00e+00 10 (500, 5000, 50000) 0.00e+00 6.25e-01 U238 fission 0.00e+00 0.00e+00 @@ -49,19 +49,19 @@ 14 (500, 5000, 50000) 6.25e-01 2.00e+07 U238 fission 0.00e+00 0.00e+00 15 (500, 5000, 50000) 6.25e-01 2.00e+07 U238 nu-fission 0.00e+00 0.00e+00 sum(mesh) energy low [eV] energy high [eV] nuclide score mean std. dev. -0 ((1, 1), (1, 2)) 0.00e+00 6.25e-01 U235 fission 6.73e-03 3.04e-03 -1 ((1, 1), (1, 2)) 0.00e+00 6.25e-01 U235 nu-fission 1.64e-02 7.40e-03 -2 ((1, 1), (1, 2)) 0.00e+00 6.25e-01 U238 fission 8.80e-09 3.84e-09 -3 ((1, 1), (1, 2)) 0.00e+00 6.25e-01 U238 nu-fission 2.19e-08 9.56e-09 -4 ((1, 1), (1, 2)) 6.25e-01 2.00e+07 U235 fission 9.89e-04 3.53e-04 -5 ((1, 1), (1, 2)) 6.25e-01 2.00e+07 U235 nu-fission 2.42e-03 8.60e-04 -6 ((1, 1), (1, 2)) 6.25e-01 2.00e+07 U238 fission 5.01e-04 2.13e-04 -7 ((1, 1), (1, 2)) 6.25e-01 2.00e+07 U238 nu-fission 1.36e-03 5.86e-04 -8 ((2, 1), (2, 2)) 0.00e+00 6.25e-01 U235 fission 1.63e-02 4.21e-03 -9 ((2, 1), (2, 2)) 0.00e+00 6.25e-01 U235 nu-fission 3.98e-02 1.02e-02 -10 ((2, 1), (2, 2)) 0.00e+00 6.25e-01 U238 fission 2.28e-08 5.90e-09 -11 ((2, 1), (2, 2)) 0.00e+00 6.25e-01 U238 nu-fission 5.67e-08 1.47e-08 -12 ((2, 1), (2, 2)) 6.25e-01 2.00e+07 U235 fission 1.79e-03 4.31e-04 -13 ((2, 1), (2, 2)) 6.25e-01 2.00e+07 U235 nu-fission 4.37e-03 1.05e-03 -14 ((2, 1), (2, 2)) 6.25e-01 2.00e+07 U238 fission 7.51e-04 2.51e-04 -15 ((2, 1), (2, 2)) 6.25e-01 2.00e+07 U238 nu-fission 2.02e-03 6.71e-04 +0 ((1, 1), (1, 2)) 0.00e+00 6.25e-01 U235 fission 1.94e-03 1.03e-03 +1 ((1, 1), (1, 2)) 0.00e+00 6.25e-01 U235 nu-fission 4.74e-03 2.50e-03 +2 ((1, 1), (1, 2)) 0.00e+00 6.25e-01 U238 fission 2.74e-09 1.42e-09 +3 ((1, 1), (1, 2)) 0.00e+00 6.25e-01 U238 nu-fission 6.83e-09 3.53e-09 +4 ((1, 1), (1, 2)) 6.25e-01 2.00e+07 U235 fission 9.02e-04 3.69e-04 +5 ((1, 1), (1, 2)) 6.25e-01 2.00e+07 U235 nu-fission 2.24e-03 9.12e-04 +6 ((1, 1), (1, 2)) 6.25e-01 2.00e+07 U238 fission 1.44e-03 8.42e-04 +7 ((1, 1), (1, 2)) 6.25e-01 2.00e+07 U238 nu-fission 4.37e-03 2.64e-03 +8 ((2, 1), (2, 2)) 0.00e+00 6.25e-01 U235 fission 1.27e-02 2.76e-03 +9 ((2, 1), (2, 2)) 0.00e+00 6.25e-01 U235 nu-fission 3.09e-02 6.72e-03 +10 ((2, 1), (2, 2)) 0.00e+00 6.25e-01 U238 fission 1.70e-08 3.57e-09 +11 ((2, 1), (2, 2)) 0.00e+00 6.25e-01 U238 nu-fission 4.25e-08 8.90e-09 +12 ((2, 1), (2, 2)) 6.25e-01 2.00e+07 U235 fission 1.43e-03 1.69e-04 +13 ((2, 1), (2, 2)) 6.25e-01 2.00e+07 U235 nu-fission 3.52e-03 4.20e-04 +14 ((2, 1), (2, 2)) 6.25e-01 2.00e+07 U238 fission 1.37e-03 2.98e-04 +15 ((2, 1), (2, 2)) 6.25e-01 2.00e+07 U238 nu-fission 4.16e-03 1.08e-03 diff --git a/tests/regression_tests/time_cutoff/inputs_true.dat b/tests/regression_tests/time_cutoff/inputs_true.dat index 7d3e94f50..e1102d475 100644 --- a/tests/regression_tests/time_cutoff/inputs_true.dat +++ b/tests/regression_tests/time_cutoff/inputs_true.dat @@ -4,13 +4,13 @@ - + fixed source 100 10 - + 0.0 0.0 0.0 diff --git a/tests/regression_tests/time_cutoff/results_true.dat b/tests/regression_tests/time_cutoff/results_true.dat index 1cafceb77..d3d5e1b3c 100644 --- a/tests/regression_tests/time_cutoff/results_true.dat +++ b/tests/regression_tests/time_cutoff/results_true.dat @@ -1,5 +1,5 @@ tally 1: -2.000000E+03 -4.000000E+05 +1.383148E+02 +1.913099E+03 0.000000E+00 0.000000E+00 diff --git a/tests/regression_tests/torus/inputs_true.dat b/tests/regression_tests/torus/inputs_true.dat index a5c7a8d7a..df4af1443 100644 --- a/tests/regression_tests/torus/inputs_true.dat +++ b/tests/regression_tests/torus/inputs_true.dat @@ -1,13 +1,13 @@ - - - + + + - - + + @@ -15,15 +15,15 @@ - - - - - - - - - + + + + + + + + + eigenvalue diff --git a/tests/regression_tests/torus/large_major/inputs_true.dat b/tests/regression_tests/torus/large_major/inputs_true.dat index fa7deb29a..513a8c67e 100644 --- a/tests/regression_tests/torus/large_major/inputs_true.dat +++ b/tests/regression_tests/torus/large_major/inputs_true.dat @@ -2,27 +2,27 @@ - - + + - - + + - - - + + + fixed source 1000 10 - + -1000.0 0 0 diff --git a/tests/regression_tests/torus/results_true.dat b/tests/regression_tests/torus/results_true.dat index 42fb209cc..84cd3c7a4 100644 --- a/tests/regression_tests/torus/results_true.dat +++ b/tests/regression_tests/torus/results_true.dat @@ -1,2 +1,2 @@ k-combined: -7.667201E-01 1.136882E-02 +7.666453E-01 1.478848E-02 diff --git a/tests/regression_tests/trace/results_true.dat b/tests/regression_tests/trace/results_true.dat index bbf03de94..97b997ae6 100644 --- a/tests/regression_tests/trace/results_true.dat +++ b/tests/regression_tests/trace/results_true.dat @@ -1,2 +1,2 @@ k-combined: -3.070134E-01 3.900396E-03 +2.940336E-01 7.338463E-04 diff --git a/tests/regression_tests/track_output/results_true.dat b/tests/regression_tests/track_output/results_true.dat index 148b54a30..205ac3eec 100644 --- a/tests/regression_tests/track_output/results_true.dat +++ b/tests/regression_tests/track_output/results_true.dat @@ -143,76 +143,74 @@ neutron [((-9.469716e-01, -2.580266e-01, 1.414357e-01), (1.438873e-01, 2.365819e ((-3.920090e+00, -9.211794e-01, 2.908406e+00), (9.094673e-01, -3.659267e-01, -1.974002e-01), 9.547085e+00, 1.260840e-07, 1.000000e+00, 23, 2387, 1) ((-3.729948e+00, -9.976834e-01, 2.867135e+00), (-2.916959e-01, -6.494657e-01, -7.022164e-01), 8.590591e+00, 1.750036e-07, 1.000000e+00, 23, 2387, 1) ((-3.744933e+00, -1.031047e+00, 2.831062e+00), (-2.916959e-01, -6.494657e-01, -7.022164e-01), 8.590591e+00, 1.876753e-07, 0.000000e+00, 23, 2387, 1)] -neutron [((6.474155e+00, -5.192870e+00, 5.413003e+00), (-9.112559e-01, 3.950037e-01, 1.165536e-01), 2.052226e+06, 4.450859e-05, 1.000000e+00, 21, 2367, 2) - ((6.037250e+00, -5.003484e+00, 5.468885e+00), (-9.112559e-01, 3.950037e-01, 1.165536e-01), 2.052226e+06, 4.450883e-05, 1.000000e+00, 22, 2367, 3) - ((5.942573e+00, -4.962444e+00, 5.480995e+00), (-9.112559e-01, 3.950037e-01, 1.165536e-01), 2.052226e+06, 4.450889e-05, 1.000000e+00, 23, 2367, 1) - ((5.861800e+00, -4.927431e+00, 5.491326e+00), (-9.518772e-01, -3.064714e-01, -2.259335e-03), 1.141417e+06, 4.450893e-05, 1.000000e+00, 23, 2367, 1) - ((5.725160e+00, -4.971424e+00, 5.491002e+00), (-9.518772e-01, -3.064714e-01, -2.259335e-03), 1.141417e+06, 4.450903e-05, 1.000000e+00, 23, 2366, 1) - ((5.494150e+00, -5.045802e+00, 5.490454e+00), (-9.518772e-01, -3.064714e-01, -2.259335e-03), 1.141417e+06, 4.450919e-05, 1.000000e+00, 22, 2366, 3) - ((5.392865e+00, -5.078412e+00, 5.490213e+00), (-9.518772e-01, -3.064714e-01, -2.259335e-03), 1.141417e+06, 4.450927e-05, 1.000000e+00, 21, 2366, 2) - ((4.612759e+00, -5.329579e+00, 5.488362e+00), (-9.518772e-01, -3.064714e-01, -2.259335e-03), 1.141417e+06, 4.450982e-05, 1.000000e+00, 22, 2366, 3) - ((4.511474e+00, -5.362189e+00, 5.488121e+00), (-9.518772e-01, -3.064714e-01, -2.259335e-03), 1.141417e+06, 4.450989e-05, 1.000000e+00, 23, 2366, 1) - ((4.089400e+00, -5.498082e+00, 5.487119e+00), (-9.518772e-01, -3.064714e-01, -2.259335e-03), 1.141417e+06, 4.451019e-05, 1.000000e+00, 23, 2365, 1) - ((3.384113e+00, -5.725160e+00, 5.485445e+00), (-9.518772e-01, -3.064714e-01, -2.259335e-03), 1.141417e+06, 4.451069e-05, 1.000000e+00, 23, 2351, 1) - ((2.453640e+00, -6.024740e+00, 5.483237e+00), (-9.518772e-01, -3.064714e-01, -2.259335e-03), 1.141417e+06, 4.451136e-05, 1.000000e+00, 23, 2350, 1) - ((2.086813e+00, -6.142846e+00, 5.482366e+00), (-9.518772e-01, -3.064714e-01, -2.259335e-03), 1.141417e+06, 4.451162e-05, 1.000000e+00, 22, 2350, 3) - ((1.993594e+00, -6.172859e+00, 5.482145e+00), (-9.518772e-01, -3.064714e-01, -2.259335e-03), 1.141417e+06, 4.451168e-05, 1.000000e+00, 21, 2350, 2) - ((1.325704e+00, -6.387896e+00, 5.480560e+00), (8.986086e-01, -4.380574e-01, -2.466265e-02), 9.775839e+05, 4.451216e-05, 1.000000e+00, 21, 2350, 2) - ((2.061403e+00, -6.746538e+00, 5.460368e+00), (-7.778764e-01, 2.051975e-01, -5.939716e-01), 7.813219e+05, 4.451276e-05, 1.000000e+00, 21, 2350, 2) - ((1.122794e+00, -6.498940e+00, 4.743664e+00), (-7.778764e-01, 2.051975e-01, -5.939716e-01), 7.813219e+05, 4.451375e-05, 1.000000e+00, 22, 2350, 3) - ((1.036483e+00, -6.476172e+00, 4.677758e+00), (-7.778764e-01, 2.051975e-01, -5.939716e-01), 7.813219e+05, 4.451384e-05, 1.000000e+00, 23, 2350, 1) - ((8.178800e-01, -6.418507e+00, 4.510837e+00), (-7.778764e-01, 2.051975e-01, -5.939716e-01), 7.813219e+05, 4.451407e-05, 1.000000e+00, 23, 2349, 1) - ((5.725264e-01, -6.353784e+00, 4.323490e+00), (-7.778764e-01, 2.051975e-01, -5.939716e-01), 7.813219e+05, 4.451432e-05, 1.000000e+00, 22, 2349, 3) - ((4.668297e-01, -6.325902e+00, 4.242782e+00), (-7.778764e-01, 2.051975e-01, -5.939716e-01), 7.813219e+05, 4.451444e-05, 1.000000e+00, 21, 2349, 2) - ((-2.989816e-01, -6.123888e+00, 3.658023e+00), (-7.778764e-01, 2.051975e-01, -5.939716e-01), 7.813219e+05, 4.451524e-05, 1.000000e+00, 22, 2349, 3) - ((-4.046782e-01, -6.096006e+00, 3.577315e+00), (-7.778764e-01, 2.051975e-01, -5.939716e-01), 7.813219e+05, 4.451535e-05, 1.000000e+00, 23, 2349, 1) - ((-8.040445e-01, -5.990656e+00, 3.272367e+00), (-7.989001e-01, -1.890553e-01, -5.709787e-01), 6.637114e+05, 4.451577e-05, 1.000000e+00, 23, 2349, 1) - ((-8.178800e-01, -5.993930e+00, 3.262478e+00), (-7.989001e-01, -1.890553e-01, -5.709787e-01), 6.637114e+05, 4.451579e-05, 1.000000e+00, 23, 2348, 1) - ((-1.077910e+00, -6.055465e+00, 3.076633e+00), (-4.487118e-01, 1.670254e-01, -8.779295e-01), 4.550608e+05, 4.451608e-05, 1.000000e+00, 23, 2348, 1) - ((-1.215611e+00, -6.004208e+00, 2.807214e+00), (7.872329e-01, 4.481433e-01, -4.235941e-01), 3.544207e+03, 4.451641e-05, 1.000000e+00, 23, 2348, 1) - ((-1.100296e+00, -5.938564e+00, 2.745166e+00), (8.468456e-01, 5.310954e-01, 2.811230e-02), 2.812308e+03, 4.451819e-05, 1.000000e+00, 23, 2348, 1) - ((-8.178800e-01, -5.761448e+00, 2.754541e+00), (8.468456e-01, 5.310954e-01, 2.811230e-02), 2.812308e+03, 4.452273e-05, 1.000000e+00, 23, 2349, 1) - ((-7.600184e-01, -5.725160e+00, 2.756462e+00), (8.468456e-01, 5.310954e-01, 2.811230e-02), 2.812308e+03, 4.452366e-05, 1.000000e+00, 23, 2363, 1) - ((-2.947156e-01, -5.433347e+00, 2.771908e+00), (8.468456e-01, 5.310954e-01, 2.811230e-02), 2.812308e+03, 4.453115e-05, 1.000000e+00, 22, 2363, 3) - ((-2.073333e-01, -5.378546e+00, 2.774809e+00), (8.468456e-01, 5.310954e-01, 2.811230e-02), 2.812308e+03, 4.453256e-05, 1.000000e+00, 21, 2363, 2) - ((-1.746705e-01, -5.358062e+00, 2.775893e+00), (5.278774e-01, 5.459205e-01, 6.506276e-01), 2.806481e+03, 4.453309e-05, 1.000000e+00, 21, 2363, 2) - ((-8.681718e-02, -5.267205e+00, 2.884176e+00), (-8.975500e-01, 8.968076e-04, -4.409119e-01), 2.764929e+03, 4.453536e-05, 1.000000e+00, 21, 2363, 2) - ((-3.684221e-01, -5.266924e+00, 2.745840e+00), (-8.975500e-01, 8.968076e-04, -4.409119e-01), 2.764929e+03, 4.453967e-05, 1.000000e+00, 22, 2363, 3) - ((-4.840903e-01, -5.266809e+00, 2.689019e+00), (-8.975500e-01, 8.968076e-04, -4.409119e-01), 2.764929e+03, 4.454144e-05, 1.000000e+00, 23, 2363, 1) - ((-8.178800e-01, -5.266475e+00, 2.525049e+00), (-8.975500e-01, 8.968076e-04, -4.409119e-01), 2.764929e+03, 4.454656e-05, 1.000000e+00, 23, 2362, 1) - ((-1.151175e+00, -5.266142e+00, 2.361321e+00), (-8.975500e-01, 8.968076e-04, -4.409119e-01), 2.764929e+03, 4.455166e-05, 1.000000e+00, 22, 2362, 3) - ((-1.266464e+00, -5.266027e+00, 2.304687e+00), (-8.975500e-01, 8.968076e-04, -4.409119e-01), 2.764929e+03, 4.455343e-05, 1.000000e+00, 21, 2362, 2) - ((-2.005772e+00, -5.265288e+00, 1.941509e+00), (-8.975500e-01, 8.968076e-04, -4.409119e-01), 2.764929e+03, 4.456475e-05, 1.000000e+00, 22, 2362, 3) - ((-2.121061e+00, -5.265173e+00, 1.884875e+00), (-8.975500e-01, 8.968076e-04, -4.409119e-01), 2.764929e+03, 4.456652e-05, 1.000000e+00, 23, 2362, 1) - ((-2.393759e+00, -5.264900e+00, 1.750915e+00), (-9.607392e-01, -1.749373e-01, 2.153533e-01), 1.619469e+03, 4.457070e-05, 1.000000e+00, 23, 2362, 1) - ((-2.453640e+00, -5.275804e+00, 1.764337e+00), (-9.607392e-01, -1.749373e-01, 2.153533e-01), 1.619469e+03, 4.457182e-05, 1.000000e+00, 23, 2361, 1) - ((-2.470658e+00, -5.278903e+00, 1.768152e+00), (-6.728606e-01, -2.916408e-01, -6.798561e-01), 4.873672e+02, 4.457214e-05, 1.000000e+00, 23, 2361, 1) - ((-3.463692e+00, -5.709318e+00, 7.647939e-01), (-2.249302e-01, -9.330150e-01, -2.808728e-01), 1.790901e+02, 4.462047e-05, 1.000000e+00, 23, 2361, 1) - ((-3.467511e+00, -5.725160e+00, 7.600247e-01), (-2.249302e-01, -9.330150e-01, -2.808728e-01), 1.790901e+02, 4.462139e-05, 1.000000e+00, 23, 2347, 1) - ((-3.533785e+00, -6.000066e+00, 6.772677e-01), (-2.249302e-01, -9.330150e-01, -2.808728e-01), 1.790901e+02, 4.463730e-05, 1.000000e+00, 22, 2347, 3) - ((-3.562245e+00, -6.118119e+00, 6.417291e-01), (-2.249302e-01, -9.330150e-01, -2.808728e-01), 1.790901e+02, 4.464414e-05, 1.000000e+00, 21, 2347, 2) - ((-3.723934e+00, -6.788806e+00, 4.398272e-01), (-2.249302e-01, -9.330150e-01, -2.808728e-01), 1.790901e+02, 4.468297e-05, 1.000000e+00, 22, 2347, 3) - ((-3.752394e+00, -6.906859e+00, 4.042885e-01), (-2.249302e-01, -9.330150e-01, -2.808728e-01), 1.790901e+02, 4.468981e-05, 1.000000e+00, 23, 2347, 1) - ((-3.848515e+00, -7.305571e+00, 2.842613e-01), (6.498448e-01, -3.243413e-01, -6.873896e-01), 2.328979e+01, 4.471290e-05, 1.000000e+00, 23, 2347, 1) - ((-3.737619e+00, -7.360920e+00, 1.669579e-01), (6.498448e-01, -3.243413e-01, -6.873896e-01), 2.328979e+01, 4.473846e-05, 1.000000e+00, 11, 1750, 1) - ((-3.574308e+00, -7.442429e+00, -5.788041e-03), (6.794505e-01, 3.157106e-01, -6.623246e-01), 1.590416e+01, 4.477611e-05, 1.000000e+00, 11, 1750, 1) - ((-3.398889e+00, -7.360920e+00, -1.767852e-01), (6.794505e-01, 3.157106e-01, -6.623246e-01), 1.590416e+01, 4.482292e-05, 1.000000e+00, 23, 2347, 1) - ((-2.904712e+00, -7.131298e+00, -6.585068e-01), (-4.836985e-02, -2.819627e-01, -9.582053e-01), 2.610202e+00, 4.495477e-05, 1.000000e+00, 23, 2347, 1) - ((-2.923579e+00, -7.241285e+00, -1.032280e+00), (-6.089807e-01, -2.347428e-01, -7.576532e-01), 1.671268e+00, 4.512933e-05, 1.000000e+00, 23, 2347, 1) - ((-3.012516e+00, -7.275567e+00, -1.142930e+00), (3.221931e-01, -5.406104e-01, -7.771306e-01), 1.275709e-01, 4.521100e-05, 1.000000e+00, 23, 2347, 1) - ((-2.984032e+00, -7.323360e+00, -1.211633e+00), (-8.629564e-01, -1.719529e-01, -4.751195e-01), 1.897424e-02, 4.538995e-05, 1.000000e+00, 23, 2347, 1) - ((-3.172528e+00, -7.360920e+00, -1.315413e+00), (-8.629564e-01, -1.719529e-01, -4.751195e-01), 1.897424e-02, 4.653641e-05, 1.000000e+00, 11, 1750, 1) - ((-3.602328e+00, -7.446562e+00, -1.552049e+00), (-1.530190e-01, -7.092235e-01, 6.881767e-01), 1.306951e-02, 4.915052e-05, 1.000000e+00, 11, 1750, 1) - ((-3.625236e+00, -7.552741e+00, -1.449021e+00), (-1.976867e-01, 2.826475e-01, 9.386322e-01), 2.145548e-02, 5.009730e-05, 1.000000e+00, 11, 1750, 1) - ((-3.636290e+00, -7.536936e+00, -1.396537e+00), (1.266676e-01, 2.265353e-01, -9.657314e-01), 1.815564e-02, 5.037329e-05, 1.000000e+00, 11, 1750, 1) - ((-3.621792e+00, -7.511008e+00, -1.507069e+00), (-4.275550e-01, 8.441443e-01, 3.234457e-01), 1.848049e-02, 5.098741e-05, 1.000000e+00, 11, 1750, 1) - ((-3.697811e+00, -7.360920e+00, -1.449560e+00), (-4.275550e-01, 8.441443e-01, 3.234457e-01), 1.848049e-02, 5.193300e-05, 1.000000e+00, 23, 2347, 1) - ((-3.703436e+00, -7.349814e+00, -1.445305e+00), (-7.832167e-01, 5.713670e-01, 2.451762e-01), 1.861705e-02, 5.200297e-05, 1.000000e+00, 23, 2347, 1) - ((-3.823243e+00, -7.262414e+00, -1.407801e+00), (-9.917106e-01, 5.069164e-02, 1.180695e-01), 4.703334e-02, 5.281350e-05, 1.000000e+00, 23, 2347, 1) - ((-4.089400e+00, -7.248809e+00, -1.376113e+00), (-9.917106e-01, 5.069164e-02, 1.180695e-01), 4.703334e-02, 5.370820e-05, 1.000000e+00, 23, 2346, 1) - ((-4.131081e+00, -7.246679e+00, -1.371151e+00), (9.108632e-01, -4.018526e-01, 9.403556e-02), 8.057393e-02, 5.384831e-05, 1.000000e+00, 23, 2346, 1) - ((-4.089400e+00, -7.265067e+00, -1.366848e+00), (9.108632e-01, -4.018526e-01, 9.403556e-02), 8.057393e-02, 5.396486e-05, 1.000000e+00, 23, 2347, 1) - ((-3.872134e+00, -7.360920e+00, -1.344418e+00), (9.108632e-01, -4.018526e-01, 9.403556e-02), 8.057393e-02, 5.457240e-05, 1.000000e+00, 11, 1750, 1) - ((-3.673062e+00, -7.448746e+00, -1.323866e+00), (2.976906e-01, 8.174443e-01, -4.931178e-01), 5.538060e-02, 5.512905e-05, 1.000000e+00, 11, 1750, 1) - ((-3.658580e+00, -7.408978e+00, -1.347855e+00), (-5.409120e-01, 8.345378e-01, -1.046943e-01), 8.122576e-02, 5.527851e-05, 1.000000e+00, 11, 1750, 1) - ((-3.682981e+00, -7.371331e+00, -1.352578e+00), (-5.409120e-01, 8.345378e-01, -1.046943e-01), 8.122576e-02, 5.539295e-05, 0.000000e+00, 11, 1750, 1)] +neutron [((6.474155e+00, -5.192870e+00, 5.413003e+00), (-9.597810e-01, -1.081529e-01, -2.590820e-01), 9.900333e+05, 4.450859e-05, 1.000000e+00, 21, 2367, 2) + ((6.142109e+00, -5.230286e+00, 5.323371e+00), (-9.597810e-01, -1.081529e-01, -2.590820e-01), 9.900333e+05, 4.450884e-05, 1.000000e+00, 22, 2367, 3) + ((6.041244e+00, -5.241652e+00, 5.296144e+00), (-9.597810e-01, -1.081529e-01, -2.590820e-01), 9.900333e+05, 4.450892e-05, 1.000000e+00, 23, 2367, 1) + ((6.004037e+00, -5.245845e+00, 5.286100e+00), (-6.195407e-01, -7.332723e-01, -2.801446e-01), 5.512347e+05, 4.450895e-05, 1.000000e+00, 23, 2367, 1) + ((5.725160e+00, -5.575916e+00, 5.159997e+00), (-6.195407e-01, -7.332723e-01, -2.801446e-01), 5.512347e+05, 4.450939e-05, 1.000000e+00, 23, 2366, 1) + ((5.599064e+00, -5.725160e+00, 5.102979e+00), (-6.195407e-01, -7.332723e-01, -2.801446e-01), 5.512347e+05, 4.450958e-05, 1.000000e+00, 23, 2352, 1) + ((5.296886e+00, -6.082810e+00, 4.966340e+00), (-6.195407e-01, -7.332723e-01, -2.801446e-01), 5.512347e+05, 4.451006e-05, 1.000000e+00, 22, 2352, 3) + ((5.240003e+00, -6.150135e+00, 4.940619e+00), (-6.195407e-01, -7.332723e-01, -2.801446e-01), 5.512347e+05, 4.451015e-05, 1.000000e+00, 21, 2352, 2) + ((4.752072e+00, -6.727638e+00, 4.719986e+00), (3.721510e-02, -9.647240e-01, 2.606197e-01), 5.045933e+05, 4.451092e-05, 1.000000e+00, 21, 2352, 2) + ((4.764028e+00, -7.037568e+00, 4.803713e+00), (3.721510e-02, -9.647240e-01, 2.606197e-01), 5.045933e+05, 4.451124e-05, 1.000000e+00, 22, 2352, 3) + ((4.767580e+00, -7.129630e+00, 4.828584e+00), (3.721510e-02, -9.647240e-01, 2.606197e-01), 5.045933e+05, 4.451134e-05, 1.000000e+00, 23, 2352, 1) + ((4.776502e+00, -7.360920e+00, 4.891066e+00), (3.721510e-02, -9.647240e-01, 2.606197e-01), 5.045933e+05, 4.451158e-05, 1.000000e+00, 23, 2338, 1) + ((4.778286e+00, -7.407162e+00, 4.903559e+00), (4.571054e-01, -3.889563e-01, 7.998548e-01), 1.818775e+05, 4.451163e-05, 1.000000e+00, 23, 2338, 1) + ((4.981926e+00, -7.580442e+00, 5.259893e+00), (4.571054e-01, -3.889563e-01, 7.998548e-01), 1.818775e+05, 4.451239e-05, 1.000000e+00, 22, 2338, 3) + ((5.154144e+00, -7.726985e+00, 5.561246e+00), (4.571054e-01, -3.889563e-01, 7.998548e-01), 1.818775e+05, 4.451303e-05, 1.000000e+00, 21, 2338, 2) + ((5.313757e+00, -7.862801e+00, 5.840540e+00), (4.571054e-01, -3.889563e-01, 7.998548e-01), 1.818775e+05, 4.451362e-05, 1.000000e+00, 22, 2338, 3) + ((5.485976e+00, -8.009344e+00, 6.141893e+00), (4.571054e-01, -3.889563e-01, 7.998548e-01), 1.818775e+05, 4.451426e-05, 1.000000e+00, 23, 2338, 1) + ((5.725160e+00, -8.212869e+00, 6.560424e+00), (4.571054e-01, -3.889563e-01, 7.998548e-01), 1.818775e+05, 4.451515e-05, 1.000000e+00, 23, 2339, 1) + ((6.004950e+00, -8.450945e+00, 7.050007e+00), (4.571054e-01, -3.889563e-01, 7.998548e-01), 1.818775e+05, 4.451618e-05, 1.000000e+00, 22, 2339, 3) + ((6.360530e+00, -8.753512e+00, 7.672210e+00), (4.571054e-01, -3.889563e-01, 7.998548e-01), 1.818775e+05, 4.451750e-05, 1.000000e+00, 23, 2339, 1) + ((6.646303e+00, -8.996680e+00, 8.172263e+00), (4.571054e-01, -3.889563e-01, 7.998548e-01), 1.818775e+05, 4.451856e-05, 1.000000e+00, 23, 2326, 1) + ((6.702490e+00, -9.044491e+00, 8.270582e+00), (2.028534e-01, -9.607965e-01, -1.889990e-01), 1.805295e+04, 4.451877e-05, 1.000000e+00, 23, 2326, 1) + ((6.745127e+00, -9.246436e+00, 8.230857e+00), (2.028534e-01, -9.607965e-01, -1.889990e-01), 1.805295e+04, 4.451990e-05, 1.000000e+00, 22, 2326, 3) + ((6.767219e+00, -9.351070e+00, 8.210274e+00), (2.028534e-01, -9.607965e-01, -1.889990e-01), 1.805295e+04, 4.452049e-05, 1.000000e+00, 21, 2326, 2) + ((6.885344e+00, -9.910562e+00, 8.100216e+00), (-3.857824e-01, -3.006310e-01, -8.722344e-01), 1.795765e+04, 4.452362e-05, 1.000000e+00, 21, 2326, 2) + ((6.803615e+00, -9.974251e+00, 7.915431e+00), (-7.096135e-01, 6.778415e-01, 1.923009e-01), 1.779137e+04, 4.452476e-05, 1.000000e+00, 21, 2326, 2) + ((6.334815e+00, -9.526441e+00, 8.042473e+00), (-1.748210e-01, 9.821705e-01, -6.912779e-02), 1.729669e+04, 4.452835e-05, 1.000000e+00, 21, 2326, 2) + ((6.304853e+00, -9.358111e+00, 8.030625e+00), (-1.748210e-01, 9.821705e-01, -6.912779e-02), 1.729669e+04, 4.452929e-05, 1.000000e+00, 22, 2326, 3) + ((6.288777e+00, -9.267793e+00, 8.024268e+00), (-1.748210e-01, 9.821705e-01, -6.912779e-02), 1.729669e+04, 4.452979e-05, 1.000000e+00, 23, 2326, 1) + ((6.275105e+00, -9.190979e+00, 8.018862e+00), (-7.174952e-01, 5.897531e-01, -3.706642e-01), 9.207900e+03, 4.453022e-05, 1.000000e+00, 23, 2326, 1) + ((6.038719e+00, -8.996680e+00, 7.896743e+00), (-7.174952e-01, 5.897531e-01, -3.706642e-01), 9.207900e+03, 4.453271e-05, 1.000000e+00, 23, 2339, 1) + ((6.028805e+00, -8.988531e+00, 7.891621e+00), (-2.989803e-01, 4.300779e-01, -8.518473e-01), 5.653774e+03, 4.453281e-05, 1.000000e+00, 23, 2339, 1) + ((5.725160e+00, -8.551743e+00, 7.026484e+00), (-2.989803e-01, 4.300779e-01, -8.518473e-01), 5.653774e+03, 4.454257e-05, 1.000000e+00, 23, 2338, 1) + ((5.507324e+00, -8.238390e+00, 6.405832e+00), (-2.989803e-01, 4.300779e-01, -8.518473e-01), 5.653774e+03, 4.454958e-05, 1.000000e+00, 22, 2338, 3) + ((5.417387e+00, -8.109017e+00, 6.149584e+00), (-2.989803e-01, 4.300779e-01, -8.518473e-01), 5.653774e+03, 4.455247e-05, 1.000000e+00, 21, 2338, 2) + ((5.162017e+00, -7.741671e+00, 5.421991e+00), (7.522612e-01, -1.036919e-01, -6.506543e-01), 5.619608e+03, 4.456069e-05, 1.000000e+00, 21, 2338, 2) + ((5.184146e+00, -7.744722e+00, 5.402851e+00), (7.522612e-01, -1.036919e-01, -6.506543e-01), 5.619608e+03, 4.456097e-05, 1.000000e+00, 22, 2338, 3) + ((5.348057e+00, -7.767315e+00, 5.261079e+00), (7.522612e-01, -1.036919e-01, -6.506543e-01), 5.619608e+03, 4.456307e-05, 1.000000e+00, 23, 2338, 1) + ((5.581568e+00, -7.799502e+00, 5.059108e+00), (2.029690e-01, -4.131185e-01, -8.877706e-01), 3.359662e+03, 4.456606e-05, 1.000000e+00, 23, 2338, 1) + ((5.707007e+00, -8.054818e+00, 4.510447e+00), (3.894183e-01, -7.459178e-01, -5.403333e-01), 3.303714e+03, 4.457377e-05, 1.000000e+00, 23, 2338, 1) + ((5.725160e+00, -8.089590e+00, 4.485259e+00), (3.894183e-01, -7.459178e-01, -5.403333e-01), 3.303714e+03, 4.457436e-05, 1.000000e+00, 23, 2339, 1) + ((5.750893e+00, -8.138881e+00, 4.449554e+00), (-2.879829e-01, -5.545287e-01, -7.807456e-01), 1.744626e+03, 4.457519e-05, 1.000000e+00, 23, 2339, 1) + ((5.725160e+00, -8.188431e+00, 4.379790e+00), (-2.879829e-01, -5.545287e-01, -7.807456e-01), 1.744626e+03, 4.457674e-05, 1.000000e+00, 23, 2338, 1) + ((5.532143e+00, -8.560097e+00, 3.856504e+00), (-6.185172e-01, -7.766669e-01, -1.192687e-01), 8.559363e+02, 4.458834e-05, 1.000000e+00, 23, 2338, 1) + ((5.522333e+00, -8.572415e+00, 3.854613e+00), (-3.452053e-01, -2.657159e-02, -9.381510e-01), 9.272133e+01, 4.458873e-05, 1.000000e+00, 23, 2338, 1) + ((5.366948e+00, -8.584375e+00, 3.432328e+00), (4.761677e-01, -8.187551e-01, -3.207871e-01), 6.522002e+00, 4.462253e-05, 1.000000e+00, 23, 2338, 1) + ((5.516634e+00, -8.841755e+00, 3.331487e+00), (4.237115e-01, -6.022578e-01, 6.765752e-01), 9.968491e-01, 4.471152e-05, 1.000000e+00, 23, 2338, 1) + ((5.625629e+00, -8.996680e+00, 3.505530e+00), (4.237115e-01, -6.022578e-01, 6.765752e-01), 9.968491e-01, 4.489779e-05, 1.000000e+00, 23, 2325, 1) + ((5.723424e+00, -9.135684e+00, 3.661687e+00), (7.706137e-01, -6.358415e-01, 4.312932e-02), 5.695813e-01, 4.506493e-05, 1.000000e+00, 23, 2325, 1) + ((5.725160e+00, -9.137116e+00, 3.661784e+00), (7.706137e-01, -6.358415e-01, 4.312932e-02), 5.695813e-01, 4.506708e-05, 1.000000e+00, 23, 2326, 1) + ((6.079210e+00, -9.429247e+00, 3.681599e+00), (7.706137e-01, -6.358415e-01, 4.312932e-02), 5.695813e-01, 4.550721e-05, 1.000000e+00, 22, 2326, 3) + ((6.147194e+00, -9.485341e+00, 3.685404e+00), (7.706137e-01, -6.358415e-01, 4.312932e-02), 5.695813e-01, 4.559172e-05, 1.000000e+00, 21, 2326, 2) + ((6.864744e+00, -1.007740e+01, 3.725564e+00), (3.888690e-01, -8.895503e-01, -2.397522e-01), 5.691123e-01, 4.648372e-05, 1.000000e+00, 21, 2326, 2) + ((6.908415e+00, -1.017730e+01, 3.698639e+00), (3.888690e-01, -8.895503e-01, -2.397522e-01), 5.691123e-01, 4.659135e-05, 1.000000e+00, 22, 2326, 3) + ((6.945959e+00, -1.026318e+01, 3.675492e+00), (3.888690e-01, -8.895503e-01, -2.397522e-01), 5.691123e-01, 4.668388e-05, 1.000000e+00, 23, 2326, 1) + ((6.966122e+00, -1.030930e+01, 3.663060e+00), (7.493672e-01, -6.303754e-01, 2.026713e-01), 2.849108e-01, 4.673357e-05, 1.000000e+00, 23, 2326, 1) + ((7.350254e+00, -1.063244e+01, 3.766951e+00), (7.493672e-01, -6.303754e-01, 2.026713e-01), 2.849108e-01, 4.742789e-05, 1.000000e+00, 23, 2311, 1) + ((7.360920e+00, -1.064141e+01, 3.769836e+00), (7.493672e-01, -6.303754e-01, 2.026713e-01), 2.849108e-01, 4.744717e-05, 1.000000e+00, 23, 2312, 1) + ((7.449168e+00, -1.071565e+01, 3.793703e+00), (1.626881e-01, -1.480918e-01, 9.755006e-01), 2.025207e-01, 4.760667e-05, 1.000000e+00, 23, 2312, 1) + ((7.495754e+00, -1.075805e+01, 4.073039e+00), (-1.185723e-01, -6.787603e-01, 7.247241e-01), 2.121260e-01, 4.806671e-05, 1.000000e+00, 23, 2312, 1) + ((7.451135e+00, -1.101347e+01, 4.345753e+00), (-4.978877e-01, -3.750598e-02, 8.664301e-01), 2.609768e-02, 4.865741e-05, 1.000000e+00, 23, 2312, 1) + ((7.426401e+00, -1.101533e+01, 4.388795e+00), (9.221835e-01, -6.407530e-02, 3.814078e-01), 2.031765e-02, 4.887973e-05, 1.000000e+00, 23, 2312, 1) + ((7.438938e+00, -1.101621e+01, 4.393980e+00), (8.832139e-01, 3.563144e-01, 3.049151e-01), 2.038019e-02, 4.894869e-05, 1.000000e+00, 23, 2312, 1) + ((7.578355e+00, -1.095996e+01, 4.442112e+00), (5.564936e-01, 8.135970e-01, 1.684482e-01), 4.869241e-02, 4.974811e-05, 1.000000e+00, 23, 2312, 1) + ((7.802376e+00, -1.063244e+01, 4.509922e+00), (5.564936e-01, 8.135970e-01, 1.684482e-01), 4.869241e-02, 5.106705e-05, 1.000000e+00, 23, 2327, 1) + ((7.826035e+00, -1.059785e+01, 4.517083e+00), (-8.227572e-01, -5.662268e-01, 4.957651e-02), 8.202195e-02, 5.120634e-05, 1.000000e+00, 23, 2327, 1) + ((7.775776e+00, -1.063244e+01, 4.520112e+00), (-8.227572e-01, -5.662268e-01, 4.957651e-02), 8.202195e-02, 5.136055e-05, 1.000000e+00, 23, 2312, 1) + ((7.360920e+00, -1.091795e+01, 4.545109e+00), (-8.227572e-01, -5.662268e-01, 4.957651e-02), 8.202195e-02, 5.263343e-05, 1.000000e+00, 23, 2311, 1) + ((7.180267e+00, -1.104227e+01, 4.555995e+00), (5.568446e-01, -6.706436e-01, -4.900625e-01), 5.560680e-02, 5.318772e-05, 1.000000e+00, 23, 2311, 1) + ((7.207392e+00, -1.107494e+01, 4.532123e+00), (9.936512e-01, 4.529367e-02, -1.029847e-01), 8.142074e-02, 5.333706e-05, 1.000000e+00, 23, 2311, 1) + ((7.252245e+00, -1.107290e+01, 4.527474e+00), (9.936512e-01, 4.529367e-02, -1.029847e-01), 8.142074e-02, 5.345144e-05, 0.000000e+00, 23, 2311, 1)] diff --git a/tests/regression_tests/translation/results_true.dat b/tests/regression_tests/translation/results_true.dat index f832aa296..6e03d2224 100644 --- a/tests/regression_tests/translation/results_true.dat +++ b/tests/regression_tests/translation/results_true.dat @@ -1,2 +1,2 @@ k-combined: -4.087580E-01 4.466279E-03 +4.076610E-01 6.454244E-03 diff --git a/tests/regression_tests/trigger_batch_interval/results_true.dat b/tests/regression_tests/trigger_batch_interval/results_true.dat index 0571d6c4f..92fa99d87 100644 --- a/tests/regression_tests/trigger_batch_interval/results_true.dat +++ b/tests/regression_tests/trigger_batch_interval/results_true.dat @@ -1,28 +1,28 @@ k-combined: -9.767929E-01 5.327552E-03 +9.863217E-01 6.499354E-03 tally 1: -1.405471E+01 -1.976444E+01 -3.186139E+00 -1.015515E+00 -3.088643E+00 -9.542994E-01 -1.086857E+01 -1.182011E+01 -1.405471E+01 -1.976444E+01 -3.186139E+00 -1.015515E+00 -3.088643E+00 -9.542994E-01 -1.086857E+01 -1.182011E+01 +1.423436E+01 +2.027258E+01 +3.223740E+00 +1.039872E+00 +3.125016E+00 +9.771709E-01 +1.101062E+01 +1.212977E+01 +1.423436E+01 +2.027258E+01 +3.223740E+00 +1.039872E+00 +3.125016E+00 +9.771709E-01 +1.101062E+01 +1.212977E+01 tally 2: -1.405471E+01 -1.976444E+01 -3.186139E+00 -1.015515E+00 -3.088643E+00 -9.542994E-01 -1.086857E+01 -1.182011E+01 +1.423436E+01 +2.027258E+01 +3.223740E+00 +1.039872E+00 +3.125016E+00 +9.771709E-01 +1.101062E+01 +1.212977E+01 diff --git a/tests/regression_tests/trigger_no_batch_interval/results_true.dat b/tests/regression_tests/trigger_no_batch_interval/results_true.dat index 0571d6c4f..92fa99d87 100644 --- a/tests/regression_tests/trigger_no_batch_interval/results_true.dat +++ b/tests/regression_tests/trigger_no_batch_interval/results_true.dat @@ -1,28 +1,28 @@ k-combined: -9.767929E-01 5.327552E-03 +9.863217E-01 6.499354E-03 tally 1: -1.405471E+01 -1.976444E+01 -3.186139E+00 -1.015515E+00 -3.088643E+00 -9.542994E-01 -1.086857E+01 -1.182011E+01 -1.405471E+01 -1.976444E+01 -3.186139E+00 -1.015515E+00 -3.088643E+00 -9.542994E-01 -1.086857E+01 -1.182011E+01 +1.423436E+01 +2.027258E+01 +3.223740E+00 +1.039872E+00 +3.125016E+00 +9.771709E-01 +1.101062E+01 +1.212977E+01 +1.423436E+01 +2.027258E+01 +3.223740E+00 +1.039872E+00 +3.125016E+00 +9.771709E-01 +1.101062E+01 +1.212977E+01 tally 2: -1.405471E+01 -1.976444E+01 -3.186139E+00 -1.015515E+00 -3.088643E+00 -9.542994E-01 -1.086857E+01 -1.182011E+01 +1.423436E+01 +2.027258E+01 +3.223740E+00 +1.039872E+00 +3.125016E+00 +9.771709E-01 +1.101062E+01 +1.212977E+01 diff --git a/tests/regression_tests/trigger_no_status/results_true.dat b/tests/regression_tests/trigger_no_status/results_true.dat index fb6c0086a..a62e1b3fe 100644 --- a/tests/regression_tests/trigger_no_status/results_true.dat +++ b/tests/regression_tests/trigger_no_status/results_true.dat @@ -1,28 +1,28 @@ k-combined: -9.682315E-01 3.302924E-03 +9.858966E-01 1.500542E-02 tally 1: -7.046510E+00 -9.932168E+00 -1.591675E+00 -5.067777E-01 -1.541572E+00 -4.753743E-01 -5.454835E+00 -5.951990E+00 -7.046510E+00 -9.932168E+00 -1.591675E+00 -5.067777E-01 -1.541572E+00 -4.753743E-01 -5.454835E+00 -5.951990E+00 +7.081828E+00 +1.003709E+01 +1.607382E+00 +5.171386E-01 +1.559242E+00 +4.866413E-01 +5.474447E+00 +5.997737E+00 +7.081828E+00 +1.003709E+01 +1.607382E+00 +5.171386E-01 +1.559242E+00 +4.866413E-01 +5.474447E+00 +5.997737E+00 tally 2: -7.046510E+00 -9.932168E+00 -1.591675E+00 -5.067777E-01 -1.541572E+00 -4.753743E-01 -5.454835E+00 -5.951990E+00 +7.081828E+00 +1.003709E+01 +1.607382E+00 +5.171386E-01 +1.559242E+00 +4.866413E-01 +5.474447E+00 +5.997737E+00 diff --git a/tests/regression_tests/trigger_statepoint_restart/inputs_true.dat b/tests/regression_tests/trigger_statepoint_restart/inputs_true.dat index 6f0b629eb..59a829700 100644 --- a/tests/regression_tests/trigger_statepoint_restart/inputs_true.dat +++ b/tests/regression_tests/trigger_statepoint_restart/inputs_true.dat @@ -1,14 +1,14 @@ - - - + + + - + eigenvalue @@ -16,7 +16,7 @@ 15 10 - 0.003 + 0.002 std_dev diff --git a/tests/regression_tests/trigger_statepoint_restart/results_true.dat b/tests/regression_tests/trigger_statepoint_restart/results_true.dat index 3e6619d74..3cb1e230d 100644 --- a/tests/regression_tests/trigger_statepoint_restart/results_true.dat +++ b/tests/regression_tests/trigger_statepoint_restart/results_true.dat @@ -1,5 +1,5 @@ k-combined: -3.014717E-01 2.864764E-03 +2.948661E-01 1.949846E-03 tally 1: -8.946107E+01 -7.281263E+02 +5.515170E+01 +4.349007E+02 diff --git a/tests/regression_tests/trigger_statepoint_restart/test.py b/tests/regression_tests/trigger_statepoint_restart/test.py index 8144c1d0b..b242f7f1c 100644 --- a/tests/regression_tests/trigger_statepoint_restart/test.py +++ b/tests/regression_tests/trigger_statepoint_restart/test.py @@ -29,7 +29,7 @@ def model(): settings.inactive = 10 settings.particles = 400 # Choose a sufficiently low threshold to enable use of trigger - settings.keff_trigger = {'type': 'std_dev', 'threshold': 0.003} + settings.keff_trigger = {'type': 'std_dev', 'threshold': 0.002} settings.trigger_max_batches = 1000 settings.trigger_batch_interval = 1 settings.trigger_active = True @@ -41,10 +41,10 @@ def model(): tallies = openmc.Tallies([t]) # Put it all together - model = openmc.model.Model(materials=materials, - geometry=geometry, - settings=settings, - tallies=tallies) + model = openmc.Model(materials=materials, + geometry=geometry, + settings=settings, + tallies=tallies) return model diff --git a/tests/regression_tests/trigger_tallies/results_true.dat b/tests/regression_tests/trigger_tallies/results_true.dat index 0571d6c4f..92fa99d87 100644 --- a/tests/regression_tests/trigger_tallies/results_true.dat +++ b/tests/regression_tests/trigger_tallies/results_true.dat @@ -1,28 +1,28 @@ k-combined: -9.767929E-01 5.327552E-03 +9.863217E-01 6.499354E-03 tally 1: -1.405471E+01 -1.976444E+01 -3.186139E+00 -1.015515E+00 -3.088643E+00 -9.542994E-01 -1.086857E+01 -1.182011E+01 -1.405471E+01 -1.976444E+01 -3.186139E+00 -1.015515E+00 -3.088643E+00 -9.542994E-01 -1.086857E+01 -1.182011E+01 +1.423436E+01 +2.027258E+01 +3.223740E+00 +1.039872E+00 +3.125016E+00 +9.771709E-01 +1.101062E+01 +1.212977E+01 +1.423436E+01 +2.027258E+01 +3.223740E+00 +1.039872E+00 +3.125016E+00 +9.771709E-01 +1.101062E+01 +1.212977E+01 tally 2: -1.405471E+01 -1.976444E+01 -3.186139E+00 -1.015515E+00 -3.088643E+00 -9.542994E-01 -1.086857E+01 -1.182011E+01 +1.423436E+01 +2.027258E+01 +3.223740E+00 +1.039872E+00 +3.125016E+00 +9.771709E-01 +1.101062E+01 +1.212977E+01 diff --git a/tests/regression_tests/triso/inputs_true.dat b/tests/regression_tests/triso/inputs_true.dat index 37f37af78..c96684568 100644 --- a/tests/regression_tests/triso/inputs_true.dat +++ b/tests/regression_tests/triso/inputs_true.dat @@ -1,38 +1,38 @@ - - - - - - + + + + + + - - + + - - + + - - - - - + + + + + - - + + - - + + @@ -42,171 +42,171 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -253,187 +253,187 @@ 24 25 26 21 22 23 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + eigenvalue 100 4 0 - + 0.0 0.0 0.0 diff --git a/tests/regression_tests/triso/results_true.dat b/tests/regression_tests/triso/results_true.dat index fa1842e54..d9850e410 100644 --- a/tests/regression_tests/triso/results_true.dat +++ b/tests/regression_tests/triso/results_true.dat @@ -1,2 +1,2 @@ k-combined: -1.716873E+00 5.266107E-02 +1.604832E+00 2.031393E-03 diff --git a/tests/regression_tests/uniform_fs/results_true.dat b/tests/regression_tests/uniform_fs/results_true.dat index 46654b49b..f7ceecfb7 100644 --- a/tests/regression_tests/uniform_fs/results_true.dat +++ b/tests/regression_tests/uniform_fs/results_true.dat @@ -1,2 +1,2 @@ k-combined: -3.685309E-01 1.861720E-03 +3.675645E-01 4.342970E-03 diff --git a/tests/regression_tests/universe/results_true.dat b/tests/regression_tests/universe/results_true.dat index bbf03de94..97b997ae6 100644 --- a/tests/regression_tests/universe/results_true.dat +++ b/tests/regression_tests/universe/results_true.dat @@ -1,2 +1,2 @@ k-combined: -3.070134E-01 3.900396E-03 +2.940336E-01 7.338463E-04 diff --git a/tests/regression_tests/unstructured_mesh/inputs_true.dat b/tests/regression_tests/unstructured_mesh/inputs_true.dat index 07486d3e0..e7a485b4d 100644 --- a/tests/regression_tests/unstructured_mesh/inputs_true.dat +++ b/tests/regression_tests/unstructured_mesh/inputs_true.dat @@ -1,54 +1,54 @@ - - - + + + - - - - - - + + + + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + fixed source 1000 10 - - - + + + 1.0 1.0 @@ -67,7 +67,7 @@ -10.0 -10.0 -10.0 10.0 10.0 10.0 - + test_mesh_hexes.e diff --git a/tests/regression_tests/unstructured_mesh/inputs_true0.dat b/tests/regression_tests/unstructured_mesh/inputs_true0.dat index c6b28d890..2508c25b3 100644 --- a/tests/regression_tests/unstructured_mesh/inputs_true0.dat +++ b/tests/regression_tests/unstructured_mesh/inputs_true0.dat @@ -1,54 +1,54 @@ - - - + + + - - - - - - + + + + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + fixed source 1000 10 - - - + + + 1.0 1.0 @@ -67,7 +67,7 @@ -10.0 -10.0 -10.0 10.0 10.0 10.0 - + test_mesh_tets_w_holes.e diff --git a/tests/regression_tests/unstructured_mesh/inputs_true1.dat b/tests/regression_tests/unstructured_mesh/inputs_true1.dat index 40183c89b..04bbdb4b2 100644 --- a/tests/regression_tests/unstructured_mesh/inputs_true1.dat +++ b/tests/regression_tests/unstructured_mesh/inputs_true1.dat @@ -1,54 +1,54 @@ - - - + + + - - - - - - + + + + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + fixed source 1000 10 - - - + + + 1.0 1.0 @@ -67,7 +67,7 @@ -10.0 -10.0 -10.0 10.0 10.0 10.0 - + test_mesh_tets.e diff --git a/tests/regression_tests/unstructured_mesh/inputs_true10.dat b/tests/regression_tests/unstructured_mesh/inputs_true10.dat index 81dfbdc52..169f0a6b4 100644 --- a/tests/regression_tests/unstructured_mesh/inputs_true10.dat +++ b/tests/regression_tests/unstructured_mesh/inputs_true10.dat @@ -1,54 +1,54 @@ - - - + + + - - - - - - + + + + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + fixed source 1000 10 - - - + + + 1.0 1.0 @@ -67,7 +67,7 @@ -10.0 -10.0 -10.0 10.0 10.0 10.0 - + test_mesh_tets_w_holes.e diff --git a/tests/regression_tests/unstructured_mesh/inputs_true11.dat b/tests/regression_tests/unstructured_mesh/inputs_true11.dat index b224a3ebc..8163750ca 100644 --- a/tests/regression_tests/unstructured_mesh/inputs_true11.dat +++ b/tests/regression_tests/unstructured_mesh/inputs_true11.dat @@ -1,54 +1,54 @@ - - - + + + - - - - - - + + + + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + fixed source 1000 10 - - - + + + 1.0 1.0 @@ -67,7 +67,7 @@ -10.0 -10.0 -10.0 10.0 10.0 10.0 - + test_mesh_tets.e diff --git a/tests/regression_tests/unstructured_mesh/inputs_true12.dat b/tests/regression_tests/unstructured_mesh/inputs_true12.dat index a18aee627..be0655e98 100644 --- a/tests/regression_tests/unstructured_mesh/inputs_true12.dat +++ b/tests/regression_tests/unstructured_mesh/inputs_true12.dat @@ -1,54 +1,54 @@ - - - + + + - - - - - - + + + + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + fixed source 1000 10 - - - + + + 1.0 1.0 @@ -67,7 +67,7 @@ -10.0 -10.0 -10.0 10.0 10.0 10.0 - + test_mesh_tets_w_holes.e diff --git a/tests/regression_tests/unstructured_mesh/inputs_true13.dat b/tests/regression_tests/unstructured_mesh/inputs_true13.dat index 0e9123c90..42c0cc122 100644 --- a/tests/regression_tests/unstructured_mesh/inputs_true13.dat +++ b/tests/regression_tests/unstructured_mesh/inputs_true13.dat @@ -1,54 +1,54 @@ - - - + + + - - - - - - + + + + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + fixed source 1000 10 - - - + + + 1.0 1.0 @@ -67,7 +67,7 @@ -10.0 -10.0 -10.0 10.0 10.0 10.0 - + test_mesh_tets.e diff --git a/tests/regression_tests/unstructured_mesh/inputs_true14.dat b/tests/regression_tests/unstructured_mesh/inputs_true14.dat index 9d4db4904..a27c7445d 100644 --- a/tests/regression_tests/unstructured_mesh/inputs_true14.dat +++ b/tests/regression_tests/unstructured_mesh/inputs_true14.dat @@ -1,54 +1,54 @@ - - - + + + - - - - - - + + + + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + fixed source 1000 10 - - - + + + 1.0 1.0 @@ -67,7 +67,7 @@ -10.0 -10.0 -10.0 10.0 10.0 10.0 - + test_mesh_tets_w_holes.e diff --git a/tests/regression_tests/unstructured_mesh/inputs_true15.dat b/tests/regression_tests/unstructured_mesh/inputs_true15.dat index eab97b952..c69bd15d0 100644 --- a/tests/regression_tests/unstructured_mesh/inputs_true15.dat +++ b/tests/regression_tests/unstructured_mesh/inputs_true15.dat @@ -1,54 +1,54 @@ - - - + + + - - - - - - + + + + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + fixed source 1000 10 - - - + + + 1.0 1.0 @@ -67,7 +67,7 @@ -10.0 -10.0 -10.0 10.0 10.0 10.0 - + test_mesh_tets.e diff --git a/tests/regression_tests/unstructured_mesh/inputs_true2.dat b/tests/regression_tests/unstructured_mesh/inputs_true2.dat index 3521ac7b8..ba9d477b5 100644 --- a/tests/regression_tests/unstructured_mesh/inputs_true2.dat +++ b/tests/regression_tests/unstructured_mesh/inputs_true2.dat @@ -1,54 +1,54 @@ - - - + + + - - - - - - + + + + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + fixed source 1000 10 - - - + + + 1.0 1.0 @@ -67,7 +67,7 @@ -10.0 -10.0 -10.0 10.0 10.0 10.0 - + test_mesh_tets_w_holes.e diff --git a/tests/regression_tests/unstructured_mesh/inputs_true3.dat b/tests/regression_tests/unstructured_mesh/inputs_true3.dat index a376b401d..d840bfa09 100644 --- a/tests/regression_tests/unstructured_mesh/inputs_true3.dat +++ b/tests/regression_tests/unstructured_mesh/inputs_true3.dat @@ -1,54 +1,54 @@ - - - + + + - - - - - - + + + + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + fixed source 1000 10 - - - + + + 1.0 1.0 @@ -67,7 +67,7 @@ -10.0 -10.0 -10.0 10.0 10.0 10.0 - + test_mesh_tets.e diff --git a/tests/regression_tests/unstructured_mesh/inputs_true4.dat b/tests/regression_tests/unstructured_mesh/inputs_true4.dat index 843632fdd..db8e37177 100644 --- a/tests/regression_tests/unstructured_mesh/inputs_true4.dat +++ b/tests/regression_tests/unstructured_mesh/inputs_true4.dat @@ -1,54 +1,54 @@ - - - + + + - - - - - - - + + + + + + + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + fixed source - 100 + 1000 10 - - - + + + 1.0 1.0 @@ -56,34 +56,33 @@ 0.0 1.0 - 15000000.0 1.0 - + 10 10 10 -10.0 -10.0 -10.0 10.0 10.0 10.0 - - test_mesh_tets_w_holes.exo + + test_mesh_tets_w_holes.e - - 9 + + 1 - - 10 + + 2 - - 9 + + 1 flux tracklength - - 10 + + 2 flux tracklength diff --git a/tests/regression_tests/unstructured_mesh/inputs_true5.dat b/tests/regression_tests/unstructured_mesh/inputs_true5.dat index dc9129d98..b2bbc7e16 100644 --- a/tests/regression_tests/unstructured_mesh/inputs_true5.dat +++ b/tests/regression_tests/unstructured_mesh/inputs_true5.dat @@ -1,54 +1,54 @@ - - - + + + - - - - - - - + + + + + + + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + fixed source - 100 + 1000 10 - - - + + + 1.0 1.0 @@ -56,34 +56,33 @@ 0.0 1.0 - 15000000.0 1.0 - + 10 10 10 -10.0 -10.0 -10.0 10.0 10.0 10.0 - - test_mesh_tets.exo + + test_mesh_tets.e - - 11 + + 1 - - 12 + + 2 - - 11 + + 1 flux tracklength - - 12 + + 2 flux tracklength diff --git a/tests/regression_tests/unstructured_mesh/inputs_true6.dat b/tests/regression_tests/unstructured_mesh/inputs_true6.dat index 82bc30703..d6ad0d98d 100644 --- a/tests/regression_tests/unstructured_mesh/inputs_true6.dat +++ b/tests/regression_tests/unstructured_mesh/inputs_true6.dat @@ -1,54 +1,54 @@ - - - + + + - - - - - - - + + + + + + + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + fixed source - 100 + 1000 10 - - - + + + 1.0 1.0 @@ -56,34 +56,33 @@ 0.0 1.0 - 15000000.0 1.0 - + 10 10 10 -10.0 -10.0 -10.0 10.0 10.0 10.0 - - test_mesh_tets_w_holes.exo + + test_mesh_tets_w_holes.e - - 13 + + 1 - - 14 + + 2 - - 13 + + 1 flux tracklength - - 14 + + 2 flux tracklength diff --git a/tests/regression_tests/unstructured_mesh/inputs_true7.dat b/tests/regression_tests/unstructured_mesh/inputs_true7.dat index b982c40d0..924790a8c 100644 --- a/tests/regression_tests/unstructured_mesh/inputs_true7.dat +++ b/tests/regression_tests/unstructured_mesh/inputs_true7.dat @@ -1,54 +1,54 @@ - - - + + + - - - - - - - + + + + + + + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + fixed source - 100 + 1000 10 - - - + + + 1.0 1.0 @@ -56,34 +56,33 @@ 0.0 1.0 - 15000000.0 1.0 - + 10 10 10 -10.0 -10.0 -10.0 10.0 10.0 10.0 - - test_mesh_tets.exo + + test_mesh_tets.e - - 15 + + 1 - - 16 + + 2 - - 15 + + 1 flux tracklength - - 16 + + 2 flux tracklength diff --git a/tests/regression_tests/unstructured_mesh/inputs_true8.dat b/tests/regression_tests/unstructured_mesh/inputs_true8.dat index 7994e1add..c04beb211 100644 --- a/tests/regression_tests/unstructured_mesh/inputs_true8.dat +++ b/tests/regression_tests/unstructured_mesh/inputs_true8.dat @@ -1,54 +1,54 @@ - - - + + + - - - - - - + + + + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + fixed source 1000 10 - - - + + + 1.0 1.0 @@ -67,7 +67,7 @@ -10.0 -10.0 -10.0 10.0 10.0 10.0 - + test_mesh_tets_w_holes.e diff --git a/tests/regression_tests/unstructured_mesh/inputs_true9.dat b/tests/regression_tests/unstructured_mesh/inputs_true9.dat index 4fff123d7..111898ff2 100644 --- a/tests/regression_tests/unstructured_mesh/inputs_true9.dat +++ b/tests/regression_tests/unstructured_mesh/inputs_true9.dat @@ -1,54 +1,54 @@ - - - + + + - - - - - - + + + + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + fixed source 1000 10 - - - + + + 1.0 1.0 @@ -67,7 +67,7 @@ -10.0 -10.0 -10.0 10.0 10.0 10.0 - + test_mesh_tets.e diff --git a/tests/regression_tests/unstructured_mesh/test.py b/tests/regression_tests/unstructured_mesh/test.py index 0082198dd..7607531d8 100644 --- a/tests/regression_tests/unstructured_mesh/test.py +++ b/tests/regression_tests/unstructured_mesh/test.py @@ -256,7 +256,7 @@ for i, (lib, estimator, ext_geom, holes) in enumerate(product(*param_values)): def test_unstructured_mesh_tets(model, test_opts): # skip the test if the library is not enabled if test_opts['library'] == 'moab' and not openmc.lib._dagmc_enabled(): - pytest.skip("DAGMC (and MOAB) mesh not enbaled in this build.") + pytest.skip("DAGMC (and MOAB) mesh not enabled in this build.") if test_opts['library'] == 'libmesh' and not openmc.lib._libmesh_enabled(): pytest.skip("LibMesh is not enabled in this build.") diff --git a/tests/regression_tests/unstructured_mesh/test_mesh_dagmc_tets.vtk b/tests/regression_tests/unstructured_mesh/test_mesh_dagmc_tets.vtk new file mode 100644 index 000000000..2ddd228cf --- /dev/null +++ b/tests/regression_tests/unstructured_mesh/test_mesh_dagmc_tets.vtk @@ -0,0 +1,159 @@ +# vtk DataFile Version 2.0 +made_with_cad_to_dagmc_package, Created by Gmsh 4.12.1 +ASCII +DATASET UNSTRUCTURED_GRID +POINTS 14 double +-0.5 -0.5 0.5 +-0.5 -0.5 -0.5 +-0.5 0.5 0.5 +-0.5 0.5 -0.5 +0.5 -0.5 0.5 +0.5 -0.5 -0.5 +0.5 0.5 0.5 +0.5 0.5 -0.5 +-0.5 0 0 +0.5 0 0 +0 -0.5 0 +0 0.5 0 +0 0 -0.5 +0 0 0.5 + +CELLS 68 268 +1 0 +1 1 +1 2 +1 3 +1 4 +1 5 +1 6 +1 7 +2 1 0 +2 0 2 +2 3 2 +2 1 3 +2 5 4 +2 4 6 +2 7 6 +2 5 7 +2 1 5 +2 0 4 +2 3 7 +2 2 6 +3 1 0 8 +3 0 2 8 +3 3 1 8 +3 2 3 8 +3 5 9 4 +3 4 9 6 +3 7 9 5 +3 6 9 7 +3 0 1 10 +3 4 0 10 +3 1 5 10 +3 5 4 10 +3 2 11 3 +3 6 11 2 +3 3 11 7 +3 7 11 6 +3 1 3 12 +3 5 1 12 +3 3 7 12 +3 7 5 12 +3 0 13 2 +3 4 13 0 +3 2 13 6 +3 6 13 4 +4 13 8 12 10 +4 11 8 12 13 +4 12 11 13 9 +4 10 12 13 9 +4 12 3 11 7 +4 13 2 8 0 +4 8 12 1 3 +4 11 3 8 2 +4 10 8 1 0 +4 0 10 13 4 +4 1 12 10 5 +4 11 2 13 6 +4 4 9 13 6 +4 6 9 11 7 +4 10 9 4 5 +4 7 9 12 5 +4 3 8 12 11 +4 1 12 8 10 +4 8 11 2 13 +4 10 13 8 0 +4 13 10 9 4 +4 11 13 9 6 +4 12 11 9 7 +4 9 10 12 5 + +CELL_TYPES 68 +1 +1 +1 +1 +1 +1 +1 +1 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +3 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +5 +10 +10 +10 +10 +10 +10 +10 +10 +10 +10 +10 +10 +10 +10 +10 +10 +10 +10 +10 +10 +10 +10 +10 +10 diff --git a/tests/regression_tests/void/inputs_true.dat b/tests/regression_tests/void/inputs_true.dat index 7fee0779e..cd2d14206 100644 --- a/tests/regression_tests/void/inputs_true.dat +++ b/tests/regression_tests/void/inputs_true.dat @@ -2,8 +2,8 @@ - - + + @@ -58,62 +58,62 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + fixed source 1000 3 - + 0.0 0.0 0.0 diff --git a/tests/regression_tests/volume_calc/inputs_true.dat b/tests/regression_tests/volume_calc/inputs_true.dat index e3a8162e3..ed7024c57 100644 --- a/tests/regression_tests/volume_calc/inputs_true.dat +++ b/tests/regression_tests/volume_calc/inputs_true.dat @@ -2,27 +2,27 @@ - - - - + + + + - - - - + + + + - - - - - + + + + + volume @@ -53,7 +53,7 @@ 100 -1.0 -1.0 -6.0 1.0 1.0 6.0 - + material @@ -61,7 +61,7 @@ 100 -1.0 -1.0 -6.0 1.0 1.0 6.0 - + cell @@ -69,7 +69,7 @@ 100 -1.0 -1.0 -6.0 1.0 1.0 6.0 - + diff --git a/tests/regression_tests/volume_calc/inputs_true_mg.dat b/tests/regression_tests/volume_calc/inputs_true_mg.dat index 2ace5cd3c..127566084 100644 --- a/tests/regression_tests/volume_calc/inputs_true_mg.dat +++ b/tests/regression_tests/volume_calc/inputs_true_mg.dat @@ -3,26 +3,26 @@ mg_lib.h5 - - - - + + + + - - - - + + + + - - - - - + + + + + volume @@ -54,7 +54,7 @@ 100 -1.0 -1.0 -6.0 1.0 1.0 6.0 - + material @@ -62,7 +62,7 @@ 100 -1.0 -1.0 -6.0 1.0 1.0 6.0 - + cell @@ -70,7 +70,7 @@ 100 -1.0 -1.0 -6.0 1.0 1.0 6.0 - + diff --git a/tests/regression_tests/weightwindows/generators/test.py b/tests/regression_tests/weightwindows/generators/test.py index d6a40b44f..4dc0ab80d 100644 --- a/tests/regression_tests/weightwindows/generators/test.py +++ b/tests/regression_tests/weightwindows/generators/test.py @@ -46,14 +46,14 @@ def test_ww_generator(run_in_tmpdir): # just test that the generation happens successfully here assert os.path.exists('weight_windows.h5') - wws_mean = openmc.hdf5_to_wws() + wws_mean = openmc.WeightWindowsList.from_hdf5() assert len(wws_mean) == 1 # check that generation using the relative error works too wwg.update_parameters['value'] = 'rel_err' model.run() - wws_rel_err = openmc.hdf5_to_wws() + wws_rel_err = openmc.WeightWindowsList.from_hdf5() assert len(wws_rel_err) == 1 # we should not get the same set of weight windows when switching to use of diff --git a/tests/regression_tests/weightwindows/inputs_true.dat b/tests/regression_tests/weightwindows/inputs_true.dat index dcc41ae84..eb9393179 100644 --- a/tests/regression_tests/weightwindows/inputs_true.dat +++ b/tests/regression_tests/weightwindows/inputs_true.dat @@ -2,39 +2,39 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - + + fixed source 200 2 - + 0.001 0.001 0.001 @@ -49,7 +49,7 @@ 0.0 0.5 20000000.0 -1.0 0.007673145137236567 6.542700644645627e-07 0.0017541380096893788 0.0007245451610090619 7.476545089278482e-06 2.253382683081525e-06 2.1040609012865134e-05 0.08285899874014539 -1.0 1.0262431550731535e-13 3.3164825349503764e-16 0.0064803314120165335 3.5981031766416143e-06 -1.0 1.6205064883026195e-11 1.7770136411255912e-05 0.0001670700632870335 4.323138781337963e-05 -1.0 -1.0 6.922231352729155e-05 0.06550426960512012 -1.0 2.5639656866250453e-06 1.4508262073256659e-13 -1.0 -1.0 0.0009127050763987511 3.8523247550378815e-12 -1.0 0.0008175033526488423 -1.0 0.015148978428271613 2.5157355790201773e-07 2.1612150425221703e-06 1.3181562352445092e-10 2.9282097947816224e-05 2.762955748645507e-05 2.936268747135548e-14 1.6859219614058024e-19 3.937160538176268e-07 2.6011787393916806e-06 0.001570829313580841 -1.0 1.7041669224797384e-09 1.6421491993751715e-11 0.4899999304038166 6.948292975998466e-07 -1.0 -1.0 0.08657573566388353 0.006639379668946672 1.681305446488884e-11 2.2487617828938326e-05 4.109066205029878e-05 0.08288806458368345 -1.0 0.007385384405891666 -1.0 -1.0 1.008394964750947e-06 6.655926357459275e-08 0.0016279794552427574 1.4825219199133353e-12 -1.0 1.93847081892941e-05 1.284759166582202e-05 5.1161740516205715e-05 2.5447281241730366e-07 3.853097455417877e-06 -1.0 8.887234042637684e-05 0.01621821782442112 -1.0 1.8747824667478637e-14 5.97653814110781e-06 -1.0 -1.0 1.2296747260635405e-06 -1.0 -1.0 7.754700849337902e-06 7.091263906557291e-05 3.2799045883372075e-06 0.00020573181450240786 5.6949597066784976e-05 1.271128669411295e-07 0.0010019432401508087 -1.0 -1.0 6.848642863465585e-07 5.783974359937857e-06 2.380955631371226e-06 4.756872959630257e-05 2.1360401784344975e-18 0.00046029617115127556 1.0092905083158804e-11 0.08095280568305474 3.89841667138598e-08 4.354946981329799e-05 -1.0 0.5 0.0015447823995470042 -1.0 -1.0 0.001959411999677113 0.48573842213878143 -1.0 7.962899789920809e-06 5.619835883512353e-14 0.0835648710074336 2.7207433165796702e-11 0.00027464244062887683 4.076762579823379e-17 2.124999182004655e-05 8.037131813528501e-07 8.846493399850663e-06 1.080711295768551e-05 -1.0 -1.0 0.0010737081832502356 2.679340942769232e-06 2.1648918040467363e-05 0.0002668579837809081 1.3455341306162382e-05 2.5629068330446215e-05 1.3228013765525015e-05 -1.0 -1.0 7.002861620919232e-08 1.5172912057312398e-14 -1.0 7.989579285134734e-06 2.639268952045579e-10 -1.0 0.013330619853379314 0.00021534568699157805 2.4469456008493614e-09 8.211982683649991e-09 1.951356547084204e-15 0.00016419031150495913 5.985108617124989e-06 1.28584557092134e-05 1.5476769237571295e-14 5.5379154134462336e-08 0.0016637126543321873 2.499931357628383e-07 8.020767115181574e-07 2.7697233171399416e-13 -1.0 0.007197662162700777 -1.0 0.0833931797381589 2.8226276944532696e-05 3.353295403842037e-05 5.504813693036933e-12 0.007136750029575816 0.08636569925236791 -1.0 -1.0 6.315154082213375e-07 0.4877856021170283 -1.0 3.7051518220083886e-06 -1.0 0.0017950613169359904 7.84289689494925e-06 9.041149893307806e-07 -1.0 8.48176145671274e-10 9.03108551826469e-05 3.634644995026692e-05 2.0295213621716706e-09 1.0305672698745657e-11 1.5550455959178486e-06 0.01664109232689093 8.533030345699353e-17 0.0009252532821720597 -1.0 7.695031155172816e-14 0.0007151459162818186 -1.0 -1.0 5.182269672663266e-10 3.0160758454323657e-07 -1.0 0.06539005235506369 3.452537179033895e-05 -1.0 -1.0 3.855884234344845e-06 0.00017699858357744463 2.594951085377588e-06 1.1333627604823673e-09 -1.0 2.4306375693722205e-06 0.0063790654507599135 2.2060992580622125e-11 -1.0 -1.0 0.0848872967381878 3.932389299316285e-06 1.2911827198500372e-08 1.957092814065688e-05 0.0007213722022489493 0.0018327593437608 1.6699254277734109e-06 0.007188410694198128 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -10.0 0.07673145137236567 6.5427006446456266e-06 0.017541380096893787 0.0072454516100906195 7.476545089278483e-05 2.253382683081525e-05 0.00021040609012865135 0.828589987401454 -10.0 1.0262431550731535e-12 3.3164825349503764e-15 0.06480331412016534 3.5981031766416144e-05 -10.0 1.6205064883026195e-10 0.0001777013641125591 0.001670700632870335 0.0004323138781337963 -10.0 -10.0 0.0006922231352729155 0.6550426960512012 -10.0 2.5639656866250452e-05 1.4508262073256658e-12 -10.0 -10.0 0.009127050763987512 3.852324755037882e-11 -10.0 0.008175033526488424 -10.0 0.15148978428271614 2.515735579020177e-06 2.1612150425221703e-05 1.3181562352445092e-09 0.00029282097947816227 0.0002762955748645507 2.9362687471355483e-13 1.6859219614058023e-18 3.937160538176268e-06 2.6011787393916804e-05 0.015708293135808408 -10.0 1.7041669224797384e-08 1.6421491993751715e-10 4.899999304038166 6.948292975998466e-06 -10.0 -10.0 0.8657573566388354 0.06639379668946672 1.681305446488884e-10 0.00022487617828938325 0.0004109066205029878 0.8288806458368345 -10.0 0.07385384405891665 -10.0 -10.0 1.0083949647509469e-05 6.655926357459275e-07 0.016279794552427576 1.4825219199133352e-11 -10.0 0.000193847081892941 0.0001284759166582202 0.0005116174051620571 2.5447281241730365e-06 3.853097455417877e-05 -10.0 0.0008887234042637684 0.16218217824421122 -10.0 1.8747824667478637e-13 5.97653814110781e-05 -10.0 -10.0 1.2296747260635405e-05 -10.0 -10.0 7.754700849337902e-05 0.0007091263906557291 3.2799045883372076e-05 0.0020573181450240785 0.0005694959706678497 1.271128669411295e-06 0.010019432401508087 -10.0 -10.0 6.848642863465585e-06 5.7839743599378564e-05 2.380955631371226e-05 0.0004756872959630257 2.1360401784344976e-17 0.004602961711512756 1.0092905083158804e-10 0.8095280568305474 3.89841667138598e-07 0.00043549469813297995 -10.0 5.0 0.015447823995470043 -10.0 -10.0 0.01959411999677113 4.8573842213878144 -10.0 7.96289978992081e-05 5.619835883512353e-13 0.8356487100743359 2.7207433165796704e-10 0.002746424406288768 4.076762579823379e-16 0.00021249991820046548 8.037131813528501e-06 8.846493399850663e-05 0.0001080711295768551 -10.0 -10.0 0.010737081832502356 2.679340942769232e-05 0.00021648918040467362 0.0026685798378090807 0.00013455341306162382 0.00025629068330446217 0.00013228013765525016 -10.0 -10.0 7.002861620919232e-07 1.51729120573124e-13 -10.0 7.989579285134734e-05 2.639268952045579e-09 -10.0 0.13330619853379314 0.0021534568699157807 2.4469456008493615e-08 8.211982683649991e-08 1.951356547084204e-14 0.0016419031150495913 5.985108617124989e-05 0.000128584557092134 1.5476769237571296e-13 5.537915413446234e-07 0.016637126543321872 2.499931357628383e-06 8.020767115181574e-06 2.7697233171399415e-12 -10.0 0.07197662162700777 -10.0 0.8339317973815891 0.000282262769445327 0.00033532954038420373 5.504813693036933e-11 0.07136750029575815 0.8636569925236791 -10.0 -10.0 6.3151540822133754e-06 4.877856021170283 -10.0 3.7051518220083885e-05 -10.0 0.017950613169359905 7.84289689494925e-05 9.041149893307805e-06 -10.0 8.48176145671274e-09 0.000903108551826469 0.0003634644995026692 2.0295213621716707e-08 1.0305672698745658e-10 1.5550455959178486e-05 0.1664109232689093 8.533030345699353e-16 0.009252532821720597 -10.0 7.695031155172816e-13 0.007151459162818186 -10.0 -10.0 5.182269672663266e-09 3.0160758454323656e-06 -10.0 0.6539005235506369 0.0003452537179033895 -10.0 -10.0 3.855884234344845e-05 0.0017699858357744464 2.594951085377588e-05 1.1333627604823672e-08 -10.0 2.4306375693722206e-05 0.06379065450759913 2.2060992580622125e-10 -10.0 -10.0 0.848872967381878 3.9323892993162844e-05 1.2911827198500372e-07 0.0001957092814065688 0.0072137220224894934 0.018327593437608 1.669925427773411e-05 0.07188410694198127 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 - 3 + 3.0 1.5 10 1e-38 @@ -65,7 +65,7 @@ 0.0 0.5 20000000.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 0.06827568359008944 0.00017329528628152923 0.018541112907970003 0.011113024641218336 8.76041935303527e-05 8.168081568291806e-05 0.00046693784586018913 0.4952432605379829 2.2512327083641865e-10 4.6258592060517866e-07 2.7044817176109556e-05 0.054902816619122045 0.00014126153603265097 8.304845400451923e-08 2.2950716170641463e-05 0.0001335621430311088 0.003432919201293737 0.0005197081842709918 5.726152701849347e-16 -1.0 0.0013332554437480327 0.4346984808472855 7.691527781829036e-17 0.00011042047857307253 3.0571050855707084e-06 -1.0 4.986698316296507e-06 0.011128424196387618 1.3106335518133802e-05 5.447493368067179e-10 0.011440381012864086 4.670673837764874e-08 0.12364069326350118 0.00012558879474108074 3.136829920007009e-05 2.34750482787598e-05 0.001537590300149361 0.0017693279949094218 6.717625881826167e-05 4.587143797469485e-08 2.6211239246796104e-05 0.00030002326388383244 0.01729816946709781 4.5757238372058234e-11 6.92296299242814e-05 3.792209399652396e-06 -1.0 9.256616392487858e-05 8.541606727879512e-07 -1.0 0.49317081643076643 0.05500108683629957 1.298062961617927e-05 0.0006870228272606287 0.0008231482263927564 0.5 3.419181071650816e-06 0.06433819434431046 6.574706543646946e-16 4.0404626147344e-13 0.0003782322077390033 0.00012637534695610975 0.017602971074583987 1.0044390728858277e-05 -1.0 0.0008787411098754915 0.00023686818807101741 0.0009304497896205121 6.949587369646497e-05 0.00012918433677593975 2.0707648529746894e-06 0.0023295401596005313 0.11819165666519223 -1.0 2.1606550732170693e-05 0.00022057970761624768 -1.0 1.0325207105027347e-08 0.0002029396545382813 2.1234980618763222e-13 -1.0 0.00024175998138228048 0.001178616843705956 0.0001399807456616496 0.0038811025614225057 0.0011076796092102186 0.00010814452764860558 0.010955637485319249 -1.0 9.382800796426366e-17 5.098747893974248e-05 0.00027052054298385255 0.00021305826462238593 0.000808100901275472 4.233410073487772e-06 0.0051513292132259495 8.616027294555462e-07 0.4873897581604287 2.9093345975075226e-05 0.000469589568463265 -1.0 -1.0 0.017802624844035688 1.3116807133030035e-15 2.617878055106949e-16 0.01884234453311008 -1.0 2.027381220364608e-16 0.0004299195570308035 1.4628847959717225e-05 0.4899952354672477 2.774067049392004e-07 0.004441328419270369 4.279460329782799e-09 0.0012297303081805393 0.0002792896409558745 0.0006934466049804711 8.370896020975689e-05 3.8270536025799805e-15 -1.0 0.01208261392046878 0.0001497958445994315 0.0015016500045374082 0.005384625561469684 0.00025519632243117644 0.0011028020390507682 0.0002362355168421952 -1.0 -1.0 8.862760180332873e-05 1.3806577785135177e-06 -1.0 0.0001319677450153934 2.6866894852481906e-05 -1.0 0.11510120013926417 0.002672923773363389 1.2257360246712472e-05 8.544159282151438e-05 2.777791741571174e-05 0.0014957033281168012 0.0003257646134837451 0.0008919466185572302 1.2907171695294846e-13 4.6842350882367666e-05 0.01721806295736377 0.00025106741008066317 0.00022234471595443313 2.101790478097517e-09 5.752120832330886e-11 0.06428782790571179 3.2478301680021854e-08 0.4903495510314233 0.001146714816952061 0.0004777967757842694 1.0882011018684852e-06 0.05708498338352203 0.4981497862127628 -1.0 3.2790914744011534e-06 0.00010077009726691265 -1.0 2.210707325798542e-07 4.3166052799897375e-05 -1.0 0.01825795827020865 0.0003182108781955478 3.8561696337086434e-05 1.0995322456277382e-06 9.53380658669839e-06 0.001550036616828061 0.0012648333883989995 5.272021975060514e-06 1.9257248009114363e-05 0.00016757997590048827 0.11891251244906934 5.515522196186723e-06 0.01102706140784316 9.904481358675478e-13 3.520674728719278e-05 0.011294708566804167 7.239087311622819e-08 -1.0 3.5740607788414942e-06 0.00035983547999740665 1.0588257623722672e-07 0.42372713683725016 0.0011273340972061078 8.582011716859219e-15 1.1514579117272292e-10 0.00043130977711323417 0.0027847329307350423 0.00017287873387910357 6.401055165502384e-06 1.722191123879782e-08 0.00020848309220162036 0.05639071613735579 1.8064550990294753e-05 1.289814511028015e-06 1.078687446476881e-14 0.4897735047310072 0.0002981891705231209 0.00016079768514218546 9.332371598523186e-05 0.011724714376848187 0.019040707071165303 0.00014242053195529864 0.06684484191345574 -1.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 -10.0 0.6827568359008944 0.0017329528628152924 0.18541112907970003 0.11113024641218336 0.0008760419353035269 0.0008168081568291806 0.004669378458601891 4.952432605379829 2.2512327083641864e-09 4.625859206051786e-06 0.00027044817176109554 0.5490281661912204 0.0014126153603265096 8.304845400451923e-07 0.00022950716170641464 0.001335621430311088 0.03432919201293737 0.0051970818427099184 5.726152701849347e-15 -10.0 0.013332554437480326 4.346984808472855 7.6915277818290365e-16 0.0011042047857307254 3.0571050855707086e-05 -10.0 4.986698316296507e-05 0.11128424196387618 0.000131063355181338 5.447493368067179e-09 0.11440381012864086 4.670673837764874e-07 1.2364069326350118 0.0012558879474108074 0.0003136829920007009 0.000234750482787598 0.01537590300149361 0.01769327994909422 0.0006717625881826168 4.587143797469485e-07 0.000262112392467961 0.0030002326388383245 0.1729816946709781 4.5757238372058235e-10 0.0006922962992428139 3.792209399652396e-05 -10.0 0.0009256616392487858 8.541606727879512e-06 -10.0 4.931708164307665 0.5500108683629957 0.00012980629616179268 0.006870228272606287 0.008231482263927564 5.0 3.419181071650816e-05 0.6433819434431045 6.574706543646946e-15 4.0404626147344005e-12 0.003782322077390033 0.0012637534695610975 0.17602971074583987 0.00010044390728858278 -10.0 0.008787411098754914 0.002368681880710174 0.00930449789620512 0.0006949587369646498 0.0012918433677593976 2.0707648529746893e-05 0.023295401596005315 1.1819165666519222 -10.0 0.00021606550732170693 0.0022057970761624767 -10.0 1.0325207105027347e-07 0.0020293965453828133 2.123498061876322e-12 -10.0 0.0024175998138228046 0.01178616843705956 0.0013998074566164962 0.03881102561422506 0.011076796092102187 0.0010814452764860557 0.10955637485319249 -10.0 9.382800796426367e-16 0.0005098747893974248 0.0027052054298385255 0.0021305826462238594 0.00808100901275472 4.233410073487772e-05 0.0515132921322595 8.61602729455546e-06 4.873897581604287 0.0002909334597507523 0.0046958956846326495 -10.0 -10.0 0.1780262484403569 1.3116807133030034e-14 2.6178780551069492e-15 0.1884234453311008 -10.0 2.027381220364608e-15 0.004299195570308035 0.00014628847959717226 4.899952354672477 2.774067049392004e-06 0.04441328419270369 4.279460329782799e-08 0.012297303081805393 0.002792896409558745 0.006934466049804711 0.0008370896020975689 3.8270536025799805e-14 -10.0 0.1208261392046878 0.001497958445994315 0.015016500045374082 0.05384625561469684 0.0025519632243117644 0.011028020390507681 0.002362355168421952 -10.0 -10.0 0.0008862760180332873 1.3806577785135176e-05 -10.0 0.001319677450153934 0.00026866894852481903 -10.0 1.1510120013926417 0.026729237733633893 0.00012257360246712473 0.0008544159282151438 0.0002777791741571174 0.014957033281168012 0.0032576461348374514 0.008919466185572301 1.2907171695294846e-12 0.00046842350882367664 0.17218062957363772 0.0025106741008066318 0.0022234471595443312 2.101790478097517e-08 5.752120832330886e-10 0.6428782790571179 3.2478301680021856e-07 4.903495510314233 0.01146714816952061 0.004777967757842694 1.0882011018684853e-05 0.5708498338352204 4.981497862127628 -10.0 3.279091474401153e-05 0.0010077009726691265 -10.0 2.210707325798542e-06 0.00043166052799897375 -10.0 0.1825795827020865 0.0031821087819554777 0.00038561696337086434 1.0995322456277382e-05 9.53380658669839e-05 0.01550036616828061 0.012648333883989995 5.272021975060514e-05 0.00019257248009114364 0.0016757997590048828 1.1891251244906933 5.515522196186723e-05 0.1102706140784316 9.904481358675478e-12 0.0003520674728719278 0.11294708566804167 7.239087311622819e-07 -10.0 3.574060778841494e-05 0.0035983547999740664 1.0588257623722672e-06 4.237271368372502 0.011273340972061077 8.582011716859219e-14 1.151457911727229e-09 0.004313097771132342 0.027847329307350423 0.0017287873387910357 6.401055165502385e-05 1.722191123879782e-07 0.0020848309220162036 0.5639071613735579 0.00018064550990294753 1.289814511028015e-05 1.078687446476881e-13 4.897735047310072 0.002981891705231209 0.0016079768514218546 0.0009332371598523186 0.11724714376848187 0.19040707071165303 0.0014242053195529865 0.6684484191345574 -10.0 - 3 + 3.0 1.5 10 1e-38 diff --git a/tests/regression_tests/weightwindows/results_true.dat b/tests/regression_tests/weightwindows/results_true.dat index 6c05af31a..122c5d890 100644 --- a/tests/regression_tests/weightwindows/results_true.dat +++ b/tests/regression_tests/weightwindows/results_true.dat @@ -1 +1 @@ -ebc761815175b25fc95a226174928c226a3ab5dbf3b2a2abf09e079a0b87dee1dee74aa9b9eaec35acd58b8c481d264be7e9b3f052905bcc14ccd76f36b01549 \ No newline at end of file +5df0c08573ccee3fd3495c877c7dc0c4b69c245faf8473b848c89fb837dea7fd437936ffebeb6455c793e66046c46eb0ad6941cc5ef1699fc5fc8a7fcb9b5a0c \ No newline at end of file diff --git a/tests/regression_tests/weightwindows/test.py b/tests/regression_tests/weightwindows/test.py index 864f4f062..cfb651338 100644 --- a/tests/regression_tests/weightwindows/test.py +++ b/tests/regression_tests/weightwindows/test.py @@ -1,4 +1,3 @@ -from copy import deepcopy import pytest import numpy as np @@ -8,6 +7,7 @@ from openmc.stats import Discrete, Point from tests.testing_harness import HashedPyAPITestHarness + @pytest.fixture def model(): model = openmc.Model() @@ -114,7 +114,7 @@ def test_weightwindows(model): def test_wwinp_cylindrical(): - ww = openmc.wwinp_to_wws('ww_n_cyl.txt')[0] + ww = openmc.WeightWindowsList.from_wwinp('ww_n_cyl.txt')[0] mesh = ww.mesh @@ -144,7 +144,7 @@ def test_wwinp_cylindrical(): def test_wwinp_spherical(): - ww = openmc.wwinp_to_wws('ww_n_sph.txt')[0] + ww = openmc.WeightWindowsList.from_wwinp('ww_n_sph.txt')[0] mesh = ww.mesh diff --git a/tests/regression_tests/weightwindows_fw_cadis/inputs_true.dat b/tests/regression_tests/weightwindows_fw_cadis/inputs_true.dat index 586bbb120..5fa6505dd 100644 --- a/tests/regression_tests/weightwindows_fw_cadis/inputs_true.dat +++ b/tests/regression_tests/weightwindows_fw_cadis/inputs_true.dat @@ -3,24 +3,24 @@ mgxs.h5 - + - + - + - - - - - + + + + + 2.5 2.5 2.5 12 12 12 @@ -182,19 +182,19 @@ 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - - - - - - + + + + + + fixed source 90 10 5 - + 100.0 1.0 @@ -222,12 +222,12 @@ 500.0 100.0 - + 0.0 0.0 0.0 30.0 30.0 30.0 - True + true naive diff --git a/tests/regression_tests/weightwindows_fw_cadis_mesh/flat/inputs_true.dat b/tests/regression_tests/weightwindows_fw_cadis_mesh/flat/inputs_true.dat index ffb2ac112..ceb89e6e3 100644 --- a/tests/regression_tests/weightwindows_fw_cadis_mesh/flat/inputs_true.dat +++ b/tests/regression_tests/weightwindows_fw_cadis_mesh/flat/inputs_true.dat @@ -3,24 +3,24 @@ mgxs.h5 - + - + - + - - - - - + + + + + 2.5 2.5 2.5 12 12 12 @@ -182,19 +182,19 @@ 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - - - - - - + + + + + + fixed source 750 30 20 - + 100.0 1.0 @@ -222,12 +222,12 @@ 500.0 100.0 - + 0.0 0.0 0.0 30.0 30.0 30.0 - True + true diff --git a/tests/regression_tests/weightwindows_fw_cadis_mesh/flat/results_true.dat b/tests/regression_tests/weightwindows_fw_cadis_mesh/flat/results_true.dat index e14b7e199..0354501d1 100644 --- a/tests/regression_tests/weightwindows_fw_cadis_mesh/flat/results_true.dat +++ b/tests/regression_tests/weightwindows_fw_cadis_mesh/flat/results_true.dat @@ -36,15 +36,15 @@ Lower Bounds 1.73e-01 2.44e-01 3.63e-01 -1.23e-01 +1.22e-01 1.71e-01 1.66e-01 1.69e-01 -1.71e-01 +1.70e-01 1.67e-01 1.71e-01 1.64e-01 -1.56e-01 +1.55e-01 1.67e-01 1.64e-01 1.68e-01 @@ -96,7 +96,7 @@ Lower Bounds 1.80e-01 2.59e-01 2.97e-01 -1.07e-01 +1.06e-01 1.68e-01 1.60e-01 1.58e-01 @@ -156,7 +156,7 @@ Lower Bounds 1.49e-01 2.14e-01 1.76e-01 -6.71e-02 +6.70e-02 1.72e-01 1.66e-01 1.74e-01 @@ -192,7 +192,7 @@ Lower Bounds 2.37e-01 2.51e-01 2.64e-01 -2.43e-01 +2.42e-01 2.39e-01 2.32e-01 2.32e-01 @@ -209,12 +209,12 @@ Lower Bounds 2.86e-01 3.17e-01 2.60e-01 -2.39e-01 +2.38e-01 1.88e-01 1.97e-01 1.84e-01 1.50e-01 -9.99e-02 +9.98e-02 3.88e-02 1.90e-02 2.18e-01 @@ -340,7 +340,7 @@ Lower Bounds 1.65e-01 1.63e-01 1.59e-01 -1.58e-01 +1.57e-01 1.59e-01 1.54e-01 1.54e-01 @@ -416,7 +416,7 @@ Lower Bounds 2.65e-01 2.54e-01 2.58e-01 -2.81e-01 +2.80e-01 2.53e-01 2.33e-01 2.40e-01 @@ -503,7 +503,7 @@ Lower Bounds 3.36e-01 1.29e-01 1.57e-01 -1.68e-01 +1.67e-01 1.66e-01 1.63e-01 1.63e-01 @@ -513,7 +513,7 @@ Lower Bounds 1.56e-01 1.59e-01 1.65e-01 -1.60e-01 +1.59e-01 2.43e-01 3.30e-01 1.08e-01 @@ -543,7 +543,7 @@ Lower Bounds 1.54e-01 1.56e-01 1.67e-01 -1.70e-01 +1.69e-01 2.42e-01 3.48e-01 1.32e-01 @@ -661,7 +661,7 @@ Lower Bounds 2.34e-01 2.20e-01 1.88e-01 -1.78e-01 +1.77e-01 1.34e-01 1.25e-01 1.07e-01 @@ -676,7 +676,7 @@ Lower Bounds 8.09e-02 8.37e-02 5.69e-02 -6.46e-02 +6.45e-02 3.15e-02 3.86e-02 3.51e-02 @@ -770,14 +770,14 @@ Lower Bounds 1.53e-01 1.64e-01 2.46e-01 -3.03e-01 +3.02e-01 1.11e-01 1.63e-01 1.59e-01 1.68e-01 -1.56e-01 +1.59e-01 1.52e-01 -1.55e-01 +1.54e-01 1.56e-01 1.49e-01 1.49e-01 @@ -850,7 +850,7 @@ Lower Bounds 1.73e-01 1.65e-01 1.70e-01 -7.83e-02 +1.66e-01 1.73e-01 1.78e-01 1.65e-01 @@ -877,7 +877,7 @@ Lower Bounds 2.14e-01 8.26e-02 2.65e-02 -3.07e-01 +3.06e-01 2.51e-01 2.10e-01 2.95e-01 @@ -1091,7 +1091,7 @@ Lower Bounds 2.30e-01 2.33e-01 2.43e-01 -2.46e-01 +2.45e-01 2.48e-01 2.46e-01 2.21e-01 @@ -1124,7 +1124,7 @@ Lower Bounds 1.07e-01 8.75e-02 1.17e-01 -5.68e-02 +5.67e-02 7.16e-02 5.22e-02 3.31e-02 @@ -1317,7 +1317,7 @@ Lower Bounds 2.20e-01 2.27e-01 2.41e-01 -2.35e-01 +2.34e-01 2.13e-01 2.04e-01 2.13e-01 @@ -1359,14 +1359,14 @@ Lower Bounds 8.92e-03 1.61e-01 1.59e-01 -1.57e-01 +1.56e-01 1.59e-01 1.51e-01 1.49e-01 1.54e-01 1.51e-01 1.53e-01 -1.49e-01 +1.48e-01 1.52e-01 1.48e-01 2.27e-01 @@ -1478,12 +1478,12 @@ Lower Bounds 1.68e-01 5.02e-02 1.53e-01 -7.09e-02 +1.48e-01 1.47e-01 1.48e-01 1.43e-01 1.46e-01 -6.84e-02 +1.42e-01 1.27e-01 1.24e-01 1.31e-01 @@ -1523,7 +1523,7 @@ Lower Bounds 7.50e-02 2.64e-02 1.58e-01 -1.56e-01 +1.55e-01 1.50e-01 1.45e-01 1.50e-01 @@ -1575,7 +1575,7 @@ Lower Bounds 6.95e-02 7.10e-02 4.92e-02 -4.74e-02 +4.73e-02 3.52e-02 4.69e-02 4.03e-02 @@ -1669,7 +1669,7 @@ Lower Bounds 1.34e-01 1.36e-01 1.50e-01 -1.96e-01 +1.95e-01 1.29e-01 4.48e-02 1.49e-01 @@ -1784,7 +1784,7 @@ Lower Bounds 1.53e-01 1.76e-01 1.13e-01 -9.77e-02 +9.76e-02 8.62e-02 1.49e-01 1.29e-01 @@ -1898,7 +1898,7 @@ Lower Bounds 1.53e-01 5.25e-02 1.45e-01 -1.41e-01 +1.44e-01 1.44e-01 1.36e-01 1.36e-01 @@ -1928,13 +1928,13 @@ Lower Bounds 7.71e-02 3.01e-02 1.38e-01 -1.12e-01 +1.35e-01 1.38e-01 1.41e-01 1.44e-01 1.46e-01 1.34e-01 -1.11e-01 +1.28e-01 1.24e-01 1.20e-01 1.22e-01 @@ -1955,7 +1955,7 @@ Lower Bounds 1.21e-01 1.25e-01 1.84e-01 -9.19e-02 +9.18e-02 2.31e-02 1.48e-01 1.32e-01 @@ -2039,7 +2039,7 @@ Lower Bounds 1.55e-01 1.46e-01 1.44e-01 -1.48e-01 +1.47e-01 1.42e-01 1.44e-01 1.40e-01 @@ -2067,7 +2067,7 @@ Lower Bounds 1.43e-01 1.44e-01 1.46e-01 -1.54e-01 +1.53e-01 1.50e-01 1.51e-01 1.54e-01 @@ -2214,7 +2214,7 @@ Lower Bounds 1.83e-02 2.39e-01 1.91e-01 -1.79e-01 +1.80e-01 2.07e-01 1.97e-01 2.03e-01 @@ -2238,7 +2238,7 @@ Lower Bounds 1.30e-01 1.06e-01 9.60e-02 -7.07e-02 +7.06e-02 4.00e-02 1.71e-02 7.45e-03 @@ -2343,7 +2343,7 @@ Lower Bounds 1.32e-01 1.41e-01 1.41e-01 -1.40e-01 +1.39e-01 2.04e-01 1.15e-01 3.10e-02 @@ -2471,7 +2471,7 @@ Lower Bounds 3.06e-02 3.68e-02 4.09e-02 -5.27e-02 +5.26e-02 4.71e-02 3.30e-02 4.67e-02 @@ -2493,7 +2493,7 @@ Lower Bounds 1.53e-01 1.51e-01 1.54e-01 -1.45e-01 +1.44e-01 1.43e-01 3.50e-02 1.38e-02 @@ -2533,7 +2533,7 @@ Lower Bounds 1.54e-01 1.59e-01 1.65e-01 -5.07e-02 +1.63e-01 1.43e-01 1.52e-01 1.45e-01 @@ -2548,7 +2548,7 @@ Lower Bounds 1.55e-01 1.59e-01 1.59e-01 -1.53e-01 +1.54e-01 1.47e-01 1.53e-01 1.51e-01 @@ -2648,7 +2648,7 @@ Lower Bounds 5.02e-02 1.48e-02 1.33e-01 -5.34e-02 +1.31e-01 1.34e-01 1.36e-01 1.35e-01 @@ -2678,7 +2678,7 @@ Lower Bounds 2.21e-02 7.42e-03 1.30e-01 -7.03e-02 +7.02e-02 8.47e-02 1.05e-01 8.11e-02 @@ -2726,7 +2726,7 @@ Lower Bounds 2.10e-01 2.47e-01 2.20e-01 -2.21e-01 +2.20e-01 2.29e-01 2.22e-01 2.06e-01 @@ -2776,7 +2776,7 @@ Lower Bounds 2.54e-01 2.18e-01 2.16e-01 -2.24e-01 +2.23e-01 1.99e-01 1.77e-01 1.57e-01 @@ -3026,7 +3026,7 @@ Lower Bounds 1.80e-01 2.09e-01 2.09e-01 -1.83e-01 +1.82e-01 2.00e-01 1.82e-01 1.57e-01 @@ -3120,7 +3120,7 @@ Lower Bounds 8.59e-02 7.51e-02 7.34e-02 -6.11e-02 +6.10e-02 6.19e-02 4.42e-02 3.60e-02 @@ -3164,7 +3164,7 @@ Lower Bounds 1.09e-01 8.20e-02 7.49e-02 -7.94e-02 +7.93e-02 7.32e-02 5.71e-02 3.93e-02 @@ -3188,7 +3188,7 @@ Lower Bounds 1.79e-02 8.68e-03 8.76e-02 -6.94e-02 +6.93e-02 1.01e-01 9.79e-02 5.28e-02 @@ -3236,7 +3236,7 @@ Lower Bounds 5.48e-02 7.05e-02 7.64e-02 -6.19e-02 +6.18e-02 5.28e-02 6.84e-02 5.17e-02 @@ -3404,7 +3404,7 @@ Upper Bounds 7.61e-01 8.32e-01 8.60e-01 -8.42e-01 +8.41e-01 8.42e-01 8.32e-01 8.34e-01 @@ -3412,15 +3412,15 @@ Upper Bounds 8.65e-01 1.22e+00 1.82e+00 -6.13e-01 +6.12e-01 8.56e-01 -8.32e-01 +8.31e-01 8.43e-01 -8.53e-01 +8.52e-01 8.33e-01 8.57e-01 8.19e-01 -7.78e-01 +7.77e-01 8.33e-01 8.19e-01 8.41e-01 @@ -3472,8 +3472,8 @@ Upper Bounds 8.98e-01 1.29e+00 1.49e+00 -5.33e-01 -8.40e-01 +5.32e-01 +8.39e-01 7.98e-01 7.91e-01 8.03e-01 @@ -3526,7 +3526,7 @@ Upper Bounds 7.71e-01 7.75e-01 7.58e-01 -7.64e-01 +7.63e-01 7.06e-01 7.64e-01 7.43e-01 @@ -3556,7 +3556,7 @@ Upper Bounds 8.72e-01 7.91e-01 8.39e-01 -7.95e-01 +7.94e-01 7.87e-01 7.88e-01 7.38e-01 @@ -3589,7 +3589,7 @@ Upper Bounds 9.40e-01 9.83e-01 9.19e-01 -7.52e-01 +7.51e-01 4.99e-01 1.94e-01 9.48e-02 @@ -3615,7 +3615,7 @@ Upper Bounds 8.13e-01 7.97e-01 8.76e-01 -8.45e-01 +8.44e-01 7.95e-01 8.18e-01 8.84e-01 @@ -3649,7 +3649,7 @@ Upper Bounds 8.01e-01 8.48e-01 8.52e-01 -8.71e-01 +8.70e-01 1.31e+00 1.65e+00 5.73e-01 @@ -3713,10 +3713,10 @@ Upper Bounds 1.17e+00 1.50e+00 5.74e-01 -8.24e-01 +8.23e-01 8.15e-01 7.95e-01 -7.88e-01 +7.87e-01 7.97e-01 7.70e-01 7.69e-01 @@ -3761,7 +3761,7 @@ Upper Bounds 8.45e-01 8.73e-01 8.56e-01 -8.16e-01 +8.15e-01 8.44e-01 8.36e-01 7.99e-01 @@ -3774,11 +3774,11 @@ Upper Bounds 6.73e-01 2.04e-01 8.93e-01 -8.59e-01 +8.60e-01 8.64e-01 8.51e-01 8.70e-01 -8.91e-01 +8.90e-01 8.41e-01 7.94e-01 7.85e-01 @@ -3856,10 +3856,10 @@ Upper Bounds 8.14e-01 7.91e-01 8.00e-01 -7.95e-01 +7.94e-01 8.24e-01 8.16e-01 -8.87e-01 +8.86e-01 1.22e+00 1.96e+00 8.18e-01 @@ -3879,7 +3879,7 @@ Upper Bounds 1.68e+00 6.47e-01 7.87e-01 -8.38e-01 +8.37e-01 8.29e-01 8.15e-01 8.16e-01 @@ -3889,13 +3889,13 @@ Upper Bounds 7.82e-01 7.95e-01 8.24e-01 -7.98e-01 +7.97e-01 1.22e+00 1.65e+00 5.42e-01 8.09e-01 8.09e-01 -8.05e-01 +8.04e-01 7.72e-01 8.14e-01 8.20e-01 @@ -3919,7 +3919,7 @@ Upper Bounds 7.72e-01 7.80e-01 8.33e-01 -8.48e-01 +8.47e-01 1.21e+00 1.74e+00 6.61e-01 @@ -3934,7 +3934,7 @@ Upper Bounds 7.56e-01 7.70e-01 7.83e-01 -7.97e-01 +7.96e-01 1.13e+00 1.26e+00 4.66e-01 @@ -3943,7 +3943,7 @@ Upper Bounds 7.98e-01 7.75e-01 7.87e-01 -7.92e-01 +7.91e-01 7.70e-01 7.35e-01 7.31e-01 @@ -3959,7 +3959,7 @@ Upper Bounds 8.01e-01 7.99e-01 7.90e-01 -7.89e-01 +7.88e-01 7.83e-01 7.33e-01 7.48e-01 @@ -3975,7 +3975,7 @@ Upper Bounds 8.32e-01 7.85e-01 7.86e-01 -7.51e-01 +7.50e-01 7.01e-01 7.38e-01 7.30e-01 @@ -4037,13 +4037,13 @@ Upper Bounds 1.17e+00 1.10e+00 9.39e-01 -8.88e-01 +8.87e-01 6.70e-01 6.23e-01 5.35e-01 2.34e-01 6.47e-02 -6.45e-01 +6.44e-01 4.31e-01 7.11e-01 6.80e-01 @@ -4063,7 +4063,7 @@ Upper Bounds 8.31e-01 8.52e-01 8.43e-01 -8.06e-01 +8.05e-01 7.88e-01 7.57e-01 7.58e-01 @@ -4083,7 +4083,7 @@ Upper Bounds 7.76e-01 7.95e-01 8.30e-01 -7.96e-01 +7.95e-01 8.37e-01 1.18e+00 1.62e+00 @@ -4105,7 +4105,7 @@ Upper Bounds 5.36e-01 8.08e-01 8.15e-01 -8.00e-01 +7.99e-01 8.03e-01 7.68e-01 7.86e-01 @@ -4122,7 +4122,7 @@ Upper Bounds 7.72e-01 8.04e-01 8.28e-01 -7.75e-01 +7.74e-01 7.64e-01 7.80e-01 7.54e-01 @@ -4151,12 +4151,12 @@ Upper Bounds 8.13e-01 7.95e-01 8.40e-01 -7.80e-01 +7.97e-01 7.59e-01 -7.73e-01 +7.72e-01 7.80e-01 7.46e-01 -7.45e-01 +7.44e-01 7.55e-01 7.27e-01 7.44e-01 @@ -4226,8 +4226,8 @@ Upper Bounds 8.65e-01 8.27e-01 8.48e-01 -3.91e-01 -8.66e-01 +8.31e-01 +8.65e-01 8.92e-01 8.23e-01 7.50e-01 @@ -4265,7 +4265,7 @@ Upper Bounds 9.09e-01 6.43e-01 6.18e-01 -5.19e-01 +5.18e-01 2.26e-01 8.71e-02 5.78e-01 @@ -4367,7 +4367,7 @@ Upper Bounds 7.08e-01 7.78e-01 7.45e-01 -7.62e-01 +7.61e-01 7.55e-01 7.92e-01 1.16e+00 @@ -4376,7 +4376,7 @@ Upper Bounds 7.40e-01 7.79e-01 7.94e-01 -7.60e-01 +7.59e-01 7.99e-01 7.16e-01 7.14e-01 @@ -4420,7 +4420,7 @@ Upper Bounds 2.76e-01 8.13e-01 8.09e-01 -7.87e-01 +7.86e-01 7.66e-01 7.26e-01 7.62e-01 @@ -4531,7 +4531,7 @@ Upper Bounds 7.86e-01 7.98e-01 7.43e-01 -7.69e-01 +7.68e-01 7.51e-01 7.70e-01 8.08e-01 @@ -4583,7 +4583,7 @@ Upper Bounds 1.19e+00 1.33e+00 5.12e-01 -7.76e-01 +7.75e-01 7.68e-01 7.84e-01 7.62e-01 @@ -4631,14 +4631,14 @@ Upper Bounds 7.78e-01 7.65e-01 7.86e-01 -7.10e-01 +7.09e-01 7.60e-01 7.43e-01 7.27e-01 6.62e-01 6.51e-01 6.35e-01 -7.04e-01 +7.03e-01 7.07e-01 1.06e+00 7.73e-01 @@ -4648,7 +4648,7 @@ Upper Bounds 7.63e-01 7.80e-01 7.34e-01 -7.23e-01 +7.24e-01 7.02e-01 6.87e-01 7.13e-01 @@ -4724,7 +4724,7 @@ Upper Bounds 4.81e-01 4.96e-01 3.78e-01 -5.26e-01 +5.25e-01 3.10e-01 2.83e-01 1.99e-01 @@ -4735,14 +4735,14 @@ Upper Bounds 4.46e-02 8.04e-01 7.95e-01 -7.83e-01 +7.82e-01 7.95e-01 7.54e-01 7.47e-01 7.72e-01 7.56e-01 7.67e-01 -7.43e-01 +7.42e-01 7.58e-01 7.40e-01 1.14e+00 @@ -4779,7 +4779,7 @@ Upper Bounds 1.24e+00 5.06e-01 7.87e-01 -7.41e-01 +7.40e-01 7.55e-01 7.36e-01 7.30e-01 @@ -4821,7 +4821,7 @@ Upper Bounds 7.08e-01 7.57e-01 1.07e+00 -7.06e-01 +7.05e-01 2.16e-01 7.82e-01 7.85e-01 @@ -4854,12 +4854,12 @@ Upper Bounds 8.40e-01 2.51e-01 7.67e-01 -3.55e-01 +7.41e-01 7.36e-01 7.41e-01 7.16e-01 -7.29e-01 -3.42e-01 +7.28e-01 +7.11e-01 6.33e-01 6.18e-01 6.57e-01 @@ -4874,7 +4874,7 @@ Upper Bounds 7.36e-01 7.09e-01 6.77e-01 -6.93e-01 +6.94e-01 6.91e-01 6.86e-01 6.77e-01 @@ -4899,8 +4899,8 @@ Upper Bounds 3.75e-01 1.32e-01 7.90e-01 -7.78e-01 -7.50e-01 +7.77e-01 +7.49e-01 7.25e-01 7.49e-01 7.50e-01 @@ -4964,7 +4964,7 @@ Upper Bounds 7.66e-01 7.81e-01 7.83e-01 -7.80e-01 +7.79e-01 7.68e-01 7.20e-01 7.09e-01 @@ -5045,7 +5045,7 @@ Upper Bounds 6.71e-01 6.81e-01 7.49e-01 -9.78e-01 +9.77e-01 6.44e-01 2.24e-01 7.44e-01 @@ -5148,7 +5148,7 @@ Upper Bounds 8.35e-01 8.39e-01 9.59e-01 -9.14e-01 +9.15e-01 7.74e-01 5.71e-01 1.72e-01 @@ -5191,7 +5191,7 @@ Upper Bounds 7.60e-01 7.46e-01 7.71e-01 -7.12e-01 +7.11e-01 6.80e-01 6.82e-01 7.51e-01 @@ -5229,7 +5229,7 @@ Upper Bounds 8.27e-01 2.75e-01 7.59e-01 -7.20e-01 +7.19e-01 7.47e-01 7.32e-01 7.40e-01 @@ -5256,7 +5256,7 @@ Upper Bounds 7.13e-01 7.47e-01 9.68e-01 -6.86e-01 +6.85e-01 2.05e-01 7.59e-01 7.40e-01 @@ -5266,22 +5266,22 @@ Upper Bounds 6.98e-01 7.04e-01 6.61e-01 -6.80e-01 -6.80e-01 +6.79e-01 +6.79e-01 6.86e-01 7.42e-01 1.01e+00 7.65e-01 2.63e-01 7.27e-01 -7.07e-01 +7.22e-01 7.21e-01 6.82e-01 6.82e-01 6.79e-01 6.66e-01 6.58e-01 -6.32e-01 +6.31e-01 6.61e-01 6.87e-01 6.88e-01 @@ -5304,13 +5304,13 @@ Upper Bounds 3.86e-01 1.50e-01 6.91e-01 -5.58e-01 +6.77e-01 6.91e-01 7.07e-01 7.18e-01 7.31e-01 6.70e-01 -5.57e-01 +6.39e-01 6.18e-01 6.02e-01 6.11e-01 @@ -5349,7 +5349,7 @@ Upper Bounds 4.84e-01 1.41e-01 7.40e-01 -6.74e-01 +6.73e-01 6.74e-01 7.15e-01 7.22e-01 @@ -5415,16 +5415,16 @@ Upper Bounds 7.76e-01 7.30e-01 7.18e-01 -7.38e-01 +7.37e-01 7.09e-01 -7.21e-01 +7.20e-01 7.00e-01 7.72e-01 9.68e-01 6.90e-01 2.52e-01 7.57e-01 -7.65e-01 +7.64e-01 7.45e-01 7.47e-01 7.46e-01 @@ -5433,9 +5433,9 @@ Upper Bounds 7.52e-01 7.26e-01 6.82e-01 -7.10e-01 +7.09e-01 7.86e-01 -1.05e+00 +1.04e+00 7.77e-01 2.28e-01 7.74e-01 @@ -5443,7 +5443,7 @@ Upper Bounds 7.17e-01 7.21e-01 7.29e-01 -7.68e-01 +7.67e-01 7.52e-01 7.57e-01 7.68e-01 @@ -5504,7 +5504,7 @@ Upper Bounds 7.08e-01 7.09e-01 7.14e-01 -6.80e-01 +6.79e-01 6.85e-01 6.58e-01 6.83e-01 @@ -5519,7 +5519,7 @@ Upper Bounds 7.21e-01 7.00e-01 6.83e-01 -6.44e-01 +6.43e-01 6.62e-01 6.42e-01 6.10e-01 @@ -5566,7 +5566,7 @@ Upper Bounds 6.70e-01 6.87e-01 6.53e-01 -6.04e-01 +6.03e-01 5.84e-01 5.54e-01 5.65e-01 @@ -5574,7 +5574,7 @@ Upper Bounds 4.40e-01 1.48e-01 7.67e-01 -6.96e-01 +6.97e-01 7.26e-01 7.26e-01 6.91e-01 @@ -5590,7 +5590,7 @@ Upper Bounds 9.16e-02 1.20e+00 9.57e-01 -8.97e-01 +8.98e-01 1.03e+00 9.83e-01 1.01e+00 @@ -5655,7 +5655,7 @@ Upper Bounds 7.63e-01 7.61e-01 7.53e-01 -7.70e-01 +7.69e-01 7.59e-01 7.54e-01 7.39e-01 @@ -5667,18 +5667,18 @@ Upper Bounds 7.39e-01 7.32e-01 7.64e-01 -7.36e-01 +7.35e-01 7.69e-01 7.88e-01 7.27e-01 7.35e-01 7.32e-01 7.27e-01 -7.50e-01 +7.49e-01 9.97e-01 7.08e-01 2.42e-01 -7.31e-01 +7.30e-01 7.41e-01 7.80e-01 7.20e-01 @@ -5719,7 +5719,7 @@ Upper Bounds 6.58e-01 7.03e-01 7.03e-01 -6.98e-01 +6.97e-01 1.02e+00 5.77e-01 1.55e-01 @@ -5766,12 +5766,12 @@ Upper Bounds 6.04e-01 6.27e-01 8.72e-01 -4.59e-01 +4.58e-01 1.30e-01 6.94e-01 6.76e-01 6.98e-01 -7.17e-01 +7.16e-01 7.24e-01 6.61e-01 6.58e-01 @@ -5815,7 +5815,7 @@ Upper Bounds 7.13e-02 9.78e-01 8.94e-01 -9.01e-01 +9.02e-01 9.75e-01 9.93e-01 9.72e-01 @@ -5869,7 +5869,7 @@ Upper Bounds 7.65e-01 7.57e-01 7.69e-01 -7.23e-01 +7.22e-01 7.14e-01 1.75e-01 6.92e-02 @@ -5901,7 +5901,7 @@ Upper Bounds 7.12e-01 8.00e-01 1.03e+00 -5.17e-01 +5.16e-01 1.38e-01 7.80e-01 7.93e-01 @@ -5909,7 +5909,7 @@ Upper Bounds 7.70e-01 7.94e-01 8.27e-01 -2.53e-01 +8.15e-01 7.14e-01 7.62e-01 7.24e-01 @@ -5924,7 +5924,7 @@ Upper Bounds 7.75e-01 7.94e-01 7.94e-01 -7.67e-01 +7.68e-01 7.35e-01 7.64e-01 7.55e-01 @@ -5940,7 +5940,7 @@ Upper Bounds 7.62e-01 7.55e-01 7.49e-01 -7.14e-01 +7.15e-01 7.33e-01 7.29e-01 6.88e-01 @@ -5953,10 +5953,10 @@ Upper Bounds 7.63e-01 7.78e-01 7.67e-01 -7.39e-01 +7.38e-01 7.39e-01 7.04e-01 -6.89e-01 +6.90e-01 7.02e-01 7.00e-01 6.50e-01 @@ -5967,7 +5967,7 @@ Upper Bounds 7.31e-01 7.02e-01 7.48e-01 -7.26e-01 +7.25e-01 7.23e-01 7.48e-01 7.26e-01 @@ -6005,7 +6005,7 @@ Upper Bounds 5.90e-01 6.17e-01 5.70e-01 -8.00e-01 +7.99e-01 3.80e-01 1.34e-01 6.68e-01 @@ -6024,7 +6024,7 @@ Upper Bounds 2.51e-01 7.41e-02 6.65e-01 -2.67e-01 +6.54e-01 6.72e-01 6.79e-01 6.77e-01 @@ -6036,11 +6036,11 @@ Upper Bounds 5.40e-01 5.07e-01 5.77e-01 -2.23e-01 +2.24e-01 6.42e-02 8.66e-01 8.00e-01 -8.00e-01 +8.01e-01 8.48e-01 8.27e-01 8.32e-01 @@ -6048,13 +6048,13 @@ Upper Bounds 9.02e-01 9.05e-01 7.29e-01 -6.76e-01 +6.75e-01 5.88e-01 3.48e-01 1.10e-01 3.71e-02 6.49e-01 -3.52e-01 +3.51e-01 4.24e-01 5.24e-01 4.05e-01 @@ -6103,7 +6103,7 @@ Upper Bounds 1.23e+00 1.10e+00 1.10e+00 -1.15e+00 +1.14e+00 1.11e+00 1.03e+00 9.91e-01 @@ -6147,7 +6147,7 @@ Upper Bounds 1.03e+00 1.06e+00 1.10e+00 -1.04e+00 +1.05e+00 1.13e+00 1.27e+00 1.09e+00 @@ -6184,7 +6184,7 @@ Upper Bounds 8.41e-01 9.51e-01 9.08e-01 -7.46e-01 +7.45e-01 7.77e-01 3.05e-01 9.78e-02 @@ -6218,7 +6218,7 @@ Upper Bounds 8.06e-01 2.24e-01 7.49e-02 -9.70e-01 +9.69e-01 1.03e+00 1.10e+00 1.01e+00 @@ -6229,7 +6229,7 @@ Upper Bounds 8.30e-01 8.02e-01 8.09e-01 -8.10e-01 +8.11e-01 7.80e-01 2.46e-01 7.63e-02 @@ -6250,7 +6250,7 @@ Upper Bounds 7.72e-02 7.36e-01 7.62e-01 -8.87e-01 +8.86e-01 8.71e-01 9.21e-01 9.57e-01 @@ -6287,7 +6287,7 @@ Upper Bounds 2.20e-01 2.69e-01 4.39e-01 -2.89e-01 +2.88e-01 1.35e-01 1.30e-01 7.47e-02 @@ -6335,7 +6335,7 @@ Upper Bounds 7.01e-01 6.46e-01 5.40e-01 -4.50e-01 +4.49e-01 2.04e-01 7.38e-02 1.18e+00 @@ -6345,7 +6345,7 @@ Upper Bounds 9.38e-01 1.19e+00 9.74e-01 -1.02e+00 +1.01e+00 9.23e-01 8.23e-01 8.89e-01 @@ -6362,7 +6362,7 @@ Upper Bounds 1.36e+00 1.18e+00 1.09e+00 -8.67e-01 +8.66e-01 6.32e-01 4.57e-01 3.13e-01 @@ -6402,7 +6402,7 @@ Upper Bounds 9.01e-01 1.04e+00 1.05e+00 -9.13e-01 +9.12e-01 1.00e+00 9.12e-01 7.83e-01 @@ -6515,7 +6515,7 @@ Upper Bounds 1.43e-01 8.60e-02 5.91e-02 -4.19e-02 +4.18e-02 2.09e-02 1.01e-02 6.92e-02 @@ -6639,7 +6639,7 @@ Upper Bounds 3.97e-02 3.67e-02 1.54e-01 -2.67e-01 +2.66e-01 2.58e-01 2.66e-01 2.93e-01 diff --git a/tests/regression_tests/weightwindows_fw_cadis_mesh/linear/inputs_true.dat b/tests/regression_tests/weightwindows_fw_cadis_mesh/linear/inputs_true.dat index 6aa91ca79..c7691e950 100644 --- a/tests/regression_tests/weightwindows_fw_cadis_mesh/linear/inputs_true.dat +++ b/tests/regression_tests/weightwindows_fw_cadis_mesh/linear/inputs_true.dat @@ -3,24 +3,24 @@ mgxs.h5 - + - + - + - - - - - + + + + + 2.5 2.5 2.5 12 12 12 @@ -182,19 +182,19 @@ 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 - - - - - - + + + + + + fixed source 750 30 20 - + 100.0 1.0 @@ -222,12 +222,12 @@ 500.0 100.0 - + 0.0 0.0 0.0 30.0 30.0 30.0 - True + true diff --git a/tests/regression_tests/weightwindows_fw_cadis_mesh/linear/results_true.dat b/tests/regression_tests/weightwindows_fw_cadis_mesh/linear/results_true.dat index 3afdc56ca..c1066ae82 100644 --- a/tests/regression_tests/weightwindows_fw_cadis_mesh/linear/results_true.dat +++ b/tests/regression_tests/weightwindows_fw_cadis_mesh/linear/results_true.dat @@ -60,7 +60,7 @@ Lower Bounds 1.68e-01 1.70e-01 1.75e-01 -1.73e-01 +1.72e-01 1.73e-01 1.65e-01 1.84e-01 @@ -281,7 +281,7 @@ Lower Bounds 1.86e-01 1.81e-01 1.83e-01 -1.73e-01 +1.74e-01 1.67e-01 1.72e-01 1.75e-01 @@ -722,7 +722,7 @@ Lower Bounds 1.63e-01 1.58e-01 1.70e-01 -1.70e-01 +1.69e-01 1.84e-01 2.44e-01 2.71e-01 @@ -775,7 +775,7 @@ Lower Bounds 1.69e-01 1.67e-01 1.76e-01 -1.59e-01 +1.64e-01 1.59e-01 1.58e-01 1.64e-01 @@ -835,7 +835,7 @@ Lower Bounds 1.76e-01 1.78e-01 1.68e-01 -1.78e-01 +1.79e-01 1.73e-01 1.69e-01 1.62e-01 @@ -850,11 +850,11 @@ Lower Bounds 1.88e-01 1.77e-01 1.78e-01 -8.59e-02 +1.76e-01 1.82e-01 1.90e-01 1.76e-01 -1.63e-01 +1.62e-01 1.69e-01 1.69e-01 1.69e-01 @@ -1201,7 +1201,7 @@ Lower Bounds 1.57e-01 1.58e-01 1.58e-01 -1.57e-01 +1.56e-01 1.58e-01 1.66e-01 2.50e-01 @@ -1223,7 +1223,7 @@ Lower Bounds 2.18e-01 9.03e-02 1.68e-01 -1.70e-01 +1.69e-01 1.64e-01 1.56e-01 1.58e-01 @@ -1382,7 +1382,7 @@ Lower Bounds 1.52e-01 1.59e-01 1.52e-01 -1.49e-01 +1.48e-01 1.55e-01 2.25e-01 2.01e-01 @@ -1478,12 +1478,12 @@ Lower Bounds 1.63e-01 4.89e-02 1.64e-01 -6.61e-02 +1.55e-01 1.57e-01 1.53e-01 1.48e-01 1.53e-01 -7.58e-02 +1.52e-01 1.40e-01 1.38e-01 1.40e-01 @@ -1539,7 +1539,7 @@ Lower Bounds 2.68e-02 2.40e-01 2.25e-01 -2.21e-01 +2.22e-01 2.27e-01 2.31e-01 2.20e-01 @@ -1572,7 +1572,7 @@ Lower Bounds 8.97e-02 4.80e-02 4.87e-02 -6.44e-02 +6.43e-02 6.38e-02 4.70e-02 4.40e-02 @@ -1581,7 +1581,7 @@ Lower Bounds 4.03e-02 1.52e-02 8.66e-03 -6.15e-03 +6.14e-03 1.56e-01 1.57e-01 1.54e-01 @@ -1637,7 +1637,7 @@ Lower Bounds 1.53e-01 1.47e-01 1.42e-01 -1.57e-01 +1.56e-01 1.66e-01 2.10e-01 1.46e-01 @@ -1792,7 +1792,7 @@ Lower Bounds 4.29e-02 1.08e-02 4.27e-03 -7.46e-02 +7.45e-02 7.65e-02 5.07e-02 4.76e-02 @@ -1898,7 +1898,7 @@ Lower Bounds 1.50e-01 5.21e-02 1.53e-01 -1.49e-01 +1.53e-01 1.52e-01 1.45e-01 1.45e-01 @@ -1928,13 +1928,13 @@ Lower Bounds 7.19e-02 2.90e-02 1.48e-01 -1.19e-01 +1.44e-01 1.48e-01 1.48e-01 1.49e-01 1.54e-01 1.45e-01 -1.21e-01 +1.38e-01 1.29e-01 1.30e-01 1.31e-01 @@ -1970,7 +1970,7 @@ Lower Bounds 1.18e-01 1.31e-01 1.83e-01 -9.56e-02 +9.55e-02 2.75e-02 1.63e-01 1.47e-01 @@ -2058,7 +2058,7 @@ Lower Bounds 1.58e-01 1.43e-01 1.49e-01 -1.60e-01 +1.59e-01 2.21e-01 1.56e-01 4.57e-02 @@ -2208,7 +2208,7 @@ Lower Bounds 1.36e-01 1.33e-01 1.26e-01 -1.10e-01 +1.11e-01 1.31e-01 5.72e-02 1.80e-02 @@ -2245,7 +2245,7 @@ Lower Bounds 7.21e-02 6.08e-02 6.40e-02 -5.54e-02 +5.53e-02 6.28e-02 5.59e-02 4.39e-02 @@ -2405,7 +2405,7 @@ Lower Bounds 1.23e-01 1.24e-01 1.55e-01 -8.14e-02 +8.15e-02 2.87e-02 1.44e-01 1.47e-01 @@ -2416,7 +2416,7 @@ Lower Bounds 1.42e-01 1.37e-01 1.27e-01 -1.28e-01 +1.29e-01 1.17e-01 1.21e-01 1.63e-01 @@ -2479,12 +2479,12 @@ Lower Bounds 2.61e-02 2.32e-02 1.25e-02 -9.63e-03 +9.62e-03 6.12e-03 3.33e-03 1.57e-01 1.68e-01 -1.77e-01 +1.76e-01 1.71e-01 1.70e-01 1.76e-01 @@ -2533,7 +2533,7 @@ Lower Bounds 1.65e-01 1.69e-01 1.74e-01 -6.32e-02 +1.78e-01 1.61e-01 1.64e-01 1.57e-01 @@ -2547,8 +2547,8 @@ Lower Bounds 1.61e-01 1.66e-01 1.68e-01 -1.70e-01 -1.63e-01 +1.71e-01 +1.64e-01 1.61e-01 1.62e-01 1.60e-01 @@ -2647,8 +2647,8 @@ Lower Bounds 1.45e-01 4.24e-02 1.27e-02 -1.42e-01 -6.20e-02 +1.43e-01 +1.40e-01 1.44e-01 1.45e-01 1.42e-01 @@ -2660,7 +2660,7 @@ Lower Bounds 1.15e-01 1.07e-01 1.24e-01 -3.83e-02 +3.91e-02 1.19e-02 1.85e-01 1.70e-01 @@ -2678,7 +2678,7 @@ Lower Bounds 2.05e-02 7.17e-03 1.27e-01 -6.47e-02 +6.46e-02 8.27e-02 1.04e-01 7.86e-02 @@ -3043,7 +3043,7 @@ Lower Bounds 1.57e-01 1.80e-01 1.80e-01 -1.24e-01 +1.23e-01 1.22e-01 8.18e-02 7.30e-02 @@ -3055,7 +3055,7 @@ Lower Bounds 1.13e-01 1.37e-01 1.61e-01 -2.21e-01 +2.20e-01 1.71e-01 1.51e-01 1.16e-01 @@ -3187,14 +3187,14 @@ Lower Bounds 2.64e-02 1.76e-02 8.34e-03 -8.72e-02 +8.71e-02 6.82e-02 1.03e-01 9.93e-02 4.68e-02 8.00e-02 6.54e-02 -5.74e-02 +5.73e-02 5.88e-02 4.17e-02 6.05e-02 @@ -3252,7 +3252,7 @@ Lower Bounds 7.34e-02 7.91e-02 4.60e-02 -5.73e-02 +5.72e-02 6.01e-02 5.26e-02 5.01e-02 @@ -3399,7 +3399,7 @@ Upper Bounds 2.14e+00 7.89e-01 8.70e-01 -9.12e-01 +9.11e-01 9.06e-01 8.15e-01 8.92e-01 @@ -3436,7 +3436,7 @@ Upper Bounds 8.38e-01 8.52e-01 8.74e-01 -8.63e-01 +8.62e-01 8.63e-01 8.27e-01 9.20e-01 @@ -3509,8 +3509,8 @@ Upper Bounds 9.09e-01 8.56e-01 8.36e-01 -8.27e-01 -8.09e-01 +8.26e-01 +8.10e-01 7.69e-01 7.73e-01 7.71e-01 @@ -3642,14 +3642,14 @@ Upper Bounds 8.80e-01 8.68e-01 8.83e-01 -8.81e-01 +8.82e-01 8.83e-01 8.68e-01 8.89e-01 8.61e-01 9.00e-01 9.04e-01 -9.07e-01 +9.06e-01 1.33e+00 1.66e+00 5.75e-01 @@ -3657,7 +3657,7 @@ Upper Bounds 9.28e-01 9.04e-01 9.15e-01 -8.67e-01 +8.68e-01 8.37e-01 8.58e-01 8.74e-01 @@ -3673,7 +3673,7 @@ Upper Bounds 8.97e-01 8.66e-01 8.29e-01 -8.49e-01 +8.48e-01 8.85e-01 8.47e-01 8.39e-01 @@ -3734,7 +3734,7 @@ Upper Bounds 8.72e-01 8.86e-01 8.25e-01 -8.06e-01 +8.05e-01 7.70e-01 7.66e-01 7.77e-01 @@ -4084,7 +4084,7 @@ Upper Bounds 8.23e-01 8.70e-01 8.45e-01 -8.81e-01 +8.80e-01 1.24e+00 1.66e+00 6.51e-01 @@ -4098,7 +4098,7 @@ Upper Bounds 8.14e-01 7.91e-01 8.49e-01 -8.48e-01 +8.47e-01 9.21e-01 1.22e+00 1.35e+00 @@ -4124,7 +4124,7 @@ Upper Bounds 8.56e-01 8.12e-01 7.90e-01 -8.10e-01 +8.09e-01 7.88e-01 8.08e-01 8.07e-01 @@ -4141,7 +4141,7 @@ Upper Bounds 7.98e-01 8.23e-01 8.40e-01 -8.12e-01 +8.11e-01 8.01e-01 8.15e-01 8.78e-01 @@ -4149,14 +4149,14 @@ Upper Bounds 1.49e+00 5.48e-01 8.43e-01 -8.37e-01 +8.36e-01 8.81e-01 -7.97e-01 +8.18e-01 7.95e-01 7.90e-01 8.20e-01 7.94e-01 -7.75e-01 +7.74e-01 7.96e-01 7.56e-01 8.00e-01 @@ -4176,10 +4176,10 @@ Upper Bounds 7.46e-01 7.89e-01 1.17e+00 -9.25e-01 +9.24e-01 3.31e-01 8.47e-01 -8.26e-01 +8.25e-01 8.14e-01 8.34e-01 8.09e-01 @@ -4211,7 +4211,7 @@ Upper Bounds 8.80e-01 8.88e-01 8.39e-01 -8.92e-01 +8.93e-01 8.67e-01 8.43e-01 8.12e-01 @@ -4226,11 +4226,11 @@ Upper Bounds 9.42e-01 8.84e-01 8.89e-01 -4.30e-01 +8.81e-01 9.12e-01 9.52e-01 8.80e-01 -8.13e-01 +8.12e-01 8.44e-01 8.47e-01 8.47e-01 @@ -4284,7 +4284,7 @@ Upper Bounds 1.28e-01 6.06e-02 8.53e-01 -8.42e-01 +8.41e-01 8.16e-01 8.39e-01 8.62e-01 @@ -4293,7 +4293,7 @@ Upper Bounds 7.57e-01 7.84e-01 8.17e-01 -7.86e-01 +7.85e-01 8.91e-01 1.29e+00 1.58e+00 @@ -4384,7 +4384,7 @@ Upper Bounds 7.51e-01 7.69e-01 7.83e-01 -7.95e-01 +7.94e-01 1.09e+00 1.03e+00 3.79e-01 @@ -4439,7 +4439,7 @@ Upper Bounds 8.29e-01 8.34e-01 8.10e-01 -8.16e-01 +8.15e-01 8.13e-01 7.91e-01 7.58e-01 @@ -4500,7 +4500,7 @@ Upper Bounds 5.38e-01 4.35e-01 5.87e-01 -2.74e-01 +2.73e-01 3.52e-01 2.53e-01 1.54e-01 @@ -4577,7 +4577,7 @@ Upper Bounds 7.84e-01 7.91e-01 7.91e-01 -7.83e-01 +7.82e-01 7.90e-01 8.30e-01 1.25e+00 @@ -4590,7 +4590,7 @@ Upper Bounds 7.98e-01 7.82e-01 7.55e-01 -7.52e-01 +7.51e-01 8.14e-01 8.19e-01 7.83e-01 @@ -4599,7 +4599,7 @@ Upper Bounds 1.09e+00 4.51e-01 8.40e-01 -8.48e-01 +8.47e-01 8.18e-01 7.81e-01 7.89e-01 @@ -4623,7 +4623,7 @@ Upper Bounds 7.25e-01 7.18e-01 7.55e-01 -7.87e-01 +7.86e-01 8.22e-01 1.16e+00 5.88e-01 @@ -4658,7 +4658,7 @@ Upper Bounds 1.05e+00 6.00e-01 1.91e-01 -8.27e-01 +8.26e-01 7.94e-01 8.07e-01 8.05e-01 @@ -4758,7 +4758,7 @@ Upper Bounds 7.61e-01 7.94e-01 7.58e-01 -7.43e-01 +7.42e-01 7.76e-01 1.12e+00 1.01e+00 @@ -4784,12 +4784,12 @@ Upper Bounds 7.60e-01 7.73e-01 8.04e-01 -7.87e-01 +7.86e-01 7.68e-01 7.69e-01 7.72e-01 7.79e-01 -8.20e-01 +8.19e-01 1.12e+00 7.80e-01 3.07e-01 @@ -4817,7 +4817,7 @@ Upper Bounds 7.52e-01 7.32e-01 7.17e-01 -7.61e-01 +7.60e-01 7.74e-01 8.04e-01 1.13e+00 @@ -4854,12 +4854,12 @@ Upper Bounds 8.15e-01 2.44e-01 8.21e-01 -3.30e-01 +7.75e-01 7.87e-01 7.66e-01 7.39e-01 7.65e-01 -3.79e-01 +7.62e-01 6.99e-01 6.88e-01 6.98e-01 @@ -4962,10 +4962,10 @@ Upper Bounds 7.87e-01 7.72e-01 8.00e-01 -8.25e-01 -8.31e-01 +8.24e-01 +8.30e-01 8.27e-01 -7.89e-01 +7.88e-01 7.35e-01 7.02e-01 6.79e-01 @@ -4991,13 +4991,13 @@ Upper Bounds 7.91e-01 7.84e-01 8.12e-01 -8.14e-01 +8.13e-01 7.93e-01 7.86e-01 7.80e-01 7.88e-01 7.62e-01 -7.26e-01 +7.25e-01 7.48e-01 8.00e-01 1.08e+00 @@ -5013,7 +5013,7 @@ Upper Bounds 7.67e-01 7.34e-01 7.08e-01 -7.83e-01 +7.82e-01 8.28e-01 1.05e+00 7.28e-01 @@ -5043,7 +5043,7 @@ Upper Bounds 7.26e-01 7.36e-01 7.31e-01 -7.41e-01 +7.40e-01 7.92e-01 1.07e+00 6.18e-01 @@ -5089,7 +5089,7 @@ Upper Bounds 6.75e-01 6.66e-01 7.38e-01 -7.32e-01 +7.31e-01 9.88e-01 5.41e-01 1.68e-01 @@ -5219,7 +5219,7 @@ Upper Bounds 7.96e-01 8.02e-01 7.57e-01 -7.80e-01 +7.79e-01 7.99e-01 7.43e-01 7.26e-01 @@ -5251,7 +5251,7 @@ Upper Bounds 7.54e-01 7.53e-01 7.66e-01 -7.41e-01 +7.40e-01 7.01e-01 7.50e-01 8.07e-01 @@ -5274,9 +5274,9 @@ Upper Bounds 7.50e-01 2.61e-01 7.64e-01 -7.45e-01 +7.65e-01 7.60e-01 -7.26e-01 +7.25e-01 7.24e-01 7.17e-01 6.99e-01 @@ -5294,7 +5294,7 @@ Upper Bounds 7.14e-01 7.38e-01 7.21e-01 -6.81e-01 +6.80e-01 6.69e-01 6.84e-01 6.84e-01 @@ -5304,13 +5304,13 @@ Upper Bounds 3.59e-01 1.45e-01 7.38e-01 -5.93e-01 +7.18e-01 7.38e-01 7.39e-01 7.46e-01 7.70e-01 7.25e-01 -6.07e-01 +6.90e-01 6.46e-01 6.49e-01 6.56e-01 @@ -5318,7 +5318,7 @@ Upper Bounds 9.65e-01 3.98e-01 1.02e-01 -7.63e-01 +7.64e-01 7.31e-01 7.32e-01 7.05e-01 @@ -5369,7 +5369,7 @@ Upper Bounds 1.11e+00 1.11e+00 1.08e+00 -9.96e-01 +9.95e-01 1.02e+00 9.59e-01 1.01e+00 @@ -5434,7 +5434,7 @@ Upper Bounds 7.89e-01 7.16e-01 7.47e-01 -7.98e-01 +7.97e-01 1.11e+00 7.82e-01 2.29e-01 @@ -5447,7 +5447,7 @@ Upper Bounds 7.75e-01 7.99e-01 8.00e-01 -7.27e-01 +7.26e-01 7.00e-01 7.95e-01 1.12e+00 @@ -5584,7 +5584,7 @@ Upper Bounds 6.82e-01 6.66e-01 6.30e-01 -5.52e-01 +5.53e-01 6.56e-01 2.86e-01 9.02e-02 @@ -5603,7 +5603,7 @@ Upper Bounds 5.90e-01 1.70e-01 6.04e-02 -9.35e-01 +9.34e-01 7.67e-01 7.48e-01 8.36e-01 @@ -5688,7 +5688,7 @@ Upper Bounds 7.74e-01 7.69e-01 7.48e-01 -7.27e-01 +7.26e-01 7.70e-01 1.04e+00 5.38e-01 @@ -5698,7 +5698,7 @@ Upper Bounds 7.98e-01 7.72e-01 8.10e-01 -7.95e-01 +7.96e-01 7.80e-01 7.69e-01 7.86e-01 @@ -5776,7 +5776,7 @@ Upper Bounds 7.07e-01 6.87e-01 6.74e-01 -6.34e-01 +6.35e-01 6.34e-01 6.14e-01 6.22e-01 @@ -5792,10 +5792,10 @@ Upper Bounds 7.08e-01 6.86e-01 6.37e-01 -6.42e-01 +6.43e-01 5.84e-01 6.05e-01 -8.13e-01 +8.14e-01 2.50e-01 7.65e-02 7.35e-01 @@ -5805,7 +5805,7 @@ Upper Bounds 7.24e-01 7.52e-01 7.60e-01 -7.36e-01 +7.35e-01 6.72e-01 6.44e-01 6.12e-01 @@ -5860,7 +5860,7 @@ Upper Bounds 1.67e-02 7.86e-01 8.39e-01 -8.83e-01 +8.82e-01 8.55e-01 8.50e-01 8.79e-01 @@ -5901,7 +5901,7 @@ Upper Bounds 7.49e-01 8.31e-01 1.07e+00 -4.89e-01 +4.88e-01 1.30e-01 8.26e-01 8.49e-01 @@ -5909,7 +5909,7 @@ Upper Bounds 8.27e-01 8.44e-01 8.70e-01 -3.16e-01 +8.88e-01 8.04e-01 8.19e-01 7.85e-01 @@ -5923,8 +5923,8 @@ Upper Bounds 8.03e-01 8.28e-01 8.39e-01 -8.52e-01 -8.17e-01 +8.53e-01 +8.18e-01 8.07e-01 8.12e-01 8.02e-01 @@ -6023,8 +6023,8 @@ Upper Bounds 7.24e-01 2.12e-01 6.37e-02 -7.12e-01 -3.10e-01 +7.13e-01 +6.99e-01 7.21e-01 7.24e-01 7.11e-01 @@ -6036,7 +6036,7 @@ Upper Bounds 5.74e-01 5.37e-01 6.18e-01 -1.92e-01 +1.95e-01 5.93e-02 9.23e-01 8.49e-01 @@ -6053,8 +6053,8 @@ Upper Bounds 3.58e-01 1.02e-01 3.58e-02 -6.34e-01 -3.24e-01 +6.33e-01 +3.23e-01 4.14e-01 5.18e-01 3.93e-01 @@ -6067,7 +6067,7 @@ Upper Bounds 2.08e-01 1.27e-01 3.00e-02 -9.84e-03 +9.83e-03 2.53e-01 1.24e-01 1.72e-01 @@ -6211,7 +6211,7 @@ Upper Bounds 1.03e+00 1.15e+00 1.11e+00 -9.64e-01 +9.63e-01 1.01e+00 9.05e-01 8.67e-01 @@ -6229,8 +6229,8 @@ Upper Bounds 8.93e-01 8.70e-01 8.58e-01 -8.56e-01 -8.00e-01 +8.57e-01 +8.01e-01 2.31e-01 7.13e-02 9.12e-01 @@ -6249,7 +6249,7 @@ Upper Bounds 2.01e-01 7.22e-02 7.80e-01 -8.00e-01 +7.99e-01 9.64e-01 9.33e-01 9.70e-01 @@ -6277,7 +6277,7 @@ Upper Bounds 5.08e-01 3.32e-01 9.24e-02 -4.15e-02 +4.14e-02 3.42e-01 2.04e-01 2.56e-01 @@ -6414,12 +6414,12 @@ Upper Bounds 1.17e-01 7.24e-02 5.31e-01 -7.17e-01 +7.16e-01 8.03e-01 7.87e-01 9.01e-01 9.00e-01 -6.18e-01 +6.17e-01 6.08e-01 4.09e-01 3.65e-01 @@ -6545,7 +6545,7 @@ Upper Bounds 2.87e-01 1.88e-01 1.85e-01 -1.80e-01 +1.79e-01 1.07e-01 3.77e-02 5.65e-01 @@ -6578,13 +6578,13 @@ Upper Bounds 1.41e-01 5.88e-02 6.26e-02 -4.47e-01 +4.46e-01 3.47e-01 5.27e-01 6.11e-01 3.91e-01 4.22e-01 -4.77e-01 +4.76e-01 4.54e-01 4.31e-01 3.19e-01 @@ -6727,14 +6727,14 @@ Upper Bounds 5.73e-02 5.81e-02 1.92e-02 -6.10e-03 +6.09e-03 2.72e-02 4.77e-02 4.74e-02 3.34e-02 5.41e-02 7.93e-02 -6.70e-02 +6.69e-02 7.67e-02 9.31e-02 5.17e-02 diff --git a/tests/regression_tests/white_plane/results_true.dat b/tests/regression_tests/white_plane/results_true.dat index 6f1d064eb..ffb19491d 100644 --- a/tests/regression_tests/white_plane/results_true.dat +++ b/tests/regression_tests/white_plane/results_true.dat @@ -1,2 +1,2 @@ k-combined: -2.279719E+00 5.380792E-03 +2.274312E+00 4.223342E-03 diff --git a/tests/testing_harness.py b/tests/testing_harness.py index 6de475e6e..1ad91b7a8 100644 --- a/tests/testing_harness.py +++ b/tests/testing_harness.py @@ -68,7 +68,7 @@ class TestHarness: if config['mpi']: mpi_args = [config['mpiexec'], '-n', config['mpi_np']] openmc.run(openmc_exec=config['exe'], mpi_args=mpi_args, - event_based=config['event']) + event_based=config['event']) else: openmc.run(openmc_exec=config['exe'], event_based=config['event']) @@ -305,9 +305,12 @@ class PyAPITestHarness(TestHarness): else: self.execute_test() - def execute_test(self): + def execute_test(self, change_dir=False): """Build input XMLs, run OpenMC, and verify correct results.""" + base_dir = os.getcwd() if change_dir else None try: + if change_dir: + os.chdir(self.workdir) self._build_inputs() inputs = self._get_inputs() self._write_inputs(inputs) @@ -319,10 +322,15 @@ class PyAPITestHarness(TestHarness): self._compare_results() finally: self._cleanup() + if base_dir: + os.chdir(base_dir) - def update_results(self): + def update_results(self, change_dir=False): """Update results_true.dat and inputs_true.dat""" + base_dir = os.getcwd() if change_dir else None try: + if change_dir: + os.chdir(self.workdir) self._build_inputs() inputs = self._get_inputs() self._write_inputs(inputs) @@ -334,6 +342,8 @@ class PyAPITestHarness(TestHarness): self._overwrite_results() finally: self._cleanup() + if base_dir: + os.chdir(base_dir) def _build_inputs(self): """Write input XML files.""" @@ -371,7 +381,8 @@ class PyAPITestHarness(TestHarness): """Delete XMLs, statepoints, tally, and test files.""" super()._cleanup() output = ['materials.xml', 'geometry.xml', 'settings.xml', - 'tallies.xml', 'plots.xml', 'inputs_test.dat', 'model.xml'] + 'tallies.xml', 'plots.xml', 'inputs_test.dat', 'model.xml', + 'collision_track.h5', 'collision_track.mcpl'] for f in output: if os.path.exists(f): os.remove(f) @@ -389,6 +400,7 @@ class TolerantPyAPITestHarness(PyAPITestHarness): due to single precision usage (e.g., as in the random ray solver). """ + def _are_files_equal(self, actual_path, expected_path, tolerance): def isfloat(value): try: @@ -428,7 +440,8 @@ class TolerantPyAPITestHarness(PyAPITestHarness): def _compare_results(self): """Make sure the current results agree with the reference.""" - compare = self._are_files_equal('results_test.dat', 'results_true.dat', 1e-6) + compare = self._are_files_equal( + 'results_test.dat', 'results_true.dat', 1e-6) if not compare: expected = open('results_true.dat').readlines() actual = open('results_test.dat').readlines() @@ -443,7 +456,7 @@ class TolerantPyAPITestHarness(PyAPITestHarness): class WeightWindowPyAPITestHarness(PyAPITestHarness): def _get_results(self): """Digest info in the weight window file and return as a string.""" - ww = openmc.hdf5_to_wws()[0] + ww = openmc.WeightWindowsList.from_hdf5()[0] # Access the weight window bounds lower_bound = ww.lower_ww_bounds @@ -476,6 +489,7 @@ class WeightWindowPyAPITestHarness(PyAPITestHarness): class PlotTestHarness(TestHarness): """Specialized TestHarness for running OpenMC plotting tests.""" + def __init__(self, plot_names, voxel_convert_checks=[]): super().__init__(None) self._plot_names = plot_names @@ -523,3 +537,105 @@ class PlotTestHarness(TestHarness): outstr = sha512.hexdigest() return outstr + + +class CollisionTrackTestHarness(PyAPITestHarness): + def __init__(self, statepoint_name, model=None, inputs_true=None, workdir=None): + super().__init__(statepoint_name, model, inputs_true) + self.workdir = workdir + + def _test_output_created(self): + """Make sure collision_track.h5 has also been created.""" + super()._test_output_created() + if self._model.settings.collision_track: + assert os.path.exists( + "collision_track.h5" + ), "collision_track file has not been created." + + def _compare_output(self): + """Compare collision_track.h5 files.""" + if self._model.settings.collision_track: + collision_track_true = self._return_collision_track_data( + "collision_track_true.h5") + collision_track_test = self._return_collision_track_data( + "collision_track.h5") + np.testing.assert_allclose( + collision_track_true, collision_track_test, rtol=1e-07) + + def main(self): + """Accept commandline arguments and either run or update tests.""" + if config["build_inputs"]: + self.build_inputs() + elif config["update"]: + self.update_results(change_dir=True) + else: + self.execute_test(change_dir=True) + + def build_inputs(self): + """Build inputs.""" + base_dir = os.getcwd() + try: + os.chdir(self.workdir) + self._build_inputs() + finally: + os.chdir(base_dir) + + def _overwrite_results(self): + """Also add the 'collision_track.h5' file during overwriting.""" + super()._overwrite_results() + if os.path.exists("collision_track.h5"): + shutil.copyfile("collision_track.h5", "collision_track_true.h5") + + @staticmethod + def _return_collision_track_data(filepath): + """ + Read a collision_track file and return a sorted array composed + of flatten arrays of collision information. + + Parameters + ---------- + filepath : str + Path to the collision_track file + + Returns + ------- + data : np.array + Sorted array composed of flatten arrays of collision_track data for + each collision information + """ + data = [] + keys = [] + + # Read source file + source = openmc.read_collision_track_file(filepath) + for src in source: + r = src['r'] + u = src['u'] + e = src['E'] + de = src['dE'] + time = src['time'] + wgt = src['wgt'] + delayed_group = src['delayed_group'] + cell_id = src['cell_id'] + nuclide_id = src['nuclide_id'] + material_id = src['material_id'] + universe_id = src['universe_id'] + n_collision = src['n_collision'] + event_mt = src['event_mt'] + key = ( + f"{r[0]:.10e} {r[1]:.10e} {r[2]:.10e} {u[0]:.10e} {u[1]:.10e} {u[2]:.10e}" + f"{e:.10e} {de:.10e} {time:.10e} {wgt:.10e} {event_mt} {delayed_group} {cell_id}" + f"{nuclide_id} {material_id} {universe_id} {n_collision} " + ) + keys.append(key) + values = [*r, *u, e, de, time, wgt, event_mt, + delayed_group, cell_id, nuclide_id, material_id, + universe_id, n_collision] + assert len(values) == 17 + data.append(values) + + data = np.array(data) + keys = np.array(keys) + sorted_idx = np.argsort(keys, kind='stable') + + return data[sorted_idx] diff --git a/tests/unit_tests/__init__.py b/tests/unit_tests/__init__.py index e97ab13e2..44b5a5018 100644 --- a/tests/unit_tests/__init__.py +++ b/tests/unit_tests/__init__.py @@ -14,3 +14,12 @@ def assert_unbounded(obj): ll, ur = obj.bounding_box assert ll == pytest.approx((-np.inf, -np.inf, -np.inf)) assert ur == pytest.approx((np.inf, np.inf, np.inf)) + + +def assert_sample_mean(samples, expected_mean): + # Calculate sample standard deviation + std_dev = samples.std() / np.sqrt(samples.size - 1) + + # Means should agree within 4 sigma 99.993% of the time. Note that this is + # expected to fail about 1 out of 16,000 times + assert np.abs(expected_mean - samples.mean()) < 4*std_dev diff --git a/tests/unit_tests/dagmc/dagmc_tetrahedral_no_graveyard.h5m b/tests/unit_tests/dagmc/dagmc_tetrahedral_no_graveyard.h5m new file mode 100644 index 000000000..2aa72956b Binary files /dev/null and b/tests/unit_tests/dagmc/dagmc_tetrahedral_no_graveyard.h5m differ diff --git a/tests/unit_tests/dagmc/test_lost_particles.py b/tests/unit_tests/dagmc/test_lost_particles.py index 502bd795e..3a4166009 100644 --- a/tests/unit_tests/dagmc/test_lost_particles.py +++ b/tests/unit_tests/dagmc/test_lost_particles.py @@ -70,12 +70,12 @@ def test_lost_particles(run_in_tmpdir, broken_dagmc_model): openmc.run() # run this again, but with the dagmc universe as the root unvierse + # to ensure that lost particles are still caught in this case for univ in broken_dagmc_model.geometry.get_all_universes().values(): if isinstance(univ, openmc.DAGMCUniverse): - broken_dagmc_model.geometry.root_unvierse = univ + broken_dagmc_model.geometry.root_universe = univ break broken_dagmc_model.export_to_xml() with pytest.raises(RuntimeError, match='Maximum number of lost particles has been reached.'): openmc.run() - diff --git a/tests/unit_tests/dagmc/test_model.py b/tests/unit_tests/dagmc/test_model.py index 9fdfbcebc..0917f5b23 100644 --- a/tests/unit_tests/dagmc/test_model.py +++ b/tests/unit_tests/dagmc/test_model.py @@ -4,6 +4,7 @@ import lxml.etree as ET import numpy as np import pytest import openmc +import openmc.lib from openmc.utility_funcs import change_directory pytestmark = pytest.mark.skipif( @@ -30,7 +31,7 @@ def model(request): p = Path(request.fspath).parent / "dagmc.h5m" - daguniv = openmc.DAGMCUniverse(p, auto_geom_ids=True) + daguniv = openmc.DAGMCUniverse(p, name='simple-dagmc', auto_geom_ids=True) lattice = openmc.RectLattice() lattice.dimension = [2, 2] @@ -231,6 +232,7 @@ def test_dagmc_xml(model): dagmc_ele = root.find('dagmc_universe') assert dagmc_ele.get('id') == str(dag_univ.id) + assert dagmc_ele.get('name') == str(dag_univ.name) assert dagmc_ele.get('filename') == str(dag_univ.filename) assert dagmc_ele.get('auto_geom_ids') == str(dag_univ.auto_geom_ids).lower() diff --git a/tests/unit_tests/dagmc/test_plot.py b/tests/unit_tests/dagmc/test_plot.py new file mode 100644 index 000000000..6ce1d79a2 --- /dev/null +++ b/tests/unit_tests/dagmc/test_plot.py @@ -0,0 +1,71 @@ +import pytest +import openmc +import openmc.lib + + +pytestmark = pytest.mark.skipif( + not openmc.lib._dagmc_enabled(), reason="DAGMC CAD geometry is not enabled." +) + +def test_plotting_dagmc_model(request): + """Test plotting a DAGMC model with OpenMC. This is different to CSG + model plotting as the path to the DAGMC file needs handling.""" + + dag_universe = openmc.DAGMCUniverse(request.path.parent / 'dagmc.h5m') + csg_with_dag_inside = dag_universe.bounded_universe() + model = openmc.Model() + model.geometry = openmc.Geometry(csg_with_dag_inside) + + for mat_name in dag_universe.material_names: + material = openmc.Material(name=mat_name) + material.add_nuclide("Fe56", 1.0) + material.set_density("g/cm3", 7.0) + model.materials.append(material) + + # putting the source at the center of the bounding box of the DAGMC + model.settings.source = openmc.IndependentSource( + space=openmc.stats.Point(dag_universe.bounding_box.center) + ) + model.settings.batches = 10 + model.settings.particles = 50 + + model.plot() + + +def test_plotting_dagmc_universe(request): + """Test plotting a DAGMCUniverse with OpenMC. This is different to plotting + UniverseBase as the materials are not defined withing the DAGMCUniverse.""" + + dag_universe = openmc.DAGMCUniverse(request.path.parent / 'dagmc.h5m') + dag_universe.plot() + + +def test_plotting_geometry_filled_with_dagmc_universe(request): + """Test plotting a geometry with OpenMC. This is an edge case when plotting + geometry as often geometry objects don't include a DAGMCUniverse. The + inclusion of a DAGMCUniverse requires special handling for the materials.""" + + dag_universe = openmc.DAGMCUniverse(request.path.parent / 'dagmc.h5m', auto_geom_ids=True) + + sphere1 = openmc.Sphere(r=50.0) + sphere2 = openmc.Sphere(r=60.0) + sphere2 = openmc.Sphere(r=70.0, boundary_type='vacuum') + + # Adding a material to the CSG Universe to check universe materials are accounted for + csg_material = openmc.Material(name='csg_material') + csg_material.add_nuclide("H1", 1.0) + + # Adding a material with the same name as a dagmc material to check that + # the plot can handel two materials with the same name from different universes + csg_material = openmc.Material(name=dag_universe.material_names[0]) + csg_material.add_nuclide("H1", 1.0) + + cell1 = openmc.Cell(fill=dag_universe, region=-sphere1) + cell2 = openmc.Cell(fill=csg_material, region=+sphere1 & -sphere2) + + geometry = openmc.Geometry([cell1, cell2]) + geometry.plot() + + # Close plot to avoid warning + import matplotlib.pyplot as plt + plt.close() diff --git a/tests/unit_tests/mesh_to_vtk/test.py b/tests/unit_tests/mesh_to_vtk/test.py index 3ee6c0298..f00aa4626 100644 --- a/tests/unit_tests/mesh_to_vtk/test.py +++ b/tests/unit_tests/mesh_to_vtk/test.py @@ -49,7 +49,10 @@ sphere_mesh = openmc.SphericalMesh( def mesh_data(mesh_dims): data = 100 * np.arange(np.prod(mesh_dims), dtype=float) - return data.reshape(*mesh_dims) + # data is returned reshaped with order 'F' to ensure that + # the resulting data is interpreted correctly by the + # write_data_to_vtk method + return data.reshape(*mesh_dims, order='F') test_data = ((reg_mesh, False, 'regular'), (rect_mesh, False, 'rectilinear'), @@ -83,7 +86,6 @@ def test_mesh_write_vtk(mesh_params, run_in_tmpdir): # check data writing def test_mesh_write_vtk_data(run_in_tmpdir): - data = {'ascending_data': mesh_data(cyl_mesh.dimension)} filename_expected = full_path('cyl-data.vtk') filename_actual = full_path('cyl-data-actual.vtk') diff --git a/tests/unit_tests/mesh_to_vtk/test_vtk_dims.py b/tests/unit_tests/mesh_to_vtk/test_vtk_dims.py index 0b6acf5aa..8166ba68c 100644 --- a/tests/unit_tests/mesh_to_vtk/test_vtk_dims.py +++ b/tests/unit_tests/mesh_to_vtk/test_vtk_dims.py @@ -90,7 +90,7 @@ def test_write_data_to_vtk(mesh, tmpdir): # kji (i changing fastest) orering is expected for input data # by using the volumes transposed as the data here, we can ensure the # normalization is happening correctly - data = mesh.volumes.T + data = mesh.volumes # RUN mesh.write_data_to_vtk(filename=filename, datasets={"label1": data, "label2": data}) diff --git a/tests/unit_tests/test_cell.py b/tests/unit_tests/test_cell.py index 95c8249bb..60b205818 100644 --- a/tests/unit_tests/test_cell.py +++ b/tests/unit_tests/test_cell.py @@ -126,6 +126,29 @@ def test_temperature(cell_with_lattice): c.temperature = (300., 600., 900.) +def test_densities(cell_with_lattice): + # Make sure density propagates through universes + m = openmc.Material() + s = openmc.XPlane() + c1 = openmc.Cell(fill=m, region=+s) + c2 = openmc.Cell(fill=m, region=-s) + u1 = openmc.Universe(cells=[c1, c2]) + c = openmc.Cell(fill=u1) + + c.density = 1. + assert c1.density == 1. + assert c2.density == 1. + with pytest.raises(ValueError): + c.density = -1. + c.density = None + assert c1.density == None + assert c2.density == None + + # distributed density + cells, _, _, _ = cell_with_lattice + c = cells[0] + c.density = (1., 2., 3.) + def test_rotation(): u = openmc.Universe() c = openmc.Cell(fill=u) diff --git a/tests/unit_tests/test_collision_track.py b/tests/unit_tests/test_collision_track.py new file mode 100644 index 000000000..25344a3bd --- /dev/null +++ b/tests/unit_tests/test_collision_track.py @@ -0,0 +1,129 @@ +"""Test the 'collision_track' setting used to store particle information +during specified collision conditions in a file for a given simulation.""" + +import openmc +import pytest +import h5py +import numpy as np +import shutil + +from tests.testing_harness import CollisionTrackTestHarness as ctt + + +@pytest.fixture(scope="module") +def geometry(): + """Simple hydrogen sphere geometry""" + openmc.reset_auto_ids() + material = openmc.Material(name="H1") + material.add_element("H", 1.0) + sphere = openmc.Sphere(r=1.0, boundary_type="vacuum") + cell = openmc.Cell(region=-sphere, fill=material) + return openmc.Geometry([cell]) + + +@pytest.mark.parametrize( + "parameter", + [ + {"max_collisions": 200}, + {"max_collisions": 200, "reactions": ["(n,disappear)"]}, + {"max_collisions": 200, "cell_ids": [1]}, + {"max_collisions": 200, "material_ids": [1]}, + {"max_collisions": 200, "universe_ids": [1]}, + {"max_collisions": 200, "nuclides": ["H1"]}, + {"max_collisions": 200, "deposited_E_threshold": 200000.0}, + {"max_collisions": 200, "mcpl": True} + + ], +) +def test_xml_serialization(parameter, run_in_tmpdir): + """Check that the different use cases can be written and read in XML.""" + settings = openmc.Settings() + settings.collision_track = parameter + settings.export_to_xml() + + read_settings = openmc.Settings.from_xml() + assert read_settings.collision_track == parameter + + +@pytest.fixture(scope="module") +def model(): + """Simple hydrogen sphere divided in two hemispheres + by a z-plane to form 2 cells.""" + openmc.reset_auto_ids() + model = openmc.Model() + + # Material + material = openmc.Material(name="H1") + material.add_element("H", 1.0) + + # Geometry + radius = 1.0 + sphere = openmc.Sphere(r=radius, boundary_type="reflective") + plane = openmc.ZPlane(0.0) + cell_1 = openmc.Cell(region=-sphere & -plane, fill=material, cell_id=1) + cell_2 = openmc.Cell(region=-sphere & +plane, fill=material, cell_id=2) + root = openmc.Universe(cells=[cell_1, cell_2]) + model.geometry = openmc.Geometry(root) + + # Settings + model.settings = openmc.Settings() + model.settings.run_mode = "fixed source" + model.settings.particles = 1 + model.settings.batches = 1 + model.settings.seed = 2 + + bounds = [-radius, -radius, -radius, radius, radius, radius] + distribution = openmc.stats.Box(bounds[:3], bounds[3:]) + model.settings.source = openmc.IndependentSource(space=distribution) + + return model + + +def test_particle_location(run_in_tmpdir, model): + """Test the location of particles with respected to the "cell_ids" + and the location x, y, z of the particle itself. the upper sphere will + have positive z component and the bottom sphere a negative z compnent. + + """ + model.settings.collision_track = { + "max_collisions": 200, + "reactions": ["elastic"], + "cell_ids": [1, 2] + } + model.run() + + with h5py.File("collision_track.h5", "r") as f: + source = f["collision_track_bank"] + + assert len(source) == 60 + + # We want to verify that the collisions happenening are in the right cells + # and the position of the particle is either positive or negative relative + # to the z plane. In this case, we track the position of the particle + # relative to the cell_id already set. + for point in source: + if point['cell_id'] == 1: + assert point['r'][2] < 0.0 # z component negative + elif point['cell_id'] == 2: + assert point["r"][2] > 0.0 # z component positive + else: + assert False + + +@pytest.mark.skipif(shutil.which("mcpl-config") is None, reason="MCPL is not available.") +def test_format_similarity(run_in_tmpdir, model): + model.settings.collision_track = {"max_collisions": 200, "reactions": ['elastic'], + "cell_ids": [1, 2], "mcpl": False} + model.run() + data_h5 = ctt._return_collision_track_data('collision_track.h5') + + model.settings.collision_track["mcpl"] = True + model.run() + data_mcpl = ctt._return_collision_track_data('collision_track.mcpl') + + assert len(data_h5) == 60 + assert len(data_mcpl) == 60 + + np.testing.assert_allclose(data_h5, data_mcpl, rtol=1e-05) + # tolerance not that low due to the strings that is saved in MCPL, + # not enough precision! diff --git a/tests/unit_tests/test_config.py b/tests/unit_tests/test_config.py index 9d3f53a74..45e6a7e5a 100644 --- a/tests/unit_tests/test_config.py +++ b/tests/unit_tests/test_config.py @@ -1,53 +1,104 @@ from collections.abc import Mapping import os +from pathlib import Path import openmc +from openmc.config import _default_config +from openmc.data import decay import pytest -@pytest.fixture(autouse=True, scope='module') -def reset_config(): - config = dict(openmc.config) +@pytest.fixture(autouse=True, scope='function') +def reset_config_and_env(): + """A fixture to ensure each test has a clean config, env, and CWD.""" + original_env = dict(os.environ) + original_cwd = os.getcwd() + original_resolve_paths = openmc.config["resolve_paths"] + + # Reset environment variables that affect config + for key in ['OPENMC_CROSS_SECTIONS', 'OPENMC_MG_CROSS_SECTIONS', 'OPENMC_CHAIN_FILE']: + if key in os.environ: + del os.environ[key] + + # Re-initialize the global config object + openmc.config = _default_config() + try: yield finally: - openmc.config.clear() - openmc.config.update(config) + # Restore environment, CWD and resolve_paths + os.environ.clear() + os.environ.update(original_env) + os.chdir(original_cwd) + + # Restore config one last time for safety between modules + openmc.config = _default_config(resolve_paths=original_resolve_paths) def test_config_basics(): assert isinstance(openmc.config, Mapping) - for key, value in openmc.config.items(): - assert isinstance(key, str) - if key == 'resolve_paths': - assert isinstance(value, bool) - else: - assert isinstance(value, os.PathLike) - - # Set and delete - openmc.config['cross_sections'] = '/path/to/cross_sections.xml' + with pytest.warns(UserWarning): + openmc.config['cross_sections'] = '/path/to/cross_sections.xml' del openmc.config['cross_sections'] assert 'cross_sections' not in openmc.config assert 'OPENMC_CROSS_SECTIONS' not in os.environ - - # Can't use any key - with pytest.raises(KeyError): - openmc.config['🐖'] = '/like/to/eat/bacon' + with pytest.raises(KeyError, match="Unrecognized config key: nuke"): + openmc.config['nuke'] = '/like/to/eat/bacon' + with pytest.raises(TypeError): + openmc.config['resolve_paths'] = 'not a bool' -def test_config_patch(): - openmc.config['cross_sections'] = '/path/to/cross_sections.xml' - with openmc.config.patch('cross_sections', '/path/to/other.xml'): - assert str(openmc.config['cross_sections']) == '/path/to/other.xml' - assert str(openmc.config['cross_sections']) == '/path/to/cross_sections.xml' +def test_config_path_resolution(tmp_path): + """Test path resolution logic.""" + os.chdir(tmp_path) + relative_path = Path("some/file.xml") + absolute_path = relative_path.resolve() + + # Test with resolve_paths = True (default) + with pytest.warns(UserWarning): + openmc.config['cross_sections'] = relative_path + assert openmc.config['cross_sections'] == absolute_path + assert openmc.config['cross_sections'].is_absolute() + + # Test with resolve_paths = False + with openmc.config.patch('resolve_paths', False): + with pytest.warns(UserWarning): + openmc.config['chain_file'] = relative_path + assert openmc.config['chain_file'] == relative_path + assert not openmc.config['chain_file'].is_absolute() + + assert openmc.config['resolve_paths'] is True -def test_config_set_envvar(): - openmc.config['cross_sections'] = '/path/to/cross_sections.xml' - assert os.environ['OPENMC_CROSS_SECTIONS'] == '/path/to/cross_sections.xml' +def test_config_patch(tmp_path): + file_a = tmp_path / "a.xml"; file_a.touch() + file_b = tmp_path / "b.xml"; file_b.touch() + openmc.config['cross_sections'] = file_a + with openmc.config.patch('cross_sections', file_b): + assert openmc.config['cross_sections'] == file_b.resolve() + assert openmc.config['cross_sections'] == file_a.resolve() - openmc.config['mg_cross_sections'] = '/path/to/mg_cross_sections.h5' - assert os.environ['OPENMC_MG_CROSS_SECTIONS'] == '/path/to/mg_cross_sections.h5' +def test_config_set_envvar(tmp_path): + """Test that setting config also sets environment variables correctly.""" + os.chdir(tmp_path) + relative_path = Path("relative.xml") + with pytest.warns(UserWarning): + openmc.config['cross_sections'] = relative_path + expected_path = str(relative_path.resolve()) + assert os.environ['OPENMC_CROSS_SECTIONS'] == expected_path - openmc.config['chain_file'] = '/path/to/chain_file.xml' - assert os.environ['OPENMC_CHAIN_FILE'] == '/path/to/chain_file.xml' + +def test_config_warning_nonexistent_path(tmp_path): + """Test that a warning is issued for a path that does not exist.""" + bad_path = tmp_path / "a/path/that/does/not/exist.xml" + with pytest.warns(UserWarning, match=f"Path '{bad_path}' does not exist."): + openmc.config['chain_file'] = bad_path + + +def test_config_chain_side_effect(tmp_path): + """Test that modifying chain_file clears decay data caches.""" + chain_file = tmp_path / "chain.xml"; chain_file.touch() + decay._DECAY_ENERGY['U235'] = (1.0, 2.0) + decay._DECAY_PHOTON_ENERGY['PU239'] = {} + openmc.config['chain_file'] = chain_file + assert not decay._DECAY_ENERGY and not decay._DECAY_PHOTON_ENERGY diff --git a/tests/unit_tests/test_cylindrical_mesh.py b/tests/unit_tests/test_cylindrical_mesh.py index b408bc0e9..645269825 100644 --- a/tests/unit_tests/test_cylindrical_mesh.py +++ b/tests/unit_tests/test_cylindrical_mesh.py @@ -49,6 +49,7 @@ def model(): return openmc.Model(geometry=geom, settings=settings, tallies=tallies) + def test_origin_read_write_to_xml(run_in_tmpdir, model): """Tests that the origin attribute can be written and read back to XML """ @@ -63,8 +64,9 @@ def test_origin_read_write_to_xml(run_in_tmpdir, model): np.testing.assert_equal(new_mesh.origin, mesh.origin) estimators = ('tracklength', 'collision') -origins = set(permutations((-geom_size, 0, 0))) -origins |= set(permutations((geom_size, 0, 0))) +offset = geom_size + 0.001 +origins = set(permutations((-offset , 0, 0))) +origins |= set(permutations((offset, 0, 0))) test_cases = product(estimators, origins) @@ -74,8 +76,9 @@ def label(p): if isinstance(p, str): return f'estimator:{p}' + @pytest.mark.parametrize('estimator,origin', test_cases, ids=label) -def test_offset_mesh(run_in_tmpdir, model, estimator, origin): +def test_offset_mesh(model, estimator, origin): """Tests that the mesh has been moved based on tally results """ mesh = model.tallies[0].filters[0].mesh @@ -103,6 +106,7 @@ def test_offset_mesh(run_in_tmpdir, model, estimator, origin): else: mean[i, j, k] != 0.0 + @pytest.fixture() def void_coincident_geom_model(): """A model with many geometric boundaries coincident with mesh boundaries @@ -155,6 +159,7 @@ def _check_void_cylindrical_tally(statepoint_filename): d_r = mesh.r_grid[1] - mesh.r_grid[0] assert neutron_flux == pytest.approx(d_r) + def test_void_geom_pnt_src(run_in_tmpdir, void_coincident_geom_model): src = openmc.IndependentSource() src.space = openmc.stats.Point() diff --git a/tests/unit_tests/test_d1s.py b/tests/unit_tests/test_d1s.py index 7c92dd6d9..8f3b62f40 100644 --- a/tests/unit_tests/test_d1s.py +++ b/tests/unit_tests/test_d1s.py @@ -22,7 +22,8 @@ def model(): def test_get_radionuclides(model): # Check that radionuclides are correct and are unstable - nuclides = d1s.get_radionuclides(model, CHAIN_PATH) + chain = openmc.deplete.Chain.from_xml(CHAIN_PATH) + nuclides = d1s.get_radionuclides(model, chain) assert sorted(nuclides) == [ 'Co58', 'Co60', 'Co61', 'Co62', 'Co64', 'Fe55', 'Fe59', 'Fe61', 'Ni57', 'Ni59', 'Ni63', 'Ni65' @@ -83,6 +84,11 @@ def test_prepare_tallies(model): assert tally.contains_filter(openmc.ParentNuclideFilter) assert sorted(tally.filters[-1].bins) == sorted(radionuclides) + assert len(tally.filters) == 2 + # calling prepare_tallies twice should not add another ParentNuclideFilter + d1s.prepare_tallies(model, chain_file=CHAIN_PATH) + assert len(tally.filters) == 2 + def test_apply_time_correction(run_in_tmpdir): # Make simple sphere model with elemental Ni @@ -114,6 +120,13 @@ def test_apply_time_correction(run_in_tmpdir): tally = sp.tallies[tally.id] flux = tally.mean.flatten() + # Copy attributes from original tally + tally_filters = list(tally.filters) + tally_sum = tally.sum.copy() + tally_sum_sq = tally.sum_sq.copy() + tally_mean = tally.mean.copy() + tally_std_dev = tally.std_dev.copy() + # Apply TCF and make sure results are consistent result = d1s.apply_time_correction(tally, factors, sum_nuclides=False) tcf = np.array([factors[nuc][-1] for nuc in nuclides]) @@ -123,6 +136,13 @@ def test_apply_time_correction(run_in_tmpdir): result_summed = d1s.apply_time_correction(tally, factors) assert result_summed.mean.flatten()[0] == pytest.approx(result.mean.sum()) + # Make sure original tally is unchanged + assert tally.filters == tally_filters + assert np.all(tally.sum == tally_sum) + assert np.all(tally.sum_sq == tally_sum_sq) + assert np.all(tally.mean == tally_mean) + assert np.all(tally.std_dev == tally_std_dev) + # Make sure various tally methods work result.get_values() result_summed.get_values() diff --git a/tests/unit_tests/test_data_decay.py b/tests/unit_tests/test_data_decay.py index 8900e7eac..de8d90a43 100644 --- a/tests/unit_tests/test_data_decay.py +++ b/tests/unit_tests/test_data_decay.py @@ -17,25 +17,22 @@ def ufloat_close(a, b): @pytest.fixture(scope='module') -def nb90(): +def nb90(endf_data): """Nb90 decay data.""" - endf_data = os.environ['OPENMC_ENDF_DATA'] filename = os.path.join(endf_data, 'decay', 'dec-041_Nb_090.endf') return openmc.data.Decay.from_endf(filename) @pytest.fixture(scope='module') -def ba137m(): +def ba137m(endf_data): """Ba137_m1 decay data.""" - endf_data = os.environ['OPENMC_ENDF_DATA'] filename = os.path.join(endf_data, 'decay', 'dec-056_Ba_137m1.endf') return openmc.data.Decay.from_endf(filename) @pytest.fixture(scope='module') -def u235_yields(): +def u235_yields(endf_data): """U235 fission product yield data.""" - endf_data = os.environ['OPENMC_ENDF_DATA'] filename = os.path.join(endf_data, 'nfy', 'nfy-092_U_235.endf') return openmc.data.FissionProductYields.from_endf(filename) diff --git a/tests/unit_tests/test_data_dose.py b/tests/unit_tests/test_data_dose.py index 2d80cf838..4f1880014 100644 --- a/tests/unit_tests/test_data_dose.py +++ b/tests/unit_tests/test_data_dose.py @@ -41,3 +41,23 @@ def test_dose_coefficients(): dose_coefficients('neutron', 'ZZ') with raises(ValueError): dose_coefficients('neutron', data_source='icrp7000') + with raises(ValueError) as excinfo: + dose_coefficients("photons", data_source="icrp116") + expected_particles = [ + "electron", + "helium", + "mu+", + "mu-", + "neutron", + "photon", + "photon kerma", + "pi+", + "pi-", + "positron", + "proton", + ] + expected_msg = ( + "'photons' has no dose data in data source icrp116. " + f"Available particles for icrp116 are: {expected_particles}" + ) + assert str(excinfo.value) == expected_msg diff --git a/tests/unit_tests/test_data_kalbach_mann.py b/tests/unit_tests/test_data_kalbach_mann.py index 3b837af7d..5d06669f7 100644 --- a/tests/unit_tests/test_data_kalbach_mann.py +++ b/tests/unit_tests/test_data_kalbach_mann.py @@ -7,6 +7,7 @@ import pytest import numpy as np +import openmc from openmc.data import IncidentNeutron from openmc.data.kalbach_mann import _separation_energy, _AtomicRepresentation from openmc.data import kalbach_slope @@ -129,7 +130,7 @@ def test_kalbach_slope(): ('Hg204.h5', 'n-080_Hg_204.endf') ] ) -def test_comparison_slope_hdf5(hdf5_filename, endf_filename): +def test_comparison_slope_hdf5(hdf5_filename, endf_filename, endf_data): """Test the calculation of the Kalbach-Mann slope done by OpenMC by comparing it to HDF5 data. The test is based on the first product of MT=5 (neutron). The isotopes tested have been selected because the @@ -147,13 +148,13 @@ def test_comparison_slope_hdf5(hdf5_filename, endf_filename): """ # HDF5 data - hdf5_directory = Path(os.environ['OPENMC_CROSS_SECTIONS']).parent + hdf5_directory = Path(openmc.config.get('cross_sections')).parent hdf5_data = IncidentNeutron.from_hdf5(hdf5_directory / hdf5_filename) hdf5_product = hdf5_data[5].products[0] hdf5_distribution = hdf5_product.distribution[0] # ENDF data - endf_directory = Path(os.environ['OPENMC_ENDF_DATA']) + endf_directory = Path(endf_data) endf_path = endf_directory / 'neutrons' / endf_filename endf_data = IncidentNeutron.from_endf(endf_path) endf_product = endf_data[5].products[0] diff --git a/tests/unit_tests/test_data_misc.py b/tests/unit_tests/test_data_misc.py index 226d848a5..14db68913 100644 --- a/tests/unit_tests/test_data_misc.py +++ b/tests/unit_tests/test_data_misc.py @@ -30,7 +30,7 @@ def test_data_library(tmpdir): assert os.path.exists(filename) new_lib = openmc.data.DataLibrary() - directory = os.path.dirname(os.environ['OPENMC_CROSS_SECTIONS']) + directory = os.path.dirname(openmc.config.get('cross_sections')) new_lib.register_file(os.path.join(directory, 'H1.h5')) assert new_lib[-1]['type'] == 'neutron' new_lib.register_file(os.path.join(directory, 'c_Zr_in_ZrH.h5')) @@ -131,7 +131,8 @@ def test_zam(): assert openmc.data.zam('Am242_m10') == (95, 242, 10) with pytest.raises(ValueError): openmc.data.zam('garbage') - + with pytest.raises(ValueError): + openmc.data.zam('Am242-m1') def test_half_life(): assert openmc.data.half_life('H2') is None diff --git a/tests/unit_tests/test_data_multipole.py b/tests/unit_tests/test_data_multipole.py index 4c2ba96d6..105099bb9 100644 --- a/tests/unit_tests/test_data_multipole.py +++ b/tests/unit_tests/test_data_multipole.py @@ -8,14 +8,14 @@ import openmc.data @pytest.fixture(scope='module') def u235(): - directory = pathlib.Path(os.environ['OPENMC_CROSS_SECTIONS']).parent + directory = pathlib.Path(openmc.config.get('cross_sections')).parent u235 = directory / 'wmp' / '092235.h5' return openmc.data.WindowedMultipole.from_hdf5(u235) @pytest.fixture(scope='module') def b10(): - directory = pathlib.Path(os.environ['OPENMC_CROSS_SECTIONS']).parent + directory = pathlib.Path(openmc.config.get('cross_sections')).parent b10 = directory / 'wmp' / '005010.h5' return openmc.data.WindowedMultipole.from_hdf5(b10) @@ -48,17 +48,15 @@ def test_export_to_hdf5(tmpdir, u235): assert os.path.exists(filename) -def test_from_endf(): +def test_from_endf(endf_data): pytest.importorskip('vectfit') - endf_data = os.environ['OPENMC_ENDF_DATA'] endf_file = os.path.join(endf_data, 'neutrons', 'n-001_H_001.endf') - return openmc.data.WindowedMultipole.from_endf( + assert openmc.data.WindowedMultipole.from_endf( endf_file, log=True, wmp_options={"n_win": 400, "n_cf": 3}) -def test_from_endf_search(): +def test_from_endf_search(endf_data): pytest.importorskip('vectfit') - endf_data = os.environ['OPENMC_ENDF_DATA'] endf_file = os.path.join(endf_data, 'neutrons', 'n-095_Am_244.endf') - return openmc.data.WindowedMultipole.from_endf( + assert openmc.data.WindowedMultipole.from_endf( endf_file, log=True, wmp_options={"search": True, 'rtol':1e-2}) diff --git a/tests/unit_tests/test_data_neutron.py b/tests/unit_tests/test_data_neutron.py index db6ae1eb8..d43d93ae5 100644 --- a/tests/unit_tests/test_data_neutron.py +++ b/tests/unit_tests/test_data_neutron.py @@ -14,128 +14,113 @@ _TEMPERATURES = [300., 600., 900.] @pytest.fixture(scope='module') def pu239(): """Pu239 HDF5 data.""" - directory = os.path.dirname(os.environ['OPENMC_CROSS_SECTIONS']) + directory = os.path.dirname(openmc.config.get('cross_sections')) filename = os.path.join(directory, 'Pu239.h5') return openmc.data.IncidentNeutron.from_hdf5(filename) @pytest.fixture(scope='module') -def xe135(): +def xe135(endf_data): """Xe135 ENDF data (contains SLBW resonance range)""" - endf_data = os.environ['OPENMC_ENDF_DATA'] filename = os.path.join(endf_data, 'neutrons', 'n-054_Xe_135.endf') return openmc.data.IncidentNeutron.from_endf(filename) @pytest.fixture(scope='module') -def sm150(): +def sm150(endf_data): """Sm150 ENDF data (contains MLBW resonance range)""" - endf_data = os.environ['OPENMC_ENDF_DATA'] filename = os.path.join(endf_data, 'neutrons', 'n-062_Sm_150.endf') return openmc.data.IncidentNeutron.from_endf(filename) @pytest.fixture(scope='module') -def gd154(): +def gd154(endf_data): """Gd154 ENDF data (contains Reich Moore resonance range and reosnance covariance with LCOMP=1).""" - endf_data = os.environ['OPENMC_ENDF_DATA'] filename = os.path.join(endf_data, 'neutrons', 'n-064_Gd_154.endf') return openmc.data.IncidentNeutron.from_endf(filename, covariance=True) @pytest.fixture(scope='module') -def cl35(): +def cl35(endf_data): """Cl35 ENDF data (contains RML resonance range)""" - endf_data = os.environ['OPENMC_ENDF_DATA'] filename = os.path.join(endf_data, 'neutrons', 'n-017_Cl_035.endf') return openmc.data.IncidentNeutron.from_endf(filename) @pytest.fixture(scope='module') -def am241(): +def am241(endf_data): """Am241 ENDF data (contains Madland-Nix fission energy distribution).""" - endf_data = os.environ['OPENMC_ENDF_DATA'] filename = os.path.join(endf_data, 'neutrons', 'n-095_Am_241.endf') return openmc.data.IncidentNeutron.from_endf(filename) @pytest.fixture(scope='module') -def u233(): +def u233(endf_data): """U233 ENDF data (contains Watt fission energy distribution).""" - endf_data = os.environ['OPENMC_ENDF_DATA'] filename = os.path.join(endf_data, 'neutrons', 'n-092_U_233.endf') return openmc.data.IncidentNeutron.from_endf(filename) @pytest.fixture(scope='module') -def u236(): +def u236(endf_data): """U236 ENDF data (contains Watt fission energy distribution).""" - endf_data = os.environ['OPENMC_ENDF_DATA'] filename = os.path.join(endf_data, 'neutrons', 'n-092_U_236.endf') return openmc.data.IncidentNeutron.from_endf(filename) @pytest.fixture(scope='module') -def na22(): +def na22(endf_data): """Na22 ENDF data (contains evaporation spectrum).""" - endf_data = os.environ['OPENMC_ENDF_DATA'] filename = os.path.join(endf_data, 'neutrons', 'n-011_Na_022.endf') return openmc.data.IncidentNeutron.from_endf(filename) @pytest.fixture(scope='module') -def na23(): +def na23(endf_data): """Na23 ENDF data (contains MLBW resonance covariance with LCOMP=0).""" - endf_data = os.environ['OPENMC_ENDF_DATA'] filename = os.path.join(endf_data, 'neutrons', 'n-011_Na_023.endf') return openmc.data.IncidentNeutron.from_endf(filename, covariance=True) @pytest.fixture(scope='module') -def be9(): +def be9(endf_data): """Be9 ENDF data (contains laboratory angle-energy distribution).""" - endf_data = os.environ['OPENMC_ENDF_DATA'] filename = os.path.join(endf_data, 'neutrons', 'n-004_Be_009.endf') return openmc.data.IncidentNeutron.from_endf(filename) @pytest.fixture(scope='module') -def h2(): - endf_data = os.environ['OPENMC_ENDF_DATA'] +def h2(endf_data): endf_file = os.path.join(endf_data, 'neutrons', 'n-001_H_002.endf') return openmc.data.IncidentNeutron.from_njoy( endf_file, temperatures=_TEMPERATURES) @pytest.fixture(scope='module') -def am244(): - endf_data = os.environ['OPENMC_ENDF_DATA'] +def am244(endf_data): endf_file = os.path.join(endf_data, 'neutrons', 'n-095_Am_244.endf') return openmc.data.IncidentNeutron.from_njoy(endf_file) @pytest.fixture(scope='module') -def ti50(): +def ti50(endf_data): """Ti50 ENDF data (contains Multi-level Breit-Wigner resonance range and resonance covariance with LCOMP=1).""" - endf_data = os.environ['OPENMC_ENDF_DATA'] filename = os.path.join(endf_data, 'neutrons', 'n-022_Ti_050.endf') return openmc.data.IncidentNeutron.from_endf(filename, covariance=True) @pytest.fixture(scope='module') -def cf252(): +def cf252(endf_data): """Cf252 ENDF data (contains RM resonance covariance with LCOMP=0).""" - endf_data = os.environ['OPENMC_ENDF_DATA'] filename = os.path.join(endf_data, 'neutrons', 'n-098_Cf_252.endf') return openmc.data.IncidentNeutron.from_endf(filename, covariance=True) @pytest.fixture(scope='module') -def th232(): +def th232(endf_data): """Th232 ENDF data (contains RM resonance covariance with LCOMP=2).""" - endf_data = os.environ['OPENMC_ENDF_DATA'] filename = os.path.join(endf_data, 'neutrons', 'n-090_Th_232.endf') return openmc.data.IncidentNeutron.from_endf(filename, covariance=True) @@ -453,8 +438,7 @@ def test_laboratory(be9): @needs_njoy -def test_correlated(tmpdir): - endf_data = os.environ['OPENMC_ENDF_DATA'] +def test_correlated(tmpdir, endf_data): endf_file = os.path.join(endf_data, 'neutrons', 'n-014_Si_030.endf') si30 = openmc.data.IncidentNeutron.from_njoy(endf_file, heatr=False) @@ -480,8 +464,7 @@ def test_nbody(tmpdir, h2): @needs_njoy -def test_ace_convert(run_in_tmpdir): - endf_data = os.environ['OPENMC_ENDF_DATA'] +def test_ace_convert(run_in_tmpdir, endf_data): filename = os.path.join(endf_data, 'neutrons', 'n-001_H_001.endf') ace_ascii = 'ace_ascii' ace_binary = 'ace_binary' @@ -515,8 +498,7 @@ def test_ace_table_types(): @needs_njoy -def test_high_temperature(): - endf_data = os.environ['OPENMC_ENDF_DATA'] +def test_high_temperature(endf_data): endf_file = os.path.join(endf_data, 'neutrons', 'n-001_H_001.endf') # Ensure that from_njoy works when given a high temperature diff --git a/tests/unit_tests/test_data_photon.py b/tests/unit_tests/test_data_photon.py index 010ac1f35..98b180f52 100644 --- a/tests/unit_tests/test_data_photon.py +++ b/tests/unit_tests/test_data_photon.py @@ -9,9 +9,8 @@ import openmc.data @pytest.fixture(scope='module') -def elements_endf(): +def elements_endf(endf_data): """Dictionary of element ENDF data indexed by atomic symbol.""" - endf_data = os.environ['OPENMC_ENDF_DATA'] elements = {'H': 1, 'O': 8, 'Al': 13, 'Cu': 29, 'Ag': 47, 'U': 92, 'Pu': 94} data = {} for symbol, Z in elements.items(): @@ -145,8 +144,8 @@ def test_export_to_hdf5(tmpdir, element): element2.export_to_hdf5(filename, 'w') -def test_photodat_only(run_in_tmpdir): - endf_dir = Path(os.environ['OPENMC_ENDF_DATA']) +def test_photodat_only(run_in_tmpdir, endf_data): + endf_dir = Path(endf_data) photoatomic_file = endf_dir / 'photoat' / 'photoat-001_H_000.endf' data = openmc.data.IncidentPhoton.from_endf(photoatomic_file) data.export_to_hdf5('tmp.h5', 'w') diff --git a/tests/unit_tests/test_data_thermal.py b/tests/unit_tests/test_data_thermal.py index c9fd9045b..7cd63ca71 100644 --- a/tests/unit_tests/test_data_thermal.py +++ b/tests/unit_tests/test_data_thermal.py @@ -6,6 +6,8 @@ import random import numpy as np import pytest import openmc.data +from openmc.data.thermal import _THERMAL_NAMES +from openmc.data.njoy import _THERMAL_DATA from . import needs_njoy @@ -13,7 +15,7 @@ from . import needs_njoy @pytest.fixture(scope='module') def h2o(): """H in H2O thermal scattering data.""" - directory = os.path.dirname(os.environ['OPENMC_CROSS_SECTIONS']) + directory = os.path.dirname(openmc.config.get('cross_sections')) filename = os.path.join(directory, 'c_H_in_H2O.h5') return openmc.data.ThermalScattering.from_hdf5(filename) @@ -21,15 +23,14 @@ def h2o(): @pytest.fixture(scope='module') def graphite(): """Graphite thermal scattering data.""" - directory = os.path.dirname(os.environ['OPENMC_CROSS_SECTIONS']) + directory = os.path.dirname(openmc.config.get('cross_sections')) filename = os.path.join(directory, 'c_Graphite.h5') return openmc.data.ThermalScattering.from_hdf5(filename) @pytest.fixture(scope='module') -def h2o_njoy(): +def h2o_njoy(endf_data): """H in H2O generated using NJOY.""" - endf_data = os.environ['OPENMC_ENDF_DATA'] path_h1 = os.path.join(endf_data, 'neutrons', 'n-001_H_001.endf') path_h2o = os.path.join(endf_data, 'thermal_scatt', 'tsl-HinH2O.endf') return openmc.data.ThermalScattering.from_njoy( @@ -37,17 +38,15 @@ def h2o_njoy(): @pytest.fixture(scope='module') -def hzrh(): +def hzrh(endf_data): """H in ZrH thermal scattering data.""" - endf_data = os.environ['OPENMC_ENDF_DATA'] filename = os.path.join(endf_data, 'thermal_scatt', 'tsl-HinZrH.endf') return openmc.data.ThermalScattering.from_endf(filename, divide_incoherent_elastic=True) @pytest.fixture(scope='module') -def hzrh_njoy(): +def hzrh_njoy(endf_data): """H in ZrH generated using NJOY.""" - endf_data = os.environ['OPENMC_ENDF_DATA'] path_h1 = os.path.join(endf_data, 'neutrons', 'n-001_H_001.endf') path_hzrh = os.path.join(endf_data, 'thermal_scatt', 'tsl-HinZrH.endf') with_endf_data = openmc.data.ThermalScattering.from_njoy( @@ -60,9 +59,8 @@ def hzrh_njoy(): @pytest.fixture(scope='module') -def sio2(): +def sio2(endf_data): """SiO2 thermal scattering data.""" - endf_data = os.environ['OPENMC_ENDF_DATA'] filename = os.path.join(endf_data, 'thermal_scatt', 'tsl-SiO2.endf') return openmc.data.ThermalScattering.from_endf(filename, divide_incoherent_elastic=True) @@ -102,8 +100,7 @@ def test_graphite_xs(graphite): assert elastic([1e-3, 1.0]) == pytest.approx([0.0, 0.62586153]) @needs_njoy -def test_graphite_njoy(): - endf_data = os.environ['OPENMC_ENDF_DATA'] +def test_graphite_njoy(endf_data): path_c0 = os.path.join(endf_data, 'neutrons', 'n-006_C_000.endf') path_gr = os.path.join(endf_data, 'thermal_scatt', 'tsl-graphite.endf') graphite = openmc.data.ThermalScattering.from_njoy( @@ -141,8 +138,7 @@ def test_continuous_dist(h2o_njoy): assert isinstance(dist, openmc.data.IncoherentInelasticAE) -def test_h2o_endf(): - endf_data = os.environ['OPENMC_ENDF_DATA'] +def test_h2o_endf(endf_data): filename = os.path.join(endf_data, 'thermal_scatt', 'tsl-HinH2O.endf') h2o = openmc.data.ThermalScattering.from_endf(filename, divide_incoherent_elastic=True) assert not h2o.elastic @@ -264,6 +260,27 @@ def test_get_thermal_name(): assert f('boogie_monster') == 'c_boogie_monster' +def test_thermal_names_data_consistency(): + # Check that keys in _THERMAL_NAMES are also in _THERMAL_DATA + names_only = set(_THERMAL_NAMES.keys()) - set(_THERMAL_DATA.keys()) + assert not names_only, f"Keys in _THERMAL_NAMES but not in _THERMAL_DATA: {names_only}" + + # Check that keys in _THERMAL_DATA are also in _THERMAL_NAMES + data_only = set(_THERMAL_DATA.keys()) - set(_THERMAL_NAMES.keys()) + assert not data_only, f"Keys in _THERMAL_DATA but not in _THERMAL_NAMES: {data_only}" + + # Check that the name from each ThermalTuple in _THERMAL_DATA appears as + # a recognized alias in _THERMAL_NAMES for the same key + missing_aliases = [] + for key, thermal_tuple in _THERMAL_DATA.items(): + name = thermal_tuple.name + if name not in _THERMAL_NAMES[key]: + missing_aliases.append((key, name, _THERMAL_NAMES[key])) + assert not missing_aliases, ( + f"ThermalTuple names not in _THERMAL_NAMES aliases: {missing_aliases}" + ) + + @pytest.fixture def fake_mixed_elastic(): fake_tsl = openmc.data.ThermalScattering("c_D_in_7LiD", 1.9968, 4.9, [0.0253]) diff --git a/tests/unit_tests/test_deplete_activation.py b/tests/unit_tests/test_deplete_activation.py index 6afea8c9f..eace1976e 100644 --- a/tests/unit_tests/test_deplete_activation.py +++ b/tests/unit_tests/test_deplete_activation.py @@ -45,10 +45,11 @@ ENERGIES = np.logspace(log10(1e-5), log10(2e7), 100) @pytest.mark.parametrize("reaction_rate_mode,reaction_rate_opts,tolerance", [ ("direct", {}, 1e-5), - ("flux", {'energies': ENERGIES}, 0.01), + ("flux", {'energies': ENERGIES}, 0.1), ("flux", {'energies': ENERGIES, 'reactions': ['(n,gamma)']}, 1e-5), ("flux", {'energies': ENERGIES, 'reactions': ['(n,gamma)'], 'nuclides': ['W186', 'H3']}, 1e-2), ]) +@pytest.mark.flaky(reruns=1) def test_activation(run_in_tmpdir, model, reaction_rate_mode, reaction_rate_opts, tolerance): # Determine (n.gamma) reaction rate using initial run sp = model.run() @@ -61,11 +62,10 @@ def test_activation(run_in_tmpdir, model, reaction_rate_mode, reaction_rate_opts w186 = openmc.deplete.Nuclide('W186') w186.add_reaction('(n,gamma)', None, 0.0, 1.0) chain.add_nuclide(w186) - chain.export_to_xml('test_chain.xml') # Create transport operator op = openmc.deplete.CoupledOperator( - model, 'test_chain.xml', + model, chain, normalization_mode="source-rate", reaction_rate_mode=reaction_rate_mode, reaction_rate_opts=reaction_rate_opts, diff --git a/tests/unit_tests/test_deplete_chain.py b/tests/unit_tests/test_deplete_chain.py index 13267cb05..e90b61022 100644 --- a/tests/unit_tests/test_deplete_chain.py +++ b/tests/unit_tests/test_deplete_chain.py @@ -54,11 +54,11 @@ def simple_chain(): @pytest.fixture(scope='module') -def endf_chain(): - endf_data = Path(os.environ['OPENMC_ENDF_DATA']) - decay_data = (endf_data / 'decay').glob('*.endf') - fpy_data = (endf_data / 'nfy').glob('*.endf') - neutron_data = (endf_data / 'neutrons').glob('*.endf') +def endf_chain(endf_data): + endf_dir = Path(endf_data) + decay_data = (endf_dir / 'decay').glob('*.endf') + fpy_data = (endf_dir / 'nfy').glob('*.endf') + neutron_data = (endf_dir / 'neutrons').glob('*.endf') return Chain.from_endf(decay_data, fpy_data, neutron_data) @@ -310,8 +310,7 @@ def test_capture_branch_infer_ground(): # Create nuclide to be added into the chain xe136m = nuclide.Nuclide("Xe136_m1") - chain.nuclides.append(xe136m) - chain.nuclide_dict[xe136m.name] = len(chain.nuclides) - 1 + chain.add_nuclide(xe136m) chain.set_branch_ratios(infer_br, "(n,gamma)") @@ -327,8 +326,7 @@ def test_capture_branch_no_rxn(): u5m = nuclide.Nuclide("U235_m1") - chain.nuclides.append(u5m) - chain.nuclide_dict[u5m.name] = len(chain.nuclides) - 1 + chain.add_nuclide(u5m) with pytest.raises(AttributeError, match="U234"): chain.set_branch_ratios(u4br) diff --git a/tests/unit_tests/test_deplete_continue.py b/tests/unit_tests/test_deplete_continue.py index 53c4c56d2..1b6eac238 100644 --- a/tests/unit_tests/test_deplete_continue.py +++ b/tests/unit_tests/test_deplete_continue.py @@ -4,6 +4,7 @@ These tests run in two steps: first a normal run and then a continue run using t """ import pytest +import numpy as np import openmc.deplete from tests import dummy_operator @@ -16,7 +17,7 @@ def test_continue(run_in_tmpdir): operator = dummy_operator.DummyOperator() # initial depletion - bundle.solver(operator, [1.0, 2.0], [1.0, 2.0]).integrate() + bundle.solver(operator, [1.0, 2.0], [1.0, 2.0]).integrate(write_rates=True) # set up continue run prev_res = openmc.deplete.Results(operator.output_dir / "depletion_results.h5") @@ -24,8 +25,45 @@ def test_continue(run_in_tmpdir): # if continue run happens, test passes bundle.solver(operator, [1.0, 2.0, 3.0, 4.0], [1.0, 2.0, 3.0, 4.0], + continue_timesteps=True).integrate(write_rates=True) + + final_res = openmc.deplete.Results(operator.output_dir / "depletion_results.h5") + + assert np.array_equal( + np.diff(final_res.get_times(time_units="s")), + [1.0, 2.0, 3.0, 4.0] + ) + + +def test_continue_continue(run_in_tmpdir): + """Test to ensure that a continue run can be continued""" + # set up the problem + bundle = dummy_operator.SCHEMES['predictor'] + operator = dummy_operator.DummyOperator() + + # initial depletion + bundle.solver(operator, [1.0, 2.0], [1.0, 2.0]).integrate(write_rates=True) + + # set up continue run + prev_res = openmc.deplete.Results(operator.output_dir / "depletion_results.h5") + operator = dummy_operator.DummyOperator(prev_res) + + # first continue run + bundle.solver(operator, [1.0, 2.0, 3.0, 4.0], [1.0, 2.0, 3.0, 4.0], + continue_timesteps=True).integrate(write_rates=True) + + prev_res = openmc.deplete.Results(operator.output_dir / "depletion_results.h5") + # second continue run + bundle.solver(operator, [1.0, 2.0, 3.0, 4.0, 5.0, 6.0], [1.0, 2.0, 3.0, 4.0, 5.0, 6.0], continue_timesteps=True).integrate() + final_res = openmc.deplete.Results(operator.output_dir / "depletion_results.h5") + + assert np.array_equal( + np.diff(final_res.get_times(time_units="s")), + [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] + ) + def test_mismatched_initial_times(run_in_tmpdir): """Test to ensure that a continue run with different initial steps is properly caught""" diff --git a/tests/unit_tests/test_deplete_coupled_operator.py b/tests/unit_tests/test_deplete_coupled_operator.py index ba291e07d..119a15923 100644 --- a/tests/unit_tests/test_deplete_coupled_operator.py +++ b/tests/unit_tests/test_deplete_coupled_operator.py @@ -5,7 +5,7 @@ from pathlib import Path import pytest -from openmc.deplete import CoupledOperator +from openmc.deplete import CoupledOperator, Chain import openmc import numpy as np @@ -106,11 +106,13 @@ def test_diff_volume_method_match_cell(model_with_volumes): def test_diff_volume_method_divide_equally(model_with_volumes): """Tests the volumes assigned to the materials are divided equally""" + chain = Chain.from_xml(CHAIN_PATH) + operator = openmc.deplete.CoupledOperator( model=model_with_volumes, diff_burnable_mats=True, diff_volume_method='divide equally', - chain_file=CHAIN_PATH + chain_file=chain ) all_cells = list(operator.model.geometry.get_all_cells().values()) diff --git a/tests/unit_tests/test_deplete_external_source_rates.py b/tests/unit_tests/test_deplete_external_source_rates.py new file mode 100644 index 000000000..a8cf9dde5 --- /dev/null +++ b/tests/unit_tests/test_deplete_external_source_rates.py @@ -0,0 +1,170 @@ +""" Tests for ExternalSourceRates class """ + +from pathlib import Path + +import pytest +import numpy as np +import re + +import openmc +from openmc.data import AVOGADRO, atomic_mass +from openmc.deplete import CoupledOperator +from openmc.deplete.transfer_rates import ExternalSourceRates +from openmc.deplete.abc import (_SECONDS_PER_MINUTE, _SECONDS_PER_HOUR, + _SECONDS_PER_DAY, _SECONDS_PER_JULIAN_YEAR) + +CHAIN_PATH = Path(__file__).parents[1] / "chain_simple.xml" + +@pytest.fixture +def model(): + openmc.reset_auto_ids() + f = openmc.Material(name="f") + f.add_element("U", 1, enrichment=4.25) + f.add_element("O", 2) + f.set_density("g/cm3", 10.4) + + w = openmc.Material(name="w") + w.add_element("O", 1) + w.add_element("H", 2) + w.set_density("g/cm3", 1.0) + w.depletable = True + + # material just to test multiple destination material + h = openmc.Material(name="h") + h.add_element("He", 1) + h.set_density("g/cm3", 1.78e-4) + + radii = [0.42, 0.45] + f.volume = np.pi * radii[0] ** 2 + w.volume = np.pi * (radii[1]**2 - radii[0]**2) + h.volume = 1 + materials = openmc.Materials([f, w, h]) + + surf_f = openmc.Sphere(r=radii[0]) + surf_w = openmc.Sphere(r=radii[1], boundary_type='vacuum') + surf_h = openmc.Sphere(x0=10, r=1, boundary_type='vacuum') + cell_f = openmc.Cell(fill=f, region=-surf_f) + cell_w = openmc.Cell(fill=w, region=+surf_f & -surf_w) + cell_h = openmc.Cell(fill=h, region=-surf_h) + geometry = openmc.Geometry([cell_f, cell_w, cell_h]) + + settings = openmc.Settings() + settings.particles = 1000 + settings.inactive = 10 + settings.batches = 50 + + return openmc.Model(geometry, materials, settings) + + +@pytest.mark.parametrize( +"case_name, external_source_vectors, external_source_rate, timesteps", [ + ('elements', [{'U': 0.9, 'Xe': 0.1}], 1, None), + ('nuclides', [{'I135': 0.1, 'Gd156': 0.3, 'Gd157': 0.6}], 1, None), + ('nuclides_elements', [{'I135': 0.01, 'Gd156': 0.1, 'Gd157': 0.01, 'U': 0.8, + 'Xe': 0.08}], 1, None), + ('elements_nuclides', [{'U': 0.78, 'Xe': 0.1, 'I135': 0.01, 'Gd156': 0.1, + 'Gd157': 0.01}], 1, None), + ('multiple_vectors', [{'U': 1.}, {'Xe': 1}], 1, None), + ('timesteps', [{'U': 0.9, 'Xe': 0.1}], 1, [1]), + ('rates_invalid_1', [{'Gb': 1.}], 1, None), + ('rates_invalid_2', [{'Pu': 1.}], 1, None) + ]) +def test_get_set(model, case_name, external_source_vectors, external_source_rate, + timesteps): + """Tests the get/set methods""" + + op = CoupledOperator(model, CHAIN_PATH) + number_of_timesteps = 2 + transfer = ExternalSourceRates(op, model.materials, number_of_timesteps) + + if timesteps is None: + timesteps = np.arange(number_of_timesteps) + + # Test by Openmc material, material name and material id + material= [m for m in model.materials if m.depletable][0] + + for material_input in [material, material.name, material.id]: + for external_source_vector in external_source_vectors: + if case_name == 'rates_invalid_1': + with pytest.raises(ValueError, match='Gb is not a valid ' + 'nuclide or element.'): + transfer.set_external_source_rate(material_input, + external_source_vector, + external_source_rate) + elif case_name == 'rates_invalid_2': + with pytest.raises(ValueError, match='Cannot add element Pu'): + transfer.set_external_source_rate(material_input, + external_source_vector, + external_source_rate) + else: + transfer.set_external_source_rate(material_input, + external_source_vector, + external_source_rate, + timesteps=timesteps) + for component, percent in external_source_vector.items(): + split_component = re.split(r'\d+', component) + if len(split_component) == 1: + for nuc, frac in openmc.data.isotopes(component): + val = external_source_rate * percent * frac * \ + AVOGADRO / atomic_mass(nuc) + assert transfer.get_external_rate( + material_input, nuc, timesteps)[0] == pytest.approx(val) + else: + val = external_source_rate * percent * AVOGADRO / atomic_mass(component) + assert transfer.get_external_rate( + material_input, component, timesteps)[0] == pytest.approx(val) + + assert np.all(transfer.external_timesteps == timesteps) + + +@pytest.mark.parametrize("units, unit_conv", [ + ('g/s', 1), + ('g/sec', 1), + ('g/min', _SECONDS_PER_MINUTE), + ('g/minute', _SECONDS_PER_MINUTE), + ('g/h', _SECONDS_PER_HOUR), + ('g/hr', _SECONDS_PER_HOUR), + ('g/hour', _SECONDS_PER_HOUR), + ('g/d', _SECONDS_PER_DAY), + ('g/day', _SECONDS_PER_DAY), + ('g/a', _SECONDS_PER_JULIAN_YEAR), + ('g/year', _SECONDS_PER_JULIAN_YEAR), + ]) +def test_units(units, unit_conv, model): + """ Units testing""" + # create external rate Xe + components = ['Xe135', 'U235'] + external_source_rate = 1.0 + number_of_timesteps = 2 + op = CoupledOperator(model, CHAIN_PATH) + transfer = ExternalSourceRates(op, model.materials, number_of_timesteps) + timesteps = np.arange(number_of_timesteps) + + for component in components: + rate = external_source_rate * unit_conv * atomic_mass(component) / AVOGADRO + transfer.set_external_source_rate('f', {component: 1}, rate, rate_units=units) + assert transfer.get_external_rate( + 'f', component, timesteps)[0] == pytest.approx(external_source_rate) + + +def test_external_source(run_in_tmpdir, model): + """Tests external source depletion class without neither reaction rates nor + decay but only external source rates""" + # create transfer rate for U + vector = {'U235': 1} + external_source = 10 # grams + op = CoupledOperator(model, CHAIN_PATH) + integrator = openmc.deplete.PredictorIntegrator( + op, [1, 1], 0.0, timestep_units = 'd') + integrator.add_external_source_rate('f', vector, external_source/(24*3600)) + integrator.integrate() + + # Get number of U238 atoms from results + results = openmc.deplete.Results('depletion_results.h5') + _, atoms = results.get_atoms(model.materials[0], "U235") + + # Ensure number of atoms equal external source + assert atoms[1] - atoms[0] == pytest.approx( + external_source * AVOGADRO / atomic_mass('U235')) + assert atoms[2] - atoms[1] == pytest.approx( + external_source * AVOGADRO / atomic_mass('U235')) diff --git a/tests/unit_tests/test_deplete_independent_operator.py b/tests/unit_tests/test_deplete_independent_operator.py index c765d0650..aca83399a 100644 --- a/tests/unit_tests/test_deplete_independent_operator.py +++ b/tests/unit_tests/test_deplete_independent_operator.py @@ -7,7 +7,7 @@ from pathlib import Path import pytest from openmc import Material -from openmc.deplete import IndependentOperator, MicroXS +from openmc.deplete import IndependentOperator, MicroXS, Chain CHAIN_PATH = Path(__file__).parents[1] / "chain_simple.xml" ONE_GROUP_XS = Path(__file__).parents[1] / "micro_xs_simple.csv" @@ -25,8 +25,9 @@ def test_operator_init(): 'O17': 1.7588724018066158e+19} flux = 1.0 micro_xs = MicroXS.from_csv(ONE_GROUP_XS) + chain = Chain.from_xml(CHAIN_PATH) IndependentOperator.from_nuclides( - volume, nuclides, flux, micro_xs, CHAIN_PATH, nuc_units='atom/cm3') + volume, nuclides, flux, micro_xs, chain, nuc_units='atom/cm3') fuel = Material(name="uo2") fuel.add_element("U", 1, percent_type="ao", enrichment=4.25) diff --git a/tests/unit_tests/test_deplete_integrator.py b/tests/unit_tests/test_deplete_integrator.py index b1d2cb950..6463eaa20 100644 --- a/tests/unit_tests/test_deplete_integrator.py +++ b/tests/unit_tests/test_deplete_integrator.py @@ -10,6 +10,7 @@ import copy from random import uniform from unittest.mock import MagicMock +import h5py import numpy as np from uncertainties import ufloat import pytest @@ -38,8 +39,6 @@ INTEGRATORS = [ def test_results_save(run_in_tmpdir): """Test data save module""" - stages = 3 - rng = np.random.RandomState(comm.rank) # Mock geometry @@ -63,31 +62,22 @@ def test_results_save(run_in_tmpdir): op.get_results_info.return_value = ( vol_dict, nuc_list, burn_list, full_burn_list) - # Construct x - x1 = [] - x2 = [] + # Construct end-of-step concentrations + x1 = [rng.random(2), rng.random(2)] + x2 = [rng.random(2), rng.random(2)] - for i in range(stages): - x1.append([rng.random(2), rng.random(2)]) - x2.append([rng.random(2), rng.random(2)]) - - # Construct r + # Construct reaction rates r1 = ReactionRates(burn_list, ["na", "nb"], ["ra", "rb"]) r1[:] = rng.random((2, 2, 2)) + rate1 = copy.deepcopy(r1) - rate1 = [] - rate2 = [] + r2 = ReactionRates(burn_list, ["na", "nb"], ["ra", "rb"]) + r2[:] = rng.random((2, 2, 2)) + rate2 = copy.deepcopy(r2) - for i in range(stages): - rate1.append(copy.deepcopy(r1)) - r1[:] = rng.random((2, 2, 2)) - rate2.append(copy.deepcopy(r1)) - r1[:] = rng.random((2, 2, 2)) - - # Create global terms - # Col 0: eig, Col 1: uncertainty - eigvl1 = rng.random((stages, 2)) - eigvl2 = rng.random((stages, 2)) + # Create global terms (eigenvalue and uncertainty) + eigvl1 = rng.random(2) + eigvl2 = rng.random(2) eigvl1 = comm.bcast(eigvl1, root=0) eigvl2 = comm.bcast(eigvl2, root=0) @@ -95,29 +85,35 @@ def test_results_save(run_in_tmpdir): t1 = [0.0, 1.0] t2 = [1.0, 2.0] - op_result1 = [OperatorResult(ufloat(*k), rates) - for k, rates in zip(eigvl1, rate1)] - op_result2 = [OperatorResult(ufloat(*k), rates) - for k, rates in zip(eigvl2, rate2)] + op_result1 = OperatorResult(ufloat(*eigvl1), rate1) + op_result2 = OperatorResult(ufloat(*eigvl2), rate2) # saves within a subdirectory - StepResult.save(op, x1, op_result1, t1, 0, 0, path='out/put/depletion.h5') + StepResult.save( + op, + x1, + op_result1, + t1, + 0, + 0, + write_rates=True, + path='out/put/depletion.h5' + ) res = Results('out/put/depletion.h5') # saves with default filename - StepResult.save(op, x1, op_result1, t1, 0, 0) - StepResult.save(op, x2, op_result2, t2, 0, 1) + StepResult.save(op, x1, op_result1, t1, 0, 0, write_rates=True) + StepResult.save(op, x2, op_result2, t2, 0, 1, write_rates=True) # Load the files res = Results("depletion_results.h5") - for i in range(stages): - for mat_i, mat in enumerate(burn_list): - for nuc_i, nuc in enumerate(nuc_list): - assert res[0][i, mat, nuc] == x1[i][mat_i][nuc_i] - assert res[1][i, mat, nuc] == x2[i][mat_i][nuc_i] - np.testing.assert_array_equal(res[0].rates[i], rate1[i]) - np.testing.assert_array_equal(res[1].rates[i], rate2[i]) + for mat_i, mat in enumerate(burn_list): + for nuc_i, nuc in enumerate(nuc_list): + assert res[0][mat, nuc] == x1[mat_i][nuc_i] + assert res[1][mat, nuc] == x2[mat_i][nuc_i] + np.testing.assert_array_equal(res[0].rates, rate1) + np.testing.assert_array_equal(res[1].rates, rate2) np.testing.assert_array_equal(res[0].k, eigvl1) np.testing.assert_array_equal(res[0].time, t1) @@ -126,6 +122,31 @@ def test_results_save(run_in_tmpdir): np.testing.assert_array_equal(res[1].time, t2) +def test_results_save_without_rates(run_in_tmpdir): + """StepResult.save skips reaction-rate datasets by default""" + + op = MagicMock() + op.prev_res = None + vol_dict = {"0": 1.0} + nuc_list = ["na"] + burn_list = ["0"] + op.get_results_info.return_value = (vol_dict, nuc_list, burn_list, burn_list) + + x = [np.array([1.0])] + rates = ReactionRates(burn_list, nuc_list, ["ra"]) + rates[:] = np.array([[[2.0]]]) + op_result = OperatorResult(ufloat(1.0, 0.1), rates) + + StepResult.save(op, x, op_result, [0.0, 1.0], 0.0, 0) + + with h5py.File('depletion_results.h5', 'r') as handle: + assert 'reaction rates' not in handle + assert 'reactions' not in handle + + res = Results('depletion_results.h5') + assert res[0].rates.size == 0 + + def test_bad_integrator_inputs(): """Test failure modes for Integrator inputs""" diff --git a/tests/unit_tests/test_deplete_microxs.py b/tests/unit_tests/test_deplete_microxs.py index 073b3f162..5762a8511 100644 --- a/tests/unit_tests/test_deplete_microxs.py +++ b/tests/unit_tests/test_deplete_microxs.py @@ -111,3 +111,16 @@ def test_multigroup_flux_same(): energies=energies, multigroup_flux=flux, chain_file=chain_file) assert microxs_4g.data == pytest.approx(microxs_2g.data) + + +def test_microxs_zero_flux(): + chain_file = Path(__file__).parents[1] / 'chain_simple.xml' + + # Generate micro XS based on zero flux + energies = [0., 6.25e-1, 5.53e3, 8.21e5, 2.e7] + flux = [0.0, 0.0, 0.0, 0.0] + microxs = MicroXS.from_multigroup_flux( + energies=energies, multigroup_flux=flux, chain_file=chain_file) + + # All microscopic cross sections should be zero + assert np.all(microxs.data == 0.0) diff --git a/tests/unit_tests/test_deplete_restart.py b/tests/unit_tests/test_deplete_restart.py index e8bfc062a..1cbff30a5 100644 --- a/tests/unit_tests/test_deplete_restart.py +++ b/tests/unit_tests/test_deplete_restart.py @@ -21,7 +21,7 @@ def test_restart_predictor_cecm(run_in_tmpdir): # Perform simulation using the predictor algorithm dt = [0.75] power = 1.0 - openmc.deplete.PredictorIntegrator(op, dt, power).integrate() + openmc.deplete.PredictorIntegrator(op, dt, power).integrate(write_rates=True) # Load the files prev_res = openmc.deplete.Results(op.output_dir / "depletion_results.h5") @@ -30,10 +30,6 @@ def test_restart_predictor_cecm(run_in_tmpdir): op = dummy_operator.DummyOperator(prev_res) op.output_dir = output_dir - # check ValueError is raised, indicating previous and current stages - with pytest.raises(ValueError, match="incompatible.* 1.*2"): - openmc.deplete.CECMIntegrator(op, dt, power) - def test_restart_cecm_predictor(run_in_tmpdir): """Integral regression test of integrator algorithm using CE/CM for the @@ -47,7 +43,7 @@ def test_restart_cecm_predictor(run_in_tmpdir): dt = [0.75] power = 1.0 cecm = openmc.deplete.CECMIntegrator(op, dt, power) - cecm.integrate() + cecm.integrate(write_rates=True) # Load the files prev_res = openmc.deplete.Results(op.output_dir / "depletion_results.h5") @@ -56,10 +52,6 @@ def test_restart_cecm_predictor(run_in_tmpdir): op = dummy_operator.DummyOperator(prev_res) op.output_dir = output_dir - # check ValueError is raised, indicating previous and current stages - with pytest.raises(ValueError, match="incompatible.* 2.*1"): - openmc.deplete.PredictorIntegrator(op, dt, power) - @pytest.mark.parametrize("scheme", dummy_operator.SCHEMES) def test_restart(run_in_tmpdir, scheme): @@ -70,7 +62,7 @@ def test_restart(run_in_tmpdir, scheme): operator = dummy_operator.DummyOperator() # take first step - bundle.solver(operator, [0.75], 1.0).integrate() + bundle.solver(operator, [0.75], 1.0).integrate(write_rates=True) # restart prev_res = openmc.deplete.Results( diff --git a/tests/unit_tests/test_deplete_resultslist.py b/tests/unit_tests/test_deplete_resultslist.py index b22a78650..9a4699a4f 100644 --- a/tests/unit_tests/test_deplete_resultslist.py +++ b/tests/unit_tests/test_deplete_resultslist.py @@ -21,14 +21,14 @@ def test_get_activity(res): t_ref = np.array([0.0, 1296000.0, 2592000.0, 3888000.0]) a_ref = np.array( - [1.25167956e+06, 3.71938527e+11, 4.43264300e+11, 3.55547176e+11]) + [1.25167956e+06, 3.69842310e+11, 3.70099291e+11, 3.53629755e+11]) np.testing.assert_allclose(t, t_ref) np.testing.assert_allclose(a, a_ref) # Check by_nuclide a_xe135_ref = np.array( - [2.106574218e+05, 1.227519888e+11, 1.177491828e+11, 1.031986176e+11]) + [2.10657422e+05, 1.12825236e+11, 1.09055177e+11, 1.07491257e+11]) t_nuc, a_nuc = res.get_activity("1", by_nuclide=True) a_xe135 = np.array([a_nuc_i["Xe135"] for a_nuc_i in a_nuc]) @@ -43,7 +43,7 @@ def test_get_atoms(res): t_ref = np.array([0.0, 1296000.0, 2592000.0, 3888000.0]) n_ref = np.array( - [6.67473282e+08, 3.88942731e+14, 3.73091215e+14, 3.26987387e+14]) + [6.67473282e+08, 3.57489567e+14, 3.45544042e+14, 3.40588723e+14]) np.testing.assert_allclose(t, t_ref) np.testing.assert_allclose(n, n_ref) @@ -71,7 +71,7 @@ def test_get_decay_heat(res): t_ref = np.array([0.0, 1296000.0, 2592000.0, 3888000.0]) dh_ref = np.array( - [1.27933813e-09, 5.85347232e-03, 7.38773010e-03, 5.79954067e-03]) + [1.27933813e-09, 5.95370258e-03, 6.01335600e-03, 5.69831173e-03]) t, dh = res.get_decay_heat("1") @@ -80,7 +80,7 @@ def test_get_decay_heat(res): # Check by nuclide dh_xe135_ref = np.array( - [1.27933813e-09, 7.45481920e-04, 7.15099509e-04, 6.26732849e-04]) + [1.27933813e-09, 6.85196014e-04, 6.62300168e-04, 6.52802366e-04]) t_nuc, dh_nuc = res.get_decay_heat("1", by_nuclide=True) dh_nuc_xe135 = np.array([dh_nuc_i["Xe135"] for dh_nuc_i in dh_nuc]) @@ -95,7 +95,7 @@ def test_get_mass(res): t_ref = np.array([0.0, 1296000.0, 2592000.0, 3888000.0]) n_ref = np.array( - [6.67473282e+08, 3.88942731e+14, 3.73091215e+14, 3.26987387e+14]) + [6.67473282e+08, 3.57489567e+14, 3.45544042e+14, 3.40588723e+14]) # Get g n_ref *= openmc.data.atomic_mass('Xe135') / openmc.data.AVOGADRO @@ -123,8 +123,8 @@ def test_get_reaction_rate(res): t, r = res.get_reaction_rate("1", "Xe135", "(n,gamma)") t_ref = [0.0, 1296000.0, 2592000.0, 3888000.0] - n_ref = [6.67473282e+08, 3.88942731e+14, 3.73091215e+14, 3.26987387e+14] - xs_ref = [2.53336104e-05, 4.21747011e-05, 3.48616127e-05, 3.61775563e-05] + n_ref = [6.67473282e+08, 3.57489567e+14, 3.45544042e+14, 3.40588723e+14] + xs_ref = [3.10220818e-05, 3.36754072e-05, 3.12740350e-05, 3.86717693e-05] np.testing.assert_allclose(t, t_ref) np.testing.assert_allclose(r, np.array(n_ref) * xs_ref) @@ -136,8 +136,8 @@ def test_get_keff(res): t_min, k = res.get_keff(time_units='min') t_ref = [0.0, 1296000.0, 2592000.0, 3888000.0] - k_ref = [1.1596402556, 1.1914183335, 1.2292570871, 1.1797030302] - u_ref = [0.0270680649, 0.0219163444, 0.024268508 , 0.0221401194] + k_ref = [1.1773089172, 1.2231748584, 1.1611455694, 1.1714783649] + u_ref = [0.0384666252, 0.0311915665, 0.0226370102, 0.0315964732] np.testing.assert_allclose(t, t_ref) np.testing.assert_allclose(t_min * 60, t_ref) @@ -220,5 +220,4 @@ def test_stepresult_get_material(res): # Spot check number densities densities = mat1.get_nuclide_atom_densities() assert densities['Xe135'] == pytest.approx(1e-14) - assert densities['I135'] == pytest.approx(1e-21) assert densities['U234'] == pytest.approx(1.00506e-05) diff --git a/tests/unit_tests/test_deplete_transfer_rates.py b/tests/unit_tests/test_deplete_transfer_rates.py index 140777cd6..a6dcb2b27 100644 --- a/tests/unit_tests/test_deplete_transfer_rates.py +++ b/tests/unit_tests/test_deplete_transfer_rates.py @@ -16,6 +16,7 @@ CHAIN_PATH = Path(__file__).parents[1] / "chain_simple.xml" @pytest.fixture def model(): + openmc.reset_auto_ids() f = openmc.Material(name="f") f.add_element("U", 1, percent_type="ao", enrichment=4.25) f.add_element("O", 2) @@ -54,32 +55,35 @@ def model(): return openmc.Model(geometry, materials, settings) -@pytest.mark.parametrize("case_name, transfer_rates", [ - ('elements', {'U': 0.01, 'Xe': 0.1}), - ('nuclides', {'I135': 0.01, 'Gd156': 0.1, 'Gd157': 0.01}), +@pytest.mark.parametrize("case_name, transfer_rates, timesteps", [ + ('elements', {'U': 0.01, 'Xe': 0.1}, None), + ('nuclides', {'I135': 0.01, 'Gd156': 0.1, 'Gd157': 0.01}, None), ('nuclides_elements', {'I135': 0.01, 'Gd156': 0.1, 'Gd157': 0.01, 'U': 0.01, - 'Xe': 0.1}), + 'Xe': 0.1}, None), ('elements_nuclides', {'U': 0.01, 'Xe': 0.1, 'I135': 0.01, 'Gd156': 0.1, - 'Gd157': 0.01}), + 'Gd157': 0.01}, None), ('multiple_transfer', {'U': 0.01, 'Xe': 0.1, 'I135': 0.01, 'Gd156': 0.1, - 'Gd157': 0.01}), - ('rates_invalid_1', {'Gd': 0.01, 'Gd157': 0.01, 'Gd156': 0.01}), - ('rates_invalid_2', {'Gd156': 0.01, 'Gd157': 0.01, 'Gd': 0.01}), - ('rates_invalid_3', {'Gb156': 0.01}), - ('rates_invalid_4', {'Gb': 0.01}) + 'Gd157': 0.01}, None), + ('timesteps', {'U': 0.01, 'Xe': 0.1}, [1]), + ('rates_invalid_1', {'Gd': 0.01, 'Gd157': 0.01, 'Gd156': 0.01}, None), + ('rates_invalid_2', {'Gd156': 0.01, 'Gd157': 0.01, 'Gd': 0.01}, None), + ('rates_invalid_3', {'Gb156': 0.01}, None), + ('rates_invalid_4', {'Gb': 0.01}, None) ]) -def test_get_set(model, case_name, transfer_rates): +def test_get_set(model, case_name, transfer_rates, timesteps): """Tests the get/set methods""" - - openmc.reset_auto_ids() op = CoupledOperator(model, CHAIN_PATH) - transfer = TransferRates(op, model) + number_of_timesteps = 2 + transfer = TransferRates(op, model.materials, number_of_timesteps) + + if timesteps is None: + timesteps = np.arange(number_of_timesteps) # Test by Openmc material, material name and material id material, dest_material, dest_material2 = [m for m in model.materials if m.depletable] for material_input in [material, material.name, material.id]: - for dest_material_input in [dest_material, dest_material.name, + for dest_material_input in [None, dest_material, dest_material.name, dest_material.id]: if case_name == 'rates_invalid_1': with pytest.raises(ValueError, match='Cannot add transfer ' @@ -117,14 +121,21 @@ def test_get_set(model, case_name, transfer_rates): for component, transfer_rate in transfer_rates.items(): transfer.set_transfer_rate(material_input, [component], transfer_rate, + timesteps=timesteps, destination_material=\ dest_material_input) - assert transfer.get_transfer_rate( - material_input, component)[0] == transfer_rate - assert transfer.get_destination_material( - material_input, component)[0] == str(dest_material.id) - assert transfer.get_components(material_input) == \ - transfer_rates.keys() + assert transfer.get_external_rate( + material_input, component, timesteps, + dest_material_input)[0] == transfer_rate + assert np.all(transfer.external_timesteps == timesteps) + + if timesteps is not None: + for timestep in timesteps: + assert transfer.get_components(material_input, timestep, + dest_material_input) == list(transfer_rates.keys()) + else: + assert transfer.get_components(material_input, timesteps, + dest_material_input) == list(transfer_rates.keys()) if case_name == 'multiple_transfer': for dest2_material_input in [dest_material2, dest_material2.name, @@ -135,10 +146,8 @@ def test_get_set(model, case_name, transfer_rates): destination_material=\ dest2_material_input) for id, dest_mat in zip([0,1],[dest_material,dest_material2]): - assert transfer.get_transfer_rate( - material_input, component)[id] == transfer_rate - assert transfer.get_destination_material( - material_input, component)[id] == str(dest_mat.id) + assert transfer.get_external_rate( + material_input, component, timesteps)[0] == transfer_rate @pytest.mark.parametrize("transfer_rate_units, unit_conv", [ ('1/s', 1), @@ -158,13 +167,15 @@ def test_units(transfer_rate_units, unit_conv, model): # create transfer rate Xe components = ['Xe', 'U235'] transfer_rate = 1e-5 + number_of_timesteps = 2 op = CoupledOperator(model, CHAIN_PATH) - transfer = TransferRates(op, model) + transfer = TransferRates(op, model.materials, number_of_timesteps) for component in components: transfer.set_transfer_rate('f', [component], transfer_rate * unit_conv, transfer_rate_units=transfer_rate_units) - assert transfer.get_transfer_rate('f', component)[0] == transfer_rate + for timestep in range(transfer.number_of_timesteps): + assert transfer.get_external_rate('f', component, timestep)[0] == transfer_rate def test_transfer(run_in_tmpdir, model): @@ -187,3 +198,35 @@ def test_transfer(run_in_tmpdir, model): # Ensure number of atoms equal transfer decay assert atoms[1] == pytest.approx(atoms[0]*exp(-transfer_rate*3600*24)) assert atoms[2] == pytest.approx(atoms[1]*exp(-transfer_rate*3600*24)) + +@pytest.mark.parametrize("case_name, buffer, ox", [ + ('redox', {'Gd157':1}, {'Gd': 3, 'U': 4}), + ('buffer_invalid', {'Gd158':1}, {'Gd': 3, 'U': 4}), + ('elm_invalid', {'Gd157':1}, {'Gb': 3, 'U': 4}), + ]) +def test_redox(case_name, buffer, ox, model): + op = CoupledOperator(model, CHAIN_PATH) + number_of_timesteps = 2 + transfer = TransferRates(op, model.materials, number_of_timesteps) + + # Test by Openmc material, material name and material id + material, dest_material, dest_material2 = [m for m in model.materials + if m.depletable] + for material_input in [material, material.name, material.id]: + for dest_material_input in [dest_material, dest_material.name, + dest_material.id]: + + if case_name == 'buffer_invalid': + with pytest.raises(ValueError, match='Gd158 is not a valid ' + 'nuclide.'): + transfer.set_redox(material_input, buffer, ox) + + elif case_name == 'elm_invalid': + with pytest.raises(ValueError, match='Gb is not a valid ' + 'element.'): + transfer.set_redox(material_input, buffer, ox) + else: + transfer.set_redox(material_input, buffer, ox) + mat_id = transfer._get_material_id(material_input) + assert transfer.redox[mat_id][0] == buffer + assert transfer.redox[mat_id][1] == ox diff --git a/tests/unit_tests/test_element.py b/tests/unit_tests/test_element.py index d3555701e..d91cfaf6e 100644 --- a/tests/unit_tests/test_element.py +++ b/tests/unit_tests/test_element.py @@ -44,6 +44,13 @@ def test_expand_no_isotopes(): element.expand(100.0, 'ao') +def test_expand_ta(): + ref = {'Ta180': 0.01201, 'Ta181': 99.98799} + element = openmc.Element('Ta') + for isotope in element.expand(100.0, 'ao'): + assert isotope[1] == approx(ref[isotope[0]]) + + def test_expand_exceptions(): """ Test that correct exceptions are raised for invalid input """ diff --git a/tests/unit_tests/test_filter_distribcell.py b/tests/unit_tests/test_filter_distribcell.py new file mode 100644 index 000000000..d5734a2c0 --- /dev/null +++ b/tests/unit_tests/test_filter_distribcell.py @@ -0,0 +1,53 @@ +import openmc +import pandas as pd + + +def test_distribcell_filter_apply_tally_results(run_in_tmpdir): + # Reset IDs to ensure consistent paths + openmc.reset_auto_ids() + + mat = openmc.Material() + mat.add_nuclide("U235", 1.0) + mat.set_density("g/cm3", 1.0) + + # Define 2x2 lattice with a cylinder in each universe + cyl = openmc.ZCylinder(r=1.0) + cell1 = openmc.Cell(fill=mat, region=-cyl) + cell2 = openmc.Cell(fill=None, region=+cyl) + univ = openmc.Universe(cells=[cell1, cell2]) + lattice = openmc.RectLattice() + lattice.lower_left = (-3.0, -3.0) + lattice.pitch = (3.0, 3.0) + lattice.universes = [[univ, univ], [univ, univ]] + box = openmc.model.RectangularPrism(6., 6., boundary_type='reflective') + root_cell = openmc.Cell(region=-box, fill=lattice) + geometry = openmc.Geometry([root_cell]) + + # Create model and add tally with distribcell filter + model = openmc.Model(geometry) + model.settings.batches = 10 + model.settings.particles = 1000 + tally = openmc.Tally() + distribcell_filter = openmc.DistribcellFilter(cell1) + tally.filters = [distribcell_filter] + tally.scores = ['flux'] + model.tallies = [tally] + + # Run OpenMC and apply tally results + model.run(apply_tally_results=True) + + # Check that mean and standard deviation are available on tally + assert tally.mean.shape == (4, 1, 1) + assert tally.std_dev.shape == (4, 1, 1) + + # Make sure paths attribute on filter is correct + assert distribcell_filter.paths == [ + 'u3->c3->l2(0,0)->u1->c1', + 'u3->c3->l2(1,0)->u1->c1', + 'u3->c3->l2(0,1)->u1->c1', + 'u3->c3->l2(1,1)->u1->c1', + ] + + # Check that we can get a DataFrame from the tally + df = tally.get_pandas_dataframe() + assert isinstance(df, pd.DataFrame) diff --git a/tests/unit_tests/test_filter_mesh.py b/tests/unit_tests/test_filter_mesh.py index a8bd4996d..faa43af47 100644 --- a/tests/unit_tests/test_filter_mesh.py +++ b/tests/unit_tests/test_filter_mesh.py @@ -259,3 +259,29 @@ def test_get_reshaped_data(run_in_tmpdir): assert data1.shape == (2, 19*3*2, 1, 1) assert data2.shape == (2, 19, 3, 2, 1, 1) + +def test_mesh_filter_rotation_roundtrip(run_in_tmpdir): + """Test that MeshFilter rotation works as expected""" + + + mesh = openmc.RegularMesh() + mesh.lower_left = [-10, -10, -10] + mesh.upper_right = [10, 10, 10] + mesh.dimension = [2, 3, 4] + + # check that rotatoin is round-tripped correctly for a set of angles + mesh_filter = openmc.MeshFilter(mesh) + mesh_filter.rotation = [0, 0, 90] # Rotate around z-axis by 90 degrees + + elem = mesh_filter.to_xml_element() + mesh_filter_xml = openmc.MeshFilter.from_xml_element(elem, meshes={mesh.id: mesh}) + assert all(mesh_filter_xml.rotation == mesh_filter.rotation) + + # check that rotation matrix is round-tripped correctly for a rotation matrix + mesh_filter.rotation = np.array([[0.7071, 0, 0.7071], + [0, 1, 0], + [-0.7071, 0, 0.7071]]) + + elem = mesh_filter.to_xml_element() + mesh_filter_xml = openmc.MeshFilter.from_xml_element(elem, meshes={mesh.id: mesh}) + assert np.allclose(mesh_filter_xml.rotation, mesh_filter.rotation) diff --git a/tests/unit_tests/test_filter_meshmaterial.py b/tests/unit_tests/test_filter_meshmaterial.py new file mode 100644 index 000000000..a05ed5a12 --- /dev/null +++ b/tests/unit_tests/test_filter_meshmaterial.py @@ -0,0 +1,66 @@ +import numpy as np +import openmc +from pytest import approx + + +def test_filter_mesh_material(run_in_tmpdir): + # Create four identical materials + openmc.reset_auto_ids() + materials = [] + for i in range(4): + mat = openmc.Material() + mat.id = 10*(i+1) + mat.add_nuclide('Fe56', 1.0) + materials.append(mat) + + # Create a slab model with four cells + z_values = [-10., -5., 0., 5., 10.] + planes = [openmc.ZPlane(z) for z in z_values] + planes[0].boundary_type = 'vacuum' + planes[-1].boundary_type = 'vacuum' + regions = [+left & -right for left, right in zip(planes[:-1], planes[1:])] + cells = [openmc.Cell(fill=m, region=r) for r, m in zip(regions, materials)] + model = openmc.Model() + model.geometry = openmc.Geometry(cells) + model.settings.particles = 1_000 + model.settings.batches = 5 + model.settings.run_mode = 'fixed source' + + # Create a mesh that does not align with all planar surfaces + mesh = openmc.RegularMesh() + mesh.lower_left = (-1., -1., -10.) + mesh.upper_right = (1., 1., 10.) + mesh.dimension = (1, 1, 5) + + # Determine material volumes in each mesh element and use result to create a + # MeshMaterialFilter with corresponding bins + vols = mesh.material_volumes(model) + mmf = openmc.MeshMaterialFilter.from_volumes(mesh, vols) + expected_bins = [(0, 10), (1, 10), (1, 20), (2, 20), (2, 30), (3, 40), (3, 30), (4, 40)] + np.testing.assert_equal(mmf.bins, expected_bins) + + # Create two tallies, one with a mesh filter and one with mesh-material + mesh_tally = openmc.Tally() + mesh_tally.filters = [openmc.MeshFilter(mesh)] + mesh_tally.scores = ['flux'] + mesh_material_tally = openmc.Tally() + mesh_material_tally.filters = [mmf] + mesh_material_tally.scores = ['flux'] + model.tallies = [mesh_tally, mesh_material_tally] + + # Run model to get results on the two tallies + model.run(apply_tally_results=True) + + # The sum of the flux in each mesh-material combination within a single mesh + # element should be equal to the flux in that mesh element + mesh_mean = mesh_tally.mean.ravel() + meshmat_mean = mesh_material_tally.mean.ravel() + assert mesh_mean[0] == approx(meshmat_mean[0]) + assert mesh_mean[1] == approx(meshmat_mean[1] + meshmat_mean[2]) + assert mesh_mean[2] == approx(meshmat_mean[3] + meshmat_mean[4]) + assert mesh_mean[3] == approx(meshmat_mean[5] + meshmat_mean[6]) + assert mesh_mean[4] == approx(meshmat_mean[7]) + assert mesh_tally.mean.sum() == approx(mesh_material_tally.mean.sum()) + + # Make sure get_pandas_dataframe method works + mesh_material_tally.get_pandas_dataframe() diff --git a/tests/unit_tests/test_filter_weight.py b/tests/unit_tests/test_filter_weight.py new file mode 100644 index 000000000..878929ee0 --- /dev/null +++ b/tests/unit_tests/test_filter_weight.py @@ -0,0 +1,44 @@ +import openmc +import numpy as np + + +def test_weightfilter(run_in_tmpdir): + steel = openmc.Material(name='Stainless Steel') + steel.set_density('g/cm3', 8.00) + steel.add_nuclide('Fe56', 1.0) + + sphere = openmc.Sphere(r=50.0, boundary_type='vacuum') + cell = openmc.Cell(region=-sphere, fill=steel) + model = openmc.Model() + model.geometry = openmc.Geometry([cell]) + model.settings.particles = 100 + model.settings.batches = 10 + + model.settings.source = openmc.IndependentSource( + energy=openmc.stats.delta_function(14e6), + ) + model.settings.run_mode = "fixed source" + + radius = list(range(1, 50)) + sphere_mesh = openmc.SphericalMesh(radius) + mesh_filter = openmc.MeshFilter(sphere_mesh) + weight_filter = openmc.WeightFilter( + [0.999, 0.9999, 0.99999, 0.999999, 1.0, 1.000001 ,1.00001, 1.0001, 1.001] + ) + + tally = openmc.Tally() + tally.filters = [mesh_filter, weight_filter] + tally.estimator = 'analog' + tally.scores = ['flux'] + model.tallies = openmc.Tallies([tally]) + + # Run OpenMC + model.run(apply_tally_results=True) + + # Get current binned by mu + neutron_flux = tally.mean.reshape(48, 8) + + # All contributions should show up in the fourth bin + assert np.all(neutron_flux[:, 3] != 0.0) + neutron_flux[:, 3] = 0.0 + assert np.all(neutron_flux == 0.0) diff --git a/tests/unit_tests/test_filters.py b/tests/unit_tests/test_filters.py index 55bb62075..8c56a310e 100644 --- a/tests/unit_tests/test_filters.py +++ b/tests/unit_tests/test_filters.py @@ -294,3 +294,75 @@ def test_tabular_from_energyfilter(): tab = efilter.get_tabular(values=np.array([10, 10, 5]), interpolation='linear-linear') assert tab.interpolation == 'linear-linear' + + +def test_energy_filter(): + + # testing that bins descending value raises error + msg = "Values 1.0 and 0.5 appear to be out of order" + with raises(ValueError, match=msg): + openmc.EnergyFilter([0.0, 1.0, 0.5]) + + # testing that bins with same value raises error + msg = "Values 0.25 and 0.25 appear to be out of order" + with raises(ValueError, match=msg): + openmc.EnergyFilter([0.0, 0.25, 0.25]) + + # testing that negative bins values raises error + msg = 'Unable to set "filter value" to "-1.2" since it is less than "0.0"' + with raises(ValueError, match=msg): + openmc.EnergyFilter([-1.2, 0.25, 0.5]) + + +def test_weight(): + f = openmc.WeightFilter([0.01, 0.1, 1.0, 10.0]) + expected_bins = [[0.01, 0.1], [0.1, 1.0], [1.0, 10.0]] + + assert np.allclose(f.bins, expected_bins) + assert len(f.bins) == 3 + + # Make sure __repr__ works + repr(f) + + # to_xml_element() + elem = f.to_xml_element() + assert elem.tag == 'filter' + assert elem.attrib['type'] == 'weight' + + # from_xml_element() + new_f = openmc.Filter.from_xml_element(elem) + assert new_f.id == f.id + assert np.allclose(new_f.bins, f.bins) + + +def test_mesh_material(): + mat1 = openmc.Material() + mat2 = openmc.Material() + + mesh = openmc.RegularMesh() + mesh.lower_left = (-1., -1., -1.) + mesh.upper_right = (1., 1., 1.) + mesh.dimension = (2, 4, 1) + bins = [(0, mat1), (0, mat2), (6, mat1), (7, mat2)] + f = openmc.MeshMaterialFilter(mesh, bins) + + expected_bins = [(0, mat1.id), (0, mat2.id), (6, mat1.id), (7, mat2.id)] + assert np.allclose(f.bins, expected_bins) + assert f.mesh == mesh + assert f.shape == (4,) + + # to_xml_element() + elem = f.to_xml_element() + assert elem.tag == 'filter' + assert elem.attrib['type'] == 'meshmaterial' + + # from_xml_element() + new_f = openmc.Filter.from_xml_element(elem, meshes={mesh.id: mesh}) + assert isinstance(new_f, openmc.MeshMaterialFilter) + assert new_f.id == f.id + assert new_f.mesh == f.mesh + assert np.allclose(new_f.bins, expected_bins) + + # Test hash and str + hash(f) + str(f) diff --git a/tests/unit_tests/test_ifp.py b/tests/unit_tests/test_ifp.py new file mode 100644 index 000000000..e527f1624 --- /dev/null +++ b/tests/unit_tests/test_ifp.py @@ -0,0 +1,88 @@ +"""Test the Iterated Fission Probability (IFP) method to compute adjoint-weighted +kinetics parameters using dedicated tallies.""" + +import pytest +import openmc + + +def test_xml_serialization(run_in_tmpdir): + """Check that a simple use case can be written and read in XML.""" + parameter = 5 + settings = openmc.Settings() + settings.ifp_n_generation = parameter + settings.export_to_xml() + + read_settings = openmc.Settings.from_xml() + assert read_settings.ifp_n_generation == parameter + + +@pytest.fixture(scope="module") +def geometry(): + openmc.reset_auto_ids() + material = openmc.Material() + material.add_nuclide("U235", 1.0) + sphere = openmc.Sphere(r=1.0, boundary_type="vacuum") + cell = openmc.Cell(region=-sphere, fill=material) + return openmc.Geometry([cell]) + + +@pytest.mark.parametrize( + "options, error", + [ + ({"ifp_n_generation": 0}, ValueError), + ({"ifp_n_generation": -1}, ValueError), + ({"run_mode": "fixed source"}, RuntimeError), + ({"inactive": 5, "ifp_n_generation": 6}, RuntimeError), + ({"inactive": 9}, RuntimeError) + ], +) +def test_exceptions(options, error, run_in_tmpdir, geometry): + """Test settings configuration that should return an error.""" + with pytest.raises(error): + settings = openmc.Settings(**options) + settings.particles = 100 + settings.batches = 15 + tally = openmc.Tally(name="ifp-scores") + tally.scores = ["ifp-time-numerator", "ifp-beta-numerator", "ifp-denominator"] + tallies = openmc.Tallies([tally]) + model = openmc.Model(geometry=geometry, settings=settings, tallies=tallies) + model.run() + + +@pytest.mark.parametrize( + "num_groups, use_auto_tallies", + [ + (None, True), + (None, False), + (6, True), + (6, False), + ], +) +def test_get_kinetics_parameters(run_in_tmpdir, geometry, num_groups, use_auto_tallies): + # Create basic model + model = openmc.Model(geometry=geometry) + model.settings.particles = 1000 + model.settings.batches = 20 + model.settings.inactive = 5 + model.settings.ifp_n_generation = 5 + + # Add IFP tallies either via the convenience method or manually + if use_auto_tallies: + model.add_kinetics_parameters_tallies(num_groups=num_groups) + else: + for score in ["ifp-time-numerator", "ifp-beta-numerator", "ifp-denominator"]: + tally = openmc.Tally() + tally.scores = [score] + if score == "ifp-beta-numerator" and num_groups is not None: + tally.filters = [openmc.DelayedGroupFilter(list(range(1, num_groups + 1)))] + model.tallies.append(tally) + + # Run and get kinetics parameters + sp_file = model.run() + with openmc.StatePoint(sp_file) as sp: + params = sp.get_kinetics_parameters() + assert isinstance(params, openmc.KineticsParameters) + assert params.generation_time is not None + assert params.beta_effective is not None + if num_groups is not None: + assert len(params.beta_effective) == num_groups diff --git a/tests/unit_tests/test_lib.py b/tests/unit_tests/test_lib.py index 8ab35335f..e5a4d198e 100644 --- a/tests/unit_tests/test_lib.py +++ b/tests/unit_tests/test_lib.py @@ -159,6 +159,34 @@ def test_properties_temperature(lib_init): assert cell.get_temperature() == pytest.approx(200.0) +def test_cell_density(lib_init): + cell = openmc.lib.cells[1] + print('density', cell.get_density()) + orig_density = cell.get_density() + try: + cell.set_density(1.5, 0) + assert cell.get_density(0) == pytest.approx(1.5) + cell.set_density(2.0) + assert cell.get_density() == pytest.approx(2.0) + finally: + cell.set_density(orig_density) + + +def test_properties_cell_density(lib_init): + # Cell density should be 2.0 from above test + cell = openmc.lib.cells[1] + orig_density = cell.get_density() + + # Export properties and change density + openmc.lib.export_properties('properties.h5') + cell.set_density(3.0) + assert cell.get_density() == pytest.approx(3.0) + + # Import properties and check that density is restored + openmc.lib.import_properties('properties.h5') + assert cell.get_density() == pytest.approx(orig_density) + + def test_new_cell(lib_init): with pytest.raises(exc.AllocationError): openmc.lib.Cell(1) @@ -468,9 +496,6 @@ def test_set_n_batches(lib_run): for i in range(7): openmc.lib.next_batch() - # Setting n_batches less than current_batch should raise error - with pytest.raises(exc.InvalidArgumentError): - settings.set_batches(6) # n_batches should stay the same assert settings.get_batches() == 10 @@ -583,6 +608,13 @@ def test_regular_mesh(lib_init): assert isinstance(mesh, openmc.lib.RegularMesh) assert mesh_id == mesh.id + rotation = (180.0, 0.0, 0.0) + + mf = openmc.lib.MeshFilter(mesh) + assert mf.mesh == mesh + mf.rotation = rotation + assert np.allclose(mf.rotation, rotation) + translation = (1.0, 2.0, 3.0) mf = openmc.lib.MeshFilter(mesh) diff --git a/tests/unit_tests/test_material.py b/tests/unit_tests/test_material.py index cb71cd09b..764c98d41 100644 --- a/tests/unit_tests/test_material.py +++ b/tests/unit_tests/test_material.py @@ -3,8 +3,11 @@ from pathlib import Path import pytest +import numpy as np + import openmc from openmc.data import decay_photon_energy +from openmc.deplete import Chain import openmc.examples import openmc.model import openmc.stats @@ -478,6 +481,7 @@ def test_borated_water(): # Test the density override m = openmc.model.borated_water(975, 566.5, 15.51, density=0.9) assert m.density == pytest.approx(0.9, 1e-3) + assert m.temperature == pytest.approx(566.5) def test_from_xml(run_in_tmpdir): @@ -590,6 +594,12 @@ def test_get_activity(): # Test with volume specified as argument assert pytest.approx(m4.get_activity(units='Bq', volume=1.0)) == 355978108155965.94*3/2 + # Test units based on Ci + bq = m4.get_activity(units='Bq') + m3 = m4.volume * 1e-6 + assert (ci := m4.get_activity(units='Ci')) == pytest.approx(bq/3.7e10) + assert m4.get_activity(units='Ci/m3') == pytest.approx(ci/m3) + def test_get_decay_heat(): # Set chain file for testing @@ -704,3 +714,108 @@ def test_avoid_subnormal(run_in_tmpdir): # When read back in, the density should be zero mats = openmc.Materials.from_xml() assert mats[0].get_nuclide_atom_densities()['H2'] == 0.0 + + +def test_material_deplete(): + pristine_material = openmc.Material() + pristine_material.add_nuclide("Ni58", 1.0) + pristine_material.set_density("g/cm3", 7.87) + pristine_material.depletable = True + pristine_material.temperature = 293.6 + pristine_material.volume = 1. + + mg_flux = [0.5e11] * 42 + + chain = Chain.from_xml( + Path(__file__).parents[1] / "chain_ni.xml" + ) + + depleted_material = pristine_material.deplete( + multigroup_flux=mg_flux, + energy_group_structure="VITAMIN-J-42", + timesteps=[10, 70.86], + source_rates=[1e19, 0.0], + timestep_units="d", + chain_file=chain, + ) + + for i_step, material in enumerate(depleted_material): + assert isinstance(material, openmc.Material) + if i_step > 0: + assert len(material.get_nuclides()) > len(pristine_material.get_nuclides()) + + Co58_mat_1_step_0 = depleted_material[0].get_nuclide_atom_densities("Co58").get("Co58", 0.0) + Co58_mat_1_step_1 = depleted_material[1].get_nuclide_atom_densities("Co58")["Co58"] + Co58_mat_1_step_2 = depleted_material[2].get_nuclide_atom_densities("Co58")["Co58"] + + assert Co58_mat_1_step_0 == 0.0 + + # Check that Co58 is produced in the first step + assert Co58_mat_1_step_1 > 0.0 + + # Check that Co58 is halved in the second step which is one halflife later + assert np.allclose(Co58_mat_1_step_1 * 0.5, Co58_mat_1_step_2) + + +def test_mean_free_path(): + + mat1 = openmc.Material() + mat1.add_nuclide('Si28', 1.0) + mat1.set_density('g/cm3', 2.32) + assert mat1.mean_free_path(energy=14e6) == pytest.approx(11.41, abs=1e-2) + + mat2 = openmc.Material() + mat2.add_nuclide('Pb208', 1.0) + mat2.set_density('g/cm3', 11.34) + assert mat2.mean_free_path(energy=14e6) == pytest.approx(5.65, abs=1e-2) + + +def test_material_from_constructor(): + # Test that components and percent_type work in the constructor + components = { + 'Li': {'percent': 0.5, 'enrichment': 60.0, 'enrichment_target': 'Li7'}, + 'O16': 1.0, + 'Be': 0.5 + } + mat = openmc.Material( + material_id=123, + name="test-mat", + components=components, + percent_type="ao" + ) + # Check that nuclides were added + nuclide_names = [nuc.name for nuc in mat.nuclides] + assert 'O16' in nuclide_names + assert 'Be9' in nuclide_names + assert 'Li7' in nuclide_names + assert 'Li6' in nuclide_names + assert mat.id == 123 + assert mat.name == "test-mat" + + mat1 = openmc.Material( + **{ + "material_id": 1, + "name": "neutron_star", + "density": 1e17, + "density_units": "kg/m3", + } + ) + assert mat1.id == 1 + assert mat1.name == "neutron_star" + assert mat1._density == 1e17 + assert mat1._density_units == "kg/m3" + assert mat1.nuclides == [] + + mat2 = openmc.Material( + material_id=42, + name="plasma", + temperature=None, + density=1e-7, + density_units="g/cm3", + ) + assert mat2.id == 42 + assert mat2.name == "plasma" + assert mat2.temperature is None + assert mat2.density == 1e-7 + assert mat2.density_units == "g/cm3" + assert mat2.nuclides == [] diff --git a/tests/unit_tests/test_materials.py b/tests/unit_tests/test_materials.py new file mode 100644 index 000000000..5a382b777 --- /dev/null +++ b/tests/unit_tests/test_materials.py @@ -0,0 +1,80 @@ +from pathlib import Path + +import openmc +from openmc.deplete import Chain + + +def test_materials_deplete(): + pristine_material_1 = openmc.Material() + pristine_material_1.add_nuclide("Ni58", 1.) + pristine_material_1.set_density("g/cm3", 7.87) + pristine_material_1.depletable = True + pristine_material_1.temperature = 293.6 + pristine_material_1.volume = 1. + + pristine_material_2 = openmc.Material() + pristine_material_2.add_nuclide("Ni60", 1.) + pristine_material_2.set_density("g/cm3", 7.87) + pristine_material_2.depletable = True + pristine_material_2.temperature = 293.6 + pristine_material_2.volume = 1. + + pristine_materials = openmc.Materials([pristine_material_1, pristine_material_2]) + + mg_flux = [0.5e11] * 42 + + chain = Chain.from_xml( + Path(__file__).parents[1] / "chain_ni.xml" + ) + + depleted_material = pristine_materials.deplete( + multigroup_fluxes=[mg_flux, mg_flux], + energy_group_structures=["VITAMIN-J-42", "VITAMIN-J-42"], + timesteps=[100, 100], + source_rates=[1e19, 0.0], + timestep_units="d", + chain_file=chain, + ) + + assert list(depleted_material.keys()) == [pristine_material_1.id, pristine_material_2.id] + for mat_id, materials in depleted_material.items(): + for i_step, material in enumerate(materials): + assert isinstance(material, openmc.Material) + if i_step > 0: + assert len(material.get_nuclides()) > 1 + assert mat_id == material.id + + mats = depleted_material[pristine_material_1.id] + Co58_mat_1_step_0 = mats[0].get_nuclide_atom_densities("Co58").get("Co58", 0.0) + Co58_mat_1_step_1 = mats[1].get_nuclide_atom_densities("Co58")["Co58"] + Co58_mat_1_step_2 = mats[2].get_nuclide_atom_densities("Co58")["Co58"] + + assert Co58_mat_1_step_0 == 0.0 + # Co58 is the main activation product of Ni58 in the first irradiation step. + # It then decays in the second cooling step (flux = 0) + assert Co58_mat_1_step_1 > 0.0 and Co58_mat_1_step_1 > Co58_mat_1_step_2 + + Ni59_mat_1_step_0 = mats[0].get_nuclide_atom_densities("Ni59").get("Ni59", 0.0) + Ni59_mat_1_step_1 = mats[1].get_nuclide_atom_densities("Ni59")["Ni59"] + Ni59_mat_1_step_2 = mats[2].get_nuclide_atom_densities("Ni59")["Ni59"] + + assert Ni59_mat_1_step_0 == 0.0 + # Ni59 is one of the main activation product of Ni60 in the first irradiation + # step. It then decays in the second cooling step (flux = 0) + assert Ni59_mat_1_step_1 > 0.0 and Ni59_mat_1_step_1 > Ni59_mat_1_step_2 + + +def test_export_duplicate_materials_to_xml(run_in_tmpdir): + """ + Test exporting Materials to xml with a duplicate and checking that only + unique entities are exported. + """ + my_mat = openmc.Material(name="my_mat") + my_mat2 = openmc.Material(name="my_mat2") + + materials = openmc.Materials([my_mat, my_mat2, my_mat]) + + materials.export_to_xml("materials.xml") + + materials_in = openmc.Materials.from_xml("materials.xml") + assert len(materials_in) == 2 diff --git a/tests/unit_tests/test_mcpl_stat_sum.py b/tests/unit_tests/test_mcpl_stat_sum.py new file mode 100644 index 000000000..b69192956 --- /dev/null +++ b/tests/unit_tests/test_mcpl_stat_sum.py @@ -0,0 +1,69 @@ +"""Test for MCPL stat:sum functionality""" + +from pathlib import Path +import shutil + +import pytest +import openmc + + +@pytest.mark.skipif(shutil.which("mcpl-config") is None, reason="MCPL is not available.") +def test_mcpl_stat_sum_field(run_in_tmpdir): + """Test that MCPL files contain proper stat:sum field with particle count. + + This test verifies that when OpenMC creates MCPL source files, they contain + the stat:sum field. Since MCPL functions are not exposed in the Python API, + this test creates an actual OpenMC simulation to generate MCPL files and + then checks their content. + """ + + mcpl = pytest.importorskip("mcpl") + + # Create a minimal working model that will generate MCPL files + model = openmc.examples.pwr_pin_cell() + model.settings.batches = 5 + model.settings.inactive = 2 + model.settings.particles = 1000 + model.settings.sourcepoint = {'mcpl': True, 'separate': True} + + # Run a short simulation to generate MCPL files + model.run(output=False) + + # Find the generated MCPL file (from the last batch) + mcpl_file = Path('source.5.mcpl') + assert mcpl_file.exists(), "No MCPL files were generated" + + # Open and verify the stat:sum field exists + with mcpl.MCPLFile(mcpl_file) as f: + # Check if stat:sum field exists using convenience property + if hasattr(f, 'stat_sum'): + # Use the convenience .stat_sum property directly + stat_sum_dict = f.stat_sum + assert 'openmc_np1' in stat_sum_dict, "openmc_np1 key not found in stat_sum" + stat_sum_value = int(stat_sum_dict['openmc_np1']) + else: + # Fallback to checking comments for older MCPL versions + comments = f.comments + + # Check for stat:sum in comments (MCPL stores these as comments) + stat_sum_value = None + + for comment in comments: + if 'stat:sum:openmc_np1' in comment: + # Extract the value + parts = comment.split(':') + if len(parts) >= 4: + stat_sum_value = int(parts[3].strip()) + break + else: + pytest.skip("stat:sum field not found - may be running with MCPL < 2.1.0") + + # Verify the stat:sum value is reasonable + assert stat_sum_value != -1, "stat:sum was not updated from initial -1 value" + + # In eigenvalue mode, active batches generate source particles + active_batches = model.settings.batches - model.settings.inactive # 3 active batches + expected_particles = active_batches * model.settings.particles # 3000 total + + assert stat_sum_value == expected_particles, \ + f"stat:sum value {stat_sum_value} doesn't match expected {expected_particles}" diff --git a/tests/unit_tests/test_mesh.py b/tests/unit_tests/test_mesh.py index f1f5e9f67..9aca8b596 100644 --- a/tests/unit_tests/test_mesh.py +++ b/tests/unit_tests/test_mesh.py @@ -2,11 +2,14 @@ from math import pi from tempfile import TemporaryDirectory from pathlib import Path +import h5py import numpy as np +from scipy.stats import chi2 import pytest import openmc import openmc.lib from openmc.utility_funcs import change_directory +from uncertainties.unumpy import uarray, nominal_values, std_devs @pytest.mark.parametrize("val_left,val_right", [(0, 0), (-1., -1.), (2.0, 2)]) @@ -480,6 +483,77 @@ def test_umesh(run_in_tmpdir, simple_umesh, export_type): mean = np.array([arr.GetTuple1(i) for i in range(ref_data.size)]) np.testing.assert_almost_equal(mean, ref_data) + # attempt to apply a dataset with an improper size to a VTK write + with pytest.raises(ValueError, match='Cannot apply dataset "mean"'): + simple_umesh.write_data_to_vtk(datasets={'mean': ref_data[:-2]}, filename=filename) + + +@pytest.mark.skipif(not openmc.lib._dagmc_enabled(), reason="DAGMC not enabled.") +def test_write_vtkhdf(request, run_in_tmpdir): + """Performs a minimal UnstructuredMesh simulation, reads in the resulting + statepoint file and writes the mesh data to vtk and vtkhdf files. It is + necessary to read in the unstructured mesh from a statepoint file to ensure + it has all the required attributes + """ + model = openmc.Model() + + surf1 = openmc.Sphere(r=1000.0, boundary_type="vacuum") + cell1 = openmc.Cell(region=-surf1) + model.geometry = openmc.Geometry([cell1]) + + umesh = openmc.UnstructuredMesh( + request.path.parent / "test_mesh_dagmc_tets.vtk", + "moab", + mesh_id = 1 + ) + mesh_filter = openmc.MeshFilter(umesh) + + # Create flux mesh tally to score alpha production + mesh_tally = openmc.Tally(name="test_tally") + mesh_tally.filters = [mesh_filter] + mesh_tally.scores = ["flux"] + + model.tallies = [mesh_tally] + + model.settings.run_mode = "fixed source" + model.settings.batches = 2 + model.settings.particles = 10 + + statepoint_file = model.run() + + with openmc.StatePoint(statepoint_file) as statepoint: + my_tally = statepoint.get_tally(name="test_tally") + + umesh_from_sp = statepoint.meshes[umesh.id] + + datasets={ + "mean": my_tally.mean.flatten(), + "std_dev": my_tally.std_dev.flatten() + } + + umesh_from_sp.write_data_to_vtk(datasets=datasets, filename="test_mesh.vtkhdf") + umesh_from_sp.write_data_to_vtk(datasets=datasets, filename="test_mesh.vtk") + + with pytest.raises(ValueError, match="Unsupported file extension"): + # Supported file extensions are vtk or vtkhdf, not hdf5, so this should raise an error + umesh_from_sp.write_data_to_vtk( + datasets=datasets, + filename="test_mesh.hdf5", + ) + with pytest.raises(ValueError, match="Cannot apply dataset"): + # The shape of the data should match the shape of the mesh, so this should raise an error + umesh_from_sp.write_data_to_vtk( + datasets={'incorrectly_shaped_data': np.array(([1,2,3]))}, + filename="test_mesh_incorrect_shape.vtkhdf", + ) + + assert Path("test_mesh.vtk").exists() + assert Path("test_mesh.vtkhdf").exists() + + # just ensure we can open the file without error + with h5py.File("test_mesh.vtkhdf", "r"): + ... + def test_mesh_get_homogenized_materials(): """Test the get_homogenized_materials method""" @@ -615,3 +689,142 @@ def test_mesh_material_volumes_serialize(): assert new_volumes.by_element(1) == [(None, 1.0)] assert new_volumes.by_element(2) == [(2, 0.5), (1, 0.5)] assert new_volumes.by_element(3) == [(2, 1.0)] + + +def test_mesh_material_volumes_boundary_conditions(sphere_model): + """Test the material volumes method using a regular mesh + that overlaps with a vacuum boundary condition.""" + + mesh = openmc.SphericalMesh.from_domain(sphere_model.geometry, dimension=(1, 1, 1)) + # extend mesh beyond the outer sphere surface to test rays crossing the boundary condition + mesh.r_grid[-1] += 5.0 + + # add a new cell to the modelthat occupies the outside of the sphere + sphere_surfaces = list(filter(lambda s: isinstance(s, openmc.Sphere), + sphere_model.geometry.get_all_surfaces().values())) + outer_cell = openmc.Cell(region=+sphere_surfaces[0]) + sphere_model.geometry.root_universe.add_cell(outer_cell) + + volumes = mesh.material_volumes(sphere_model, (0, 100, 100)) + sphere_volume = 4/3*np.pi*25**3 + mats = sphere_model.materials + expected_volumes = [(mats[0].id, 0.25*sphere_volume), + (mats[1].id, 0.25*sphere_volume), + (mats[2].id, 0.5*sphere_volume), + (None, 4/3*np.pi*mesh.r_grid[-1]**3 - sphere_volume)] + + for evaluated, expected in zip(volumes.by_element(0), expected_volumes): + assert evaluated[0] == expected[0] + assert evaluated[1] == pytest.approx(expected[1], rel=1e-2) + + +def test_raytrace_mesh_infinite_loop(run_in_tmpdir): + # Create a model with one large spherical cell + sphere = openmc.Sphere(r=100, boundary_type='vacuum') + cell = openmc.Cell(region=-sphere) + model = openmc.Model() + model.geometry = openmc.Geometry([cell]) + + # Create a regular mesh and associated tally + mesh_surface = openmc.RegularMesh() + mesh_surface.lower_left = (-30, -30, 30) + mesh_surface.upper_right = (30, 30, 60) + mesh_surface.dimension = (1, 1, 1) + reg_filter = openmc.MeshSurfaceFilter(mesh_surface) + mesh_surface_tally = openmc.Tally() + mesh_surface_tally.filters = [reg_filter] + mesh_surface_tally.scores = ['current'] + model.tallies = [mesh_surface_tally] + + # Define a source such that the z position is on a mesh boundary with a very + # small directional cosine in the z direction + polar = openmc.stats.delta_function(1.75e-7) + azimuthal = openmc.stats.Uniform(0.0, 2.0*pi) + model.settings.source = openmc.IndependentSource( + angle=openmc.stats.PolarAzimuthal(polar, azimuthal) + ) + model.settings.run_mode = 'fixed source' + model.settings.particles = 10 + model.settings.batches = 1 + + # Run the model; this should not cause an infinite loop + model.run() + + +def test_filter_time_mesh(run_in_tmpdir): + """Test combination of TimeFilter and MeshFilter""" + + # Define material + mat = openmc.Material() + mat.add_nuclide('Fe56', 1.0) + mat.set_density('g/cm3', 7.8) + + # Define geometry + surf_Z1 = openmc.XPlane(x0=-1e10, boundary_type="reflective") + surf_Z2 = openmc.XPlane(x0=1e10, boundary_type="reflective") + cell_F = openmc.Cell(fill=mat, region=+surf_Z1 & -surf_Z2) + model = openmc.Model() + model.geometry = openmc.Geometry([cell_F]) + + # Define settings + model.settings.run_mode = "fixed source" + model.settings.particles = 1000 + model.settings.batches = 20 + model.settings.output = {"tallies": False} + model.settings.cutoff = {"time_neutron": 1e-7} + + # Define tallies + + # Create a mesh filter that can be used in a tally + mesh = openmc.RegularMesh() + mesh.dimension = (21, 1, 1) + mesh.lower_left = (-20.5, -1e10, -1e10) + mesh.upper_right = (20.5, 1e10, 1e10) + time_grid = np.linspace(0.0, 1e-7, 21) + + mesh_filter = openmc.MeshFilter(mesh) + time_filter = openmc.TimeFilter(time_grid) + + # Now use the mesh filter in a tally and indicate what scores are desired + tally1 = openmc.Tally(name="collision") + tally1.estimator = "collision" + tally1.filters = [time_filter, mesh_filter] + tally1.scores = ["flux"] + tally2 = openmc.Tally(name="tracklength") + tally2.estimator = "tracklength" + tally2.filters = [time_filter, mesh_filter] + tally2.scores = ["flux"] + model.tallies = openmc.Tallies([tally1, tally2]) + + # Run and post-process + model.run(apply_tally_results=True) + + # Get radial flux distribution + flux_collision = tally1.mean.ravel() + flux_collision_unc = tally1.std_dev.ravel() + flux_tracklength = tally2.mean.ravel() + flux_tracklength_unc = tally2.std_dev.ravel() + + # Construct arrays with uncertainties + collision = uarray(flux_collision, flux_collision_unc) + tracklength = uarray(flux_tracklength, flux_tracklength_unc) + delta = collision - tracklength + + # Compute differences and standard deviations + diff = nominal_values(delta) + std_dev = std_devs(delta) + + # Exclude zero-uncertainty bins + mask = std_dev > 0.0 + dof = int(np.sum(mask)) + + # Global chi-square consistency test between collision and tracklength + # estimators. Target false positive rate ~1e-4 (1 in 10,000) + z = diff[mask] / std_dev[mask] + chi2_stat = np.sum(z * z) + alpha = 1.0e-4 + crit = chi2.ppf(1 - alpha, dof) + assert chi2_stat < crit, ( + f"Collision vs tracklength tallies disagree: chi2={chi2_stat:.2f} " + f">= {crit=:.2f} ({dof=}, {alpha=})" + ) diff --git a/tests/unit_tests/test_mesh_dagmc_tets.vtk b/tests/unit_tests/test_mesh_dagmc_tets.vtk new file mode 120000 index 000000000..9f7000175 --- /dev/null +++ b/tests/unit_tests/test_mesh_dagmc_tets.vtk @@ -0,0 +1 @@ +../regression_tests/unstructured_mesh/test_mesh_dagmc_tets.vtk \ No newline at end of file diff --git a/tests/unit_tests/test_mesh_from_domain.py b/tests/unit_tests/test_mesh_from_domain.py index 0cbe413e8..5b1173126 100644 --- a/tests/unit_tests/test_mesh_from_domain.py +++ b/tests/unit_tests/test_mesh_from_domain.py @@ -40,7 +40,7 @@ def test_cylindrical_mesh_from_cell(): assert isinstance(mesh, openmc.CylindricalMesh) assert np.array_equal(mesh.dimension, (1, 1, 1)) - assert np.array_equal(mesh.r_grid, [0., 150.]) + assert np.array_equal(mesh.r_grid, [0., 50.]) assert np.array_equal(mesh.origin, [100., 0., 10.]) # Cell is not centralized on Z, X or Y axis @@ -49,7 +49,7 @@ def test_cylindrical_mesh_from_cell(): mesh = openmc.CylindricalMesh.from_domain(domain=cell, dimension=[1, 1, 1]) assert isinstance(mesh, openmc.CylindricalMesh) - assert np.array_equal(mesh.r_grid, [0., 220.]) + assert np.array_equal(mesh.r_grid, [0., 50.]) assert np.array_equal(mesh.origin, [100., 170., 10.]) @@ -87,6 +87,34 @@ def test_cylindrical_mesh_from_region(): assert np.array_equal(mesh.origin, (0.0, 0.0, -30.)) +def test_spherical_mesh_from_domain(): + """Tests a SphericalMesh can be made from a Region and the specified + dimensions are propagated through. Cell is not centralized""" + sphere = openmc.Sphere(r=5, x0=2, y0=3, z0=4) + region = -sphere + + geometry = openmc.Geometry(openmc.Universe(cells=[openmc.Cell(region=region)])) + + region_mesh = openmc.SphericalMesh.from_domain( + domain=region, dimension=(4, 3, 4)) + universe_mesh = openmc.SphericalMesh.from_domain( + domain=geometry.root_universe, dimension=(4, 3, 4)) + geometry_mesh = openmc.SphericalMesh.from_domain( + domain=geometry, dimension=(4, 3, 4)) + + + for mesh in (region_mesh, universe_mesh, geometry_mesh): + assert isinstance(mesh, openmc.SphericalMesh) + assert np.array_equal(mesh.dimension, (4, 3, 4)) + assert np.array_equal(mesh.r_grid, [0., 1.25, 2.5, 3.75, 5.0]) + assert np.array_equal(mesh.theta_grid, [0., np.pi/3., 2*np.pi/3., np.pi]) + assert np.array_equal(mesh.phi_grid, [0., np.pi/2., np.pi, 3*np.pi/2., 2*np.pi]) + assert np.array_equal(mesh.origin, (2.0, 3.0, 4.0)) + + for p in mesh.centroids.reshape(-1, 3): + assert p in mesh.bounding_box + + def test_reg_mesh_from_universe(): """Tests a RegularMesh can be made from a Universe and the default dimensions are propagated through. Universe is centralized""" @@ -119,3 +147,27 @@ def test_reg_mesh_from_geometry(): def test_error_from_unsupported_object(): with pytest.raises(TypeError): openmc.RegularMesh.from_domain("vacuum energy") + + +def test_regularmesh_from_domain_error_from_small_dimensions(): + surface = openmc.Sphere(r=20) + cell = openmc.Cell(region=-surface) + with pytest.raises( + ValueError, match='Unable to set "dimension" to "-2" since it is less than "1"' + ): + openmc.RegularMesh.from_domain(domain=cell, dimension=-2) + + +def test_dimensions_from_domain_dimensions_from_int(): + region = openmc.model.RectangularParallelepiped( + xmin=-100, + xmax=150, + ymin=-50, + ymax=200, + zmin=300, + zmax=400, + boundary_type="vacuum", + ) + cell = openmc.Cell(region=-region) + mesh = openmc.RegularMesh.from_domain(domain=cell, dimension=1000) + assert mesh.dimension == (14, 14, 5) diff --git a/tests/unit_tests/test_mgxs_convert_flux.py b/tests/unit_tests/test_mgxs_convert_flux.py new file mode 100644 index 000000000..e235f88e0 --- /dev/null +++ b/tests/unit_tests/test_mgxs_convert_flux.py @@ -0,0 +1,62 @@ +"""Tests for openmc.mgxs.convert_flux_groups function.""" + +import numpy as np +import pytest +from pytest import approx + +import openmc.mgxs + + +def test_coarse_to_fine(): + """Test coarse to fine conversion with flux conservation.""" + source = openmc.mgxs.EnergyGroups([1.0, 10.0, 100.0]) + target = openmc.mgxs.EnergyGroups([1.0, 5.0, 10.0, 50.0, 100.0]) + flux_source = np.array([1e8, 2e8]) + + flux_target = openmc.mgxs.convert_flux_groups(flux_source, source, target) + + # Check conservation + assert np.sum(flux_target) == approx(np.sum(flux_source)) + assert len(flux_target) == 4 + assert np.all(flux_target >= 0) + + +def test_fine_to_coarse(): + """Test fine to coarse conversion (reverse direction).""" + source = openmc.mgxs.EnergyGroups([1.0, 5.0, 10.0, 50.0, 100.0]) + target = openmc.mgxs.EnergyGroups([1.0, 10.0, 100.0]) + flux_source = np.array([1e7, 2e7, 3e7, 4e7]) + + flux_target = openmc.mgxs.convert_flux_groups(flux_source, source, target) + + assert np.sum(flux_target) == approx(np.sum(flux_source)) + assert len(flux_target) == 2 + + +def test_lethargy_distribution(): + """Test that flux is distributed by lethargy, not linear energy.""" + # Single group from 1 to 100 eV + source = openmc.mgxs.EnergyGroups([1.0, 100.0]) + # Split into two groups: 1-10 eV and 10-100 eV + target = openmc.mgxs.EnergyGroups([1.0, 10.0, 100.0]) + flux_source = np.array([1e8]) + + flux_target = openmc.mgxs.convert_flux_groups(flux_source, source, target) + + # Each target group spans one decade (ln(10) lethargy each) + # So flux should be split 50/50 by lethargy + assert flux_target[0] == approx(5e7) + assert flux_target[1] == approx(5e7) + + +def test_fns_ccfe709_to_ukaea1102(): + """Test CCFE-709 to UKAEA-1102 conversion with real FNS flux spectrum.""" + from pathlib import Path + flux_file = Path(__file__).parent.parent / 'fns_flux_709.npy' + fns_flux_709 = np.load(flux_file) + + flux_1102 = openmc.mgxs.convert_flux_groups(fns_flux_709, 'CCFE-709', 'UKAEA-1102') + + assert len(flux_1102) == 1102 + assert np.sum(flux_1102) == approx(np.sum(fns_flux_709), rel=1e-10) + assert np.all(flux_1102 >= 0) diff --git a/tests/unit_tests/test_model.py b/tests/unit_tests/test_model.py index ee5d8895c..3846ba4fb 100644 --- a/tests/unit_tests/test_model.py +++ b/tests/unit_tests/test_model.py @@ -7,6 +7,7 @@ import pytest import openmc import openmc.lib +from openmc.plots import id_map_to_rgb @pytest.fixture(scope='function') @@ -73,13 +74,13 @@ def pin_model_attributes(): tal.scores = ['flux', 'fission'] tals.append(tal) - plot1 = openmc.Plot(plot_id=1) + plot1 = openmc.SlicePlot(plot_id=1) plot1.origin = (0., 0., 0.) plot1.width = (pitch, pitch) plot1.pixels = (300, 300) plot1.color_by = 'material' plot1.filename = 'test' - plot2 = openmc.Plot(plot_id=2) + plot2 = openmc.SlicePlot(plot_id=2) plot2.origin = (0., 0., 0.) plot2.width = (pitch, pitch) plot2.pixels = (300, 300) @@ -251,10 +252,11 @@ def test_import_properties(run_in_tmpdir, mpi_intracomm): model = openmc.examples.pwr_pin_cell() model.init_lib(output=False, intracomm=mpi_intracomm) - # Change fuel temperature and density and export properties + # Change cell fuel temperature, density, material density and export properties cell = openmc.lib.cells[1] cell.set_temperature(600.0) cell.fill.set_density(5.0, 'g/cm3') + cell.set_density(10.0) openmc.lib.export_properties(output=False) # Import properties to existing model @@ -264,9 +266,11 @@ def test_import_properties(run_in_tmpdir, mpi_intracomm): # First python cell = model.geometry.get_all_cells()[1] assert cell.temperature == [600.0] + assert cell.density == [pytest.approx(10.0, 1e-5)] assert cell.fill.get_mass_density() == pytest.approx(5.0) # Now C assert openmc.lib.cells[1].get_temperature() == 600. + assert openmc.lib.cells[1].get_density() == pytest.approx(10.0, 1e-5) assert openmc.lib.materials[1].get_density('g/cm3') == pytest.approx(5.0) # Clear the C API @@ -283,6 +287,7 @@ def test_import_properties(run_in_tmpdir, mpi_intracomm): ) cell = model_with_properties.geometry.get_all_cells()[1] assert cell.temperature == [600.0] + assert cell.density == [pytest.approx(10.0, 1e-5)] assert cell.fill.get_mass_density() == pytest.approx(5.0) @@ -448,7 +453,7 @@ def test_deplete(run_in_tmpdir, pin_model_attributes, mpi_intracomm): # In this test we first run without pre-initializing the shared library # data and then compare. Then we repeat with the C API already initialized # and make sure we get the same answer - test_model.deplete([1e6], 'predictor', final_step=False, + test_model.deplete(timesteps=[1e6], method='predictor', final_step=False, operator_kwargs=op_kwargs, power=1., output=False) # Get the new Xe136 and U235 atom densities @@ -482,7 +487,7 @@ def test_deplete(run_in_tmpdir, pin_model_attributes, mpi_intracomm): # Now we can re-run with the pre-initialized API test_model.init_lib(output=False, intracomm=mpi_intracomm) - test_model.deplete([1e6], 'predictor', final_step=False, + test_model.deplete(timesteps=[1e6], method='predictor', final_step=False, operator_kwargs=op_kwargs, power=1., output=False) # Get the new Xe136 and U235 atom densities @@ -649,3 +654,387 @@ def test_model_plot(): # ensure that all of the data in the image data is either white or red test_mask = (image_data == white) | (image_data == red) assert np.all(test_mask), "Colors other than white or red found in overlap plot image" + + # Close plots to avoid warning + import matplotlib.pyplot as plt + plt.close('all') + + +def test_model_id_map_initialization(run_in_tmpdir): + model = openmc.examples.pwr_assembly() + model.init_lib(output=False) + + id_map = model.id_map( + pixels=(100, 100), + basis='xy', + origin=(0, 0, 0), + width=(10, 10), + ) + + assert id_map.shape == (100, 100, 3) + assert id_map.dtype == np.int32 + + max_cell_id = max(model.geometry.get_all_cells().keys()) + max_material_id = max(model.geometry.get_all_materials().keys()) + + # add some spot checks for the id_map + # Check that the array contains valid cell/material IDs (not all -2) + # The -2 values indicate outside the geometry + assert not np.all(id_map == -2), "All values are -2, indicating no valid geometry found" + + # Check that we have valid cell IDs (first dimension) + valid_cell_ids = id_map[:, :, 0] + assert np.any(valid_cell_ids >= 0), "No valid cell IDs found in the id_map" + + # Check that we have valid material IDs (third dimension) + valid_material_ids = id_map[:, :, 2] + assert np.any(valid_material_ids >= 0), "No valid material IDs found in the id_map" + + # Check that the middle dimension (cell instances) is consistent + # Cell instances should be >= 0 when cell IDs are valid + cell_instances = id_map[:, :, 1] + valid_cells = valid_cell_ids >= 0 + if np.any(valid_cells): + assert np.all(cell_instances[valid_cells] >= 0), "Invalid cell instances found for valid cells" + + # Check that the array contains reasonable ranges of values + # Cell IDs should be within the expected range for the assembly + if np.any(valid_cell_ids >= 0): + max_map_cell_id = np.max(valid_cell_ids) + assert max_map_cell_id <= max_cell_id, \ + f"Cell ID {max_map_cell_id} in the map is greater than the maximum cell ID {max_cell_id}" + + # Material IDs should be within the expected range + if np.any(valid_material_ids >= 0): + max_map_material_id = np.max(valid_material_ids) + assert max_map_material_id <= max_material_id, \ + f"Material ID {max_map_material_id} in the map is greater than the maximum material ID {max_material_id}" + + # Test id_map with pixels outside the model geometry + # Use a plot that's far from the model center to ensure we get -2 values + outside_id_map = model.id_map( + pixels=(50, 50), + basis='xy', + origin=(1000, 1000, 0), # Far from the model center + width=(10, 10), + ) + + assert outside_id_map.shape == (50, 50, 3) + assert outside_id_map.dtype == np.int32 + + # All values should be -2 (outside geometry) for this plot + assert np.all(outside_id_map == -2), "Expected all values to be -2 for plot outside model geometry" + + # Verify that the outside plot has the correct structure + assert np.all(outside_id_map[:, :, 0] == -2), "Cell IDs should all be -2 outside geometry" + assert np.all(outside_id_map[:, :, 1] == -2), "Cell instances should all be -2 outside geometry" + assert np.all(outside_id_map[:, :, 2] == -2), "Material IDs should all be -2 outside geometry" + + # if the model is already initialized, it should not be finalized + # after calling this method + model.id_map( + pixels=(100, 100), + basis='xy', + origin=(0, 0, 0), + width=(10, 10), + ) + assert model.is_initialized + + # if the model is not initialized, it should be finalized + # before exiting this method + model.finalize_lib() + model.id_map( + pixels=(100, 100), + basis='xy', + origin=(0, 0, 0), + width=(10, 10), + ) + assert not model.is_initialized + + +def test_id_map_aligned_model(): + """Test id_map with a 2x2 lattice where pixel boundaries align to cell boundaries""" + # Create materials -- identical compositions, different IDs + mat1 = openmc.Material(material_id=1, name='Material 1') + mat1.set_density('g/cm3', 1.0) + mat1.add_element('H', 1.0) + + mat2 = openmc.Material(material_id=2, name='Material 2') + mat2.set_density('g/cm3', 1.0) + mat2.add_element('H', 1.0) + + mat3 = openmc.Material(material_id=3, name='Material 3') + mat3.set_density('g/cm3', 1.0) + mat3.add_element('H', 1.0) + + mat4 = openmc.Material(material_id=4, name='Material 4') + mat4.set_density('g/cm3', 1.0) + mat4.add_element('H', 1.0) + + outer_mat = openmc.Material(material_id=5, name='Material 5') + outer_mat.set_density('g/cm3', 1.0) + outer_mat.add_element('H', 1.0) + + inner_materials = [mat1, mat2, mat3, mat4] + + # Create square surface that fits inside the lattice cell + # Lattice cell is 1 cm x 1 cm, so square will be 0.6 cm x 0.6 cm centered on the origin + square = openmc.model.RectangularPrism(0.6, 0.6, boundary_type='transmission') + + # Create cells for this universe + inner_cell = openmc.Cell(cell_id=10, region=-square, name='inner_cell') + inner_cell.fill = inner_materials + + outer_cell = openmc.Cell(cell_id=20, region=+square, name='outer_cell') + outer_cell.fill = outer_mat + + # Create universe + universe = openmc.Universe(universe_id=100, cells=[inner_cell, outer_cell]) + + # Create 2x2 lattice + lattice = openmc.RectLattice(lattice_id=1) + lattice.lower_left = [-1.0, -1.0] + lattice.pitch = [1.0, 1.0] + lattice.universes = [[universe, universe], [universe, universe]] + + # Create outer boundary + outer_boundary = openmc.model.RectangularPrism(2.0, 2.0, boundary_type='vacuum') + + # Create root cell + root_cell = openmc.Cell(cell_id=1, name='root', fill=lattice, region=-outer_boundary) + + # Create geometry + geometry = openmc.Geometry([root_cell]) + + # Create settings + settings = openmc.Settings() + settings.particles = 1000 + settings.batches = 10 + + # Create model + model = openmc.Model(settings=settings, geometry=geometry) + + # Generate id_map with pixel boundaries aligned to cell boundaries + # The model is 2 cm x 2 cm, so we'll use 200x200 pixels to get 0.01 cm resolution + # This allows us to align pixels with the squares inside each lattice cell + id_map = model.id_map( + pixels=(200, 200), + basis='xy', + origin=(0.0, 0.0, 0.0), # Align with lattice lower_left + width=(2.0, 2.0), # Align with lattice size + ) + + # Verify id_map properties + assert id_map.shape == (200, 200, 3) + assert id_map.dtype == np.int32 + + cell_id_map = id_map[:, :, 0] + material_ids_map = id_map[:, :, 2] + + # Check that we have valid cell IDs (not all -2) + assert np.any(cell_id_map >= 0), "No valid cell IDs found in the id_map" + + # Check that we have valid material IDs + assert np.any(material_ids_map >= 0), "No valid material IDs found in the id_map" + + # Check that the expected cell IDs are present + expected_cell_ids = [10, 20] # Root cell, inner cell, outer cell + found_cell_ids = np.unique(cell_id_map[cell_id_map >= 0]) + for cell_id in expected_cell_ids: + assert cell_id in found_cell_ids, f"Expected cell ID {cell_id} not found in id_map" + + # Check that the expected material IDs are present + expected_material_ids = [1, 2, 3, 4, 5] # All materials defined above + found_material_ids = np.unique(material_ids_map[material_ids_map >= 0]) + for mat_id in expected_material_ids: + assert mat_id in found_material_ids, f"Expected material ID {mat_id} not found in id_map" + + # Test specific regions to verify lattice structure + # Check center of each lattice cell (should be inner cells) + # Lattice cell centers are at (-0.5, -0.5), (0.5, -0.5), (-0.5, 0.5), (0.5, 0.5) + # With 200x200 pixels over 2x2 units, each pixel is 0.01 units + + # Bottom-left lattice cell center (should be inner cell 10) + bl_cell, bl_instance, bl_material = id_map[-50, 50] + assert bl_cell == 10, f"Expected cell ID 10 at bottom-left center, got {bl_cell}" + assert bl_instance == 0, f"Expected cell instance 0 at bottom-left center, got {bl_instance}" + assert bl_material == 1, f"Expected material ID 1 at bottom-left center, got {bl_material}" + + # Bottom-right lattice cell center (should be inner cell 10) + br_cell, br_instance, br_material = id_map[-50, 150] + assert br_cell == 10, f"Expected cell ID 10 at bottom-right center, got {br_cell}" + assert br_instance == 1, f"Expected cell instance 1 at bottom-right center, got {br_instance}" + assert br_material == 2, f"Expected material ID 2 at bottom-right center, got {br_material}" + + # Top-left lattice cell center (should be inner cell 10) + tl_cell, tl_instance, tl_material = id_map[-150, 50] + assert tl_cell == 10, f"Expected cell ID 10 at top-left center, got {tl_cell}" + assert tl_instance == 2, f"Expected cell instance 2 at top-left center, got {tl_instance}" + assert tl_material == 3, f"Expected material ID 3 at top-left center, got {tl_material}" + + # Top-right lattice cell center (should be inner cell 10) + tr_cell, tr_instance, tr_material = id_map[-150, 150] + assert tr_cell == 10, f"Expected cell ID 10 at top-right center, got {tr_cell}" + assert tr_instance == 3, f"Expected cell instance 3 at top-right center, got {tr_instance}" + assert tr_material == 4, f"Expected material ID 4 at top-right center, got {tr_material}" + + # Check that the model is properly finalized after id_map call + assert not model.is_initialized, "Model should be finalized after id_map call" + + # Check that the values at the corners are correctly set as the outer cell and material + bl_cell, bl_instance, bl_material = id_map[-1, 0] + assert bl_cell == 20, f"Expected cell ID 20 at bottom-left corner, got {bl_cell}" + assert bl_instance == 0, f"Expected cell instance 0 at bottom-left corner, got {bl_instance}" + assert bl_material == 5, f"Expected material ID 5 at bottom-left corner, got {bl_material}" + + br_cell, br_instance, br_material = id_map[-1, -1] + assert br_cell == 20, f"Expected cell ID 20 at bottom-right corner, got {br_cell}" + assert br_instance == 1, f"Expected cell instance 1 at bottom-right corner, got {br_instance}" + assert br_material == 5, f"Expected material ID 5 at bottom-right corner, got {br_material}" + + tl_cell, tl_instance, tl_material = id_map[0, 0] + assert tl_cell == 20, f"Expected cell ID 20 at top-left corner, got {tl_cell}" + assert tl_instance == 2, f"Expected cell instance 2 at top-left corner, got {tl_instance}" + assert tl_material == 5, f"Expected material ID 5 at top-left corner, got {tl_material}" + + tr_cell, tr_instance, tr_material = id_map[0, -1] + assert tr_cell == 20, f"Expected cell ID 20 at top-right corner, got {tr_cell}" + assert tr_instance == 3, f"Expected cell instance 3 at top-right corner, got {tr_instance}" + assert tr_material == 5, f"Expected material ID 5 at top-right corner, got {tr_material}" + + +def test_id_map_model_with_overlaps(): + """Test id_map with a model that has overlaps and color_overlaps option""" + surface1 = openmc.Sphere(r=50, boundary_type="vacuum") + surface2 = openmc.Sphere(r=30) + cell1 = openmc.Cell(region=-surface1) + cell2 = openmc.Cell(region=-surface2) + geometry = openmc.Geometry([cell1, cell2]) + settings = openmc.Settings() + model = openmc.Model(geometry=geometry, settings=settings) + id_slice = model.id_map( + pixels=(10, 10), + basis='xy', + origin=(0, 0, 0), + width=(100, 100), + ) + assert -3 not in id_slice # -3 indicates overlap region + id_slice = model.id_map( + pixels=(10, 10), + basis='xy', + origin=(0, 0, 0), + width=(100, 100), + color_overlaps=True, # enables id_map to return -3 for overlaps + ) + assert -3 in id_slice + + +def test_setter_from_list(): + mat = openmc.Material() + model = openmc.Model(materials=[mat]) + assert isinstance(model.materials, openmc.Materials) + + tally = openmc.Tally() + model = openmc.Model(tallies=[tally]) + assert isinstance(model.tallies, openmc.Tallies) + + plot = openmc.SlicePlot() + model = openmc.Model(plots=[plot]) + assert isinstance(model.plots, openmc.Plots) + + +def test_keff_search(run_in_tmpdir): + """Test the Model.keff_search method""" + + # Create model of a sphere of U235 + mat = openmc.Material() + mat.set_density('g/cm3', 18.9) + mat.add_nuclide('U235', 1.0) + sphere = openmc.Sphere(r=10.0, boundary_type='vacuum') + cell = openmc.Cell(fill=mat, region=-sphere) + geometry = openmc.Geometry([cell]) + settings = openmc.Settings(particles=1000, inactive=10, batches=30) + model = openmc.Model(geometry=geometry, settings=settings) + + # Define function to modify sphere radius + def modify_radius(radius): + sphere.r = radius + + # Perform keff search + k_tol = 4e-3 + sigma_final = 2e-3 + result = model.keff_search( + func=modify_radius, + x0=6.0, + x1=9.0, + k_tol=k_tol, + sigma_final=sigma_final, + output=True, + ) + + final_keff = result.means[-1] + 1.0 # Add back target since means are (keff - target) + final_sigma = result.stdevs[-1] + + # Check for convergence and that tolerances are met + assert result.converged, "keff_search did not converge" + assert abs(final_keff - 1.0) <= k_tol, \ + f"Final keff {final_keff:.5f} not within k_tol {k_tol}" + assert final_sigma <= sigma_final, \ + f"Final uncertainty {final_sigma:.5f} exceeds sigma_final {sigma_final}" + + # Check type of result + assert isinstance(result, openmc.model.SearchResult) + + # Check that we have function evaluation history + assert len(result.parameters) >= 2 + assert len(result.means) == len(result.parameters) + assert len(result.stdevs) == len(result.parameters) + assert len(result.batches) == len(result.parameters) + + # Check that function_calls property works + assert result.function_calls == len(result.parameters) + + # Check that total_batches property works + assert result.total_batches == sum(result.batches) + assert result.total_batches > 0 + + +def test_id_map_to_rgb(): + """Test conversion of ID map to RGB image array.""" + # Create a simple model + mat = openmc.Material() + mat.set_density('g/cm3', 1.0) + mat.add_nuclide('Li7', 1.0) + + sphere = openmc.Sphere(r=5.0, boundary_type='vacuum') + cell = openmc.Cell(fill=mat, region=-sphere) + geometry = openmc.Geometry([cell]) + settings = openmc.Settings( + batches=10, particles=100, run_mode='fixed source' + ) + model = openmc.Model(geometry, settings=settings) + + id_data = np.zeros((10, 10, 3), dtype=np.int32) + id_data[:, :, 0] = cell.id # Cell IDs + id_data[:, :, 2] = mat.id # Material IDs + + # Test color_by with default colors + for color_by in ['cell', 'material']: + rgb = id_map_to_rgb(id_data, color_by=color_by) + assert rgb.shape == (10, 10, 3) + assert rgb.dtype == float + assert np.all((rgb >= 0) & (rgb <= 1)) # RGB values in [0, 1] + + # Test with custom colors + colors = {cell.id: (255, 0, 0)} # Red + rgb_custom = id_map_to_rgb(id_data, color_by='cell', colors=colors) + assert np.allclose(rgb_custom, [1.0, 0.0, 0.0]) # All pixels should be red + + # Test with overlaps + id_data_overlap = id_data.copy() + id_data_overlap[5:, 5:, 0] = -3 # Mark some pixels as overlaps + rgb_overlap = id_map_to_rgb( + id_data_overlap, overlap_color=(0, 255, 0) + ) + # Check that overlap region is green + assert np.allclose(rgb_overlap[5:, 5:], [0.0, 1.0, 0.0]) diff --git a/tests/unit_tests/test_no_reduce.py b/tests/unit_tests/test_no_reduce.py new file mode 100644 index 000000000..00ddb5a95 --- /dev/null +++ b/tests/unit_tests/test_no_reduce.py @@ -0,0 +1,40 @@ +"""Test the settings.no_reduce feature to ensure tallies are correctly +reduced across MPI processes.""" + +import openmc +import pytest + +from tests.testing_harness import config + + +@pytest.mark.parametrize('no_reduce', [True, False]) +def test_no_reduce(no_reduce, run_in_tmpdir): + """Test that tally results are correct with and without no_reduce.""" + + # Create simple sphere model with vacuum + model = openmc.Model() + sphere = openmc.Sphere(r=1.0, boundary_type='vacuum') + cell = openmc.Cell(region=-sphere) + model.geometry = openmc.Geometry([cell]) + model.settings.run_mode = 'fixed source' + model.settings.batches = 10 + model.settings.particles = 100 + model.settings.source = openmc.IndependentSource(space=openmc.stats.Point()) + model.settings.no_reduce = no_reduce + + # Tally: surface current on vacuum boundary + surf_filter = openmc.SurfaceFilter(sphere) + tally = openmc.Tally() + tally.filters = [surf_filter] + tally.scores = ['current'] + model.tallies = [tally] + + # Run OpenMC with proper MPI arguments if needed + kwargs = {'apply_tally_results': True, 'openmc_exec': config['exe']} + if config['mpi']: + kwargs['mpi_args'] = [config['mpiexec'], '-n', config['mpi_np']] + model.run(**kwargs) + + # The tally should be ~1.0 (every particle crosses the surface once) + tally_mean = tally.mean.flatten()[0] + assert tally_mean == pytest.approx(1.0) diff --git a/tests/unit_tests/test_nuclide_heating.py b/tests/unit_tests/test_nuclide_heating.py new file mode 100644 index 000000000..e00d57b4f --- /dev/null +++ b/tests/unit_tests/test_nuclide_heating.py @@ -0,0 +1,39 @@ +import openmc +from pytest import approx + + +def test_nuclide_heating(run_in_tmpdir): + mat = openmc.Material() + mat.add_nuclide("Li6", 0.5) + mat.add_nuclide("Li7", 0.5) + mat.set_density("g/cm3", 1.0) + + sphere = openmc.Sphere(r=20, boundary_type="reflective") + inside_sphere = openmc.Cell(fill=mat, region=-sphere) + model = openmc.Model() + model.geometry = openmc.Geometry([inside_sphere]) + + model.settings.particles = 1000 + model.settings.batches = 1 + model.settings.photon_transport = True + model.settings.electron_treatment = "ttb" + model.settings.cutoff = {"energy_photon": 1000} + model.settings.run_mode = "fixed source" + model.settings.source = openmc.IndependentSource( + energy=openmc.stats.delta_function(10.0e6), + particle="photon" + ) + + # Create two tallies, one with heating by nuclide and one with total heating + tally1 = openmc.Tally() + tally1.scores = ["heating"] + tally1.nuclides = mat.get_nuclides() + tally2 = openmc.Tally() + tally2.scores = ["heating"] + model.tallies = [tally1, tally2] + + # Run the model + model.run(apply_tally_results=True) + + # Make sure the heating results are consistent + assert tally1.mean.sum() == approx(tally2.mean.sum()) diff --git a/tests/unit_tests/test_pathlike_simple.py b/tests/unit_tests/test_pathlike_simple.py new file mode 100644 index 000000000..e0116bf01 --- /dev/null +++ b/tests/unit_tests/test_pathlike_simple.py @@ -0,0 +1,46 @@ +"""Simple test for PathLike filename support""" + +from pathlib import Path + +import pytest +import openmc +from openmc.checkvalue import check_type, PathLike + + +def test_pathlike_type_checking(): + """Test that PathLike type checking works correctly""" + + # Test with string (should work) + check_type('filename', 'test.txt', PathLike) + + # Test with Path object (should work) + path_obj = Path('test.txt') + check_type('filename', path_obj, PathLike) + + # Test with Path object containing subdirectories (should work) + path_with_subdir = Path('subdir') / 'test.txt' + check_type('filename', path_with_subdir, PathLike) + + # Test with invalid type (should raise TypeError) + with pytest.raises(TypeError): + check_type('filename', 123, PathLike) + + +def test_plot_filename_pathlike(): + """Test that plot filename accepts Path objects""" + + plot = openmc.Plot() + + # Test with string (should still work) + plot.filename = "test_plot" + assert plot.filename == "test_plot" + + # Test with Path object + path_obj = Path("test_plot_path") + plot.filename = path_obj + assert plot.filename == path_obj + + # Test with Path object containing subdirectories + path_with_subdir = Path("subdir") / "test_plot" + plot.filename = path_with_subdir + assert plot.filename == path_with_subdir diff --git a/tests/unit_tests/test_periodic_bc.py b/tests/unit_tests/test_periodic_bc.py new file mode 100644 index 000000000..4cc126abc --- /dev/null +++ b/tests/unit_tests/test_periodic_bc.py @@ -0,0 +1,47 @@ +from math import cos, sin, radians +import random + +import openmc +import pytest + + +@pytest.mark.parametrize("angle", [30., 45., 60., 90., 120.]) +def test_rotational_periodic_bc(angle): + # Pick random starting angle + start = random.uniform(0., 360.) + degrees = angle + ang1 = radians(start) + ang2 = radians(start + degrees) + + # Define three points on each plane and then randomly shuffle them + p1_points = [(0., 0., 0.), (cos(ang1), sin(ang1), 0.), (0., 0., 1.)] + p2_points = [(0., 0., 0.), (cos(ang2), sin(ang2), 0.), (0., 0., 1.)] + random.shuffle(p1_points) + random.shuffle(p2_points) + + # Create periodic planes and a cylinder + p1 = openmc.Plane.from_points(*p1_points, boundary_type='periodic') + p2 = openmc.Plane.from_points(*p2_points, boundary_type='periodic') + p1.periodic_surface = p2 + zcyl = openmc.ZCylinder(r=5., boundary_type='vacuum') + + # Figure out which side of planes to use based on a point in the middle + ang_mid = radians(start + degrees/2.) + mid_point = (cos(ang_mid), sin(ang_mid), 0.) + r1 = -p1 if mid_point in -p1 else +p1 + r2 = -p2 if mid_point in -p2 else +p2 + + # Create one cell bounded by the two planes and the cylinder + mat = openmc.Material(density=1.0, density_units='g/cm3', components={'U235': 1.0}) + cell = openmc.Cell(fill=mat, region=r1 & r2 & -zcyl) + + # Make the model complete + model = openmc.Model() + model.geometry = openmc.Geometry([cell]) + model.settings.source = openmc.IndependentSource(space=openmc.stats.Point(mid_point)) + model.settings.particles = 1000 + model.settings.batches = 10 + model.settings.inactive = 5 + + # Run the model + model.run() diff --git a/tests/unit_tests/test_photon_heating.py b/tests/unit_tests/test_photon_heating.py new file mode 100644 index 000000000..05473f5c6 --- /dev/null +++ b/tests/unit_tests/test_photon_heating.py @@ -0,0 +1,30 @@ +import openmc + + +def test_negative_positron_heating(): + m = openmc.Material() + m.add_element('Li', 1.0) + m.set_density('g/cm3', 10.0) + + surf = openmc.Sphere(r=100.0, boundary_type='reflective') + cell = openmc.Cell(fill=m, region=-surf) + model = openmc.Model() + model.geometry = openmc.Geometry([cell]) + model.settings.run_mode = 'fixed source' + model.settings.source = openmc.IndependentSource( + space=openmc.stats.Point(), + energy=openmc.stats.Discrete([5.0e6], [1.0]), + particle='photon', + ) + model.settings.particles = 7 + model.settings.batches = 1 + model.settings.electron_treatment = 'led' + model.settings.seed = 513836 + + tally = openmc.Tally() + tally.filters = [openmc.ParticleFilter(['photon', 'electron', 'positron'])] + tally.scores = ['heating'] + model.tallies = openmc.Tallies([tally]) + model.run(apply_tally_results=True) + + assert (tally.mean >= 0.0).all(), "Negative heating detected" diff --git a/tests/unit_tests/test_plots.py b/tests/unit_tests/test_plots.py index fad574ee6..98a93e44b 100644 --- a/tests/unit_tests/test_plots.py +++ b/tests/unit_tests/test_plots.py @@ -9,12 +9,11 @@ from openmc.plots import _SVG_COLORS @pytest.fixture(scope='module') def myplot(): - plot = openmc.Plot(name='myplot') + plot = openmc.SlicePlot(name='myplot') plot.width = (100., 100.) plot.origin = (2., 3., -10.) plot.pixels = (500, 500) plot.filename = './not-a-dir/myplot' - plot.type = 'slice' plot.basis = 'yz' plot.background = 'black' plot.background = (0, 0, 0) @@ -80,8 +79,7 @@ def test_voxel_plot(run_in_tmpdir): geometry.export_to_xml() materials = openmc.Materials() materials.export_to_xml() - vox_plot = openmc.Plot() - vox_plot.type = 'voxel' + vox_plot = openmc.VoxelPlot() vox_plot.id = 12 vox_plot.width = (1500., 1500., 1500.) vox_plot.pixels = (200, 200, 200) @@ -97,8 +95,9 @@ def test_voxel_plot(run_in_tmpdir): assert Path('h5_voxel_plot.h5').is_file() assert Path('another_test_voxel_plot.vti').is_file() - slice_plot = openmc.Plot() - with pytest.raises(ValueError): + # SlicePlot should not have to_vtk method + slice_plot = openmc.SlicePlot() + with pytest.raises(AttributeError): slice_plot.to_vtk('shimmy.vti') @@ -153,14 +152,14 @@ def test_from_geometry(): geom = openmc.Geometry(univ) for basis in ('xy', 'yz', 'xz'): - plot = openmc.Plot.from_geometry(geom, basis) + plot = openmc.SlicePlot.from_geometry(geom, basis) assert plot.origin == pytest.approx((0., 0., 0.)) assert plot.width == pytest.approx((width, width)) assert plot.basis == basis def test_highlight_domains(): - plot = openmc.Plot() + plot = openmc.SlicePlot() plot.color_by = 'material' plots = openmc.Plots([plot]) @@ -179,8 +178,8 @@ def test_xml_element(myplot): assert elem.find('pixels') is not None assert elem.find('background').text == '0 0 0' - newplot = openmc.Plot.from_xml_element(elem) - attributes = ('id', 'color_by', 'filename', 'type', 'basis', 'level', + newplot = openmc.SlicePlot.from_xml_element(elem) + attributes = ('id', 'color_by', 'filename', 'basis', 'level', 'meshlines', 'show_overlaps', 'origin', 'width', 'pixels', 'background', 'mask_background') for attr in attributes: @@ -200,11 +199,11 @@ def test_to_xml_element_proj(myprojectionplot): def test_plots(run_in_tmpdir): - p1 = openmc.Plot(name='plot1') + p1 = openmc.SlicePlot(name='plot1') p1.origin = (5., 5., 5.) p1.colors = {10: (255, 100, 0)} p1.mask_components = [2, 4, 6] - p2 = openmc.Plot(name='plot2') + p2 = openmc.SlicePlot(name='plot2') p2.origin = (-3., -3., -3.) plots = openmc.Plots([p1, p2]) assert len(plots) == 2 @@ -213,7 +212,7 @@ def test_plots(run_in_tmpdir): plots = openmc.Plots([p1, p2, p3]) assert len(plots) == 3 - p4 = openmc.Plot(name='plot4') + p4 = openmc.VoxelPlot(name='plot4') plots.append(p4) assert len(plots) == 4 @@ -230,8 +229,7 @@ def test_plots(run_in_tmpdir): def test_voxel_plot_roundtrip(): # Define a voxel plot and create XML element - plot = openmc.Plot(name='my voxel plot') - plot.type = 'voxel' + plot = openmc.VoxelPlot(name='my voxel plot') plot.filename = 'voxel1' plot.pixels = (50, 50, 50) plot.origin = (0., 0., 0.) @@ -243,7 +241,6 @@ def test_voxel_plot_roundtrip(): new_plot = plot.from_xml_element(elem) assert new_plot.name == plot.name assert new_plot.filename == plot.filename - assert new_plot.type == plot.type assert new_plot.pixels == plot.pixels assert new_plot.origin == plot.origin assert new_plot.width == plot.width @@ -288,10 +285,9 @@ def test_phong_plot_roundtrip(): def test_plot_directory(run_in_tmpdir): pwr_pin = openmc.examples.pwr_pin_cell() - # create a standard plot, expected to work - plot = openmc.Plot() + # create a standard slice plot, expected to work + plot = openmc.SlicePlot() plot.filename = 'plot_1' - plot.type = 'slice' plot.pixels = (10, 10) plot.color_by = 'material' plot.width = (100., 100.) diff --git a/tests/unit_tests/test_r2s.py b/tests/unit_tests/test_r2s.py new file mode 100644 index 000000000..a94f85c8c --- /dev/null +++ b/tests/unit_tests/test_r2s.py @@ -0,0 +1,152 @@ +from pathlib import Path + +import pytest +import openmc +from openmc.deplete import Chain, R2SManager + + +@pytest.fixture +def simple_model_and_mesh(tmp_path): + # Define two materials: water and Ni + h2o = openmc.Material() + h2o.add_nuclide("H1", 2.0) + h2o.add_nuclide("O16", 1.0) + h2o.set_density("g/cm3", 1.0) + nickel = openmc.Material() + nickel.add_element("Ni", 1.0) + nickel.set_density("g/cm3", 4.0) + + # Geometry: two half-spaces split by x=0 plane + left = openmc.XPlane(0.0) + x_min = openmc.XPlane(-10.0, boundary_type='vacuum') + x_max = openmc.XPlane(10.0, boundary_type='vacuum') + y_min = openmc.YPlane(-10.0, boundary_type='vacuum') + y_max = openmc.YPlane(10.0, boundary_type='vacuum') + z_min = openmc.ZPlane(-10.0, boundary_type='vacuum') + z_max = openmc.ZPlane(10.0, boundary_type='vacuum') + + c1 = openmc.Cell(fill=h2o, region=+x_min & -left & +y_min & -y_max & +z_min & -z_max) + c2 = openmc.Cell(fill=nickel, region=+left & -x_max & +y_min & -y_max & +z_min & -z_max) + c1.volume = 4000.0 + c2.volume = 4000.0 + geometry = openmc.Geometry([c1, c2]) + + # Simple settings with a point source + settings = openmc.Settings() + settings.batches = 10 + settings.particles = 1000 + settings.run_mode = 'fixed source' + settings.source = openmc.IndependentSource() + model = openmc.Model(geometry, settings=settings) + + mesh = openmc.RegularMesh() + mesh.lower_left = (-10.0, -10.0, -10.0) + mesh.upper_right = (10.0, 10.0, 10.0) + mesh.dimension = (1, 1, 1) + return model, (c1, c2), mesh + + +def test_r2s_mesh_expected_output(simple_model_and_mesh, tmp_path): + model, (c1, c2), mesh = simple_model_and_mesh + + # Use mesh-based domains + r2s = R2SManager(model, mesh) + + # Use custom reduced chain file for Ni + chain = Chain.from_xml(Path(__file__).parents[1] / "chain_ni.xml") + + # Run R2S calculation + outdir = r2s.run( + timesteps=[(1.0, 'd')], + source_rates=[1.0], + photon_time_indices=[1], + output_dir=tmp_path, + chain_file=chain, + ) + + # Check directories and files exist + nt = Path(outdir) / 'neutron_transport' + assert (nt / 'fluxes.npy').exists() + assert (nt / 'micros.h5').exists() + assert (nt / 'mesh_material_volumes.npz').exists() + act = Path(outdir) / 'activation' + assert (act / 'depletion_results.h5').exists() + pt = Path(outdir) / 'photon_transport' + assert (pt / 'tally_ids.json').exists() + assert (pt / 'time_1' / 'statepoint.10.h5').exists() + + # Basic results structure checks + assert len(r2s.results['fluxes']) == 2 + assert len(r2s.results['micros']) == 2 + assert len(r2s.results['mesh_material_volumes']) == 2 + assert len(r2s.results['activation_materials']) == 2 + assert len(r2s.results['depletion_results']) == 2 + + # Check activation materials + amats = r2s.results['activation_materials'] + assert all(m.depletable for m in amats) + # Volumes preserved + assert {m.volume for m in amats} == {c1.volume, c2.volume} + + # Check loading results + r2s_loaded = R2SManager(model, mesh) + r2s_loaded.load_results(outdir) + assert len(r2s_loaded.results['fluxes']) == 2 + assert len(r2s_loaded.results['micros']) == 2 + assert len(r2s_loaded.results['mesh_material_volumes']) == 2 + assert len(r2s_loaded.results['activation_materials']) == 2 + assert len(r2s_loaded.results['depletion_results']) == 2 + + +def test_r2s_cell_expected_output(simple_model_and_mesh, tmp_path): + model, (c1, c2), _ = simple_model_and_mesh + + # Use cell-based domains + r2s = R2SManager(model, [c1, c2]) + + # Use custom reduced chain file for Ni + chain = Chain.from_xml(Path(__file__).parents[1] / "chain_ni.xml") + + # Run R2S calculation + bounding_boxes = {c1.id: c1.bounding_box, c2.id: c2.bounding_box} + outdir = r2s.run( + timesteps=[(1.0, 'd')], + source_rates=[1.0], + photon_time_indices=[1], + output_dir=tmp_path, + bounding_boxes=bounding_boxes, + chain_file=chain + ) + + # Check directories and files exist + nt = Path(outdir) / 'neutron_transport' + assert (nt / 'fluxes.npy').exists() + assert (nt / 'micros.h5').exists() + act = Path(outdir) / 'activation' + assert (act / 'depletion_results.h5').exists() + pt = Path(outdir) / 'photon_transport' + assert (pt / 'tally_ids.json').exists() + assert (pt / 'time_1' / 'statepoint.10.h5').exists() + + # Basic results structure checks + assert len(r2s.results['fluxes']) == 2 + assert len(r2s.results['micros']) == 2 + assert len(r2s.results['activation_materials']) == 2 + assert len(r2s.results['depletion_results']) == 2 + + # Check activation materials + amats = r2s.results['activation_materials'] + assert all(m.depletable for m in amats) + # Names include cell IDs + assert any(f"Cell {c1.id}" in m.name for m in amats) + assert any(f"Cell {c2.id}" in m.name for m in amats) + # Volumes preserved + assert {m.volume for m in amats} == {c1.volume, c2.volume} + + # Check loading results + r2s_loaded = R2SManager(model, [c1, c2]) + r2s_loaded.load_results(outdir) + assert len(r2s_loaded.results['fluxes']) == 2 + assert len(r2s_loaded.results['micros']) == 2 + assert len(r2s_loaded.results['activation_materials']) == 2 + assert len(r2s_loaded.results['depletion_results']) == 2 diff --git a/tests/unit_tests/test_region.py b/tests/unit_tests/test_region.py index cbcd19831..cb9fa171b 100644 --- a/tests/unit_tests/test_region.py +++ b/tests/unit_tests/test_region.py @@ -248,6 +248,10 @@ def test_plot(): c_before = openmc.Cell() region.plot() + # Close plot to avoid warning + import matplotlib.pyplot as plt + plt.close() + # Ensure that calling plot doesn't affect cell ID space c_after = openmc.Cell() assert c_after.id - 1 == c_before.id diff --git a/tests/unit_tests/test_settings.py b/tests/unit_tests/test_settings.py index 397d70434..fe618fd2d 100644 --- a/tests/unit_tests/test_settings.py +++ b/tests/unit_tests/test_settings.py @@ -59,15 +59,28 @@ def test_export_to_xml(run_in_tmpdir): s.electron_treatment = 'led' s.write_initial_source = True s.weight_window_checkpoints = {'surface': True, 'collision': False} + source_region_mesh = openmc.RegularMesh() + source_region_mesh.dimension = [2, 2, 2] + source_region_mesh.lower_left = [-2, -2, -2] + source_region_mesh.upper_right = [2, 2, 2] + root_universe = openmc.Universe() s.random_ray = { 'distance_inactive': 10.0, 'distance_active': 100.0, 'ray_source': openmc.IndependentSource( space=openmc.stats.Box((-1., -1., -1.), (1., 1., 1.)) - ) + ), + 'source_region_meshes': [(source_region_mesh, [root_universe])], + 'volume_estimator': 'hybrid', + 'source_shape': 'linear', + 'volume_normalized_flux_tallies': True, + 'adjoint': False, + 'sample_method': 'halton' } - s.max_particle_events = 100 + s.max_secondaries = 1_000_000 + s.source_rejection_fraction = 0.01 + s.free_gas_threshold = 800.0 # Make sure exporting XML works s.export_to_xml() @@ -130,7 +143,7 @@ def test_export_to_xml(run_in_tmpdir): assert s.log_grid_bins == 2000 assert not s.photon_transport assert s.electron_treatment == 'led' - assert s.write_initial_source == True + assert s.write_initial_source assert len(s.volume_calculations) == 1 vol = s.volume_calculations[0] assert vol.domain_type == 'cell' @@ -144,3 +157,18 @@ def test_export_to_xml(run_in_tmpdir): assert s.random_ray['distance_active'] == 100.0 assert s.random_ray['ray_source'].space.lower_left == [-1., -1., -1.] assert s.random_ray['ray_source'].space.upper_right == [1., 1., 1.] + assert 'source_region_meshes' in s.random_ray + assert len(s.random_ray['source_region_meshes']) == 1 + mesh_and_domains = s.random_ray['source_region_meshes'][0] + recovered_mesh = mesh_and_domains[0] + assert recovered_mesh.dimension == (2, 2, 2) + assert recovered_mesh.lower_left == [-2., -2., -2.] + assert recovered_mesh.upper_right == [2., 2., 2.] + assert s.random_ray['volume_estimator'] == 'hybrid' + assert s.random_ray['source_shape'] == 'linear' + assert s.random_ray['volume_normalized_flux_tallies'] + assert not s.random_ray['adjoint'] + assert s.random_ray['sample_method'] == 'halton' + assert s.max_secondaries == 1_000_000 + assert s.source_rejection_fraction == 0.01 + assert s.free_gas_threshold == 800.0 diff --git a/tests/unit_tests/test_slice_voxel_plots.py b/tests/unit_tests/test_slice_voxel_plots.py new file mode 100644 index 000000000..48ca31b7a --- /dev/null +++ b/tests/unit_tests/test_slice_voxel_plots.py @@ -0,0 +1,273 @@ +"""Tests for SlicePlot and VoxelPlot classes + +This module tests the functionality of the new SlicePlot and VoxelPlot +classes that replace the legacy Plot class. +""" +import warnings + +import pytest +import openmc + + +def test_slice_plot_initialization(): + """Test SlicePlot initialization with defaults""" + plot = openmc.SlicePlot() + assert plot.width == [4.0, 4.0] + assert plot.pixels == [400, 400] + assert plot.basis == 'xy' + assert plot.origin == [0., 0., 0.] + + +def test_slice_plot_width_validation(): + """Test that SlicePlot only accepts 2 values for width""" + plot = openmc.SlicePlot() + + # Should accept 2 values + plot.width = [10.0, 20.0] + assert plot.width == [10.0, 20.0] + + # Should reject 1 value + with pytest.raises(ValueError, match='must be of length "2"'): + plot.width = [10.0] + + # Should reject 3 values + with pytest.raises(ValueError, match='must be of length "2"'): + plot.width = [10.0, 20.0, 30.0] + + +def test_slice_plot_pixels_validation(): + """Test that SlicePlot only accepts 2 values for pixels""" + plot = openmc.SlicePlot() + + # Should accept 2 values + plot.pixels = [100, 200] + assert plot.pixels == [100, 200] + + # Should reject 1 value + with pytest.raises(ValueError, match='must be of length "2"'): + plot.pixels = [100] + + # Should reject 3 values + with pytest.raises(ValueError, match='must be of length "2"'): + plot.pixels = [100, 200, 300] + + +def test_slice_plot_basis(): + """Test that SlicePlot has basis attribute""" + plot = openmc.SlicePlot() + + # Test all valid basis values + for basis in ['xy', 'xz', 'yz']: + plot.basis = basis + assert plot.basis == basis + + # Test invalid basis + with pytest.raises(ValueError): + plot.basis = 'invalid' + + +def test_slice_plot_meshlines(): + """Test that SlicePlot has meshlines attribute""" + plot = openmc.SlicePlot() + + meshlines = { + 'type': 'tally', + 'id': 1, + 'linewidth': 2, + 'color': (255, 0, 0) + } + plot.meshlines = meshlines + assert plot.meshlines == meshlines + + +def test_slice_plot_xml_roundtrip(): + """Test SlicePlot XML serialization and deserialization""" + plot = openmc.SlicePlot(name='test_slice') + plot.width = [15.0, 25.0] + plot.pixels = [150, 250] + plot.basis = 'xz' + plot.origin = [1.0, 2.0, 3.0] + plot.color_by = 'material' + plot.filename = 'test_plot' + + # Convert to XML and back + elem = plot.to_xml_element() + new_plot = openmc.SlicePlot.from_xml_element(elem) + + # Check all attributes preserved + assert new_plot.name == plot.name + assert new_plot.width == pytest.approx(plot.width) + assert new_plot.pixels == tuple(plot.pixels) + assert new_plot.basis == plot.basis + assert new_plot.origin == pytest.approx(plot.origin) + assert new_plot.color_by == plot.color_by + assert new_plot.filename == plot.filename + + +def test_slice_plot_from_geometry(): + """Test creating SlicePlot from geometry""" + # Create simple geometry + s = openmc.Sphere(r=10.0, boundary_type='vacuum') + c = openmc.Cell(region=-s) + univ = openmc.Universe(cells=[c]) + geom = openmc.Geometry(univ) + + # Test all basis options + for basis in ['xy', 'xz', 'yz']: + plot = openmc.SlicePlot.from_geometry(geom, basis=basis) + assert plot.basis == basis + assert plot.width == pytest.approx([20.0, 20.0]) + assert plot.origin == pytest.approx([0.0, 0.0, 0.0]) + + +def test_voxel_plot_initialization(): + """Test VoxelPlot initialization with defaults""" + plot = openmc.VoxelPlot() + assert plot.width == [4.0, 4.0, 4.0] + assert plot.pixels == [400, 400, 400] + assert plot.origin == [0., 0., 0.] + + +def test_voxel_plot_width_validation(): + """Test that VoxelPlot only accepts 3 values for width""" + plot = openmc.VoxelPlot() + + # Should accept 3 values + plot.width = [10.0, 20.0, 30.0] + assert plot.width == [10.0, 20.0, 30.0] + + # Should reject 2 values + with pytest.raises(ValueError, match='must be of length "3"'): + plot.width = [10.0, 20.0] + + # Should reject 1 value + with pytest.raises(ValueError, match='must be of length "3"'): + plot.width = [10.0] + + +def test_voxel_plot_pixels_validation(): + """Test that VoxelPlot only accepts 3 values for pixels""" + plot = openmc.VoxelPlot() + + # Should accept 3 values + plot.pixels = [100, 200, 300] + assert plot.pixels == [100, 200, 300] + + # Should reject 2 values + with pytest.raises(ValueError, match='must be of length "3"'): + plot.pixels = [100, 200] + + # Should reject 1 value + with pytest.raises(ValueError, match='must be of length "3"'): + plot.pixels = [100] + + +def test_voxel_plot_xml_roundtrip(): + """Test VoxelPlot XML serialization and deserialization""" + plot = openmc.VoxelPlot(name='test_voxel') + plot.width = [10.0, 20.0, 30.0] + plot.pixels = [100, 200, 300] + plot.origin = [1.0, 2.0, 3.0] + plot.color_by = 'cell' + plot.filename = 'voxel_plot' + + # Convert to XML and back + elem = plot.to_xml_element() + new_plot = openmc.VoxelPlot.from_xml_element(elem) + + # Check all attributes preserved + assert new_plot.name == plot.name + assert new_plot.width == pytest.approx(plot.width) + assert new_plot.pixels == tuple(plot.pixels) + assert new_plot.origin == pytest.approx(plot.origin) + assert new_plot.color_by == plot.color_by + assert new_plot.filename == plot.filename + + +def test_plot_deprecation_warning(): + """Test that Plot class raises deprecation warning""" + with warnings.catch_warnings(record=True) as w: + warnings.simplefilter("always") + openmc.Plot() + + assert len(w) == 1 + assert issubclass(w[0].category, FutureWarning) + assert "deprecated" in str(w[0].message).lower() + + +def test_plot_returns_slice_plot(): + """Test that Plot() returns a SlicePlot instance""" + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + plot = openmc.Plot() + + # Should be an actual SlicePlot instance + assert isinstance(plot, openmc.SlicePlot) + + +def test_plot_type_setter_raises_error(): + """Test that setting plot.type raises a helpful error""" + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + plot = openmc.Plot() + + with pytest.raises(TypeError, match="no longer supported"): + plot.type = 'voxel' + + with pytest.raises(TypeError, match="no longer supported"): + plot.type = 'slice' + + +def test_plot_type_getter_warns(): + """Test that getting plot.type raises a deprecation warning""" + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + plot = openmc.Plot() + + with warnings.catch_warnings(record=True) as w: + warnings.simplefilter("always") + plot_type = plot.type + + assert plot_type == 'slice' + assert len(w) == 1 + assert issubclass(w[0].category, FutureWarning) + assert "deprecated" in str(w[0].message).lower() + + +def test_plots_collection_mixed_types(): + """Test Plots collection with different plot types""" + slice_plot = openmc.SlicePlot(name='slice') + voxel_plot = openmc.VoxelPlot(name='voxel') + wireframe_plot = openmc.WireframeRayTracePlot(name='wireframe') + + plots = openmc.Plots([slice_plot, voxel_plot, wireframe_plot]) + + assert len(plots) == 3 + assert isinstance(plots[0], openmc.SlicePlot) + assert isinstance(plots[1], openmc.VoxelPlot) + assert isinstance(plots[2], openmc.WireframeRayTracePlot) + + +def test_plots_collection_xml_roundtrip(run_in_tmpdir): + """Test XML export and import with new plot types""" + s1 = openmc.SlicePlot(name='slice1') + s1.width = [10.0, 20.0] + s1.basis = 'xz' + + v1 = openmc.VoxelPlot(name='voxel1') + v1.width = [10.0, 20.0, 30.0] + + plots = openmc.Plots([s1, v1]) + plots.export_to_xml() + + # Read back + new_plots = openmc.Plots.from_xml() + + assert len(new_plots) == 2 + assert isinstance(new_plots[0], openmc.SlicePlot) + assert isinstance(new_plots[1], openmc.VoxelPlot) + assert new_plots[0].name == 'slice1' + assert new_plots[1].name == 'voxel1' + assert new_plots[0].basis == 'xz' + assert new_plots[0].width == pytest.approx([10.0, 20.0]) + assert new_plots[1].width == pytest.approx([10.0, 20.0, 30.0]) diff --git a/tests/unit_tests/test_source.py b/tests/unit_tests/test_source.py index c88fbcbe6..bb8a1b785 100644 --- a/tests/unit_tests/test_source.py +++ b/tests/unit_tests/test_source.py @@ -264,21 +264,36 @@ def test_constraints_file(sphere_box_model, run_in_tmpdir): @pytest.mark.skipif(config['mpi'], reason='Not compatible with MPI') -def test_rejection_limit(sphere_box_model, run_in_tmpdir): - model, cell1 = sphere_box_model[:2] +def test_rejection_fraction(run_in_tmpdir): + mat = openmc.Material() + mat.add_nuclide('H1', 1.0) + w = 0.25 + rpp1 = openmc.model.RectangularParallelepiped( + -w/2, w/2, -w/2, w/2, -w/2, w/2) + rpp2 = openmc.model.RectangularParallelepiped( + -0.5, 0.5, -0.5, 0.5, -0.5, 0.5, boundary_type='vacuum') + cell1 = openmc.Cell(fill=mat, region=-rpp1) + cell2 = openmc.Cell(region=+rpp1 & -rpp2) + model = openmc.Model() + model.geometry = openmc.Geometry([cell1, cell2]) - # Define a point source that will get rejected 100% of the time + # Create a box source over a 1 cm³ volume that is constrained to the source + # cell of volume (0.25 cm)³ = 0.0125 cm³, which means the default rejection + # fraction of 0.05 won't work + model.settings.particles = 1000 + model.settings.batches = 1 + model.settings.run_mode = 'fixed source' model.settings.source = openmc.IndependentSource( - space=openmc.stats.Point((-3., 0., 0.)), + space=openmc.stats.Box(*(-rpp2).bounding_box), constraints={'domains': [cell1]} ) - - # Confirm that OpenMC doesn't run in an infinite loop. Note that this may - # work when running with MPI since it won't necessarily capture the error - # message correctly - with pytest.raises(RuntimeError, match="rejected"): + with pytest.raises(RuntimeError, match='Too few source sites'): model.run(openmc_exec=config['exe']) + # With a source rejection fraction below 0.0125, the simulation should run + model.settings.source_rejection_fraction = 0.005 + model.run(openmc_exec=config['exe']) + def test_exceptions(): diff --git a/tests/unit_tests/test_source_biasing.py b/tests/unit_tests/test_source_biasing.py new file mode 100644 index 000000000..12588594c --- /dev/null +++ b/tests/unit_tests/test_source_biasing.py @@ -0,0 +1,276 @@ +"""Tests for source biasing using C++ sampling routines via openmc.lib + +This test module validates that the C++ distribution sampling implementations +correctly handle both unbiased and biased sampling when used in source +definitions. Each test: + +1. Creates a minimal model with a source using a specific energy distribution +2. Uses model.sample_external_source() to generate samples via openmc.lib +3. Extracts energies from the returned particle list +4. Validates that: + - Unbiased sampling produces the expected mean + - Biased sampling with importance weighting produces the expected mean + - Weights are correctly applied (non-unity for biased case) + +These tests complement the Python-level tests in test_stats.py by exercising +the full C++ sampling codepath that is used during actual simulations. +""" + +import numpy as np +import pytest +import openmc + +from tests.unit_tests import assert_sample_mean + + +@pytest.fixture +def model(): + """Create a minimal model for source sampling tests.""" + sphere = openmc.Sphere(r=100.0, boundary_type='vacuum') + cell = openmc.Cell(region=-sphere) + geometry = openmc.Geometry([cell]) + settings = openmc.Settings(particles=100, batches=1) + space = openmc.stats.Point() + angle = openmc.stats.Monodirectional((1.0, 0.0, 0.0)) + settings.source = openmc.IndependentSource(space=space, angle=angle) + return openmc.Model(geometry=geometry, settings=settings) + + +@pytest.mark.flaky(reruns=1) +def test_discrete(run_in_tmpdir, model): + """Test Discrete distribution sampling via C++ routines.""" + vals = np.array([1.0, 2.0, 3.0]) + probs = np.array([0.1, 0.7, 0.2]) + exp_mean = (vals * probs).sum() + + # Create source with discrete energy distribution + model.settings.source[0].energy = energy_dist = openmc.stats.Discrete(vals, probs) + + # Sample using C++ routines and extract energies + n_samples = 10_000 + particles = model.sample_external_source(n_samples) + energies = np.array([p.E for p in particles]) + + # Check unbiased mean + assert_sample_mean(energies, exp_mean) + + # Sample from biased distribution + energy_dist.bias = np.array([0.2, 0.1, 0.7]) + particles = model.sample_external_source(n_samples) + energies = np.array([p.E for p in particles]) + weights = np.array([p.wgt for p in particles]) + + # Check biased weighted mean + weighted_energies = energies * weights + assert_sample_mean(weighted_energies, exp_mean) + assert np.any(weights != 1.0) + + +@pytest.mark.flaky(reruns=1) +def test_uniform(run_in_tmpdir, model): + """Test Uniform distribution sampling via C++ routines.""" + a, b = 5.0, 10.0 + exp_mean = 0.5 * (a + b) + + # Create source with uniform energy distribution + model.settings.source[0].energy = energy_dist = openmc.stats.Uniform(a, b) + + # Sample using C++ routines and extract energies + n_samples = 10_000 + particles = model.sample_external_source(n_samples) + energies = np.array([p.E for p in particles]) + + # Check unbiased mean + assert_sample_mean(energies, exp_mean) + + # Sample from biased distribution + energy_dist.bias = openmc.stats.PowerLaw(a, b, 2) + particles = model.sample_external_source(n_samples) + energies = np.array([p.E for p in particles]) + weights = np.array([p.wgt for p in particles]) + + # Check biased weighted mean + weighted_energies = energies * weights + assert_sample_mean(weighted_energies, exp_mean) + assert np.any(weights != 1.0) + + +@pytest.mark.flaky(reruns=1) +def test_powerlaw(run_in_tmpdir, model): + """Test PowerLaw distribution sampling via C++ routines.""" + a, b, n = 1.0, 20.0, 2.0 + + # Determine mean of distribution + exp_mean = (n+1)*(b**(n+2) - a**(n+2))/((n+2)*(b**(n+1) - a**(n+1))) + + # Create source with powerlaw energy distribution + model.settings.source[0].energy = energy_dist = openmc.stats.PowerLaw(a, b, n) + + # Sample using C++ routines and extract energies + n_samples = 10_000 + particles = model.sample_external_source(n_samples) + energies = np.array([p.E for p in particles]) + + # Check unbiased mean + assert_sample_mean(energies, exp_mean) + + # Sample from biased distribution + energy_dist.bias = openmc.stats.Uniform(a, b) + particles = model.sample_external_source(n_samples) + energies = np.array([p.E for p in particles]) + weights = np.array([p.wgt for p in particles]) + + # Check biased weighted mean + weighted_energies = energies * weights + assert_sample_mean(weighted_energies, exp_mean) + assert np.any(weights != 1.0) + + +@pytest.mark.flaky(reruns=1) +def test_maxwell(run_in_tmpdir, model): + """Test Maxwell distribution sampling via C++ routines.""" + theta = 1.2895e6 + exp_mean = 3/2 * theta + + # Create source with Maxwell energy distribution + model.settings.source[0].energy = energy_dist = openmc.stats.Maxwell(theta) + + # Sample using C++ routines and extract energies + n_samples = 10_000 + particles = model.sample_external_source(n_samples) + energies = np.array([p.E for p in particles]) + + # Check unbiased mean + assert_sample_mean(energies, exp_mean) + + # Sample from biased distribution + energy_dist.bias = openmc.stats.Maxwell(theta * 1.1) + particles = model.sample_external_source(n_samples) + energies = np.array([p.E for p in particles]) + weights = np.array([p.wgt for p in particles]) + + # Check biased weighted mean + weighted_energies = energies * weights + assert_sample_mean(weighted_energies, exp_mean) + assert np.any(weights != 1.0) + + +@pytest.mark.flaky(reruns=1) +def test_watt(run_in_tmpdir, model): + """Test Watt distribution sampling via C++ routines.""" + a, b = 0.965e6, 2.29e-6 + exp_mean = 3/2 * a + a**2 * b / 4 + + # Create source with Watt energy distribution + model.settings.source[0].energy = energy_dist = openmc.stats.Watt(a, b) + + # Sample using C++ routines and extract energies + n_samples = 10_000 + particles = model.sample_external_source(n_samples) + energies = np.array([p.E for p in particles]) + + # Check unbiased mean + assert_sample_mean(energies, exp_mean) + + # Sample from biased distribution + energy_dist.bias = openmc.stats.Watt(a*1.05, b) + particles = model.sample_external_source(n_samples) + energies = np.array([p.E for p in particles]) + weights = np.array([p.wgt for p in particles]) + + # Check biased weighted mean + weighted_energies = energies * weights + assert_sample_mean(weighted_energies, exp_mean) + assert np.any(weights != 1.0) + + +@pytest.mark.flaky(reruns=1) +def test_tabular(run_in_tmpdir, model): + """Test Tabular distribution sampling via C++ routines.""" + # Test linear-linear sampling + x = np.array([0.0, 5.0, 7.0, 10.0]) + p = np.array([10.0, 20.0, 5.0, 6.0]) + + # Create tabular distribution and normalize to get expected mean + model.settings.source[0].energy = energy_dist = openmc.stats.Tabular(x, p, 'linear-linear') + energy_dist.normalize() + exp_mean = energy_dist.mean() + + # Sample using C++ routines and extract energies + n_samples = 10_000 + particles = model.sample_external_source(n_samples) + energies = np.array([p.E for p in particles]) + + # Check unbiased mean + assert_sample_mean(energies, exp_mean) + + # Sample from biased distribution + energy_dist.bias = openmc.stats.Uniform(x[0], x[-1]) + particles = model.sample_external_source(n_samples) + energies = np.array([p.E for p in particles]) + weights = np.array([p.wgt for p in particles]) + + # Check biased weighted mean + weighted_energies = energies * weights + assert_sample_mean(weighted_energies, exp_mean) + assert np.any(weights != 1.0) + + +@pytest.mark.flaky(reruns=1) +def test_mixture(run_in_tmpdir, model): + """Test Mixture distribution sampling via C++ routines.""" + d1 = openmc.stats.Uniform(0, 5) + d2 = openmc.stats.Uniform(3, 7) + p = [0.5, 0.5] + + # Create mixture energy distribution + model.settings.source[0].energy = energy_dist = openmc.stats.Mixture(p, [d1, d2]) + exp_mean = (2.5 + 5.0) / 2 + + # Sample using C++ routines and extract energies + n_samples = 10_000 + particles = model.sample_external_source(n_samples) + energies = np.array([p.E for p in particles]) + + # Check unbiased mean + assert_sample_mean(energies, exp_mean) + + # Sample using biased sub-distribution + energy_dist.distribution[0].bias = openmc.stats.PowerLaw(0, 5, 2) + particles = model.sample_external_source(n_samples) + energies = np.array([p.E for p in particles]) + weights = np.array([p.wgt for p in particles]) + + # Check biased weighted mean + weighted_energies = energies * weights + assert_sample_mean(weighted_energies, exp_mean) + assert np.any(weights != 1.0) + + +@pytest.mark.flaky(reruns=1) +def test_normal(run_in_tmpdir, model): + """Test Normal distribution sampling via C++ routines.""" + mean_val = 25.0 + std_dev = 2.0 + + # Create source with normal energy distribution + model.settings.source[0].energy = energy_dist = openmc.stats.Normal(mean_val, std_dev) + + # Sample using C++ routines and extract energies + n_samples = 10_000 + particles = model.sample_external_source(n_samples) + energies = np.array([p.E for p in particles]) + + # Check unbiased mean + assert_sample_mean(energies, mean_val) + + # Sample from biased distribution + energy_dist.bias = openmc.stats.Normal(mean_val * 1.1, std_dev) + particles = model.sample_external_source(n_samples) + energies = np.array([p.E for p in particles]) + weights = np.array([p.wgt for p in particles]) + + # Check biased weighted mean + weighted_energies = energies * weights + assert_sample_mean(weighted_energies, mean_val) + assert np.any(weights != 1.0) diff --git a/tests/unit_tests/test_source_mesh.py b/tests/unit_tests/test_source_mesh.py index 43bb1678c..2550cb87e 100644 --- a/tests/unit_tests/test_source_mesh.py +++ b/tests/unit_tests/test_source_mesh.py @@ -1,5 +1,7 @@ from itertools import product from pathlib import Path +from math import sqrt +import random import pytest import numpy as np @@ -334,13 +336,10 @@ def test_umesh_source_independent(run_in_tmpdir, request, void_model, library): n_elements = 12_000 model.settings.source = openmc.MeshSource(uscd_mesh, n_elements*[ind_source]) model.export_to_model_xml() - try: - openmc.lib.init() + with openmc.lib.run_in_memory(): openmc.lib.simulation_init() sites = openmc.lib.sample_external_source(10) openmc.lib.statepoint_write('statepoint.h5') - finally: - openmc.lib.finalize() with openmc.StatePoint('statepoint.h5') as sp: uscd_mesh = sp.meshes[uscd_mesh.id] @@ -351,32 +350,86 @@ def test_umesh_source_independent(run_in_tmpdir, request, void_model, library): assert site.r in bounding_box -def test_mesh_source_file(run_in_tmpdir): - # Creating a source file with a single particle - source_particle = openmc.SourceParticle(time=10.0) - openmc.write_source_file([source_particle], 'source.h5') - file_source = openmc.FileSource('source.h5') +def test_mesh_source_constraints(run_in_tmpdir): + """Test application of constraints to underlying mesh element sources""" + # Create simple model with two cells + m1 = openmc.Material() + m1.add_nuclide('H1', 1.0) + m2 = m1.clone() + sph = openmc.Sphere(r=100, boundary_type='vacuum') + box1 = openmc.model.RectangularParallelepiped(-1, 0, -1, 1, -1, 1) + box2 = openmc.model.RectangularParallelepiped(0, 2, -1, 1, -1, 1) + cell1 = openmc.Cell(fill=m1, region=-box1) + cell2 = openmc.Cell(fill=m2, region=-box2) + outer = openmc.Cell(region=-sph & (+box1 | +box2)) + model = openmc.Model() + model.geometry = openmc.Geometry([cell1, cell2, outer]) + + # Define a mesh covering the two cells: the first mesh element contains + # cell1 (-1 < x < 0) and the second element contains cells2 (0 < x < 2) + mesh = openmc.RegularMesh() + mesh.lower_left = (-3., -1., -1.) + mesh.upper_right = (3., 1., 1.) + mesh.dimension = (2, 1, 1) + + # Define a mesh source with a randomly chosen probability + p = random.random() + src1 = openmc.IndependentSource(strength=p, constraints={'domains': [cell1]}) + src2 = openmc.IndependentSource(strength=1 - p, constraints={'domains': [cell2]}) + model.settings.source = openmc.MeshSource(mesh, [src1, src2]) + + # Finish settings and export + model.settings.particles = 100 + model.settings.batches = 1 + model.export_to_model_xml() + + with openmc.lib.run_in_memory(): + # Sample sites from the source + sites = openmc.lib.sample_external_source(N := 1000) + + # Check that all sites are either in cell1 or cell2 + xs = np.array([s.r[0] for s in sites]) + assert (xs >= -1.0).all() + assert (xs <= 2.0).all() + + # Check that the correct percentage of the sites are in cell1 + sigma = sqrt(p*(1- p)/N) + frac = xs[(-1.0 <= xs) & (xs <= 0.0)].size / N + assert frac == pytest.approx(p, abs=5*sigma) + + +@pytest.mark.parametrize("mesh_type", ('rectangular', 'cylindrical', 'spherical')) +def test_mesh_spatial(run_in_tmpdir, mesh_type): + """Test that a spherical mesh source works as expected.""" model = openmc.Model() - rect_prism = openmc.model.RectangularParallelepiped( - -5.0, 5.0, -5.0, 5.0, -5.0, 5.0, boundary_type='vacuum') - + # Set up geometry, a box that is shifted in x, y, and z + box = openmc.model.RectangularParallelepiped(5.0, 25.0, -20.0, 20.0, -30.0, 30.0, boundary_type='vacuum') mat = openmc.Material() mat.add_nuclide('H1', 1.0) + model.geometry = openmc.Geometry([openmc.Cell(fill=mat, region=-box)]) - model.geometry = openmc.Geometry([openmc.Cell(fill=mat, region=-rect_prism)]) - model.settings.particles = 1000 + # Create a mesh of each type in turn + if mesh_type == 'rectangular': + mesh = openmc.RegularMesh.from_domain(model.geometry, (10, 2, 2)) + elif mesh_type == 'cylindrical': + mesh = openmc.CylindricalMesh.from_domain(model.geometry, (10, 2, 2)) + assert max(mesh.r_grid) == 10.0, "Cylindrical mesh radius exceeds geometry bounds" + assert mesh.origin[0] == 15.0, "Cylindrical mesh origin x-coordinate is incorrect" + elif mesh_type == 'spherical': + mesh = openmc.SphericalMesh.from_domain(model.geometry, (10, 2, 2)) + assert max(mesh.r_grid) == 10.0, "Spherical mesh radius exceeds geometry bounds" + assert mesh.origin[0] == 15.0, "Spherical mesh origin x-coordinate is incorrect" + + # Create a mesh source with a single particle + ind_source = openmc.IndependentSource(space=openmc.stats.MeshSpatial(mesh, np.prod(mesh.dimension)*[1.0])) + model.settings.source = ind_source + + model.settings.particles = 100 model.settings.batches = 10 model.settings.run_mode = 'fixed source' - mesh = openmc.RegularMesh() - mesh.lower_left = (-1, -2, -3) - mesh.upper_right = (2, 3, 4) - mesh.dimension = (1, 1, 1) - - model.settings.source = openmc.MeshSource(mesh, [file_source]) - model.export_to_model_xml() openmc.lib.init() @@ -385,14 +438,7 @@ def test_mesh_source_file(run_in_tmpdir): openmc.lib.simulation_finalize() openmc.lib.finalize() - # The mesh bounds do not contain the point of the lone source site in the - # file source, so it should not appear in the set of source sites produced - # from the mesh source. Additionally, the source should be located within - # the mesh + # Check that the sites are within the spherical mesh bounds bbox = mesh.bounding_box for site in sites: - assert site.r != (0, 0, 0) - assert site.E == source_particle.E - assert site.u == source_particle.u - assert site.time == source_particle.time assert site.r in bbox diff --git a/tests/unit_tests/test_spherical_mesh.py b/tests/unit_tests/test_spherical_mesh.py index 0b579be35..a95a4151a 100644 --- a/tests/unit_tests/test_spherical_mesh.py +++ b/tests/unit_tests/test_spherical_mesh.py @@ -63,8 +63,6 @@ def test_origin_read_write_to_xml(run_in_tmpdir, model): np.testing.assert_equal(new_mesh.origin, mesh.origin) estimators = ('tracklength', 'collision') -# TODO: determine why this is needed for spherical mesh -# but not cylindrical mesh offset = geom_size + 0.001 origins = set(permutations((-offset, 0, 0))) diff --git a/tests/unit_tests/test_statepoint.py b/tests/unit_tests/test_statepoint.py new file mode 100644 index 000000000..7ffaf7ec2 --- /dev/null +++ b/tests/unit_tests/test_statepoint.py @@ -0,0 +1,65 @@ +import openmc + + +def test_get_tally_filter_type(run_in_tmpdir): + """Test various ways of retrieving tallies from a StatePoint object.""" + + mat = openmc.Material() + mat.add_nuclide("H1", 1.0) + mat.set_density("g/cm3", 10.0) + + sphere = openmc.Sphere(r=10.0, boundary_type="vacuum") + cell = openmc.Cell(fill=mat, region=-sphere) + geometry = openmc.Geometry([cell]) + + settings = openmc.Settings() + settings.particles = 10 + settings.batches = 2 + settings.run_mode = "fixed source" + + reg_mesh = openmc.RegularMesh().from_domain(cell) + tally1 = openmc.Tally(tally_id=1) + mesh_filter = openmc.MeshFilter(reg_mesh) + tally1.filters = [mesh_filter] + tally1.scores = ["flux"] + + tally2 = openmc.Tally(tally_id=2, name="heating tally") + cell_filter = openmc.CellFilter(cell) + tally2.filters = [cell_filter] + tally2.scores = ["heating"] + + tallies = openmc.Tallies([tally1, tally2]) + model = openmc.Model( + geometry=geometry, materials=[mat], settings=settings, tallies=tallies + ) + + sp_filename = model.run() + + sp = openmc.StatePoint(sp_filename) + + tally_found = sp.get_tally(filter_type=openmc.MeshFilter) + assert tally_found.id == 1 + + tally_found = sp.get_tally(filter_type=openmc.CellFilter) + assert tally_found.id == 2 + + tally_found = sp.get_tally(filters=[mesh_filter]) + assert tally_found.id == 1 + + tally_found = sp.get_tally(filters=[cell_filter]) + assert tally_found.id == 2 + + tally_found = sp.get_tally(scores=["heating"]) + assert tally_found.id == 2 + + tally_found = sp.get_tally(name="heating tally") + assert tally_found.id == 2 + + tally_found = sp.get_tally(name=None) + assert tally_found.id == 1 + + tally_found = sp.get_tally(id=1) + assert tally_found.id == 1 + + tally_found = sp.get_tally(id=2) + assert tally_found.id == 2 diff --git a/tests/unit_tests/test_statepoint_batches.py b/tests/unit_tests/test_statepoint_batches.py new file mode 100644 index 000000000..bf54e1878 --- /dev/null +++ b/tests/unit_tests/test_statepoint_batches.py @@ -0,0 +1,26 @@ +from pathlib import Path + +import openmc + + +def test_statepoint_batches(run_in_tmpdir): + # Create a minimal model + mat = openmc.Material() + mat.add_nuclide('U235', 1.0) + mat.set_density('g/cm3', 4.5) + sphere = openmc.Sphere(r=10.0, boundary_type='vacuum') + cell = openmc.Cell(fill=mat, region=-sphere) + model = openmc.Model() + model.geometry = openmc.Geometry([cell]) + model.settings.batches = 10 + model.settings.inactive = 5 + model.settings.particles = 100 + + # Specify when statepoints should be written + model.settings.statepoint = {'batches': [3, 6, 9]} + + # Run model and ensure that statepoints are created + model.run() + sp_files = ['statepoint.03.h5', 'statepoint.06.h5', 'statepoint.09.h5'] + for f in sp_files: + assert Path(f).is_file() diff --git a/tests/unit_tests/test_stats.py b/tests/unit_tests/test_stats.py index 386181f34..e92e9e135 100644 --- a/tests/unit_tests/test_stats.py +++ b/tests/unit_tests/test_stats.py @@ -6,16 +6,10 @@ import openmc import openmc.stats from scipy.integrate import trapezoid - -def assert_sample_mean(samples, expected_mean): - # Calculate sample standard deviation - std_dev = samples.std() / np.sqrt(samples.size - 1) - - # Means should agree within 4 sigma 99.993% of the time. Note that this is - # expected to fail about 1 out of 16,000 times - assert np.abs(expected_mean - samples.mean()) < 4*std_dev +from tests.unit_tests import assert_sample_mean +@pytest.mark.flaky(reruns=1) def test_discrete(): x = [0.0, 1.0, 10.0] p = [0.3, 0.2, 0.5] @@ -46,8 +40,19 @@ def test_discrete(): # sample discrete distribution and check that the mean of the samples is # within 4 std. dev. of the expected mean n_samples = 1_000_000 - samples = d3.sample(n_samples) + samples, weights = d3.sample(n_samples) assert_sample_mean(samples, exp_mean) + assert np.all(weights == 1.0) + + # Test biased distribution + d3.bias = np.array([0.2, 0.1, 0.7]) + bias_elem = d3.to_xml_element('distribution') + d4 = openmc.stats.Univariate.from_xml_element(bias_elem) + np.testing.assert_array_equal(d4.bias, [0.2, 0.1, 0.7]) + samples, weights = d4.sample(n_samples) + weighted_sample = samples * weights + assert_sample_mean(weighted_sample, exp_mean) + assert np.all(weights != 1.0) def test_delta_function(): @@ -82,6 +87,28 @@ def test_merge_discrete(): assert triple.integral() == pytest.approx(6.0) +def test_merge_discrete_with_bias(): + # Two discrete distributions with different biases + d1 = openmc.stats.Discrete([1.0, 2.0], [0.5, 0.5]) + d2 = openmc.stats.Discrete([2.0, 3.0], [0.3, 0.7], bias=[0.1, 0.9]) + + merged = openmc.stats.Discrete.merge([d1, d2], [0.6, 0.4]) + exp_mean = 0.6 * d1.mean() + 0.4 * d2.mean() + + # Verify merged distribution has correct x values + assert set(merged.x) == {1.0, 2.0, 3.0} + + # Bias should not be changed in original distributions + assert d1.bias is None + assert np.all(d2.bias == [0.1, 0.9]) + + # Sample and verify bias is applied correctly + samples, weights = merged.sample(10_000) + + # Verify weighted mean matches expected unbiased mean + assert_sample_mean(samples*weights, exp_mean) + + def test_clip_discrete(): # Create discrete distribution with two points that are not important, one # because the x value is very small, and one because the p value is very @@ -104,6 +131,7 @@ def test_clip_discrete(): d.clip(5) +@pytest.mark.flaky(reruns=1) def test_uniform(): a, b = 10.0, 20.0 d = openmc.stats.Uniform(a, b) @@ -123,10 +151,22 @@ def test_uniform(): # std. dev. of the expected mean exp_mean = 0.5 * (a + b) n_samples = 1_000_000 - samples = d.sample(n_samples) + samples, weights = d.sample(n_samples) assert_sample_mean(samples, exp_mean) + assert np.all(weights == 1.0) + + # Test biased distribution + d.bias = openmc.stats.PowerLaw(a, b, 2) + bias_elem = d.to_xml_element('distribution') + d2 = openmc.stats.Univariate.from_xml_element(bias_elem) + assert isinstance (d2.bias, openmc.stats.PowerLaw) + samples, weights = d2.sample(n_samples) + weighted_sample = samples * weights + assert_sample_mean(weighted_sample, exp_mean) + assert np.all(weights != 1.0) +@pytest.mark.flaky(reruns=1) def test_powerlaw(): a, b, n = 10.0, 100.0, 2.0 d = openmc.stats.PowerLaw(a, b, n) @@ -144,10 +184,22 @@ def test_powerlaw(): # sample power law distribution and check that the mean of the samples is # within 4 std. dev. of the expected mean n_samples = 1_000_000 - samples = d.sample(n_samples) + samples, weights = d.sample(n_samples) assert_sample_mean(samples, exp_mean) + assert np.all(weights == 1.0) + + # Test biased distribution + d.bias = openmc.stats.Uniform(a, b) + bias_elem = d.to_xml_element('distribution') + d2 = openmc.stats.Univariate.from_xml_element(bias_elem) + assert isinstance (d2.bias, openmc.stats.Uniform) + samples, weights = d2.sample(n_samples) + weighted_sample = samples * weights + assert_sample_mean(weighted_sample, exp_mean) + assert np.all(weights != 1.0) +@pytest.mark.flaky(reruns=1) def test_maxwell(): theta = 1.2895e6 d = openmc.stats.Maxwell(theta) @@ -162,15 +214,28 @@ def test_maxwell(): # sample maxwell distribution and check that the mean of the samples is # within 4 std. dev. of the expected mean n_samples = 1_000_000 - samples = d.sample(n_samples) + samples, weights = d.sample(n_samples) assert_sample_mean(samples, exp_mean) + assert np.all(weights == 1.0) # A second sample starting from a different seed - samples_2 = d.sample(n_samples) + samples_2, weights_2 = d.sample(n_samples) assert_sample_mean(samples_2, exp_mean) assert samples_2.mean() != samples.mean() + assert np.all(weights_2 == 1) + + # Test biased distribution + d.bias = openmc.stats.Maxwell((theta * 1.1)) + bias_elem = d.to_xml_element('distribution') + d2 = openmc.stats.Univariate.from_xml_element(bias_elem) + assert isinstance (d2.bias, openmc.stats.Maxwell) + samples, weights = d2.sample(n_samples) + weighted_sample = samples * weights + assert_sample_mean(weighted_sample, exp_mean) + assert np.all(weights != 1.0) +@pytest.mark.flaky(reruns=1) def test_watt(): a, b = 0.965e6, 2.29e-6 d = openmc.stats.Watt(a, b) @@ -190,18 +255,31 @@ def test_watt(): # sample Watt distribution and check that the mean of the samples is within # 4 std. dev. of the expected mean n_samples = 1_000_000 - samples = d.sample(n_samples) + samples, weights = d.sample(n_samples) assert_sample_mean(samples, exp_mean) + assert np.all(weights == 1.0) + + # Test biased distribution with 5 percent higher T_e + d.bias = openmc.stats.Watt(a*1.05, b) + bias_elem = d.to_xml_element('distribution') + d2 = openmc.stats.Univariate.from_xml_element(bias_elem) + assert isinstance (d2.bias, openmc.stats.Watt) + samples, weights = d2.sample(n_samples) + weighted_sample = samples * weights + assert_sample_mean(weighted_sample, exp_mean) + assert np.all(weights != 1.0) +@pytest.mark.flaky(reruns=1) def test_tabular(): # test linear-linear sampling x = np.array([0.0, 5.0, 7.0, 10.0]) p = np.array([10.0, 20.0, 5.0, 6.0]) d = openmc.stats.Tabular(x, p, 'linear-linear') n_samples = 100_000 - samples = d.sample(n_samples) + samples, weights = d.sample(n_samples) assert_sample_mean(samples, d.mean()) + assert np.all(weights == 1.0) # test linear-linear normalization d.normalize() @@ -209,8 +287,9 @@ def test_tabular(): # test histogram sampling d = openmc.stats.Tabular(x, p, interpolation='histogram') - samples = d.sample(n_samples) + samples, weights = d.sample(n_samples) assert_sample_mean(samples, d.mean()) + assert np.all(weights == 1.0) d.normalize() assert d.integral() == pytest.approx(1.0) @@ -220,7 +299,7 @@ def test_tabular(): d = openmc.stats.Tabular(x, p[:-1], interpolation='histogram') d.cdf() d.mean() - assert_sample_mean(d.sample(n_samples), d.mean()) + assert_sample_mean(d.sample(n_samples)[0], d.mean()) # passing a shorter probability set should raise an error for linear-linear with pytest.raises(ValueError): @@ -232,6 +311,16 @@ def test_tabular(): d = openmc.stats.Tabular(x, p, interpolation='linear-linear') d.cdf() + # Test biased distribution + d.bias = openmc.stats.Uniform(x[0], x[-1]) + bias_elem = d.to_xml_element('distribution') + d2 = openmc.stats.Univariate.from_xml_element(bias_elem) + assert isinstance (d2.bias, openmc.stats.Uniform) + samples, weights = d2.sample(n_samples) + weighted_sample = samples * weights + assert_sample_mean(weighted_sample, d2.mean()) + assert np.all(weights != 1.0) + def test_tabular_from_xml(): x = np.array([0.0, 5.0, 7.0, 10.0]) @@ -270,6 +359,7 @@ def test_legendre(): d.to_xml_element('distribution') +@pytest.mark.flaky(reruns=1) def test_mixture(): d1 = openmc.stats.Uniform(0, 5) d2 = openmc.stats.Uniform(3, 7) @@ -281,8 +371,9 @@ def test_mixture(): # Sample and make sure sample mean is close to expected mean n_samples = 1_000_000 - samples = mix.sample(n_samples) + samples, weights = mix.sample(n_samples) assert_sample_mean(samples, (2.5 + 5.0)/2) + assert np.all(weights == 1.0) elem = mix.to_xml_element('distribution') @@ -291,6 +382,26 @@ def test_mixture(): assert d.distribution == [d1, d2] assert len(d) == 4 + # Test biased sub-distribution + d.distribution[0].bias = openmc.stats.PowerLaw(0, 5, 2) + bias_elem = d.to_xml_element('distribution') + d3 = openmc.stats.Univariate.from_xml_element(bias_elem) + assert isinstance (d3.distribution[0].bias, openmc.stats.PowerLaw) + samples, weights = d3.sample(n_samples) + weighted_sample = samples * weights + assert_sample_mean(weighted_sample, (2.5 + 5.0)/2) + + # Test biased meta-probability + d.distribution[0].bias = None + d.bias = [0.25, 0.75] + bias_elem_2 = d.to_xml_element('distribution') + d4 = openmc.stats.Univariate.from_xml_element(bias_elem_2) + assert isinstance (d4.bias, np.ndarray) + samples, weights = d4.sample(n_samples) + weighted_sample = samples * weights + assert_sample_mean(weighted_sample, (2.5 + 5.0)/2) + assert np.all(weights != 1.0) + def test_mixture_clip(): # Create mixture distribution containing a discrete distribution with two @@ -323,6 +434,13 @@ def test_mixture_clip(): with pytest.warns(UserWarning): mix_clip = mix.clip(1e-6) + # Make sure warning is raised if a biased Discrete is clipped + d3 = openmc.stats.Discrete([1.0, 1.001], [1.0, 0.7e-8]) + d3.bias = [0.9, 0.1] + mix = openmc.stats.Mixture([1.0, 1.0], [d3, d2]) + with pytest.raises(RuntimeError): + mix_clip = mix.clip(1e-6) + def test_polar_azimuthal(): # default polar-azimuthal should be uniform in mu and phi @@ -358,12 +476,17 @@ def test_polar_azimuthal(): def test_isotropic(): d = openmc.stats.Isotropic() + mu = openmc.stats.Uniform(-1.0, 1.0) + phi = openmc.stats.PowerLaw(0., 2*np.pi, 2) + d2 = openmc.stats.PolarAzimuthal(mu, phi) + d.bias = d2 elem = d.to_xml_element() assert elem.tag == 'angle' assert elem.attrib['type'] == 'isotropic' d = openmc.stats.Isotropic.from_xml_element(elem) assert isinstance(d, openmc.stats.Isotropic) + assert isinstance(d.bias, openmc.stats.PolarAzimuthal) def test_monodirectional(): @@ -380,6 +503,7 @@ def test_cartesian(): x = openmc.stats.Uniform(-10., 10.) y = openmc.stats.Uniform(-10., 10.) z = openmc.stats.Uniform(0., 20.) + z.bias = openmc.stats.PowerLaw(0., 20., 3) d = openmc.stats.CartesianIndependent(x, y, z) elem = d.to_xml_element() @@ -395,6 +519,7 @@ def test_cartesian(): d = openmc.stats.Spatial.from_xml_element(elem) assert isinstance(d, openmc.stats.CartesianIndependent) + assert isinstance (d.z.bias, openmc.stats.PowerLaw) def test_box(): @@ -425,6 +550,7 @@ def test_point(): assert d.xyz == pytest.approx(p) +@pytest.mark.flaky(reruns=1) def test_normal(): mean = 10.0 std_dev = 2.0 @@ -440,10 +566,22 @@ def test_normal(): # sample normal distribution n_samples = 100_000 - samples = d.sample(n_samples) + samples, weights = d.sample(n_samples) assert_sample_mean(samples, mean) + assert np.all(weights == 1.0) + + # Test biased distribution + d.bias = openmc.stats.Normal(10.0, 4.0) + bias_elem = d.to_xml_element('distribution') + d2 = openmc.stats.Univariate.from_xml_element(bias_elem) + assert isinstance (d2.bias, openmc.stats.Normal) + samples, weights = d2.sample(n_samples) + weighted_sample = samples * weights + assert_sample_mean(weighted_sample, mean) + assert np.all(weights != 1.0) +@pytest.mark.flaky(reruns=1) def test_muir(): mean = 10.0 mass = 5.0 @@ -459,10 +597,12 @@ def test_muir(): # sample muir distribution n_samples = 100_000 - samples = d.sample(n_samples) + samples, weights = d.sample(n_samples) assert_sample_mean(samples, mean) + assert np.all(weights == 1.0) +@pytest.mark.flaky(reruns=1) def test_combine_distributions(): # Combine two discrete (same data as in test_merge_discrete) x1 = [0.0, 1.0, 10.0] @@ -504,5 +644,54 @@ def test_combine_distributions(): # Sample the combined distribution and make sure the sample mean is within # uncertainty of the expected value - samples = combined.sample(10_000) + samples, weights = combined.sample(10_000) assert_sample_mean(samples, 0.25) + assert np.all(weights == 1.0) + + # If biased/unbiased Discrete distributions are combined, unbiased probability + # should be conserved and points from both original distributions should be + # assigned bias probabilities. + x1 = [0.0, 1.0, 10.0] + p1 = [0.3, 0.2, 0.5] + b1 = [0.2, 0.5, 0.3] + d1 = openmc.stats.Discrete(x1, p1, b1) + x2 = [0.5, 1.0, 5.0] + p2 = [0.4, 0.5, 0.1] + d2 = openmc.stats.Discrete(x2, p2) + combined = openmc.stats.combine_distributions([d1, d2, t1], [0.25, 0.25, 0.5]) + + p3 = [0.075, 0.1, 0.175, 0.025, 0.125] + b3 = [0.05, 0.1, 0.25, 0.025, 0.075] + assert all(combined.distribution[-1].p == p3) + assert all(combined.distribution[-1].bias == b3) + + +def test_reference_vwu_projection(): + """When a non-orthogonal vector is provided, the setter should project out + any component along reference_uvw so the stored vector is orthogonal. + """ + pa = openmc.stats.PolarAzimuthal() # default reference_uvw == (0, 0, 1) + + # Provide a vector that is not orthogonal to (0,0,1) + pa.reference_vwu = (2.0, 0.5, 0.3) + + reference_v = np.asarray(pa.reference_vwu) + reference_u = np.asarray(pa.reference_uvw) + + # reference_v should be orthogonal to reference_u + assert abs(np.dot(reference_v, reference_u)) < 1e-6 + + +def test_reference_vwu_normalization(): + """When a non-normalized vector is provided, the setter should normalize + the projected vector to unit length. + """ + pa = openmc.stats.PolarAzimuthal() # default reference_uvw == (0, 0, 1) + + # Provide a vector that is neither orthogonal to (0,0,1) nor unit-length + pa.reference_vwu = (2.0, 0.5, 0.3) + + reference_v = np.asarray(pa.reference_vwu) + + # reference_v should be unit length + assert np.isclose(np.linalg.norm(reference_v), 1.0, atol=1e-12) diff --git a/tests/unit_tests/test_summary.py b/tests/unit_tests/test_summary.py new file mode 100644 index 000000000..315ac0ba5 --- /dev/null +++ b/tests/unit_tests/test_summary.py @@ -0,0 +1,41 @@ +import openmc + + +def test_periodic_surface_roundtrip(run_in_tmpdir): + # Create a simple model with periodic surfaces + mat = openmc.Material() + mat.add_nuclide('H1', 1.0) + mat.set_density('g/cm3', 1.0) + cyl = openmc.ZCylinder(r=1.0) + x0 = openmc.XPlane(-5.0, boundary_type='periodic') + y0 = openmc.YPlane(-5.0, boundary_type='periodic') + z0 = openmc.ZPlane(-5.0, boundary_type='periodic') + x1 = openmc.XPlane(5.0, boundary_type='periodic') + y1 = openmc.YPlane(5.0, boundary_type='periodic') + z1 = openmc.ZPlane(5.0, boundary_type='periodic') + x0.periodic_surface = x1 + y0.periodic_surface = y1 + z0.periodic_surface = z1 + cell1 = openmc.Cell(fill=mat, region=-cyl) + cell2 = openmc.Cell(fill=mat, region=+cyl & +x0 & -x1 & +y0 & -y1 & +z0 & -z1) + model = openmc.Model() + model.geometry = openmc.Geometry([cell1, cell2]) + model.settings.particles = 100 + model.settings.batches = 1 + model.settings.run_mode = 'fixed source' + model.settings.source = openmc.IndependentSource( + energy=openmc.stats.delta_function(1.0e4) + ) + + # Run model + model.run() + + # Load summary data and check periodic surfaces + summary = openmc.Summary('summary.h5') + surfs = summary.geometry.get_all_surfaces() + for s in [x0, y0, z0, x1, y1, z1]: + assert surfs[s.id].boundary_type == 'periodic' + pairs = [(x0, x1), (y0, y1), (z0, z1)] + for s0, s1 in pairs: + assert surfs[s0.id].periodic_surface == surfs[s1.id] + assert surfs[s1.id].periodic_surface == surfs[s0.id] diff --git a/tests/unit_tests/test_tallies.py b/tests/unit_tests/test_tallies.py index ccc6ff343..7b1bf0a2f 100644 --- a/tests/unit_tests/test_tallies.py +++ b/tests/unit_tests/test_tallies.py @@ -1,6 +1,8 @@ +from math import sqrt import numpy as np - +import pytest import openmc +import scipy.stats as sps def test_xml_roundtrip(run_in_tmpdir): @@ -96,6 +98,22 @@ def test_tally_equivalence(): assert tally_a == tally_b +def test_figure_of_merit(sphere_model, run_in_tmpdir): + # Run model with a few simple tally scores + tally = openmc.Tally() + tally.scores = ['total', 'absorption', 'scatter'] + sphere_model.tallies = [tally] + sp_path = sphere_model.run(apply_tally_results=True) + + # Get execution time and relative error + with openmc.StatePoint(sp_path) as sp: + time = sp.runtime['simulation'] + rel_err = tally.std_dev / tally.mean + + # Check that figure of merit is calculated correctly + assert tally.figure_of_merit == pytest.approx(1 / (rel_err**2 * time)) + + def test_tally_application(sphere_model, run_in_tmpdir): # Create a tally with most possible gizmos tally = openmc.Tally(name='test tally') @@ -147,3 +165,214 @@ def test_tally_application(sphere_model, run_in_tmpdir): assert (sp_tally.std_dev == tally.std_dev).all() assert (sp_tally.mean == tally.mean).all() assert sp_tally.nuclides == tally.nuclides + +def _tally_from_data(x, *, higher_moments=True, normality=True): + t = openmc.Tally() + t.scores = ["flux"] # 1 score + t.nuclides = [openmc.Nuclide("H1")] # 1 nuclide + t._sp_filename = "dummy.h5" # mark "results available" + t._results_read = True # don't try to read from disk + t._num_realizations = int(len(x)) # n + t.higher_moments = bool(higher_moments) + + x = np.asarray(x, dtype=float) + # (num_filter_bins=1, num_nuclides=1, num_scores=1) -> (1,1,1) arrays + t._sum = np.array([[[np.sum(x)]]], dtype=float) + t._sum_sq = np.array([[[np.sum(x**2)]]], dtype=float) + if higher_moments: + t._sum_third = np.array([[[np.sum(x**3)]]], dtype=float) + t._sum_fourth = np.array([[[np.sum(x**4)]]], dtype=float) + return t + +@pytest.mark.parametrize( + "x, skew_true, kurt_true", + [ # Rademacher distribution + (np.array([1.0, -1.0] * 200), 0.0, 1.0), + # Two-point {0,3} with p(0)=3/4, p(3)=1/4 + (np.concatenate([np.zeros(600), np.full(200, 3.0)]), 2.0 / sqrt(3.0), 7.0 / 3.0), + # Bernoulli distribution + (np.concatenate([np.ones(300), np.zeros(700)]), (1 - 2 * 0.3) / sqrt(0.3 * 0.7), (1 - 3 * 0.3 + 3 * 0.3**2) / (0.3 * 0.7)), + ], +) +def test_b1_b2_analytical_against_tally(x, skew_true, kurt_true): + t = _tally_from_data(x, higher_moments=True, normality=False) + + g1 = t.skew(bias=True)[0, 0, 0] + b2 = t.kurtosis(bias=True, fisher=False)[0, 0, 0] + + assert np.isclose(g1, skew_true, rtol=0, atol=1e-12) + assert np.isclose(b2, kurt_true, rtol=0, atol=1e-12) + +@pytest.mark.parametrize( + "draw, skew_true, kurt_true", + [(lambda rng, n: rng.normal(0, 1, n), 0.0, 3.0), # Normal + (lambda rng, n: rng.random(n), 0.0, 1.8), # Uniform(0,1) + (lambda rng, n: rng.exponential(1.0, n), 2.0, 9.0), # Exp(1) + (lambda rng, n: (rng.random(n) < 0.3).astype(float), + (1 - 2 * 0.3) / sqrt(0.3 * 0.7), + (1 - 3 * 0.3 + 3 * 0.3**2) / (0.3 * 0.7),),],) + +def test_b1_b2_scipy_and_theory(draw, skew_true, kurt_true): + rng = np.random.default_rng(12345) + N = 200_000 + x = draw(rng, N) + + # Tally outputs + t = _tally_from_data(x, higher_moments=True, normality=False) + g1_t = t.skew(bias=True)[0, 0, 0] + b2_t = t.kurtosis(bias=True, fisher=False)[0, 0, 0] + + # SciPy (population, bias=True to match population-moment style) + skew_sp = sps.skew(x, bias=True) + kurt_sp = sps.kurtosis(x, fisher=False, bias=True) + + # Compare to SciPy numerically + assert np.isclose(g1_t, skew_sp, rtol=0, atol=5e-3) + assert np.isclose(b2_t, kurt_sp, rtol=0, atol=5e-3) + + # Compare to analytical targets with size-dependent tolerances + tol_skew = 0.02 if abs(skew_true) < 0.5 else 0.05 + tol_kurt = 0.03 if kurt_true < 4 else 0.1 + assert abs(g1_t - skew_true) < tol_skew + assert abs(b2_t - kurt_true) < tol_kurt + + +def test_kurtosis_bias_fisher_combinations(): + """Test that all combinations of bias and fisher match scipy.stats.kurtosis""" + rng = np.random.default_rng(42) + x = rng.normal(0, 1, 10000) + + t = _tally_from_data(x, higher_moments=True, normality=False) # Test all four combinations + # 1. bias=True, fisher=False (Pearson's kurtosis, b2) + b2_tally = t.kurtosis(bias=True, fisher=False)[0, 0, 0] + b2_scipy = sps.kurtosis(x, fisher=False, bias=True) + assert np.isclose(b2_tally, b2_scipy, rtol=0, atol=1e-10) + assert np.isclose(b2_tally, 3.0, rtol=0.05, atol=0.1) # Should be ~3 for normal + + # 2. bias=True, fisher=True (excess kurtosis, g2) + g2_tally = t.kurtosis(bias=True, fisher=True)[0, 0, 0] + g2_scipy = sps.kurtosis(x, fisher=True, bias=True) + assert np.isclose(g2_tally, g2_scipy, rtol=0, atol=1e-10) + assert np.isclose(g2_tally, 0.0, rtol=0, atol=0.1) # Should be ~0 for normal + assert np.isclose(g2_tally, b2_tally - 3.0, rtol=0, atol=1e-10) # g2 = b2 - 3 + + # 3. bias=False, fisher=True (adjusted excess kurtosis, G2) + G2_tally = t.kurtosis(bias=False, fisher=True)[0, 0, 0] + G2_tally_default = t.kurtosis()[0, 0, 0] # Should be same as default + G2_scipy = sps.kurtosis(x, fisher=True, bias=False) + assert np.isclose(G2_tally, G2_tally_default, rtol=0, atol=1e-10) + assert np.isclose(G2_tally, G2_scipy, rtol=0, atol=1e-10) + assert np.isclose(G2_tally, 0.0, rtol=0, atol=0.1) # Should be ~0 for normal + + # 4. bias=False, fisher=False (adjusted Pearson's kurtosis) + adj_b2_tally = t.kurtosis(bias=False, fisher=False)[0, 0, 0] + adj_b2_scipy = sps.kurtosis(x, fisher=False, bias=False) + assert np.isclose(adj_b2_tally, adj_b2_scipy, rtol=0, atol=1e-10) + assert np.isclose(adj_b2_tally, 3.0, rtol=0.05, atol=0.1) # Should be ~3 for normal + assert np.isclose(adj_b2_tally, G2_tally + 3.0, rtol=0, atol=1e-10) # adj_b2 = G2 + 3 + + +def test_ztests_scipy_comparison(): + rng = np.random.default_rng(987) + x_norm = rng.normal(size=50_000) + x_exp = rng.exponential(size=50_000) + + # -------- Normal dataset (should not reject) -------- + t0 = _tally_from_data(x_norm, higher_moments=True, normality=True) + Zb1_0, p_skew_0 = t0.skewtest(alternative="two-sided") + Zb2_0, p_kurt_0 = t0.kurtosistest(alternative="two-sided") + K2_0, p_omni_0 = t0.normaltest(alternative="two-sided") + + Zb1_0 = Zb1_0.ravel()[0] + p_skew_0 = p_skew_0.ravel()[0] + Zb2_0 = Zb2_0.ravel()[0] + p_kurt_0 = p_kurt_0.ravel()[0] + K2_0 = K2_0.ravel()[0] + p_omni_0 = p_omni_0.ravel()[0] + + z_skew_sp0, p_skew_sp0 = sps.skewtest(x_norm) + z_kurt_sp0, p_kurt_sp0 = sps.kurtosistest(x_norm) + k2_sp0, p_omni_sp0 = sps.normaltest(x_norm) + + assert np.isclose(Zb1_0, z_skew_sp0, atol=0.15) + assert np.isclose(Zb2_0, z_kurt_sp0, atol=0.15) + assert np.isclose(K2_0, k2_sp0, atol=0.30) + assert np.isclose(p_skew_0, p_skew_sp0, atol=5e-3) + assert np.isclose(p_kurt_0, p_kurt_sp0, atol=5e-3) + assert np.isclose(p_omni_0, p_omni_sp0, atol=5e-3) + + # -------- Exponential dataset (should strongly reject) -------- + t1 = _tally_from_data(x_exp, higher_moments=True, normality=True) + + Zb1_1, p_skew_1 = t1.skewtest(alternative="two-sided") + Zb2_1, p_kurt_1 = t1.kurtosistest(alternative="two-sided") + K2_1, p_omni_1 = t1.normaltest(alternative="two-sided") + + Zb1_1 = Zb1_1.ravel()[0] + p_skew_1 = p_skew_1.ravel()[0] + Zb2_1 = Zb2_1.ravel()[0] + p_kurt_1 = p_kurt_1.ravel()[0] + K2_1 = K2_1.ravel()[0] + p_omni_1 = p_omni_1.ravel()[0] + + z_skew_sp1, p_skew_sp1 = sps.skewtest(x_exp) + z_kurt_sp1, p_kurt_sp1 = sps.kurtosistest(x_exp) + k2_sp1, p_omni_sp1 = sps.normaltest(x_exp) + + # Both pipelines should reject very strongly + assert p_skew_1 < 1e-6 and p_skew_sp1 < 1e-6 + assert p_kurt_1 < 1e-6 and p_kurt_sp1 < 1e-6 + assert p_omni_1 < 1e-6 and p_omni_sp1 < 1e-6 + + # Right-skewed and heavy-tailed → large positive Z-statistics + assert Zb1_1 > 30 and z_skew_sp1 > 30 + assert Zb2_1 > 30 and z_kurt_sp1 > 30 + assert K2_1 > 2000 and k2_sp1 > 2000 + +def test_vov_stochastic(sphere_model, run_in_tmpdir): + tally = openmc.Tally(name="test tally") + ef = openmc.EnergyFilter([0.0, 0.1, 1.0, 10.0e6]) + mesh = openmc.RegularMesh.from_domain(sphere_model.geometry, (2, 2, 2)) + mf = openmc.MeshFilter(mesh) + tally.filters = [ef, mf] + tally.scores = ["flux", "absorption", "fission", "scatter"] + tally.higher_moments = True + sphere_model.tallies = [tally] + + sp_file = sphere_model.run(apply_tally_results=True) + + assert tally._mean is None + assert tally._std_dev is None + assert tally._sum is None + assert tally._sum_sq is None + assert tally._sum_third is None + assert tally._sum_fourth is None + assert tally._num_realizations == 0 + assert tally._sp_filename == sp_file + + with openmc.StatePoint(sp_file) as sp: + assert tally in sp.tallies.values() + sp_tally = sp.tallies[tally.id] + + assert np.all(sp_tally.std_dev == tally.std_dev) + assert np.all(sp_tally.mean == tally.mean) + assert np.all(sp_tally.vov == tally.vov) + assert sp_tally.nuclides == tally.nuclides + + n = sp_tally.num_realizations + mean = sp_tally.mean + sum_ = sp_tally._sum + sum_sq = sp_tally._sum_sq + sum_third = sp_tally._sum_third + sum_fourth = sp_tally._sum_fourth + + expected_vov = np.zeros_like(mean) + nonzero = np.abs(mean) > 0 + + num = (sum_fourth - (4.0*sum_third*sum_)/n + (6.0*sum_sq*sum_**2)/(n**2) + - (3.0*sum_**4)/(n**3)) + den = (sum_sq - (1.0/n)*sum_**2)**2 + + expected_vov[nonzero] = num[nonzero]/den[nonzero] - 1.0/n + + assert np.allclose(expected_vov, sp_tally.vov, rtol=1e-7, atol=0.0) diff --git a/tests/unit_tests/test_uniform_source_sampling.py b/tests/unit_tests/test_uniform_source_sampling.py index 7f805e37d..0d1930328 100644 --- a/tests/unit_tests/test_uniform_source_sampling.py +++ b/tests/unit_tests/test_uniform_source_sampling.py @@ -14,10 +14,15 @@ def sphere_model(): model.settings.particles = 100 model.settings.batches = 1 - model.settings.source = openmc.IndependentSource( + src1 = openmc.IndependentSource( energy=openmc.stats.delta_function(1.0e3), - strength=100.0 + strength=75.0 ) + src2 = openmc.IndependentSource( + energy=openmc.stats.delta_function(1.0e3), + strength=25.0 + ) + model.settings.source = [src1, src2] model.settings.run_mode = "fixed source" model.settings.surf_source_write = { "max_particles": 100, @@ -42,11 +47,13 @@ def test_source_weight(run_in_tmpdir, sphere_model): sphere_model.settings.uniform_source_sampling = True sphere_model.run() particles = openmc.ParticleList.from_hdf5('surface_source.h5') - strength = sphere_model.settings.source[0].strength - assert set(p.wgt for p in particles) == {strength} + assert set(p.wgt for p in particles) == {0.5, 1.5} def test_tally_mean(run_in_tmpdir, sphere_model): + # Use only one source + sphere_model.settings.source.pop() + # Run without uniform source sampling sphere_model.settings.uniform_source_sampling = False sp_file = sphere_model.run() diff --git a/tests/unit_tests/test_universe.py b/tests/unit_tests/test_universe.py index 46d4ec3f7..efe8552a6 100644 --- a/tests/unit_tests/test_universe.py +++ b/tests/unit_tests/test_universe.py @@ -99,6 +99,10 @@ def test_plot(run_in_tmpdir, sphere_model): pixels=100, ) + # Close plots to avoid warning + import matplotlib.pyplot as plt + plt.close('all') + def test_get_nuclides(uo2): c = openmc.Cell(fill=uo2) diff --git a/tests/unit_tests/test_waste_classification.py b/tests/unit_tests/test_waste_classification.py new file mode 100644 index 000000000..072590df9 --- /dev/null +++ b/tests/unit_tests/test_waste_classification.py @@ -0,0 +1,102 @@ +import random + +import openmc +import pytest + + +@pytest.mark.parametrize("metal", [False, True]) +def test_waste_classification_long(metal): + """Test classification when determined by long-lived radionuclides""" + f = 10.0 if metal else 1.0 + limit = 8.0*f + mat = openmc.Material() + mat.add_nuclide('C14', 1e-9*f) + assert mat.get_activity('Ci/m3') < 0.1 * limit + assert mat.waste_classification(metal=metal) == 'Class A' + + mat = openmc.Material() + mat.add_nuclide('C14', 1e-8*f) + assert 0.1 * limit < mat.get_activity('Ci/m3') < limit + assert mat.waste_classification(metal=metal) == 'Class C' + + mat = openmc.Material() + mat.add_nuclide('C14', 1e-7*f) + assert mat.get_activity('Ci/m3') > limit + assert mat.waste_classification(metal=metal) == 'GTCC' + + +@pytest.mark.parametrize("metal", [False, True]) +def test_waste_classification_short(metal): + """Test classification when determined by short-lived radionuclides""" + f = 10.0 if metal else 1.0 + col1, col2, col3 = 3.5*f, 70.0*f, 700.0*f + + mat = openmc.Material() + mat.add_nuclide('Ni63', 1e-10*f) + assert mat.get_activity('Ci/m3') < col1 + assert mat.waste_classification(metal=metal) == 'Class A' + + mat = openmc.Material() + mat.add_nuclide('Ni63', 1e-10*10*f) + assert col1 < mat.get_activity('Ci/m3') < col2 + assert mat.waste_classification(metal=metal) == 'Class B' + + mat = openmc.Material() + mat.add_nuclide('Ni63', 1e-10*200*f) + assert col2 < mat.get_activity('Ci/m3') < col3 + assert mat.waste_classification(metal=metal) == 'Class C' + + mat = openmc.Material() + mat.add_nuclide('Ni63', 1e-10*2000*f) + assert mat.get_activity('Ci/m3') > col3 + assert mat.waste_classification(metal=metal) == 'GTCC' + + +def test_waste_classification_mix(): + """Test classification when determined by a mix of radionuclides""" + # Check example from 10 CFR 61.55 with mix of Sr90 and Cs137 + mat = openmc.Material() + mat.add_nuclide('Sr90', 2.425e-9) + mat.add_nuclide('Cs137', 1.115e-9) + + # In example, activity of Sr90 is 50.0 Ci/m3 and Cs137 is 22.0 Ci/m3 + activity = mat.get_activity(units='Ci/m3', by_nuclide=True) + assert activity['Sr90'] == pytest.approx(50.0, 0.01) + assert activity['Cs137'] == pytest.approx(22.0, 0.01) + + # According to example, the waste should be class B + assert mat.waste_classification() == 'Class B' + + +def test_waste_rating_fetter(): + """Test waste classification using the Fetter limits""" + # For Tc99, Fetter has a more strict limit. Here, we create a material with + # Tc99 at 1 Ci/m3 which exceeds Fetter but not NRC + density = 3.5561e-7 + mat = openmc.Material() + mat.add_nuclide('Tc99', density) + assert mat.get_activity('Ci/m3') == pytest.approx(1.0, 1e-3) + assert mat.waste_disposal_rating(limits='NRC_short_C') < 1.0 + assert mat.waste_disposal_rating(limits='Fetter') > 1.0 + + # With a lower density, it should be Class C under Fetter limits and Class A + # under NRC limits + mat = openmc.Material() + mat.add_nuclide('Tc99', 5.0e-2*density) + assert mat.waste_disposal_rating(limits='NRC_short_A') < 1.0 + assert mat.waste_disposal_rating(limits='Fetter') < 1.0 + + +def test_waste_disposal_rating(): + """Test waste_disposal_rating method""" + mat = openmc.Material() + mat.add_nuclide('K40', random.random()) + + # Check for correct classification based on actual activity + ci_m3 = mat.get_activity('Ci/m3') + assert mat.waste_disposal_rating(limits={'K40': 2*ci_m3}) < 1.0 + assert mat.waste_disposal_rating(limits={'K40': 0.5*ci_m3}) > 1.0 + + wdr = mat.waste_disposal_rating(limits={'K40': 4*ci_m3}, by_nuclide=True) + assert isinstance(wdr, dict) + assert wdr['K40'] == pytest.approx(1/4) diff --git a/tests/unit_tests/weightwindows/dagmc/__init__.py b/tests/unit_tests/weightwindows/dagmc/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/unit_tests/weightwindows/dagmc/nested_shell_geometry.h5m b/tests/unit_tests/weightwindows/dagmc/nested_shell_geometry.h5m new file mode 100644 index 000000000..af1d5563d Binary files /dev/null and b/tests/unit_tests/weightwindows/dagmc/nested_shell_geometry.h5m differ diff --git a/tests/unit_tests/weightwindows/dagmc/test.py b/tests/unit_tests/weightwindows/dagmc/test.py new file mode 100644 index 000000000..ed01a93ed --- /dev/null +++ b/tests/unit_tests/weightwindows/dagmc/test.py @@ -0,0 +1,98 @@ +import pytest + +import openmc +import openmc.lib + +pytestmark = pytest.mark.skipif( + not openmc.lib._dagmc_enabled(), + reason="DAGMC CAD geometry is not enabled.", +) + + +def test_dagmc_weight_windows_near_boundary(run_in_tmpdir, request): + """Ensure splitting near a boundary doesn't lose particles due to + a stale DAGMC history on the particle object.""" + + # DAGMC model overview: + # * Three nested cubes; innermost cube contains a fusion neutron source. + # * Two outer cubes filled with tungsten. Weight windows defined on a mesh + # cause particles to split moving outward. + # Outer cubes are similar in size (outer slightly larger) so particles + # frequently cross the problem boundary immediately after splitting. No lost + # particles are allowed to the correct DAGMC history after splitting is used. + model = openmc.Model() + + dagmc_file = request.path.parent / 'nested_shell_geometry.h5m' + dagmc_univ = openmc.DAGMCUniverse(dagmc_file) + model.geometry = openmc.Geometry(dagmc_univ) + + tungsten = openmc.Material(name='shell') + tungsten.add_element('W', 1.0) + tungsten.set_density('g/cm3', 7.8) + materials = openmc.Materials([tungsten]) + model.materials = materials + + settings = openmc.Settings() + settings.output = {'tallies': False, 'summary': False} + + source = openmc.IndependentSource() + source.space = openmc.stats.Point((0.0, 0.0, 0.0)) + source.angle = openmc.stats.Isotropic() + source.energy = openmc.stats.Discrete([14.1e6], [1.0]) + settings.source = source + + settings.batches = 2 + settings.particles = 500 + settings.run_mode = 'fixed source' + settings.survival_biasing = False + settings.max_lost_particles = 1 + settings.max_history_splits = 10_000_000 + + settings.weight_window_checkpoints = { + 'surface': True, + 'collision': True, + } + + mesh = openmc.RegularMesh() + mesh.lower_left = (-60.0, -60.0, -60.0) + mesh.upper_right = (60.0, 60.0, 60.0) + mesh.dimension = (24, 1, 1) + + weight_windows_lower = [ + 0.030750733294361156, + 0.056110505674355333, + 0.08187875047968339, + 0.1101743496347699, + 0.13982370013053508, + 0.17443799246829372, + 0.21576286623367483, + 0.26416659508033646, + 0.318574932646899, + 0.3804031702117963, + 0.42899359749256355, + 0.4954283294279403, + 0.49999999999999994, + 0.43432341070872266, + 0.38302303850488206, + 0.32148375935490886, + 0.2637416945702018, + 0.21498369367288853, + 0.17163611765361744, + 0.13832102142074995, + 0.10717772257151495, + 0.07986176041282561, + 0.05499644859408233, + 0.03058023506703803, + ] + + weight_windows = openmc.WeightWindows( + mesh, + lower_ww_bounds=weight_windows_lower, + upper_bound_ratio=5.0, + ) + weight_windows.max_lower_bound_ratio = 1.0 + settings.weight_windows = weight_windows + settings.weight_windows_on = True + model.settings = settings + + model.run() \ No newline at end of file diff --git a/tests/unit_tests/weightwindows/test_ww_gen.py b/tests/unit_tests/weightwindows/test_ww_gen.py index 555421461..a4456e680 100644 --- a/tests/unit_tests/weightwindows/test_ww_gen.py +++ b/tests/unit_tests/weightwindows/test_ww_gen.py @@ -1,3 +1,4 @@ +import copy from itertools import permutations from pathlib import Path @@ -303,7 +304,7 @@ def test_python_hdf5_roundtrip(run_in_tmpdir, model): openmc.lib.finalize() - wws_hdf5 = openmc.hdf5_to_wws()[0] + wws_hdf5 = openmc.WeightWindowsList.from_hdf5()[0] # ensure assert all(wws.energy_bounds == wws_hdf5.energy_bounds) @@ -332,3 +333,72 @@ def test_ww_bounds_set_in_memory(run_in_tmpdir, model): wws.bounds = (bounds, bounds) openmc.lib.finalize() + + +@pytest.mark.skipif(not openmc.lib._dagmc_enabled(), reason="DAGMC CAD geometry is not enabled.") +def test_ww_generation_with_dagmc(run_in_tmpdir): + mat1 = openmc.Material(name="1") + mat1.add_nuclide("H1", 1, percent_type="ao") + mat1.set_density("g/cm3", 0.001) + + materials = openmc.Materials([mat1]) + dag_univ = openmc.DAGMCUniverse( + Path(__file__).parent.parent / "dagmc" / "dagmc_tetrahedral_no_graveyard.h5m") + bound_dag_univ = dag_univ.bounded_universe(padding_distance=1) + geometry = openmc.Geometry(bound_dag_univ) + + settings = openmc.Settings() + settings.batches = 6 + settings.particles = 30 + settings.run_mode = "fixed source" + + # Create a point source which are supported by random ray mode + my_source = openmc.IndependentSource() + my_source.space = openmc.stats.Point((0.25, 0.25, 0.25)) + my_source.energy = openmc.stats.delta_function(14e6) + settings.source = my_source + + model = openmc.Model(geometry, materials, settings) + + rr_model = copy.deepcopy(model) + rr_model.settings.inactive = 3 + + rr_model.convert_to_multigroup( + method="stochastic_slab", + overwrite_mgxs_library=True, + nparticles=10, + groups="CASMO-2" + ) + + rr_model.convert_to_random_ray() + + mesh = openmc.RegularMesh.from_domain(rr_model, dimension=(4, 4, 4)) + + # avoid writing files we don't make use of + rr_model.settings.output = {"summary": False, "tallies": False} + + # Subdivide random ray source regions + rr_model.settings.random_ray["source_region_meshes"] = [ + (mesh, [rr_model.geometry.root_universe]) + ] + + # less likely to get negative values in the weight window + rr_model.settings.random_ray["volume_estimator"] = "naive" + + # Add a weight window generator to the model + rr_model.settings.weight_window_generators = openmc.WeightWindowGenerator( + method="fw_cadis", + mesh=mesh, + max_realizations=42, + particle_type='neutron', + energy_bounds=[0.0, 100e6] + ) + + rr_model.run() + + model.settings.weight_windows_on = True + model.settings.weight_window_checkpoints = {"collision": True, "surface": True} + model.settings.survival_biasing = False + model.settings.weight_windows = openmc.WeightWindowsList.from_hdf5() + + model.run() diff --git a/tests/unit_tests/weightwindows/test_ww_list.py b/tests/unit_tests/weightwindows/test_ww_list.py new file mode 100644 index 000000000..d148f382a --- /dev/null +++ b/tests/unit_tests/weightwindows/test_ww_list.py @@ -0,0 +1,23 @@ +import openmc + + +def test_ww_roundtrip(request, run_in_tmpdir): + # Load weight windows from a wwinp file + wwinp_file = request.path.with_name('wwinp_n') + wws = openmc.WeightWindowsList.from_wwinp(wwinp_file) + + # Roundtrip them, writing to HDF5 and reading back in + wws.export_to_hdf5('ww.h5') + wws_new = openmc.WeightWindowsList.from_hdf5('ww.h5') + + # Check that the new weight windows are the same as the original + assert len(wws) == len(wws_new) + for ww, ww_new in zip(wws, wws_new): + assert ww.particle_type == ww_new.particle_type + assert (ww.lower_ww_bounds == ww_new.lower_ww_bounds).all() + assert (ww.upper_ww_bounds == ww_new.upper_ww_bounds).all() + assert ww.survival_ratio == ww_new.survival_ratio + assert ww.num_energy_bins == ww_new.num_energy_bins + assert ww.max_split == ww_new.max_split + assert ww.weight_cutoff == ww_new.weight_cutoff + assert ww.mesh.id == ww_new.mesh.id diff --git a/tests/unit_tests/weightwindows/test_wwinp_reader.py b/tests/unit_tests/weightwindows/test_wwinp_reader.py index 434a36753..637463bb2 100644 --- a/tests/unit_tests/weightwindows/test_wwinp_reader.py +++ b/tests/unit_tests/weightwindows/test_wwinp_reader.py @@ -96,7 +96,7 @@ def id_fn(params): def test_wwinp_reader(wwinp_data, request): wwinp_file, mesh, particle_types, energy_bounds = wwinp_data - wws = openmc.wwinp_to_wws(request.node.path.parent / wwinp_file) + wws = openmc.WeightWindowsList.from_wwinp(request.node.path.parent / wwinp_file) for i, ww in enumerate(wws): e_bounds = energy_bounds[i] @@ -140,4 +140,4 @@ def test_wwinp_reader_failures(wwinp_data, request): filename, expected_failure = wwinp_data with pytest.raises(expected_failure): - _ = openmc.wwinp_to_wws(request.node.path.parent / filename) + _ = openmc.WeightWindowsList.from_wwinp(request.node.path.parent / filename) diff --git a/tools/ci/gha-install-dagmc.sh b/tools/ci/gha-install-dagmc.sh index 82759c9bc..8d0648a50 100755 --- a/tools/ci/gha-install-dagmc.sh +++ b/tools/ci/gha-install-dagmc.sh @@ -3,7 +3,7 @@ set -ex # MOAB Variables -MOAB_BRANCH='Version5.1.0' +MOAB_BRANCH='5.5.1' MOAB_REPO='https://bitbucket.org/fathomteam/moab/' MOAB_INSTALL_DIR=$HOME/MOAB/ @@ -19,7 +19,7 @@ cd $HOME mkdir MOAB && cd MOAB git clone -b $MOAB_BRANCH $MOAB_REPO mkdir build && cd build -cmake ../moab -DENABLE_HDF5=ON -DENABLE_NETCDF=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=$MOAB_INSTALL_DIR -DENABLE_BLASLAPACK=OFF +cmake ../moab -DENABLE_HDF5=ON -DENABLE_NETCDF=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=$MOAB_INSTALL_DIR make -j && make -j install rm -rf $HOME/MOAB/moab $HOME/MOAB/build diff --git a/tools/ci/gha-install-mcpl.sh b/tools/ci/gha-install-mcpl.sh deleted file mode 100755 index 9b8609398..000000000 --- a/tools/ci/gha-install-mcpl.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -set -ex -cd $HOME -git clone https://github.com/mctools/mcpl -cd mcpl -mkdir build && cd build -cmake .. && make 2>/dev/null && sudo make install diff --git a/tools/ci/gha-install.sh b/tools/ci/gha-install.sh index d8a3a7600..74c3947f1 100755 --- a/tools/ci/gha-install.sh +++ b/tools/ci/gha-install.sh @@ -29,7 +29,7 @@ if [[ $LIBMESH = 'y' ]]; then fi # Install MCPL -./tools/ci/gha-install-mcpl.sh +pip install mcpl # For MPI configurations, make sure mpi4py and h5py are built against the # correct version of MPI diff --git a/tools/ci/gha-script.sh b/tools/ci/gha-script.sh index c7c634ffa..b40238ffb 100755 --- a/tools/ci/gha-script.sh +++ b/tools/ci/gha-script.sh @@ -14,5 +14,8 @@ if [[ $EVENT == 'y' ]]; then args="${args} --event " fi -# Run regression and unit tests -pytest --cov=openmc -v $args tests +# Run unit tests and then regression tests +pytest -v $args \ + tests/test_matplotlib_import.py \ + tests/unit_tests \ + tests/regression_tests