CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

Laminar Pipe Flow convergence issues

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   February 18, 2010, 02:44
Default Laminar Pipe Flow convergence issues
  #1
Member
 
Paul Reichl
Join Date: Feb 2010
Location: Melbourne, Victoria, Australia
Posts: 33
Rep Power: 7
preichl is on a distinguished road
Hi All,

I am new to OpenFoam and I am having a few issues getting a converged solution for laminar flow through a circular pipe (simplest problem I could think of to start with). I am using simpleFoam with (simulationType set to laminar in constant/turbulenceProperties and transportModel set to Newtonian in constant/transportProperties). My Reynolds number is about 20.

Essentially everything runs without a problem except that the Initial residual for the two non axial components of the velocity do not converge. The axial component and the pressure converge nicely (and all of the final residual values look good along the way) but the initial residual of the two non axial components bounce around and don't settle down.

I have tried altering the relaxation parameters but with little success. I have set the pressures at the ends of the pipe and have zeroGradient BCs for U. Mesh is a Hex mesh from gambit.

When I look at the results in paraFoam it indicates that the axial velocity is approx 1.8 m/s while the non axial components (U_x and U_y) are of the order of 1.0e-6 in a couple of regions (so the axial components are very small).

Does anyone have an idea as to what i need to to get the Initial Residual of the non axial components to converge?.

For what it is worth this problem does not seem to show up if I look at flows that have non negligible non axial components).

My contents of fvSolution file and my 0/p and 0/U files are listed below.

Thanks in advance and Kind Regards,

Paul.

solvers
{
p
{
solver GAMG;
tolerance 1e-08;
relTol 0;
smoother GaussSeidel;
nPreSweeps 0;
nPostSweeps 2;
cacheAgglomeration true;
nCellsInCoarsestLevel 20;
agglomerator faceAreaPair;
mergeLevels 1;
}

U
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-08;
relTol 0;
}

nuTilda
{
solver smoothSolver;
smoother GaussSeidel;
nSweeps 2;
tolerance 1e-08;
relTol 0.1;
}
}

SIMPLE
{
nNonOrthogonalCorrectors 0;
pRefCell 0;
pRefValue 0;
}

relaxationFactors
{
default 0;
p 0.3;
U 0.7;
nuTilda 1.0;
}

0/p File

dimensions [0 2 -2 0 0 0 0];

internalField uniform 0;

boundaryField
{
wall
{
type zeroGradient;
}

inlet
{
type fixedValue;
value uniform 24;
}

outlet
{
type fixedValue;
value uniform 0;
}

}

0/U file

dimensions [0 1 -1 0 0 0 0];

internalField uniform (0 0 0);

boundaryField
{
wall
{
type fixedValue;
value uniform (0 0 0);
}

inlet
{
type zeroGradient;

}

outlet
{
type zeroGradient;
}
}
preichl is offline   Reply With Quote

Old   February 18, 2010, 11:51
Default
  #2
Senior Member
 
santos's Avatar
 
Jose Luis Santos
Join Date: Mar 2009
Location: Portugal
Posts: 213
Rep Power: 9
santos is on a distinguished road
Send a message via Skype™ to santos
Hi,

I think your problem lies in your BCs . At the inlet I would define U as fixedValue (with velocity value for Re=20) and p as zeroGradient. At the outlet, U as zeroGradient and p = 0.

Regards,
Jose Santos
santos is offline   Reply With Quote

Old   February 18, 2010, 19:29
Default
  #3
Member
 
Paul Reichl
Join Date: Feb 2010
Location: Melbourne, Victoria, Australia
Posts: 33
Rep Power: 7
preichl is on a distinguished road
Hi Jose,

Thanks for your reply. This boundary condition works. However, in this case the flow develops with distance (i.e. it has a development length), whereas I would like to model fully developed laminar pipe flow.
Do you have any idea why fixing the pressures at both ends and setting zero gradients on the velocities should not work (converge)?.
It is my understanding that this should be equivalent to having a pressure inlet at one end and a pressure outlet at the other.

I have tried setting the inlet and the outlet to be pressureInletVelocity (see below) but I am not sure what I need to set the value to, so I just used uniform (0 0 0). It also seems to have issues converging the non axial components of the velocity (over thousands and thousands of iterations they seem to decrease very slowly with this approach rather than bouncing around, so it is not really ideal either).

Kind Regards,

Paul.


inlet
{
type pressureInletVelocity;
value uniform (0 0 0);

}

outlet
{
type pressureInletVelocity;
value uniform (0 0 0);
}
preichl is offline   Reply With Quote

Old   February 19, 2010, 05:32
Default
  #4
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,609
Rep Power: 25
ngj will become famous soon enoughngj will become famous soon enough
Hi Paul

An approach similar to Josť's is to use the directMapped boundary condition, which maps some interior plane onto the inlet. In this manner you will avoid having a developing velocity profile even though you specify uniform conditions at time = 0.

You can get a feel of how to use directMapped by looking into

~/OpenFOAM/OpenFOAM-1.5.x/tutorials/oodles/pitzDailyDirectMapped

(still working in 1.5 so the location of the tutorial has changed, however does not have access to 1.6.x at the moment).

Especially look carefully in the Allrun file and notice/understand the use of changeDictionary in case-folder/system.

Good luck and welcome

Niels
ngj is offline   Reply With Quote

Old   February 19, 2010, 05:41
Default
  #5
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 14
l_r_mcglashan will become famous soon enough
You could do something like in channelFoam, where you set the inlet/outlet as cyclics and give an average velocity to the solver. I've used this for laminar and turbulent flows in the past.
__________________
Laurence R. McGlashan :: Website
l_r_mcglashan is offline   Reply With Quote

Old   February 19, 2010, 06:42
Default
  #6
Senior Member
 
santos's Avatar
 
Jose Luis Santos
Join Date: Mar 2009
Location: Portugal
Posts: 213
Rep Power: 9
santos is on a distinguished road
Send a message via Skype™ to santos
Hi all,

I have also used both approaches suggested by Niels and Laurence for periodic channels, and they work quite well.

Let us know how it goes!

Regards,
Jose
santos is offline   Reply With Quote

Old   February 19, 2010, 16:56
Default
  #7
Member
 
Sylvain Martel
Join Date: Apr 2009
Location: University of Sherbrooke/Quebec/Canada
Posts: 51
Rep Power: 8
smart is on a distinguished road
Hi all.

As Paul, I am using simpleFoam to obtain an incompressible steady state flow of water in a converging-diverging nozzle without turbulence and wall friction (slip condition). I know the analytical solution by the Bernoulli equation.

Initially, I was using the following boundary condition:

Pin = fixedValue, Pout = fixedValue, Uin = pressureInletOutletVelocity, Uout = pressureInletOutletVelocity

With these BC, I was unable to reach the analytical solution since the inlet velocity obtained was lower by 5-10% of the analytical one even with small grid size. The problem is that with large grid size, the convergence (number of iteration to have a constant value) is fast but not accurate and with small grid size, the convergence is very long (1000000 iterations) and inlet velocity results are 6% lower than the analytical one. I did the same with rhoSimpleFoam with water vapor and the same kind of result differences occured.

After that, I tried the following BC:
Pin = zeroGradient, Pout = fixedValue, Uin = fixedValue, Uout, zeroGradient

The solution converge in about 400 iterations and for a small grid size about 600 iterations with good results compared to the analytical one with simpleFoam and rhoSimpleFoam.

But I want to simulate two-phase flow with inlet total pressure and outlet static pressure known and calculated other flow properties so I need the inlet and outlet pressure boundary condition to be set to :
Pin = fixedValue, Pout = fixedValue.

What is the problem with these BC and is it the same with the twoPhaseEulerFoam solver?

Thank you very much to help me with this understanding problem.

Sylvain
University of Sherbrooke, Canada
smart is offline   Reply With Quote

Old   February 19, 2010, 18:38
Default
  #8
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,609
Rep Power: 25
ngj will become famous soon enoughngj will become famous soon enough
Hi Sylvain and Paul

As Laurance pointed out the method of applying a body force in a cyclic domain is also quite helpful in many situations where the method suggested by me does not work, e.g. period domain with converging-diverging flows which could for instance be river dunes.

The method, however, has a considerable drawback as is also the case in the setup by Sylvain, if certain measures are not taking. The drawback is a huge number of iterations, as the flow approaches the solutions in an asymptotic manner. What we have been doing in our group with respect to river dunes on cyclic domains, is to define some target value, e.g. the mass flux, and then adjust the magnitude of the body force as a function of the error in and the rate of change of this target function. This forces the solution onto the system, and the convergence is considerably faster. How this could be adjusted in Sylvain's is not clear to me, however I hope this has given you some inspiration to solve the problem at hand.

A nice weekend to all of you

Niels
ngj is offline   Reply With Quote

Old   February 25, 2010, 02:22
Default
  #9
Member
 
Paul Reichl
Join Date: Feb 2010
Location: Melbourne, Victoria, Australia
Posts: 33
Rep Power: 7
preichl is on a distinguished road
First of all, thank you everyone for your comments.
My main interest in this problem is as a test case to determine how well OpenFoam predicts the flow rate through a pipe for a prescribed pressure drop. While mapping and using cyclic BCs should work well for this case, I am not sure if they will be suitable for some of the other cases that I wish to look at.
As things currently stand, I am using pressureInletVelocity BCs on both the inlet and outlet and I judge convergence based on the change in the mass flow rate through the system (i.e. using calcMassFlow). If the rate of change with the number of iterations drops below a certain threshold then I will deem the solution converged.
For what it is worth, for pipe flow at Re=200, I get reasonable agreement with the analytic solution (within 1% when I correct for the area discretization (2% if I don't correct)) after about 5000 iterations.
I have run the same problem in CFX (with the same mesh and CFX default solver settings) and while I get convergence (i.e. RMS residuals for all fields drop below 1.0e-5 after 1088 iterations) the CFX result is out by about 11% (again correcting for the area discretization (12% if I don't correct)).

If I compare the codes after the same number of iterations (i.e. 1088) the OpenFoam solution is out by 14.5%. However, I should stress that OpenFoam did the 1088 iterations roughly 6.3 times faster than CFX did them. in fact OpenFoam did the 5000 iterations faster than CFX did the 1088 iterations, so OpenFoam is the winner on speed and accuracy, well, at least for this problem.
I suspect that the speed and accuracy results are not directly transferable to other problems but it is what I observed here, so it may prove helpful to anyone else who comes across similar issues or reads this post at a later date.

Anyway, thanks again for your helpful suggestions.

Kind Regards,

Paul
preichl is offline   Reply With Quote

Old   February 25, 2010, 03:16
Default
  #10
Member
 
matej forman
Join Date: Mar 2009
Location: Brno, Czech Republic
Posts: 91
Rep Power: 8
matejfor is on a distinguished road
HI,
just a short comment.
When comparing the speed, you should not forget the differences in CFX and OF. While CFX is using coupled solver, in OF you are using segregated to name the biggest difference. This would make a difference, of course. According to my experiences, coupled solver of CFX was a great help in more complicated flows with varying density (like combustion).

Another important think, which you said and need to be stressed. The speed and accuracy conclusions works for this type of flow. It doest not say about other types of flow.

(I'm not advocating for CFX, I'm happy OF user )
matej
matejfor is offline   Reply With Quote

Old   February 25, 2010, 06:01
Default
  #11
Member
 
Paul Reichl
Join Date: Feb 2010
Location: Melbourne, Victoria, Australia
Posts: 33
Rep Power: 7
preichl is on a distinguished road
Hi matej,

Yes I am aware that CFX uses a coupled solver while OpenFoam uses a segregated solver. That was why I was quite surprised that CFX did not do much better than it did. As I mentioned I doubt this comparison can be translated to other problems (where for example coupling should show significant benefits) but the results for this problem are fairly clear.

Cheers,

Paul.
preichl is offline   Reply With Quote

Old   September 22, 2014, 21:22
Default
  #12
New Member
 
nakku
Join Date: Jun 2014
Posts: 11
Rep Power: 3
dahicocuk is on a distinguished road
Quote:
Originally Posted by smart View Post
Hi all.

As Paul, I am using simpleFoam to obtain an incompressible steady state flow of water in a converging-diverging nozzle without turbulence and wall friction (slip condition). I know the analytical solution by the Bernoulli equation.

Initially, I was using the following boundary condition:

Pin = fixedValue, Pout = fixedValue, Uin = pressureInletOutletVelocity, Uout = pressureInletOutletVelocity

With these BC, I was unable to reach the analytical solution since the inlet velocity obtained was lower by 5-10% of the analytical one even with small grid size. The problem is that with large grid size, the convergence (number of iteration to have a constant value) is fast but not accurate and with small grid size, the convergence is very long (1000000 iterations) and inlet velocity results are 6% lower than the analytical one. I did the same with rhoSimpleFoam with water vapor and the same kind of result differences occured.

After that, I tried the following BC:
Pin = zeroGradient, Pout = fixedValue, Uin = fixedValue, Uout, zeroGradient

The solution converge in about 400 iterations and for a small grid size about 600 iterations with good results compared to the analytical one with simpleFoam and rhoSimpleFoam.

But I want to simulate two-phase flow with inlet total pressure and outlet static pressure known and calculated other flow properties so I need the inlet and outlet pressure boundary condition to be set to :
Pin = fixedValue, Pout = fixedValue.

What is the problem with these BC and is it the same with the twoPhaseEulerFoam solver?

Thank you very much to help me with this understanding problem.

Sylvain
University of Sherbrooke, Canada
Hi Martel,

I am using water for laminar pipe flow simulation to verify accuracy of the Openfoam codes. Pipe dimensions are D=4 mm, L=2 m and Re=1620. I have implemented the boundary condition that you used but, it has not been converging. Do you know what might be potential reason for this? In addition, Could you please let me know how I can calculate heat transfer coefficient and Nusselt number along the axial variation of the pipe using OpenFOAM?

Thank you.
dahicocuk is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Laminar , steady state pipe flow andesameer OpenFOAM 31 March 3, 2015 03:42
Laminar pipe flow John FLUENT 6 December 5, 2014 06:00
About Turbulence Intensity (Pipe flow assimilated) gRomK13 Main CFD Forum 1 July 10, 2009 03:11
Turbulence in a pipe flow JM Main CFD Forum 4 December 21, 2006 05:04
Axisymetric laminar pipe flow? Any body has idea SAM FLUENT 1 November 8, 2004 09:36


All times are GMT -4. The time now is 13:23.