Compute shared surface area using cell data in unstructured grid


I am working with polycrystalline microstructure models that were initially created using DREAM.3D in a voxelated format. Each model is converted to a triangular geometry (i.e., unstructured grid) with smoothened grain boundaries within DREAM.3D. An .stl file is then exported for each grain, which is meshed using gmsh and the collection of meshed grains are then joined into a single ABAQUS input file. After I perform finite element method simulations, a Python script extracts the unique grain ID at each element and produces a .vtk file as shown below.

I would like to compute the shared surface area between each grain and its nearest neighbors. An example microstructure model is shown below with ~6.4 million tetrahedral elements and 204 grains (color coded).

The grains have an average of 10 neighbors and as many as 50. I see that I could use the cell size filter to compute the volume of each tetrahedral but I cannot seem to compute the area of each triangle. Is there a way within ParaView to compute the shared surface area between each grain and its neighbors (i.e., using the Cell data, which is “GID” here)? Alternatively, I can compute this using Python, IF there is a way within ParaView to determine and export the value of cell data (in this case “GID”) on both sides of each triangle.

Please let me know if I can clarify further and thank you in advance for your help. I am using ParaView version 5.9.0-RC4 on Windows 10.

Best regards,

Hi @Krzysztof_Stopka ,

Maybe you are looking for the DigitalRockPhysics plugin:


Hey @mwestphal,

Thank you for the suggestion! I attempted to use the plugin but it seems that the Input must be vtkImageData, whereas my .vtk file is composed of an unstructured grid of tetrahedrals. I am not sure if there is a way to get around this… I already have the voxelated version of this model with the statistics I need, but the issue is that the stair-stepped boundary between grains skews these statistics.

Do you have any other suggestions I might be able to pursue within ParaView? As I mentioned, if it were possible to export the cell data on either side of each triangular face and export this, I could process the data further in Python to compute the statistics.

I uploaded a sample .vtk file here: SEM_141_keyhole.vtk - Google Drive

Best regards,

Image data uses structured datasets, so if you would use a vtkImageData format, you would end up with the stair-stepped boundaries.

I’m not familiar with your file format but an idea that partially uses Paraview and partially Python is to:

  • Within ParaView extract cells of just one grain. Find Data, Extract Selection could be useful here
  • Save the data as a .csv file
  • Repeat this for a bounding grain
  • Then in Python read both csv files and find points with common coordinates
  • With a list of coordinates you could extrapolate a surface through these points and calculate its surface

Admittedly, this is a labor intensive method. You could partially automate it by tracing the ParaView commands such that you can run them from Python.