OpenMC tally post processing
Labeled as draft until CI is updated and I add in the power processing to convert units, but this can still be reviewed as is until then. until outstanding items are finished.
Major updates to include the logic to post process the OpenMC tallies. All tally results (except meshtally) are formatted as strings and printed to the extended summary file. Examples of what the output ends up looking like can be seen in the added test files exp_mcsim_test_tallies*.extended.summary
. The pandas dataframes from OpenMC with the tally results are provided in the user_object results. You'll note that there is not a ton of overlap in how each of the tally types (core region, assembly region, pin region, mesh, and surface) can be processed. This is due to different data being available in the dataframe results for each (different openmc filters are used for each with result in slightly different data presentation).
More specific description of how tallies are processed:
- Meshtally results are written to a VTK file. Datasets are expanded so that there is one dataset per nuclide per material per energy group and per score making the number of datasets on each mesh element equal to
N_score * N_materials * N_nuclides * N_energygroups
. - Region tallies - any region that is a part of a lattice (ie assembly and pin but not full core) are identified by their PyARC indexing (ring, index). For square lattices, this was done easily with the methods that already existed for converting grid to rings and vice versa. For the hexagonal lattices, this required a different type of mapping using the (x, alpha)/(alpha, y) indexing scheme in OpenMC.
- Surface tallies - for any surface made of multiple openmc surfaces (hexagons and squares), there is an additional identifier that gets written out that identifies which part of the square or hexagon the data corresponds to (ie +x or -x+y). See docstrings of the surface tally processing methods for full explanation (this info will be added to the tutorial eventually).
- Pin tallies if spanning multiple materials are now broken apart and identified by the material rather than number that has no meaning to the user. One pin tally per material is processed as standalone and a warning is issued to the user that the tally has been separated into different parts.
Additional changes:
Power was moved as to be a general mcsim input rather than per tally input. My thought process is that it cannot be set differently for different tallies of a single reactor (I don't think? unless it should be the power for the volume being tallied? I don't have the implementation ready to actually convert the data using the power and volume yet, but that will be coming soon.- The option to supply a power was removed for now due to how complicated it is to actually convert the units for some of these tallies. (see discussion here).
- OpenMC v0.13.3 is now the minimum version supported. This is reflected in the precheck and the setup script.
- Base conda environment also get VTK installed (from pip, conda install caused issues on my Mac) so that meshtally results can be written.
- A second conda environment is generated with the workbench conda called
openmc-plotter
which can be used to launch the openmc plotter GUI. Installing within the base environment was not working (at least not on my Mac) because the plotter wouldn't launch if the python version was too old (3.8 in the current WB env). Since it is not needed in any of the scripts and just meant to be a helper tool for visualizing tally results, I think it is fine to have it as a separate env. A scriptplot_openmc.sh
was added which can be used to launch the plotter from the correct environment. - Volume calculations now report the standard deviation as well because I figured out how that can be retrieved from the hdf5 results.
- README updated with new install information and results object.
-
Bug fixes:
- The grid-to-ring and vice-versa indexing schemes assumed OpenMC indexing started in the upper left. It actually starts in the lower left as (0, 0). The methods have been fixed to reflect that (basically just moving the other direction through the rings).
- PyARC.py - the
tallies.out
file is already covered by the.out
ending in the lines above so that file was being zipped twice. Line was removed to avoid that. - I had previously hardcoded the working directory path into the settings, but that caused issues when trying to open the results in the OpenMC plotter. OpenMC was looking for the summary file in the temporary directory that doesn't exist after running. Removed the hardcoded path and it did not seem to affect how it runs.
- Installing VTK causes the encoding/decoding of text files to be finicky for DASSH and Griffin. I added explicit encoding instructions were possible. See discussion here.
Outstanding:
-
Process with power to get different units on results -
Update README -
Add tallies to tutorial -
Ensure CI is updated with at least v0.13.3 in order to run -
Update changelog