Importing VTU/VTK into MATLAB/Python

725 views
Skip to first unread message

Buhari Ibrahim

unread,
Apr 19, 2022, 2:53:40 PM4/19/22
to PRISMS-PF Users
Hi everyone,

Is there a way to import .vtu/.vtk files into Matlab? I was thinking of converting them into HDF5 files for use in Matlab, but could not find a way doing that. Does anyone have an idea how to do that, or just a better way to process .vtu/.vtk data in Matlab in general? Thank you.

Buhari Ibrahim.

Farid Mehri Sofiani

unread,
Apr 19, 2022, 5:00:25 PM4/19/22
to PRISMS-PF Users
Hello Buhari,

I am using meshio library (https://pypi.org/project/meshio/2.3.5/) in Python. You can process .vtu data into data frames using numpy and pandas and take them into MATLAB. Hope this helps. 


kind regards,
Farid   

Buhari Ibrahim

unread,
Apr 20, 2022, 1:15:39 AM4/20/22
to PRISMS-PF Users
Hi Farid,

Thank you very much for this information. I'll give that try.

Regards,
BI.

David Montiel Taboada

unread,
Apr 20, 2022, 1:20:51 PM4/20/22
to Buhari Ibrahim, PRISMS-PF Users
Thank you, Farid. This is very helpful.

David 


--
You received this message because you are subscribed to the Google Groups "PRISMS-PF Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prisms-pf-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prisms-pf-users/573accae-862c-4774-a030-08840536b139n%40googlegroups.com.

Buhari Ibrahim

unread,
May 1, 2022, 11:40:09 PM5/1/22
to PRISMS-PF Users
Hi,

So I am trying to measure the evolution of the neck for the two spheres (for the 2D case for now); the reason I wanted to convert the .vtu files into hdf5. I was able to do the conversion, and I plotted the nodal coordinates for the order parameter c. Somehow, though, I feel like the density of the mesh at the interface is not representative of that from the simulation; in the simulation, the interface appears to be very thin but in the Matlab, it looks like a relatively thick zone with very fine mesh. I am not sure what the discrepancy is or could I just be misunderstanding the figures?

Also, from one of the video tutorials, I saw that Min. ref. level determines the coarseness of the mesh in a region whereas the Max. is fine meshes, but is there a way to define these regions? For example, if I only wanted the interface(or a portion of it thereof) to have a Ref. level of 6 and 2 in the bulk, how could I achieve that? Thank you very much.

Buhari.
Paraview.jpeg
Matlab.jpg
Reply all
Reply to author
Forward
0 new messages