CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Post-Processing

Exporting Contour Plots

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree2Likes
  • 1 Post By floquation
  • 1 Post By Edgar Alejandro Martínez

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 19, 2017, 04:44
Default Exporting Contour Plots
  #1
New Member
 
Josh Dyson
Join Date: Mar 2011
Posts: 16
Rep Power: 12
jd210 is on a distinguished road
Dear Foamers,

I'm currently writing up the results from a Rayleigh-Taylor interface problem. I can quite easily show the interface in paraview. However when I present them I'd like to ensure all plots have the same aspect ratio, show the same amount of geometry and ideally on a grid plot.

My original thought was to export the contours as CSV files and plot the points in excel. However with openfoam's left to right cell sorting I can't think of a way to get the points in a useful order to plot. Does anyone know of some sort of method to do this?

Alternatively, does anyone how to ensure that in a paraview screenshot I can show the exact same geometry dimensions?

The comparisons I want to make are across grid resolutions like the below image, but the location of the top of the interface will vary which I'd like to show



Thanks in advance!
jd210 is offline   Reply With Quote

Old   January 19, 2017, 05:05
Default
  #2
Senior Member
 
floquation's Avatar
 
Kevin van As
Join Date: Sep 2014
Location: TU Delft, The Netherlands
Posts: 252
Rep Power: 18
floquation will become famous soon enough
Quote:
Originally Posted by jd210 View Post
My original thought was to export the contours as CSV files and plot the points in excel. However with openfoam's left to right cell sorting I can't think of a way to get the points in a useful order to plot. Does anyone know of some sort of method to do this?
I don't have a code for you, but it should be pretty easy to write a sorter in Python/Matlab/... using the following criterion:
"For any given point, its two adjacent points are the two points that are closest to that given point."
So, loop over all points, compute the distance to all other points, and sort based on that distance.
Something like:
Code:
Choose a random point p
pPrev=null;
While(not done)
  smallestDistance = inf
  nextPointIndex=-1;
  For all points q unequal to p and pPrev
    newD = d(p,q)
    if(smallestDistance > newD){
      smallestDistance = newD
      nextPointIndex = index of q
    }
  endfor
  sort q[nextPointIndex] next to p
  set pPrev = p
  set p = q[nextPointIndex]
endwhile
And since your shape is not closed, you might need a condition to "search the other way" as well. So if no new point is found, return to the starting point and search the other way (i.e. the second-closest point).

Quote:
Originally Posted by jd210 View Post
Alternatively, does anyone how to ensure that in a paraview screenshot I can show the exact same geometry dimensions?
Make a state-file which shows exactly what you want to see. Then, load that state file for each case and export the visualisation. (Do this without moving the camera after loading the case file!)
toolpost likes this.
floquation is offline   Reply With Quote

Old   January 20, 2017, 03:09
Default
  #3
New Member
 
Josh Dyson
Join Date: Mar 2011
Posts: 16
Rep Power: 12
jd210 is on a distinguished road
Thanks for your suggestion. I was hoping not to have to write a script, but in the end it wasn't so bad to do it in matlab.
jd210 is offline   Reply With Quote

Old   January 20, 2017, 04:01
Default
  #4
Senior Member
 
floquation's Avatar
 
Kevin van As
Join Date: Sep 2014
Location: TU Delft, The Netherlands
Posts: 252
Rep Power: 18
floquation will become famous soon enough
Quote:
Originally Posted by jd210 View Post
I was hoping not to have to write a script, but in the end it wasn't so bad to do it in matlab.
So you wrote the script?
If so, you might want to post it here such that future users that come across this topic may use it as well.
floquation is offline   Reply With Quote

Old   January 20, 2017, 04:06
Default
  #5
New Member
 
Josh Dyson
Join Date: Mar 2011
Posts: 16
Rep Power: 12
jd210 is on a distinguished road
Quote:
Originally Posted by floquation View Post
So you wrote the script?
If so, you might want to post it here such that future users that come across this topic may use it as well.
I will indeed, will test it a little more than once before I do though...
jd210 is offline   Reply With Quote

Old   September 15, 2021, 17:12
Default
  #6
New Member
 
Edgar Alejandro Martínez Ojeda
Join Date: Jul 2019
Posts: 20
Rep Power: 4
Edgar Alejandro Martínez is on a distinguished road
You can use fluidfoam as a way to export the fields and plot them using Python. I made a YouTube video on how to use it, perhaps it may help you: https://www.youtube.com/watch?v=wFZeFDUQflQ
cyss38 likes this.
Edgar Alejandro Martínez is offline   Reply With Quote

Reply

Tags
contour, paraview

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
generating 2d-planar contour plots from a contour plot on a curved surface alinik CFX 3 May 21, 2016 07:17
Exporting Contour plots for report paddywhacker Visualization & Post-Processing 1 March 26, 2014 08:27
vector plots and contour plots do not match swati_mohanty FLUENT 1 August 26, 2010 06:53
drawing of contour plots chinthakindi Main CFD Forum 1 April 27, 2004 05:33
Local surface contour line plots Nandu FLUENT 0 November 10, 2003 00:26


All times are GMT -4. The time now is 09:55.