-
Notifications
You must be signed in to change notification settings - Fork 525
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
Ignoring nuclides with no xs data when writing material xml files #2800
base: develop
Are you sure you want to change the base?
Conversation
from openmc.mgxs import GROUP_STRUCTURES | ||
from openmc.data import REACTION_MT | ||
import openmc | ||
from .abc import change_directory | ||
from .chain import Chain, REACTIONS | ||
from .coupled_operator import _find_cross_sections |
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.
from .coupled_operator import _find_cross_sections |
@@ -91,7 +91,7 @@ def get_microxs_and_flux( | |||
reactions = chain.reactions | |||
if not nuclides: | |||
cross_sections = _find_cross_sections(model) | |||
nuclides_with_data = _get_nuclides_with_data(cross_sections) | |||
nuclides_with_data = get_nuclides_with_data(cross_sections) |
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.
nuclides_with_data = get_nuclides_with_data(cross_sections) | |
nuclides_with_data = _get_nuclides_with_data(cross_sections) |
@@ -15,6 +15,7 @@ | |||
from openmc.checkvalue import check_value | |||
from openmc.exceptions import DataError | |||
from openmc.mpi import comm | |||
from openmc import get_nuclides_with_data |
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.
I think get_nuclides_with_data is now called _get_nuclides_with_data. Also perhaps this does not need importing as I see an abstract method in the openmc_operator file
@@ -148,16 +149,12 @@ def __init__( | |||
# for which there is an entry in the micro_xs parameter | |||
openmc.reset_auto_ids() | |||
|
|||
self.nuclides_with_data = self._get_nuclides_with_data( | |||
self.cross_sections) | |||
self.nuclides_with_data = get_nuclides_with_data(self.cross_sections) |
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.
self.nuclides_with_data = get_nuclides_with_data(self.cross_sections) | |
self.nuclides_with_data = _get_nuclides_with_data(self.cross_sections) |
Description
Adding an
ignore_phantom_nuclides
argument toMaterials.export_to_xml
,Model.export_to_xml
andModel.export_to_model_xml
(andModel.run
). This allows a user to automatically ignore nuclides that have no cross-sections when writing xml files. A typical usecase is running an eigenvalue calculation on a depleted material. This new argument is set toFalse
by default.A first implementation of this was available when using
OpenMCOperator
to start depletion from existing depleted materials, this PR refactors it to allow static calculations as well. In particular the_get_nuclides_with_data
function was moved from theOpenMCOperator
subclasses to the material.py file.A warning message was also added to inform the user about the percentage of mass density lost when ignoring these nuclides, a high number would be problematic for the calculation's accuracy but this should not be the case for most practical uses.
This feature was discussed with @pshriwise during the last OpenMC community call. This is my first non trivial PR, so any feedback is of course much appreciated.
Example script
Here is a minimal working script showcasing the feature:
Checklist