
[Sponsors] 
March 3, 2011, 19:15 
InterFoam viscosity problem / possible bug

#1 
New Member
Paul Bryant
Join Date: Feb 2011
Posts: 13
Rep Power: 8 
The InterFoam solver seems to be giving the wrong answer when the viscosity is large. To demonstrate this I generated a test case called waterDrop which I uploaded as a zip file. It is essentially identical to the damBreak tutorial except that the liquid is now in a rectangular blob suspended above the ground by about 0.218 meters. At t=0 it is dropped and falls down. The expected fall time can be obtained from the usual physics formula: t = sqrt(2*h/g), which in this case is about 0.21 seconds. It works as expected for low viscosity, but surprisingly the fall time is found to increase when the viscosity is increased to a large value. As uploaded, the viscosity of the "water" has been increased from 1e6 to 1e0 and the fall time has increased to about 0.78 seconds. When further increased to 1e2 the water actually floats upwards and disappears out the atmosphere patch! (The viscosity nu for phase1 is set in the file constant/transportProperties. To run and generate log file, enter the commands: blockMesh, checkMesh, setFields, interFoam  tee log1) I have tried adjusting most of the parameters in the fvSolution file with little success. Setting momentumPredictor to yes helps somewhat as does increasing nCorrectors but drastically increases the run time and doesn't completely fix the problem. Decreasing Courant number in the controlDict file also has some beneficial effect. I'm hoping that someone will know how to solve this problem, or else can confirm my suspicion that this is a symptom of some kind of bug in the software.
Thanks  Paul 

March 4, 2011, 03:34 

#2 
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,910
Rep Power: 28 
Hi, I can reproduce this on OpenFOAM 1.7.x too. Did you report it as a bug?
__________________
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; March 4, 2011 at 03:43. Reason: Misread the post: corrected conclusions. 

March 7, 2011, 05:48 

#3 
Senior Member
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,226
Rep Power: 23 
Link to the (closed) bug report: http://openfoam.com/mantisbt/view.php?id=156


March 7, 2011, 11:26 

#4 
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,910
Rep Power: 28 
Indeed, increasing the viscosity ratio so much makes the whole idea of VOF, based on a mixture approach, questionable...
From a numerical point of view, implementing the PIMPLE procedure to allow underrelaxation is straightforward, and I am not so sure I agree it is much more expensive than performing hundreds PISO correctors. In multiphase codes you often end up needing an unsteady SIMPLE or a PIMPLE procedure to couple the different equations. 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. 

March 7, 2011, 14:22 

#5 
New Member
Join Date: Jul 2009
Posts: 3
Rep Power: 9 
The key point of course is the large viscosity ratio is generating the problem. This can be countered by simultaneously increasing the viscosity of the light phase. Depending upon the nature of the problem, this may not introduce terribly significant errors.


March 7, 2011, 15:20 

#6 
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,910
Rep Power: 28 
Yes, but with such high viscosity ratio, it would be better to adopt models where each phase has its own equations instead of relying on a mixture approach which is valid when the phase properties are similar.
__________________
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. 

March 8, 2011, 05:03 

#7 
New Member
Paul Bryant
Join Date: Feb 2011
Posts: 13
Rep Power: 8 
A couple of comments:
The severity of the problem seems to be tied to the value of the "water" viscosity, rather than the viscosity ratio. I ran a variety of cases which indicate this. For example, with the "water" viscosity set to 0.1, there is a moderate effect where the fall time is increased to 0.33 seconds from the expected value of about 0.20. Keeping 0.1 for the "water" and increasing the viscosity of the "air" by a factor of 100 from 1.48e5 to 1.48e3 there is only a barely perceptible change in the fall time, increasing to about 0.335. The viscosity of the "air" can also be decreased all the way to zero with negligible effect. When increasing the density of the "air" from 1 to 10 the effect is also quite small. I am also interested using nonNewtonian viscosity such as the HerschelBulkley model. When the shear rate decreases, such a fluid can transition from moderate viscosity to nearly infinite viscosity. It would be very desirable for the simulation to perform reliably in both regimes. Incidentally, I recently reported a bug in that model http://openfoam.com/mantisbt/view.php?id=153. Paul 

March 11, 2011, 21:54 
Effective "g" value is scaled down

#8 
New Member
Paul Bryant
Join Date: Feb 2011
Posts: 13
Rep Power: 8 
For moderately high viscosity (up to nu=1.0 at least) the block of "water" does not behave erratically, but rather it moves in the downwards direction as expected from gravity. The only problem is that it accelerates more slowly as though the value of "g" was scaled down by some factor that depends on the water's viscosity. This remains approximately true even when "g" is drastically increased. For example, in the nu=1.0 case, if g is increased by a factor of 100 from 9.81 to 981, the fall time of the block is reduced by roughly a factor of 10 from 0.78 to about 0.07 sec, which is as expected since the fall time should be proportional to the inverse square root of g. The effective value of g based on the fall time t is roughly 0.073 times the actual value of g: [geff/g = 2*h/(g*t^2)]. There also appears to be some size dependence to the effect. If the block dimensions are reduced by a factor of 2, the fall time increases from 0.76 to 0.99 sec.
The consistent nature of the error in these cases suggest that there is something about the algorithm or the way it is implemented that is resulting in the reduced effectiveness of gravity in the problem. If anyone has any comments or suggestions of how to possibly fix the problem without increasing the run time by orders of magnitude I would greatly appreciate it. Thanks, Paul 

March 13, 2011, 03:55 

#9 
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,910
Rep Power: 28 
Hi Paul,
I believe the problem is of numerical origin. Did you check the evolution of the residuals and the convergence of your solution? Alberto
__________________
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. 

March 13, 2011, 13:22 

#10 
New Member
Paul Bryant
Join Date: Feb 2011
Posts: 13
Rep Power: 8 
Reducing all tolerances in fvSolution by 10x has almost no effect. Here is a typical section of output from the log file:
__________________________________________________ ___ Courant Number mean: 0.0359508 max: 0.397045 Interface Courant Number mean: 0.00321944 max: 0.246874 deltaT = 0.00111111 Time = 0.0411111 MULES: Solving for alpha1 Liquid phase volume fraction = 0.01716 Min(alpha1) = 8.72931e40 Max(alpha1) = 0.999951 MULES: Solving for alpha1 Liquid phase volume fraction = 0.01716 Min(alpha1) = 4.82315e40 Max(alpha1) = 0.999951 DICPCG: Solving for p_rgh, Initial residual = 0.00259989, Final residual = 1.1547e05, No Iterations 22 time step continuity errors : sum local = 2.37286e05, global = 6.0088e08, cumulative = 1.85707e05 DICPCG: Solving for p_rgh, Initial residual = 6.39632e05, Final residual = 2.712e07, No Iterations 36 time step continuity errors : sum local = 5.47611e07, global = 6.02456e08, cumulative = 1.86309e05 DICPCG: Solving for p_rgh, Initial residual = 2.33225e05, Final residual = 7.87965e09, No Iterations 63 time step continuity errors : sum local = 1.59131e08, global = 1.33036e10, cumulative = 1.86308e05 ExecutionTime = 4.05 s ClockTime = 5 s __________________________________________________ _____ Forcing a greatly smaller time step by say 10x or 100x does lead to improvement, but this is undesirable since it results in an increase in run time by a similar factor. Again, it seems very strange that the motion of the block of water seems as though it is responding to a gravitational force of greatly reduced magnitude. It seems to accelerate normally, with no sign of reaching a terminal velocity as it would if the sluggish response was a result of the air viscosity. Paul 

March 13, 2011, 20:25 

#11  
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,910
Rep Power: 28 
Quote:
The fact that improvements appear reducing the time step seem to confirm what Henry wrote in the bugzilla. You might need an unsteady SIMPLE/PIMPLE algorithm with underrelaxation of the solution. This would allow larger time steps, since you will perform outer correctors. Best, Alberto
__________________
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. 

March 16, 2011, 20:40 
momentumPredictor eliminates gravity problem

#12 
New Member
Paul Bryant
Join Date: Feb 2011
Posts: 13
Rep Power: 8 
The "momentum predictor" step is normally turned off in interFoam. I'm not sure of the reasoning behind this, but I have found that turning it on leads to a very dramatic improvement in the dynamics for high viscosity cases (much more than I had originally thought). If we consider a 10% error in the fall rate of the block of water to be the acceptable limit, then turning on the momentum predictor increases the maximum usable viscosity for the water from about 0.02 to at least 4.0, i.e. at least a factor of 200 times! I say "at least" because above 4.0 other instabilities take over that cause the block of water to move about erratically, which is quite different from the "reduced gravity" effect that is observed below this level.
I checked again on the suggested possibility of a "viscosity ratio" problem. For nu=4.0 the viscosity of the air can be reduced to zero with no significant effect on the motion of the block of water. For nu=10.0, where the behavior is erratic, increasing the viscosity of the air by a factor of 100 does change the behavior somewhat, but it remains very erratic, i.e. reducing the viscosity ratio by 100x has no beneficial effect. For low viscosity, the momentum predictor seems to effect the run time by only about 10%. So it might be appropriate to have it on by default and set to "yes" in the file fvSolution for examples such as damBreak. It might also be useful to include some discussion of this in the user manual when discussing the damBreak tutorial. Any comments or suggestions will be greatly appreciated, Thanks, Paul 

March 17, 2011, 14:29 

#13  
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,910
Rep Power: 28 
Quote:
Yes, solving the momentum predictor is expected to play an important role when viscous stresses are important or dominant. What kind of instability? Altered interface (high velocities there?), or complete crash?
__________________
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. 

March 18, 2011, 12:56 

#14 
New Member
Paul Bryant
Join Date: Feb 2011
Posts: 13
Rep Power: 8 
Alberto,
The block of water has a tendency in these very high viscosity cases (nu>4) to rotate while moving, sometimes going sideways or even upwards and not necessarily in a straight line. Sometimes it will collide with one of the sides or go out the atmosphere patch, usually within about 0.4 seconds or so. It usually remains intact and block shaped but may show some deformations in the surface. You mentioned that it is known that the momentum predictor is important when the viscosity is high (or low Re)  do you know of a reference that discusses this? (I am curious to see what other people have said about it) Thanks, Paul 

March 19, 2011, 04:12 

#15  
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,910
Rep Power: 28 
Quote:
Quote:
If you increase the viscosity as much as you do, you are basically solving for a blob that tends to behave like a solid in one block of cells, and something fluid on the other side of the interface. This corresponds to a sharp viscosity gradient, which will destabilise your solution. Did you try to put a limiter on the gradients of the viscous term and use a completely limited scheme? This is very common in commercial codes. 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; March 19, 2011 at 04:32. 

June 3, 2011, 04:31 
Highviscosity problem with interFoam

#16 
New Member
Florian Gruber
Join Date: Mar 2009
Location: Stuttgart, Germany
Posts: 6
Rep Power: 10 
Hi,
As I seem to face a similar problem like Paul, I would like to contribute to this thread. I'm currently using a modified version of compressibleInterFoam to model timedependent physical foam expansion (mostly polystyrene and silicone oil with carbon dioxide as blowing gas). The viscosity of the foam phase can reach values well above 10 Pas. Now, as Paul already stated, the problem seems to be mostly tied to the maximum viscosity value and not the gradient at the interface. I ran several simple simulations with a vertical rectangular channel containing a certain amount of polymer that is sitting at the bottom. No density change whatsoever was imposed, so one would expect the interface to remain immobile. However, this is only true for low viscosity values. For values above 1 Pas however, the polymer immediately starts to move and shift upwards in the center due to high velocities at the interface. Raising the air viscosity to values similar to the polymer has very little effect, so the viscosity gradient does not seem to be the only problem. The case runs perfectly with calm interface if gravity is set to a very low value (eg 0.01 m^2/s), so I would assume that the core of the problem seems to be some kind of (numerical?) interference of the gravitational and viscous forces for high viscosity values. I would be very grateful If anyone could shed some more light on this issue, as for now my only solution to this problem is to drastically reduce gravity in my calculations, which of course is not always appropriate. Florian 

June 3, 2011, 04:59 

#17  
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,910
Rep Power: 28 
Quote:
I tried to reproduce your problem without success. I took the depthCharge2D case, removed the sphere from setFields, so to fill the bottom of the container with phase1, and I set nu = 0.01 (10 Pa s / (1000 kg/m^3)), since the density of phase 1 is 1000 kg/m^3. Gravity is the correct value along y. I ran the case, and the field of alpha1 seems fine (picture attached). Maybe you could attach a small test case reproducing the problem. 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. 

June 3, 2011, 08:37 

#18 
New Member
Florian Gruber
Join Date: Mar 2009
Location: Stuttgart, Germany
Posts: 6
Rep Power: 10 
Hi Alberto,
thanks for your fast reply. You are right, it seems to work with the official release of compressibleInterFoam. The solver I'm currently using was initially developed by a former colleague of me and is based on an early version of compressibleInterFoam. One thing that just caught my eye is that the solver expects dynamic viscosity values from transportproperties.dict, and uses an altered twoPhaseMixtureclass to calculate muf in Ueqn.h as follows: "muf", alpha1f*fvc::interpolate(muModel1_>mu()) + (scalar(1)  alpha1f)*fvc::interpolate(muModel2_>mu()) "muf" is called in Ueqn.h right before the velocity equation. Other than that, I think twoPhaseMixture is only used to update the viscosity for each time step (.correct). Maybe this is the root of my interface instability, although I don't see yet where problems could arise by specifying mu instead of nu. To be sure, I will try and change parts of the code to be consistent with the official compressibleInterFoam and see if my problems persist. Hopefully I can provide some more information in the future. Florian 

June 7, 2011, 04:04 
Problem solved

#19 
New Member
Florian Gruber
Join Date: Mar 2009
Location: Stuttgart, Germany
Posts: 6
Rep Power: 10 
Hi,
I finally managed to locate the error in my calculations. Thankfully it's not related to the solver itself. but rather to the discretization and solution procedure. I changed parts of my case to match fvSchemes and fvSolutions from the depthChargetutorial, and now it's working like a charm. Thank you very much Alberto for pointing me in the right direction. If anyone else is having trouble dealing with multiphase simulations involving high viscosity gradients: one measure that tremendously improved my velocity field was switching off the momentum predictor. With predictor steps, I get gradually increasing velocities at the interface that eventually get out of hand. 

June 15, 2012, 06:34 

#20 
Senior Member
Albrecht vBoetticher
Join Date: Aug 2010
Location: Zürich, Swizerland
Posts: 213
Rep Power: 9 
Thanks for the hint with the momentum predictor. Has anyone experience with perssuredependent viscosity models in interFoam? I get high pressure fluctuations / viscosity fluctuations depending on whether I deal with p or with p_rgh, and I wonder wether I have to switch to compressible two phase flow to deal with it.


Tags 
interfoam, viscosity 
Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Can I solve this problem by Fluent?  Kai_kc  FLUENT  1  October 27, 2010 05:29 
flat plate boundary layer problem great influence of viscosity  waynezw0618  OpenFOAM  6  August 12, 2010 02:19 
Problem with the pressure field using interFoam  zoune  OpenFOAM Running, Solving & CFD  20  February 4, 2008 19:42 
Problem with InterFoam  in_flu_ence  OpenFOAM Running, Solving & CFD  4  October 26, 2007 08:39 
Turbulent viscosity in a riser  ap  FLUENT  8  April 19, 2003 08:00 