|
[Sponsors] |
July 19, 2010, 10:27 |
Area Weighted Average
|
#1 |
Senior Member
Balkrishna Patankar
Join Date: Mar 2009
Location: Pune
Posts: 123
Rep Power: 17 |
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.
|
|
July 19, 2010, 10:55 |
|
#2 |
Senior Member
Sandeep Menon
Join Date: Mar 2009
Location: Amherst, MA
Posts: 403
Rep Power: 25 |
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. |
|
July 20, 2010, 02:21 |
|
#3 |
Senior Member
Balkrishna Patankar
Join Date: Mar 2009
Location: Pune
Posts: 123
Rep Power: 17 |
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 .
|
|
July 20, 2010, 06:10 |
|
#4 |
Senior Member
Balkrishna Patankar
Join Date: Mar 2009
Location: Pune
Posts: 123
Rep Power: 17 |
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 ? |
|
July 20, 2010, 06:15 |
|
#5 |
Senior Member
Stefan Herbert
Join Date: Dec 2009
Location: Darmstadt, Germany
Posts: 129
Rep Power: 18 |
If you only want to calculate average values on patches for postprocessing, you can use simpleFunctionObjects.
Regards, Stefan |
|
July 20, 2010, 06:49 |
|
#6 |
Senior Member
|
Another option is to run:
patchAverage <field> <patch> Regards, Jose Santos |
|
February 28, 2011, 18:17 |
|
#7 |
Member
Wolfgang W.
Join Date: Nov 2009
Location: Switzerland
Posts: 57
Rep Power: 17 |
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 |
|
February 28, 2011, 18:21 |
|
#8 |
Senior Member
|
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 |
|
March 1, 2011, 20:21 |
|
#9 |
Member
Wolfgang W.
Join Date: Nov 2009
Location: Switzerland
Posts: 57
Rep Power: 17 |
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 |
|
March 2, 2011, 08:05 |
|
#10 |
Senior Member
Balkrishna Patankar
Join Date: Mar 2009
Location: Pune
Posts: 123
Rep Power: 17 |
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 ...
|
|
February 16, 2017, 08:54 |
|
#11 | ||
Member
Saurav Kumar
Join Date: Jul 2016
Posts: 80
Rep Power: 10 |
Quote:
actually, I am using OpenFOAM4 and interested to find Area Weighted Average for each time step. I modified pimplefoam and it calculates gradT and average of gradT over patch surface. Quote:
in openfoam4 i have used "mypimpleFoam -postProcess -func 'patchAverage(name=HEATEDWALL,gradT)' >log" but it gives me Zero value and only at those time that i have saved for postProcessing. Region type : patch HEATEDWALL # Faces : 351 # Area : 3.50000000e-03 # Time average(gradT) 0 0.00000000e+00 1 0.00000000e+00 2 0.00000000e+00 3 0.00000000e+00 4 0.00000000e+00 5 0.00000000e+00 6 0.00000000e+00 7 0.00000000e+00 8 0.00000000e+00 9 0.00000000e+00 10 0.00000000e+00 10 0.00000000e+00 I want to save average(gradT) and average(wallShearStress) that i have calculated by " mypimpleFoam -postProcess -func wallShearStress" at all time step how can i do this, please suggest me. Kind Regards, srv |
|||
March 14, 2018, 10:41 |
|
#12 |
New Member
Gerhard
Join Date: Mar 2017
Posts: 26
Rep Power: 9 |
Hi
This conversation really helped me. Thank you. However, patchAverage does not calculate the area weighted average. It only calculates the average. You can make it calculate the area weighted average by doing the following: - Copy the patchAverage file from $FOAM_ETC/caseDicts/postProcessing to your case's system file. - Change operation to areaAverage instead of average. - include #includeFunc patchAverage under functions in controlDict. - run the case and once done run: solver -postProcess (eg. simpleFoam -postProcess) Good luck! Last edited by Gerhard; March 14, 2018 at 10:46. Reason: Pressed the send button by accident... |
|
October 11, 2021, 23:37 |
|
#13 | |
Member
Venkat Ganesh
Join Date: May 2020
Location: Cincinnati, Ohio
Posts: 49
Rep Power: 6 |
Quote:
I need to obtain an area averaged value for the volume fraction in interfoam. |
||
Tags |
area, average, foam, open, weighted |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Area weighted or mass weighted average | SAM | Main CFD Forum | 31 | April 30, 2018 05:12 |
Diffference between mass weighted average and Area | giogio | FLUENT | 9 | March 6, 2018 09:24 |
CFX Solver Memory Error | mike | CFX | 1 | March 19, 2008 08:22 |
Area weighted average | ashish | FLUENT | 1 | April 12, 2005 19:02 |
area weighted average | Sireesha Pasari | FLUENT | 1 | April 4, 2004 14:06 |