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

Source Code for Module PyFoam.Applications.SteadyRunner

 1  """ 
 2  Application class that implements pyFoamSteadyRunner 
 3  """ 
 4   
 5  from PyFoamApplication import PyFoamApplication 
 6   
 7  from PyFoam.Execution.ConvergenceRunner import ConvergenceRunner 
 8  from PyFoam.LogAnalysis.BoundingLogAnalyzer import BoundingLogAnalyzer 
 9  from PyFoam.RunDictionary.SolutionDirectory import SolutionDirectory 
10   
11  from PyFoam.Execution.ParallelExecution import LAMMachine 
12   
13 -class SteadyRunner(PyFoamApplication):
14 - def __init__(self):
15 description=""" 16 Runs an OpenFoam steady solver. Needs the usual 3 arguments (<solver> 17 <directory> <case>) and passes them on (plus additional arguments) 18 Output is sent to stdout and a logfile inside the case directory 19 (PyFoamSolver.logfile). The Directory PyFoamSolver.analyzed contains 20 this information a) Residuals and other information of the linear 21 solvers b) Execution time c) continuity information d) bounding of 22 variables 23 24 If the solver has converged (linear solvers below threshold) it is 25 stopped and the last simulation state is written to disk 26 """ 27 28 PyFoamApplication.__init__(self,description=description)
29
30 - def addOptions(self):
31 self.parser.add_option("--procnr",type="int",dest="procnr",default=None,help="The number of processors the run should be started on") 32 self.parser.add_option("--machinefile",dest="machinefile",default=None,help="The machinefile that specifies the parallel machine") 33 self.parser.add_option("--clear-case",action="store_true",default=False,dest="clearCase",help="Clear all timesteps except for the first before running")
34
35 - def run(self):
36 if self.opts.clearCase: 37 print "Clearing out old timesteps ...." 38 39 cName=self.parser.getArgs()[2] 40 sol=SolutionDirectory(cName) 41 sol.clearResults() 42 43 lam=None 44 if self.opts.procnr!=None or self.opts.machinefile!=None: 45 lam=LAMMachine(machines=self.opts.machinefile,nr=self.opts.procnr) 46 47 run=ConvergenceRunner(BoundingLogAnalyzer(),argv=self.parser.getArgs(),server=True,lam=lam) 48 49 run.start()
50