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

Non-normal inflow with groovyBC

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

Reply
 
LinkBack Thread Tools Display Modes
Old   March 30, 2010, 22:12
Default Non-normal inflow with groovyBC
  #1
bjr
Member
 
Ben Racine
Join Date: Mar 2009
Location: Seattle, WA, USA
Posts: 62
Rep Power: 8
bjr is on a distinguished road
Send a message via AIM to bjr Send a message via Skype™ to bjr
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;
}
}


// ************************************************** *********************** //
bjr is offline   Reply With Quote

Old   March 31, 2010, 15:24
Default Getting there... this works
  #2
bjr
Member
 
Ben Racine
Join Date: Mar 2009
Location: Seattle, WA, USA
Posts: 62
Rep Power: 8
bjr is on a distinguished road
Send a message via AIM to bjr Send a message via Skype™ to bjr
/*--------------------------------*- 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;
}
}


// ************************************************** *********************** //
bjr is offline   Reply With Quote

Old   March 31, 2010, 17:26
Default
  #3
bjr
Member
 
Ben Racine
Join Date: Mar 2009
Location: Seattle, WA, USA
Posts: 62
Rep Power: 8
bjr is on a distinguished road
Send a message via AIM to bjr Send a message via Skype™ to bjr
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?
bjr is offline   Reply With Quote

Old   March 31, 2010, 18:21
Default
  #4
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,912
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by bjr View Post
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?
Looks like a bug in the parser. Could you report a bug at http://sourceforge.net/apps/mantisbt...e_status_id=-2

Bernhard
gschaider is offline   Reply With Quote

Old   March 31, 2010, 18:30
Default
  #5
bjr
Member
 
Ben Racine
Join Date: Mar 2009
Location: Seattle, WA, USA
Posts: 62
Rep Power: 8
bjr is on a distinguished road
Send a message via AIM to bjr Send a message via Skype™ to bjr
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.

Generating a parabolic Profile with groovyBC

"""
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().y-w;d=pos().z-w;a=pow((c/w),2);b=pow((d/w),2);speed=Umax*(1-a)*(1-b);";
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().z-w 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().z-w,2)) which doesnt work either.
"""
bjr is offline   Reply With Quote

Old   March 31, 2010, 18:46
Default Found the problem as far as syntax is concerned...
  #6
bjr
Member
 
Ben Racine
Join Date: Mar 2009
Location: Seattle, WA, USA
Posts: 62
Rep Power: 8
bjr is on a distinguished road
Send a message via AIM to bjr Send a message via Skype™ to bjr
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);
}
bjr is offline   Reply With Quote

Old   January 14, 2011, 20:42
Default help with inflow to groovybc
  #7
Member
 
Join Date: Mar 2010
Posts: 30
Rep Power: 7
bunni is on a distinguished road
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
bunni is offline   Reply With Quote

Old   January 15, 2011, 12:27
Default
  #8
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,912
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by bunni View Post
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?
value is only needed by programs that "don't understand" the groovyBC (usual reason is that they are not OpenFOAM-programs - therefor they can't load the libs - that understand the OF-Fileformat. Usually postprocessors like Paraview and Visit) and want some information about the value on the border (although for the IC the value is probably inconsistent with the groovyBC)

Quote:
Originally Posted by bunni View Post
(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)
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.
gschaider is offline   Reply With Quote

Old   January 15, 2011, 22:32
Default thanks
  #9
Member
 
Join Date: Mar 2010
Posts: 30
Rep Power: 7
bunni is on a distinguished road
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 post-processes 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.
bunni is offline   Reply With Quote

Old   January 17, 2011, 11:35
Default
  #10
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,912
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by bunni View Post
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 post-processes 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.
Could you please copy the relevant expressions here so that we're not chasing ghosts? The entries you copied won't work (wrong case of BC, no " around expression, no () after normal)

Bernhard
gschaider is offline   Reply With Quote

Reply

Tags
crossflow, inlet profile

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
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
How to get normal vector to the face? Viatcheslav Kulikov FLUENT 0 January 19, 2006 15:04


All times are GMT -4. The time now is 12:41.