CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   how to set up inlet velocity profile (http://www.cfd-online.com/Forums/openfoam/121557-how-set-up-inlet-velocity-profile.html)

Raymond.Leoi July 31, 2013 09:09

how to set up inlet velocity profile
 
Hey,

I am setting up a polynomial velocity profile (say, Ux = C1+C2*y+C3*y^2) for a velocity inlet. Any idea for it?

Cheers,
Raymond

kilroy July 31, 2013 09:36

Hello Raymond,

I am not sure but maybe you can do that with swak4Foam (groovyBC). You may want to look into that.

Best,
kilroy

Raymond.Leoi July 31, 2013 09:50

Thanks, Kilroy. Unfortunately, I couldn't find it in the OF version used.

Actually, the question is similar to setting up the inlet velocity profile for fully-dveloped laminar flow.

Quote:

Originally Posted by kilroy (Post 443060)
Hello Raymond,

I am not sure but maybe you can do that with swak4Foam (groovyBC). You may want to look into that.

Best,
kilroy


Lieven July 31, 2013 10:26

Hi Raymond,

Have a look at http://www.openfoam.org/version2.1.0...conditions.php
the functionality you are looking for, is already available in OF.

Cheers

L

Raymond.Leoi July 31, 2013 10:32

Thanks, L. Well, I suppose the polynomial example for scalar variables. Is it also applicable for vector variables like velocity?

Quote:

Originally Posted by Lieven (Post 443077)
Hi Raymond,

Have a look at http://www.openfoam.org/version2.1.0...conditions.php
the functionality you are looking for, is already available in OF.

Cheers

L


Lieven July 31, 2013 10:43

That's a very good question, I have no clue :D

I would say, have a look at the sources and see if that tells you a bit more. Otherwise, I'm pretty sure you can use the codedFixedValue boundary condition but this will be a bit more challenging. Then the groovyBC might be easier to use (never used it myself so can't help you with that).

Cheers,

L

kilroy July 31, 2013 11:01

Quote:

Originally Posted by Raymond.Leoi (Post 443067)
Thanks, Kilroy. Unfortunately, I couldn't find it in the OF version used.

Actually, the question is similar to setting up the inlet velocity profile for fully-dveloped laminar flow.

Raymond,

swak4Foam doesn't come with standard OpenFoam. You need to add it seperately. Please see the link below for details:

http://openfoamwiki.net/index.php/Contrib/swak4Foam

Best,
kilroy

Raymond.Leoi August 21, 2013 11:08

I made up a parabolic profile for velocity inlet using groovyBC as
Code:

inletL
{
type groovyBC;
variables "yp=pts().y;minY=min(yp);maxY=max(yp);rad=0.5*(max Y-minY);vavg=0.23;";
valueExpression "2.0*vavg*(1.0-pow(pos().y/rad,2))*normal()";
value uniform (10 0 0);
}

Also,
Code:

libs ( "libOpenFOAM.so" "libgroovyBC.so" );
is declared in controlDict. But I got the following error
Code:

Create mesh for time = 0
Reading field p
Reading field U

--> FOAM FATAL IO ERROR:
keyword boundaryField is undefined in dictionary "/home/parallels/OpenFOAM/..../0/U"

file: /home/parallels/OpenFOAM/..../0/U from line 17 to line 48.

From function dictionary::subDict(const word& keyword) const
in file db/dictionary/dictionary.C at line 461.

FOAM exiting

Anything wrong I made?

wyldckat August 22, 2013 07:21

Hi Raymond,

OK, the error message says that "boundaryField" is missing. If you look at one of OpenFOAM's tutorial files, such as "incompressible/icoFoam/cavity/0/U", you'll see that the "boundaryField" is the keyword for the list of boundary conditions, as you can examine at this link: https://github.com/OpenFOAM/OpenFOAM...oam/cavity/0/U

Therefore, it looks like you somehow has a damaged "U" file, which you must fix, to make it more similar to the ones on OpenFOAM's tutorials.

Best regards,
Bruno

Raymond.Leoi August 23, 2013 05:16

Quote:

Originally Posted by wyldckat (Post 447424)
Hi Raymond,

OK, the error message says that "boundaryField" is missing. If you look at one of OpenFOAM's tutorial files, such as "incompressible/icoFoam/cavity/0/U", you'll see that the "boundaryField" is the keyword for the list of boundary conditions, as you can examine at this link: https://github.com/OpenFOAM/OpenFOAM...oam/cavity/0/U

Therefore, it looks like you somehow has a damaged "U" file, which you must fix, to make it more similar to the ones on OpenFOAM's tutorials.

Best regards,
Bruno

Many cheers, Bruno. It's sorted out. Eventually, GroovyBC works. BTW, normal() follows right-hand rule as most of other codes, doesn't it?

wyldckat August 24, 2013 19:41

Quote:

Originally Posted by Raymond.Leoi (Post 447648)
BTW, normal() follows right-hand rule as most of other codes, doesn't it?

It should, but keep in mind that it might (probably) also take(s) into account which way is the inside of the simulation domain.
Nonetheless, I advise you to do some trial-and-error tests, just to confirm this ;)

Raymond.Leoi August 25, 2013 06:06

Quote:

Originally Posted by wyldckat (Post 447850)
It should, but keep in mind that it might (probably) also take(s) into account which way is the inside of the simulation domain.
Nonetheless, I advise you to do some trial-and-error tests, just to confirm this ;)

Thanks for your suggestion. That's a good idea. It's for sure that the direction of normal() at boundaries points outwards.

gschaider August 26, 2013 11:36

Quote:

Originally Posted by Raymond.Leoi (Post 447895)
Thanks for your suggestion. That's a good idea. It's for sure that the direction of normal() at boundaries points outwards.

Honestly: I've got to look that up every time myself. But basically it just passes through the definition that OpenFOAM uses. But I guess outwards. Because the boundary cell is the "owner" of the boundary face. And the normal of a face points from the "owner" to the "neighbour"

bufs July 10, 2015 09:51

groovyBC problems
 
Hi guys,

it's my first time using groovyBC, and I'm trying to set up an inlet velocity profile according to the following equation u = 2*y + y^2 in the x direction.

What I've done is edit the U file to include the following code for the inlet velocity

Code:

inlet
    {
        type              groovyBC;
    valueExpression    "(2*pos().y+pos().y*pos().y)*normal()";
    value              uniform (0 0 0);
    }

I've also edited the controlDict file in system to include

Code:

libs ("libOpenFOAM.so"
      "libsimpleSwakFunctionObjects.so"
      "libswakFunctionObjects.so"
      "libgroovyBC.so"
);

But once I run the code, after only few timesteps I get the following error messages

Code:

$ #0  Foam::error::printStack(Foam::Ostream&) in  "/usr/local/OpenFOAM/OpenFOAM-2.1.1//platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#1  Foam::sigFpe::sigHandler(int) in "/usr/local/OpenFOAM/OpenFOAM-2.1.1//platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#2 
 at sigaction.c:0
#3  Foam::PBiCG::solve(Foam::Field<double>&,  Foam::Field<double> const&, unsigned char) const in  "/usr/local/OpenFOAM/OpenFOAM-2.1.1//platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#4 
 in "/usr/local/OpenFOAM/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/bin/pimpleDyMFoam"
#5 
 in "/usr/local/OpenFOAM/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/bin/pimpleDyMFoam"
#6 
 in "/usr/local/OpenFOAM/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/bin/pimpleDyMFoam"
#7  __libc_start_main in "/lib64/libc.so.6"
#8 
 in "/usr/local/OpenFOAM/OpenFOAM-2.1.1/platforms/linux64GccDPOpt/bin/pimpleDyMFoam"

Anyone has any idea of what I'm doing wrong?

fabian_roesler July 17, 2015 01:39

Hi

Where dose this profile come from? Try to plot it in a spread sheet tool. It contains negative values and the peak (minimum value) is at y = -1.
From the error massage you can see, that the error is not withing your implementation of the profile in groovyBC but within your profile itself. The solver PBiCG can't solve for pressure because of the wired velocity profile.

Cheers

Fabian


All times are GMT -4. The time now is 07:47.