Allowing multiple cells in surface source banking#3832
Open
MohamedElkamash wants to merge 19 commits intoopenmc-dev:developfrom
Open
Allowing multiple cells in surface source banking#3832MohamedElkamash wants to merge 19 commits intoopenmc-dev:developfrom
MohamedElkamash wants to merge 19 commits intoopenmc-dev:developfrom
Conversation
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.
Description
Currently, the
surf_source_writesetting allows the use of thecell,cellfrom, orcelltoparameters to filter particles banked in the surface source. Recently, there has been interest in extending this behavior to allow filtering by multiple cells instead of a single cell. The main objective of this development is to enable filtering by multiple cells, where each cell can have an associated direction: "to", "from", or "both".Motivation
In the simple model shown below, we are interested in banking particles that cross surfaces 2, 4, 9, or 10 and enter either cell 6 or cell 7. This behavior cannot be achieved with the current design because the
celltoparameter accepts only a single cell ID.New feature
A new
cellsargument has been added to thesurf_source_writesetting to allow specifying multiple cells for particle banking. An optionaldirectionsargument can be provided to define the corresponding direction for each cell listed incells. Ifdirectionsis not specified, the default behavior is "both" for every cell in cells. For example, the case above can now be implemented as:Handling duplicate cells
Although duplicate entries in
cellsare discouraged (since equivalent behavior can typically be expressed using "both"), they are handled safely. If duplicate cell entries are provided with different directions, their directions are combined using a union rule. For example:is equivalent to:
Tests
Two regression tests were added based on the model described above:
Verifies that filtering by multiple cells produces the same result as summing the results of individual simulations. Specifically, the number of particles entering cell 6 in one simulation plus the number entering cell 7 in a second simulation is equal to the number of particles entering cells 6 and 7 in a single simulation.
Verifies that different duplicate combinations in
cellsproduce identical surface source outputs when their effective directions are equivalent.Backward compatibility
The original syntax (
cell,cellto,cellfrom) remains fully supported. However, it cannot be used simultaneously with the new syntax (cellsanddirections). If both syntaxes are provided, an error is raised.Additional changes
Previously, the logic for rejecting surfaces from being added to the surface source bank was partially implemented in the
Surfaceconstructor and partially during the simulation, depending on whethersurface_idswas specified. This logic has now been fully moved to theSurfaceconstructor.Checklist