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

[swak4Foam] a groovyBC error

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 18, 2012, 12:20
Default a groovyBC error
  #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
why this error is shown?
thesis@thesis-X58A-UD7:~/Desktop/method_4$ rhoCentralFoam
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.1.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
Build : 2.1.0-0bc225064152
Exec : rhoCentralFoam
Date : Dec 18 2012
Time : 19:22:27
Host : "thesis-X58A-UD7"
PID : 3659
Case : /home/thesis/Desktop/method_4
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Disallowing user-supplied system call operations
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time
Create mesh for time = 0
Reading thermophysical properties
Selecting thermodynamics package ePsiThermo<pureMixture<constTransport<specieThermo <hConstThermo<perfectGas>>>>>
Reading field U
Creating turbulence model
Selecting turbulence model type RASModel
Selecting RAS turbulence model kOmegaSST
kOmegaSSTCoeffs
{
alphaK1 0.85034;
alphaK2 1;
alphaOmega1 0.5;
alphaOmega2 0.85616;
Prt 1;
gamma1 0.5532;
gamma2 0.4403;
beta1 0.075;
beta2 0.0828;
betaStar 0.09;
a1 0.31;
c1 10;
}
Reading thermophysicalProperties
fluxScheme: Kurganov
Starting time loop
Mean and max Courant Numbers = 1.70419 74.97
deltaT = 1.33387e-10
Time = 1.33387e-10
diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
diagonal: Solving for rhoUx, Initial residual = 0, Final residual = 0, No Iterations 0
diagonal: Solving for rhoUy, Initial residual = 0, Final residual = 0, No Iterations 0
 
--> FOAM FATAL ERROR:
Parser Error at "1.29-31" :"syntax error, unexpected TOKEN_points"
"(0<=time() && time()<=(w_w1-pts().y)/v_r)||((w_w1+w_p1-pts().y)/v_r<=time() && time()<=(w_w1+w_p1+w_w2-pts().y)/v_r)||((w_w1+w_p1+w_w2+w_p2-pts().y)/v_r<=time() && time()<=(w_w1+w_p1+w_w2+w_p2+w_w3-w_cell)/v_r)?1:0"
" ^^^ "
From function parsingValue
in file lnInclude/CommonValueExpressionDriverI.H at line 802.
FOAM exiting
immortality is offline   Reply With Quote

Old   December 18, 2012, 13:36
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 immortality View Post
why this error is shown?
 
--> FOAM FATAL ERROR:
Parser Error at "1.29-31" :"syntax error, unexpected TOKEN_points"
"(0<=time() && time()<=(w_w1-pts().y)/v_r)||((w_w1+w_p1-pts().y)/v_r<=time() && time()<=(w_w1+w_p1+w_w2-pts().y)/v_r)||((w_w1+w_p1+w_w2+w_p2-pts().y)/v_r<=time() && time()<=(w_w1+w_p1+w_w2+w_p2+w_w3-w_cell)/v_r)?1:0"
" ^^^ "
From function parsingValue
in file lnInclude/CommonValueExpressionDriverI.H at line 802.
FOAM exiting
The problem is probably a mixing of point fields (fields defined on the vertices - which pts() is) and face fields (which is the regular thing). swak does not automatically interpolate between these (reasons are: loss of precision and ambiguity)

Either you juggle with the toFace() to toPoint() functions (see Examples) or you use pos() instead of pts() (which I think is what you wanted to use in the first place)
__________________
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 19, 2012, 09:14
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
thanks.I want to use fields on vertices.because I want the points on the patch gradually change from wall condition to environment(p0,T0).then I should use for example toPoint(U.x)? U should be internalField(U.x) for reading U from neighbour cells in grid.how should I merge these then?
thank you and best regards.
I wrote as this:
left
{
type groovyBC;
variables (
//"pi=3.1415926535;"
"ymax=max(pos().y);"
"ymin=min(pos().y);"
"r=0.06;"
"rpm=3600;"
"omega=rpm*pi/30;"
"v_r=r*omega;"
"w_cell=.003;"
"w_w1=.003;"
"w_p1=.06*11*pi/180;"
"w_w2=.06*49*pi/180;"
"w_p2=.06*30*pi/180;"
"w_w3=.003;"
"p0_1=250000;"
"T0_1=288;"
"p0_2=100000;"
"T0_2=288;"
"gamma=1.4;"
"R=287.14;"

);


fractionExpression "((0<=time() && time()<=(w_w1-pts().y)/v_r)||((w_w1+w_p1-pts().y)/v_r<=time() && time()<=(w_w1+w_p1+w_w2-pts().y)/v_r)||((w_w1+w_p1+w_w2+w_p2-pts().y)/v_r<=time() && time()<=(w_w1+w_p1+w_w2+w_p2+w_w3-w_cell)/v_r))?0:1";
valueExpression "((w_w1-pts().y)/v_r<time() && time()<(w_w1+w_p1-pts().y)/v_r)?(p0_1/pow((1+(gamma-1)/2*sqr(U.x)/(gamma*R*T0_1-(gamma-1)/2*sqr(U.x)),gamma/(gamma-1)))p0_2/pow((1+(gamma-1)/2*sqr(U.x)/(gamma*R*T0_2-(gamma-1)/2*sqr(U.x)),gamma/(gamma-1)))";
value uniform 100000;
gradientExpression "0";

//type fixedValue;
//value uniform 250000;
}
immortality is offline   Reply With Quote

Old   December 19, 2012, 09:34
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 immortality View Post
thanks.I want to use fields on vertices.because I want the points on the patch gradually change from wall condition to environment(p0,T0).then I should use for example toPoint(U.x)? U should be internalField(U.x) for reading U from neighbour cells in grid.how should I merge these then?
thank you and best regards.
I wrote as this:
left
{
type groovyBC;
variables (
//"pi=3.1415926535;"
"ymax=max(pos().y);"
"ymin=min(pos().y);"
"r=0.06;"
"rpm=3600;"
"omega=rpm*pi/30;"
"v_r=r*omega;"
"w_cell=.003;"
"w_w1=.003;"
"w_p1=.06*11*pi/180;"
"w_w2=.06*49*pi/180;"
"w_p2=.06*30*pi/180;"
"w_w3=.003;"
"p0_1=250000;"
"T0_1=288;"
"p0_2=100000;"
"T0_2=288;"
"gamma=1.4;"
"R=287.14;"

);


fractionExpression "((0<=time() && time()<=(w_w1-pts().y)/v_r)||((w_w1+w_p1-pts().y)/v_r<=time() && time()<=(w_w1+w_p1+w_w2-pts().y)/v_r)||((w_w1+w_p1+w_w2+w_p2-pts().y)/v_r<=time() && time()<=(w_w1+w_p1+w_w2+w_p2+w_w3-w_cell)/v_r))?0:1";
valueExpression "((w_w1-pts().y)/v_r<time() && time()<(w_w1+w_p1-pts().y)/v_r)?(p0_1/pow((1+(gamma-1)/2*sqr(U.x)/(gamma*R*T0_1-(gamma-1)/2*sqr(U.x)),gamma/(gamma-1)))p0_2/pow((1+(gamma-1)/2*sqr(U.x)/(gamma*R*T0_2-(gamma-1)/2*sqr(U.x)),gamma/(gamma-1)))";
value uniform 100000;
gradientExpression "0";

//type fixedValue;
//value uniform 250000;
}
I think what you want is rewrite some of the variables to points form ("ymax=max(pts().y);") and use the face positions ("pos()") in the main expression.

Draw yourself a sketch of a small sketch (5 faces or so are sufficient) and think what the difference in point and face positions mean for your expression
__________________
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 22, 2012, 11:47
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
I changed all terms to pos() function.but this error appeared:

fluxScheme: Kurganov
Starting time loop
Mean and max Courant Numbers = 1.70419 4.02331
deltaT = 2.48509e-08
Time = 2.48509e-08
diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
diagonal: Solving for rhoUx, Initial residual = 0, Final residual = 0, No Iterations 0
diagonal: Solving for rhoUy, Initial residual = 0, Final residual = 0, No Iterations 0
smoothSolver: Solving for Ux, Initial residual = 0.00115429, Final residual = 4.61702e-18, No Iterations 3
smoothSolver: Solving for Uy, Initial residual = 1, Final residual = 8.05495e-17, No Iterations 3
diagonal: Solving for rhoE, Initial residual = 0, Final residual = 0, No Iterations 0
smoothSolver: Solving for e, Initial residual = 0.00265688, Final residual = 3.54541e-12, No Iterations 3
swak4Foam: Allocating new repository for sampledGlobalVariables
 
--> FOAM FATAL ERROR:
Parser Error at "1.33" :"syntax error, unexpected ')'"
"1-(gamma-1)*sqr(internalField(U))/(2*gamma*R*T0_1)"
" ^ "
From function parsingValue
in file lnInclude/CommonValueExpressionDriverI.H at line 802.
FOAM exiting
 
---------------------------------------------------------------------------------------
my BC is:
---------------------------------------------------------------------------------------
left
{
type groovyBC;
variables (
//"pi=3.1415926535;"
"ymax=max(pos().y);"
"ymin=min(pos().y);"
"r=0.06;"
"rpm=3600;"
"omega=rpm*pi/30;"
"v_r=r*omega;"
"w_cell=.003;"
"w_w1=.003;"
"w_p1=.06*11*pi/180;"
"w_w2=.06*49*pi/180;"
"w_p2=.06*30*pi/180;"
"w_w3=.003;"
"p0_1=250000;"
"T0_1=288;"
"p0_2=100000;"
"T0_2=288;"
"gamma=1.4;"
"R=287.14;"
"par1=1-(gamma-1)*sqr(internalField(U))/(2*gamma*R*T0_1);"
"par2=1-(gamma-1)*sqr(internalField(U))/(2*gamma*R*T0_2);"


);


fractionExpression "(0<=time()&&time()<=(.003-pos().y)/22)||((.003+.01151917-pos().y)/22<=time()&&time()<=(.003+.01151917+.05131268-pos().y)/22)||((.003+.01151917+.05131268+.031415927-pos().y)/22<=time()&&time()<=(.003+.01151917+.05131268+.031 415927+.003-.003)/22)?0:1";
valueExpression "((w_w1-pos().y)/v_r<time() && time()<(w_w1+w_p1-pos().y)/v_r)? p0_1*pow(part1,3.5) : p0_2*pow(par2,3.5)";
value uniform 1000000;
gradientExpression "0";

//type fixedValue;
//value uniform 250000;
//(p0_1/pow(1+(gamma-1)/2*sqr(internalField(U)/(gamma*R*T0_1-(gamma-1)/2*sqr(internalField(U),3.5))
//(w_w1-pos().y)/22<time() && time()<(w_w1+w_p1-pos().y)/22)?
//p0_1*pow(1-(gamma-1)*sqr(internalField(U))/(2*gamma*R*T0_1),gamma/(gamma-1))
//2*gamma*R*T0_1
}
walls
{
type zeroGradient;

}
empty
{
type empty;

}

Last edited by immortality; December 22, 2012 at 13:11.
immortality is offline   Reply With Quote

Old   December 22, 2012, 20:01
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 immortality View Post
 
--> FOAM FATAL ERROR:
Parser Error at "1.33" :"syntax error, unexpected ')'"
"1-(gamma-1)*sqr(internalField(U))/(2*gamma*R*T0_1)"
" ^ "
From function parsingValue
in file lnInclude/CommonValueExpressionDriverI.H at line 802.
FOAM exiting
How am I supposed to easily see which')' the '^' points too?

Using the CODE-tag for terminal output improves the usefulness tremendously (although in my example the '^' is still not at the right place):
Code:
--> FOAM FATAL ERROR: 
Parser Error at "1.33" :"syntax error, unexpected ')'"
"1-(gamma-1)*sqr(internalField(U))/(2*gamma*R*T0_1)"
"                   ^ "
Anyway: your problem probably is that in OpenFOAM sqr of a vector is a symmetric tensor but in your expression the parser expects a scalar. So either use sqr(mag(U)) and then square it or something like U&U (insert the internalField correctly to make it work the way you want to)
__________________
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, 2012, 10:27
Default
  #7
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 refined it in this manner:
Code:
left
    {
       type groovyBC;

        variables (

      //"pi=3.1415926535;"
                  "ymax=max(pos().y);"
                  "ymin=min(pos().y);"
                  "r=0.06;"
                  "rpm=3600;"
                  "omega=rpm*pi/30;"
                  "v_r=r*omega;"
                  "w_cell=.003;"
                  "w_w1=.003;"
                  "w_p1=.06*11*pi/180;"
                  "w_w2=.06*49*pi/180;"
                  "w_p2=.06*30*pi/180;"
                  "w_w3=.003;"
                  "p0_1=2500000;"
                  "T0_1=288;"
                  "p0_2=1000000;"
                  "T0_2=288;"
                  "gamma=1.4;"
                  "R=287.14;"
                  
                  
);

     
         
       fractionExpression "(0<=time() && time()<=(w_w1-pos().y)/v_r)||((w_w1+w_p1-pos().y)/v_r<=time() && time()<=(w_w1+w_p1+w_w2-pos().y)/v_r)||((w_w1+w_p1+w_w2+w_p2-pos().y)/v_r<=time() && time()<=(w_w1+w_p1+w_w2+w_p2+w_w3-w_cell)/v_r)?0:1";
       valueExpression "(w_w1-pos().y)/v_r<time() && time()<(w_w1+w_p1-pos().y)/v_r) ? T0_1-(gamma-1)/(2*gamma*R)*magSqr(internalField(U.x)):T0_2-(gamma-1)/(2*gamma*R)*magSqr(internalField(U.x))";
       value uniform 288;
       gradientExpression "0";
       
    }
but the error is persistent:

Code:
Starting time loop

Mean and max Courant Numbers = 1.70419 4.02331
deltaT = 2.48546e-09
Time = 2.48546e-09

diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
diagonal:  Solving for rhoUx, Initial residual = 0, Final residual = 0, No Iterations 0
diagonal:  Solving for rhoUy, Initial residual = 0, Final residual = 0, No Iterations 0
smoothSolver:  Solving for Ux, Initial residual = 1, Final residual = 5.94738e-17, No Iterations 3
smoothSolver:  Solving for Uy, Initial residual = 1, Final residual = 1.2546e-16, No Iterations 3
diagonal:  Solving for rhoE, Initial residual = 0, Final residual = 0, No Iterations 0


--> FOAM FATAL ERROR: 
 Parser Error at "1.60" :"syntax error, unexpected ')', expecting $end"
"(w_w1-pos().y)/v_r<time() && time()<(w_w1+w_p1-pos().y)/v_r) ? T0_1-(gamma-1)/(2*gamma*R)*magSqr(internalField(U.x)):T0_2-(gamma-1)/(2*gamma*R)*magSqr(internalField(U.x))"
"                                                            ^                                                                                                             "

    From function parsingValue
    in file lnInclude/CommonValueExpressionDriverI.H at line 802.

FOAM exiting
immortality is offline   Reply With Quote

Old   December 23, 2012, 12:02
Default
  #8
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 immortality View Post
but the error is persistent:

Code:
Starting time loop

Mean and max Courant Numbers = 1.70419 4.02331
deltaT = 2.48546e-09
Time = 2.48546e-09

diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
diagonal:  Solving for rhoUx, Initial residual = 0, Final residual = 0, No Iterations 0
diagonal:  Solving for rhoUy, Initial residual = 0, Final residual = 0, No Iterations 0
smoothSolver:  Solving for Ux, Initial residual = 1, Final residual = 5.94738e-17, No Iterations 3
smoothSolver:  Solving for Uy, Initial residual = 1, Final residual = 1.2546e-16, No Iterations 3
diagonal:  Solving for rhoE, Initial residual = 0, Final residual = 0, No Iterations 0


--> FOAM FATAL ERROR: 
 Parser Error at "1.60" :"syntax error, unexpected ')', expecting $end"
"(w_w1-pos().y)/v_r<time() && time()<(w_w1+w_p1-pos().y)/v_r) ? T0_1-(gamma-1)/(2*gamma*R)*magSqr(internalField(U.x)):T0_2-(gamma-1)/(2*gamma*R)*magSqr(internalField(U.x))"
"                                                            ^                                                                                                             "

    From function parsingValue
    in file lnInclude/CommonValueExpressionDriverI.H at line 802.

FOAM exiting
Look at where the ^ is pointing. There's 6 '(' and this is the 7th ')' so the error message is spot-on: there is no way that at any point in the expression can there be more closing ')' than opening '('.

Have you ever considered to think for 5 minutes about what the error message means and whether it could be your input that caused it? I think that would be faster than copy/pasting it to the message board and waiting for someone else to do the thinking you should have done. Especially if people stop answering
__________________
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

Last edited by gschaider; December 23, 2012 at 12:03. Reason: Deleted opening of quote
gschaider is offline   Reply With Quote

Old   December 23, 2012, 13:21
Default
  #9
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27
immortality is on a distinguished road
thanks.sorry also I grasped it after sending.good people never refuse to help even if the question is silly.
thanks for your help.
immortality 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
[OpenFOAM.org] compile error in dynamicMesh and thermophysicalModels libraries NickG OpenFOAM Installation 3 December 30, 2019 01:21
[blockMesh] blockMesh with double grading. spwater OpenFOAM Meshing & Mesh Conversion 92 January 12, 2019 10:00
[swak4Foam] GroovyBC the dynamic cousin of funkySetFields that lives on the suburb of the mesh gschaider OpenFOAM Community Contributions 300 October 29, 2014 19:00
OpenFOAM without MPI kokizzu OpenFOAM Installation 4 May 26, 2014 10:17
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 18:51


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