-
Notifications
You must be signed in to change notification settings - Fork 598
Temperature feedback support in the random ray solver. #3737
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
base: develop
Are you sure you want to change the base?
Temperature feedback support in the random ray solver. #3737
Conversation
|
This is an awesome feature. It'd be nice if you could add some content to the theory and user manual on it's implementation and use :) (as well as for the cell density feature that was already merged) |
|
Good catch @yardasol! I don't know if a discussion about the cell densities / temperatures really needs to be included in the random-ray user guide, as this was a feature in CE/MG Monte Carlo which these PRs extended to the random ray solver. I think it's definitely worth adding a discussion of the temperature automagic setup though. Edit: I just realized that distributed cell temperatures and densities don't have an entry in the geometry user manual. I'll add those in a bit. |
6bb3fef to
0bb4bb4
Compare
…mber of distrib temperatures aren't the same.
0bb4bb4 to
e850220
Compare
jtramm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding in this new capability @nuclearkevin - very cool!!
I gather there are three basic things this PR does:
-
Adds temperature dependence to the MGXS library object on the python side
-
Updates the "automagic" MGXS generation routines to support automated generation of MGXS data.
-
Updates the random ray solver to actually use the temperature dependent MGXS, with the
nearestmethod.
This all sounds good and makes sense! I've annotated the code with a few minor comments.
The main thing I'm wondering about is that I had recalled that MGMC had already been able to support temperature dependence, so I was going into this assuming that the machinery for building temperature dependent libraries was already in place (i.e., (1) above). It sounds like this is not the case? What was the existing workflow for temperature dependence in MGMC before this PR?
| temperature settings used during cross section generation can be specified with the | ||
| ``temperature_settings`` parameter. If no ``temperature_settings`` are provided, | ||
| the settings contained in the model will be used. This approach yields isothermal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not clear to me what the temperature_settings parameter does - can you elaborate more on this parameters function or what the options for it are?
| def get_xsdata(self, domain, xsdata_name, nuclide='total', xs_type='macro', | ||
| subdomain=None, apply_domain_chi=False): | ||
| subdomain=None, apply_domain_chi=False, temperature=ROOM_TEMPERATURE_KELVIN): | ||
| """Generates an openmc.XSdata object describing a multi-group cross section | ||
| dataset for writing to an openmc.MGXSLibrary object. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding was that the MGMC solver was already capable of handling temperature dependence. How was it able to load in temperature dependent MGXS libraries previously? Can we use that same strategy for what we're doing with random ray/automagic without all the edits in library.py? I'm sure there is likely a good reason for this, but want to make sure I understand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous workflow in MGMC for generating multi-temperature MGXS libraries was to manually set each MGXS at each temperature data point (which results in a lot of duplicated code). The modifications in openmc.mgxs.Library and openmc.MGXSLibrary exist to decrease code duplication, since we generate isothermal temperature data points in individual libraries with the MGXS API and need to merge the individual libraries together.
In the case of the openmc.mgxs.Library, there was no way to set a temperature dependence previously. You had to go in, extract the cross section data one array at a time, and manually re-assign it to a XSdata object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is possible to do this the old way (see this commit for what that looks like). If that's preferred, I can revert to this point (though I think the ability to merge libraries with different temperature points would be useful in the future).
| temperature_settings : dict, optional | ||
| A dictionary of temperature settings to use when generating MGXS. If not | ||
| provided, the settings stored in the model will be used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to elaborate more on what this parameter does (what items are in the dictionary, or where else is it defined?).
| temperature_settings : dict | ||
| A dictionary of temperature settings to use when generating MGXS. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar comment as above regarding more explanation of this parameter
| temperature_settings : dict, optional | ||
| A dictionary of temperature settings to use when generating MGXS. If not | ||
| provided, the settings stored in the model will be used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar comment as above regarding more explanation of this parameter
| temperature_settings : dict | ||
| A dictionary of temperature settings to use when generating MGXS. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar comment as above regarding more explanation of this parameter
| temperature_settings : dict, optional | ||
| A dictionary of temperature settings to use when generating MGXS. If not | ||
| provided, the settings stored in the model will be used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar comment as above regarding more explanation of this parameter
- Also add more checks when merging MGXS temperature grids.
Description
This PR implements temperature feedback in the random ray solver using nearest interpolation (in a manner consistent to the MGMC solver). A new array slice is added to the flattened MGXS data structures which corresponds to a temperature index. Each source region computes and stores this temperature index based off of the cell (instance) temperature, allowing for per-cell temperature feedback. The implementation was tested by manually adding a new MGXS set for the south-west pin in the 2x2 random ray example which is 1/2 that of the other pins, which is used as the gold file for
tests/regression_tests/random_ray_cell_temperature. The generation of temperature-dependent cross sections is also supported in the automagic setup, where the entire model is isothermal at each temperature value in the list provided by the user. The automagic addition + tests accounts for the vast majority of the diff in this PR.This PR also fixes a bug in the MGMC solver where cell temperatures were not being queried correctly. This stopped all temperature datapoints from being correctly loaded when initializing the MGXS library at runtime.
Future work should include other temperature interpolation types for both the MGMC solver and the random ray solver. This is complicated in the random ray case due to the flattening of the cross sections to improve cache locality during source region updates.
I am not the most savvy Python programmer, so feedback regarding the additions to the Python API would be greatly appreciated!
Checklist