Poiseuille's inlet velocity profile
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. 
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 
Thanks a lot, Alan!

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. 
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, 
Thank you very much, Alberto!

simpleFoam Blows up with Parabolic Inlet Pipe Flow
2 Attachment(s)
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 Code:
inlet 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 
Try a few things:

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 
Just wondering now, how do I change the inlet BC during runtime or after nth iterations?

Quote:
Best, 
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 
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 
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. 
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?:(:confused: 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 
Quote:
Quote:
Best, 
Quote:
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 
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, 
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 
Hi Stefano,
I use OpenFOAM 1.7.x, running it in serial mode. I would suggest you to
Best, 
All times are GMT 4. The time now is 10:55. 