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

Mattdon/new melcor interface #2017

Open
wants to merge 37 commits into
base: devel
Choose a base branch
from
Open

Conversation

mandd
Copy link
Collaborator

@mandd mandd commented Nov 17, 2022


Pull Request Description

What issue does this change request address? (Use "#" before the issue to link it, i.e., #42.)

Closes #2125

What are the significant changes in functionality due to this change request?

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.

@moosebuild
Copy link

Job Mingw Test on 3eb7f67 : invalidated by @joshua-cogliati-inl

restarted civet

@moosebuild
Copy link

Job Precheck on d8c1ae7 : invalidated by @aalfonsi

@wangcj05
Copy link
Collaborator

Job Precheck on d8c1ae7 : invalidated by @aalfonsi

@mandd @aalfonsi FYI, pre-check failed due to hpcgithub issue. This may be resolved until next Tuesday.

@moosebuild
Copy link

Job Precheck on d8c1ae7 : invalidated by @aalfonsi

@mandd mandd requested a review from wangcj05 June 2, 2023 22:04
@mandd
Copy link
Collaborator Author

mandd commented Jun 2, 2023

@wangcj05 : this PR is good to be reviewed

@moosebuild
Copy link

Job Mingw Test on 851e8df : invalidated by @mandd

@moosebuild
Copy link

Job Test qsubs sawtooth on 851e8df : invalidated by @mandd

@wangcj05
Copy link
Collaborator

wangcj05 commented Jun 5, 2023

@mandd Could you create an issue for this PR? In addition, could you update the description for this PR? I will review it this week.

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.

@mandd I have a couple of comments for you to consider.

@author: Matteo Donorio (University of Rome La Sapienza),
Fabio Gianneti (University of Rome La Sapienza),
Andrea Alfonsi (INL)
@author: Matteo D'Onorio (Sapienza University of Rome)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you want to add your name and Andrea name 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.

added

Comment on lines 53 to 54
self.VarList = [var.strip() for var in varNode.text.split("$,")]
self.MelcorPlotFile = [var.strip() for var in plotNode.text.split(",")][0]
Copy link
Collaborator

Choose a reason for hiding this comment

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

please use camelBack style for variables.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed


return self.VarList, self.MelcorPlotFile, self.melcorOutFile

def findInps(self,currentInputFiles):
"""
Locates the input files for Melgen, Melcor
@ In, inputFiles, list, list of Files objects
Copy link
Collaborator

Choose a reason for hiding this comment

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

please change 'inputFiles' to 'currentInputFiles'

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

Comment on lines 66 to 70
for index, inputFile in enumerate(currentInputFiles):
if inputFile.getExt() in self.getInputExtension():
foundMelcorInp = True
melgIn = inputFiles[index]
melcIn = inputFiles[index]
melgIn = currentInputFiles[index]
melcIn = currentInputFiles[index]
Copy link
Collaborator

Choose a reason for hiding this comment

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

It is not clear to me about the 'for loop' here. For example, if there are multiple files provided in raven input, how can this for loop check which files to pick? I guess only one file is accepted for melgIn and melcIn.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I am not sure here TBH

Copy link
Collaborator

Choose a reason for hiding this comment

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

I suggest to add a check inside the if statement, for example:

if foundMelcorInp:
  raise IOError(f"Multiple Melcor input files are founded {inputFile} and {melgIn}, please check your inputs, only one of input is accepted")

break
if not found:
raise IOError('None of the input files has one of the following extensions: ' + ' '.join(self.getInputExtension()))
melcOut = 'OUTPUT_MELCOR'
Copy link
Collaborator

Choose a reason for hiding this comment

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

I suggest move this to init method using self.melcOut.

Copy link
Collaborator

Choose a reason for hiding this comment

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

could you address this issue also?

Copy link
Collaborator

Choose a reason for hiding this comment

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

could you address this?

unset = ', '.join(list(set(dims) - set(inputVars)))
self.raiseAnError(RuntimeError, ("Subdomain grid must be defined on the input space only (inputs)."
f"The following variables '{unset}' are not part "
f"of the input space of DataObject {inputs[-1].name}!"))
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think inputs[-1].name will not give you the right name of DataObject, it will only return 'DataSet, PointSet or HistorySet', not the actually name provided by the user. I think we need to add a method in DataObject to retrieve the name in the future.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

FYI @alfoa

Copy link
Collaborator

Choose a reason for hiding this comment

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

self.name is set to the attribute ``name'' (in the XML) in the base type class. It will return the name of the data object. (Tried)

Comment on lines 13 to 14
@ In, fileDirectory, string, the file directory. This is the directory of the MELCOR plot file
@ In, variableSearch, list, list of variables to be collected
Copy link
Collaborator

Choose a reason for hiding this comment

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

please update these docstring to reflect the provided input arguments.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

This method is called to collect the variables to be used in the postprocess
@ In, fileDirectory, string, the file directory. This is the directory of the MELCOR plot file
@ In, variableSearch, list, list of variables to be collected
@ Out, Data, tuple (numpy.ndarray,numpy.ndarray,numpy.ndarray), this contains the extracted data for each declare variable
Copy link
Collaborator

Choose a reason for hiding this comment

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

please update this docstring to explain each element in the tuple.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have added a short description based on my understanding of the code

Comment on lines +20 to +25
HdrList = []
BlkLenBef = []
BlkLenAft = []
DataPos=[]
cntr = 0
Var_dict = {}
Copy link
Collaborator

Choose a reason for hiding this comment

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

@mandd Do we want to force this file to use RAVEN code standards? To me, I'm ok with the code style of this file since it is a contrib file.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I agree since it is in contrib

found = False

for index, inputFile in enumerate(inputFiles):
if inputFile.getExt() in self.getInputExtension():
Copy link
Collaborator

Choose a reason for hiding this comment

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

I do not see a function to add the input extension for this interface. I think you need to update the self.inputExtensions using setInputExtension method or using addDefaultExtension method.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems this issue has not been addressed yet.

@wangcj05 wangcj05 mentioned this pull request Jun 7, 2023
9 tasks
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.

@mandd It seems a couple of comments have not been addressed yet.

Comment on lines 66 to 70
for index, inputFile in enumerate(currentInputFiles):
if inputFile.getExt() in self.getInputExtension():
foundMelcorInp = True
melgIn = inputFiles[index]
melcIn = inputFiles[index]
melgIn = currentInputFiles[index]
melcIn = currentInputFiles[index]
Copy link
Collaborator

Choose a reason for hiding this comment

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

I suggest to add a check inside the if statement, for example:

if foundMelcorInp:
  raise IOError(f"Multiple Melcor input files are founded {inputFile} and {melgIn}, please check your inputs, only one of input is accepted")

found = False

for index, inputFile in enumerate(inputFiles):
if inputFile.getExt() in self.getInputExtension():
Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems this issue has not been addressed yet.

break
if not found:
raise IOError('None of the input files has one of the following extensions: ' + ' '.join(self.getInputExtension()))
melcOut = 'OUTPUT_MELCOR'
Copy link
Collaborator

Choose a reason for hiding this comment

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

could you address this issue also?

@mandd
Copy link
Collaborator Author

mandd commented Sep 22, 2023

This PR is good to go I think

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.

@mandd I have a couple of comments for you to consider, manual for the user manual documentations regarding the Melcor code interface changes. Please let me know if you have any questions.

Comment on lines -13 to -14
<revision author="alfoa" date="2017-04-27">Adding this test description.</revision>
<revision author="alfoa" date="2020-10-31">Added csv xml node in the Code block for showing how to use it.</revision>
Copy link
Collaborator

Choose a reason for hiding this comment

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

These two lines should not be removed.

Comment on lines +32 to +36
<variables>
CVH-P_1$, CVH-TLIQ_2$, CFVALU_2
</variables>
<CodePlotFile>MELPTF.PTF</CodePlotFile>
<MelcorOutput>MELMES_v2-0</MelcorOutput>
Copy link
Collaborator

Choose a reason for hiding this comment

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

The user manual is not updated to reflect these changes. Could you update it? In addition, why there is a '$' and the end of some defined variables?

Comment on lines +43 to +45
melNode = xmlNode.find('MelcorOutput')
varNode = xmlNode.find('variables')
plotNode = xmlNode.find('CodePlotFile')
Copy link
Collaborator

Choose a reason for hiding this comment

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

These nodes need to be documented in the user manual

if melNode is None:
raise IOError("Please enter MELCOR message file name")

self.varList = [var.strip() for var in varNode.text.split("$,")]
Copy link
Collaborator

Choose a reason for hiding this comment

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

This split using '$,' need also be documented in the user manual.

break
if not found:
raise IOError('None of the input files has one of the following extensions: ' + ' '.join(self.getInputExtension()))
melcOut = 'OUTPUT_MELCOR'
Copy link
Collaborator

Choose a reason for hiding this comment

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

could you address this?

Comment on lines +55 to +56
self.melcorPlotFile = [var.strip() for var in plotNode.text.split(",")][0]
self.melcorOutFile = [var.strip() for var in melNode.text.split(",")][0]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please also document the output files types and explain the use of these files. For example, self.melcorPlotFile is used to retrieve outputs, and self.melcorOutFile is used to detect failures.

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] MELCOR interface
6 participants