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

[swak4Foam] what does this swak function of average on average mean?

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

Like Tree1Likes
  • 1 Post By artymk4

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 2, 2013, 15:12
Default what does this swak function of average on average mean?
  #1
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
I've found this function in an thesis.is it correct?
because it has defined an average of total pressure on the patch at each time step and in accumulations it uses average again.what does average do in this case?is it a correct method to get average on a patch?
Code:
Total-pressuresec9outlet
{
functionObjectLibs("libsimpleSwakFunctionObjects.so”);
type swak Expression ;
outputControl outputTime ;
valueType faceZone ;
zoneName sec9 outlet ;
expression ”sum((0.5∗rho*pow(mag(U),2)+p)∗(area()∗rho))/(sum(area()∗rho))”;
accumulations
(
average
);
verbose true ;
autoInterpolate true ;
warnAutoInterpolate false ;
}
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.

Last edited by immortality; May 2, 2013 at 15:32.
immortality is offline   Reply With Quote

Old   May 2, 2013, 22:16
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,978
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Ehsan,

Mmm... after thinking a bit about this, I think I can explain what happened:
  1. The current accumulation in your example only averages a single value. Therefore, the average of a single value is that same value.
  2. The author probably started the function object like this:
    Code:
    Total-pressuresec9outlet
    {
    functionObjectLibs("libsimpleSwakFunctionObjects.so”);
    type swakExpression;
    outputControl outputTime;
    valueType faceZone;
    zoneName sec9outlet;
    expression ”0.5∗rho*pow(mag(U),2)+p”;
    accumulations
    (
    average
    );
    verbose true ;
    autoInterpolate true ;
    warnAutoInterpolate false ;
    }
    In other words, by using the standard average mechanism that swak4Foam provides.
  3. Problem was that this value wasn't the average that the author was looking for. So, the next step was to do the average manually, just to make sure things still worked as before:
    Code:
    Total-pressuresec9outlet
    {
    functionObjectLibs("libsimpleSwakFunctionObjects.so”);
    type swakExpression;
    outputControl outputTime;
    valueType faceZone;
    zoneName sec9outlet;
    expression ”sum((0.5∗rho*pow(mag(U),2)+p)*area())/sum(area())”;
    accumulations
    (
    average
    );
    verbose true ;
    autoInterpolate true ;
    warnAutoInterpolate false ;
    }
    This should be able to perform the same averaging methodology that is used by swak4Foam.
  4. And now, as for the final step, I'm going to ask you Ehsan: Why do you think the author used "area()*rho()" instead of "area()"?
Best regards,
Bruno
wyldckat is offline   Reply With Quote

Old   May 3, 2013, 05:47
Default
  #3
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
I think its because the flow has been compressible.correct?
this way the average will be more accurate(because of variation of density I think),is it true?
if the mesh is uniform then I think there is no need to sum on area manually,am i correct?!
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   May 3, 2013, 12:20
Default
  #4
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,978
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quote:
Originally Posted by immortality View Post
I think its because the flow has been compressible.correct?
this way the average will be more accurate(because of variation of density I think),is it true?
Yes and yes.
Although I was thinking more along the lines of "mass weighted average" - an even better description on this topic can be found on this thread: http://www.cfd-online.com/Forums/mai...d-average.html - specially on post #20!

Quote:
Originally Posted by immortality View Post
if the mesh is uniform then I think there is no need to sum on area manually,am i correct?!
As someone once said: better safe than sorry.
It's better to use the area no matter what, to avoid any unpleasant surprises, in case you change the mesh and forget to update this calculation.
__________________
wyldckat is offline   Reply With Quote

Old   May 3, 2013, 13:52
Default
  #5
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
ok.but I think its more satisfying to have min and max as well as true average of a variable field on a plane.
how can I change the function below to have min,max an true average(if I change mesh that I'm going to!)in a single function(so that no more complexity be added to poor controlDict!)
is it possible in your opinion?
Code:
sP_h2_velocity
    {
        type swakExpression;
        valueType surface;
        surfaceName horizontal_Plane_2;
        verbose true;
        surface {
            type plane;
            basePoint       (0.0345 0.002 0);
            normalVector    (0 1 0);
            interpolate true;
        }
        expression "mag(U)";
        accumulations (
            min
            max
            average
        );
    }
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   April 25, 2019, 09:32
Default
  #6
Member
 
Martin
Join Date: Aug 2018
Posts: 33
Rep Power: 8
artymk4 is on a distinguished road
I got error because of different multiplication signs in this quoted expression:
Quote:
expression ”sum((0.5rho*pow(mag(U),2)+p)(area()rho))/(sum(area()rho))”;
when I replaced big asterisks with normal ones (*) the error was gone. So:
Code:
expression ”sum((0.5*rho*pow(mag(U),2)+p)*(area()*rho))/(sum(area()*rho))”
wyldckat likes this.
artymk4 is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
y+ and u+ values with low-Re RANS turbulence models: utility + testcase florian_krause OpenFOAM 114 August 23, 2023 05:37
whats the cause of error? immortality OpenFOAM Running, Solving & CFD 13 March 24, 2021 07:15
[blockMesh] non-orthogonal faces and incorrect orientation? nennbs OpenFOAM Meshing & Mesh Conversion 7 April 17, 2013 05:42
is internalField(U) equivalent to zeroGradient? immortality OpenFOAM Running, Solving & CFD 7 March 29, 2013 01:27
channelFoam for a 3D pipe AlmostSurelyRob OpenFOAM 3 June 24, 2011 13:06


All times are GMT -4. The time now is 17:00.