-
Notifications
You must be signed in to change notification settings - Fork 133
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
Addition of datatypes for R5 interface #2212
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.
One additional comment: I think we do not check that the format of the sampled variables match the format specified in the input file
@@ -431,10 +440,18 @@ def modifyOrAdd(self,modifyDict,save=True): | |||
temp.append('*'+' deckNum: '+str(deckNum)+'\n') | |||
for j in sorted(modiDictionaryList): | |||
for var in modiDictionaryList[j]: | |||
ff = '{:7e}' | |||
cast = float | |||
if j in intDT and int(intDT[j]) == int(var['position']): |
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.
since we have two datatypes, should we specify only one of the datatypes in the input files?
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.
yeah..since float is the default, I remover the input for them (redundant)
ff = '{:d}' | ||
cast = int | ||
elif j in floatDT and int(floatDT[j]) == int(var['position']) : | ||
ff = '{:7e}' |
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.
should we mention this float format in the user manual?
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.
RELAP does not use a fix-typed input file so probably it is not needed.
@@ -462,12 +479,18 @@ def modifyOrAdd(self,modifyDict,save=True): | |||
# modify the cards | |||
for card in cardLines.keys(): | |||
for var in modiDictionaryList[card]: | |||
dtype = "float" | |||
if card in intDT and int(intDT[card]) == int(var['position']): |
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.
why do we need the second portion of this if condition (int(intDT[card]) == int(var['position']))?
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.
yes that is needed because multiple "cards" can be inputted at different position. For example, we can sample 2 cards: 201:1
and 201:2
and we want only the second one to be integer. Ie.:
<integers>201:2</integers>
If we do not check for the position, both cards will be treated as integers.
@@ -317,13 +329,15 @@ def createNewInput(self,currentInputFiles,oriInputFiles,samplerType,**Kwargs): | |||
where RAVEN stores the variables that got sampled (e.g. Kwargs['SampledVars'] => {'var1':10,'var2':40}) | |||
@ Out, newInputFiles, list, list of newer input files, list of the new input files (modified and not) | |||
""" | |||
if "_indexMap" in Kwargs['SampledVars']: |
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.
why these two lines have been added?
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 is because this "variable" is added in the custom sampler and in RELAP5 any variable in SampledVars are treated as variables to be changed
@mandd I addressed all the comments. |
@mandd it should be green now |
Job Test qsubs sawtooth on 6c938ae : invalidated by @alfoa |
@mandd this is ready for re-review |
Job Test qsubs sawtooth on 6c938ae : invalidated by @wangcj05 python environment issue |
Job Test qsubs sawtooth on 6c938ae : invalidated by @mandd |
2 similar comments
Job Test qsubs sawtooth on 6c938ae : invalidated by @mandd |
Job Test qsubs sawtooth on 6c938ae : invalidated by @mandd |
Job Test qsubs sawtooth on 6c938ae : invalidated by @wangcj05 Failed tests/framework/pca_rom/oneDim |
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 have a couple of comments for you to consider @alfoa
elif dtype == 'float': | ||
ff, cast = '{:7e}', float |
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.
may not need this elif conditions 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.
completely right. Fixed
elif child.tag == 'datatypes': | ||
# DATA TYPES | ||
integers = child.find("integers") | ||
if integers is not None: | ||
c = "," if "," in integers.text else None | ||
self.datatypes['integers'] = [e.strip() for e in (integers.text.split() if c is None else integers.text.split(c))] |
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.
only integers are processed here. I would suggest to add a check here, I would suggest to check all the subnodes under datatypes to prevent any typos or other types provided by users.
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.
completely right. Fixed
""" | ||
Constructor | ||
@ In, inputFile, string, input file name | ||
@ In, datatypes, {}, dict {floats:[],integers:[]} |
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 default is floats, and the codes only process integers and it seems to me only integers are stored in datatypes. I would suggest update the line with integers only.
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.
Addressed
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.
changes are good.
checklist is good. |
Pull Request Description
What issue does this change request address? (Use "#" before the issue to link it, i.e., #42.)
Closes #2211
What are the significant changes in functionality due to this change request?
Addition of the XML node to specify datatypes.
For Change Control Board: Change Request Review
The following review must be completed by an authorized member of the Change Control Board.
<internalParallel>
to True.raven/tests/framework/user_guide
andraven/docs/workshop
) have been changed, the associated documentation must be reviewed and assured the text matches the example.