Converting the mesh file generated from GMSH to a mesh file that can be read on ANSYS
I did my mesh and I tried to insert the mesh directly into ANSYS, but a problem occured. I tried to use meshio code to convert it:
**import meshio
Load the GMSH .msh file
mesh = meshio.read("C:\Users\86159\Desktop\Converting GMSH to ANSYS\Traial_2\Basement_1.msh")
Convert the mesh to an ANSYS mesh file
meshio.write("Basement_1.inp", mesh, file_format="ansys")**
but I got this error:
**PS C:\Users\86159> & C:/Users/86159/AppData/Local/Programs/Python/Python311/python.exe "c:/Users/86159/Desktop/Converting GMSH to ANSYS/Traial_2/Traial_2.py"
Traceback (most recent call last): File "C:\Users\86159\AppData\Local\Programs\Python\Python311\Lib\site-packages\meshio\ansys_ansys.py", line 445, in write ansys_cell_type = meshio_to_ansys_type[cell_type] ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^ KeyError: 'line'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "c:\Users\86159\Desktop\Converting GMSH to ANSYS\Traial_2\Traial_2.py", line 5, in meshio.write("mesh.inp", mesh, file_format="ansys") File "C:\Users\86159\AppData\Local\Programs\Python\Python311\Lib\site-packages\meshio_helpers.py", line 188, in write return writer(filename, mesh, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\86159\AppData\Local\Programs\Python\Python311\Lib\site-packages\meshio\ansys_ansys.py", line 448, in write raise KeyError( KeyError: "Illegal ANSYS cell type 'line'. (legal: triangle, tetra, quad, hexahedron, pyramid, wedge)"
It seems that there are mesh elements in GMSH (line) where ANSYS cannot read, ANSYS only reads : Triangle: 2 Quadrilateral: 3 Tetrahedron: 4 Hexahedron: 5 Pyramid: 6 Wedge: 7
my mesh has the following: 10250 nodes, 170 lines, and 19938 Triangles. Now, how do I change these line elements in my mesh?