CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Main CFD Forum (
-   -   Contour Drawing Algorithm (

Abhijit June 2, 2002 17:35

Contour Drawing Algorithm

Can anyone direct me to a paper/book that discribes algorithm to find Isolines, given a variable distribution in a domain phi(x,y) and x,y coordinates of points at which phi is known.



adarsh June 3, 2002 02:54

Re: Contour Drawing Algorithm
use matlab software .. adarsh

Abhijit Tilak June 3, 2002 12:53

Re: Contour Drawing Algorithm
That's a trivial answer


kunal June 3, 2002 17:26

Re: Contour Drawing Algorithm
i generally use gri for drawing vectors to color contours. it has a very nice FAQ and documentation and you can easily get scripts from there. gri can be downloaded from

if you decide to use gri and have any problems using it let me know


adarsh June 4, 2002 03:06

Re: Contour Drawing Algorithm
kunal , can you pleas echeck the url again .. i am unable to get it..pls check the spellings.. adarsh

Rami June 4, 2002 04:38

Re: Contour Drawing Algorithm
it is

Oleg Melnik June 4, 2002 09:57

Re: Contour Drawing Algorithm
You can use PGPLOT. It's a fortan package working on most platforms.


Adarsh June 6, 2002 14:19

Re: Contour Drawing Algorithm
is there any advantage offered by gri or PGPLOT over matlab .. can these packages support 3-d visualizations .. infact i am looking for a package for 3-d viewing of a NS-computation... thanks in advance


Rob Mason June 7, 2002 05:55

Re: Contour Drawing Algorithm
The main advantage has to be that gri and PGPLOT are free and easily available online. I've never used gri but know that PGPLOT can be used for 3D visualisations. The best free software that I've found for 3D visualisations is Scilab, however. This is similar in design and use to matlab and loads of examples for 2D and 3D plotting can be found online. Scilab is also available for most platforms and in my experience is very easy to install on both windows and unix.

visit for information, examples, and downloading of the software


senthil June 7, 2002 08:20

Re: Contour Drawing Algorithm
hi you can use Plotmtv. it's a small and good package for contours. You can get it online. Just search in google for Plotmtv you'll get it. bye senthil

Jonas Holdeman June 7, 2002 17:01

Re: Contour Drawing Algorithm
Since no one has addressed your question directly, I will give it a shot.

Efficient contour plotting was a matter of great interest maybe 20 years ago. There were a number of algorithms published. One source of published algorithms was the journal "Communications of the Association for Computing Machinery" (CACM) and the set of algorithms was referred to as the "Collected Algorithms of the ACM." Later the algorithms were published in a special journal "Transactions on mathematical software" (TOMS).

There may be better algorithms now, but the old method went something like this:

(1) Assume you have a plot package that can plot straight line segments. (2) Construct a fine grid with (x,y) coordinates over the domain on which you want to plot. (3) Evaluate the function to be coutoured at each node by computing the function or perhaps interpolating some discrete approximation. (4) Select a list of coutour levels to be plotted. (5) For each rectangle of the grid: (a) Find the largest and smallest function values on the corners. (b) Ignore the contour levels outside the range of the largest and smallest values. (c) For each acceptable contour and for each edge, find the coordinate values of the intersection of the contour level and the straight line joining the function values at the corners. (d) Plot the line segments joining coordinates with equal contour values. END

That is enough to give you contours, but you probably won't like it. You probably want to label contours, and there will be problems when a saddle point lies inside a rectangle, and there are axis labels, etc., etc., etc.

For all those details you would best follow the advice given previously. But the above description is enough to write a contouring program.

Abhijit Tilak June 8, 2002 01:06

Re: Contour Drawing Algorithm
Hi Jonas,

Thanks for your answer. Actually I should have said "Contour Finding Algorithm" I was looking for something like this.I will look out for the references you gave. Actually I don't need to draw the contours just find the x,y position related to particular value of phi=const.This subroutine will plug in to my code. i am solving a 2-D Inverse problem in heat conduction where T(x,y) at surface of a body is known. Intermidiate step involves finding surface of phi=const, then extracting x & y coordinates corresponding to that phi=c & update the guess for unknown geometry. Anyway thanks for the answer.If you know anything further please let me know.

Abhijit Tilak.

stefan June 10, 2002 08:47

Re: Contour Drawing Algorithm

All times are GMT -4. The time now is 13:15.