Problem with visualizing material type in ParaView

Hi every one,


I have run initialization simulation to obtain initial pressure and temperature conditions that follow hydrostatic pressure gradient and geothermal temperature gradient, respectively. The model has three material types; sand, well1, and well2. I have read the "INFILE" using Python and exported it to an unstructured VTK file and visualized it with ParaView. I could see the pressure and temperature results, however I couldn't see the material type. This is the code that I used to read the input file and export it to an unstructured VTK file.

import numpy
import toughio

parameters = toughio.read_input("INFILE")
points = numpy.array([v["center"] for v in parameters["elements"].values()])
incons = numpy.array([v["values"] for v in parameters["initial_conditions"].values()])

mesh = toughio.meshmaker.triangulate(points)
mesh.add_point_data("pressure", incons[:, 0])
mesh.add_point_data("temperature", incons[:, 3])


Thanks in advance

6replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • You also have to export material data (which are stored for each element under the key "material"):

    rocks = numpy.array([v["material"] for v in parameters["elements"].values()])
    mesh.add_point_data("material", rocks)

    Note that because the mesh is reconstructed using Delaunay triangulation from a point cloud, material properties will be associated to point data "material". But you will also notice in Paraview another property called "material" associated to cell data as toughio always create a uniform cell data array "material" (as shown in your figure).

    • Keurfon Luu I have exported the material data, but it seems that the problem still exists!. I find the data range is [1,1] for the exported material!.

    • Refaat G Hashish Have you appended the code in my previous answer to your script?

      import numpy
      import toughio
      parameters = toughio.read_input("INFILE")
      points = numpy.array([v["center"] for v in parameters["elements"].values()])
      incons = numpy.array([v["values"] for v in parameters["initial_conditions"].values()])
      rocks = numpy.array([v["material"] for v in parameters["elements"].values()])
      mesh = toughio.meshmaker.triangulate(points)
      mesh.add_point_data("pressure", incons[:, 0])
      mesh.add_point_data("temperature", incons[:, 3])
      mesh.add_point_data("material", rocks)

      Running this script, I get a new point data array named "material" in ParaView:

    • Keurfon Luu I got it.  Thanks!

    • Refaat G Hashish Anyway, with the latest version of toughio (v1.4.4), you can accurately reconstruct a mesh generated by TOUGH's MESHMAKER using the function toughio.meshmaker.voxelize.

      mesh = toughio.meshmaker.voxelize(points, origin=[0.0, 0.0, -50.0])
      mesh.add_cell_data("pressure", incons[:, 0])
      mesh.add_cell_data("temperature", incons[:, 3])
      mesh.add_cell_data("material", rocks)
    • Keurfon Luu I got it. Thanks again!

Like Follow
  • 8 mths agoLast active
  • 6Replies
  • 53Views
  • 2 Following