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

[swak4Foam] having problems configuring parabolic inlet using groovyBC

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By asharma
  • 1 Post By swahono

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 9, 2010, 05:47
Default having problems configuring parabolic inlet using groovyBC
  #1
New Member
 
Abhinav Sharma
Join Date: Sep 2010
Posts: 28
Rep Power: 15
asharma is on a distinguished road
Hi ,
I've been experimenting with different boundary conditions and am trying to set up velocity profile using groovyBC. At the inlet i require a power law condition given by U=2.5*(z/zr)^0.299...

Code:
inlet      
    {
        type            groovyBC;
        variables "Umin=2.5;h=pts().y;a=pow((h/10),0.299);speed=Umin*a;";
         valueExpression    "vector (speed, 0, 0)";
    }
I've attached by simulation domain also, basically a street canyon where my inlet is the left most face with x co-ordinate at -30 and y varying from 40 to 100m. I'm running it in Pisofoam but it keeps giving syntax error at "pow((h/10),0.299);"
" ^^ "
I am also a little confused on how to specify my "y" co-ordinate varying from 40 to 100 in groovy BC, I think i've done it incorrectly.

Any help would be much appreciated.

Thanks in advance,

Regards ,
Abhinav
Attached Images
File Type: jpg geometry.jpg (17.8 KB, 196 views)
phuchuynh likes this.
asharma is offline   Reply With Quote

Old   November 9, 2010, 23:02
Default
  #2
Member
 
Stefano Wahono
Join Date: Aug 2010
Location: Melbourne, Australia
Posts: 42
Rep Power: 15
swahono is on a distinguished road
I'm also now trying to use groovy BC to model a parabolic inlet velocity profile in a pipe flow.
Any help please?
__________________
Stefano Wahono

Defence Science and Technology Organisation
Propulsion Systems
swahono is offline   Reply With Quote

Old   November 10, 2010, 00:15
Default
  #3
New Member
 
Aidan
Join Date: Apr 2010
Posts: 18
Rep Power: 16
flowman is on a distinguished road
pts() returns a vector and you are using it as a scalar. Try something like this instead:

Code:
inlet      
    {
        type            groovyBC;
        variables "dir=vector (0,1,0);Umin=2.5;h=mag(pos()*dir);a=pow((h/10),0.299);speed=Umin*a;";
         valueExpression    "vector (speed, 0, 0)";
    }
flowman is offline   Reply With Quote

Old   November 10, 2010, 01:00
Default
  #4
New Member
 
Abhinav Sharma
Join Date: Sep 2010
Posts: 28
Rep Power: 15
asharma is on a distinguished road
Hi Aidan,
Thanks for the prompt reply. I tried implementing "dir=vector (0,1,0)" as suggested, but then when i run i get the following...

Quote:
--> FOAM FATAL ERROR:
Parser Error at "1.11-13" :"syntax error, unexpected vectorID, expecting 'x' or 'y' or 'z'"
"mag(pos().dir)"
" ^^^"

From function parsingValue
in file lnInclude/CommonValueExpressionDriverI.H at line 365.
i don't quite follow what "dir=vector (0,1,0)" means?

Regards,
Abhinav
asharma is offline   Reply With Quote

Old   November 10, 2010, 01:14
Default
  #5
Member
 
Stefano Wahono
Join Date: Aug 2010
Location: Melbourne, Australia
Posts: 42
Rep Power: 15
swahono is on a distinguished road
Hi,

Thanks for the reply.

I am trying to put a parabolic velocity profile at a pipe inlet.
u(r) = umean * (1- (r/R)^2)

My domain is a half pipe (see attached Picture).
Pipe is oriented along the x-direction.

Code:
    inlet
    {
        type                    groovyBC;               // Use Parabolic Profile
        //fractionExpression    1;
        variables               "Umax=0.178;c=vector(0,0,0);n=vector(1,0,0);p=pos()-c;r=mag(p)+1.0e-10;R=max(r);uprof=(1-pow(r/R,2))*Umax*normal();";
        valueExpression         "-uprof";
        timelines ();
        value                   uniform (0.178 0 0);
    }
This gives me wrong velocity profile at inlet (see attached picture).
It's supposed to be 0.178 m/s at the inlet centre.

I think I haven't got the transformation from the cylindrical to cartesian coordinate correctly.
Can someone please help on the transformation.

Thank you very much.

Stefano
Attached Images
File Type: jpg stillwrongParabolaInletVelocity-Ux.jpg (17.7 KB, 198 views)
swahono is offline   Reply With Quote

Old   November 30, 2010, 05:06
Default groovy BC
  #6
New Member
 
Abhinav Sharma
Join Date: Sep 2010
Posts: 28
Rep Power: 15
asharma is on a distinguished road
Hi foamers,
I've been trying out this new boundary condition describing inflow vertical velocity profile given as:-

u(z)=u*/k*log((z-do)/zo)

i've used groovyBC at my inlet wall as follows...

Code:
inlet      
    {
        type            groovyBC;
     
    variables    "Ustar=0.05;do=0.057;zo=0.00025;K=0.4;para (Ustar/K)*log((pos().z-do)/(zo))*normal();";
    valueExpression     "vector(para,0,0)";
    
    }
when i run pisoFoam i get the following error...

Quote:
Create time

Create mesh for time = 0

Reading field p

Reading field U

Reading/calculating face flux field phi

Selecting incompressible transport model Newtonian
Selecting turbulence model type RASModel
Selecting RAS turbulence model kEpsilon
kEpsilonCoeffs
{
Cmu 0.09;
C1 1.44;
C2 1.92;
sigmaEps 1.3;
}


Starting time loop

Time = 0.005

Courant Number mean: 0 max: 0
#0 Foam::error:rintStack(Foam::Ostream&) in "/opt/openfoam171/lib/linuxGccDPOpt/libOpenFOAM.so"
#1 Foam::sigFpe::sigFpeHandler(int) in "/opt/openfoam171/lib/linuxGccDPOpt/libOpenFOAM.so"
#2 Uninterpreted:
#3 log in "/lib/tls/i686/cmov/libm.so.6"
#4 Foam::log(Foam::Field<double>&, Foam::UList<double> const&) in "/opt/openfoam171/lib/linuxGccDPOpt/libOpenFOAM.so"
#5 Foam::log(Foam::UList<double> const&) in "/opt/openfoam171/lib/linuxGccDPOpt/libOpenFOAM.so"
#6 parserPatch::PatchValueExpressionParser:arse() at PatchValueExpressionParser.C:0
#7 Foam::PatchValueExpressionDriver:arse(std::strin g const&) in "/root/OpenFOAM/root-1.7.1/lib/linuxGccDPOpt/libswak4FoamParsers.so"
#8 Foam::CommonValueExpressionDriver::evaluateVariabl e(Foam::word const&, Foam::string const&) in "/root/OpenFOAM/root-1.7.1/lib/linuxGccDPOpt/libswak4FoamParsers.so"
#9 Foam::CommonValueExpressionDriver::addVariables(Fo am::string const&, bool) in "/root/OpenFOAM/root-1.7.1/lib/linuxGccDPOpt/libswak4FoamParsers.so"
#10 Foam::groovyBCFvPatchField<Foam::Vector<double> >::updateCoeffs() in "/root/OpenFOAM/root-1.7.1/lib/linuxGccDPOpt/libgroovyBC.so"
#11 Foam::fvMatrix<Foam::Vector<double> >::fvMatrix(Foam::GeometricField<Foam::Vector<doub le>, Foam::fvPatchField, Foam::volMesh>&, Foam::dimensionSet const&) in "/opt/openfoam171/lib/linuxGccDPOpt/libincompressibleLESModels.so"
#12 Foam::fv::gaussLaplacianScheme<Foam::Vector<double >, double>::fvmLaplacianUncorrected(Foam::GeometricFi eld<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>&) in "/opt/openfoam171/lib/linuxGccDPOpt/libfiniteVolume.so"
#13 Foam::fv::gaussLaplacianScheme<Foam::Vector<double >, double>::fvmLaplacian(Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>&) in "/opt/openfoam171/lib/linuxGccDPOpt/libfiniteVolume.so"
#14 Foam::fv::laplacianScheme<Foam::Vector<double>, double>::fvmLaplacian(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>&) in "/opt/openfoam171/lib/linuxGccDPOpt/libfiniteVolume.so"
#15 Foam::tmp<Foam::fvMatrix<Foam::Vector<double> > > Foam::fvm::laplacian<Foam::Vector<double>, double>(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>&, Foam::word const&) in "/opt/openfoam171/lib/linuxGccDPOpt/libincompressibleTurbulenceModel.so"
#16 Foam::tmp<Foam::fvMatrix<Foam::Vector<double> > > Foam::fvm::laplacian<Foam::Vector<double>, double>(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>&) in "/opt/openfoam171/lib/linuxGccDPOpt/libincompressibleTurbulenceModel.so"
#17 Foam::incompressible::RASModels::kEpsilon::divDevR eff(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>&) const in "/opt/openfoam171/lib/linuxGccDPOpt/libincompressibleRASModels.so"
#18
in "/opt/openfoam171/applications/bin/linuxGccDPOpt/pisoFoam"
#19 __libc_start_main in "/lib/tls/i686/cmov/libc.so.6"
#20
in "/opt/openfoam171/applications/bin/linuxGccDPOpt/pisoFoam"
Floating point exception
I'm not sure whats causing the problem.. am i doing something wrong in defining my condition?

regards,
Abhinav
asharma is offline   Reply With Quote

Old   December 1, 2010, 02:20
Default
  #7
New Member
 
Abhinav Sharma
Join Date: Sep 2010
Posts: 28
Rep Power: 15
asharma is on a distinguished road
I could get to run my case without any error.The problem was a small mistake at my end in defining my points.(sorry)

Thank you,
Abhinav
asharma is offline   Reply With Quote

Old   December 4, 2010, 05:54
Default
  #8
Senior Member
 
Suresh kumar Kannan
Join Date: Mar 2009
Location: Luxembourg, Luxembourg, Luxembourg
Posts: 129
Rep Power: 17
kumar is on a distinguished road
Hello Stefano and Abhinav,
I am trying to set parabolic inlet velocity using the groovyBC on a radial mesh which I generated using the guidelines from this website

http://openfoamwiki.net/index.php/Si...nical_diffuser
A snapshot of my mesh is attached . My flow is in the Z direction and it is a radial mesh.

My doubt is that to apply the parabolic inlet do I have to perform transformation.

Secondly I dont get the syntax of the groovyBC as used by Stefano.

Some advice would be really helpful
bye
regards
K.Suresh kumar
Attached Images
File Type: jpg mesh.jpg (61.2 KB, 70 views)
kumar is offline   Reply With Quote

Old   December 6, 2010, 00:42
Default
  #9
Member
 
Stefano Wahono
Join Date: Aug 2010
Location: Melbourne, Australia
Posts: 42
Rep Power: 15
swahono is on a distinguished road
Hi Kumar,

I just used the groovyBC syntax as given in the groovyBC Wiki
(http://openfoamwiki.net/index.php/Contrib_groovyBC).

I made a bit of mistake in my earlier post.
The setup for the 0/U file supposed to be:
Code:
    inlet
    {
           type            groovyBC;
           variables       "rpm=0.0;Un=0.178;c=vector(-10,0,0);n=sum(normal())/mag(sum(normal()));p=pos()-c;r=mag(p)+1.0e-10;R=max(r);xt=vector(n.y,-n.x,0);xT=xt/mag(xt);yt=vector(-n.x*n.z,-n.y*n.z,n.x*n.x+n.y*n.y);yT=yt/mag(yt);";
           valueExpression "-Un*normal()*(1-pow(r/R,2)) + (rpm*pi/30)*((p & yT)*xT - (p & xT)*yT)";
    value        uniform (0 0 0);
    timelines();
    }
The above profile was taken from groovyBC wiki for generating swirling inlet superimposed on a parabolic axial velocity profile. I have put the swirl component to zero (by setting rpm=0.0).

Un is the centreline velocity at the inlet
c is the position vector of the centre of the inlet patch.

The parabolic profile is just simply given by:
U(r) = Un * (1-(r/R)^2), where R is the radius of the inlet patch.

Just put the above expression onto your 0/U for the inlet patch,
set rpm to zero, change the value of c and Un. It's already in the cylindrical coordinate.
It should work straight away - no additional transformation required.

Be warned, epsilon will blow up in less than 10 iterations (if you use k-epsilon and steady RANS, and starting the solution from zero).
You need to start the run with laminar RAS model, then switch to k-epsilon after the initial instabilities near the wall dissapear.

Good luck. Please let me know if you need further info.

Best Regards,
Stefano
Attached Images
File Type: jpg ParabolaInletVelocity.jpg (19.3 KB, 105 views)
1988 likes this.
swahono is offline   Reply With Quote

Old   December 7, 2010, 02:49
Default
  #10
Senior Member
 
Suresh kumar Kannan
Join Date: Mar 2009
Location: Luxembourg, Luxembourg, Luxembourg
Posts: 129
Rep Power: 17
kumar is on a distinguished road
Hi Stefano,
Thanks for the clear explanation of the use of the syntax. I will try the groovyBC in the format that you have specified.
Actually I am still having some issues with the mesh . Once I am done with that, I will straight away use the groovyBC in the way you have specified.

I will get back to you, If I have any errors.

Thanks again.

bye
regards
K.Suresh kumar
kumar is offline   Reply With Quote

Old   December 27, 2010, 05:20
Default
  #11
Senior Member
 
Suresh kumar Kannan
Join Date: Mar 2009
Location: Luxembourg, Luxembourg, Luxembourg
Posts: 129
Rep Power: 17
kumar is on a distinguished road
Hi Stefano,
I had to change the mesh, because I want to compare the results with another solver FS3D. This time I am using a cartesian mesh and the solver interFoam. So I first had to define the volume fraction in a circular way from the center. Now I want to put a parabolic velocity profile on it. I started with your formulation.
internalField uniform (0 0 0);

boundaryField
{
inletWall
{
type groovyBC;
variables "rpm=0.0;Un=20;c=vector(2.1e-3,2.1e-3,0);n=sum(normal())/mag(sum(normal()));p=pos()-c;r=mag(p)+1.0e-10;R=max(r);xt=vector(n.y,-n.x,0);xT=xt/mag(xt);yt=vector(-n.x*n.z,-n.y*n.z,n.x*n.x+n.y*n.y);yT=yt/mag(yt);";
valueExpression "-(alpha1+internalField(alpha1))*-Un*normal()*(1-pow(r/R,2)) + (rpm*pi/30)*((p & yT)*xT - (p & xT)*yT)";
value uniform (0 0 20);
timelines ();
}

atmosphere
{
type fixedValue;
value uniform (0 0 0);
}

}
But I am not getting the parabolic velocity profile.The definition of c is the location of the centre of the round inlet. And I want to have a max velocity of 20 m/s.
Could you give me any suggestions on how to set a parabolic velocity profile for this kind of problem
regards
K.Suresh kumar
Attached Images
File Type: png roundinlet.png (7.3 KB, 85 views)
kumar is offline   Reply With Quote

Old   January 10, 2011, 18:10
Default
  #12
Member
 
Stefano Wahono
Join Date: Aug 2010
Location: Melbourne, Australia
Posts: 42
Rep Power: 15
swahono is on a distinguished road
Quote:
Originally Posted by kumar View Post
internalField uniform (0 0 0);

boundaryField
{
inletWall
{
type groovyBC;
variables "rpm=0.0;Un=20;c=vector(2.1e-3,2.1e-3,0);n=sum(normal())/mag(sum(normal()));p=pos()-c;r=mag(p)+1.0e-10;R=max(r);xt=vector(n.y,-n.x,0);xT=xt/mag(xt);yt=vector(-n.x*n.z,-n.y*n.z,n.x*n.x+n.y*n.y);yT=yt/mag(yt);";
valueExpression "-(alpha1+internalField(alpha1))*-Un*normal()*(1-pow(r/R,2)) + (rpm*pi/30)*((p & yT)*xT - (p & xT)*yT)";
value uniform (0 0 20);
timelines ();
}

atmosphere
{
type fixedValue;
value uniform (0 0 0);
}

}
But I am not getting the parabolic velocity profile.The definition of c is the location of the centre of the round inlet. And I want to have a max velocity of 20 m/s.
Could you give me any suggestions on how to set a parabolic velocity profile for this kind of problem
Hi Suresh,

I don't understand why you put "-(alpha1+internalField(alpha1))" in your value expression. This is a U BC isn't it?
I don't think you need that alpha1.
But again, I have not run interFoam before.

Another suggestion, it may be simpler to put the centre of the inlet face at 0,0,0. It makes things simpler because you don't have to worry about rounding.

The other thing, is the patch "atmosphere" your outlet?
You cannot have both fixedValue for velocity on both inlet and outlet.
If you fixed the velocity at inlet, then you need to use zeroGradient for velocity at the outlet boundary. You can then use zeroGradient pressure at Inlet, and fixedValue pressure at outlet.

Kind Regards,
Stefano
swahono is offline   Reply With Quote

Old   January 11, 2011, 06:33
Default
  #13
Senior Member
 
Suresh kumar Kannan
Join Date: Mar 2009
Location: Luxembourg, Luxembourg, Luxembourg
Posts: 129
Rep Power: 17
kumar is on a distinguished road
Hi Stefano,
Thanks for the suggestions. Actually I solved the problem for setting the parabolic inlet. You are right about the velocity at the outlet. I will change it.
Your explanation was very useful.

regards
K.Suresh kumar
kumar is offline   Reply With Quote

Old   May 25, 2011, 07:41
Default information in parabolic inlet
  #14
New Member
 
bamba
Join Date: Apr 2011
Posts: 4
Rep Power: 14
kbambas is on a distinguished road
Hello foamers
I 'm using open foam (IcoFoam)to solver my problem.I want use the parabolic velocity inlet for a cylinder.I understand stephane use a same my problem.
Stephane ,I want your help.I have attache the geometry and the condition inlet.
Thank
kbambas is offline   Reply With Quote

Old   May 27, 2011, 05:41
Default information in parabolic inlet
  #15
New Member
 
bamba
Join Date: Apr 2011
Posts: 4
Rep Power: 14
kbambas is on a distinguished road
Hello Stefano
I send you my geomtry .you can find it on the attachment.I work with IcoFoam( laminar staionnary) and i want a parabolic velocity inlet.
Thank you .
Attached Files
File Type: pdf geometrie.pdf (62.6 KB, 110 views)
kbambas is offline   Reply With Quote

Old   October 4, 2013, 13:41
Unhappy GroovyBC doubt
  #16
New Member
 
Akash Sharma
Join Date: May 2013
Location: Paris
Posts: 15
Rep Power: 12
akashjangid is on a distinguished road
Hello,

I am doing simulation on a rotor blade. My flow is a pressure based flow.
I have my Velocity at inlet which is given by direction cosines
dir_cos1 = 4.04
dir_cos2 = EXPR{57.2958*(acos(0.07045*(z/sqrt(z*z+y*y))))}
dir_cos3 = EXPR{57.2958*(acos(-0.07045*(y/sqrt(z*z+y*y))))}

Can someone tell me how to give this using groovyBC.

Thanks a lot !!
akashjangid is offline   Reply With Quote

Old   October 6, 2013, 06:59
Default
  #17
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 akashjangid View Post
Hello,

I am doing simulation on a rotor blade. My flow is a pressure based flow.
I have my Velocity at inlet which is given by direction cosines
dir_cos1 = 4.04
dir_cos2 = EXPR{57.2958*(acos(0.07045*(z/sqrt(z*z+y*y))))}
dir_cos3 = EXPR{57.2958*(acos(-0.07045*(y/sqrt(z*z+y*y))))}

Can someone tell me how to give this using groovyBC.

Thanks a lot !!
Which information is missing for you from http://openfoamwiki.net/index.php/Co...ression_syntax ? I think all you need to know is there. Except maybe that it is not exactly stated that there IS an acos-functin. But there is
__________________
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   June 23, 2015, 13:21
Default
  #18
New Member
 
Jindo
Join Date: Mar 2011
Location: Germany
Posts: 25
Rep Power: 15
phuchuynh is on a distinguished road
Quote:
Originally Posted by asharma View Post
Hi ,
I've been experimenting with different boundary conditions and am trying to set up velocity profile using groovyBC. At the inlet i require a power law condition given by U=2.5*(z/zr)^0.299...

Code:
inlet      
    {
        type            groovyBC;
        variables "Umin=2.5;h=pts().y;a=pow((h/10),0.299);speed=Umin*a;";
         valueExpression    "vector (speed, 0, 0)";
    }
I've attached by simulation domain also, basically a street canyon where my inlet is the left most face with x co-ordinate at -30 and y varying from 40 to 100m. I'm running it in Pisofoam but it keeps giving syntax error at "pow((h/10),0.299);"
" ^^ "
I am also a little confused on how to specify my "y" co-ordinate varying from 40 to 100 in groovy BC, I think i've done it incorrectly.

Any help would be much appreciated.

Thanks in advance,

Regards ,
Abhinav
hi,

I use OpenFoam to simulate flow throught street canyon, but I have some troubles, it is the boundaries condition. Especially, boundary condition for inlet? Can you help me about it?
Thanks.
phuchuynh is offline   Reply With Quote

Old   February 12, 2018, 08:40
Default
  #19
Senior Member
 
A. Min
Join Date: Mar 2015
Posts: 305
Rep Power: 12
alimea is on a distinguished road
Hi
consider a 3D box that I want to put a circular input with U=(0,5,0) boundary condition(on one of my walls that is rectangular)
If I want to use funkySetFields:

funkySetFields -case hotRoom -time 0 -field U -keepPatches -valuePatches "pipe" -condition "...." -expression 'vector(0,5,0)'

I put it just in time=0 ! however I want to use it as a boundary condition in my all timeSteps.

And if I want to use groovyBC I don't have any experience!
plz help me if you know what should I do.
Thank you
alimea 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
Inlet velocity as parabolic function @cfd OpenFOAM Pre-Processing 2 July 29, 2017 15:43
[swak4Foam] Inlet Boundary with groovyBC fmerk OpenFOAM Community Contributions 0 May 3, 2017 10:00
[swak4Foam] Power law inlet velocity using groovyBC aviator OpenFOAM Community Contributions 3 November 13, 2013 10:50
[swak4Foam] parabolic velocity profile with fluctuations (groovyBC?) newOFuser OpenFOAM Community Contributions 17 July 15, 2013 17:27
what the result is negatif pressure at inlet chong chee nan FLUENT 0 December 29, 2001 05:13


All times are GMT -4. The time now is 11:21.