
[Sponsors] 
March 30, 2010, 22:12 
Nonnormal inflow with groovyBC

#1 
Member

Anybody have any general guidance on this? I am trying to work my way up to 45 degree flow... but starting with this 80/10 ratio. I've got it working without groovyBC, but does anybody know how the formulation would need to be changed if using Groovy... my current attempt looks like this...
/** C++ **\  =========    \\ / F ield  OpenFOAM: The Open Source CFD Toolbox   \\ / O peration  Version: 1.6   \\ / A nd  Web: http://www.OpenFOAM.org   \\/ M anipulation   \**/ FoamFile { version 2.0; format ascii; class volVectorField; location "0"; object U; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 1 1 0 0 0 0]; internalField uniform (80 10 0); boundaryField { front { type groovyBC; variables "zp=pts().z;minZ=min(zp);maxZ=max(zp);para=pow(pos().z/0.390667,0.13)*normal();"; valueExpression "(1+0.00005*sin(500*time()))*para"; value uniform (80 10 0); } inlet { type groovyBC; variables "zp=pts().z;minZ=min(zp);maxZ=max(zp);para=pow(pos().z/0.390667,0.13)*normal();"; valueExpression "(1+0.00005*sin(500*time()))*para"; value uniform (80 10 0); } back { type inletOutlet; inletValue uniform (0 0 0); value uniform (80 10 0); } outlet { type inletOutlet; inletValue uniform (0 0 0); value uniform (80 10 0); } lowerWall { type fixedValue; value uniform (0 0 0); } OBJECT_patch0 { type fixedValue; value uniform (0 0 0); } upperWall { type slip; } } // ************************************************** *********************** // 

March 31, 2010, 15:24 
Getting there... this works

#2 
Member

/** C++ **\
 =========    \\ / F ield  OpenFOAM: The Open Source CFD Toolbox   \\ / O peration  Version: 1.6   \\ / A nd  Web: http://www.OpenFOAM.org   \\/ M anipulation   \**/ FoamFile { version 2.0; format ascii; class volVectorField; location "0"; object U; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 1 1 0 0 0 0]; internalField uniform (63.63 63.63 0); boundaryField { /* inlet { type fixedValue; value $internalField; } */ inlet { type groovyBC; //variables "zp=pts().z;minZ=min(zp);maxZ=max(zp);para=pow(pos().z/0.390667,0.13)*normal();"; //valueExpression "vector(63.63*para, 63.63*para, 0)"; valueExpression "vector(63.63, 63.63, 0)"; value uniform (63.63 63.63 0); } /* front { //type slip; type fixedValue; value $internalField; } */ front { type groovyBC; //variables "zp=pts().z;minZ=min(zp);maxZ=max(zp);para=pow(pos().z/0.390667,0.13)*normal();"; //valueExpression "90*para"; //valueExpression "vector(63.63*para, 63.63*para, 0)"; valueExpression "vector(63.63, 63.63, 0)"; value uniform (63.63 63.63 0); } /* back { //type slip; type inletOutlet; inletValue uniform (0 0 0); //value uniform (90 0 0); value $internalField; } */ back { type groovyBC; valueExpression "vector(0,0,0)"; //valueExpression "vector(63.63,63.63,0)"; gradientExpression "vector(0,0,0)"; fractionExpression "(phi > 0) ? 0 : 1"; //value uniform (0 0 0); value $internalField; } /* outlet { type inletOutlet; inletValue uniform (0 0 0); //value uniform (90 0 0); value $internalField; } */ outlet { type groovyBC; valueExpression "vector(0,0,0)"; //valueExpression "vector(63.63,63.63,0)"; gradientExpression "vector(0,0,0)"; fractionExpression "(phi > 0) ? 0 : 1"; //value uniform (0 0 0); value $internalField; } lowerWall { type slip; //type fixedValue; //value uniform (0 0 0); } OBJECT_patch0 { type fixedValue; value uniform (0 0 0); } upperWall { type slip; } } // ************************************************** *********************** // 

March 31, 2010, 17:26 

#3 
Member

But, if I switch the commented lines from
//valueExpression "vector(63.63*para, 63.63*para, 0)"; valueExpression "vector(63.63, 63.63, 0)"; to valueExpression "vector(63.63*para, 63.63*para, 0)"; //valueExpression "vector(63.63, 63.63, 0)"; it gives the error... Starting time loop Time = 1 Parser Error at "1.18" :"syntax error, unexpected ','" "vector(63.63*para, 63.63*para, 0)" " ^ " Any ideas? 

March 31, 2010, 18:21 

#4  
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,020
Rep Power: 43 
Quote:
Bernhard 

March 31, 2010, 18:30 

#5 
Member

I don't get it because there seems to be a successful case here... he thinks he has a pow(x,y) error, but seems to have gotten the above syntax to work.
http://www.cfdonline.com/Forums/ope...groovybc.html """ I managed to get a parabolic profile with variables "w=0.00005;m=3;n=2;Umax=1*(m+1)*(n+1)/m/n;c=pos().yw;d=pos().zw;a=pow((c/w),2);b=pow((d/w),2);speed=Umax*(1a)*(1b);"; valueExpression "vector (speed, 0, 0)"; in my starting file for U but i have two problems. pow() does not accecpt non integer values for the exponent like pow(a,1.5) is this a "normal" behaviour? and i need some function to get the distance from a point like distance = pos().zw now this will result in an negative value if pos().z <w which "should" be positive, i tried abs() but it seems its not implemented and i tried something like sqr(pow(pos().zw,2)) which doesnt work either. """ 

March 31, 2010, 18:46 
Found the problem as far as syntax is concerned...

#6 
Member

I've at least made the syntax happy... I believe the normal and the negative sign do not combine with the vector function. I suppose this makes sense, to be explicit about the vector components in this way. As for making sure it's physically correct... that's my problem. Thanks for entertaining my thoughts out loud though Bernhard! Once again it's us and not groovyBC!
inlet { type groovyBC; valueExpression "vector(pow(pos().z/0.390667,0.13)*63.63,pow(pos().z/0.390667,0.13)*63.63,0)"; value uniform (63.63 63.63 0); } 

January 14, 2011, 20:42 
help with inflow to groovybc

#7 
Member
Join Date: Mar 2010
Posts: 31
Rep Power: 9 
Sorry for the newbie questions, but clearly I'm misunderstanding something. I'd like to use groovyBC to vary the inlet velocity both in time and space. I've been playing with the examples circulatingsplash.
I'll use that example, from the 0/U file: atmosphere { type groovyBC; valueExpression "(alpha1+internalField(alpha1))*0.5*normal()"; value uniform (0 0 0); } So, my questions: (1) why do you need value uniform(0,0,0) ? From what I understand valueExpression is going to assign a value to each cell face, what role is the uniform playing? (2) how is { type groovyBC valueExpression " vector(0,2,0)"; } different from { type groovyBC valueExpression "2*normal()"; } different from: { type fixedValue value uniform(0,2,0) } ? (in this case, atmosphere is on the y=1 plane) Cheers 

January 15, 2011, 12:27 

#8  
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,020
Rep Power: 43 
Quote:
They are all equivalent. The middle one is the most flexible because it makes no assumption about the orientation of the boundary. So if you got to 3D and your atmosphere is z=1 you can reuse the files from the IC and they will still work. 

January 15, 2011, 22:32 
thanks

#9 
Member
Join Date: Mar 2010
Posts: 31
Rep Power: 9 
Ok, thanks for that. It's good to know I have some idea. So, the
value uniform (0,2,0) is for postprocessing  I do use paraview. Now, I haven't noticed any difference from the following BC's: (1) type groovybc; valueExpression 2*normal; (2) type groovybc; valueExpression 2*cos(time())*normal; The latter should give me a periodic wave, but as I run the case, and postprocesses using paraview I see no difference as a function of time. This could then be a paraview problem? can you suggest a different way of processing the data to see what's going on? Thanks so much for your help, it's good to know I'm somewhat on the right track. 

January 17, 2011, 11:35 

#10  
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,020
Rep Power: 43 
Quote:
Bernhard 

Tags 
crossflow, inlet profile 
Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
How to get normal vector to the face?  Viatcheslav Kulikov  FLUENT  1  August 31, 2017 03:03 
UDF to Access Wall Normal Concentration Gradient  Daniel Tanner  Fluent UDF and Scheme Programming  4  February 18, 2015 15:35 
my stl surface is seen as just a line  rcastilla  OpenFOAM Meshing & Mesh Conversion  2  January 6, 2010 02:30 
Normal stress?/  bowlderyu  Main CFD Forum  1  October 28, 2008 22:57 
NACA0012 geometry/design software needed  Franny  Main CFD Forum  13  July 7, 2007 15:57 