Message Boards Message Boards

0
|
6450 Views
|
7 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Handling concavity in ListContourPlot

Posted 5 years ago

I have imported some CFD results (in csv format) into Mathematica to do some further processing of the data.

One of my 2D geometries is as:

enter image description here

Now, when I try to do the contour plot, I get the following:

enter image description here

Why is contour plot filling those areas above and below the narrow section with purplish color. Those regions are not even within my X and Y coordinates (see the image for geometry above)?

Any ideas?

Thanks

Cross-posted here. I am attaching a sample of my data (a csv file for the above geometry). Note that I am only working with columns 1 and 2 (as x and y) and column 6, as my velocity in z direction.

Attachments:
POSTED BY: Mohammad Faghih
7 Replies

I’ve suggested another hacky solution here Stack Exchange

POSTED BY: Ian Williams

Hello Mohammad,

a 'quick and dirty' method would be to just cutting off the bottom using PlotRange:

ListContourPlot[xyutubeArbitrary, Contours -> 500, 
 ColorFunction -> "Rainbow", ContourStyle -> None, 
 AspectRatio -> Automatic, PlotLegends -> Automatic, 
 PlotRange -> {.004, Automatic}]

enter image description here

Does that help? Regards -- Henrik

POSTED BY: Henrik Schachner

Thanks. It is useful.

POSTED BY: Mohammad Faghih
Posted 5 years ago

Looks very similar to this question.

POSTED BY: Rohit Namjoshi

Cross-posted here.

Which is also mentioned in the original post.

POSTED BY: Mohammad Faghih
Posted 5 years ago

Can you post the exact code you use to create your plots? It's not obvious how to get from the CSV to your plots.

POSTED BY: Kyle Martin

To import the csv file:

       tubeArbitrary = Import["tube_arbitrary.csv", "HeaderLines" -> 1];

To extract the x and y, each in a separate list:

       XtubeArbitrary = tubeArbitrary[[All, 1]];

       YtubeArbitrary = tubeArbitrary[[All, 2]];

To extract x and y and U velocity in z direction in a single data-set:

        XYUtubeArbitrary = tubeArbitrary[[All, {1, 2, 6}]];

To plot the geometry based on the (x,y) points:

   ListPlot[Thread[{XtubeArbitrary, YtubeArbitrary}], PlotRange -> Automatic, AspectRatio -> Automatic];

To contourplot it:

      ListContourPlot[XYUtubeArbitrary, Contours -> 500, ColorFunction -> "Rainbow", ContourStyle -> None, AspectRatio -> Automatic, PlotLegends -> Automatic];
POSTED BY: Mohammad Faghih
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract