CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Main CFD Forum (http://www.cfd-online.com/Forums/main/)
-   -   To plot a grid using Gnuplot (http://www.cfd-online.com/Forums/main/8038-plot-grid-using-gnuplot.html)

Jim September 3, 2004 05:43

To plot a grid using Gnuplot
 
I have a 2-D unstructured grid for CFD calculations formed by triangles. I.e. there are two arrays: {i, x(i), y(i)} and {j, j1,j2,j3} where x(i),y(i) are coordinates of i-th node; j1,j2,j3 are nodes of j-th triangle. Is it possible to apply well known package Gnuplot (ver 4.0) to draw such grid and how to do this?

Thanks in advance.

Tom September 3, 2004 06:44

Re: To plot a grid using Gnuplot
 
If you output your grid as

# First cell

x1 y1

x2 y2

x3 y3

x1 y1 # Second cell ...

where (x1,y1), (x2,y2) and (x3,y3) are the (consecuitive vertices of the triangle then gnuplot should be able to plot the grid with the usual plot command.

Jim September 3, 2004 08:05

Re: To plot a grid using Gnuplot
 
Thanks Tom, all works perfectly.

Jim.

krishna September 3, 2004 10:16

Re: To plot a grid using Gnuplot
 
Hi Tom,

The same question, in case i have a structured grid, with x,y co-ordinates for all the node points, GNU PLOT should be able to plot the same properly rt..

Plz confirm,

Thanks,

krishna.

Tom September 3, 2004 10:35

Re: To plot a grid using Gnuplot
 
You can do as I described above but using 4 points (which for a structured grid is a bit wasteful) or for each grid line in one direction ouput the (x,y) node values (remembering to inset a blank/comment line between each block) and then repeat in the other direction; i.e. if your node points are at x(M,N), y(M,N) then the file should look something like

# x direction

x(1,1) y(1,1)

x(2,1) y(2,1)

.....

x(M,1) y(M,1)

# 2nd grid line

x(1,2) y(1,2)

....

....

x(M,N) y(M,N)

# Now y direction

x(1,1) y(1,1)

x(1,2) y(1,2)

....

x(1,N) y(1,N)

etc

amol palekar September 3, 2004 16:32

Re: To plot a grid using Gnuplot
 
i think if you use 'set dgrid3d then you may plot even non grided data. -amol


All times are GMT -4. The time now is 22:04.