Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assertion error #373

Closed
rzsd1374 opened this issue Apr 4, 2019 · 4 comments
Closed

assertion error #373

rzsd1374 opened this issue Apr 4, 2019 · 4 comments

Comments

@rzsd1374
Copy link

rzsd1374 commented Apr 4, 2019

If you're having problems converting from or to a mesh format, remember to attach a mesh that shows the problem. This will enable other people to reproduce and fix the problem.
Hi
I wanted to convert a .msh file by meshio,but this error appears:

Traceback (most recent call last):
  File "/home/reza/.local/bin/meshio-convert", line 10, in <module>
    sys.exit(main())
  File "/home/reza/.local/lib/python3.5/site-packages/meshio/cli.py", line 22, in main
    mesh = read(args.infile, file_format=args.input_format)
  File "/home/reza/.local/lib/python3.5/site-packages/meshio/helpers.py", line 174, in read
    return format_to_reader[file_format].read(filename)
  File "/home/reza/.local/lib/python3.5/site-packages/meshio/msh_io/main.py", line 14, in read
    mesh = read_buffer(f)
  File "/home/reza/.local/lib/python3.5/site-packages/meshio/msh_io/main.py", line 30, in read_buffer
    assert line == "$MeshFormat"
AssertionError

and I cannot understand what is the problem.Can anyone help me?
regards

sirkel4.zip

@gdmcbain
Copy link
Contributor

gdmcbain commented Apr 4, 2019

Hi there. I can dispel the mystery but not solve the problem. The suffix .msh has long been in use for several unrelated mesh formats, it being the obvious choice for an 8.3 filename. By default, meshio.read assumes that .msh means Gmsh's MSH file format; this is why it's looking for $MeshFormat.

The attached file isn't one of these.

head -1 sirkel4.msh 

(0 " Created by : Fluent_V6 Interface Vers. 11.0.8")

I do read on the front page that meshio handles ‘ANSYS msh’ (ANSYS bought Fluent a while back, didn't it?), but I don't know much about that myself.

@keurfonluu
Copy link
Contributor

As @gdmcbain said, your file is an ANSYS mesh file. You should use the option file_format to force meshio to read it as an ANSYS mesh file, such as:
msh = meshio.read("sirkel4.msh", file_format = "ansys-ascii")

@gdmcbain
Copy link
Contributor

gdmcbain commented Apr 4, 2019

Ah: try --input format ansys; e.g.

meshio-convert --input-format ansys sirkel4.m{,e}sh

Not quite sure that meshio is actually reading everything that's in the file, but that's a separate issue.

@nschloe
Copy link
Owner

nschloe commented Apr 5, 2019

Yup, that works.

k

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants