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

How to calculate a zone Average

Register Blogs Community New Posts Updated Threads Search

Like Tree13Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 23, 2010, 09:01
Default How to calculate a zone Average
  #1
New Member
 
CFD user
Join Date: Apr 2010
Location: Germany
Posts: 28
Rep Power: 16
subhkirti is on a distinguished road
Hi Everyone,

I am trying to simulate a flow over a gondola of a wind turbine using OpenFoam. I have an oil cooler sitting over the top of the gondola, which is of rectangular cross-section, with the flow of inlet air in its normal direction. I have defined the cooler as a porous region, using the Darcy's coefficient, d and f. I am trying to find out what is the mean velocity of air passing through this cooler. Since the region is not defined as patch, i cannot use the patchAverage in OF. I used the sampleDict utility to generate only the cooler section data, but i could find no means of averaging it.

Can anyone suggest me a way of doing this?

Thanks in Advance

Subhkirti.
subhkirti is offline   Reply With Quote

Old   September 23, 2010, 10:58
Default
  #2
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 subhkirti View Post
Hi Everyone,

I am trying to simulate a flow over a gondola of a wind turbine using OpenFoam. I have an oil cooler sitting over the top of the gondola, which is of rectangular cross-section, with the flow of inlet air in its normal direction. I have defined the cooler as a porous region, using the Darcy's coefficient, d and f. I am trying to find out what is the mean velocity of air passing through this cooler. Since the region is not defined as patch, i cannot use the patchAverage in OF. I used the sampleDict utility to generate only the cooler section data, but i could find no means of averaging it.

Can anyone suggest me a way of doing this?

Thanks in Advance

Subhkirti.
Beware:
a) I'm biased (I wrote this thing)
b) this is to be considered beta-quality software (until I get some feedback)

It will not do directly what you want but defining an arbitray expression on a cellZone/faceZone is quite easy (I think ) with this:
http://www.cfd-online.com/Forums/ope...swak4foam.html

Bernhard
gschaider is offline   Reply With Quote

Old   September 24, 2010, 05:39
Default
  #3
New Member
 
CFD user
Join Date: Apr 2010
Location: Germany
Posts: 28
Rep Power: 16
subhkirti is on a distinguished road
Dear Bernhard,

Thanks for the reply. The thing is that I'm very new to the use of OpenFoam, and was using sampleDict to make a cut at the surface of the cooler. My syntax is like below:

// Fields to sample.
fields
(
U
);



triangleCut
{
// Cutingplane using iso surface
type cuttingPlane;
planeType pointAndNormal;
pointAndNormalDict
{
basePoint (7.547 0.5 0.0001);
normalVector (1 0 0);
}
interpolate true;

zone porosity; // Optional: zone only
exposedPatchName gondel; // Optional: zone only

regularise true; // Optional: do not simplify
}

How/Where do I make changes in my case setup, with the utility given by you, so that I can approach the result, Aren't there any direct methods which I can use to calculate the zone average (Average Velocity in the cooler region of the gondola)? I am sorry if these questions looks stupid, but I have just begun with OpenFoam.

Regards,

Subhkirti.
subhkirti is offline   Reply With Quote

Old   September 27, 2010, 08:37
Default
  #4
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 subhkirti View Post
How/Where do I make changes in my case setup, with the utility given by you, so that I can approach the result, Aren't there any direct methods which I can use to calculate the zone average (Average Velocity in the cooler region of the gondola)? I am sorry if these questions looks stupid, but I have just begun with OpenFoam.

Regards,

Subhkirti.
a) the stuff that is currently distributed only consists of functionObjects. That means that the calculations can be done during the run not afterwards (but of course it is easy to write a utility that does it after the fact)
b) what do you mean with zone? Have you got a cellZone or faceZone defined in your mesh? Then swak can do the calculations. Getting OF-zones depends on the way you create your mesh
c) sorry. swak doesn't do sampledSurfaces - yet. But if you have got a faceZone or faceSet defined it might do the same thing for you

Bernhard
Kummi likes this.
gschaider is offline   Reply With Quote

Old   September 27, 2010, 09:36
Default
  #5
New Member
 
CFD user
Join Date: Apr 2010
Location: Germany
Posts: 28
Rep Power: 16
subhkirti is on a distinguished road
Quote:
Originally Posted by gschaider View Post
a) the stuff that is currently distributed only consists of functionObjects. That means that the calculations can be done during the run not afterwards (but of course it is easy to write a utility that does it after the fact)
b) what do you mean with zone? Have you got a cellZone or faceZone defined in your mesh? Then swak can do the calculations. Getting OF-zones depends on the way you create your mesh
c) sorry. swak doesn't do sampledSurfaces - yet. But if you have got a faceZone or faceSet defined it might do the same thing for you

Bernhard
Dear Bernhard,

Thanks again for the reply. I have got a CellZone in the mesh. How can I call the function to calculate the average velocity in that zone? Can you give me an example.
Kummi likes this.
subhkirti is offline   Reply With Quote

Old   September 27, 2010, 10:51
Default
  #6
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 subhkirti View Post
Dear Bernhard,

Thanks again for the reply. I have got a CellZone in the mesh. How can I call the function to calculate the average velocity in that zone? Can you give me an example.
Have a look at Examples/other/angledDuct/system/controlDict for some examples. The easiest would be to add to the controlDict something like
Code:
    
functions
(
   averageVel
    {
        type swakExpression;
        valueType cellZone;
        zoneName heater; // or whatever is your zoneName
        accumulations (
            average
        );
        expression "U";
        verbose true;
    }
);
That would give you the arithmetic average of the vector value over all cells. Volume weighted average over all cells of the velocity magnitude would be
Code:
    
functions
(
   weightedAverageVel
    {
        type swakExpression;
        valueType cellZone;
        zoneName heater; // or whatever is your zoneName
        accumulations (
            min
        );
        expression "sum(mag(U)*vol())/sum(vol())";
        verbose true;
    }
);
Note that as the average velocity is already calculated in the expression every accumulation except sum gives you the same result.

It all depends on what your definition of "average velocity" is. If you're interested in the average velocity in a specific direction this might do the trick for you:
Code:
    
 functions
 (
    directionAverageVel
     {
         type swakExpression;
         valueType cellZone;
        variables "direction=vector(1,1,0);dir=direction/mag(direction);";
         zoneName heater; // or whatever is your zoneName
         accumulations (
             min
         );
         expression "sum((U & dir)*vol())/sum(vol())";
         verbose true;
     }
 );
(Havn't tested these expressions so there might be typos in there)

Bernhard
gschaider is offline   Reply With Quote

Old   September 27, 2010, 12:08
Default
  #7
New Member
 
CFD user
Join Date: Apr 2010
Location: Germany
Posts: 28
Rep Power: 16
subhkirti is on a distinguished road
Thank you so much Bernhard. I will try out these and comeback to you if any further clarifications are needed.

Regards,
Subhkirti.
subhkirti is offline   Reply With Quote

Old   September 29, 2010, 07:29
Default
  #8
Senior Member
 
Anne Gerdes
Join Date: Aug 2010
Location: Hamburg
Posts: 168
Rep Power: 16
Anne Lincke is on a distinguished road
Hey subhkirti, Hallo Bernhard

can you please tell me if you succeeded in computing the average over the cellZones and how you managed to do so?

I would like to compute an average value of a scalar over several cellZones, so one average value for each cellZone and I do not know how to do it when running the case in parallel.

Would be great if you could help me
Anne Lincke is offline   Reply With Quote

Old   September 29, 2010, 13:44
Default
  #9
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 Anne Lincke View Post
Hey subhkirti, Hallo Bernhard

can you please tell me if you succeeded in computing the average over the cellZones and how you managed to do so?

I would like to compute an average value of a scalar over several cellZones, so one average value for each cellZone and I do not know how to do it when running the case in parallel.

Would be great if you could help me
If a functionObject is enough for you: follow the link in my first posting in this thread.
If you want to do it in your own code: the key is that the sum is local on each processor. Use "reduce(plusOp<scalar>,sum);" to get the total.

Bernhard
gschaider is offline   Reply With Quote

Old   October 1, 2010, 06:04
Default
  #10
Senior Member
 
Anne Gerdes
Join Date: Aug 2010
Location: Hamburg
Posts: 168
Rep Power: 16
Anne Lincke is on a distinguished road
Thank you very much Bernhard, I think your tool would do just the right thing.
Can you please tell me where should I put the source Code and the libraries?
I did not succeed in compiling so far. I am using OpenFOAM 1.7.0
It would be great if you could give me a little howto for compiling the sources, especially where to put the folder.
Thank you very much!
Anne Lincke is offline   Reply With Quote

Old   October 1, 2010, 06:47
Default
  #11
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 Anne Lincke View Post
Thank you very much Bernhard, I think your tool would do just the right thing.
Can you please tell me where should I put the source Code and the libraries?
I did not succeed in compiling so far. I am using OpenFOAM 1.7.0
It would be great if you could give me a little howto for compiling the sources, especially where to put the folder.
Thank you very much!
As long as you download the whole folder and do a "wmake all" inside it there is no constraint on the location. Include-search-paths etc are relative inside that directory. Only external dependency (for some of the functionObjects) is that you have the simpleFunctionObjects installed at $(WM_PROJECT_USER_DIR)/Libraries/simpleFunctionObjects

But without further information what exactly is your problem I will not be able to help you

Bernhard
gschaider is offline   Reply With Quote

Old   October 1, 2010, 09:51
Default
  #12
Senior Member
 
Anne Gerdes
Join Date: Aug 2010
Location: Hamburg
Posts: 168
Rep Power: 16
Anne Lincke is on a distinguished road
Hey Bernhard,

thank you for answering. I downloaded the simpleFunctionObjects and compiled it via wmake libso in my $(WM_PROJECT_USER_DIR)/Libraries. That worked so far I think.
But when compiling swak4foam with wmake all I get many error messages like

from funkySetFields.C:41:
../../Libraries/swak4FoamParsers/lnInclude/FieldValueExpressionDriverYY.H:10: Fehler: »parserField« has not been declared
../../Libraries/swak4FoamParsers/lnInclude/FieldValueExpressionDriverYY.H:10: Fehler: »yylval« wurde in diesem Gültigkeitsbereich nicht definiert
../../Libraries/swak4FoamParsers/lnInclude/FieldValueExpressionDriverYY.H:10: Fehler: »parserField« has not been declared
../../Libraries/swak4FoamParsers/lnInclude/FieldValueExpressionDriverYY.H:10: Fehler: »yylloc« wurde in diesem Gültigkeitsbereich nicht definiert
../../Libraries/swak4FoamParsers/lnInclude/FieldValueExpressionDriverYY.H:10: Fehler: expected primary-expression before »&« token
../../Libraries/swak4FoamParsers/lnInclude/FieldValueExpressionDriverYY.H:10: Fehler: »driver« wurde in diesem Gültigkeitsbereich nicht definiert
../../Libraries/swak4FoamParsers/lnInclude/FieldValueExpressionDriverYY.H:10: Fehler: initializer Ausdrucksliste als zusammengesetzten Ausdruck behandelt
In file included from FieldValueExpressionParser.yy:67,
from ../../Libraries/swak4FoamParsers/lnInclude/FieldValueExpressionDriver.H:18,
from funkySetFields.C:41:
../../Libraries/swak4FoamParsers/lnInclude/FieldValueExpressionDriverLogicalTemplates.H:9: Fehler: expected initializer before »<« token
../../Libraries/swak4FoamParsers/lnInclude/FieldValueExpressionDriverLogicalTemplates.H:15: Fehler: expected initializer before »<« token
../../Libraries/swak4FoamParsers/lnInclude/FieldValueExpressionDriverLogicalTemplates.H:23: Fehler: invalid use of incomplete type »struct Foam::FieldValueExpressionDriver«
../../Libraries/swak4FoamParsers/lnInclude/FieldValueExpressionDriver.H:13: Fehler: forward declaration of »struct Foam::FieldValueExpressionDriver«
../../Libraries/swak4FoamParsers/lnInclude/FieldValueExpressionDriverLogicalTemplates.H:49: Fehler: invalid use of incomplete type »struct Foam::FieldValueExpressionDriver«
../../Libraries/swak4FoamParsers/lnInclude/FieldValueExpressionDriver.H:13: Fehler: forward declaration of »struct Foam::FieldValueExpressionDriver«
../../Libraries/swak4FoamParsers/lnInclude/FieldValueExpressionDriverLogicalTemplates.H:80: Fehler: invalid use of incomplete type »struct Foam::FieldValueExpressionDriver«
../../Libraries/swak4FoamParsers/lnInclude/FieldValueExpressionDriver.H:13: Fehler: forward declaration of »struct Foam::FieldValueExpressionDriver«
../../Libraries/swak4FoamParsers/lnInclude/FieldValueExpressionDriverLogicalTemplates.H:106: Fehler: invalid use of incomplete type »struct Foam::FieldValueExpressionDriver«
../../Libraries/swak4FoamParsers/lnInclude/FieldValueExpressionDriver.H:13: Fehler: forward declaration of »struct Foam::FieldValueExpressionDriver«


Something does not work with the swak4Foam Parser.
I tried to install it on my home-directory of the master node of the cluster. I hope that this should not be a problem.....

Have a nice weekend!

Anne
Anne Lincke is offline   Reply With Quote

Old   October 4, 2010, 08:02
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
Hi Anne!

What I need to diagnose the problem is the first error message.

And could you check the versions of the used utilities with "bison -V" ,"flex -V" and "gcc -v"

Bernhard

Quote:
Originally Posted by Anne Lincke View Post
Hey Bernhard,

thank you for answering. I downloaded the simpleFunctionObjects and compiled it via wmake libso in my $(WM_PROJECT_USER_DIR)/Libraries. That worked so far I think.
But when compiling swak4foam with wmake all I get many error messages like

from funkySetFields.C:41:
../../Libraries/swak4FoamParsers/lnInclude/FieldValueExpressionDriverYY.H:10: Fehler: »parserField« has not been declared
../../Libraries/swak4FoamParsers/lnInclude/FieldValueExpressionDriverYY.H:10: Fehler: »yylval« wurde in diesem Gültigkeitsbereich nicht definiert
../../Libraries/swak4FoamParsers/lnInclude/FieldValueExpressionDriverYY.H:10: Fehler: »parserField« has not been declared
../../Libraries/swak4FoamParsers/lnInclude/FieldValueExpressionDriverYY.H:10: Fehler: »yylloc« wurde in diesem Gültigkeitsbereich nicht definiert
../../Libraries/swak4FoamParsers/lnInclude/FieldValueExpressionDriverYY.H:10: Fehler: expected primary-expression before »&« token
../../Libraries/swak4FoamParsers/lnInclude/FieldValueExpressionDriverYY.H:10: Fehler: »driver« wurde in diesem Gültigkeitsbereich nicht definiert
../../Libraries/swak4FoamParsers/lnInclude/FieldValueExpressionDriverYY.H:10: Fehler: initializer Ausdrucksliste als zusammengesetzten Ausdruck behandelt
In file included from FieldValueExpressionParser.yy:67,
from ../../Libraries/swak4FoamParsers/lnInclude/FieldValueExpressionDriver.H:18,
from funkySetFields.C:41:
../../Libraries/swak4FoamParsers/lnInclude/FieldValueExpressionDriverLogicalTemplates.H:9: Fehler: expected initializer before »<« token
../../Libraries/swak4FoamParsers/lnInclude/FieldValueExpressionDriverLogicalTemplates.H:15: Fehler: expected initializer before »<« token
../../Libraries/swak4FoamParsers/lnInclude/FieldValueExpressionDriverLogicalTemplates.H:23: Fehler: invalid use of incomplete type »struct Foam::FieldValueExpressionDriver«
../../Libraries/swak4FoamParsers/lnInclude/FieldValueExpressionDriver.H:13: Fehler: forward declaration of »struct Foam::FieldValueExpressionDriver«
../../Libraries/swak4FoamParsers/lnInclude/FieldValueExpressionDriverLogicalTemplates.H:49: Fehler: invalid use of incomplete type »struct Foam::FieldValueExpressionDriver«
../../Libraries/swak4FoamParsers/lnInclude/FieldValueExpressionDriver.H:13: Fehler: forward declaration of »struct Foam::FieldValueExpressionDriver«
../../Libraries/swak4FoamParsers/lnInclude/FieldValueExpressionDriverLogicalTemplates.H:80: Fehler: invalid use of incomplete type »struct Foam::FieldValueExpressionDriver«
../../Libraries/swak4FoamParsers/lnInclude/FieldValueExpressionDriver.H:13: Fehler: forward declaration of »struct Foam::FieldValueExpressionDriver«
../../Libraries/swak4FoamParsers/lnInclude/FieldValueExpressionDriverLogicalTemplates.H:106: Fehler: invalid use of incomplete type »struct Foam::FieldValueExpressionDriver«
../../Libraries/swak4FoamParsers/lnInclude/FieldValueExpressionDriver.H:13: Fehler: forward declaration of »struct Foam::FieldValueExpressionDriver«


Something does not work with the swak4Foam Parser.
I tried to install it on my home-directory of the master node of the cluster. I hope that this should not be a problem.....

Have a nice weekend!

Anne
gschaider is offline   Reply With Quote

Old   October 4, 2010, 10:16
Default
  #14
Senior Member
 
Anne Gerdes
Join Date: Aug 2010
Location: Hamburg
Posts: 168
Rep Power: 16
Anne Lincke is on a distinguished road
Hallo Bernhard,

1.) Here is the first error

lincke@master:~/OpenFOAM/OpenFOAM-1.7.0/swak4Foam> wmake all
SOURCE=FieldValueExpressionParser.yy ; rm -f Make/linux64GccDPOpt/FieldValueExpressionParser.C Make/linux64GccDPOpt/FieldValueExpressionParser.tab.hh; bison -ra -v -d $SOURCE ; mv *.tab.cc Make/linux64GccDPOpt/FieldValueExpressionParser.C ; sed -i.bak "s/position.hh/FieldValueExpressionParser_position.hh/" location.hh ; mv location.hh lnInclude/FieldValueExpressionParser_location.hh ; mv stack.hh lnInclude/FieldValueExpressionParser_stack.hh ; mv position.hh lnInclude/FieldValueExpressionParser_position.hh ; sed -i.bak "s/stack.hh/FieldValueExpressionParser_stack.hh/;s/location.hh/FieldValueExpressionParser_location.hh/" FieldValueExpressionParser.tab.hh ;mv *.hh lnInclude ; touch -r $SOURCE lnInclude/FieldValueExpressionParser*.hh ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-40 -IMake/linux64GccDPOpt -I/home/lincke/OpenFOAM/OpenFOAM-1.7.0/src/finiteVolume/lnInclude -I/home/lincke/OpenFOAM/OpenFOAM-1.7.0/src/meshTools/lnInclude -IlnInclude -I. -I/home/lincke/OpenFOAM/OpenFOAM-1.7.0/src/OpenFOAM/lnInclude -I/home/lincke/OpenFOAM/OpenFOAM-1.7.0/src/OSspecific/POSIX/lnInclude -fPIC -c Make/linux64GccDPOpt/FieldValueExpressionParser.C -o Make/linux64GccDPOpt/FieldValueExpressionParser.o
In file included from FieldValueExpressionParser.yy:66,
from Make/linux64GccDPOpt/FieldValueExpressionParser.C:24:
lnInclude/FieldValueExpressionDriverYY.H:10: Fehler: incomplete type »parserField::FieldValueExpressionParser« used in nested name specifier
lnInclude/FieldValueExpressionDriverYY.H:10: Fehler: »yylval« wurde in diesem Gültigkeitsbereich nicht definiert
lnInclude/FieldValueExpressionDriverYY.H:10: Fehler: expected primary-expression before »*« token
lnInclude/FieldValueExpressionDriverYY.H:10: Fehler: »yylloc« wurde in diesem Gültigkeitsbereich nicht definiert
lnInclude/FieldValueExpressionDriverYY.H:10: Fehler: expected primary-expression before »&« token
lnInclude/FieldValueExpressionDriverYY.H:10: Fehler: »driver« wurde in diesem Gültigkeitsbereich nicht definiert
lnInclude/FieldValueExpressionDriverYY.H:10: Fehler: initializer Ausdrucksliste als zusammengesetzten Ausdruck behandelt
FieldValueExpressionParser.tab.cc: In member function »virtual int yy::FieldValueExpressionParser:arse()«:
FieldValueExpressionParser.tab.cc:414: Fehler: »parserFieldlex« kann nicht als Funktion verwendet werden
FieldValueExpressionParser.tab.cc: In member function »unsigned char yy::FieldValueExpressionParser::yytranslate_(int)« :
FieldValueExpressionParser.tab.cc:2771: Warnung: Verwendung einer Typumwandlung im alten Stil
FieldValueExpressionParser.yy: At global scope:
FieldValueExpressionParser.yy:404: Fehler: expected unqualified-id before »&« token
FieldValueExpressionParser.yy:404: Fehler: expected »)« before »&« token
FieldValueExpressionParser.yy:404: Fehler: expected initializer before »&« token
make: *** [Make/linux64GccDPOpt/FieldValueExpressionParser.o] Fehler 1


2.) Bison
lincke@master:~/OpenFOAM/OpenFOAM-1.7.0/swak4Foam> bison -V
bison (GNU Bison) 2.1
Geschrieben von Robert Corbett und Richard Stallman.

Copyright © 2005 Free Software Foundation, Inc.
Dies ist freie Software; die Kopierbedingungen stehen in den Quellen. Es
gibt keine Garantie; auch nicht für VERKAUFBARKEIT oder FÜR SPEZIELLE ZWECKE.


3.) flex
flex 2.5.31

4.) lincke@master:~/OpenFOAM/OpenFOAM-1.7.0/swak4Foam> gcc -v
Es werden eingebaute Spezifikationen verwendet.
Ziel: x86_64-unknown-linux-gnu
Konfiguriert mit: ../configure --prefix=/home/lincke/OpenFOAM/ThirdParty-1.7.0/platforms/linux64/gcc-4.4.4 --with-gmp=/home/lincke/OpenFOAM/ThirdParty-1.7.0/platforms/linux64/gmp-5.0.1 --with-mpfr=/home/lincke/OpenFOAM/ThirdParty-1.7.0/platforms/linux64/mpfr-2.4.2
Thread-Modell: posix
gcc-Version 4.4.4 (GCC)

There may be a problem with the gcc version. The original version of gcc that is used by the cluster is too old for OF1.7. so I had to use my own specifications in order to be able to compile OF1.7.

I hope this helps....thank you a lot!
Anne Lincke is offline   Reply With Quote

Old   October 5, 2010, 08:57
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 Anne Lincke View Post
Hallo Bernhard,


2.) Bison
lincke@master:~/OpenFOAM/OpenFOAM-1.7.0/swak4Foam> bison -V
bison (GNU Bison) 2.1
Geschrieben von Robert Corbett und Richard Stallman.

Copyright © 2005 Free Software Foundation, Inc.
Dies ist freie Software; die Kopierbedingungen stehen in den Quellen. Es
gibt keine Garantie; auch nicht für VERKAUFBARKEIT oder FÜR SPEZIELLE ZWECKE.


3.) flex
flex 2.5.31

4.) lincke@master:~/OpenFOAM/OpenFOAM-1.7.0/swak4Foam> gcc -v
Es werden eingebaute Spezifikationen verwendet.
Ziel: x86_64-unknown-linux-gnu
Konfiguriert mit: ../configure --prefix=/home/lincke/OpenFOAM/ThirdParty-1.7.0/platforms/linux64/gcc-4.4.4 --with-gmp=/home/lincke/OpenFOAM/ThirdParty-1.7.0/platforms/linux64/gmp-5.0.1 --with-mpfr=/home/lincke/OpenFOAM/ThirdParty-1.7.0/platforms/linux64/mpfr-2.4.2
Thread-Modell: posix
gcc-Version 4.4.4 (GCC)

There may be a problem with the gcc version. The original version of gcc that is used by the cluster is too old for OF1.7. so I had to use my own specifications in order to be able to compile OF1.7.

I hope this helps....thank you a lot!
I'm afraid the problem is bison. The smallest version I use is 2.3 (and I remember having to adapt funkySetFields for that).

Solution might be to download the sources for bison, compile them and add the new bison to your path.

The other solution might be to compile swak on a machine with a more UpToDate bison and then use the generated files on your cluster. Like it is described in
http://openfoamwiki.net/index.php/Co...sions_of_bison
only you'll have to do it for 3 sets of grammars

Bernhard
gschaider is offline   Reply With Quote

Old   October 12, 2010, 10:55
Default
  #16
Senior Member
 
Anne Gerdes
Join Date: Aug 2010
Location: Hamburg
Posts: 168
Rep Power: 16
Anne Lincke is on a distinguished road
Hallo Bernhard,

I compiled the swak4foam on another machine which has a newer version of Bison.
Then I copied the folder which was created to the "old" system, ran a wmake libso (without changing anything) and it worked!

The computation of the average works when I insert a function object in my system/controldict.
I think this tool might be very helpful for future computations. Thank you for that.

But I have still one questions:
I need to set the value of my cellZones to the average value (which is computed by inserting a function object to system/controldict).
Is there any possibility to set the value which is computed at run-time to my cellZones?

I tried some things but so far it did not work for me.

Thank you very much.

Anne
Anne Lincke is offline   Reply With Quote

Old   October 12, 2010, 14:09
Default
  #17
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 Anne Lincke View Post
Hallo Bernhard,

I compiled the swak4foam on another machine which has a newer version of Bison.
Then I copied the folder which was created to the "old" system, ran a wmake libso (without changing anything) and it worked!

The computation of the average works when I insert a function object in my system/controldict.
I think this tool might be very helpful for future computations. Thank you for that.

But I have still one questions:
I need to set the value of my cellZones to the average value (which is computed by inserting a function object to system/controldict).
Is there any possibility to set the value which is computed at run-time to my cellZones?

I tried some things but so far it did not work for me.

Thank you very much.

Anne
Have a looked at the pulsedPitzDaily in the examples. There are two functionObjects there: expressionField and manipulateField. manipulateField can modify the field in a region specified by mask. The problem is that it currently doesn't know the variables-entry that most of the other functionObjects have. But maybe you'll find a way to work around that (or if the value you want to set doesn't depend on anything else - cellSets etc - it should work without problems)

Anyway. I recommend using that only for prototyping you calculations. In the long run I recommend building a solver that does the physics right

Bernhard
gschaider is offline   Reply With Quote

Old   October 13, 2010, 10:34
Smile
  #18
Senior Member
 
Anne Gerdes
Join Date: Aug 2010
Location: Hamburg
Posts: 168
Rep Power: 16
Anne Lincke is on a distinguished road
Hey Bernhard,

I added the line

reduce(average,sumOp<scalar>());

to my code and this really worked fine and was much more easier than I expected.
Nevertheless the test case you recommended me to look at seems to be interesting, especially what can be done with swak4foam.

Apart from the fact that it did not help me solving my problem (which I now solved with the expression you recommended me before) I have many other things (pressure loss, uniformity of the flow) which I am now able to compute (hopefully) easily with your tool.

I thank you very much!
Anne Lincke is offline   Reply With Quote

Old   October 13, 2010, 11:47
Default
  #19
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 Anne Lincke View Post
Hey Bernhard,

I added the line

reduce(average,sumOp<scalar>());

to my code and this really worked fine and was much more easier than I expected.
Nevertheless the test case you recommended me to look at seems to be interesting, especially what can be done with swak4foam.

Apart from the fact that it did not help me solving my problem (which I now solved with the expression you recommended me before) I have many other things (pressure loss, uniformity of the flow) which I am now able to compute (hopefully) easily with your tool.

I thank you very much!
Glad you find it useful. Please always check the numbers you get (whether they make sense). The stuff is still in beta

Bernhard
gschaider is offline   Reply With Quote

Old   October 31, 2012, 10:44
Default
  #20
Member
 
Join Date: Mar 2009
Posts: 90
Rep Power: 17
aerogt3 is on a distinguished road
Quote:
Originally Posted by gschaider View Post
Code:
    
functions
(
   averageVel
    {
        type swakExpression;
        valueType cellZone;
        zoneName heater; // or whatever is your zoneName
        accumulations (
            average
        );
        expression "U";
        verbose true;
    }
Bernhard
I just download swak4foam, and right now I just want to get the average pressure and total mass flow rate at my velocity inlet, to compare with hand calcs and make sure I am using it correctly. To sum these, I am doing the following:

Code:
            mdot_inlet
            {
              type swakExpression;                                    
              valueType patch                                    
              patchName inlet      
              expression "phi*flip()";                                 
              accumulations
                (
                  sum                                                            
                );
              verbose true;
            }

            p_inlet
            {
              type swakExpression;                                    
              valueType patch;                                    
              patchName inlet      
              expression "p";                                 
              accumulations
                (
                  average                                                            
                );
              verbose true;
            }
I get the following error for averaging p, and I get the same error when performing the operation on faceZones.

[44] [24]
--> FOAM FATAL ERROR:
[42] --> FOAM FATAL ERROR: Could not find a field name "p" of type scalar (neither surfaceScalarField nor volScalarField) Autointerpolate: 0
[16]

And this one for mass flow rate. When I do mass flow rate calcs on faceZones, it works.

[42]
[42] --> FOAM FATAL ERROR:
[42] Parser Error at "1.5-8" :"field flip not existing or of wrong type"
"phi*flip()"
" ^^^^ "


Any ideas? As best I can tell, I am following your syntax correctly, no?
aerogt3 is offline   Reply With Quote

Reply

Tags
openfoam 1.7.1, patchaverage, porous modellling, sampledict


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
How to calculate a time average spwater OpenFOAM 2 February 24, 2010 09:04
Problem in IMPORT of ICEM input file in FLUENT csvirume FLUENT 2 September 9, 2009 02:08
calculate the average velocity of particles robert FLUENT 0 August 1, 2008 10:44
Error to re-open fluent case file J.Gimbun FLUENT 0 April 27, 2006 09:42
Sliding mesh error Karl Kevala FLUENT 4 February 21, 2001 16:52


All times are GMT -4. The time now is 16:22.