我正在尝试使用 Gmsh3D 函数将先前使用 Gmsh 生成的 3D 网格导入到 Fipy,如下所示:
mesh = Gmsh3D(join(output,'case_1.msh'),communicator=serialComm)
我收到与其他类似帖子相同的错误,但建议的解决方案似乎对我不起作用:
GmshException: Gmsh hasn't produced any cells! Check your Gmsh code.
Gmsh output:
Info : Running 'gmsh C:\Users\pcnou\AppData\Local\Temp\tmppouz68km.geo -3 -nopopup -format msh2 -o C:\Users\pcnou\AppData\Local\Temp\tmp5es89ie5.msh' [Gmsh 4.6.0, 1 node, max. 1 thread]
Info : Started on Wed May 05 10:22:49 2021
Info : Reading 'C:\Users\pcnou\AppData\Local\Temp\tmppouz68km.geo'...
Info : Done reading 'C:\Users\pcnou\AppData\Local\Temp\tmppouz68km.geo'
Info : Meshing 1D...
Info : Done meshing 1D (Wall 0s, CPU 0s)
Info : Meshing 2D...
Info : Done meshing 2D (Wall 0s, CPU 0s)
Info : Meshing 3D...
Info : Done meshing 3D (Wall 0s, CPU 0s)
Info : 0 nodes 0 elements
Info : Writing 'C:\Users\pcnou\AppData\Local\Temp\tmp5es89ie5.msh'...
Info : Done writing 'C:\Users\pcnou\AppData\Local\Temp\tmp5es89ie5.msh'
Info : Stopped on Wed May 05 10:22:49 2021 (From start: Wall 0.00999999s, CPU 0.03125s)
我正在使用 Fipy 3.4.2.1、Python 3.7.9 和 Gmsh 4.8.4 开发 Win10。
我尝试将 .msh 文件转换为 .msh2 文件,但随后出现以下错误:
IndexError Traceback (most recent call last)
<ipython-input-47-38097a945970> in <module>
----> 1 mesh = Gmsh3D(join(output,'case_1.msh2'),communicator=serialComm) # Doesn't work
~\Anaconda3\envs\Ansys\Lib\site-packages\fipy\meshes\gmshMesh.py in __init__(self, arg, communicator,
overlap, background)
1991 self.cellGlobalIDs,
1992 self.gCellGlobalIDs,
-> 1993 self._orderedCellVertexIDs_data) = self.mshFile.read()
1994
1995 self.mshFile.close()
~\Anaconda3\envs\Ansys\Lib\site-packages\fipy\meshes\gmshMesh.py in read(self)
815 parprint("Recovering coords.")
816 parprint("numcells %d" % numCellsTotal)
--> 817 vertexCoords, vertIDtoIdx = self._vertexCoordsAndMap(cellsToGmshVerts)
818
819 # translate Gmsh IDs to `vertexCoord` indices
~\Anaconda3\envs\Ansys\Lib\site-packages\fipy\meshes\gmshMesh.py in _vertexCoordsAndMap(self,
cellsToGmshVerts)
1008 allVerts = nx.unique(nx.array(allVerts, dtype=nx.INT_DTYPE)) # remove dups
1009 allVerts = nx.sort(allVerts)
-> 1010 maxVertIdx = allVerts[-1] + 1 # add one to offset zero
1011 vertGIDtoIdx = nx.ones(maxVertIdx, 'l') * -1 # gmsh ID -> vertexCoords idx
1012 vertexCoords = nx.empty((len(allVerts), self.coordDimensions))
IndexError: index -1 is out of bounds for axis 0 with size 0
当我使用该.geo
文件时也会发生同样的情况。是网格本身的问题还是我对 Gmsh3D 做错了什么?任何帮助将不胜感激。
我首先尝试使用这个我希望使用的网格链接,但我不确定网格本身没有任何问题。所以我然后尝试使用以下 .msh 文件:链接和相应的 .geo 文件:链接,但都没有工作。
谢谢你。