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

Python Scripting - basic help

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 15, 2011, 14:14
Default Python Scripting - basic help
  #1
Member
 
Ammar Tareen
Join Date: Jan 2011
Location: Boston University
Posts: 61
Rep Power: 15
atareen64 is on a distinguished road
Hello all,

I'm trying to analyze the boundary layer growth of a fluid near a wall in a simulation that I did with openfoam. The way I'm do that is that I take cross-sectional cuts of the velocity profile and plot the 2d data and look at the 99% value of velocity by eye and record the value.

This is a very inefficient way of doing it, and ideally I'd like to have a script that does that for me automatically. Writing python, C++ or Java programs isn't a problem for me, I just need to know how or where I can get started.
How would I get started doing something like this? Any help, pointers or suggestions are welcome.

Regards,
Ammar.
atareen64 is offline   Reply With Quote

Old   July 16, 2011, 04:12
Default
  #2
Senior Member
 
Gijsbert Wierink
Join Date: Mar 2009
Posts: 383
Rep Power: 18
gwierink is on a distinguished road
Hi Ammar,

You mentioned you're familiar with python, so PyFoam is a nice place to start looking around.
__________________
Regards, Gijs
gwierink is offline   Reply With Quote

Old   July 17, 2011, 22:37
Default
  #3
Member
 
Ammar Tareen
Join Date: Jan 2011
Location: Boston University
Posts: 61
Rep Power: 15
atareen64 is on a distinguished road
Hi Gijs,

I did look at pyFoam briefly and it seems like a great tool. However I was doing some reading and stumbled upon the sample utility: shouldn't I be able to do this boundary layer analysis just by using the sample utility?
Do you think that's true? I'll try it today and repost.

-Ammar.
atareen64 is offline   Reply With Quote

Old   July 18, 2011, 03:38
Default
  #4
Senior Member
 
matej forman
Join Date: Mar 2009
Location: Brno, Czech Republic
Posts: 182
Rep Power: 17
matejfor is on a distinguished road
Hi,
I think what you can do is to use the sample utility or even the approach you mentioned at the start and add same C++ to do exactly what you want. you will find these in: $FOAM/applications/utilities/postProcessing/ dir.

matej
matejfor is offline   Reply With Quote

Old   July 18, 2011, 10:39
Default
  #5
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by atareen64 View Post
Hi Gijs,

I did look at pyFoam briefly and it seems like a great tool. However I was doing some reading and stumbled upon the sample utility: shouldn't I be able to do this boundary layer analysis just by using the sample utility?
Do you think that's true? I'll try it today and repost.

-Ammar.
For getting the values you want the sample utilitiy is definitely the tool of choice. But for comparing the results of the different runs PyFoam may help you. Have a look at the pyFoamSamplePlot.py-utility. It allows you to quickly generate the gnuplot-commands to visualize the sample-data. Since the last version it also has the possibility to compare the current case to a reference case, write the data to a format Excel (or others) understand (CSV) and compare the solutions using some simple metrics.

I'm afraid "pyFoamSamplePlot.py --help" is all the documentation you're going to get, but it shouldn't be too hard to figure out how to get all this

Bernhard

Last edited by gschaider; July 18, 2011 at 11:19. Reason: Insert paragraphs that were swallowed by the MessageBoard
gschaider is offline   Reply With Quote

Reply


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
Fieldview 11.1 + Python to extract 3D core of data Rebecca FieldView 0 April 13, 2011 14:06
Basic Blade Design Code apoorv Main CFD Forum 0 April 5, 2010 07:37
python scripting in paraFoam chegdan OpenFOAM Post-Processing 0 March 31, 2010 20:06
[OpenFOAM] Paraview3 python scripting tomislav_maric ParaView 1 October 6, 2008 17:47
Programming C, Basic george Main CFD Forum 3 September 12, 2006 23:42


All times are GMT -4. The time now is 03:48.