CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

a vector and scalar error in groovyBC

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

Reply
 
LinkBack Thread Tools Display Modes
Old   January 27, 2013, 16:23
Default a vector and scalar error in groovyBC
  #1
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,173
Rep Power: 16
immortality is on a distinguished road
my groovyBC on U is:
Code:
right
    {
        type groovyBC;

        variables (

                  //"pi=3.1415926535;"
                  "ymax=max(pos().y);"
                  "ymin=min(pos().y);"
                  "r=0.02325;"
                  "rpm=32151;"
                  "omega=rpm*pi/30;"
                  "v_r=r*omega;"
                  "w_cell=.004;"
                  "n=1;"
                  
                  "w_w0=n*w_cell;"
                  "w_w1=(115.63-46)*r*pi/180;"
                  "w_w2=(180-159.28)*r*pi/180;"
                  "w_w3=(21.6-0)*r*pi/180;"
                  "w_w4=(83-61.6)*r*pi/180;"
                  "w_w5=(180-128)*r*pi/180;"
                  "w_p1=(160.28-116.63)*r*pi/180;"
                  "w_p2=(71.1-21.6)*r*pi/180;"
                  "w_p3=(46-0)*r*pi/180;"
                  "w_p4=(129-84)*r*pi/180;"
                
                  "c1=w_p2/v_r;"
                  "c2=(w_p2+w_w4)/v_r;"
                  "c3=(w_p2+w_w4+w_p4)/v_r;"
                  "c4=(w_p2+w_w4+w_p4+w_w5+w_w3)/v_r;"
                  "t1=(w_w0+w_w3-pos().y)/v_r;"
                  "t2=t1+c4;"
                  "t3=t1+2*c4;"
                  "t4=t1+3*c4;"
                  "t5=t1+4*c4;"
                  "t6=t1+5*c4;"
                  "t7=t1+6*c4;"
                  "t8=t1+7*c4;"
                  "t9=t1+8*c4;"
                  "t10=t1+9*c4;"
                  "t11=t1+10*c4;"
                  
                  "p0_1=303975;"
                  "T0_1=440;"
                  "p0_3=932190;"
                  "T0_3=1248;"
                  "p0_2=1023382.5;"
                  "T0_4=973;"
                  "gamma=1.4;"
                  "R=287.14;"
                  

);

        /*fractionExpression "((0<=time()&&time()<=t1)||(t1+c1<=time()&&time()<=t1+c2)||(t1+c3<=time()&&time()<=t1+c4)||(t2+c1<=time()&&time()<=t2+c2)||(t2+c3<=time()&&time()<=t2+c4)||(t3+c1<=time()&&time()<=t3+c2)||(t3+c3<=time()&&time()<=t3+c4)||(t4+c1<=time()&&time()<=t4+c2)||(t4+c3<=time()&&time()<=t4+c4)||(t5+c1<=time()&&time()<=t5+c2)||(t5+c3<=time()&&time()<=t5+c4)||(t6+c1<=time()&&time()<=t6+c2)||(t6+c3<=time()&&time()<=t6+c4)||(t7+c1<=time()&&time()<=t7+c2)||(t7+c3<=time()&&time()<=t7+c4)||(t8+c1<=time()&&time()<=t8+c2)||(t8+c3<=time()&&time()<=t8+c4)||(t9+c1<=time()&&time()<=t9+c2)||(t9+c3<=time()&&time()<=t9+c4)||(t10+c1<=time()&&time()<=t10+c2)||(t10+c3<=time()&&time()<=t10+c4)||(t11+c1<=time()&&time()<=t11+c2)||(t11+c3<=time()&&time()<=t11+c4))?1:0";
        valueExpression "vector(0,-v_r,0)";
        gradientExpression "(phi>0)?vector(0,0,0):"; 
        value uniform (0 -39.13957133 0);*/
       fractionExpression "1";
       gradientExpression "0";
       valueExpression "((0<=time()&&time()<=t1)||(t1+c1<=time()&&time()<=t1+c2)||(t1+c3<=time()&&time()<=t1+c4)||(t2+c1<=time()&&time()<=t2+c2)||(t2+c3<=time()&&time()<=t2+c4)||(t3+c1<=time()&&time()<=t3+c2)||(t3+c3<=time()&&time()<=t3+c4)||(t4+c1<=time()&&time()<=t4+c2)||(t4+c3<=time()&&time()<=t4+c4)||(t5+c1<=time()&&time()<=t5+c2)||(t5+c3<=time()&&time()<=t5+c4)||(t6+c1<=time()&&time()<=t6+c2)||(t6+c3<=time()&&time()<=t6+c4)||(t7+c1<=time()&&time()<=t7+c2)||(t7+c3<=time()&&time()<=t7+c4)||(t8+c1<=time()&&time()<=t8+c2)||(t8+c3<=time()&&time()<=t8+c4)||(t9+c1<=time()&&time()<=t9+c2)||(t9+c3<=time()&&time()<=t9+c4)||(t10+c1<=time()&&time()<=t10+c2)||(t10+c3<=time()&&time()<=t10+c4)||(t11+c1<=time()&&time()<=t11+c2)||(t11+c3<=time()&&time()<=t11+c4))?vector(0,-v_r,0):((phi>0)?internalField(U):vector(0,0,0))";
      value uniform (0 -78.27914269 0);
    }
and this error is occuring over and over:
Code:
Create time

Create mesh for time = 0


PIMPLE: no residual control data found. Calculations will employ 2 corrector loops

Reading thermophysical properties

Selecting thermodynamics package hPsiThermo<pureMixture<sutherlandTransport<specieThermo<janafThermo<perfectGas>>>>>
Reading field U

Reading/calculating face flux field phi

Creating turbulence model

Selecting turbulence model type laminar
Creating field dpdt

Creating field kinetic energy K


Starting time loop

Courant Number mean: 0 max: 0
deltaT = 6.711409396e-09
Time = 6.71141e-09

diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
PIMPLE: iteration 1
swak4Foam: Allocating new repository for sampledGlobalVariables


--> FOAM FATAL ERROR:
The expected return type vector is different from the stored result type "scalar"



From function tmp<Field<Type> > ExpressionResult::getResult()
in file ../swak4FoamParsers/lnInclude/ExpressionResultI.H at line 124.
I have examined the mag(internalField(U)) and vector(internalField(U),0,0) and vector(mag(internalField(U)),0,0) but the error persists.whats true expression.im in doubt internalField(U) is vector of U or magnitude although think it should be vector.
immortality is offline   Reply With Quote

Old   January 27, 2013, 17:36
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,840
Rep Power: 38
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by immortality View Post
my groovyBC on U is:
Code:
right
    {
        type groovyBC;

        variables (

                  //"pi=3.1415926535;"
                  "ymax=max(pos().y);"
                  "ymin=min(pos().y);"
                  "r=0.02325;"
                  "rpm=32151;"
                  "omega=rpm*pi/30;"
                  "v_r=r*omega;"
                  "w_cell=.004;"
                  "n=1;"
                  
                  "w_w0=n*w_cell;"
                  "w_w1=(115.63-46)*r*pi/180;"
                  "w_w2=(180-159.28)*r*pi/180;"
                  "w_w3=(21.6-0)*r*pi/180;"
                  "w_w4=(83-61.6)*r*pi/180;"
                  "w_w5=(180-128)*r*pi/180;"
                  "w_p1=(160.28-116.63)*r*pi/180;"
                  "w_p2=(71.1-21.6)*r*pi/180;"
                  "w_p3=(46-0)*r*pi/180;"
                  "w_p4=(129-84)*r*pi/180;"
                
                  "c1=w_p2/v_r;"
                  "c2=(w_p2+w_w4)/v_r;"
                  "c3=(w_p2+w_w4+w_p4)/v_r;"
                  "c4=(w_p2+w_w4+w_p4+w_w5+w_w3)/v_r;"
                  "t1=(w_w0+w_w3-pos().y)/v_r;"
                  "t2=t1+c4;"
                  "t3=t1+2*c4;"
                  "t4=t1+3*c4;"
                  "t5=t1+4*c4;"
                  "t6=t1+5*c4;"
                  "t7=t1+6*c4;"
                  "t8=t1+7*c4;"
                  "t9=t1+8*c4;"
                  "t10=t1+9*c4;"
                  "t11=t1+10*c4;"
                  
                  "p0_1=303975;"
                  "T0_1=440;"
                  "p0_3=932190;"
                  "T0_3=1248;"
                  "p0_2=1023382.5;"
                  "T0_4=973;"
                  "gamma=1.4;"
                  "R=287.14;"
                  

);

        /*fractionExpression "((0<=time()&&time()<=t1)||(t1+c1<=time()&&time()<=t1+c2)||(t1+c3<=time()&&time()<=t1+c4)||(t2+c1<=time()&&time()<=t2+c2)||(t2+c3<=time()&&time()<=t2+c4)||(t3+c1<=time()&&time()<=t3+c2)||(t3+c3<=time()&&time()<=t3+c4)||(t4+c1<=time()&&time()<=t4+c2)||(t4+c3<=time()&&time()<=t4+c4)||(t5+c1<=time()&&time()<=t5+c2)||(t5+c3<=time()&&time()<=t5+c4)||(t6+c1<=time()&&time()<=t6+c2)||(t6+c3<=time()&&time()<=t6+c4)||(t7+c1<=time()&&time()<=t7+c2)||(t7+c3<=time()&&time()<=t7+c4)||(t8+c1<=time()&&time()<=t8+c2)||(t8+c3<=time()&&time()<=t8+c4)||(t9+c1<=time()&&time()<=t9+c2)||(t9+c3<=time()&&time()<=t9+c4)||(t10+c1<=time()&&time()<=t10+c2)||(t10+c3<=time()&&time()<=t10+c4)||(t11+c1<=time()&&time()<=t11+c2)||(t11+c3<=time()&&time()<=t11+c4))?1:0";
        valueExpression "vector(0,-v_r,0)";
        gradientExpression "(phi>0)?vector(0,0,0):"; 
        value uniform (0 -39.13957133 0);*/
       fractionExpression "1";
       gradientExpression "0";
       valueExpression "((0<=time()&&time()<=t1)||(t1+c1<=time()&&time()<=t1+c2)||(t1+c3<=time()&&time()<=t1+c4)||(t2+c1<=time()&&time()<=t2+c2)||(t2+c3<=time()&&time()<=t2+c4)||(t3+c1<=time()&&time()<=t3+c2)||(t3+c3<=time()&&time()<=t3+c4)||(t4+c1<=time()&&time()<=t4+c2)||(t4+c3<=time()&&time()<=t4+c4)||(t5+c1<=time()&&time()<=t5+c2)||(t5+c3<=time()&&time()<=t5+c4)||(t6+c1<=time()&&time()<=t6+c2)||(t6+c3<=time()&&time()<=t6+c4)||(t7+c1<=time()&&time()<=t7+c2)||(t7+c3<=time()&&time()<=t7+c4)||(t8+c1<=time()&&time()<=t8+c2)||(t8+c3<=time()&&time()<=t8+c4)||(t9+c1<=time()&&time()<=t9+c2)||(t9+c3<=time()&&time()<=t9+c4)||(t10+c1<=time()&&time()<=t10+c2)||(t10+c3<=time()&&time()<=t10+c4)||(t11+c1<=time()&&time()<=t11+c2)||(t11+c3<=time()&&time()<=t11+c4))?vector(0,-v_r,0):((phi>0)?internalField(U):vector(0,0,0))";
      value uniform (0 -78.27914269 0);
    }
and this error is occuring over and over:
Code:
Create time

Create mesh for time = 0


PIMPLE: no residual control data found. Calculations will employ 2 corrector loops

Reading thermophysical properties

Selecting thermodynamics package hPsiThermo<pureMixture<sutherlandTransport<specieThermo<janafThermo<perfectGas>>>>>
Reading field U

Reading/calculating face flux field phi

Creating turbulence model

Selecting turbulence model type laminar
Creating field dpdt

Creating field kinetic energy K


Starting time loop

Courant Number mean: 0 max: 0
deltaT = 6.711409396e-09
Time = 6.71141e-09

diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
PIMPLE: iteration 1
swak4Foam: Allocating new repository for sampledGlobalVariables


--> FOAM FATAL ERROR:
The expected return type vector is different from the stored result type "scalar"



From function tmp<Field<Type> > ExpressionResult::getResult()
in file ../swak4FoamParsers/lnInclude/ExpressionResultI.H at line 124.
I have examined the mag(internalField(U)) and vector(internalField(U),0,0) and vector(mag(internalField(U)),0,0) but the error persists.whats true expression.im in doubt internalField(U) is vector of U or magnitude although think it should be vector.
Classic example of overcomplicated expressions leading to a "forest for trees"-effect: gradient of a vector in surface normal direction is a .... vector. Now have a look at the gradientEpression
__________________
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

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On



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