python - 将 gmsh 生成的 3D 网格导入 fipy 时出错
问题描述
我在将 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'
解决方案
FiPy 3.3 解决了 Windows 上 Gmsh 的一些问题。请升级并让我们知道您是否仍有问题。
推荐阅读
- mongodb - 在 mongo 4.4 中,位置投影不能与文字错误一起使用
- python - 我们可以只使用函数在 python 中创建一个测验并跟踪分数吗
- android - 自定义 android 11 更新
- python - 如果 NaN,Pandas 用以前的值替换当前值
- git - 使用 Azure DevOps REST API 更新 Git 存储库中的文件编码
- powerbi-desktop - 单击 PowerBI 中的列多维度量
- database - 我在本地(xampp)服务器中的 wordpress 站点现在显示“建立数据库连接时出错”
- domain-driven-design - 使用 DDD CQRS 时数据的完整性
- javascript - 我可以修补现有类以扩展另一个类吗?
- azure - 如何为新数据/更新数据同步 2 个 Azure 存储帐户?