【发布时间】:2018-12-28 07:39:57
【问题描述】:
我在将 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:\Users\William\Documents\Python Scripts\cylinder3.msh')
另外,我的Gmsh exe、mesh(圆柱体.msh)以及我的python代码都在同一个目录下。
但是,我不断收到“[错误 32] 进程无法访问该文件,因为它正被另一个进程使用”。我在下面附上了完整的错误消息。任何人都经历过并解决了这个问题?任何指针表示赞赏。提前致谢!
完整的错误信息:
runfile('C:/Users/William/Documents/Python Scripts/cylinder1.py', wdir='C:/Users/William/Documents/Python Scripts')
Traceback(最近一次调用最后一次):
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'
【问题讨论】:
-
您是否有任何软件可以在临时文件创建后立即访问它(如防病毒套件)?
-
这种情况只发生在
Gmsh3D上吗?您是否尝试过 2D 网格?例如,examples/diffusion/circle.py是否有效?