-
Notifications
You must be signed in to change notification settings - Fork 503
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
Pincell Maker #2608
Open
sreegudala
wants to merge
30
commits into
openmc-dev:develop
Choose a base branch
from
sreegudala:pincell_maker
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Pincell Maker #2608
Conversation
This file contains 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
… have a different division type
@sreegudala Thanks for this pull request! This looks like a useful functionality to have. Would you be willing to split this up into two PRs, one that touches only the existing functionality (CylinderSector, etc.) and then a follow-on one with the new |
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.
As OpenMC does not yet contain a cylindrical lattice geometry abstraction, certain subdivisions of typical light water reactor pincells must be done manually by the user when defining their inputs. While a helper function in the python interface (pin()) exists to aid with simple radial subdivision of pincells, that function does not allow azimuthal subdivision, and does not easily allow subdivision of the external moderator region. Furthermore, the pin() function generates new Material objects for each subdivided region, which can be highly inefficient if the different regions are sharing material data.
There are a few use cases where a more robust helper function would be desirable:
This function accommodates the above two use cases. It allows a user to define a typical light water reactor pincell in terms of a series of surfaces (e.g., fuel radius, gap radius, clad radius) and fills for each region between the inputted surfaces. This function can also automatically subdivide each region into a variable number of radial sub-regions and azimuthal sectors. The function also defines an "implicit complement" region that spans all space outside of the outermost cylinder passed in, which itself can be subdivided azimuthally.
Theoretically, the pin() function could have been edited to accommodate these other types of use cases, rather than creation of a new function. However, doing so may have likely involved changing the API and behavior of that function (which would have broken any existing input decks using pin()). As such, the new function was built to be standalone.
Some of the internal python helper functions were edited to make them more efficient. They were edited so as not to break their APIs or any dependent functionality, so those changes are not expected to break any input decks. Changes to those functions (and the reasons motivating those changes) are detailed below:
CylinderSector Class in openmc/model/surface_composite.py:
CylinderSector objects were used to create the azimuthal sectors in the pin_radial_azimuthal function. This function takes two radii and two angles to create a region defined by two cylindrical and two planar surfaces. In the original function, there were some unnecessary or redundant surfaces being created. Most of the changes were to reduce the surfaces created to the absolute minimum amount necessary.
subdivide() function in openmc/model/funcs.py:
The subdivide function allowed regions to be constructed from a set of surfaces “in order.” The original function was built to create regions bounded by Cylinders. This was updated to also handle CylinderSectors.
An example of the new pin_radial_azimuthal function for defining the standard PWR pincell available at openmc/examples/pincell is given below:
Original code:
New code that uses helper function:
Plots of the pincell geometry using the new helper function (before and after subdivision) are shown below:
Before subdivision:
After subdivision:
As a larger test, we also coded a 2D C5G7 input deck, which is available at:
https://github.com/sreegudala/benchmarks/blob/master/c5g7/openmc/2d/build-xml-2d.py
C5G7 as defined with the new method generates the expected number of cells and runs cleanly. Beyond being much easier to read and maintain, the new C5G7 definition allows for fewer surfaces to be defined, as older methods for defining these types of azimuthal subdivision often resulted in twice the number of planes being generated as were necessary. The new helper method is notable in that the minimum number of planes are defined.
Plots of the native and subdivided C5G7 geometry (with subdivision typical of what is required for random ray) are given below:
Native C5G7 plot:
Subdivided C5G7 plot:
A new regression test was also added to the OpenMC test suite that covers the function. The test is found at openmc/test/regression_tests/pin_radial_azimuthal.