本文整理汇总了Python中PyFoam.RunDictionary.SolutionDirectory.SolutionDirectory.getLast方法的典型用法代码示例。如果您正苦于以下问题:Python SolutionDirectory.getLast方法的具体用法?Python SolutionDirectory.getLast怎么用?Python SolutionDirectory.getLast使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyFoam.RunDictionary.SolutionDirectory.SolutionDirectory
的用法示例。
在下文中一共展示了SolutionDirectory.getLast方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from PyFoam.RunDictionary.SolutionDirectory import SolutionDirectory [as 别名]
# 或者: from PyFoam.RunDictionary.SolutionDirectory.SolutionDirectory import getLast [as 别名]
def run(self):
if len(self.parser.getArgs())>2:
error("Too many arguments:",self.parser.getArgs()[2:],"can not be used")
sName=self.parser.getArgs()[0]
dName=self.parser.getArgs()[1]
if path.exists(dName):
if self.parser.getOptions().force:
warning("Replacing",dName,"(--force option)")
elif path.exists(path.join(dName,"system","controlDict")):
error("Destination",dName,"already existing and a Foam-Case")
elif path.isdir(dName):
dName=path.join(dName,path.basename(sName))
if path.exists(dName) and not self.parser.getOptions().force:
error(dName,"already existing")
elif not path.exists(path.dirname(dName)):
warning("Directory",path.dirname(dName),"does not exist. Creating")
sol=SolutionDirectory(sName,
archive=None,
paraviewLink=False,
addLocalConfig=True,
parallel=self.opts.parallel)
if sol.determineVCS()!=None and self.opts.vcs:
if self.opts.chemkin or self.opts.additional or self.opts.latest:
self.error("Using an unimplemented option together with VCS")
vcsInter=getVCS(sol.determineVCS(),
path=sol.name)
vcsInter.clone(dName)
return
if self.parser.getOptions().chemkin:
sol.addToClone("chemkin")
if self.parser.getOptions().dopyfoam:
sol.addToClone("customRegexp")
for a in self.parser.getOptions().additional:
sol.addToClone(a)
if self.parser.getOptions().latest:
sol.addToClone(sol.getLast())
if self.opts.symlinkMode:
sol.symlinkCase(
dName,
followSymlinks=self.parser.getOptions().followSymlinks,
maxLevel=self.opts.symlinkLevel,
relPath=self.opts.symlinkRelative
)
else:
sol.cloneCase(
dName,
followSymlinks=self.parser.getOptions().followSymlinks
)
self.addToCaseLog(dName,"Cloned to",dName)
示例2: execute
# 需要导入模块: from PyFoam.RunDictionary.SolutionDirectory import SolutionDirectory [as 别名]
# 或者: from PyFoam.RunDictionary.SolutionDirectory.SolutionDirectory import getLast [as 别名]
def execute(self,para,log):
print_(" Copy last result")
sol=SolutionDirectory(para["case"],archive=None)
sol.addToClone(sol.getLast())
sol.cloneCase(path.join(para["results"],para["id"]))
return True,None
开发者ID:Unofficial-Extend-Project-Mirror,项目名称:openfoam-extend-Breeder-other-scripting-PyFoam,代码行数:8,代码来源:Comparator.py
示例3: range
# 需要导入模块: from PyFoam.RunDictionary.SolutionDirectory import SolutionDirectory [as 别名]
# 或者: from PyFoam.RunDictionary.SolutionDirectory.SolutionDirectory import getLast [as 别名]
maximum=1.
nr=10
f=dire.makeFile("InflowVariationResults")
for i in range(nr+1):
# Set the boundary condition at the inlet
val=(maximum*i)/nr
print "Inlet velocity:",val
sol.replaceBoundary("inlet","(%f 0 0)" %(val))
# Run the solver
run=ConvergenceRunner(BoundingLogAnalyzer(),argv=[solver,"-case",case],silent=True)
run.start()
print "Last Time = ",dire.getLast()
# Get the pressure difference (Using an external utility)
pUtil=UtilityRunner(argv=[pCmd,"-case",case],silent=True,logname="Pressure")
pUtil.add("deltaP","Pressure at .* Difference .*\] (.+)")
pUtil.start()
deltaP=pUtil.get("deltaP")[0]
# Get the mass flow
mUtil=UtilityRunner(argv=[mCmd,"-case",case,"-latestTime"],silent=True,logname="MassFlow")
mUtil.add("mass","Flux at (.+?) .*\] (.+)",idNr=1)
mUtil.start()
massFlow=mUtil.get("mass",ID="outlet")[0]