-
Notifications
You must be signed in to change notification settings - Fork 135
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
base: devel
Are you sure you want to change the base?
Conversation
This reverts commit 49913b9.
…to mattdon/New_MELCOR_Interface
Job Mingw Test on 3eb7f67 : invalidated by @joshua-cogliati-inl restarted civet |
ravenframework/Models/PostProcessors/SubdomainBasicStatistics.py
Outdated
Show resolved
Hide resolved
@wangcj05 : this PR is good to be reviewed |
Job Mingw Test on 851e8df : invalidated by @mandd |
Job Test qsubs sawtooth on 851e8df : invalidated by @mandd |
@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. |
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.
@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) |
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.
Do you want to add your name and Andrea name 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.
added
self.VarList = [var.strip() for var in varNode.text.split("$,")] | ||
self.MelcorPlotFile = [var.strip() for var in plotNode.text.split(",")][0] |
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.
please use camelBack style for variables.
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.
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 |
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.
please change 'inputFiles' to 'currentInputFiles'
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.
fixed
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] |
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.
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.
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 am not sure here TBH
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 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' |
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 suggest move this to init method using self.melcOut.
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.
could you address this issue also?
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.
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}!")) |
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 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.
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.
FYI @alfoa
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.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)
@ In, fileDirectory, string, the file directory. This is the directory of the MELCOR plot file | ||
@ In, variableSearch, list, list of variables to be collected |
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.
please update these docstring to reflect the provided input arguments.
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.
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 |
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.
please update this docstring to explain each element in the tuple.
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 added a short description based on my understanding of the code
HdrList = [] | ||
BlkLenBef = [] | ||
BlkLenAft = [] | ||
DataPos=[] | ||
cntr = 0 | ||
Var_dict = {} |
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.
@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.
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 agree since it is in contrib
found = False | ||
|
||
for index, inputFile in enumerate(inputFiles): | ||
if inputFile.getExt() in self.getInputExtension(): |
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 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.
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.
It seems this issue has not been addressed yet.
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.
@mandd It seems a couple of comments have not been addressed yet.
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] |
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 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(): |
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.
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' |
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.
could you address this issue also?
This PR is good to go I think |
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.
@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.
<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> |
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.
These two lines should not be removed.
<variables> | ||
CVH-P_1$, CVH-TLIQ_2$, CFVALU_2 | ||
</variables> | ||
<CodePlotFile>MELPTF.PTF</CodePlotFile> | ||
<MelcorOutput>MELMES_v2-0</MelcorOutput> |
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 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?
melNode = xmlNode.find('MelcorOutput') | ||
varNode = xmlNode.find('variables') | ||
plotNode = xmlNode.find('CodePlotFile') |
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.
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("$,")] |
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 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' |
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.
could you address this?
self.melcorPlotFile = [var.strip() for var in plotNode.text.split(",")][0] | ||
self.melcorOutFile = [var.strip() for var in melNode.text.split(",")][0] |
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.
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.
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.
<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.