def __init__(self, fileList, filePath, simPara, meshPara): self.fileList = fileList self.filePath = filePath self.simPara = simPara self.meshPara = meshPara path = os.getcwd() self.pathB = path + '/b' if not os.path.exists(self.pathB): os.makedirs(self.pathB) os.chdir(self.pathB) for i in range(0, len(fileList)): shutil.copy(filePath[i] + '/' + fileList[i], os.getcwd() + '/' + fileList[i]) funcs.simPara(filePath[1], fileList[1], simPara) funcs.editGeo(os.getcwd(), os.getcwd(), meshPara[0], meshPara[1], meshPara[2], meshPara[3]) subprocess.call("/tools/gmsh/2.9.2/bin/gmsh -2 -order 9 divConv2D.scr", shell=True) subprocess.call("~/bin/MeshConvert divConv2D.msh geom.xml", shell=True) subprocess.call("~/bin/IncNavierStokesSolver geom.xml " + fileList[1] + ' > log.txt', shell=True) j = funcs.MaxChk(self.pathB) args = 'cp ' + 'geom_' + str(j) + '.chk' + ' geom3D.bse' subprocess.call(args, shell=True) os.chdir(path)
def vtuHyp(): path = os.getcwd() N = funcs.MaxChk(path) for i in range(0, N + 1): if not (os.path.exists(os.getcwd() + '/geom_' + str(i) + '.vtu')): args = '~/.sg/FieldConvert geom.xml ' + 'geom_' + str( i) + '.chk ' + 'geom_' + str(i) + '.vtu' subprocess.call(args, shell=True)
def dist(): N = funcs.MaxChk(os.getcwd()) for i in range(0, N + 1): args = 'FieldConvert -m concatenate geom.xml geom_' + str( i) + '.chk/*.fld geom_' + str(i) + '.fld' subprocess.call(args, shell=True) args = 'FldAddFld -1 1 geom3D.bse geom_' + str( i) + '.fld ' + 'geom' + str(i) + '.fld' subprocess.call(args, shell=True) args = 'FieldConvert geom.xml geom' + str(i) + '.fld geom' + str( i) + '.vtu' subprocess.call(args, shell=True)
import sys, os; sys.path.append("~/Dropbox/script") import funcs; N=funcs.MaxChk(os.getcwd()); for i in range(0,N+1): args='FldAddFld -1 1 geom3D.bse geom_'+str(i)+'.chk '+'geom'+str(i)+'.fld'; subprocess.call(args,shell=True); args='FieldConvert geom.xml'+' geom'+str(i)+'.fld'+' geom'+str(i)+'.vtu'; subprocess.call(args,shell=True);