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

Issue converting INP to VTK file format #719

Closed
prince2110 opened this issue Feb 20, 2020 · 17 comments · Fixed by #722
Closed

Issue converting INP to VTK file format #719

prince2110 opened this issue Feb 20, 2020 · 17 comments · Fixed by #722

Comments

@prince2110
Copy link

I have attached the INP file for your reference. I had to compress it to zip as I was not allowed to upload INP file in this issue form.

The INP file consists of nodes and only volume elements along with element sets and solid sections. I am aiming to convert it to a file format such that I can view element sets in Paraview.

I am trying to convert this INP file to VTK format, but it throws me 'IndexError'. Following is the error details:

$ meshio-convert mesh_TET.inp mesh_TET.vtk

Number of points: 94
Number of cells:
tetra: 221
Traceback (most recent call last):
File "/home/prince/.virtualenvs/python101/bin/meshio-convert", line 8, in
sys.exit(convert())
File "/home/prince/.virtualenvs/python101/lib/python3.5/site-packages/meshio/_cli.py", line 50, in convert
write(args.outfile, mesh, file_format=args.output_format)
File "/home/prince/.virtualenvs/python101/lib/python3.5/site-packages/meshio/_helpers.py", line 125, in write
if value.shape[1] != num_nodes_per_cell[key]:
IndexError: tuple index out of range

mesh_file.zip

@nschloe
Copy link
Owner

nschloe commented Feb 20, 2020

It works in the latest revision of meshio; just upgrade.

@nschloe nschloe closed this as completed Feb 20, 2020
@prince2110
Copy link
Author

Thanks work your quick reply. It worked but VTK file has only surface information. Can you suggest me to which format I can convert this INP file such that I can view volume elements along with element sets in Paraview ?

@nschloe
Copy link
Owner

nschloe commented Feb 20, 2020

but VTK file has only surface information

Not true, all tets are contained:

o

@prince2110
Copy link
Author

Sorry Sir, for my lack of information. Just a last question, I had created element sets in INP file, but now in VTK how can I view those group of elements again ?

@nschloe
Copy link
Owner

nschloe commented Feb 20, 2020

Aha. Well, VTK doesn't support element sets as abaqus does. I suppose one could map those to integer cell functions. (It's really the reverse of what #716 is about.) I'll take a look.

@nschloe
Copy link
Owner

nschloe commented Feb 20, 2020

Alright, -s should help you out now.

@prince2110
Copy link
Author

prince2110 commented Feb 20, 2020 via email

@nschloe
Copy link
Owner

nschloe commented Feb 20, 2020

Respected Sir,

We call each other by our first names here. I'm Nico.

I am still struggling to figure out, how to display element sets using VTK file in paraview.

It should all work now. What have you tried?

@prince2110
Copy link
Author

prince2110 commented Feb 20, 2020 via email

@nschloe
Copy link
Owner

nschloe commented Feb 20, 2020

It works for me.

meshio-convert mesh_TET.inp out.vtk -s

and then open the vtk file.
h

@keurfonluu
Copy link
Contributor

Looks like a conversion issue. The scale goes completely through the roof in the VTK one.

@nschloe
Copy link
Owner

nschloe commented Feb 20, 2020

Works fine here?

@prince2110
Copy link
Author

I do not know if I am the most dumb person on this planet and I think I am. I convert INP to VTK using

$ meshio-convert mesh_TET.inp out.vtk

I have attached the VTK file as well.

When I open this directly on Paraview, I can see only this:
image

I don't understand if you guys are using some filters or some settings related to Color map in paraview.

Meshio Version

$ meshio-info --version
meshio 4.0.2 [Python 3.5.3]
Copyright (c) 2015-2020 meshio developers

Paraview version
Paraview 5.7.0

VTK.zip

@keurfonluu
Copy link
Contributor

I do not know if I am the most dumb person on this planet and I think I am. I convert INP to VTK using

$ meshio-convert mesh_TET.inp out.vtk

Your command is missing the option -s (see the answers above).

@keurfonluu
Copy link
Contributor

Note that you probably need to install the GitHub version of meshio:

pip install https://github.com/nschloe/meshio/archive/master.zip

@prince2110
Copy link
Author

prince2110 commented Feb 21, 2020

Finally figured out this little secret which I was missing out !! :)

image

And then I get this:

image

Thanks a lot guys for helping me !!

@kenza1994
Copy link

kenza1994 commented Feb 19, 2021

Hello,

I'm on a project where I need to do what you did in your example.

So, I took a cylinder that I cut into two mesh zones (zone1 = material1 and zone2 = material2). I output an .inp file

After that, I converted it to .vtk file with meshio by adding the -s command

However, when I open my .vtk file with paraview, nothing is displayed.

So, I tried to take yours, it opens and I can visualize the meshes (I can't see the colors of the different materials).

That why, I don't understand why on my side I can't see my files on paraview or see the colors.

How do you do it and which versions do you use?

Is there, something to modify in this .inp file to see the two distinct materials as well as the geometry and the mesh on paraview?

My file .inp is attached.

job.zip

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

Successfully merging a pull request may close this issue.

4 participants