-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add variable to specify ZAID-format #187
Conversation
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.
Hi @yardasol. Great work! I think this really adds some good flexibility to SaltProc to use any of these ZAID conventions. I have a few questions for you. I did not look at the two files in your note to reviewers, but can do that if necessary.
In your test suite, it looks like you test converting MCNP or NNDC conventions to Serpent convention. Do the functions only go in that direction? Or do they do Serpent to MCNP/NNDC as well?
"pattern": "^(.\\/)*(.*)$"} | ||
"pattern": "^(.\\/)*(.*)$"}, | ||
"zaid_convention": { | ||
"description": "ZAID naming convention for nuclide codes. 'serpent': The third digit in ZA for nuclides in isomeric states is 3 (e.g. 47310 for for Ag-110m). 'mcnp': ZA = Z*1000 + A + (300 + 100*m). where m is the mth isomeric state (e.g. 47510 for Ag-110m). 'nndc': Identical to 'mcnp', except Am242m1 is 95242 and Am242 is 95642", |
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'm curious why you included NNDC in this, when it looks like your stuff just uses Serpent and OpenMC.
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.
NNDC provides cross section libraries using their own ZAID convention for metastable nuclides. It is slightly different than the convention used by cross section libraries shipped with MCNP. Notice that this variable only appears in the depcode
object if codename
is serpent
. This is because Serpent uses ZAID codes to get cross section data for nuclides. This variable has no effect on how OpenMC will handle it's XS libraries, as that is all internally consistent within OpenMC.
if self.zaid_convention == 'mcnp' and nuc_code in (95242, 95642): | ||
if nuc_code == 95242: | ||
nuc_code = 95642 | ||
else: | ||
nuc_code = 95242 |
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.
Based on your documentation I thought 95642 was for the NNDC ZAIDs, not the OpenMC ones. This function makes it seem the opposite.
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.
This has nothing to do with OpenMC. It is all about where the nuclide cross section data is sourced from, since their ZAIDs will have slightly different conventions for metastable isotopes. This is a bit confusing so I'm going to go through this step-by-step.
- Recall that the standard
nndc
convention is identical to themcnp
convention, except in the case of Am-242 and Am-242m. Themcnp
convention for ZAIDs of metastable isotopes is ZA = Z * 1000 + (A + 300 + 100*m). This means that Ag-110m has ZA = 47510, and Am-242m has ZA = 95642. In thenndc
convention, for whatever reason, the ZA for Am-242m and Am242 are swapped, so ZA(Am242) = 95642, and ZA(Am242m) = 95242. - PyNE's
nucname
module contains functions for handling ZAID codes. One such function isnucname.mcnp_to_id
, which converts the ZAID code inmcnp
convention to PyNEs internal id format. However, during testing, I noticed that this function actually converts ZAID codes innndc
convention! That is, will convert95242
to952420001
, and95642
to952420000
, but convert everything else normally. So if we are using themcnp
convention, we'll need to input the wrong ZAID code to get the right PyNE id. Does that make sense?
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.
That all mostly makes sense (I meant to say MCNP, but had OpenMC on my mind when I made the comment, apologies). Just to make sure I understand this correctly:
In MCNP:
- Am242 = 95242
- Am242m = 95642
In NNDC: - Am242 = 95642
- Am242m = 95242.
Your function here says that if you are using MCNP and you give it 95242 (Am242 in MCNP), then it converts it to 95642 (Am242m in MCNP). If you give it 95642 (Am242m in MCNP), then it converts it to 95242 (Am242). So that gets switched. This assumes that you are providing NNDC nomenclature and trying to use MCNP. What if you are using MCNP nomenclature already and don't need to switch it?
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.
You have the first right.
This assumes that you are providing NNDC nomenclature and trying to use MCNP. What if you are using MCNP nomenclature already and don't need to switch it?
The reason we do the swap is because PyNE assumes an nndc
format for nucname.mcnp_to_id
and other mcnp-related functions. That is, there is a discrepancy between our understanding of the mncp
convention and what PyNE's understanding of the mcnp
convention. PyNE's mcnp
convention is equivalent to our nndc
convention. So if we want to use our mcnp
convention, we have to swap the ZAIDs for Am242 and Am242m that we input into the mcnp-related functions in PyNE to get the correct outputs (ZAIDs and nuclide names).
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.
That makes sense. I'm making sure that there is no situation in which these ZAIDs would be switched when they don't have to be.
assert nuc_code_map[380880] == '38088.82c' | ||
assert nuc_code_map[962400] == '96240.82c' | ||
assert nuc_code_map[952421] == '95642.82c' | ||
assert nuc_code_map[952420] == '95242.82c' | ||
assert nuc_code_map[471101] == '47510.82c' |
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.
This seems to imply a material temperature. Based on the later assertions, I don't think this always happens. Does it just happen with these nuclides? What causes this? Can the user change the temperature?
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'm not sure what you're question is. Can you be more specific?
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 .82c
ending to these ZAIDs indicates a temperature of the material, doesn't it? If it doesn't, then what does it mean? The assertions you test later in this test don't have the ending, so it clearly isn't applied to all ZAIDs.
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 .82c ending to these ZAIDs indicates a temperature of the material, doesn't it?
Correct.
The assertions you test later in this test don't have the ending, so it clearly isn't applied to all ZAIDs.
Some nuclides are decay-only, i.e. they don't have cross-section 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.
Where exactly does the .82c
come from, are you specifying a temperature somewhere? Is that a default? How will a user know what the material temperature is?
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.
But within your code, where does the .82c
come from? Where does that get set? Does the user define it? Will is always be .82c
or can the user change that by specifying a temperature?
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.
For the specific tests I added, these values are pulled from the .out
files in tests/serpent_data/
. When actually running SaltProc, Serpent creates this file. You can read about it here.
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.
User's specify their material temperatures entirely in their Serpent input files based on the data library they are using.
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.
So when a user is running SaltProc, they can specify the material temperatures, then SaltProc create the serpent output file as needed. Correct? And there is documentation on how a user specifies the material temperature? I want to make sure that SaltProc/Serpent will get and use cross section data for the correct temperature that the user wants.
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.
So when a user is running SaltProc, they can specify the material temperatures, then SaltProc create the serpent output file as needed. Correct?
Yes, but all the temperature specification happens in the Serpent material and input files.
And there is documentation on how a user specifies the material temperature? I want to make sure that SaltProc/Serpent will get and use cross section data for the correct temperature that the user wants.
It's out of scope for SaltProc to tell people how to get cross section libraries or set up their input file past what format SaltProc expects, as those steps are different for each depletion code. I do have a guide in progress showing people how to structure the Serpent template input file here.
I think you are confused by the name of the function |
The function name wasn't what was confusing (unless me statement about what is happening wrong). I wanted to make sure you didn't have functions in the PR that mapped to MCNP, as I didn't see any tests for that. |
There are no such functions. If we ever add functionality to couple saltproc to MCNP, then we will. |
@samgdotson @LukeSeifert bump |
Thanks for addressing my questions @yardasol. I approve the PR. I won't merge for a few days in case @samgdotson or @LukeSeifert want to look at this. |
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.
Looks good overall, though I'm not super familiar with the different ZAID formats. I had a few small comments/questions on some things.
nuc_code = int(nuc_code.split('.')[0]) | ||
if self.zaid_convention == 'serpent': | ||
nuc_code = pyname.zzzaaa_to_id(nuc_code) | ||
if self.zaid_convention in ('mcnp', 'nndc'): |
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.
Consider changing to elif
here, then you could add an else
statement to make sure self.zaid_convention
is an expected value.
serpent_depcode.zaid_convention = 'mcnp' | ||
assert serpent_depcode.convert_nuclide_code_to_name('92235.82c') == 'U235' | ||
assert serpent_depcode.convert_nuclide_code_to_name('38088.82c') == 'Sr88' | ||
assert serpent_depcode.convert_nuclide_code_to_name('95642.82c') == 'Am242m1' | ||
assert serpent_depcode.convert_nuclide_code_to_name('95242.82c') == 'Am242' | ||
assert serpent_depcode.convert_nuclide_code_to_name('61548.82c') == 'Pm148m1' | ||
assert serpent_depcode.convert_nuclide_code_to_name('20060') == 'He6' | ||
assert serpent_depcode.convert_nuclide_code_to_name('110241') == 'Na24m1' | ||
assert serpent_depcode.convert_nuclide_code_to_name('170381') == 'Cl38m1' | ||
assert serpent_depcode.convert_nuclide_code_to_name('310741') == 'Ga74m1' | ||
assert serpent_depcode.convert_nuclide_code_to_name('290702') == 'Cu70m2' | ||
assert serpent_depcode.convert_nuclide_code_to_name('250621') == 'Mn62m1' | ||
assert serpent_depcode.convert_nuclide_code_to_name('300732') == 'Zn73m2' | ||
assert serpent_depcode.convert_nuclide_code_to_name('370981') == 'Rb98m1' | ||
assert serpent_depcode.convert_nuclide_code_to_name('390972') == 'Y97m2' | ||
assert serpent_depcode.convert_nuclide_code_to_name('491142') == 'In114m2' | ||
|
||
serpent_depcode.zaid_convention = 'nndc' | ||
assert serpent_depcode.convert_nuclide_code_to_name('92235.82c') == 'U235' | ||
assert serpent_depcode.convert_nuclide_code_to_name('38088.82c') == 'Sr88' | ||
assert serpent_depcode.convert_nuclide_code_to_name('95242.82c') == 'Am242m1' | ||
assert serpent_depcode.convert_nuclide_code_to_name('95642.82c') == 'Am242' | ||
assert serpent_depcode.convert_nuclide_code_to_name('61548.82c') == 'Pm148m1' | ||
assert serpent_depcode.convert_nuclide_code_to_name('20060') == 'He6' | ||
assert serpent_depcode.convert_nuclide_code_to_name('110241') == 'Na24m1' | ||
assert serpent_depcode.convert_nuclide_code_to_name('170381') == 'Cl38m1' | ||
assert serpent_depcode.convert_nuclide_code_to_name('310741') == 'Ga74m1' | ||
assert serpent_depcode.convert_nuclide_code_to_name('290702') == 'Cu70m2' | ||
assert serpent_depcode.convert_nuclide_code_to_name('250621') == 'Mn62m1' | ||
assert serpent_depcode.convert_nuclide_code_to_name('300732') == 'Zn73m2' | ||
assert serpent_depcode.convert_nuclide_code_to_name('370981') == 'Rb98m1' | ||
assert serpent_depcode.convert_nuclide_code_to_name('390972') == 'Y97m2' | ||
assert serpent_depcode.convert_nuclide_code_to_name('491142') == 'In114m2' |
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.
This could be cleaner if you created a three lists of nuclide_codes
, serpent_names
, mcnp_names
, and nndc_names
then iterated through them. It would also be a bit easier to see the differences, but since this is a test it probably isn't necessary.
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.
Looks fine to me, although I'm confused why there isn't a corresponding openmc_depcode.py file. Is that coming in a separate PR or...?
Do you mean changes is the openmc_depcode.py file? OpenMC uses nuclide names (Am242) instead of ZAIDs, so this feature isn't relevant to the OpenMC side of things. |
@samgdotson is this good to merge? |
@samgdotson bump |
…-zaid-conventions Add variable to specify ZAID-format 1af46aa
…ible-zaid-conventions Add variable to specify ZAID-format 1af46aa
…ible-zaid-conventions Add variable to specify ZAID-format 1af46aa
Summary of changes
This PR addressed the bug described in #171. Specifically, this PR adds:
zaid_convention
SerpentDepcode
that utilizezaid_convention
to choose how to process nuclide ZAID codes.Note to reviewers: The majority of the 273k added lines are in two files:
tap_reference_mcnp.out
andtap_reference_nndc.out
, located attests/serpent_data/
. These are identical toserpent_data/tap_reference.out
, except I have changed the ZAIDs for metastable nuclides to match what we would expect them to.Types of changes
Required for Merging
Associated Issues and PRs
DepcodeSerpent.get_nuc_name()
fails with MCNP-style metastable nuc-codes. #171Associated Developers
Checklist for Reviewers
Reviewers should use this link to get to the
Review Checklist before they begin their review.