Skip to content
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

Merged
merged 11 commits into from
Mar 7, 2024
Merged

Conversation

alfoa
Copy link
Collaborator

@alfoa alfoa commented Nov 24, 2023


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.

  • 1. Review all computer code.
  • 2. If any changes occur to the input syntax, there must be an accompanying change to the user manual and xsd schema. If the input syntax change deprecates existing input files, a conversion script needs to be added (see Conversion Scripts).
  • 3. Make sure the Python code and commenting standards are respected (camelBack, etc.) - See on the wiki for details.
  • 4. Automated Tests should pass, including run_tests, pylint, manual building and xsd tests. If there are changes to Simulation.py or JobHandler.py the qsub tests must pass.
  • 5. If significant functionality is added, there must be tests added to check this. Tests should cover all possible options. Multiple short tests are preferred over one large test. If new development on the internal JobHandler parallel system is performed, a cluster test must be added setting, in XML block, the node <internalParallel> to True.
  • 6. If the change modifies or adds a requirement or a requirement based test case, the Change Control Board's Chair or designee also needs to approve the change. The requirements and the requirements test shall be in sync.
  • 7. The merge request must reference an issue. If the issue is closed, the issue close checklist shall be done.
  • 8. If an analytic test is changed/added is the the analytic documentation updated/added?
  • 9. If any test used as a basis for documentation examples (currently found in raven/tests/framework/user_guide and raven/docs/workshop) have been changed, the associated documentation must be reviewed and assured the text matches the example.

Copy link
Collaborator

@mandd mandd left a 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']):
Copy link
Collaborator

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?

Copy link
Collaborator Author

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}'
Copy link
Collaborator

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?

Copy link
Collaborator Author

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']):
Copy link
Collaborator

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']))?

Copy link
Collaborator Author

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']:
Copy link
Collaborator

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?

Copy link
Collaborator Author

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

@alfoa
Copy link
Collaborator Author

alfoa commented Dec 4, 2023

@mandd I addressed all the comments.

@alfoa alfoa requested a review from mandd December 4, 2023 03:41
@alfoa
Copy link
Collaborator Author

alfoa commented Dec 27, 2023

@mandd it should be green now

@moosebuild
Copy link

Job Test qsubs sawtooth on 6c938ae : invalidated by @alfoa

@alfoa
Copy link
Collaborator Author

alfoa commented Jan 2, 2024

@mandd this is ready for re-review

@moosebuild
Copy link

Job Test qsubs sawtooth on 6c938ae : invalidated by @wangcj05

python environment issue

@moosebuild
Copy link

Job Test qsubs sawtooth on 6c938ae : invalidated by @mandd

2 similar comments
@moosebuild
Copy link

Job Test qsubs sawtooth on 6c938ae : invalidated by @mandd

@moosebuild
Copy link

Job Test qsubs sawtooth on 6c938ae : invalidated by @mandd

@moosebuild
Copy link

Job Test qsubs sawtooth on 6c938ae : invalidated by @wangcj05

Failed tests/framework/pca_rom/oneDim

Copy link
Collaborator

@wangcj05 wangcj05 left a 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

Comment on lines 541 to 542
elif dtype == 'float':
ff, cast = '{:7e}', float
Copy link
Collaborator

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

completely right. Fixed

Comment on lines 89 to 94
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))]
Copy link
Collaborator

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.

Copy link
Collaborator Author

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:[]}
Copy link
Collaborator

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed

@alfoa alfoa requested a review from wangcj05 March 7, 2024 00:26
Copy link
Collaborator

@wangcj05 wangcj05 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes are good.

@wangcj05
Copy link
Collaborator

wangcj05 commented Mar 7, 2024

checklist is good.

@wangcj05 wangcj05 merged commit b0e0faa into devel Mar 7, 2024
12 checks passed
@wangcj05 wangcj05 deleted the alfoa/relap5_datatypes branch March 7, 2024 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[TASK] Allow Relap5 interface to specify datatypes
4 participants