nschloe / meshio

:spider_web: input/output for many mesh formats
MIT License
1.91k stars 396 forks source link

polyhedral cells in ansys #337

Open hjxy2012 opened 5 years ago

hjxy2012 commented 5 years ago

Great job. It works well with non-polyhedral cells. But when I tried to read polyhedral cells, the error came as follow.

WARNING:root:Unknown index '4'. Skipping.
WARNING:root:Unknown index '64'. Skipping.
Traceback (most recent call last):
  File "c:\program files\python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\program files\python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Program Files\Python37\Scripts\meshio-convert.exe\__main__.py", line 9, in <module>
  File "c:\program files\python37\lib\site-packages\meshio\cli.py", line 22, in main
    mesh = read(args.infile, file_format=args.input_format)
  File "c:\program files\python37\lib\site-packages\meshio\helpers.py", line 174, in read
    return format_to_reader[file_format].read(filename)
  File "c:\program files\python37\lib\site-packages\meshio\ansys_io.py", line 323, in read
    data = _read_faces(f, line)
  File "c:\program files\python37\lib\site-packages\meshio\ansys_io.py", line 183, in _read_faces
    key, num_nodes_per_cell = element_type_to_key_num_nodes[element_type]
KeyError: 5
nschloe commented 5 years ago

Does meshio support polyhedral cells now?

Nope. :)

Working on something for VTK in #323 though. You're into ANSYS? A small example file would be nice.

liszi commented 5 years ago

Really great tool:) It would be nice to have this feature too. Let me provide some details on ansys polyhedral meshes:

Here is how a polyhedral faces look like:

(13 (2 1 d4f a 0)(
...
4 12e5 12e8 12e9 12e6 13d 0
6 12e7 12ea 12eb 12ec 12ed 12e8 13d 0
5 12e8 12ed 12ee 12ef 12e9 13d 0
...
))

First face is quad, second and third are polyhedrals (pentagon and hexagon).

Here is a relatively small example file: polihedral-test.txt