CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Community Contributions (https://www.cfd-online.com/Forums/openfoam-community-contributions/)
-   -   [swak4Foam] GroovyBC syntax (https://www.cfd-online.com/Forums/openfoam-community-contributions/76578-groovybc-syntax.html)

Daniele111 May 29, 2010 14:54

GroovyBC syntax
 
Hi All

I must impose a velocity profile on inlet, and I want use groovyBC boundary condition. The velocity profile is: Ux=c1/c2log(y-y0/y0), I'm a newbe, and I would like know the correct syntax to use.

Thanks

herbert May 31, 2010 03:02

Hi,

did you take a look here: http://openfoamwiki.net/index.php/Contrib_groovyBC ? There is also an example for an inlet-condition.

Regards,
Stefan

Daniele111 May 31, 2010 06:20

Thanks you. What is the directory where I must install the groovyBC library?

Daniele111 May 31, 2010 07:41

I tried to compile this library but I have this message during compilation:

wmakeLnInclude: linking include files to ./lnInclude
Making dependency list for source file PatchResult.C
Making dependency list for source file PatchValueExpressionParser.yy
could not open file PatchValueExpressionParser.tab.hh for source file PatchValueExpressionParser.yy
Making dependency list for source file PatchValueExpressionLexer.ll
could not open file PatchValueExpressionParser.tab.hh for source file PatchValueExpressionLexer.ll
Making dependency list for source file PatchValueExpressionDriver.C
could not open file PatchValueExpressionParser.tab.hh for source file PatchValueExpressionDriver.C
Making dependency list for source file groovyBCFvPatchFields.C
could not open file PatchValueExpressionParser.tab.hh for source file groovyBCFvPatchFields.C
Making dependency list for source file groovyBCPointPatchFields.C
could not open file MixedPointPatchField.H for source file groovyBCPointPatchFields.C
could not open file PatchValueExpressionParser.tab.hh for source file groovyBCPointPatchFields.C
could not open file PointPatchFieldMapper.H for source file groovyBCPointPatchFields.C
SOURCE=PatchResult.C ; g++ -m32 -Dlinux -DWM_DP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-40 -IMake/linuxGccDPOpt -I/home/acconcia/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/acconcia/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude -I/home/acconcia/OpenFOAM/OpenFOAM-1.6/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linuxGccDPOpt/PatchResult.o
PatchResult.C: In member function ‘void Foam::PatchResult::uglyDelete()’:
PatchResult.C:97: warning: deleting ‘void*’ is undefined
SOURCE=PatchValueExpressionParser.yy ; rm -f Make/linuxGccDPOpt/PatchValueExpressionParser.C Make/linuxGccDPOpt/PatchValueExpressionParser.tab.hh; bison -ra -v -d $SOURCE ; mv *.tab.cc Make/linuxGccDPOpt/PatchValueExpressionParser.C ; mv *.tab.hh Make/linuxGccDPOpt/PatchValueExpressionParser.tab.hh ; mv *.hh Make/linuxGccDPOpt ; g++ -m32 -Dlinux -DWM_DP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-40 -IMake/linuxGccDPOpt -I/home/acconcia/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/acconcia/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude -I/home/acconcia/OpenFOAM/OpenFOAM-1.6/src/OSspecific/POSIX/lnInclude -fPIC -c Make/linuxGccDPOpt/PatchValueExpressionParser.C -o Make/linuxGccDPOpt/PatchValueExpressionParser.o
In file included from Make/linuxGccDPOpt/location.hh:44,
from PatchValueExpressionParser.tab.hh:65,
from PatchValueExpressionParser.tab.cc:61:
position.hh: In function ‘bool pve::operator==(const pve::position&, const pve::position&)’:
position.hh:136: warning: suggest parentheses around && within ||
PatchValueExpressionParser.tab.cc: In member function ‘unsigned char pve::PatchValueExpressionParser::yytranslate_(int) ’:
PatchValueExpressionParser.tab.cc:4941: warning: use of old-style cast
SOURCE=PatchValueExpressionLexer.ll ; rm Make/linuxGccDPOpt/PatchValueExpressionLexer.C ; flex -f $SOURCE ; mv *.c Make/linuxGccDPOpt/PatchValueExpressionLexer.C ; g++ -m32 -Dlinux -DWM_DP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-40 -IMake/linuxGccDPOpt -I/home/acconcia/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/acconcia/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude -I/home/acconcia/OpenFOAM/OpenFOAM-1.6/src/OSspecific/POSIX/lnInclude -fPIC -c Make/linuxGccDPOpt/PatchValueExpressionLexer.C -o Make/linuxGccDPOpt/PatchValueExpressionLexer.o
rm: impossibile rimuovere `Make/linuxGccDPOpt/PatchValueExpressionLexer.C': Nessun file o directory
/bin/sh: flex: not found
mv: impossibile fare stat di `*.c': Nessun file o directory
g++: Make/linuxGccDPOpt/PatchValueExpressionLexer.C: Nessun file o directory
g++: no input files
make: *** [Make/linuxGccDPOpt/PatchValueExpressionLexer.o] Errore 1



it's correct?

herbert May 31, 2010 10:13

Hi,

seems you need to install flex.

Regards,
Stefan

keul June 11, 2010 08:30

Hi everybody!

It's my first time on CFD Online and I begin on OpenFOAM. I'm working on a floating body simulation which I found online and I would like to generate waves on the object. So I've used the famous GroovyBC but when I compile OF return:

Reading transportProperties

Selecting incompressible transport model Newtonian
Selecting incompressible transport model Newtonian

--> FOAM FATAL ERROR:
Not Implemented
trying to construct an genericFvPatchField on patch inlet of field rho


But rho is defined for both fluids in transportProperties file.

Maybe somebody can help me?

thanks in advance

Keul

herbert June 14, 2010 03:24

Hi Mikael,

I think the problem is that your solver doesn't recognize the boundary condition for rho. Have you added the
Code:

libs ( "libOpenFOAM.so" "libgroovyBC.so" );
to your controlDict file?

Just for explanation: I guess you are using interFoam. Then BC's for rho are transferred from BC's for gamma. If using groovyBC for gamma, the solver won't be able to construct rho, if the above text is not included in your controlDict.

Regards,
Stefan

keul June 14, 2010 05:38

Hi Stephan

Thanks for your response. I had already got this problem with the groovyWaveTank file and so I go by this example. I've used the same kind of BC's. It seems that the program stops when OF is reading the transportProperties file where rho is defined for the two phases.
Do you think I should modify BC's in my gamma file?

I want to simulate a floating object (cube_region0) in a big box where there are two sides for the inlet and oulet, two sides I consider as wall (minY and maxY), the atmosphere and the bottom (minZ).


BC's in my gamma file:

boundaryField
{
inlet
{
type groovyBC;
refValue uniform 0;
refGradient uniform 0;
valueFraction uniform 1;
valueExpression "(pos().z<=A*cos(-w*time())+0.5*k*A*A*cos(2*(-w*time()))) ? 1 : 0";
gradientExpression "0";
fractionExpression "1";
variables "l=5;A=0.1;g=vector(0,0,-9.81);k=2*pi/l;w=sqrt(k*mag(g));";
timelines ( );
value nonuniform List<scalar>
1600
(......)
;
}
outlet
{
type zeroGradient;
}
minY
{
type zeroGradient;
}
maxY
{
type zeroGradient;
}
atmosphere
{
type inletOutlet;
inletValue uniform 0;
value uniform 0;
}
minZ
{
type zeroGradient;
}
cube_region0
{
type zeroGradient;
}
}

Thanks in advance

Mikael

nuovodna June 14, 2010 09:05

I think i have a similar problem.

I have this inlet condition

Code:

   
inlet
    {
            type            groovyBC;
            variables "zp=pts().z;szero=0.001;g=9.81;H=toFace(min(zp));";
            valueExpression "(g*szero)/2*nu * (2*H*zp - pow(zp,2))";
            value          uniform (0 0 0);
    }

runnin interFoam returns me this error:

Code:

--> FOAM FATAL ERROR:
 Parser Error at "1.7-9" :"syntax error, unexpected TOKEN_min"
"toFace(min(zp))"
"      ^^^    "

    From function parsingValue
    in file PatchValueExpressionDriver.C at line 188.


Solved imposing (in a not elegant way, i guess) ;

Code:

    inlet
    {
            type            groovyBC;
            variables "zp=pts().z;szero=0.001;g=9.81;H=1;";
            valueExpression "vector((g*szero)/2*nu * (2*pos().z - pow(pos().z,2)),0,0)";
            value          uniform (0 0 0);
    }


gschaider June 15, 2010 07:47

Quote:

Originally Posted by nuovodna (Post 262915)
I think i have a similar problem.

I have this inlet condition

Code:

   
inlet
    {
            type            groovyBC;
            variables "zp=pts().z;szero=0.001;g=9.81;H=toFace(min(zp));";
            valueExpression "(g*szero)/2*nu * (2*H*zp - pow(zp,2))";
            value          uniform (0 0 0);
    }

runnin interFoam returns me this error:

Code:

--> FOAM FATAL ERROR:
 Parser Error at "1.7-9" :"syntax error, unexpected TOKEN_min"
"toFace(min(zp))"
"      ^^^    "

    From function parsingValue
    in file PatchValueExpressionDriver.C at line 188.


Seems like the reduction-operations (min, max etc) are defined only for face-values (not point values like in your case). If a bug-report appears at http://sourceforge.net/apps/mantisbt...e_status_id=-2 I will attempt to fix this

Bernhard

akidess August 18, 2010 09:31

I'm having the same problem. I took a groovy boundary condition that was working with OF-1.5 and groovyBC from breeder15, and then tried to use it with OF-1.6.x and groovyBC from breeder16 - it works in the former case, but not in the latter. So this seems to be some sort of regression. Were you aware of that Bernhard?

gschaider August 18, 2010 10:25

Quote:

Originally Posted by akidess (Post 271882)
I'm having the same problem. I took a groovy boundary condition that was working with OF-1.5 and groovyBC from breeder15, and then tried to use it with OF-1.6.x and groovyBC from breeder16 - it works in the former case, but not in the latter. So this seems to be some sort of regression. Were you aware of that Bernhard?

I am not aware of such problems. I don't maintain the 1.5 version anymore

Your report is a bit unspecific. I'm not even sure whether your expression is not correctly parsed or if it gives the wrong values.

akidess August 18, 2010 10:41

I'm sorry it was unspecific. The following code works and gives the expected result with OF-1.5 and the appropriate groovyBC. With 1.6 and the newest groovyBC it throws the previously mentioned " Parser Error at "1.7-9" :"syntax error, unexpected TOKEN_min". The problem here is the call of toFace. Using only min(xp) does not lead to an error (although I still have to verify if I get the desired linear temperature gradient in that case).

Code:

top
    {
        type            groovyBC;
        refValue        uniform 0;
        refGradient    uniform 0;
        valueFraction  uniform 1;
        value          uniform 0;
        valueExpression "552.55 - (lin * 12)";
        gradientExpression "0";
        fractionExpression "1";
        variables      "xp=pts().x;minX=toFace(min(xp));maxX=toFace(max(xp));lin=(pos().x-minX)/(maxX - minX);";
        timelines      (
);
    }

- Anton

gschaider August 18, 2010 12:09

Quote:

Originally Posted by akidess (Post 271893)
I'm sorry it was unspecific. The following code works and gives the expected result with OF-1.5 and the appropriate groovyBC. With 1.6 and the newest groovyBC it throws the previously mentioned " Parser Error at "1.7-9" :"syntax error, unexpected TOKEN_min". The problem here is the call of toFace. Using only min(xp) does not lead to an error (although I still have to verify if I get the desired linear temperature gradient in that case).

Code:

top
    {
        type            groovyBC;
        refValue        uniform 0;
        refGradient    uniform 0;
        valueFraction  uniform 1;
        value          uniform 0;
        valueExpression "552.55 - (lin * 12)";
        gradientExpression "0";
        fractionExpression "1";
        variables      "xp=pts().x;minX=toFace(min(xp));maxX=toFace(max(xp));lin=(pos().x-minX)/(maxX - minX);";
        timelines      (
);
    }

- Anton

Seems like there was something broken for point-fields when the "foreign patch"-functionality was introduced.

As I said in the other posting:

Report a bug at http://sourceforge.net/apps/mantisbt...e_status_id=-2 and I will attempt to fix this

Bernhard

akidess August 18, 2010 12:43

Ok, thank you Bernhard! I basically reproduced my post here, but if you need any more information let me know.

- Anton

gschaider August 19, 2010 04:40

Quote:

Originally Posted by akidess (Post 271910)
Ok, thank you Bernhard! I basically reproduced my post here, but if you need any more information let me know.

- Anton

Thanks for taking the time to file a report. It makes life much easier for me if I find all potential problems in one please instead of having to search the whole meassage board for them.

Anyway: the problem itself could not be solved. For the full story see https://sourceforge.net/apps/mantisb...view.php?id=16 (for those who're interested. Anton should have gotten EMail-notifications anyway)

akidess August 19, 2010 05:05

Ok, so to fully resolve things, I think the wiki should be updated by removing the toFace() call from the usage examples, eg. pulsedPitzDaily, and/or stating that the behavior changed with OF-1.6 / groovyBC versions larger than 1792 (from what I can tell I was using 1709 and 1819). Do you agree?

http://openfoamwiki.net/index.php/Co...ulsedPitzDaily

PS. I actually didn't get an email because the issue was not automatically monitored..

gschaider August 19, 2010 08:11

Quote:

Originally Posted by akidess (Post 271980)
Ok, so to fully resolve things, I think the wiki should be updated by removing the toFace() call from the usage examples, eg. pulsedPitzDaily, and/or stating that the behavior changed with OF-1.6 / groovyBC versions larger than 1792 (from what I can tell I was using 1709 and 1819). Do you agree?

http://openfoamwiki.net/index.php/Co...ulsedPitzDaily

Yes. I would just change the description (no reference to the SVN-version as all people that do a new installation will get the new behaviour consistently accross 1.5-1.7)

Thanks for correcting it

Quote:

Originally Posted by akidess (Post 271980)
PS. I actually didn't get an email because the issue was not automatically monitored..

Thanks for the feedback. I assumed that the reporter automatically gets added to the monitoring list. Will see whether I can fix this

wavemaster August 19, 2010 12:59

Forget this message
 
1 Attachment(s)
The previous message was all wrong, sorry

wavemaster August 20, 2010 04:40

Sorry, my fault. Everything is fine....


All times are GMT -4. The time now is 19:51.