I have solved 2D incompressible Navier Stokes and written out a .dat file that includes x,y,u,v,p values. I am trying to get a 2D color heat graph like this one for my data

enter image description here

Here is what I have done so far trying to use Contourplot:

Data = Import[
UVP-steady-state.dat", "Table"];
x = Data[[3 ;; 16002, 1]];
y = Data[[3 ;; 16002, 2]];
u = Data[[3 ;; 16002, 3]];
v =  Data[[3 ;; 16002, 4]];
p =  Data[[3 ;; 16002, 5]];
grid = Transpose[{x, y}];
ListPlot[grid, PlotLabel -> "MeshPoints", AxesLabel -> {"x", "y"}, 
PlotRange -> Automatic, AspectRatio -> Automatic]
velocity = Transpose[{x, y, Sqrt[u*u + v*v]}];
pressure = Transpose[{x, y, p}];

My steady state solution is in this .dat file


I am able to make my solution look like this with TecPlot. enter image description here

For some reason Mathematica with ListContourPlot plots two fairly large gaps in the middle of the graph.

  • $\begingroup$ Try ColorFunction and ColorData. $\endgroup$
    – Pragabhava
    Apr 30 '13 at 22:41
  • 2
    $\begingroup$ @l3win, out of curiosity, how did you solve the Navier-Stokes equations? $\endgroup$
    – user21
    May 1 '13 at 6:58
  • $\begingroup$ @ruebenko any chance in future for NDSolve to solve Navier-Stokes out of the box..? $\endgroup$ May 1 '13 at 17:23
  • $\begingroup$ I used what is called the Projection Method for incompressible Navier-Stokes. I did not solve it with Mathematica but with Fortran :) $\endgroup$
    – l3win
    May 1 '13 at 17:23
  • 1
    $\begingroup$ @PlatoManiac, as much as I would like too, my contract with WRI does not allow me to discuss future development. I do, however, have a Navier-Stokes solver written in Mathematica. It would need (a lot of :-) polishing, however. $\endgroup$
    – user21
    May 1 '13 at 17:52

This is similar to your picture:

ListContourPlot[velocity, ColorFunction -> "Rainbow", 
                PlotLegends -> Automatic, PlotRange -> All, Contours -> 99, 
                ContourStyle -> {None}]

enter image description here

But this is on a finer grain

ListContourPlot[velocity, ColorFunction -> "Rainbow", PlotLegends -> Automatic]

enter image description here

ListContourPlot[velocity, ColorFunction -> "Rainbow", 
                PlotLegends -> Automatic, Contours -> 99, ContourStyle -> {None}]

enter image description here

  • $\begingroup$ Aaah Mathematica 9!!! Your PlotLegends is now fixed.... it was so messed up in Mathematica 8.0 $\endgroup$
    – dearN
    Apr 30 '13 at 23:25
  • $\begingroup$ what do you mean fixed? I am unable to use the command belisarius posted. It gives me an error for PlotLegends $\endgroup$
    – l3win
    May 1 '13 at 3:36
  • $\begingroup$ Does ListContourPlot only take in PlotLegends for Mathematica 9? $\endgroup$
    – l3win
    May 1 '13 at 3:52
  • $\begingroup$ Maybe I just have to edit how the contours are plotted and the range which they are plotted. Trying to get rid of the two big white gaps in the middle of the graph still $\endgroup$
    – l3win
    May 1 '13 at 18:13
  • $\begingroup$ @l3win There is a scaling problem. Let me try to fix it $\endgroup$ May 1 '13 at 18:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.