我在将 3D 网格从gmsh
导入fipy
时遇到了很多麻烦。我已经浏览了这个论坛上有关gmsh
和fipy
的所有问题,但不幸的是我没有找到类似的主题。
我正在将gmsh 4.0
生成的 3D 圆柱网格导入 FiPy。我目前使用的是python 2.7,我的操作系统是Windows 10,64位。
根据fipy
手册,Gmsh3D 函数应该将gmsh
网格转换为fipy
网格,因此我写道:
from fipy import *
mesh = Gmsh3D('C:UsersWilliamDocumentsPython Scriptscylinder3.msh')
此外,我的Gmsh exe,mesh(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:UsersWilliamAnaconda2libsite-packagesspyder_kernelscustomizespydercustomize.py", line 668, in runfile
execfile(filename, namespace)
File "C:UsersWilliamAnaconda2libsite-packagesspyder_kernelscustomizespydercustomize.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:UsersWilliamDocumentsPython Scriptscylinder3.msh')
File "C:UsersWilliamAnaconda2libsite-packagesfipymeshesgmshMesh.py", line 1944, in __init__
self._orderedCellVertexIDs_data) = self.mshFile.read()
File "C:UsersWilliamAnaconda2libsite-packagesfipymeshesgmshMesh.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'
FiPy 3.3 解决了 Windows 上 Gmsh 的一些问题。请升级,如果您仍有问题,请告诉我们。