def analyzeLogs(self): if self.foamAnalyzedKeywords == {}: return lineAnalyzers={} #key is variable's name. value is GeneralSimpleLineAnalyzer FoamLogAnalyzers={} #key is logname. value is FoamLogAnalyzer # create FoamLogAnalyzers and set lineAnalyzer each FoamLogAnalyzer loop for key,val in self.foamAnalyzedKeywords.iteritems(): logname,expt = val.split("|",1) lineAnalyzers[key] = GeneralSimpleLineAnalyzer(key, expt, doFiles=False) if not FoamLogAnalyzers.has_key(logname): FoamLogAnalyzers[logname] = FoamLogAnalyzer(progress=True) FoamLogAnalyzers[logname].addAnalyzer(key, lineAnalyzers[key]) # LogAnalyzerApplication run for logname, val in FoamLogAnalyzers.iteritems(): log_app = LogAnalyzerApplication(val) log_app.run(os.path.join(self.foam_case.name,logname)) # get result from lineAnalyzer for key,val in lineAnalyzers.iteritems(): res = self.get(key) res._allTimesValues = numpy.array(list(val.getTimeline(key + '_0'))).transpose() res.correct()
""" Analyzes the output of a interFoam-Run and writes the results to files in a directory """ import sys,re if len(sys.argv)<2: print "To few arguments: name of logfile needed" sys.exit(-1) from PyFoam.LogAnalysis.BoundingLogAnalyzer import BoundingLogAnalyzer from PyFoam.LogAnalysis.LogAnalyzerApplication import LogAnalyzerApplication from PyFoam.LogAnalysis.SimpleLineAnalyzer import SimpleLineAnalyzer class InterFoamLogAnalyzer(BoundingLogAnalyzer): def __init__(self): BoundingLogAnalyzer.__init__(self) self.addAnalyzer("deltaT",SimpleLineAnalyzer("deltaT","^deltaT = (.+)$")) self.addAnalyzer("LiquidPhase",SimpleLineAnalyzer("liquid","^Liquid phase volume fraction = (.+) Min\((.+)\) = (.+) Max\(.+\) = (.+)$",idNr=2)) analyze=LogAnalyzerApplication(InterFoamLogAnalyzer()) analyze.run()
""" Analyzes the output of a interFoam-Run and writes the results to files in a directory """ import sys, re if len(sys.argv) < 2: print "To few arguments: name of logfile needed" sys.exit(-1) from PyFoam.LogAnalysis.BoundingLogAnalyzer import BoundingLogAnalyzer from PyFoam.LogAnalysis.LogAnalyzerApplication import LogAnalyzerApplication from PyFoam.LogAnalysis.SimpleLineAnalyzer import SimpleLineAnalyzer class InterFoamLogAnalyzer(BoundingLogAnalyzer): def __init__(self): BoundingLogAnalyzer.__init__(self) self.addAnalyzer("deltaT", SimpleLineAnalyzer("deltaT", "^deltaT = (.+)$")) self.addAnalyzer( "LiquidPhase", SimpleLineAnalyzer( "liquid", "^Liquid phase volume fraction = (.+) Min\((.+)\) = (.+) Max\(.+\) = (.+)$", idNr=2)) analyze = LogAnalyzerApplication(InterFoamLogAnalyzer()) analyze.run()
#! /usr/bin/env python description = """\ Analyzes a Log written by foamJob. Needs the name of the Logfile to be analyzed the data is being written to a directory that has the same name with _analyzed appended """ from PyFoam.Basics.FoamOptionParser import FoamOptionParser parse = FoamOptionParser(description=description, usage="%prog [options] <logfile>", interspersed=True) parse.parse(nr=1) from PyFoam.LogAnalysis.BoundingLogAnalyzer import BoundingLogAnalyzer from PyFoam.LogAnalysis.LogAnalyzerApplication import LogAnalyzerApplication analyze = LogAnalyzerApplication(BoundingLogAnalyzer()) analyze.run(pfad=parse.getArgs()[0])
""" Just a demonstration of a VERY simple log analyzer""" from PyFoam.LogAnalysis.EchoLogAnalyzer import EchoLogAnalyzer from PyFoam.LogAnalysis.LogAnalyzerApplication import LogAnalyzerApplication analyze = LogAnalyzerApplication(EchoLogAnalyzer()) analyze.run()
#!/usr/bin/python description="""\ Analyzes a Log written by foamJob. Needs the name of the Logfile to be analyzed the data is being written to a directory that has the same name with _analyzed appended """ from PyFoam.Basics.FoamOptionParser import FoamOptionParser parse=FoamOptionParser(description=description,usage="%prog [options] <logfile>",interspersed=True) parse.parse(nr=1) from PyFoam.LogAnalysis.BoundingLogAnalyzer import BoundingLogAnalyzer from PyFoam.LogAnalysis.LogAnalyzerApplication import LogAnalyzerApplication analyze=LogAnalyzerApplication(BoundingLogAnalyzer()) analyze.run(pfad=parse.getArgs()[0])