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

Area Weighted Average

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

Like Tree1Likes
  • 1 Post By santos

Reply
 
LinkBack Thread Tools Display Modes
Old   July 19, 2010, 10:27
Default Area Weighted Average
  #1
Senior Member
 
Balkrishna Patankar
Join Date: Mar 2009
Location: Pune
Posts: 119
Rep Power: 7
balkrishna is on a distinguished road
Please can someone document a method to find the area weighted average of a variable in OpenFOAM. The source code is really complex to figure out for someone who has a basic programmers insight. Would be of great help if anyone would do so . The Doxygen documentation is not very helpful either for beginners .All it gives are links to headers files without actual descripton of what a variable is . Also please comment a lot when writing any solver for OpenFOAM . A very good example is the way Linux source code is written. Loads of comments explaining every line in detail.
balkrishna is offline   Reply With Quote

Old   July 19, 2010, 10:55
Default
  #2
Senior Member
 
Sandeep Menon
Join Date: Mar 2009
Location: Amherst, MA
Posts: 372
Rep Power: 14
deepsterblue will become famous soon enough
It's not entirely clear what you intend by an 'area-weighted' average. Do you intend to perform a weighted average based on mesh face-patch values? OpenFOAM is a three-dimensional code, so volume-weighted averages for cell variables are usually the norm.

Either way, you can perform a weighted average (either patch face-areas or cell-volumes) using the DimensionedField member function:

//- Calculate and return weighted average
dimensioned<Type> weightedAverage
(
const DimensionedField<scalar, GeoMesh>&
) const;

Take a look at $FOAM_SRC/finiteVolume/cfdTools/general/include/volContinuity.H for a cue on how it's done.

Also, writing code is hard work, and documenting it can be often time-consuming, which is why it may not be done at all times. Of course, if you're willing to pay for it, I'm sure you'll find a bunch of people who would oblige.
__________________
Sandeep Menon
University of Massachusetts Amherst
https://github.com/smenon
deepsterblue is offline   Reply With Quote

Old   July 20, 2010, 02:21
Default
  #3
Senior Member
 
Balkrishna Patankar
Join Date: Mar 2009
Location: Pune
Posts: 119
Rep Power: 7
balkrishna is on a distinguished road
Thanks . But how do i actually use it while solving a case . Like how do I call the function to actually find the volume weighted average .
balkrishna is offline   Reply With Quote

Old   July 20, 2010, 06:10
Default
  #4
Senior Member
 
Balkrishna Patankar
Join Date: Mar 2009
Location: Pune
Posts: 119
Rep Power: 7
balkrishna is on a distinguished road
What i want to calculate is the pressure area weighted average on any face ....
sum(Af*p)/sum(A) on the boundary .... how do I go about it ?
balkrishna is offline   Reply With Quote

Old   July 20, 2010, 06:15
Default
  #5
Senior Member
 
Stefan Herbert
Join Date: Dec 2009
Location: Darmstadt, Germany
Posts: 129
Rep Power: 8
herbert is on a distinguished road
If you only want to calculate average values on patches for postprocessing, you can use simpleFunctionObjects.

Regards,
Stefan
herbert is offline   Reply With Quote

Old   July 20, 2010, 06:49
Default
  #6
Senior Member
 
santos's Avatar
 
Jose Luis Santos
Join Date: Mar 2009
Location: Portugal
Posts: 212
Rep Power: 8
santos is on a distinguished road
Send a message via Skype™ to santos
Another option is to run:
patchAverage <field> <patch>

Regards,
Jose Santos
Bernhard likes this.
santos is offline   Reply With Quote

Old   February 28, 2011, 18:17
Default
  #7
Member
 
Wolfgang W.
Join Date: Nov 2009
Location: Switzerland
Posts: 57
Rep Power: 7
WiWo is on a distinguished road
Hi!

Sorry if this comes like a stupid question ...
I was intending to use the patchAverage utility exactly as described above - works fine. BUT - where are the results actually written to? I don't see any additional files being created anywhere ...

Thanks for your help!
Cheers,
Wolfgang
WiWo is offline   Reply With Quote

Old   February 28, 2011, 18:21
Default
  #8
Senior Member
 
santos's Avatar
 
Jose Luis Santos
Join Date: Mar 2009
Location: Portugal
Posts: 212
Rep Power: 8
santos is on a distinguished road
Send a message via Skype™ to santos
Results are not written to any file unless you instruct it to, they are just output to the terminal.

If you want to write results to a file 'file' without any output in the terminal you can try:
patchAverage <field> <patch> > file &

Regards,
Jose
santos is offline   Reply With Quote

Old   March 1, 2011, 20:21
Default
  #9
Member
 
Wolfgang W.
Join Date: Nov 2009
Location: Switzerland
Posts: 57
Rep Power: 7
WiWo is on a distinguished road
Hi Jose,

Thanks a lot for your expeditious response! I was able to redirect the output of patchAverage to a file.
Unfortunately the style of the output with the accompanying text is not ideal for further processing. Thus I decided to change the code of patchAverage a little :-)

Cheers,
Wolfgang
WiWo is offline   Reply With Quote

Old   March 2, 2011, 08:05
Default
  #10
Senior Member
 
Balkrishna Patankar
Join Date: Mar 2009
Location: Pune
Posts: 119
Rep Power: 7
balkrishna is on a distinguished road
instead of meddling with the code i pass the file through tr and awk filters .... and get the output in the format i want it to be ...
balkrishna is offline   Reply With Quote

Reply

Tags
area, average, foam, open, weighted

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Area weighted or mass weighted average SAM Main CFD Forum 23 March 4, 2014 13:37
Diffference between mass weighted average and Area giogio FLUENT 4 September 25, 2012 02:36
CFX Solver Memory Error mike CFX 1 March 19, 2008 09:22
Area weighted average ashish FLUENT 1 April 12, 2005 19:02
area weighted average Sireesha Pasari FLUENT 1 April 4, 2004 14:06


All times are GMT -4. The time now is 04:43.