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.

Ways to run and post-process

Explore different ways to run an OpenMC model, continue simulations, and retrieve tally results.

Ways to run and post-process
├── 0. Run from the command line
├── 1. Load and plot
├── 2. Restart / continue
├── 3. Run again with `apply_tally_results=True`
├── 4. Retrieve tallies without opening a `StatePoint`
└── 5. Post-process

0. Run from the command line

The simulation can be run directly from the directory containing model.xml, without rebuilding the model in Python:

OPENMC_CROSS_SECTIONS="/full/path/to/endf-b8.1/cross_sections.xml" openmc

1. Load and plot

<Figure size 774.194x779.221 with 1 Axes>

2. Restart / continue

OpenMC’s restart capability is similar to MCNP’s CONTINUE. It resumes from a saved statepoint and retains the accumulated tally statistics. The run in 4_0_breeder_tritium_neutron_maps.ipynb uses a 1% relative-error trigger for Li-7 (n,Xt) production. Here, we tighten the threshold by a factor of 2 (to 0.5%) and restart from its statepoint.

                                %%%%%%%%%%%%%%%
                           %%%%%%%%%%%%%%%%%%%%%%%%
                        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                      %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                                    %%%%%%%%%%%%%%%%%%%%%%%%
                                     %%%%%%%%%%%%%%%%%%%%%%%%
                 ###############      %%%%%%%%%%%%%%%%%%%%%%%%
                ##################     %%%%%%%%%%%%%%%%%%%%%%%
                ###################     %%%%%%%%%%%%%%%%%%%%%%%
                ####################     %%%%%%%%%%%%%%%%%%%%%%
                #####################     %%%%%%%%%%%%%%%%%%%%%
                ######################     %%%%%%%%%%%%%%%%%%%%
                #######################     %%%%%%%%%%%%%%%%%%
                 #######################     %%%%%%%%%%%%%%%%%
                 ######################     %%%%%%%%%%%%%%%%%
                  ####################     %%%%%%%%%%%%%%%%%
                    #################     %%%%%%%%%%%%%%%%%
                     ###############     %%%%%%%%%%%%%%%%
                       ############     %%%%%%%%%%%%%%%
                          ########     %%%%%%%%%%%%%%
                                      %%%%%%%%%%%

                 | The OpenMC Monte Carlo Code
       Copyright | 2011-2026 MIT, UChicago Argonne LLC, and contributors
         License | https://docs.openmc.org/en/latest/license.html
         Version | 0.16.0
     Commit Hash | 617d35a5063c57796b43428bc401e627d2011046
       Date/Time | 2026-11-06 19:49:38
  OpenMP Threads | 16

 Reading model XML file 'model.xml' ...
 Reading cross sections XML file...
 Reading Pb204 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Pb204.h5
 Reading Pb206 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Pb206.h5
 Reading Pb207 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Pb207.h5
 Reading Pb208 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Pb208.h5
 Reading Li6 from /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Li6.h5
 Reading Li7 from /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Li7.h5
 Reading Cr50 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Cr50.h5
 Reading Cr52 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Cr52.h5
 Reading Cr53 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Cr53.h5
 Reading Cr54 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Cr54.h5
 Reading W180 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/W180.h5
 Reading W182 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/W182.h5
 Reading W183 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/W183.h5
 Reading W184 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/W184.h5
 Reading W186 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/W186.h5
 Reading Mn55 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Mn55.h5
 Reading V50 from /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/V50.h5
 Reading V51 from /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/V51.h5
 Reading Ta180_m1 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Ta180_m1.h5
 Reading Ta181 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Ta181.h5
 Reading C12 from /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/C12.h5
 Reading C13 from /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/C13.h5
 Reading Ti46 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Ti46.h5
 Reading Ti47 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Ti47.h5
 Reading Ti48 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Ti48.h5
 Reading Ti49 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Ti49.h5
 Reading Ti50 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Ti50.h5
 Reading N14 from /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/N14.h5
 Reading N15 from /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/N15.h5
 Reading Fe54 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Fe54.h5
 Reading Fe56 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Fe56.h5
 Reading Fe57 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Fe57.h5
 Reading Fe58 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Fe58.h5
 Minimum neutron data temperature: 294 K
 Maximum neutron data temperature: 294 K
 Preparing distributed cell instances...
 Writing summary.h5 file...
 Maximum neutron transport energy: 20000000 eV for Pb207
 Loading state point ../output_0/statepoint.010.h5...
 Resuming simulation...

 ===============>     FIXED SOURCE TRANSPORT SIMULATION     <===============

 Simulating batch 11
 Simulating batch 12
 Simulating batch 13
 Simulating batch 14
 Simulating batch 15
 Simulating batch 16
 Simulating batch 17
 Simulating batch 18
 Simulating batch 19
 Simulating batch 20
 Triggers unsatisfied, max unc./thresh. is 1.3462663204335088 for (n,Xt) in
 tally 2
 Creating state point statepoint.020.h5...
 Simulating batch 21
 Simulating batch 22
 Simulating batch 23
 Simulating batch 24
 Simulating batch 25
 Simulating batch 26
 Simulating batch 27
 Simulating batch 28
 Simulating batch 29
 Simulating batch 30
 Triggers unsatisfied, max unc./thresh. is 1.0100134329820314 for (n,Xt) in
 tally 2
 Simulating batch 31
 Simulating batch 32
 Simulating batch 33
 Simulating batch 34
 Simulating batch 35
 Simulating batch 36
 Simulating batch 37
 Simulating batch 38
 Simulating batch 39
 Simulating batch 40
 Triggers satisfied for batch 40
 Creating state point statepoint.040.h5...

 =======================>     TIMING STATISTICS     <=======================

 Total time for initialization     = 1.7341e+00 seconds
   Reading cross sections          = 1.7289e+00 seconds
 Total time in simulation          = 1.1998e+01 seconds
   Time in transport only          = 1.1989e+01 seconds
   Time in active batches          = 1.1998e+01 seconds
   Time accumulating tallies       = 5.3616e-03 seconds
   Time writing statepoints        = 3.6722e-03 seconds
 Total time for finalization       = 1.4806e-03 seconds
 Total time elapsed                = 1.3737e+01 seconds
 Calculation Rate (active)         = 8334.47 particles/second

 ============================>     RESULTS     <============================

 Leakage Fraction            = 0.05256 +/- 0.00041

PosixPath('/Users/marychin/Downloads/output_1/statepoint.040.h5')

3. Run again with apply_tally_results=True

Use a different seed for an independent run. The tightened trigger and increased minimum batch count from section 2 remain in effect. OpenMC saves the tallies in the statepoint as usual and, with apply_tally_results=True, also loads the results into the model’s tally objects.

                                %%%%%%%%%%%%%%%
                           %%%%%%%%%%%%%%%%%%%%%%%%
                        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                      %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                                    %%%%%%%%%%%%%%%%%%%%%%%%
                                     %%%%%%%%%%%%%%%%%%%%%%%%
                 ###############      %%%%%%%%%%%%%%%%%%%%%%%%
                ##################     %%%%%%%%%%%%%%%%%%%%%%%
                ###################     %%%%%%%%%%%%%%%%%%%%%%%
                ####################     %%%%%%%%%%%%%%%%%%%%%%
                #####################     %%%%%%%%%%%%%%%%%%%%%
                ######################     %%%%%%%%%%%%%%%%%%%%
                #######################     %%%%%%%%%%%%%%%%%%
                 #######################     %%%%%%%%%%%%%%%%%
                 ######################     %%%%%%%%%%%%%%%%%
                  ####################     %%%%%%%%%%%%%%%%%
                    #################     %%%%%%%%%%%%%%%%%
                     ###############     %%%%%%%%%%%%%%%%
                       ############     %%%%%%%%%%%%%%%
                          ########     %%%%%%%%%%%%%%
                                      %%%%%%%%%%%

                 | The OpenMC Monte Carlo Code
       Copyright | 2011-2026 MIT, UChicago Argonne LLC, and contributors
         License | https://docs.openmc.org/en/latest/license.html
         Version | 0.16.0
     Commit Hash | 617d35a5063c57796b43428bc401e627d2011046
       Date/Time | 2026-11-06 19:49:52
  OpenMP Threads | 16

 Reading model XML file 'model.xml' ...
 Reading cross sections XML file...
 Reading Pb204 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Pb204.h5
 Reading Pb206 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Pb206.h5
 Reading Pb207 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Pb207.h5
 Reading Pb208 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Pb208.h5
 Reading Li6 from /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Li6.h5
 Reading Li7 from /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Li7.h5
 Reading Cr50 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Cr50.h5
 Reading Cr52 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Cr52.h5
 Reading Cr53 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Cr53.h5
 Reading Cr54 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Cr54.h5
 Reading W180 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/W180.h5
 Reading W182 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/W182.h5
 Reading W183 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/W183.h5
 Reading W184 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/W184.h5
 Reading W186 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/W186.h5
 Reading Mn55 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Mn55.h5
 Reading V50 from /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/V50.h5
 Reading V51 from /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/V51.h5
 Reading Ta180_m1 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Ta180_m1.h5
 Reading Ta181 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Ta181.h5
 Reading C12 from /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/C12.h5
 Reading C13 from /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/C13.h5
 Reading Ti46 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Ti46.h5
 Reading Ti47 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Ti47.h5
 Reading Ti48 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Ti48.h5
 Reading Ti49 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Ti49.h5
 Reading Ti50 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Ti50.h5
 Reading N14 from /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/N14.h5
 Reading N15 from /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/N15.h5
 Reading Fe54 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Fe54.h5
 Reading Fe56 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Fe56.h5
 Reading Fe57 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Fe57.h5
 Reading Fe58 from
 /Users/marychin/gitlabcode/power/data/endf-b8.1/neutron/Fe58.h5
 Minimum neutron data temperature: 294 K
 Maximum neutron data temperature: 294 K
 Preparing distributed cell instances...
 Writing summary.h5 file...
 Maximum neutron transport energy: 20000000 eV for Pb207

 ===============>     FIXED SOURCE TRANSPORT SIMULATION     <===============

 Simulating batch 1
 Simulating batch 2
 Simulating batch 3
 Simulating batch 4
 Simulating batch 5
 Simulating batch 6
 Simulating batch 7
 Simulating batch 8
 Simulating batch 9
 Simulating batch 10
 Simulating batch 11
 Simulating batch 12
 Simulating batch 13
 Simulating batch 14
 Simulating batch 15
 Simulating batch 16
 Simulating batch 17
 Simulating batch 18
 Simulating batch 19
 Simulating batch 20
 Triggers satisfied for batch 20
 Creating state point statepoint.020.h5...

 =======================>     TIMING STATISTICS     <=======================

 Total time for initialization     = 1.8584e+00 seconds
   Reading cross sections          = 1.8535e+00 seconds
 Total time in simulation          = 8.5954e+00 seconds
   Time in transport only          = 8.5895e+00 seconds
   Time in active batches          = 8.5954e+00 seconds
   Time accumulating tallies       = 3.5843e-03 seconds
   Time writing statepoints        = 2.1738e-03 seconds
 Total time for finalization       = 1.3318e-03 seconds
 Total time elapsed                = 1.0458e+01 seconds
 Calculation Rate (active)         = 23268.2 particles/second

 ============================>     RESULTS     <============================

 Leakage Fraction            = 0.05368 +/- 0.00059

PosixPath('/Users/marychin/Downloads/output_2/statepoint.020.h5')

4. Retrieve tallies without opening a StatePoint

Create a dictionary of every tally in the model, indexed by name. The results are already attached after apply_tally_results=True.

['(n,Xt)', 'Li7_(n,Xt)_convergence', 'fluence_r_E', 'fluence_n_Xt_r']

5. Post-process

We can now proceed to the tally analysis in section 8 of 4_0_breeder_tritium_neutron_maps.ipynb, without opening the statepoint explicitly. Only the first two cells are repeated here.

Li-7 (n,Xt) relative error: 0.470%
Convergence threshold:    0.500%
Tally ID = 1 Name = (n,Xt) Filters = CellFilter Nuclides = Pb204 Pb206 Pb207 Pb208 Li6 Li7 total Scores = ['(n,Xt)'] Estimator = None Multiply dens. = True
Loading...