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

How to calculate Volume averaged species/temperature

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 28, 2011, 11:10
Default How to calculate Volume averaged species/temperature
  #1
New Member
 
Patrick
Join Date: Feb 2010
Posts: 10
Rep Power: 16
will_avoid_comm_solvers is on a distinguished road
Dear All

In OpenFOAM, is there a way to estimate volume averaged temperature or species concentration for my entire flow domain.

When I use the intergrate variable filter in paraFoam, I do get the integrated temperture. Can I divide this number by the domain volume to get the volume averaged temperature?

Thanks
will_avoid_comm_solvers is offline   Reply With Quote

Old   September 28, 2011, 15:29
Default
  #2
Senior Member
 
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0
chegdan will become famous soon enoughchegdan will become famous soon enough
Quote:
Originally Posted by will_avoid_comm_solvers View Post
Dear All

In OpenFOAM, is there a way to estimate volume averaged temperature or species concentration for my entire flow domain.

When I use the intergrate variable filter in paraFoam, I do get the integrated temperture. Can I divide this number by the domain volume to get the volume averaged temperature?

Thanks
Take a look at the simpleFunctionObjects tool at ( http://openfoamwiki.net/index.php/Co...unctionObjects ) or if you think are going to use groovyBC, go ahead and get swak4foam at (http://openfoamwiki.net/index.php/Contrib/swak4Foam)


Dan
chegdan is offline   Reply With Quote

Old   September 28, 2011, 17:33
Default
  #3
Senior Member
 
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 21
Bernhard is on a distinguished road
Alternatively, you can use sample as a post processing tools (see the utilities folder for an example of the dictionary)
Bernhard is offline   Reply With Quote

Old   February 19, 2013, 07:59
Default surfaceAverage values
  #4
Senior Member
 
Sören
Join Date: Mar 2012
Posts: 102
Rep Power: 14
despaired student is on a distinguished road
Hello,

is there also a possibility to get a "surfaceAverage" instead of a patchAverage as it is described in http://openfoamwiki.net/index.php/Co...unctionObjects --> 2.3

My aim is to make a surface-sample and then -somehow- calculate the averaged value for the concentration referred to this surface or to calculate the flux of a scalar through the mentioned surface.

Is this possible and is there an easy way to do that...?


kind regards

Last edited by despaired student; February 20, 2013 at 17:31.
despaired student is offline   Reply With Quote

Old   February 22, 2013, 15:44
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 despaired student View Post
Hello,

is there also a possibility to get a "surfaceAverage" instead of a patchAverage as it is described in http://openfoamwiki.net/index.php/Co...unctionObjects --> 2.3

My aim is to make a surface-sample and then -somehow- calculate the averaged value for the concentration referred to this surface or to calculate the flux of a scalar through the mentioned surface.

Is this possible and is there an easy way to do that...?


kind regards
Yep. You've only got to look one door further: the simpleFunctionObjects are now part of swak4Foam. In swak4Foam you can (amongst other things) calculate expressions on sampledSurfaces. So there is no readymade solution for what you want but a flexible one. grep the Examples for function objects of "type swakExpression" which have a "valueType surface"
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   April 6, 2013, 07:31
Default three different methods three different results
  #6
Senior Member
 
Sören
Join Date: Mar 2012
Posts: 102
Rep Power: 14
despaired student is on a distinguished road
Hi,

it's been some days since I've worked on this problem...
Now I've tried some possibilieties (A, B, C) and all of them are delivering a different result...
I've been working/looking throug the net and some examples yet but I'm becoming more confused than I'm getting a clear vision of what to do.


My aims are to determine
1. the area-averaged concentration (T) of 2 surfaces (volume-averaged concentration of a user-defined region of the mesh would also be nice...if possible?)
2. the area-averaged flux (massflow per area) and the total massflow of a specific area.

Is it correct to assume that area-averaged means the same as area-weighted in OpenFoam?

To determine the area-averaged concentration I used three different ways (A,B,C). Can somebody explain why these three ways lead to three different results?
For the massflow I haven't really tried yet.


Thanks for your help.

Way A:
Quote:
surfacePlaneT1a
{
type swakExpression;
valueType surface;
surfaceName testPlaneT1;
surface {
type plane;
basePoint (0 0 0.0105);
normalVector (0 0 1);
interpolate false;
}
verbose true;
expression " T";
accumulations (average);
}
Way B:
Quote:
test_01
{
type faceSource;
functionObjectLibs ("libfieldFunctionObjects.so");
enabled true;
outputControl outputTime;
// Output to log&file (true) or to file only
log true;
// Output field values as well
valueOutput true; //true;
// Type of source: patch/faceZone/sampledSurface
source sampledSurface;//faceZone;
sourceName face_set_10,5mm;
sampledSurfaceDict
{
type cuttingPlane;
planeType pointAndNormal;
pointAndNormalDict
{
basePoint ( 0 0 0.0105 );
normalVector ( 0 0 1 );
}
source cells;
interpolate true;
}
// Operation: areaAverage/sum/weightedAverage ...
operation areaAverage;
//weightField phi;
fields (T);
}
Way C:
Quote:
test_02
{
type faceSource;
functionObjectLibs ("libfieldFunctionObjects.so");
enabled true;
outputControl outputTime;
log true;
valueOutput true;
source sampledSurface;
sourceName face_set2_10,5mm;
sampledSurfaceDict
{
type plane; // always triangulated
basePoint (0 0 0.0105);
normalVector (0 0 1);
}
operation areaAverage;
fields ( T );
}
despaired student is offline   Reply With Quote

Old   April 6, 2013, 11:59
Default
  #7
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 despaired student View Post
Hi,

it's been some days since I've worked on this problem...
Now I've tried some possibilieties (A, B, C) and all of them are delivering a different result...
I've been working/looking throug the net and some examples yet but I'm becoming more confused than I'm getting a clear vision of what to do.


My aims are to determine
1. the area-averaged concentration (T) of 2 surfaces (volume-averaged concentration of a user-defined region of the mesh would also be nice...if possible?)
2. the area-averaged flux (massflow per area) and the total massflow of a specific area.

Is it correct to assume that area-averaged means the same as area-weighted in OpenFoam?

To determine the area-averaged concentration I used three different ways (A,B,C). Can somebody explain why these three ways lead to three different results?
For the massflow I haven't really tried yet.


Thanks for your help.

Way A:
At first: next time use CODE instead of QUOTE for your examples:
a) the formatting is better
b) it will be there when others quote you

I can only comment on example A (the swak one): that certainly does not do what you want from it. "average" in swak means (and that is because it uses the OF-functions of the same name) is "only" the arithmetic average: so a small face of the surface has the same influence as one 10 time its size (very democratic, but not very physical). So with an expression "T*area()/sum(area())" and an accumulation "sum" you might get the result you want. The latest version of swak has an accumulation weightedAverage but I'm not sure whether it works OK for sampledSurfaces.

Volume averaged will work similar "T*vol()/sum(vol())"

Mass flow per area: just calculate the mass-flow and divide it by "sum(area())"

Don't know the difference between area-weighted and averaged in OF (would have to look that up myself)
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   April 6, 2013, 13:32
Default
  #8
Senior Member
 
Sören
Join Date: Mar 2012
Posts: 102
Rep Power: 14
despaired student is on a distinguished road
Quote:
At first: next time use CODE instead of QUOTE for your examples:
a) the formatting is better
b) it will be there when others quote you
--->OK



Another very helpful OpenFoam-expert (M. Becker - maybe he'll read this one day...?) gave me the same advise on way A.
Maybe someone else can tell me where the difference between way B and C is.


Thanks for your comment and help!
despaired student is offline   Reply With Quote

Old   April 8, 2013, 13:27
Default strange results
  #9
Senior Member
 
Sören
Join Date: Mar 2012
Posts: 102
Rep Power: 14
despaired student is on a distinguished road
Hi,

after trying some methods to receive an area-averaged value for I got two results. Maybe someone can clearify why there is such a difference between my two results...
I am thankful for any ideas...

First I'll present the results:

Method | Faces | sum(magSf) | areaAverage(T)
sampledsurf-T1 | 0.10585904
test_01 | 136298 | 0.00023717965 | 0.059855598
test_02 | 63764 | 0.000237178 | 0.10585904
test_03 | 136298 | 0.00023717965 | 0.059855598

Another thing is that the value for the "Faces" differes if I use "surface type cuttingPlane" and stays constant for "surface type plane"...why? It should stay constant...

Here is the code I used in the controlDict:
Code:
functions
{

    sampledsurf-T1
    {
        type swakExpression;
        valueType surface;
        surfaceName testPlaneT1;
        surface {
            type plane;
            basePoint       (0 0 0.0105);
            normalVector    (0 0 1);
            interpolate false;
        }
        verbose true;
        expression "T*area()/sum(area())";
        accumulations (sum);
    }

    test_01

{

    type faceSource;
    functionObjectLibs ("libfieldFunctionObjects.so");
    enabled true;
    outputControl outputTime;

// Output to log&file (true) or to file only
    log true;

// Output field values as well
    valueOutput true; //true;

// Type of source: patch/faceZone/sampledSurface
    source sampledSurface;//faceZone;
    sourceName face_set_10,5mm;
    sampledSurfaceDict
{
    type cuttingPlane;
    planeType pointAndNormal;
    pointAndNormalDict
    {
    basePoint ( 0 0 0.0105 );
    normalVector ( 0 0 1 );
    }
    source cells;
    interpolate true;
}

// Operation: areaAverage/sum/weightedAverage ...
    operation areaAverage;

//weightField phi;

    fields (T);

}


    test_02
    {
        type            faceSource;
        functionObjectLibs ("libfieldFunctionObjects.so");
        enabled         true;
        outputControl   outputTime;
        log             true;
        valueOutput     true;
        source          sampledSurface;
    sourceName face_set2_10,5mm;
        sampledSurfaceDict
        {
            type            plane;   
            basePoint       (0 0 0.0105);
            normalVector    (0 0 1);
        }
        operation       areaAverage;
        fields ( T );
    }



    test_03

{

    type faceSource;
    functionObjectLibs ("libfieldFunctionObjects.so");
    enabled true;
    outputControl outputTime;
    log true;
    valueOutput true; //true;
    source sampledSurface;//faceZone;
    sourceName face_set3_10,5mm;
    sampledSurfaceDict
    {
        type cuttingPlane;
        planeType pointAndNormal;
        pointAndNormalDict
        {
            basePoint ( 0 0 0.0105 );
            normalVector ( 0 0 1 );
        }
//    source cells;
//    interpolate true;
    }
// Operation: areaAverage/sum/weightedAverage ...
    operation areaAverage;
//weightField phi;
    fields (T);

}
despaired student is offline   Reply With Quote

Old   April 8, 2013, 14:06
Default
  #10
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 despaired student View Post
Hi,

after trying some methods to receive an area-averaged value for I got two results. Maybe someone can clearify why there is such a difference between my two results...
I am thankful for any ideas...

First I'll present the results:

Method | Faces | sum(magSf) | areaAverage(T)
sampledsurf-T1 | 0.10585904
test_01 | 136298 | 0.00023717965 | 0.059855598
test_02 | 63764 | 0.000237178 | 0.10585904
test_03 | 136298 | 0.00023717965 | 0.059855598

Another thing is that the value for the "Faces" differes if I use "surface type cuttingPlane" and stays constant for "surface type plane"...why? It should stay constant...
No idea. The positive is that results for the plane (sampledSurf-T1 and test_02) and the cutting plane (test01, test03) are consistent. I remember in the past getting weird results with cuttingPlane, but I never bothered to track it down. I think if you rewrote sampledsurf-T1 to use the cuttingPlane you should get the same result as test_01 (BTW: "sum(area())" would give you the area for the swak-variant. But that should be the same). Maybe the differences are due to different interpolation/discretization: for instance if your T is 0 in most of the domain and only different in "boundary faces". Then the smaller boundary faces only "add" half the contribution to the sum and thus give a smaller average. But that is just a guess

As always: checking for the correct method is easiest if you know beforehand what the result will be: for instance a constant T or a T(x) (funkySetFields will help you there) where T(x) is such that you can analytically calculate the result beforehand
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   April 9, 2013, 06:14
Default Possibility for a reference???
  #11
Senior Member
 
Sören
Join Date: Mar 2012
Posts: 102
Rep Power: 14
despaired student is on a distinguished road
Quote:
As always: checking for the correct method is easiest if you know beforehand what the result will be: for instance a constant T or a T(x) (funkySetFields will help you there) where T(x) is such that you can analytically calculate the result beforehand
If I knew how to use funkySetFields I would do that for a much easier case...but my problem right now is that I'm running out of time...my professor wants me to finish in a few days but I can't be sure to deliever proper results with such a problem...


Would it be possible to use the "surfaceToPatch" - Utility to create a patch and measure the area-averaged value for T on this patch with one of the following codes:

Code:
functions
  (   
 areaAverageConcentration-T    
   {      
     type                     patchAverage;      
     functionObjectLibs ("libsimpleFunctionObjects.so");      
     verbose true;      
     patches  (  tolles-Patch );
     fields (T);
    } 
  );
With patchAverage: sum (T_i*area_i) / sum (area_i) .
(see http://openfoamwiki.net/index.php/Co...unctionObjects )

The swak4foam way using a patch would be:

Code:
    averagedConcentration-T
     {
         type patchExpression;
         accumulations (    sum    );
         patches ( tolles-Patch  );
         expression "T*area()/sum(area())";
         verbose true;
     }
The results of both codes should be the same I think...? Now, can someone please explain how to use the > surfaceToPatch < Utility ?
If you think that this way wil not provide a proper reference to judge which one of the before mentioned results are correct then please let me know.


Kind regards

Last edited by despaired student; April 9, 2013 at 06:29.
despaired student is offline   Reply With Quote

Old   April 9, 2013, 07:20
Default Test results
  #12
Senior Member
 
Sören
Join Date: Mar 2012
Posts: 102
Rep Power: 14
despaired student is on a distinguished road
I did a little example of a rectangular channel-flow where I measured the OUTLET Patch via SWAK4FOAM and a patchAverage as described here
http://openfoamwiki.net/index.php/Co...unctionObjects

Here are my results ordered the way they are written in the controlDict which you can see attached. The last results are taken 0.8 mm ahead of the others at the OUTLET-Patch. The rest are sampled ones. From this little try I would make the conclusion that using type cuttingPlane for a sampledSurface is less precise than plane or the swak-altenative...
I would appreciate it if someone could confirm this conclusion...

sampledSurface: 0.14318075
test_01TOutlet 0.12430655
test_02TOutlet 0.14318075
test_03TOutlet 0.12430655
areaAverageConcentration-TOutlet 0.14306758
SWAKaveragedConcentration-TOutlet 0.14306758


controlDict:
Code:
libs (
    "libOpenFOAM.so" // keeps paraFoam happy
    "libtwoPhaseInterfaceProperties.so"
    "libinterfaceProperties.so"
    "libsimpleSwakFunctionObjects.so" 
    "libswakFunctionObjects.so" 
);


functions
{

    sampledsurf-TOutlet
    {
        type swakExpression;
        valueType surface;
        surfaceName testPlaneT1;
        surface {
            type plane;
            basePoint       (0 0.028 0.069);
            normalVector    (0 1 0);
            interpolate false;
        }
        verbose true;
        expression "T*area()/sum(area())";
        accumulations (sum);
    }


    test_01TOutlet

{

    type faceSource;
    functionObjectLibs ("libfieldFunctionObjects.so");
    enabled true;
    outputControl outputTime;

// Output to log&file (true) or to file only
    log true;

// Output field values as well
    valueOutput true; //true;

// Type of source: patch/faceZone/sampledSurface
    source sampledSurface;//faceZone;
    sourceName face_set_10,5mm;
    sampledSurfaceDict
{
    type cuttingPlane;
    planeType pointAndNormal;
    pointAndNormalDict
    {
            basePoint       (0 0.028 0.069);
            normalVector    (0 1 0);
    }
    source cells;
    interpolate true;
}

// Operation: areaAverage/sum/weightedAverage ...
    operation areaAverage;

//weightField phi;

    fields (T);

}

    test_02TOutlet
    {
        type            faceSource;
        functionObjectLibs ("libfieldFunctionObjects.so");
        enabled         true;
        outputControl   outputTime;
        log             true;
        valueOutput     true;
        source          sampledSurface;
    sourceName face_set2_10,5mm;
        sampledSurfaceDict
        {
            type            plane;   
            basePoint       (0 0.028 0.069);
            normalVector    (0 1 0);
        }
        operation       areaAverage;
        fields ( T );
    }

    test_03TOutlet

{

    type faceSource;
    functionObjectLibs ("libfieldFunctionObjects.so");
    enabled true;
    outputControl outputTime;
    log true;
    valueOutput true; //true;
    source sampledSurface;//faceZone;
    sourceName face_set3_10,5mm;
    sampledSurfaceDict
    {
        type cuttingPlane;
        planeType pointAndNormal;
        pointAndNormalDict
        {
                basePoint       (0 0.028 0.069);
               normalVector    (0 1 0);
        }
//    source cells;
//    interpolate true;
    }
// Operation: areaAverage/sum/weightedAverage ...
    operation areaAverage;
//weightField phi;
    fields (T);

}


     areaAverageConcentration-TOutlet    
       {      
         type                     patchAverage;      
         functionObjectLibs ("libsimpleFunctionObjects.so");      
         verbose true;      
         patches  (  OUTLET );
         fields (T);
       } 

    SWAKaveragedConcentration-TOutlet
    {
         type patchExpression;
         accumulations (    sum    );
         patches ( OUTLET  );
         expression "T*area()/sum(area())";
         verbose true;
    }
}
despaired student is offline   Reply With Quote

Old   April 9, 2013, 08:45
Default
  #13
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 despaired student View Post
I did a little example of a rectangular channel-flow where I measured the OUTLET Patch via SWAK4FOAM and a patchAverage as described here
http://openfoamwiki.net/index.php/Co...unctionObjects

Here are my results ordered the way they are written in the controlDict which you can see attached. The last results are taken 0.8 mm ahead of the others at the OUTLET-Patch. The rest are sampled ones. From this little try I would make the conclusion that using type cuttingPlane for a sampledSurface is less precise than plane or the swak-altenative...
I would appreciate it if someone could confirm this conclusion...

sampledSurface: 0.14318075
test_01TOutlet 0.12430655
test_02TOutlet 0.14318075
test_03TOutlet 0.12430655
areaAverageConcentration-TOutlet 0.14306758
SWAKaveragedConcentration-TOutlet 0.14306758
Got no time to confirm this, but my guess is that if you rewrite the swak-thing (sampledSurface) to use the cuttingPlane you'll get a similar (wrong) result. My guess is still what I said in the last post: that your T is almost a top-hat profile (constant on the interior and big increase on the boundary). Due to the smaller faces and interpolation for the cutting-plane the boundary has less influence and thus the value is different
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   April 9, 2013, 09:04
Default
  #14
Senior Member
 
Sören
Join Date: Mar 2012
Posts: 102
Rep Power: 14
despaired student is on a distinguished road
Quote:
big increase on the boundary
--> Yes, there is a huge boundary-influence and it is somehow a "top-hat"-profile.

If I got you right, in this case the cuttingPlane is less precise.


Thanks again for your quick answer!
despaired student is offline   Reply With Quote

Old   April 9, 2013, 09:31
Default
  #15
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 despaired student View Post
--> Yes, there is a huge boundary-influence and it is somehow a "top-hat"-profile.

If I got you right, in this case the cuttingPlane is less precise.
I wouldn't say it like that. It has a better resolution and therefor gives different results. It means that the result is not resolution independent
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
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
Negative Volume during Mesh Motion Analysis giov_ingr FLUENT 2 December 13, 2013 06:09
[OpenFOAM] how to calculate the m³ of a `thresholdŽ volume happysimulant ParaView 2 April 14, 2011 10:01
split volume Kabo FLUENT 1 January 28, 2008 07:08
fluent add additional zones for the mesh file SSL FLUENT 2 January 26, 2008 11:55
fluid hot volume in fluid cold volume zahid FLUENT 4 June 1, 2002 09:11


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