CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   Help parabolic inlet using groovyBC (http://www.cfd-online.com/Forums/openfoam/81858-help-parabolic-inlet-using-groovybc.html)

asharma November 9, 2010 06:47

Help parabolic inlet using groovyBC
 
1 Attachment(s)
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

swahono November 10, 2010 00:02

I'm also now trying to use groovy BC to model a parabolic inlet velocity profile in a pipe flow.
Any help please?

flowman November 10, 2010 01:15

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)";
    }


asharma November 10, 2010 02:00

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

swahono November 10, 2010 02:14

1 Attachment(s)
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

asharma November 30, 2010 06:06

groovy BC
 
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::printStack(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::parse() at PatchValueExpressionParser.C:0
#7 Foam::PatchValueExpressionDriver::parse(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 December 1, 2010 03:20

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

kumar December 4, 2010 06:54

1 Attachment(s)
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

swahono December 6, 2010 01:42

1 Attachment(s)
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

kumar December 7, 2010 03:49

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 December 27, 2010 06:20

1 Attachment(s)
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

swahono January 10, 2011 19:10

Quote:

Originally Posted by kumar (Post 288562)
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

kumar January 11, 2011 07:33

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

kbambas May 25, 2011 08:41

information in parabolic inlet
 
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 May 27, 2011 06:41

information in parabolic inlet
 
1 Attachment(s)
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 .

akashjangid October 4, 2013 14:41

GroovyBC doubt
 
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 !!

gschaider October 6, 2013 07:59

Quote:

Originally Posted by akashjangid (Post 455099)
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


All times are GMT -4. The time now is 17:28.