本文整理汇总了Python中PyFoam.RunDictionary.SolutionDirectory.SolutionDirectory.blockMesh方法的典型用法代码示例。如果您正苦于以下问题:Python SolutionDirectory.blockMesh方法的具体用法?Python SolutionDirectory.blockMesh怎么用?Python SolutionDirectory.blockMesh使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyFoam.RunDictionary.SolutionDirectory.SolutionDirectory
的用法示例。
在下文中一共展示了SolutionDirectory.blockMesh方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: prepare
# 需要导入模块: from PyFoam.RunDictionary.SolutionDirectory import SolutionDirectory [as 别名]
# 或者: from PyFoam.RunDictionary.SolutionDirectory.SolutionDirectory import blockMesh [as 别名]
#.........这里部分代码省略.........
self.info("")
else:
cleanZero=False
if self.opts.doTemplates:
self.searchAndReplaceTemplates(sol.name,
vals,
self.opts.templateExt)
self.info("")
backupZeroDir=None
if self.opts.doMeshCreate:
if self.opts.meshCreateScript:
scriptName=path.join(sol.name,self.opts.meshCreateScript)
if not path.exists(scriptName):
self.error("Script",scriptName,"does not exist")
elif path.exists(path.join(sol.name,self.defaultMeshCreate)):
scriptName=path.join(sol.name,self.defaultMeshCreate)
else:
scriptName=None
if scriptName:
self.info("Executing",scriptName,"for mesh creation")
if self.opts.verbose:
echo="Mesh: "
else:
echo=None
result="".join(execute([scriptName],workdir=sol.name,echo=echo))
open(scriptName+".log","w").write(result)
else:
self.info("No script for mesh creation found. Looking for 'blockMeshDict'")
if sol.blockMesh()!="":
self.info(sol.blockMesh(),"found. Executing 'blockMesh'")
bm=BasicRunner(argv=["blockMesh","-case",sol.name])
bm.start()
if not bm.runOK():
self.error("Problem with blockMesh")
for r in sol.regions():
self.info("Checking region",r)
s=SolutionDirectory(sol.name,region=r,
archive=None,paraviewLink=False)
if s.blockMesh()!="":
self.info(s.blockMesh(),"found. Executing 'blockMesh'")
bm=BasicRunner(argv=["blockMesh","-case",sol.name,
"-region",r])
bm.start()
if not bm.runOK():
self.error("Problem with blockMesh")
self.info("")
if cleanZero and path.exists(zeroDir):
self.warning("Mesh creation recreated 0-directory")
if self.opts.keepZeroDirectoryFromMesh:
backupZeroDir=zeroDir+".bakByPyFoam"
self.info("Backing up",zeroDir,"to",backupZeroDir)
move(zeroDir,backupZeroDir)
else:
self.info("Data in",zeroDir,"will be removed")
if self.opts.doCopy:
self.copyOriginals(sol.name)