CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Main CFD Forum (
-   -   Can you paint triangles? (

Nishikawa May 15, 2000 22:20

Can you paint triangles?

I have a triangular mesh. I want to color the triangles according to the values associated with the elements, such as cell-residuals. (So, for example, one triangle is blue, and another red indicating the values associated with each element. Yes, just like a contour plot, but element-wise)

Is there any plotting softwares that can do this? (Tecplot CANNOT do this.) Or maybe I have to write a code myself?????

Thank you,


Carlos May 16, 2000 16:59

Re: Can you paint triangles?
Hi... Try to use MATLAB or MATHEMATICA softwara


Carlos Vilela

Nishikawa May 16, 2000 21:02

Re: Can you paint triangles?
Thanks. Well, it looks like I must write such a program myself.....

Mahesh Prakash May 17, 2000 03:35

Re: Can you paint triangles?
I am not sure whether there is any commercially available software doing this but your idea is really good.

Joern Beilke May 17, 2000 05:40

Re: Can you paint triangles?
Where is the problem?

Just store the data you want to use in the same way as the other postprozessing items.

So you can use the cell aspect ratio in the same way as the pressure or some residuals.

Nishikawa May 17, 2000 06:19

Re: Can you paint triangles?
The problem is that some quantities are stored at nodes but other quantities are stored in cells.

Usually, you give nodal values (such as pressure) to a plotting software. And the software will interpolate the values (typically piecewise linear), and produce a contour plot. That is why you need to transfer the data obtained by Finite-Volume Method (cell-averages) to the nodes by some extrapolation before you send the data to a plotter for visualization.

I use a cell-vertex scheme where I have many quantities associated with triangles, and I want to see, for example, which element has the largest cell-residual, the pattern of the cell-residuals (+ or -) over the mesh, or a certain integer quantity assigned in each element. I want to see these clearly, and so do not want to use any extrapolation to nodes. I do want to color the triangles.

Joern Beilke May 17, 2000 06:56

Re: Can you paint triangles?
At least Prostar (StarCD) and EnSight are able to work with cell and vertex based results.

Plotting the cell based data just does not look very smooth.

Also the plotting of the residual distribution seems to be a standard feature which should be available at most codes.

Ricardo Bonon May 17, 2000 16:48

Re: Can you paint triangles?
Hi Nishikawa,

The answer to your question is a software called MeshTV. It is a post-processing tool developed at the Lawrence Livermore National Laboratory, and it is capable of handling both node centered data and cell centered data. Besides this, when you make contour plots in it, you have the option to use a nodal average interpolation or an element average interpolation, which does exactly what you want (color triangles accordingly to the data associated with them).

MeshTV is a free software, and Iīve been using it on Linux and SGI. Itīs quite a powerfull program, you should try. Itīs available from this homepage

But you have one problem to use MeshTV. It reads data written in its own proprietary binary format called SILO. In the download page you will find a link to download the SILO library of functions to write data in SILO format both for C and FORTRAN. SILO has some sparse documentation, s you will have to hack a little bit to get your data on MeshTV.

Iīve written an application called asc2silo which converts ASCII files containing mesh and data info into SILO files. It can convert meshes stored in an specilly formated ASCII, and meshes generated by EasyMesh (a excellent 2D delaunay mesh generator). For the data info thereīs another ASCII file format, as simple as that for the mesh.

asc2silo has little (in fact no) documentation, so if you find it would be usefull I can send it to you, but you will have to hack on it.

Thatīs it.

Ricardo Bonon

All times are GMT -4. The time now is 12:35.