
[Sponsors] 
December 2, 2009, 17:45 
Poiseuille's inlet velocity profile

#1 
Member

Hello colleagues!
I need to set nonuniform boundary inlet velocity profile (e.g. parabolic, Poiseuille's law). Please explain me, how to do it. Best regards, Aleksey. 

December 2, 2009, 20:48 

#2 
Member
Alan Russell
Join Date: Aug 2009
Location: Boise, Idaho USA
Posts: 61
Rep Power: 8 
Aleksey,
If you look at the incompressible/simpleFoam/pitzDailyExptInlet tutorial, that gives you a pretty easy way to set a parabolic profile. You change the points file in /constant/boundaryData/inlet to the points you need for your mesh, then change the U file in the /constant/boundaryData/inlet/0 directory to set a parabolic profile to match your points. The tutorial has a parabolic profile. I have used this method to make a log law profile. There are many other methods described in the forums  this one is quite simple, and it works. Good luck, Alan 

December 3, 2009, 18:52 

#3 
Member

Thanks a lot, Alan!


December 6, 2009, 12:17 

#4 
Member

Now I have a new question.
I try to make my own patch for entering boundary conditions. I've analyzed source code of some patches and I think I can do what I want. BUT! How to make OpenFOAM solvers to use it. I mean, how to compile new patch and insert it to program? Please, help me with problem. Best regards, Aleksey. 

December 7, 2009, 03:34 

#5 
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,904
Rep Power: 27 
Take a look at the GroovyBC created by Bernhard. It is often much more convenient than writing your BC for each case. You can find it here on the wiki:
http://openfoamwiki.net/index.php/Contrib_groovyBC About using your BC, simply build it with wmake libso and then add a line as libs ( "libOpenFOAM.so" "libgroovyBC.so" ) ; to your controlDict, replacing libgroovyBC.so with the library corresponding to your BC. Best,
__________________
Alberto Passalacqua GeekoCFD  A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats. OpenQBMM  An opensource implementation of quadraturebased moment methods. To obtain more accurate answers, please specify the version of OpenFOAM you are using. 

December 9, 2009, 18:25 

#6 
Member

Thank you very much, Alberto!


December 7, 2010, 01:36 
simpleFoam Blows up with Parabolic Inlet Pipe Flow

#7  
Member
Stefano Wahono
Join Date: Aug 2010
Location: Melbourne, Australia
Posts: 42
Rep Power: 7 
Hi Alberto,
I have read lots and lots of your posts and they have helped me greatly with learning how to use OpenFOAM. However, Now I am running into a wall again  (it doesn't hurt that much after the thousandth times). I'm hoping you could help me. I am simulating a pipe with sudden expansion with a parabolic inlet velocity using simpleFoam  see attached. The simulation started with laminar for 2000 iterations (residuals flat off after this)  solution attached. Quote:
The simulation crashed after 2 iterations! Consistently. Error message indicate divide by zero problem for k and epsilon (See below). Please NOTE that if I use NONparabolic inlet (i.e. fixedValue), everything is fine  I got a good converged solution. I used Upwind Div scheme with cellLimited interpolation scheme. I have tried both PCG and GAMG for pressure, and PBiCG and GAMG for Ukepsilon. I have also tried varying URF. I suspect the problem is in my BCs and bad starting solution for k and epsilon (since the flow is now parabolic from the inlet). But, I can't figure out. I've also tried setting parabolic inlet profiles for k and epsilon to no avail. Please help!. My 0/epsilon: Code:
inlet { type turbulentMixingLengthDissipationRateInlet; mixingLength 0.05; value uniform 1e06; //Estimated based on TurbIntensity of 5% at inlet and 0.05m eddy length scale } Code:
inlet { type turbulentIntensityKineticEnergyInlet; intensity 0.05; value uniform 0.0001; //Estimated based on TurbIntensity of 5% at inlet and 0.05m eddy length scale } Thank you very much. I hope I do get any help this time. Please.. It's quite difficult to get help from this forum. Regards, Stefano Code:
Time = 2 DILUPBiCG: Solving for Ux, Initial residual = 0.00855909, Final residual = 7.45812e10, No Iterations 17 DILUPBiCG: Solving for Uy, Initial residual = 0.0467024, Final residual = 6.71306e10, No Iterations 17 DILUPBiCG: Solving for Uz, Initial residual = 0.0490525, Final residual = 5.95911e10, No Iterations 18 GAMG: Solving for p, Initial residual = 0.192423, Final residual = 8.18271e11, No Iterations 40 GAMG: Solving for p, Initial residual = 0.0344647, Final residual = 6.74495e11, No Iterations 35 GAMG: Solving for p, Initial residual = 0.0101951, Final residual = 7.61577e11, No Iterations 32 time step continuity errors : sum local = 8.98665e13, global = 1.02105e14, cumulative = 6.25679e15 [4] #0 Foam::error::printStack(Foam::Ostream&) in "/home/stefano/OpenFOAM/OpenFOAM1.7.0/lib/linux64GccDPOpt/libOpenFOAM.so" [4] #1 Foam::sigFpe::sigFpeHandler(int) in "/home/stefano/OpenFOAM/OpenFOAM1.7.0/lib/linux64GccDPOpt/libOpenFOAM.so" [4] #2 __restore_rt at sigaction.c:0 [4] #3 Foam::divide(Foam::Field<double>&, Foam::UList<double> const&, Foam::UList<double> const&) in "/home/stefano/OpenFOAM/OpenFOAM1.7.0/lib/linux64GccDPOpt/libOpenFOAM.so" [4] #4 void Foam::divide<Foam::fvPatchField, Foam::volMesh>(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) in "/home/stefano/OpenFOAM/OpenFOAM1.7.0/lib/linux64GccDPOpt/libincompressibleRASModels.so" [4] #5 Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam::operator/<Foam::fvPatchField, Foam::volMesh>(Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) in "/home/stefano/OpenFOAM/OpenFOAM1.7.0/lib/linux64GccDPOpt/libincompressibleRASModels.so" [4] #6 Foam::incompressible::RASModels::RNGkEpsilon::correct() in "/home/stefano/OpenFOAM/OpenFOAM1.7.0/lib/linux64GccDPOpt/libincompressibleRASModels.so" [4] #7 main in "/home/stefano/OpenFOAM/OpenFOAM1.7.0/applications/bin/linux64GccDPOpt/simpleFoam" [4] #8 __libc_start_main in "/lib64/libc.so.6" [4] #9 Foam::regIOobject::writeObject(Foam::IOstream::streamFormat, Foam::IOstream::versionNumber, Foam::IOstream::compressionType) const in "/home/stefano/OpenFOAM/OpenFOAM1.7.0/applications/bin/linux64GccDPOpt/simpleFoam" 

December 7, 2010, 02:06 

#8 
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,904
Rep Power: 27 
Try a few things:
__________________
Alberto Passalacqua GeekoCFD  A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats. OpenQBMM  An opensource implementation of quadraturebased moment methods. To obtain more accurate answers, please specify the version of OpenFOAM you are using. 

December 7, 2010, 02:28 

#9 
Member
Stefano Wahono
Join Date: Aug 2010
Location: Melbourne, Australia
Posts: 42
Rep Power: 7 
Hi Alberto,
That is a super quick reply! Thank you I'm trying your suggestions #1 and #3 at the same time. It runs fine (up to 10 iterations now). I'll try running this to convergence, then change the inlet BC to parabolic velocity. Do you think I need to change the k and epsilon BCs to parabolic at the inlet as well? I think this would be wrong since k and epsilon does not vary linearly with velocity. So, I think the problem was in the large difference between the k and epsilon initial guesses and the parabolic velocity inlet? Thanks again. I'll let you know how it goes. Kind Regards, Stefano 

December 7, 2010, 02:33 

#10 
Member
Stefano Wahono
Join Date: Aug 2010
Location: Melbourne, Australia
Posts: 42
Rep Power: 7 
Just wondering now, how do I change the inlet BC during runtime or after nth iterations?


December 7, 2010, 02:35 

#11  
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,904
Rep Power: 27 
Quote:
Best,
__________________
Alberto Passalacqua GeekoCFD  A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats. OpenQBMM  An opensource implementation of quadraturebased moment methods. To obtain more accurate answers, please specify the version of OpenFOAM you are using. 

December 7, 2010, 02:37 

#12 
Member
Stefano Wahono
Join Date: Aug 2010
Location: Melbourne, Australia
Posts: 42
Rep Power: 7 
Hi Alberto,
I apologise to swamp your email address. I have misread your post. I have tried starting the calculation from uniform field before. The behaviour was exactly the same (crashed on the 2nd iteration). What I'm trying now is running with tophat inlet velocity, and change BC after nth iterations. So, I guess back to square one Sorry. Any idea? Thank you. Kind Regards, Stefano 

December 7, 2010, 02:41 

#13  
Member
Stefano Wahono
Join Date: Aug 2010
Location: Melbourne, Australia
Posts: 42
Rep Power: 7 
Quote:
I have done lots of simulations with flat profile on this geometry, and I thought of comparing the results if the inlet pipe flow is "fully developed". What do you mean by "turbulent profile"? Thank you. Kind Regards, Stefano 

December 7, 2010, 03:04 

#14  
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,904
Rep Power: 27 
Quote:
Btw, you said Re = 750. Strictly speaking, you are in the transition region (not fully developed), and you should use a lowRe model (I am sorry, I just noticed your Re) like LaunderSharmaKE. You will need a good resolution of the boundary layer.
__________________
Alberto Passalacqua GeekoCFD  A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats. OpenQBMM  An opensource implementation of quadraturebased moment methods. To obtain more accurate answers, please specify the version of OpenFOAM you are using. Last edited by alberto; December 7, 2010 at 03:04. Reason: Typo 

December 7, 2010, 22:10 

#15  
Member
Stefano Wahono
Join Date: Aug 2010
Location: Melbourne, Australia
Posts: 42
Rep Power: 7 
Hi Alberto,
Quote:
I used the U/Uc = pow((1r/rc),1/7) velocity profile at inlet (set using groovyBC). Then I used 'applyBoundaryLayer' tool to calculate the initial guess of epsilon distribution near wall, with yBL = rc (pipe radius). In fullydeveloped turbulent pipe flow, the BL thickness is equal to the pipe radius. >> applyBoundaryLayer ybl 0.665 writenut The run (epsilon) blew up after 3 iterations  division by zero problem (I think). Strangely, the k and epsilon residuals in the last iteration before blew up were 1e06 and 0.7 respectively. Quote:
I am really not sure what is causing the numerical error at this stage, any idea? Has anyone encountered this problem when simulating pipe flow with a 'fullydeveloped' inlet BC? Surely someone has done this before  at least for constant crosssection pipe. Kind Regards, Stefano 

December 8, 2010, 11:48 

#16  
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,904
Rep Power: 27 
Quote:
Quote:
Best,
__________________
Alberto Passalacqua GeekoCFD  A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats. OpenQBMM  An opensource implementation of quadraturebased moment methods. To obtain more accurate answers, please specify the version of OpenFOAM you are using. 

December 8, 2010, 20:53 

#17 
Member
Stefano Wahono
Join Date: Aug 2010
Location: Melbourne, Australia
Posts: 42
Rep Power: 7 
Hi Alberto,
I have emailed you the case to your gmail email address. The case was too large to attach in this forum (3MB) since max allowed attachment is 97KB. The mesh size has been reduced significantly  it's a coarse mesh with only 100000 cells. Thank you so much for your kind help. Kind Regards, Stefano 

December 9, 2010, 02:39 

#18 
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,904
Rep Power: 27 
Hi,
after how many iterations should it crash? :) It looks like it is happily converging on my workstation. I modified the linear solver settings slightly, but I don't think that's the reason... Hints:
Best,
__________________
Alberto Passalacqua GeekoCFD  A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats. OpenQBMM  An opensource implementation of quadraturebased moment methods. To obtain more accurate answers, please specify the version of OpenFOAM you are using. Last edited by alberto; December 9, 2010 at 03:02. Reason: Added hints 

December 9, 2010, 19:14 

#19  
Member
Stefano Wahono
Join Date: Aug 2010
Location: Melbourne, Australia
Posts: 42
Rep Power: 7 
Quote:
I tried running your modified case as it is, and the exact same bizarre behavior happened.. It crashed on the second iterations on my machine (I was running it serial)  See below log printout. And I have tested running it on 2 different workstations (one running Ubuntu, the other running Fedora). No difference in outcome. I'm using OpenFOAM 1.7.0. This is most extraordinary. What version of OpenFOAM are you using? Do you have any idea of what may be the problem? I'm really lost .. even on how to debug it now. Seems the problem is on the OpenFOAM setup on my workstation. Could you suggest anything? I really appreciate your help and suggestions. Kind Regards, Stefano Code:
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 RAS turbulence model realizableKE realizableKECoeffs { Cmu 0.09; A0 4; C2 1.9; sigmak 1; sigmaEps 1.2; } Starting time loop Time = 1 smoothSolver: Solving for Ux, Initial residual = 1, Final residual = 3.59393e08, No Iterations 24 smoothSolver: Solving for Uy, Initial residual = 1, Final residual = 3.23144e08, No Iterations 20 smoothSolver: Solving for Uz, Initial residual = 1, Final residual = 8.44441e08, No Iterations 18 GAMG: Solving for p, Initial residual = 1, Final residual = 9.59021e09, No Iterations 93 GAMG: Solving for p, Initial residual = 0.490638, Final residual = 8.86246e09, No Iterations 57 GAMG: Solving for p, Initial residual = 0.0631056, Final residual = 9.40724e09, No Iterations 53 time step continuity errors : sum local = 1.00658e09, global = 5.77004e11, cumulative = 5.77004e11 smoothSolver: Solving for epsilon, Initial residual = 0.569468, Final residual = 1.03889e08, No Iterations 10 smoothSolver: Solving for k, Initial residual = 1, Final residual = 5.21329e09, No Iterations 12 bounding k, min: 0 max: 0.0851712 average: 0.000115257 ExecutionTime = 13.64 s ClockTime = 14 s Time = 2 smoothSolver: Solving for Ux, Initial residual = 0.546612, Final residual = 4.7862e08, No Iterations 24 smoothSolver: Solving for Uy, Initial residual = 0.409151, Final residual = 3.74731e08, No Iterations 22 smoothSolver: Solving for Uz, Initial residual = 0.410256, Final residual = 2.61424e08, No Iterations 22 GAMG: Solving for p, Initial residual = 0.173568, Final residual = 7.41398e09, No Iterations 37 GAMG: Solving for p, Initial residual = 0.0556567, Final residual = 8.85002e09, No Iterations 25 GAMG: Solving for p, Initial residual = 0.0104717, Final residual = 9.56729e09, No Iterations 24 time step continuity errors : sum local = 2.40749e09, global = 3.52641e11, cumulative = 2.24363e11 #0 Foam::error::printStack(Foam::Ostream&) in "/home/stefano/OpenFOAM/OpenFOAM1.7.0/lib/linuxGccDPOpt/libOpenFOAM.so" #1 Foam::sigFpe::sigFpeHandler(int) in "/home/stefano/OpenFOAM/OpenFOAM1.7.0/lib/linuxGccDPOpt/libOpenFOAM.so" #2 Uninterpreted: #3 Foam::divide(Foam::Field<double>&, Foam::UList<double> const&, Foam::UList<double> const&) in "/home/stefano/OpenFOAM/OpenFOAM1.7.0/lib/linuxGccDPOpt/libOpenFOAM.so" #4 void Foam::divide<Foam::fvPatchField, Foam::volMesh>(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) in "/home/stefano/OpenFOAM/OpenFOAM1.7.0/lib/linuxGccDPOpt/libincompressibleRASModels.so" #5 Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam::operator/<Foam::fvPatchField, Foam::volMesh>(Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > const&, Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > const&) in "/home/stefano/OpenFOAM/OpenFOAM1.7.0/lib/linuxGccDPOpt/libincompressibleRASModels.so" #6 Foam::incompressible::RASModels::realizableKE::correct() in "/home/stefano/OpenFOAM/OpenFOAM1.7.0/lib/linuxGccDPOpt/libincompressibleRASModels.so" #7 in "/home/stefano/OpenFOAM/OpenFOAM1.7.0/applications/bin/linuxGccDPOpt/simpleFoam" #8 __libc_start_main in "/lib/tls/i686/cmov/libc.so.6" #9 in "/home/stefano/OpenFOAM/OpenFOAM1.7.0/applications/bin/linuxGccDPOpt/simpleFoam" Floating point exception 

December 10, 2010, 03:09 

#20 
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,904
Rep Power: 27 
Hi Stefano,
I use OpenFOAM 1.7.x, running it in serial mode. I would suggest you to
Best,
__________________
Alberto Passalacqua GeekoCFD  A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats. OpenQBMM  An opensource implementation of quadraturebased moment methods. To obtain more accurate answers, please specify the version of OpenFOAM you are using. 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Neumann pressure BC and velocity field  Antech  Main CFD Forum  0  April 25, 2006 02:15 
How to create Hemisphere Velocity Profile at inlet  Nelson  FLUENT  0  July 10, 2005 21:44 
using profile to specify inlet VOF and velocity  yf  FLUENT  8  June 2, 2005 05:40 
Inlet velocity profile  strudl  CFX  0  July 18, 2003 09:58 
velocity more than INLET velocity  neu  FLUENT  3  May 13, 2003 04:56 