CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   how to set up inlet velocity profile (https://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

gouravjee March 10, 2018 08:17

Quote:

Originally Posted by fabian_roesler (Post 555833)
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



Hello i have been working on a heat conduction problem and i am using groovyBC or providing a temperature profile as an input but it doesnt seem too work. can you help me withb this?

Code:


    front
    {
        type          groovyBC;
        valueExpression "2076000*exp(-pow((pos().x-122.5)/6.067,2))";
        fractionExpression        "0";

    }


gouravjee March 12, 2018 02:49

Probem with temperature profile
 
Quote:

Originally Posted by Lieven (Post 443083)
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

hello,
i have been working on a solidification/melting problem in which i am supposed to give a gaussian profile as a input heat flux i have written a code for that.but it is not giving me desired profile.
can you tell me where is the problem??
Code:

input
{
type codedFixedValue;
value uniform 573;
redirectType temperatureProfile;

code
#{

fixedValueFvPatchScalarField myPatch(*this);
forAll(this->patch().Cf(),i)
{
myPatch[i]=2076000*exp(-Foam::pow((this->patch().Cf()[i].x()-122.5)/6.067,2));
}
operator==(myPatch);
#};
}


wyldckat March 17, 2018 17:01

Quote:

Originally Posted by gouravjee (Post 684764)
hello,
i have been working on a solidification/melting problem in which i am supposed to give a gaussian profile as a input heat flux i have written a code for that.but it is not giving me desired profile.
can you tell me where is the problem??

Quick questions:
  1. What is the x range of values?
  2. How do you know if the centres of the faces are within that range?
  3. Have you confirmed in ParaView is they are truly positioned in that range?

gouravjee March 18, 2018 08:43

Quote:

Originally Posted by wyldckat (Post 685547)
Quick questions:
  1. What is the x range of values?
  2. How do you know if the centres of the faces are within that range?
  3. Have you confirmed in ParaView is they are truly positioned in that range?

  1. x lies within 24.4 to 48.8.
  2. i have simply used blockMesh to do the task.
  3. i Have confirmed that the they are truly positioned in that range.
  4. All the value which get from this function are nonzero.

wyldckat March 18, 2018 14:27

Quote:

Originally Posted by gouravjee (Post 685585)
  1. x lies within 24.4 to 48.8.

When I use the expression in LibreOffice Calc, with the values within that range, I get the following values:
Code:

24.4  5.89623239154312E-108
28.4  6.94161182559196E-99
32.4  3.42598751605742E-90
36.4  7.08844457133055E-82
40.4  6.14831116703849E-74
44.4  2.23563268446316E-66
48.4  3.40788382528878E-59
48.8  1.69835079530111E-58

Which means that it's not OpenFOAM's fault here.


I advise you to revise the expression you are trying to use. Perhaps the value "122.5" should be corrected for your own mesh?


All times are GMT -4. The time now is 00:59.