UQ pipeline: TMCManager, TMCStatePoint and TMCTally - #79
Merged
Conversation
Pull Request Test Coverage Report for Build 20931348909Details
💛 - Coveralls |
TCMManager, TMCStatePoint and TMCTallyTMCManager, TMCStatePoint and TMCTally
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In this PR a new version of the TMC-UQ workflow is proposed, specifically for openmc
Modelobjects.Workflow
The workflow relies on the new
TMCManager, theTMCStatePointand theTMCTallyclasses.The
TMCManagerclass takes in anopenmc.Model, a list of callables calledperturbations, a number ofrealizationsand a numpy random number generator object. The integerrealizationsspecifies the number of realizations per perturbation to run in the total monte carlo run. Perturbations are external functions, that have to be written by the user, that perturb the model, and have to have the following structure:Once the
TMCManageris instantiated , it is possile to run the tmc simulation withTMCManager.run()which takes similar arguments ofopenmc.run(). During the run the manager will build a folder structure as follows (atmc/folder withperturbation_{p}subfolders which in turn haverealization_{r}subfolders. In everyrealization_{r}subfolder there are all the information about the specificopenmcrun associated with that specificperturbationandrealization(i.e.model.xml,statepointetc.)The folder structure is saved in the
tmc_manifest.jsonlfile in the main working directory.In the main working directory there will be also the
tmc_statepointfile. It collects all the openmctalliesin xarrayDatasetadding a dimention to the classicopenmc.Tallyobject in order to stack all theperturbationandrealizationresults of the same tally.Here the folder structure:
The
TMCStatePointclass is responsible for instantiating thetmc_statepointfile. The inspection (class methods and properties) is similar to theopenmc.Statepointobject.Single tallies in the
tmc_statepointare extracted viaTMCStatepoint(...).get_tally(...)(similarly toopenmc) asTMCTallyobjects. They can be treated similar to anopenmc.Tallyobject but they have theperturbationtimesrealizationextra dimension. So, it is possible to gettally.name,TMCTally.scores,TMCTally.idinfo but theTMCTally.meanwill provide the mean of the tmc run (i.e. the mean of the single means) and theTMCTally.std_devwill provide the standard deviation of the tmc run (i.e. the std_dev of the means). To get the statistics of the single openmc runs there is theTMCTally.realization_meansandTMC.realization_std_devsthat will provide such statistics embedded in a r times p (where r is the number of realizations and p is the number of perturbations) long array.To get the most numerical information regarding the tmc run for a specific tally, there is the
TMCTally.datathat can be inspected and used.Example usage
Here an example usage with an openmc model that has a
watermaterial and gets its density perturbed.Build openmc model
Define perturbing function(s)
Instantiate and run TMC
Extract and inspect TMC results
Next steps
A possible next step is to allow the
perturbationfunctions to haveperturbation_idandnameoptions and transfer such information in thetmc_statepointfile as metadata in order to be able to slice theTMCTallyper perturbation (currently the tmc manager just adds one dimension r times p longSpefications and ofb benchmarks currently not upgraded to tmc manager
Regarding running uq on the benchmarks of this repository, currently the
specificationsand theuqmethods stick with the oldertmc_enginefunction. We will update the pipeline to theTMCManageronce it gets finalized and merged.