CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Parabolic inlet velocity profile (http://www.cfd-online.com/Forums/openfoam-solving/57793-parabolic-inlet-velocity-profile.html)

 msrinath80 April 26, 2006 05:15

I did not really want to start

I did not really want to start a new thread considering the fact that this subject has been discussed in various forms in the past. However, please bear with me if you can!

I currently have a proper case setup in OpenFoam that solves flow past an obstacle. My C++ is totally rusty and therefore I'm looking for an easy n00bie way to get this parabolic inlet profile done.

For channel flow, I'm looking at an equation of the following form that describes a parabolic velocity profile:

U = 4 * U_max * y (h -y) / (h^2)

Where, 'U_max' and 'h' are constants I provide. 'U_max' is the maximum velocity at the centerline, 'h' refers to the width of the channel.

I would really appreciate if someone could guide me through the relevant steps. I just started using OpenFoam today and I'm impressed with it's ease of use. After a quick walk through the lid-driven cavity tutorial, I was not only able to quickly create my mesh but also run the case for unsteady vortex shedding.

I will put up a tutorial for the same once I get some results I can compare with http://www.cfd-online.com/OpenFOAM_D...part/happy.gif

Thanks a lot for your patience!

 gschaider April 26, 2006 13:05

The parabolic inlet. I read ab

The parabolic inlet. I read about cultures in the Pacific where you aren't considered an adult before you havn't programmed your own parabolic-inlet-utility. But this here isn't one of them so it's OK to ask for your help.

I find it difficult to explain things step-by-step (because it's hard to anticipate what the other guy doesn't know) so I'll post you the source of one of my first tries at a OF-Utility and you'll ask about the things you don't understand.

It compiles on 1.3 but the last time I properly tested it was on 1.1 (but I see no reason why it shouldn't work on 1.3). It assumes that your channel is in x-Direction and the inlet a rectangle with borders parallel to y and z. The noncent-options are for cases where you wish to exploit the symmetry of the model (and therefor need only half a parabola).

http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif setParabolicInlet.C

 hjasak April 26, 2006 14:44

Hi, I did one of those a while

Hi, I did one of those a while back - it is called parabolicVelocityFvPatchVectorField and should be somewhere on the discussion group. If you'd like the one updated to version 1.3, send me and E-mail and I'll give you the files.

Enjoy,

Hrv

 msrinath80 April 26, 2006 17:15

Bernhard: Many thanks for your

Bernhard: Many thanks for your prompt response http://www.cfd-online.com/OpenFOAM_D...part/happy.gif

So it's enough if I modify:

scalar vel=maxVel*(1-y*y)*(1-z*z);

to something in the following lines:

scalar vel=4*maxVel*y*(h-y)/(h*h);

My geometry is also a channel (length along x) with an obstacle somewhere inside it. I'm only interested in applying the profile at the inlet, so I won't have to bother about changing anything else?

If that's the case, where do I place this source and how do I get it to compile (wmake?) and subsequently get Openfoam to recognize it?

I know I'm asking for too much here. But I would appreciate if anyone can lend a helping hand. Thanks very much!

 gschaider April 26, 2006 18:15

Hi p???! (Sorry, can't pronoun

Hi p???! (Sorry, can't pronounce your nickname)

Basically both formulations are the same BUT for mine I normalized y from [ymin,ymax] (ymax-ymin)=h to [-1,1] (as you can see in the source)

What this utility does is set the velocity at a patch if on that patch the velocity is fixedValue. Values on a fixed Value patch are not touched by the solver (normally, because he could if he wanted to), just used.

Place the source in a directory. Create a directory Make in it in which you create a file named options with this content

EXE_INC = \
-I\$(LIB_SRC)/cfdTools/lnInclude \
-I\$(LIB_SRC)/finiteVolume/lnInclude

EXE_LIBS = -lfiniteVolume

and a file files with this content

setParabolicInlet.C
EXE = \$(FOAM_USER_APPBIN)/setParabolicInlet

After a wmake the executable is in your path and you can start using it.

BTW: you'll also need a creatFields.H:

Info<< "Vector field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::AUTO_WRITE
),
mesh
);

(and look for Hrv's solution. It's always instructive to see the same thing done in different ways)

 msrinath80 April 26, 2006 18:46

Thanks for the quick response.

Thanks for the quick response. So would I need to impose a parabolic profile in X and Y even if my case will be solved in 2D?

I'm asking because you seem to be doing the following:

maxVel*(1-y*y)*(1-z*z);

 gschaider April 27, 2006 08:17

No. The test (zmax-zmin)==0 ma

No. The test (zmax-zmin)==0 makes sure that you get a 2D-profile for a 2D-case (without having to write a searate utility for 2D and 3D)

 msrinath80 May 7, 2006 00:38

Hi Bernhard, I tried your i

Hi Bernhard,

I tried your instructions for compiling. This is what I get:

[openfoam@localhost par_inlet]\$ wclean && wmake
Making dependency list for source file setParabolicInlet.C

SOURCE_DIR=.
SOURCE=setParabolicInlet.C ; g++ -m64 -DlinuxAMD64 -Wall -W -Wno-unused-parameter -Wold-style-cast -march=opteron -O3 -ffast-math -DNoRepository -ftemplate-depth-30 -I/home/openfoam/OpenFOAM/OpenFOAM-1.2/src/cfdTools/lnInclude -I/home/openfoam/OpenFOAM/OpenFOAM-1.2/src/finiteVolume/lnInclude -I/home/openfoam/OpenFOAM/OpenFOAM-1.2/src/cfdTools/general/lnInclude -I/home/openfoam/OpenFOAM/OpenFOAM-1.2/src/OpenFOAM/lnInclude -I/home/openfoam/OpenFOAM/OpenFOAM-1.2/src/OpenFOAM/lnInclude -IlnInclude -I. -fPIC -c \$SOURCE -o Make/linuxAMD64Gcc4Opt/setParabolicInlet.o
/home/openfoam/OpenFOAM/OpenFOAM-1.2/wmake/bashScripts/mkObjectDir /home/openfoam/OpenFOAM/openfoam-1.2/applications/bin/linuxAMD64Gcc4Opt/setParab olicInlet
g++ -m64 -DlinuxAMD64 -Wall -W -Wno-unused-parameter -Wold-style-cast -march=opteron -O3 -ffast-math -DNoRepository -ftemplate-depth-30 -I/home/openfoam/OpenFOAM/OpenFOAM-1.2/src/cfdTools/lnInclude -I/home/openfoam/OpenFOAM/OpenFOAM-1.2/src/finiteVolume/lnInclude -I/home/openfoam/OpenFOAM/OpenFOAM-1.2/src/cfdTools/general/lnInclude -I/home/openfoam/OpenFOAM/OpenFOAM-1.2/src/OpenFOAM/lnInclude -I/home/openfoam/OpenFOAM/OpenFOAM-1.2/src/OpenFOAM/lnInclude -IlnInclude -I. -fPIC Make/linuxAMD64Gcc4Opt/setParabolicInlet.o -L/home/openfoam/OpenFOAM/OpenFOAM-1.2/lib/linuxAMD64Gcc4Opt \
-lfiniteVolume -lOpenFOAM -lm -o /home/openfoam/OpenFOAM/openfoam-1.2/applications/bin/linuxAMD64Gcc4Opt/setParab olicInlet
/usr/bin/ld: cannot find -lfiniteVolume
collect2: ld returned 1 exit status
make: *** [/home/openfoam/OpenFOAM/openfoam-1.2/applications/bin/linuxAMD64Gcc4Opt/setPara bolicInlet] Error 1

My files file contains:

setParabolicInlet.C
EXE = \$(FOAM_USER_APPBIN)/setParabolicInlet

My options file contains:

EXE_INC = \
-I\$(LIB_SRC)/cfdTools/lnInclude \
-I\$(LIB_SRC)/finiteVolume/lnInclude \
-I\$(LIB_SRC)/cfdTools/general/lnInclude \
-I\$(LIB_SRC)/OpenFOAM/lnInclude

EXE_LIBS = \
-lfiniteVolume

I'm using OpenFoam 1.2. Any suggestions on what might be wrong?

 gschaider May 8, 2006 04:23

The finiteVolume stuff is 1.3-

The finiteVolume stuff is 1.3-specific. Replace the -lfiniteVolume with -lcfdTools

 msrinath80 May 8, 2006 04:35

It works now. Thank you!

It works now. Thank you!

 sreekanth July 20, 2006 10:16

hello OpenFoam users, I am

hello OpenFoam users,

I am working on backwardFacing step flow. I tried doing as explained above. I created "setParabolic" folder in "/home/user/skolan/OpenFOAM/skolan-1.3/applications" and created setParabolic.C file and Make folder as mentioned above and with same data. When i compile it its running as shown below.

/home/user/skolan/OpenFOAM/skolan-1.3/applications/setParabolic

newton{skolan,204}% wmake
make: `Make/linuxGcc4DPOpt/dependencies' is up to date.

/home/user/skolan/OpenFOAM/OpenFOAM-1.3/wmake/tcshScripts/mkObjectDir /home/user/skolan/OpenFOAM/skolan-1.3/applications/bin/linuxGcc4DPOpt/libsetPara bolic.so
g++ -m32 -Dlinux -DDP -Wall -W -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-30 -I/home/user/skolan/OpenFOAM/OpenFOAM-1.3/src/cfdTools/lnInclude -I/home/user/skolan/OpenFOAM/OpenFOAM-1.3/src/finiteVolume/lnInclude -I/home/user/skolan/OpenFOAM/OpenFOAM-1.3/src/cfdTools/general/lnInclude -I/home/user/skolan/OpenFOAM/OpenFOAM-1.3/src/OpenFOAM/lnInclude -I/home/user/skolan/OpenFOAM/OpenFOAM-1.3/src/OpenFOAM/lnInclude -IlnInclude -I. -fPIC -pthread Make/linuxGcc4DPOpt/libsetParabolic.o -L/home/user/skolan/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt \
-lfiniteVolume -lOpenFOAM -liberty -o /home/user/skolan/OpenFOAM/skolan-1.3/applications/bin/linuxGcc4DPOpt/libsetPara bolic.so

I tried to use this .so file in my sonicFoam/backwardStep program by giving the library name in Make/options of sonicFoam and then i get the following error.

options file:
EXE_INC = \
-I\$(LIB_SRC)/finiteVolume/lnInclude

EXE_LIBS = \
-L\$(FOAM_USER_APPBIN)\
-lfiniteVolume\
-lsetParabolic

files file:
sonicFoam.C

EXE = \$(FOAM_APPBIN)/sonicFoam

error when i compile sonicFoam is:

/home/user/skolan/OpenFOAM/OpenFOAM-1.3/applications/solvers/compressible/sonicF oam
newton{skolan,132}% wmake
make: `Make/linuxGcc4DPOpt/dependencies' is up to date.

SOURCE_DIR=.
SOURCE=sonicFoam.C ; g++ -m32 -Dlinux -DDP -Wall -W -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-30 -I/home/user/skolan/OpenFOAM/OpenFOAM-1.3/src/finiteVolume/lnInclude -I/home/user/skolan/OpenFOAM/OpenFOAM-1.3/src/OpenFOAM/lnInclude -IlnInclude -I. -fPIC -pthread -c \$SOURCE -o Make/linuxGcc4DPOpt/sonicFoam.o
/home/user/skolan/OpenFOAM/OpenFOAM-1.3/wmake/tcshScripts/mkObjectDir /home/user/skolan/OpenFOAM/OpenFOAM-1.3/applications/bin/linuxGcc4DPOpt/sonicFoa m
g++ -m32 -Dlinux -DDP -Wall -W -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-30 -I/home/user/skolan/OpenFOAM/OpenFOAM-1.3/src/finiteVolume/lnInclude -I/home/user/skolan/OpenFOAM/OpenFOAM-1.3/src/OpenFOAM/lnInclude -IlnInclude -I. -fPIC -pthread Make/linuxGcc4DPOpt/sonicFoam.o -L/home/user/skolan/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt \
-L/home/user/skolan/OpenFOAM/skolan-1.3/applications/bin/linuxGcc4DPOpt -lfiniteVolume -lsetParabolic -lOpenFOAM -liberty -o /home/user/skolan/OpenFOAM/OpenFOAM-1.3/applications/bin/linuxGcc4DPOpt/sonicFoa m
/home/user/skolan/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libsetParabolic.so(.t ext+0x10166): In function `__i686.get_pc_thunk.cx':
: multiple definition of `__i686.get_pc_thunk.cx'
Make/linuxGcc4DPOpt/sonicFoam.o(.gnu.linkonce.t.__i686.get_pc_thunk.cx +0x0):soni cFoam.C: first defined here/home/user/skolan/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libsetParab
BS*+0x806e018): In function `__init_array_start':
: multiple definition of `_DYNAMIC'
/usr/lib/crt1.o(.dynamic+0x0):../sysdeps/i386/elf/start.S:65: first de
/home/user/skolan/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libsetParab
odata+0x0): multiple definition of `_fp_hw'
/usr/lib/crt1.o(.rodata+0x0):../sysdeps/i386/elf/start.S:65: first def
/home/user/skolan/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libsetParab
nit+0x0): In function `_init':
/usr/src/packages/BUILD/glibc-2.3/cc/csu/crti.S:36: multiple definitio
t'
/usr/lib/crti.o(.init+0x0):/usr/src/packages/BUILD/glibc-2.3/cc/csu/cr
irst defined here
/home/user/skolan/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libsetParab
ext+0x0): In function `_start':
../sysdeps/i386/elf/start.S:65: multiple definition of `_start'
/usr/lib/crt1.o(.text+0x0):../sysdeps/i386/elf/start.S:65: first defin
/home/user/skolan/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libsetParab
BS*+0x806e674): In function `_edata':
: multiple definition of `__bss_start'
/home/user/skolan/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libsetParab
ext+0x1a0): In function `main':
: multiple definition of `main'
Make/linuxGcc4DPOpt/sonicFoam.o(.text+0x6f0):sonicFoam.C: first define
/usr/bin/ld: Warning: size of symbol `main' changed from 43771 in Make
DPOpt/sonicFoam.o to 9467 in /home/user/skolan/OpenFOAM/OpenFOAM-1.3/l
c4DPOpt/libsetParabolic.so
/home/user/skolan/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libsetParab
ini+0x0): In function `_fini':
/usr/src/packages/BUILD/glibc-2.3/cc/csu/crti.S:52: multiple definitio
i'
/usr/lib/crti.o(.fini+0x0):/usr/src/packages/BUILD/glibc-2.3/cc/csu/cr
t defined here
/home/user/skolan/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libsetParab
BS*+0x806e674): In function `_edata':
: multiple definition of `_edata'
/home/user/skolan/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libsetParab
ext+0x1016a): In function `__i686.get_pc_thunk.bx':
: multiple definition of `__i686.get_pc_thunk.bx'
cFoam.C: first defined here
/home/user/skolan/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libsetParab
ot.plt+0x0): multiple definition of `_GLOBAL_OFFSET_TABLE_'
/usr/lib/crt1.o(.got.plt+0x0):../sysdeps/i386/elf/start.S:65: first de
/home/user/skolan/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libsetParab
BS*+0x806e714): In function `_end':
: multiple definition of `_end'
/home/user/skolan/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libsetParab
odata+0x4): multiple definition of `_IO_stdin_used'
/usr/lib/crt1.o(.rodata+0x4):../sysdeps/i386/elf/start.S:71: first def
/home/user/skolan/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libsetParab
ata+0x0): In function `__data_start':
: multiple definition of `__data_start'
/usr/lib/crt1.o(.data+0x0):../sysdeps/i386/elf/start.S:65: first defin
collect2: ld returned 1 exit status
make: *** [/home/user/skolan/OpenFOAM/OpenFOAM-1.3/applications/bin/li
pt/sonicFoam] Error 1
newton{skolan,133}%

 msrinath80 July 20, 2006 18:00

The setParabolicInlet source c

The setParabolicInlet source compiles as a utility (an executable file) [1]. I don't remember recompiling icoFoam when I used this utility. So I doubt that you would need to recompile sonicFoam just to get it to work.

In fact, all this utility does is enter into your 0 directory and open the U file and find the patch you specify as an inlet and change the uniform value to a non-uniform list.

Quoting from the executable:
Usage: setParabolicInlet <root> <case> <boundaryname> <maximum> [-z_noncenter] [-parallel] [-y_noncenter]

Just to be on similar terms, I am referring to the utility written by Bernhard Gschaider.

[1] ~/OpenFOAM/openfoam-1.2/applications/bin/linuxAMD64Gcc4Opt/setParabolicInlet

 sreekanth July 21, 2006 10:13

now i have changed my files an

now i have changed my files and directory names to setParabolicInlet and tried to execute as follows...i didn't understand the reason. Can some one plz help me resolve this. Are my arguments correct when i have used setParabolicInlet command.

I am working on backwardFacing step flow. I am taking the symmetry of flow as advantage. Hope the code works in that case too. 0.01 is the bulk velocity i want to implement and name of the patch is inlet.

newton{skolan,229}% setParabolicInlet /home/user/skolan/OpenFOAM/skolan-1.3/run/tutorials/sonicFoam backwardStep inlet 0.01 -z_noncenter -parallel -y_noncenter
/*---------------------------------------------------------------------------*\
| ========= | |
| \ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \ / O peration | Version: 1.3 |
| \ / A nd | Web: http://www.openfoam.org |
| \/ M anipulation | |
\*---------------------------------------------------------------------------*/

Exec : setParabolicInlet /home/user/skolan/OpenFOAM/skolan-1.3/run/tutorials/sonicFoam backwardStep inlet 0.01 -z_noncenter -parallel -y_noncenter
-----------------------------------------------------------------------------

It seems that there is no lamd running on the host newton.

This indicates that the LAM/MPI runtime environment is not operating.
The LAM/MPI runtime environment is necessary for MPI programs to run
(the MPI program tired to invoke the "MPI_Init" function).

Please run the "lamboot" command the start the LAM/MPI runtime
environment. See the LAM/MPI documentation for how to invoke
"lamboot" across multiple machines.
-----------------------------------------------------------------------

 msrinath80 July 21, 2006 10:32

Are you running your case in p

Are you running your case in parallel? I think so. Try using the utility in serial mode and see if it works, then you know for sure this is something to do with lam/mpi.

 msrinath80 July 21, 2006 15:17

In serial mode, all you need t

In serial mode, all you need to give is:

setParabolicInlet /home/user/skolan/OpenFOAM/skolan-1.3/run/tutorials/sonicFoam backwardStep inlet 0.01

 sreekanth July 22, 2006 03:40

I am not running in parallel.

I am not running in parallel. I just logged off and logged in and its working now. I have some basic question. What should be my outlet(type & conditions) so that the flow at the outlet is fully developed

my boundary file is......

6
(
inlet
{
type wall;
physicalType fixedTemperatureWall;
nFaces 50;
startFace 64600;
}

outlet
{
type patch;
physicalType pressureOutlet;
nFaces 150;
startFace 64650;
}

bottom
{
type wall;
physicalType fixedTemperatureWall;
nFaces 200;
startFace 64800;
}
top
{
type symmetryPlane;
physicalType symmetryPlane;
nFaces 250;
startFace 65000;
}

obstacle
{
type patch;
nFaces 150;
startFace 65250;
}

defaultFaces
{
type empty;
nFaces 65000;
startFace 65400;
}
)

I am working on a backwardFacingStep flow taking symmetry on top face and with constant temp(1000 K) of bottom face and inflow fluid with constant temp(300 K). streamlines i have plotted are not matching at the outlet. Can someone please help me out

 sreekanth July 22, 2006 03:55

I need some suggestions so tha

I need some suggestions so that i can have fully developed flow at the outlet

 sreekanth July 23, 2006 03:40

I have a problem with paraboli

I have a problem with parabolic inlet because my origin is at the edge of step, i mean my origin is not in the center of parabola but at the bottom of parabola. It gave the above half of the parabola whereas i need lower half of the parabola. Can you please suggest me something as soon as possible

 gschaider July 23, 2006 14:28

If you're still referring to m

If you're still referring to my setParabolic.C, commenting out the line

offY -= lenY;

(or the equivalent line with z's) should do the trick. (A bit recompiling might be in order)

 mss December 14, 2006 07:45

Hej, For my project I desid

Hej,

For my project I desided to use the icoFoam case, but I need to
specify velocity inlet (it should be parabolic). Could u give me some
hint how I can do it?

Thank u,
Rita

All times are GMT -4. The time now is 18:02.