将gmsh生成的3D网格导入Fipy时出错

时间:2018-12-28 07:39:58

标签: python mesh fipy

将3D网格从gmsh导入到fipy时遇到很多麻烦。我已经在该论坛上浏览了有关gmshfipy的所有问题,但是很遗憾,我没有找到类似的话题。

我正在将gmsh 4.0生成的3D圆柱网格导入FiPy。我目前正在使用python 2.7,我的操作系统是Windows 10(64位)。

根据fipy手册,Gmsh3D函数应将gmsh网格转换为fipy网格,因此我写道:

from fipy import * 

mesh = Gmsh3D('C:\Users\William\Documents\Python Scripts\cylinder3.msh')

此外,我的Gmsh exe,网格(cylinder.msh)和python代码都位于同一目录中。

但是,我一直收到“ [错误32]进程无法访问文件,因为该文件正在被另一个进程使用”。我在下面附上完整的错误消息。任何人都经历过并且已经解决了这个问题?任何指针表示赞赏。预先感谢!

完整错误消息:

runfile('C:/Users/William/Documents/Python Scripts/cylinder1.py', wdir='C:/Users/William/Documents/Python Scripts')

回溯(最近通话最近一次):

File "<ipython-input-1-c2ebfb9899c3>", line 1, in <module>
    runfile('C:/Users/William/Documents/Python Scripts/cylinder1.py', wdir='C:/Users/William/Documents/Python Scripts')

File "C:\Users\William\Anaconda2\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 668, in runfile
    execfile(filename, namespace)

File "C:\Users\William\Anaconda2\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 93, in execfile
    exec(compile(scripttext, filename, 'exec'), glob, loc)

File "C:/Users/William/Documents/Python Scripts/cylinder1.py", line 23, in <module>
    mesh = Gmsh3D('C:\Users\William\Documents\Python Scripts\cylinder3.msh')

File "C:\Users\William\Anaconda2\lib\site-packages\fipy\meshes\gmshMesh.py", line 1944, in __init__
    self._orderedCellVertexIDs_data) = self.mshFile.read()

File "C:\Users\William\Anaconda2\lib\site-packages\fipy\meshes\gmshMesh.py", line 853, in read
    os.unlink(self.elemsPath)

WindowsError: [Error 32] The process cannot access the file because it is being used by another process: 'c:\\users\\william\\appdata\\local\\temp\\tmp1bhyl6Elements'

1 个答案:

答案 0 :(得分:0)

FiPy 3.3解决了Windows上Gmsh的一些问题。请升级,如果您仍有问题,请告诉我们。