Created
March 21, 2014 19:10
-
-
Save wd15/9693712 to your computer and use it in GitHub Desktop.
Workaround for FiPy ticket 668 http://matforge.org/fipy/ticket/668
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import fipy as fp | |
import sys | |
from subprocess import Popen, PIPE | |
mshFile = 'tmsh3d.msh' | |
if fp.parallelComm.procID == 0: | |
dimensions = 3 | |
geoFile = 'tmsh3d.geo' | |
gmshFlags = ["-%d" % dimensions, "-nopopup"] | |
gmshFlags += ["-part", "%d" % fp.parallelComm.Nproc] | |
gmshFlags += ["-format", "msh"] | |
p = Popen(["gmsh", geoFile] + gmshFlags + ["-o", mshFile], | |
stdout=PIPE) | |
p.wait() | |
fp.parallelComm.Barrier() | |
mesh = fp.Gmsh3D(mshFile) | |
print 'mesh from Geo done' | |
sys.stdout.flush() | |
mx,my,mz = mesh.getCellCenters() | |
print '3D mesh set up' | |
sys.stdout.flush() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment