def run(self): if not self.opts.keepPostprocessing: self.opts.additional.append("postProcessing") for cName in self.parser.getArgs(): if self.checkCase(cName,fatal=self.opts.fatal,verbose=not self.opts.silent): self.addLocalConfig(cName) if self.opts.verbose: print_("Clearing",cName) sol=SolutionDirectory(cName,archive=None,paraviewLink=False) sol.clear(after=self.parser.getOptions().after, processor=self.parser.getOptions().processor, pyfoam=self.parser.getOptions().pyfoam, vtk=self.parser.getOptions().vtk, removeAnalyzed=self.parser.getOptions().removeAnalyzed, keepRegular=self.parser.getOptions().keepRegular, keepParallel=self.parser.getOptions().keepParallel, keepLast=self.parser.getOptions().latest, keepInterval=self.parser.getOptions().keepInterval, clearHistory=self.parser.getOptions().clearHistory, clearParameters=self.parser.getOptions().clearParameters, additional=self.parser.getOptions().additional, functionObjectData=self.parser.getOptions().functionObjectData) self.addToCaseLog(cName)
def run(self): if not self.opts.keepPostprocessing: self.opts.additional.append("postProcessing") for cName in self.parser.getArgs(): if self.checkCase(cName, fatal=self.opts.fatal, verbose=not self.opts.silent): self.addLocalConfig(cName) if self.opts.verbose: print_("Clearing", cName) sol = SolutionDirectory(cName, archive=None, paraviewLink=False) sol.clear( after=self.parser.getOptions().after, processor=self.parser.getOptions().processor, pyfoam=self.parser.getOptions().pyfoam, vtk=self.parser.getOptions().vtk, removeAnalyzed=self.parser.getOptions().removeAnalyzed, keepRegular=self.parser.getOptions().keepRegular, keepParallel=self.parser.getOptions().keepParallel, keepLast=self.parser.getOptions().latest, keepInterval=self.parser.getOptions().keepInterval, clearHistory=self.parser.getOptions().clearHistory, clearParameters=self.parser.getOptions().clearParameters, additional=self.parser.getOptions().additional, functionObjectData=self.parser.getOptions( ).functionObjectData) self.addToCaseLog(cName)
def run(self): if not self.opts.keepPostprocessing: self.opts.additional.append("postProcessing") notCleared=[] if self.opts.dryRun: self.opts.verbose=True self.opts.verboseClear=True for cName in self.parser.getArgs(): if self.checkCase(cName,fatal=self.opts.fatal,verbose=not self.opts.silent): if self.opts.allcleanScript: scr=path.join(cName,"Allclean") if(path.exists(scr)): if self.opts.verbose or self.opts.verboseClear: print("Executing",scr) execute(scr,workdir=cName) try: self.addLocalConfig(cName) if self.opts.verbose: print_("Clearing",cName) sol=SolutionDirectory(cName, archive=None, parallel=True, paraviewLink=False) sol.clear(after=self.parser.getOptions().after, processor=self.parser.getOptions().processor, pyfoam=self.parser.getOptions().pyfoam, vtk=self.parser.getOptions().vtk, verbose=self.parser.getOptions().verboseClear, removeAnalyzed=self.parser.getOptions().removeAnalyzed, keepRegular=self.parser.getOptions().keepRegular, keepParallel=self.parser.getOptions().keepParallel, keepLast=self.parser.getOptions().latest, keepInterval=self.parser.getOptions().keepInterval, keepTimes=self.opts.keepTimes, clearHistory=self.parser.getOptions().clearHistory, clearParameters=self.parser.getOptions().clearParameters, additional=self.parser.getOptions().additional, dryRun=self.opts.dryRun, functionObjectData=self.parser.getOptions().functionObjectData) self.addToCaseLog(cName) except OSError: e = sys.exc_info()[1] # compatible with 2.x and 3.x self.warning("Can not clear",cName,"because of OSError",e) notCleared.append(cName) if len(notCleared)>0: self.warning("These case not cleared because of OS-problems:", ", ".join(notCleared))
def run(self): for cName in self.parser.getArgs(): if self.checkCase(cName,fatal=self.opts.fatal,verbose=not self.opts.silent): self.addLocalConfig(cName) if self.opts.verbose: print "Clearing",cName sol=SolutionDirectory(cName,archive=None,paraviewLink=False) sol.clear(after=self.parser.getOptions().after, processor=self.parser.getOptions().processor, pyfoam=self.parser.getOptions().pyfoam, vtk=self.parser.getOptions().vtk, keepRegular=self.parser.getOptions().keepRegular, keepLast=self.parser.getOptions().latest, clearHistory=self.parser.getOptions().clearHistory, functionObjectData=self.parser.getOptions().functionObjectData) self.addToCaseLog(cName)
from PyFoam.LogAnalysis.StandardLogAnalyzer import StandardLogAnalyzer from PyFoam.Execution.BasicRunner import BasicRunner from PyFoam.Execution.GnuplotRunner import GnuplotRunner case = "polarStudy" caseDir = SolutionDirectory(".",archive="polars") caseDir.addBackup("postProcessing/forceCoeffs/0/forceCoeffs.dat") caseDir.addBackup("PyFoamSolve.logfile") caseDir.addBackup("PyFoamSolve.analyzed") parameters = ParsedParameterFile("boundaryConditions",noHeader=True,preserveComments=False) vRange = np.arange(25,31,2.5) alphaRange = np.arange(0,11,1) print vRange caseDir.clearResults() caseDir.clear(functionObjectData=True) valueList = [] for i in range(len(vRange)): for j in range(len(alphaRange)): valueList.append({'velocity':vRange[i],'alpha':alphaRange[j]}) valueList.append({'velocity':10,'alpha':4}) valueList.append({'velocity':5,'alpha':10}) valueList.append({'velocity':7.5,'alpha':10}) print valueList for k in range(6,len(valueList)): vel = valueList[k]['velocity'] alpha = valueList[k]['alpha']