我在将 3D 网格从 导入gmsh
到fipy
. 我已经浏览了关于gmsh
和fipy
在这个论坛上的所有问题,但不幸的是我没有找到类似的主题。
我正在将生成的 3D 圆柱网格导入gmsh 4.0
到 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、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:\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'