# openmc – Basic Functionality¶

## Handling nuclear data¶

 openmc.XSdata A multi-group cross section data set providing all the multi-group data necessary for a multi-group OpenMC calculation. openmc.MGXSLibrary Multi-Group Cross Sections file used for an OpenMC simulation.

## Simulation Settings¶

 openmc.Source Distribution of phase space coordinates for source sites. openmc.VolumeCalculation Stochastic volume calculation specifications and results. openmc.Settings Settings used for an OpenMC simulation.

## Material Specification¶

 openmc.Nuclide A nuclide that can be used in a material. openmc.Element A natural element that auto-expands to add the isotopes of an element to a material in their natural abundance. openmc.Macroscopic A Macroscopic object that can be used in a material. openmc.Material A material composed of a collection of nuclides/elements. openmc.Materials MagicMock is a subclass of Mock with default implementations of most of the magic methods.

Cross sections for nuclides, elements, and materials can be plotted using the following function:

 openmc.plot_xs Creates a figure of continuous-energy cross sections for this item.

## Building geometry¶

 openmc.Plane An arbitrary plane of the form $$Ax + By + Cz = D$$. openmc.XPlane A plane perpendicular to the x axis of the form $$x - x_0 = 0$$ openmc.YPlane A plane perpendicular to the y axis of the form $$y - y_0 = 0$$ openmc.ZPlane A plane perpendicular to the z axis of the form $$z - z_0 = 0$$ openmc.XCylinder An infinite cylinder whose length is parallel to the x-axis of the form $$(y - y_0)^2 + (z - z_0)^2 = r^2$$. openmc.YCylinder An infinite cylinder whose length is parallel to the y-axis of the form $$(x - x_0)^2 + (z - z_0)^2 = r^2$$. openmc.ZCylinder An infinite cylinder whose length is parallel to the z-axis of the form $$(x - x_0)^2 + (y - y_0)^2 = r^2$$. openmc.Sphere A sphere of the form $$(x - x_0)^2 + (y - y_0)^2 + (z - z_0)^2 = r^2$$. openmc.Cone A conical surface parallel to the x-, y-, or z-axis. openmc.XCone A cone parallel to the x-axis of the form $$(y - y_0)^2 + (z - z_0)^2 = r^2 (x - x_0)^2$$. openmc.YCone A cone parallel to the y-axis of the form $$(x - x_0)^2 + (z - z_0)^2 = r^2 (y - y_0)^2$$. openmc.ZCone A cone parallel to the x-axis of the form $$(x - x_0)^2 + (y - y_0)^2 = r^2 (z - z_0)^2$$. openmc.Quadric A surface of the form $$Ax^2 + By^2 + Cz^2 + Dxy + Eyz + Fxz + Gx + Hy + Jz + K = 0$$. openmc.Halfspace A positive or negative half-space region. openmc.Intersection Intersection of two or more regions. openmc.Union Union of two or more regions. openmc.Complement Complement of a region. openmc.Cell A region of space defined as the intersection of half-space created by quadric surfaces. openmc.Universe A collection of cells that can be repeated. openmc.RectLattice A lattice consisting of rectangular prisms. openmc.HexLattice A lattice consisting of hexagonal prisms. openmc.Geometry Geometry representing a collection of surfaces, cells, and universes.

Many of the above classes are derived from several abstract classes:

 openmc.Surface An implicit surface with an associated boundary condition. openmc.Region Region of space that can be assigned to a cell. openmc.Lattice A repeating structure wherein each element is a universe.

## Constructing Tallies¶

 openmc.Filter Tally modifier that describes phase-space and other characteristics. openmc.UniverseFilter Bins tally event locations based on the Universe they occured in. openmc.MaterialFilter Bins tally event locations based on the Material they occured in. openmc.CellFilter Bins tally event locations based on the Cell they occured in. openmc.CellFromFilter Bins tally on which Cell the neutron came from. openmc.CellbornFilter Bins tally events based on which Cell the neutron was born in. openmc.SurfaceFilter Filters particles by surface crossing openmc.MeshFilter Bins tally event locations onto a regular, rectangular mesh. openmc.MeshSurfaceFilter Filter events by surface crossings on a regular, rectangular mesh. openmc.EnergyFilter Bins tally events based on incident particle energy. openmc.EnergyoutFilter Bins tally events based on outgoing particle energy. openmc.MuFilter Bins tally events based on particle scattering angle. openmc.PolarFilter Bins tally events based on the incident particle’s direction. openmc.AzimuthalFilter Bins tally events based on the incident particle’s direction. openmc.DistribcellFilter Bins tally event locations on instances of repeated cells. openmc.DelayedGroupFilter Bins fission events based on the produced neutron precursor groups. openmc.EnergyFunctionFilter Multiplies tally scores by an arbitrary function of incident energy. openmc.LegendreFilter Score Legendre expansion moments up to specified order. openmc.SpatialLegendreFilter Score Legendre expansion moments in space up to specified order. openmc.SphericalHarmonicsFilter Score spherical harmonic expansion moments up to specified order. openmc.ZernikeFilter Score Zernike expansion moments in space up to specified order. openmc.ZernikeRadialFilter Score the $$m = 0$$ (radial variation only) Zernike moments up to specified order. openmc.ParticleFilter Bins tally events based on the Particle type. openmc.RegularMesh A regular Cartesian mesh in one, two, or three dimensions openmc.RectilinearMesh A 3D rectilinear Cartesian mesh openmc.Trigger A criterion for when to finish a simulation based on tally uncertainties. openmc.TallyDerivative A material perturbation derivative to apply to a tally. openmc.Tally A tally defined by a set of scores that are accumulated for a list of nuclides given a set of filters. openmc.Tallies MagicMock is a subclass of Mock with default implementations of most of the magic methods.

## Geometry Plotting¶

 openmc.Plot Definition of a finite region of space to be plotted. openmc.Plots MagicMock is a subclass of Mock with default implementations of most of the magic methods.

## Running OpenMC¶

 openmc.run Run an OpenMC simulation. openmc.calculate_volumes Run stochastic volume calculations in OpenMC. openmc.plot_geometry Run OpenMC in plotting mode openmc.plot_inline Display plots inline in a Jupyter notebook. openmc.search_for_keff Function to perform a keff search by modifying a model parametrized by a single independent variable.

## Post-processing¶

 openmc.Particle Information used to restart a specific particle that caused a simulation to fail. openmc.StatePoint State information on a simulation at a certain point in time (at the end of a given batch). openmc.Summary Summary of geometry, materials, and tallies used in a simulation.

The following classes and functions are used for functional expansion reconstruction.

 openmc.ZernikeRadial Create radial only Zernike polynomials given coefficients and domain.
 openmc.legendre_from_expcoef Return a Legendre series object based on expansion coefficients.

Various classes may be created when performing tally slicing and/or arithmetic:

 openmc.arithmetic.CrossScore A special-purpose tally score used to encapsulate all combinations of two tally’s scores as an outer product for tally arithmetic. openmc.arithmetic.CrossNuclide A special-purpose nuclide used to encapsulate all combinations of two tally’s nuclides as an outer product for tally arithmetic. openmc.arithmetic.CrossFilter A special-purpose filter used to encapsulate all combinations of two tally’s filter bins as an outer product for tally arithmetic. openmc.arithmetic.AggregateScore A special-purpose tally score used to encapsulate an aggregate of a subset or all of tally’s scores for tally aggregation. openmc.arithmetic.AggregateNuclide A special-purpose tally nuclide used to encapsulate an aggregate of a subset or all of tally’s nuclides for tally aggregation. openmc.arithmetic.AggregateFilter A special-purpose tally filter used to encapsulate an aggregate of a subset or all of a tally filter’s bins for tally aggregation.

## Coarse Mesh Finite Difference Acceleration¶

CMFD is implemented in OpenMC and allows users to accelerate fission source convergence during inactive neutron batches. To use CMFD, the openmc.cmfd.CMFDRun class executes OpenMC through the C API, solving the CMFD system between fission generations and modifying the source weights. Note that the openmc.cmfd module is not imported by default with the openmc namespace and needs to be imported explicitly.

 openmc.cmfd.CMFDMesh A structured Cartesian mesh used for CMFD acceleration. openmc.cmfd.CMFDRun Class for running CMFD acceleration through the C API.

At the minimum, a CMFD mesh needs to be specified in order to run CMFD. Once the mesh and other optional properties are set, a simulation can be run with CMFD turned on using openmc.cmfd.CMFDRun.run().