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

[swak4Foam] different values between swakExpression & faceSource areaAverage

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

Reply
 
LinkBack Thread Tools Display Modes
Old   January 8, 2014, 13:50
Default [swak4Foam] different values between swakExpression & faceSource areaAverage
  #1
New Member
 
Fabien DOS SANTOS
Join Date: Oct 2009
Location: Nevers, FRANCE
Posts: 8
Rep Power: 8
Paebin is on a distinguished road
Hello,

I'm trying to calculate an area-weighted averaging of a field (gamma) in a arbitrary plane.

First at all I did it with faceSource, cuttingPlane and the operation areaAverage:

PHP Code:
 plan0_average
     
{
         
type            faceSource;
         
functionObjectLibs ("libfieldFunctionObjects.so");

         
enabled         true;
         
outputControl   timeStep//outputTime timeStep
         
outputInterval  200;

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

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

         // Type of source: patch/faceZone/sampledSurface
         
source          sampledSurface;

         
sampledSurfaceDict
         
{
                 
type cuttingPlane;
                 
planeType           pointAndNormal;
                 
pointAndNormalDict
                 
{
                         
basePoint       (0 0 0);
                         
normalVector    (1 0 0);
                 }
                 
source cells// sample cells or boundaryFaces
                 
interpolate true;
         }

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

         
fields          (gamma);
     } 
It seemed to work. But I also do other post-processing calculations by using the swakExpression library, and the output text file look better for me than the faceSource's one. So I decided to also calculate the area average by using a swakExpression instead of faceSource.

I'm using this code:

PHP Code:
 Test_plan0_average
     
{
         
type            swakExpression;

         
outputControlMode   timestep//outputTime timestep
         
outputInterval  200;

         
expression "gamma*area()/sum(area())"// momentum Flux [N]

         
valueType surface;
         
surfaceName plan01;
         
surface
             
{
                 
type plane;
                 
basePoint   (0 0 0);
                 
normalVector     (1 0 0);
                 
interpolate     true;
             }

         
// Operation: sumMag/min/max/weightedAverage/average/sum
         
accumulations       (sum);
verbose true;
     } 
For me the result should be the same than previously but it is not! Here is a comparison:




Someone can explain me what is the problem with my swakExpression ? Or maybe the problem comes from faceSource ??

Best regards,
Fabien.
Paebin is offline   Reply With Quote

Old   January 8, 2014, 15:03
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Paebin View Post
Hello,

I'm trying to calculate an area-weighted averaging of a field (gamma) in a arbitrary plane.

First at all I did it with faceSource, cuttingPlane and the operation areaAverage:

PHP Code:
 plan0_average
     
{
         
type            faceSource;
         
functionObjectLibs ("libfieldFunctionObjects.so");

         
enabled         true;
         
outputControl   timeStep//outputTime timeStep
         
outputInterval  200;

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

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

         // Type of source: patch/faceZone/sampledSurface
         
source          sampledSurface;

         
sampledSurfaceDict
         
{
                 
type cuttingPlane;
                 
planeType           pointAndNormal;
                 
pointAndNormalDict
                 
{
                         
basePoint       (0 0 0);
                         
normalVector    (1 0 0);
                 }
                 
source cells// sample cells or boundaryFaces
                 
interpolate true;
         }

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

         
fields          (gamma);
     } 
It seemed to work. But I also do other post-processing calculations by using the swakExpression library, and the output text file look better for me than the faceSource's one. So I decided to also calculate the area average by using a swakExpression instead of faceSource.

I'm using this code:

PHP Code:
 Test_plan0_average
     
{
         
type            swakExpression;

         
outputControlMode   timestep//outputTime timestep
         
outputInterval  200;

         
expression "gamma*area()/sum(area())"// momentum Flux [N]

         
valueType surface;
         
surfaceName plan01;
         
surface
             
{
                 
type plane;
                 
basePoint   (0 0 0);
                 
normalVector     (1 0 0);
                 
interpolate     true;
             }

         
// Operation: sumMag/min/max/weightedAverage/average/sum
         
accumulations       (sum);
verbose true;
     } 
For me the result should be the same than previously but it is not! Here is a comparison:




Someone can explain me what is the problem with my swakExpression ? Or maybe the problem comes from faceSource ??

Best regards,
Fabien.
The swak-Expression looks OK with me.

This sounds completely stupid but could you please try the same surface-type (cuttingPlane) with swak (I've seen differences in the results in the past with plane vs cuttingPlane). Also try "area()" and see if the total area of the plane is correct (you should know that from your geometry).

If the problem persists: which swak-version? Which OF-version?
__________________
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   January 9, 2014, 06:40
Default
  #3
New Member
 
Fabien DOS SANTOS
Join Date: Oct 2009
Location: Nevers, FRANCE
Posts: 8
Rep Power: 8
Paebin is on a distinguished road
Thanks for your help gschaider!

Quote:
Originally Posted by gschaider View Post
This sounds completely stupid but could you please try the same surface-type (cuttingPlane) with swak (I've seen differences in the results in the past with plane vs cuttingPlane).
I tried with my swakExpression but with a cuttingPlane as you said, and the result is different from the other two!



Quote:
Originally Posted by gschaider View Post
Also try "area()" and see if the total area of the plane is correct (you should know that from your geometry).
the total area of the three methods is the same, and it corresponds to reality.

Quote:
Originally Posted by gschaider View Post
If the problem persists: which swak-version? Which OF-version?
I'm using openFoam 2.2.2 and swak4Foam-OF22X, ubuntu

Best regards,
Fabien
Paebin is offline   Reply With Quote

Old   January 9, 2014, 10:56
Default
  #4
New Member
 
Fabien DOS SANTOS
Join Date: Oct 2009
Location: Nevers, FRANCE
Posts: 8
Rep Power: 8
Paebin is on a distinguished road
I think the problem of the configuration swak+cuttingPlane comes from the interpolate function. All the previous results used "interpolate true;". I changed it to "interpolate false;", then faceSource and swak with cuttingPlane give me (almost) the same result:



I tried also to used "plane" with faceSource and it gives the same results that "plane" with swak. So the main difference is between plane and cutting plane. Also, there is a difference on the face number: 31 for plane and much more for cuttingPlane (129). In reality I have 16 cells. So I think the plane's average result should be the correct answer.

Someone can explain me what is the difference between cuttingPlane and Plane ??

best regards,
Fabien.
Paebin is offline   Reply With Quote

Old   January 9, 2014, 17:27
Default
  #5
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Paebin View Post
I think the problem of the configuration swak+cuttingPlane comes from the interpolate function. All the previous results used "interpolate true;". I changed it to "interpolate false;", then faceSource and swak with cuttingPlane give me (almost) the same result:



I tried also to used "plane" with faceSource and it gives the same results that "plane" with swak. So the main difference is between plane and cutting plane. Also, there is a difference on the face number: 31 for plane and much more for cuttingPlane (129). In reality I have 16 cells. So I think the plane's average result should be the correct answer.

Someone can explain me what is the difference between cuttingPlane and Plane ??
Not sure. I'd have to look at the source 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   January 13, 2014, 04:05
Default
  #6
New Member
 
Fabien DOS SANTOS
Join Date: Oct 2009
Location: Nevers, FRANCE
Posts: 8
Rep Power: 8
Paebin is on a distinguished road
Ok thanks.

So plane with faceSource or swak gives the same results when I don't use interpolation. If I active interpolation, I get a different result than previously (why not!), but the problem is that the result is different between faceSource and swak...

I don't know where is the truth!
Paebin is offline   Reply With Quote

Old   January 22, 2014, 20:39
Default
  #7
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Paebin View Post
Ok thanks.

So plane with faceSource or swak gives the same results when I don't use interpolation. If I active interpolation, I get a different result than previously (why not!), but the problem is that the result is different between faceSource and swak...

I don't know where is the truth!
To further complicate things: have you tried faceSource with plane (I've only seen cuttingPlane).

One possibility to check the "truth" is to calculate an expression whose value depends on the surface but whose value you already know. For instance the sum of "area()" (that should be the total area of the plane) - that would be independent of the interpolation.
__________________
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   December 23, 2015, 12:29
Default
  #8
New Member
 
Francesco Tocci
Join Date: Sep 2015
Location: Delft, The Netherlands
Posts: 9
Rep Power: 2
Frenk_T is on a distinguished road
Quote:
Originally Posted by Paebin View Post
Ok thanks.

So plane with faceSource or swak gives the same results when I don't use interpolation. If I active interpolation, I get a different result than previously (why not!), but the problem is that the result is different between faceSource and swak...

I don't know where is the truth!
I came across the same problem. Swak and faceSource give the same value if interpolate is set to false. However this value is different for cuttingPlane and plane. In my case the value given by cuttingPlane is closer to Paraview, so I assume that it's the correct one. Anyone has faced the same problem or knows more?
Frenk_T is offline   Reply With Quote

Reply

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
TimeVaryingMappedFixedValue irishdave OpenFOAM Running, Solving & CFD 28 May 28, 2015 13:37
Ensight - node values -cell values leo FLUENT 1 May 12, 2010 08:47
exact face values RubenG Main CFD Forum 0 June 22, 2009 11:09
strange node values @ solid/fluid interface - help JB FLUENT 2 November 1, 2008 13:04
node values or cell values? aPpA FLUENT 0 November 10, 2006 09:56


All times are GMT -4. The time now is 21:36.