Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Survey ways to plot cross sections with OpenMC

Survey three ways to plot continuous-energy cross sections in OpenMC: plot_xs(), calculate_cexs(), and direct access to HDF5 data.

Survey ways to plot cross sections with OpenMC
├── Lithium: a candidate for tritium breeding
├── 1. `openmc.plot_xs()`
├── 2. `openmc.calculate_cexs()`
├── 3. `openmc.data.IncidentNeutron.from_hdf5()`
│   ├── Inspect `xs_data`
│   └── Extract barns from `xs_data`
├── Motivation for lithium enrichment
└── Comparison of the three plotting methods

Plot triton-production cross sections (MT=205, (n,Xt)) of Li6 and Li7 using the same ENDF/B-VIII.1 library at 294 K. The three approaches differ mainly in how much control they give over the data and plotting.

Lithium: a candidate for tritium breeding

D-T fusion reactors need tritium as part of the fuel mix. Tritium is scarce in nature. Tritium production is therefore critical. Lithium is a leading candidate for tritium breeding. Among other factors, the tritium-breeding potential of natural lithium depends on the isotopic abundances of Li6 and Li7 and their energy-dependent (n,Xt) cross sections. Energies of particular interest are:

  • ~0.025 eV, for thermal neutrons;

  • 14 MeV, for neutrons emerging from
    D + T →α\rightarrow \alpha (3.52 MeV) + n (14.06 MeV).

MT 205 (n,Xt) includes

  • MT 105 (n,t);

  • MT 33 (n,nt).

[('Li6', 0.07589), ('Li7', 0.92411)]

1. openmc.plot_xs()

The shortest route: OpenMC calculates and plots the cross sections. Matplotlib can still be used to customize the axes.

<Figure size 400x400 with 1 Axes>

2. openmc.calculate_cexs()

Obtain the energy grid (in eV) and cross-section arrays (in barns), then plot them yourself with Matplotlib.

<Figure size 400x400 with 1 Axes>

3. openmc.data.IncidentNeutron.from_hdf5()

Read the tabulated cross sections directly from the HDF5 library. Here, each reaction’s xs is an openmc.data.Tabulated1D object. Unlike the preceding approaches, the temperature entry is selected explicitly.

Function returns an openmc.data.Tabulated1D object.

<Figure size 400x400 with 1 Axes>

Inspect xs_data

The following cells examine xs_data from the last iteration above (Li7):

  • interpolation gives the interpolation codes;

  • breakpoints marks the ends of interpolation regions.

array([2])
{1: 'histogram', 2: 'linear-linear', 3: 'linear-log', 4: 'log-linear', 5: 'log-log'}
array([865])

Extract barns from xs_data

A Tabulated1D object can be called like a function. The input energy is in eV; the returned cross section is in barns.

array([9.43733919e+02, 2.60000000e-02])
array([0. , 0.302352])

Motivation for lithium enrichment

(np.float64(47184.62), np.float64(0.3805))
array([3.1454 , 3.2 , 3.3 , 3.331563, 3.4 ])

The neutron multiplication characteristics of Li6 and Li7 will be explored not in the next notebook.

Comparison of the three plotting methods

MethodMicroscopic XSMacroscopic XSMain advantage
openmc.plot_xs()YesYes, using openmc.MaterialQuick plotting with minimal code
openmc.plotter.calculate_cexs()YesYes, using openmc.MaterialAccess to calculated arrays for custom plotting and analysis
openmc.data.IncidentNeutron.from_hdf5()YesRequires manual mixingDirect access to tabulated nuclear data and interpolation metadata

The first two methods support macroscopic cross sections directly, accounting for material composition and atomic number densities. The third provides microscopic cross sections for individual nuclides. Constructing macroscopic cross sections would require manual mixing,

Σr(E)=∑iNiσi,r(E).\Sigma_r(E) = \sum_i N_i \sigma_{i,r}(E).

Manual mixing is generally not recommended for practical applications, but can be useful for educational exercises and verification.