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])
mesh.write("INFILE.vtu")
Thanks in advance
6 replies
-
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).