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

Source Code for Module PyFoam.Applications.PlotWatcher

 1  #  ICE Revision: $Id: PlotWatcher.py 8528 2008-02-25 15:09:57Z bgschaid $  
 2  """ 
 3  Class that implements pyFoamPlotWatcher 
 4  """ 
 5   
 6  from PyFoam.Execution.GnuplotRunner import GnuplotWatcher 
 7   
 8  from PyFoamApplication import PyFoamApplication 
 9   
10  from CommonPlotLines import CommonPlotLines 
11  from CommonPlotOptions import CommonPlotOptions 
12   
13  from os import path 
14   
15 -class PlotWatcher(PyFoamApplication, 16 CommonPlotOptions, 17 CommonPlotLines):
18 - def __init__(self,args=None):
19 description=""" 20 Gets the name of a logfile which is assumed to be the output of a 21 OpenFOAM-solver. Parses the logfile for information about the 22 convergence of the solver and generates gnuplot-graphs. Watches the 23 file until interrupted. 24 """ 25 26 CommonPlotOptions.__init__(self,persist=False) 27 CommonPlotLines.__init__(self) 28 PyFoamApplication.__init__(self,args=args,description=description,usage="%prog [options] <logfile>",interspersed=True,nr=1)
29
30 - def addOptions(self):
31 CommonPlotOptions.addOptions(self) 32 33 self.parser.add_option("--tail", 34 type="long", 35 dest="tail", 36 default=5000L, 37 help="The length at the end of the file that should be output (in bytes)") 38 self.parser.add_option("--silent", 39 action="store_true", 40 dest="silent", 41 default=False, 42 help="Logfile is not copied to the terminal") 43 self.parser.add_option("--progress", 44 action="store_true", 45 default=False, 46 dest="progress", 47 help="Only prints the progress of the simulation, but swallows all the other output") 48 self.parser.add_option("--start", 49 action="store", 50 type="float", 51 default=None, 52 dest="start", 53 help="Start time starting from which the data should be plotted. If undefined the initial time is used") 54 55 self.parser.add_option("--end", 56 action="store", 57 type="float", 58 default=None, 59 dest="end", 60 help="End time until which the data should be plotted. If undefined it is plotted till the end") 61 62 CommonPlotLines.addOptions(self)
63
64 - def run(self):
65 self.processPlotOptions() 66 self.processPlotLineOptions(autoPath=path.dirname(self.parser.getArgs()[0])) 67 68 run=GnuplotWatcher(self.parser.getArgs()[0], 69 smallestFreq=self.opts.frequency, 70 persist=self.opts.persist, 71 tailLength=self.opts.tail, 72 silent=self.opts.silent, 73 plotLinear=self.opts.linear, 74 plotCont=self.opts.cont, 75 plotBound=self.opts.bound, 76 plotIterations=self.opts.iterations, 77 plotCourant=self.opts.courant, 78 plotExecution=self.opts.execution, 79 plotDeltaT=self.opts.deltaT, 80 customRegexp=self.plotLines(), 81 writeFiles=self.opts.writeFiles, 82 raiseit=self.opts.raiseit, 83 progress=self.opts.progress, 84 start=self.opts.start, 85 end=self.opts.end) 86 87 run.start()
88