本文整理汇总了Python中PyFoam.RunDictionary.SolutionDirectory.SolutionDirectory.initialDir方法的典型用法代码示例。如果您正苦于以下问题:Python SolutionDirectory.initialDir方法的具体用法?Python SolutionDirectory.initialDir怎么用?Python SolutionDirectory.initialDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyFoam.RunDictionary.SolutionDirectory.SolutionDirectory
的用法示例。
在下文中一共展示了SolutionDirectory.initialDir方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from PyFoam.RunDictionary.SolutionDirectory import SolutionDirectory [as 别名]
# 或者: from PyFoam.RunDictionary.SolutionDirectory.SolutionDirectory import initialDir [as 别名]
def run(self):
sol=SolutionDirectory(self.parser.getArgs()[0])
if not self.opts.init:
vcs=sol.determineVCS()
if vcs==None:
self.error("not under version control")
if not vcs in self.vcsChoices:
self.error("Unsupported VCS",vcs)
else:
vcs=self.opts.vcs
vcsInter=getVCS(vcs,
path=sol.name,
init=self.opts.init)
vcsInter.addPath(path.join(sol.name,"constant"),rules=ruleList)
vcsInter.addPath(path.join(sol.name,"system"),rules=ruleList)
if sol.initialDir()!=None:
vcsInter.addPath(sol.initialDir(),rules=ruleList)
else:
self.warning("No initial-directory found")
# special PyFoam-files
for f in ["customRegexp","LocalConfigPyFoam"]:
p=path.join(sol.name,f)
if path.exists(p):
vcsInter.addPath(p,rules=ruleList)
# Add the usual files from the tutorials
for g in ["Allrun*","Allclean*"]:
for f in glob(path.join(sol.name,g)):
vcsInter.addPath(f,rules=ruleList)
for a in self.opts.additional:
vcsInter.addPath(a,rules=ruleList)
vcsInter.commit(self.opts.commitMessage)
示例2: run
# 需要导入模块: from PyFoam.RunDictionary.SolutionDirectory import SolutionDirectory [as 别名]
# 或者: from PyFoam.RunDictionary.SolutionDirectory.SolutionDirectory import initialDir [as 别名]
def run(self):
cName=self.parser.casePath()
self.checkCase(cName)
sol=SolutionDirectory(cName,archive=None)
print_("Clearing out old timesteps ....")
sol.clearResults()
self.checkAndCommit(SolutionDirectory(cName,archive=None))
run=BasicRunner(argv=self.parser.getArgs(),
server=self.opts.server,
logname="PyFoamMeshUtility")
self.addLibFunctionTrigger(run,sol)
self.addToCaseLog(cName,"Starting")
run.start()
self.setData(run.data)
sol.reread(force=True)
self.addToCaseLog(cName,"Ending")
if sol.latestDir()!=sol.initialDir():
for f in listdir(path.join(sol.latestDir(),"polyMesh")):
system("mv -f "+path.join(sol.latestDir(),"polyMesh",f)+" "+sol.polyMeshDir())
print_("\nClearing out new timesteps ....")
sol.clearResults()
else:
print_("\n\n No new timestep. Utility propably failed")
示例3: range
# 需要导入模块: from PyFoam.RunDictionary.SolutionDirectory import SolutionDirectory [as 别名]
# 或者: from PyFoam.RunDictionary.SolutionDirectory.SolutionDirectory import initialDir [as 别名]
from PyFoam.RunDictionary.SolutionFile import SolutionFile
from PyFoam.RunDictionary.SolutionDirectory import SolutionDirectory
solver="simpleFoam"
case="pitzDaily"
pCmd="calcPressureDifference"
mCmd="calcMassFlow"
dire=SolutionDirectory(case,archive="InletVariation")
dire.clearResults()
dire.addBackup("PyFoamSolve.logfile")
dire.addBackup("PyFoamSolve.analyzed")
dire.addBackup("Pressure.analyzed")
dire.addBackup("MassFlow.analyzed")
sol=SolutionFile(dire.initialDir(),"U")
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()
示例4:
# 需要导入模块: from PyFoam.RunDictionary.SolutionDirectory import SolutionDirectory [as 别名]
# 或者: from PyFoam.RunDictionary.SolutionDirectory.SolutionDirectory import initialDir [as 别名]
from PyFoam.RunDictionary.SolutionFile import SolutionFile
from PyFoam.RunDictionary.SolutionDirectory import SolutionDirectory
import sys
file=sys.argv[1]
name=sys.argv[2]
bc =sys.argv[3]
neu=sys.argv[4]
dire=SolutionDirectory(file,archive="TestArchive")
sol=SolutionFile(dire.initialDir(),name)
print "Old internal",sol.readInternal()
sol.replaceInternal(neu)
print "New internal",sol.readInternal()
sol.purgeFile()
print "Reset internal",sol.readInternal()
print "Old boundary",sol.readBoundary(bc)
sol.replaceBoundary(bc,neu)
print "New boundary",sol.readBoundary(bc)
sol.purgeFile()