OpenMC Documentation

repository·develop·Indexed 21 days ago

https://github.com/openmc-dev/openmc

OpenMC is a Monte Carlo particle transport code used for nuclear engineering and physics research, featuring constructive solid geometry (CSG) and continuous-energy transport capabilities. It utilizes HDF5 format cross sections and provides a C/C++ API for in-memory coupling, as well as Python bindings via the openmc.lib module. The documentation covers installation, custom source library compilation, and the use of the experimental C/C++ API for managing cells, materials, and tallies.

Tokens
148.7K
Snippets
318
Records
768
Agent score
74%

What's inside OpenMC

  1. Overview of the OpenMC Python API

    develop

    OpenMC provides a rich Python API designed for programmatic pre-processing (generating input files) and post-processing (analyzing results). Using the Python API allows you to leverage the Python ecosystem (like NumPy) and provides high-level scientific capabilities that are not available in the standalone C++ version.

    Key capabilities provided by the API include:

    • Geometry & Modeling: Defining dimensions with variables, convenience functions for complex shapes (e.g., hexagonal regions), and plotting individual universes during geometry creation.
    • Nuclear Data: A fully-featured interface via openmc.data and automated multi-group cross section generation via openmc.mgxs.
    • Physics & Simulation: Depletion capabilities via openmc.deplete, $k_{\text{eff}}$ search via openmc.search_for_keff, and random sphere packing for TRISO particle locations via openmc.model.pack_spheres.
    • Material Management: Creating materials based on natural elements or specific uranium enrichment levels.
  2. Overview of OpenMC

    develop
    OpenMC is a fully-featured Monte Carlo particle transport code designed for research and development. It utilizes modern methods, including constructive solid geometry (CSG) and continuous-energy transport, and relies on HDF5 format cross sections for its calculations.
  3. New features in OpenMC 0.4.0

    develop

    OpenMC 0.4.0 introduced several key features:

    • Unresolved Resonance Treatment: The probability table method for energy self-shielding in the unresolved resonance range is now implemented and enabled by default.
    • Convergence Assessment: Added calculation of Shannon entropy to assess the convergence of the fission source distribution.
    • Compiler & Hardware Support: Added support for the PGI Fortran compiler and the ability to run on IBM BlueGene/P machines.
    • Geometry Improvements: A complete rewrite of nested universe handling, resulting in more robust geometry.
  4. New Features in OpenMC 0.5.4

    develop

    Version 0.5.4 introduced several functional improvements:

    • Particle Tracking: Ability to write particle track files, which also allows for more graceful handling of lost particles.
    • Data Management: A new script is available to download ACE data from NNDC. Additionally, cross_sections.xml now supports mixed ASCII/binary formats.
    • Randomness: Support for multiple random number generator streams.
    • Utilities: The mesh tally plotting utility has been converted to use Tkinter instead of PyQt.
    • Source Handling: Source sites located outside the geometry are now resampled, and expanded options for writing the source bank are available. The ability to use a source file as a starting source has also been re-enabled.
    • Performance: Avoids $S(\alpha, \beta)$ recalculation when the same nuclide and $S(\alpha, \beta)$ table are accessed.
    • Backend: The XML-Fortran backend has been replaced by FoX XML.
  5. Use convenience functions for model building

    develop

    The openmc.model module provides several convenience functions to simplify the creation of common geometries and structures. These include:

    • borated_water: Likely used to create borated water material/geometry configurations.
    • subdivide: Used for partitioning or subdividing existing geometries.
    • pin: A helper for creating fuel pin geometries.
  6. New features in OpenMC 0.4.2

    develop

    Version 0.4.2 introduced several new capabilities:

    • Material Modeling: Ability to specify void materials and use units='sum' on a <density> tag (interpreting the total material density as the sum of the atom fractions listed for each nuclide).
    • Source & Randomness: Ability to specify 'point' source types and change the random number seed. Supports reading/writing binary source files.
    • Tallies & Estimators: Added an estimator for the diffusion coefficient and a uniform fission site method for reducing variance on local tallies. Users can also opt not to reduce tallies across processors at the end of each batch.
    • Verbosity: Added more messages for <trace> or high verbosity modes.
  7. Use the openmc.lib Python bindings for C/C++ API access

    develop
    The openmc.lib module provides direct Python bindings to the underlying C/C++ API. This allows developers to interact with the core OpenMC engine, manage simulation states, and access low-level objects like cells, materials, and meshes directly through Python.
  8. Access nuclear data via openmc.data

    develop

    The openmc.data module provides a high-level interface for interacting with nuclear data. It is organized into several functional groups depending on the type of data being accessed:

    Incident Neutron and Decay Data

    Used for neutron cross sections, decay data, fission, and product yields. Key classes include:

    • IncidentNeutron, Reaction, Product
    • FissionEnergyRelease, FissionProductYields
    • Decay, DataLibrary
    • WindowedMultipole, ProbabilityTables

    Atomic and Photon Data

    Used for incident photon cross sections and atomic relaxation. Key classes include:

    • IncidentPhoton, PhotonReaction
    • AtomicRelaxation

    Thermal Neutron Scattering Data

    Used for storing thermal scattering data. Key classes include:

    • ThermalScattering, ThermalScatteringReaction
    • CoherentElastic, IncoherentElastic
  9. Understand OpenMC file formats

    develop

    OpenMC uses specific file formats for different stages of the simulation workflow. These are categorized into:

    • Input Files: Define the simulation parameters, including geometry, materials, settings, tallies, and plots.
    • Data Files: Provide the physical data required for calculations, such as cross-sections, depletion chains, nuclear data, MGXS libraries, and WMP data.
    • Output Files: Contain the results and state information generated by the simulation, including statepoints, source distributions, collision tracks, summaries, properties, depletion results, particle restarts, tracks, voxels, volumes, and weight windows.
  10. Overview of OpenMC program flow

    develop

    OpenMC executes Monte Carlo simulations by tracking one particle at a time per program instance. The execution lifecycle is divided into three main phases: Initialization, Transport Simulation, and Finalization.

    1. Initialization

    Before tracking begins, OpenMC performs the following:

    • Reads input files to build data structures for geometry, materials, and tallies.
    • Initializes the pseudorandom number generator.
    • Loads continuous-energy or multi-group cross section data.
    • Initializes special energy grid treatments (e.g., union energy grids or lethargy bins) if specified.
    • For multi-group problems, combines nuclide cross sections into material-specific data.
    • Samples source sites (coordinates, direction, and energy) for fixed source or eigenvalue problems.

    2. Transport Simulation (Particle Life Cycle)

    For each particle, the following loop occurs:

    1. Initialization: Particle properties are set from a sampled source site.
    2. Location: The current cell is determined based on coordinates.
    3. Cross Sections: Energy-dependent cross sections for the current material are determined.
    4. Boundary Check: The distance to the nearest cell boundary is calculated.
    5. Collision Sampling: The distance to the next collision is sampled using the total material cross section $\Sigma_t$.
    6. Movement:
      • If the boundary is closer than the collision, the particle moves to the boundary and the process repeats from step 2.
      • If the collision is closer, the particle undergoes a collision.
    7. Nuclide Selection: In continuous-energy simulations, a specific nuclide is sampled based on total cross sections. (In multi-group, this is pre-combined).
    8. Reaction Sampling: A specific reaction is sampled based on microscopic (or material-specific multi-group) cross sections.
    9. Reaction Outcome:
      • Scattering (Elastic/Inelastic): Outgoing energy and angle are sampled. In continuous-energy, $(n,xn)$ reactions create secondary particles added to a bank. In multi-group, particle weight is increased instead. The particle continues from step 3.
      • Absorption/Fission: The particle dies. If fission occurs, fission sites are stored in a fission bank.

    3. Finalization

    After all particles are processed:

    • Tallies are processed to calculate sample means and variances.
    • Results and (optionally) source files are written to disk.
    • Memory is freed.
  11. Overview of Variance Reduction strategies in OpenMC

    develop

    Variance reduction techniques in OpenMC are used to combat high attenuation between source and detector regions, which otherwise leads to high uncertainties in low-flux areas. OpenMC provides three primary strategies:

    1. Weight Windows (MAGIC method): An iterative technique using spatial flux information from a normal Monte Carlo solve to generate weight windows for subsequent iterations. It uses a mesh to split particles in low-flux regions and terminate them in high-flux regions.
    2. Weight Windows (FW-CADIS method): A more numerically efficient method that generates weight windows based on spatial adjoint flux information. It uses an internal random ray multigroup transport solver to generate adjoint flux maps.
    3. Source Biasing: Modifies the sampling of the external source distribution (space, angle, energy, or time) to preferentially track particles toward regions of interest, applying a weight adjustment to maintain statistical fairness.

    Key Distinction: Source biasing changes how particles are born, while weight windows apply population control (splitting and Russian roulette) during transport. For problems with high attenuation in optically thick regions, weight windows are generally more effective.

  12. What is the Random Ray transport method?

    develop

    Random Ray is a stochastic transport method in OpenMC that is closely related to the deterministic Method of Characteristics (MOC). Unlike Monte Carlo (MC), where each ray represents a single neutron, in Random Ray, each ray represents a characteristic line through the simulation geometry.

    Key characteristics include:

    • Analytical Solution: The transport equation is written as an ordinary differential equation along the ray and solved analytically (using a multigroup approach for energy discretization).
    • Spatial/Angular Distribution: Rays are selected to explore the simulation problem with a statistically equal distribution in space and angle, meaning they are not affected by the material characteristics of the problem.
    • Variance: Random ray provides approximately even variance throughout the entire global simulation domain, unlike Monte Carlo which can struggle with numerical efficiency in low-flux regions.