Package PyFoam :: Package Applications :: Module SteadyRunner
[hide private]
[frames] | no frames]

Source Code for Module PyFoam.Applications.SteadyRunner

  1  #  ICE Revision: $Id: /local/openfoam/Python/PyFoam/PyFoam/Applications/SteadyRunner.py 7722 2012-01-18T17:50:53.943725Z bgschaid  $  
  2  """ 
  3  Application class that implements pyFoamSteadyRunner 
  4  """ 
  5   
  6  from os import path 
  7   
  8  from PyFoamApplication import PyFoamApplication 
  9   
 10  from PyFoam.Execution.ConvergenceRunner import ConvergenceRunner 
 11  from PyFoam.LogAnalysis.BoundingLogAnalyzer import BoundingLogAnalyzer 
 12  from PyFoam.RunDictionary.SolutionDirectory import SolutionDirectory 
 13   
 14  from PyFoam.Error import warning 
 15   
 16  from CommonParallel import CommonParallel 
 17  from CommonRestart import CommonRestart 
 18  from CommonPlotLines import CommonPlotLines 
 19  from CommonClearCase import CommonClearCase 
 20  from CommonReportUsage import CommonReportUsage 
 21  from CommonReportRunnerData import CommonReportRunnerData 
 22  from CommonSafeTrigger import CommonSafeTrigger 
 23  from CommonWriteAllTrigger import CommonWriteAllTrigger 
 24  from CommonStandardOutput import CommonStandardOutput 
 25  from CommonServer import CommonServer 
 26  from CommonVCSCommit import CommonVCSCommit 
 27   
28 -class SteadyRunner(PyFoamApplication, 29 CommonPlotLines, 30 CommonSafeTrigger, 31 CommonWriteAllTrigger, 32 CommonClearCase, 33 CommonServer, 34 CommonReportUsage, 35 CommonReportRunnerData, 36 CommonParallel, 37 CommonRestart, 38 CommonStandardOutput, 39 CommonVCSCommit):
40 - def __init__(self,args=None):
41 description="""\ 42 Runs an OpenFoam steady solver. Needs the usual 3 arguments (<solver> 43 <directory> <case>) and passes them on (plus additional arguments) 44 Output is sent to stdout and a logfile inside the case directory 45 (PyFoamSolver.logfile). The Directory PyFoamSolver.analyzed contains 46 this information a) Residuals and other information of the linear 47 solvers b) Execution time c) continuity information d) bounding of 48 variables 49 50 If the solver has converged (linear solvers below threshold) it is 51 stopped and the last simulation state is written to disk 52 """ 53 54 CommonPlotLines.__init__(self) 55 PyFoamApplication.__init__(self, 56 args=args, 57 description=description)
58
59 - def addOptions(self):
71
72 - def run(self):
73 cName=self.parser.casePath() 74 self.checkCase(cName) 75 76 self.processPlotLineOptions(autoPath=cName) 77 78 sol=SolutionDirectory(cName,archive=None) 79 80 self.clearCase(sol) 81 82 lam=self.getParallel(sol) 83 84 self.setLogname() 85 86 self.checkAndCommit(sol) 87 88 run=ConvergenceRunner(BoundingLogAnalyzer(progress=self.opts.progress, 89 doFiles=self.opts.writeFiles, 90 singleFile=self.opts.singleDataFilesOnly, 91 doTimelines=True), 92 silent=self.opts.progress or self.opts.silent, 93 argv=self.parser.getArgs(), 94 restart=self.opts.restart, 95 server=self.opts.server, 96 logname=self.opts.logname, 97 compressLog=self.opts.compress, 98 lam=lam, 99 logTail=self.opts.logTail, 100 noLog=self.opts.noLog, 101 remark=self.opts.remark, 102 jobId=self.opts.jobId) 103 104 run.createPlots(customRegexp=self.lines_, 105 writeFiles=self.opts.writeFiles) 106 107 self.addSafeTrigger(run,sol) 108 self.addWriteAllTrigger(run,sol) 109 110 self.addToCaseLog(cName,"Starting") 111 112 run.start() 113 114 self.addToCaseLog(cName,"Ending") 115 116 self.setData(run.data) 117 118 self.reportUsage(run) 119 self.reportRunnerData(run) 120 121 return run.data
122