-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Addition of a tally system and [Tallies]
block
#931
Conversation
Still several bugs to squash
Awesome!! I'm also requesting a review from @pshriwise to get his feedback on this. |
Job Documentation on 112309d wanted to post the following: View the site here This comment will be updated on new commits. |
How are the tallies normalized when we have > 1? I see there's a new parameter, |
The default at the moment is that tallies are normalized by a single global tally. If there is a mismatch between the global estimator and the estimators in the added tallies, the user is warned (lines 2727 to 2760 in My thought process at the time was to leave it up to the user on how they want their different tallies to get normalized. Thinking about it now, it would make more sense to set the default to normalizing by the local tallies due to this change. |
Thanks @nuclearkevin! I think there's just one last item which occurred to me. It might be complicated. We populate the If so, I think you'd be able to detect this using the Can you please test this out and see what happens? |
@aprilnovak It looks like the cell volume reported by the Postprocessor Values (single
Postprocessor Values (two
Also adding this to |
Which |
Yep, I used |
Great! This looks good-to-go. I'm just going to do a local checkout and run some of the tests, see if I can think of other error checks which may be missing. @pshriwise how would you prefer to handle the timing of this PR in contrast to #923? #923 is for a GAIN project which has a close-out approaching soon, so I'll defer to Patrick on what order we should merge these in order to minimize any schedule delays with GAIN. |
Looks like each of the test gold files is rather large. Can we test this equivalently using just 1 pebble, instead of 3 with the |
Single pebble instead of three.
Updated the tests. The only major change is that moving to a single pebble requires |
Was |
Oh, I should've been more explicit. This is for tests that include |
oh gotcha! How about we do this -- let's actually keep all 3 pebbles for the cell tests, since they would catch anything going wrong with instancing. But instead of an exodiff test, for those we can easily do a CSVDiff ( |
|
efbbda3
to
73fae49
Compare
Sorry for the kind of piecemeal review process, but another thought came to mind. Can we consolidate some of the duplicate behavior in |
No worries! It's a rather large PR that was submitted near the end of the summer, it was destined to take a while to review. I could move the I don't know if I can really move the functionality in |
That sounds like a good plan to me - I don't anticipate we'd be able to move absolutely everything, I'll trust your judgement on what makes sense to consolidate into the base class (a few obvious places stood out to me, which you've touched on). |
Addressing @aprilnovak's review
Job Precheck on 72072c6 wanted to post the following: Your code requires style changes. A patch was auto generated and copied here
Alternatively, with your repository up to date and in the top level of your repository:
|
Reason
This PR implements a new tally system and an associated block in Cardinal's input syntax based on a discussion with @aprilnovak (ref. #922). This allows for the addition of multiple different tallies at once which have different scores, an example of which can be found below (tests/neutronics/tally_system/multi_diff.i):
This is advantageous if different spatial filters are required for different scores. This PR will also (hopefully) make it easier to add new filters in the future (such as an
EnergyFilter
) without requiring the user to manually post-process tallies in the input file when they don't need certain scores binned according to a new filter.Design
The new tally system adds the following new objects:
TallyBase
: A class which wraps a single OpenMC tally to provide common data types and virtual functions required by spatially dependant tallies.TallyBase
classes are constructed by anOpenMCCellAverageProblem
through theaddTallyObject(...)
function, which mirrors how MOOSE handlesMooseObject
construction inFEProblemBase
. The virtual functions that must be overloaded by derived tallies (CellTally
andMeshTally
) are:initializeTally(...)
: A function where derived tallies can implement functionality required to initialize an OpenMC tally. Called by theOpenMCCellAverageProblem
ininitializeTallies(...)
.resetTally(...)
: A function where derived tallies can implement functionality required to reinit an OpenMC tally. Called by theOpenMCCellAverageProblem
inresetTallies(...)
.storeResults(...)
: A function where derived tallies can store their tally results in a field auxvariable. Called by theOpenMCCellAverageProblem
insyncSolutions(...)
.storeExternalResults(...)
: A function where derived tallies can store other requested tally results (unrelaxed / unrelaxed standard deviation) in a field auxvariable. Called by theOpenMCCellAverageProblem
insyncSolutions(...)
.CellTally
: A class derived fromTallyBase
which implements distributed cell tallies. Replaces the functionality oftally_type = cell
in theOpenMCCellAverageProblem
.MeshTally
: A class derived fromTallyBase
which implements unstructured mesh tallies that may also be translated in space. Replaces the functionality oftally_type = mesh
in theOpenMCCellAverageProblem
.AddTallyAction
: AnAction
which is responsible for addingTallyBase
objects to anOpenMCCellAverageProblem
. This action callsaddTallyObject(...)
when the simulation reaches the newadd_tallies
task during execution.CellTally
, a single tally object is added.MeshTally
, multiple tally objects may be added if the user specifies mesh translations. These multiple tallies all accumulate in the same set of auxvariables.Multiple tallies of the same type are allowed by this system so long as they do not share scores. In general, multiple tally objects that share scores are not allowed as it becomes difficult to normalize the tallies due to possible bin overlap.
At present time this new system is NOT backwards compatible with previous versions of Cardinal. Attempting to use an input deck where a single tally is added in the
[Problem]
block will result in an error telling the user to use the[Tallies]
block. If backwards compatibility is desirable, I can emulate the old system by havingOpenMCCellAverageProblem
add anAddTallyAction
in it's constructor with the input parameters of the required tally.Impact
OpenMCCellAverageProblem
and decreases the overall complexity of the class.Other
This PR is unfortunately quite large due to the need to update the input syntax for every tutorial and test. None of the tests required re-golding, so I don't believe updating the syntax will cause any CI/CD related issues. The documentation website has also been updated to reflect the new system (including the tutorial explanations). I believe that I caught every reference of the old system, but if I missed something please let me know and I'll get it changed over.