vtkwrite icon indicating copy to clipboard operation
vtkwrite copied to clipboard

Exporting Solution & Mesh Information

Open LTurton opened this issue 4 years ago • 0 comments

I'm looking to export some sets of data to the VTK filetype for use in paraview (this is a requirement I'm aware MATLAB has capable visulisation tools). Firstly I have a tetrahedral unstructured mesh. The data from this consists of 3 column vectors for nodal x,y and z coordinates, each N_nodes in length and a N_ele x 4 connectivity matrix. Along side this geometrical information, I also have some vector solutions Bx, By and Bz, each column vectors of length N_nodes. There is an additional scalar solution, B_mag of the same length.

Code of the form: vtkwrite(filename,'unstructured_grid',x,y,z,'vectors','B_field',Bx, By, Bz,'scalars','B_mag',B_mag)

Works in outputting the nodal information and allowing paraviewer to visualise but the structural information from the tetrahedral connectivity grid clearly isn't included. Matlab 3D vectors to Paraview (via binary VTK file) works in much the same way though it has weird connections between lines on some visualisations.

It has an alternative option for including tetrahedral meshes as 'polydata':

vtkwrite(filename,'polydata','tetrahedron',x,y,z,ele)

But this doesn't contain any of the solution data I wish to map with.

From reading the GITHUB I thought including both sets of commands i.e:

vtkwrite(filename,'polydata','tetrahedron',x,y,z,ele,'unstructured_grid',x,y,z,'vectors','B_field',Bx, By, Bz,'scalars','B_mag',B_mag)

Would help but this just generates one of the two previous filetypes depending on which order the commands are given. The two files are nodal_data and poly_data in the attached zip. A workspace export as workspace.mat is also provided to allow the problem to be recreated.

Files.zip

LTurton avatar Mar 25 '20 13:03 LTurton