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

[swak4Foam] Swirl input using groovyBC

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 4 Post By tuominen

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 14, 2011, 19:59
Default Swirl input using groovyBC
  #1
Member
 
Join Date: Nov 2010
Posts: 54
Rep Power: 15
usergk is on a distinguished road
Hello Foamers,

I am trying to implement swirl input in a cylindrical tube (axis along z dir). I came across the groovyBC code to implement swirl input:

inlet
{
type groovyBC;
variables "rpm=8000.0;Un=55.8;c=sum(pos()*mag(Sf()))/sum(mag(Sf()));n=sum(normal())/mag(sum(normal()));p=pos()-c;r=mag(p)+1.0e-10;R=max(r);
xt=vector(0,n.z,-n.y);xT=xt/mag(xt);yt=vector(n.y*n.y+n.z*n.z,-n.x*n.y,-n.x*n.z);yT=yt/mag(yt);";
valueExpression "-Un*normal() + (rpm*pi/30)*((p & yT)*xT - (p & xT)*yT)";
}

Can someone explain what xt, yt, and (p & yT)*xT - (p & xT)*yT refer to?

Thanks so much,

Regards,
gk

Last edited by usergk; February 15, 2011 at 20:31.
usergk is offline   Reply With Quote

Old   February 15, 2011, 12:43
Default
  #2
Member
 
Join Date: Nov 2010
Posts: 54
Rep Power: 15
usergk is on a distinguished road
Hello,

Can anyone provide some hints here?

Many thanks,
gk

Last edited by usergk; February 15, 2011 at 20:32.
usergk is offline   Reply With Quote

Old   February 16, 2011, 03:08
Default
  #3
Senior Member
 
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 21
Bernhard is on a distinguished road
They are defined in variables. If you don't understand the formulation, make a sketch, using the known vectors (pos and normal), in a random orientation. In your sketch you will understand each term immediately. (With the assumption that this is a correct implementation of course )
Bernhard is offline   Reply With Quote

Old   February 16, 2011, 03:16
Default
  #4
New Member
 
L.Tuominen
Join Date: Jul 2010
Posts: 8
Rep Power: 15
tuominen is on a distinguished road
Quote:
Originally Posted by usergk View Post
Hello Foamers,

I am trying to implement swirl input in a cylindrical tube (axis along z dir). I came across the groovyBC code to implement swirl input:

inlet
{
type groovyBC;
variables "rpm=8000.0;Un=55.8;c=sum(pos()*mag(Sf()))/sum(mag(Sf()));n=sum(normal())/mag(sum(normal()));p=pos()-c;r=mag(p)+1.0e-10;R=max(r);
xt=vector(0,n.z,-n.y);xT=xt/mag(xt);yt=vector(n.y*n.y+n.z*n.z,-n.x*n.y,-n.x*n.z);yT=yt/mag(yt);";
valueExpression "-Un*normal() + (rpm*pi/30)*((p & yT)*xT - (p & xT)*yT)";
}

Can someone explain what xt, yt, and (p & yT)*xT - (p & xT)*yT refer to?

Thanks so much,

Regards,
gk
Hi

I have used following code:
Code:
type         groovyBC;
variables
(
    "yp=pos().y;"
    "xp=pos().x;"
    "r=sqrt(pow(xp,2)+pow(yp,2));"

    "U_ax=31.35;"
    "U_t=20.97;"
    "theta=asin(xp/r);"
    "U_tx=sqrt(pow(U_t*cos(theta),2));"
    "U_ty=-U_t*sin(theta);"
);
valueExpression "vector ( U_tx, U_ty, U_ax )";
U_ax is axial velocity along z-axis and U_t is tangential velocity. U_tx and U_ty are tangential velocity's x- and y-components. Sqrt and pow in U_tx only make sure that x component is always positive (I have modelled only sector, not full cylinder).

Lasse
tuominen is offline   Reply With Quote

Old   February 16, 2011, 11:43
Default
  #5
Member
 
Join Date: Nov 2010
Posts: 54
Rep Power: 15
usergk is on a distinguished road
Thanks a lot for the inputs! Really appreciate it!

I was able to get it running using Lasse's code.

gk
usergk is offline   Reply With Quote

Old   July 25, 2013, 08:02
Default
  #6
New Member
 
Federica Farisco
Join Date: Jul 2013
Posts: 2
Rep Power: 0
FedericaF is on a distinguished road
Hello,

I used funkySetBoundary in openfoam 1.7 to generate a swirl in the inlet patch for a sector of a cylinder and it works. I have attached below the file funkySetBoundaryDict used.


Code:
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.7.1 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

velocityswirl {
 field U;
   expressions
   (
       {    
            target value;
            patchName inlet;
                       
            variables       "rpm=1000.0;Un=10;c=sum(pos()*mag(Sf()))/sum(mag(Sf()));n=sum(normal())/mag(sum(normal()));n=sum(normal())/mag(sum(normal()));p=pos()-c;r=mag(pos()-vector(0,0,1))+1.0e-10;R=max(r);xt=vector(0,n.z,-n.y);xT=xt/mag(xt);yt=vector(n.y*n.y+n.z*n.z,-n.x*n.y,-n.x*n.z);yT=yt/mag(yt);";
                   
                          expression "-Un*normal() + (rpm*pi/30)*(((pos()-c) & yT)*xT-((pos()-c) & xT)*yT)";
       }
);
}  

//!!! in "variables" do not leave any space between the definitions of two variables and in "espression" try to replace the name of few variables with their definitions !!!

//!!! c=sum(pos()*mag(Sf()))/sum(mag(Sf())) works just for full patches; for other cases you have to set manually !!!
FedericaF is offline   Reply With Quote

Old   January 29, 2018, 01:58
Default
  #7
New Member
 
Kadu
Join Date: Jun 2015
Location: India
Posts: 6
Rep Power: 10
Pravin Kadu is on a distinguished road
Quote:
Originally Posted by tuominen View Post
Hi

I have used following code:
Code:
type         groovyBC;
variables
(
    "yp=pos().y;"
    "xp=pos().x;"
    "r=sqrt(pow(xp,2)+pow(yp,2));"

    "U_ax=31.35;"
    "U_t=20.97;"
    "theta=asin(xp/r);"
    "U_tx=sqrt(pow(U_t*cos(theta),2));"
    "U_ty=-U_t*sin(theta);"
);
valueExpression "vector ( U_tx, U_ty, U_ax )";
U_ax is axial velocity along z-axis and U_t is tangential velocity. U_tx and U_ty are tangential velocity's x- and y-components. Sqrt and pow in U_tx only make sure that x component is always positive (I have modelled only sector, not full cylinder).

Lasse
Thank you Lasse.

For complete (360 degree) cylinder-

inlet
{
type groovyBC;
variables
(
"yp2=pos().y;"
"zp2=pos().z;"
"r2=sqrt(pow(zp2,2)+pow(yp2,2));"

"U_ax2=0.5496*pow((1-mag(r2-0.0095)/(1.001*0.0035)),(1/7));"
"U_t=0.15*(1-pow((mag(r2-0.0095)/(1.001*0.0035)),2));"

"U_tz=-U_t*yp2/r2;"
"U_ty=U_t*zp2/r2;"
);
valueExpression "vector ( U_ax2, U_ty, U_tz )";
value uniform (0 0 0);
}


The 'value' might need to be added since without it some warning will be appeared. According to my understanding 'value' will be used only for first time-step.
Pravin Kadu 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
Quantifying the swirl in CFX, Swirl Number/Swirl Angle tauqirnawaz CFX 23 July 24, 2016 22:28
[swak4Foam] GroovyBC with power input (heat flux) Tobi OpenFOAM Community Contributions 10 January 12, 2016 10:04
[OpenFOAM] Paraview 3.98 - errors when saving geometry file pajot ParaView 1 September 28, 2013 10:45
Swirl in Pressure Swirl Atomizer varunrajendra FLUENT 0 August 19, 2009 12:09
Quantifying Swirl Ianto Main CFD Forum 0 April 27, 2009 10:54


All times are GMT -4. The time now is 20:39.