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

[swak4Foam] GroovyBC syntax

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 29, 2010, 14:54
Default GroovyBC syntax
  #1
Senior Member
 
Daniele
Join Date: Feb 2010
Posts: 134
Rep Power: 16
Daniele111 is on a distinguished road
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
Daniele111 is offline   Reply With Quote

Old   May 31, 2010, 03:02
Default
  #2
Senior Member
 
Stefan Herbert
Join Date: Dec 2009
Location: Darmstadt, Germany
Posts: 129
Rep Power: 17
herbert is on a distinguished road
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
herbert is offline   Reply With Quote

Old   May 31, 2010, 06:20
Default
  #3
Senior Member
 
Daniele
Join Date: Feb 2010
Posts: 134
Rep Power: 16
Daniele111 is on a distinguished road
Thanks you. What is the directory where I must install the groovyBC library?
Daniele111 is offline   Reply With Quote

Old   May 31, 2010, 07:41
Default
  #4
Senior Member
 
Daniele
Join Date: Feb 2010
Posts: 134
Rep Power: 16
Daniele111 is on a distinguished road
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:perator==(const pve:osition&, const pve:osition&)’:
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?
Daniele111 is offline   Reply With Quote

Old   May 31, 2010, 10:13
Default
  #5
Senior Member
 
Stefan Herbert
Join Date: Dec 2009
Location: Darmstadt, Germany
Posts: 129
Rep Power: 17
herbert is on a distinguished road
Hi,

seems you need to install flex.

Regards,
Stefan
herbert is offline   Reply With Quote

Old   June 11, 2010, 08:30
Default
  #6
New Member
 
mikael
Join Date: Jun 2010
Posts: 18
Rep Power: 15
keul is on a distinguished road
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
keul is offline   Reply With Quote

Old   June 14, 2010, 03:24
Default
  #7
Senior Member
 
Stefan Herbert
Join Date: Dec 2009
Location: Darmstadt, Germany
Posts: 129
Rep Power: 17
herbert is on a distinguished road
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
herbert is offline   Reply With Quote

Old   June 14, 2010, 05:38
Default
  #8
New Member
 
mikael
Join Date: Jun 2010
Posts: 18
Rep Power: 15
keul is on a distinguished road
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
keul is offline   Reply With Quote

Old   June 14, 2010, 09:05
Default
  #9
Senior Member
 
Emanuele
Join Date: Mar 2009
Posts: 110
Rep Power: 17
nuovodna is on a distinguished road
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);
    }

Last edited by nuovodna; June 14, 2010 at 09:14. Reason: Solved
nuovodna is offline   Reply With Quote

Old   June 15, 2010, 07:47
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 nuovodna View Post
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
gschaider is offline   Reply With Quote

Old   August 18, 2010, 09:31
Default
  #11
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 29
akidess will become famous soon enough
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?
akidess is offline   Reply With Quote

Old   August 18, 2010, 10:25
Default
  #12
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 akidess View Post
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.
gschaider is offline   Reply With Quote

Old   August 18, 2010, 10:41
Default
  #13
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 29
akidess will become famous soon enough
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

Last edited by akidess; August 18, 2010 at 10:43. Reason: make post easier to read
akidess is offline   Reply With Quote

Old   August 18, 2010, 12:09
Default
  #14
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 akidess View Post
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
gschaider is offline   Reply With Quote

Old   August 18, 2010, 12:43
Default
  #15
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 29
akidess will become famous soon enough
Ok, thank you Bernhard! I basically reproduced my post here, but if you need any more information let me know.

- Anton
akidess is offline   Reply With Quote

Old   August 19, 2010, 04:40
Default
  #16
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 akidess View Post
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)
gschaider is offline   Reply With Quote

Old   August 19, 2010, 05:05
Default
  #17
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 29
akidess will become famous soon enough
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..
akidess is offline   Reply With Quote

Old   August 19, 2010, 08:11
Default
  #18
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 akidess View Post
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 View Post
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
gschaider is offline   Reply With Quote

Old   August 19, 2010, 12:59
Default Forget this message
  #19
New Member
 
Pal Schmitt
Join Date: Aug 2010
Location: Belfast
Posts: 21
Rep Power: 15
wavemaster is on a distinguished road
The previous message was all wrong, sorry
Attached Images
File Type: jpg hummp.jpg (13.4 KB, 52 views)

Last edited by wavemaster; August 20, 2010 at 04:42. Reason: Wrong information
wavemaster is offline   Reply With Quote

Old   August 20, 2010, 04:40
Default
  #20
New Member
 
Pal Schmitt
Join Date: Aug 2010
Location: Belfast
Posts: 21
Rep Power: 15
wavemaster is on a distinguished road
Sorry, my fault. Everything is fine....
wavemaster 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
[swak4Foam] log velocity profile with groovyBC - syntax grjmell OpenFOAM Community Contributions 43 December 9, 2020 15:36
what is syntax error : missing ')' before ';' aleisia Fluent UDF and Scheme Programming 8 March 10, 2015 15:42
[OpenFOAM] Annoying issue of automatic "Rescale to Data Range " with paraFoam/paraview 3.12 keepfit ParaView 60 September 18, 2013 03:23
[swak4Foam] a problem in groovyBC: "syntax error, unexpected '('" immortality OpenFOAM Community Contributions 14 December 5, 2012 04:22
error while compiling the USER Sub routine CFD user CFX 3 November 25, 2002 15:16


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