14
14
"""
15
15
Created on April 18, 2017
16
16
@author: Matteo D'Onorio (Sapienza University of Rome)
17
- Andrea Alfonsi (INL )
17
+ Andrea Alfonsi (Nucube )
18
18
"""
19
19
20
20
import os
@@ -29,6 +29,16 @@ class Melcor(CodeInterfaceBase):
29
29
This class is used a part of a code dictionary to specialize Model. Code for different MELCOR versions
30
30
like MELCOR 2.2x, MELCOR 1.86, MELCOR for fusion applications
31
31
"""
32
+ def initialize (self , runInfo , oriInputFiles ):
33
+ """
34
+ Method to initialize the run of a new step
35
+ @ In, runInfo, dict, dictionary of the info in the <RunInfo> XML block
36
+ @ In, oriInputFiles, list, list of the original input files
37
+ @ Out, None
38
+ """
39
+ self .melcOut = 'OUTPUT_MELCOR'
40
+ self .goodWord = "Normal termination" # This is for MELCOR 2.2 (todo: list for other MELCOR versions)
41
+
32
42
33
43
def _readMoreXML (self ,xmlNode ):
34
44
"""
@@ -52,8 +62,8 @@ def _readMoreXML(self,xmlNode):
52
62
raise IOError ("Please enter MELCOR message file name" )
53
63
54
64
self .varList = [var .strip () for var in varNode .text .split ("," )]
55
- self .melcorPlotFile = [ var . strip () for var in plotNode .text . split ( "," )][ 0 ]
56
- self .melcorOutFile = [ var . strip () for var in melNode .text . split ( "," )][ 0 ]
65
+ self .melcorPlotFile = plotNode .text
66
+ self .melcorOutFile = melNode .text
57
67
58
68
def findInps (self ,currentInputFiles ):
59
69
"""
@@ -89,15 +99,14 @@ def generateCommand(self, inputFiles, executable, clargs=None, fargs=None, preEx
89
99
"""
90
100
found = False
91
101
92
- melcOut = 'OUTPUT_MELCOR'
93
102
melcin = self .findInps (inputFiles )
94
103
if clargs :
95
104
precommand = executable + clargs ['text' ]
96
105
else :
97
106
precommand = executable
98
107
melgCommand = str (preExec ) + ' ' + melcin .getFilename ()
99
108
melcCommand = str (precommand ) + ' ' + melcin .getFilename ()
100
- returnCommand = [('serial' ,melgCommand + ' && ' + melcCommand + ' ow=o ' )],melcOut
109
+ returnCommand = [('serial' ,melgCommand + ' && ' + melcCommand + ' ow=o ' )],self . melcOut
101
110
102
111
return returnCommand
103
112
@@ -170,11 +179,10 @@ def checkForOutputFailure(self,output,workingDir):
170
179
@ Out, failure, bool, True if the job is failed, False otherwise
171
180
"""
172
181
failure = True
173
- goodWord = "Normal termination" # This is for MELCOR 2.2 (todo: list for other MELCOR versions)
174
182
with open (os .path .join (workingDir ,self .melcorOutFile ),"r" ) as outputToRead :
175
183
readLines = outputToRead .readlines ()
176
184
lastRow = readLines [- 1 ]
177
- if goodWord in lastRow :
185
+ if self . goodWord in lastRow :
178
186
failure = False
179
187
outputToRead .close ()
180
188
return failure
0 commit comments