
[Sponsors] 
May 19, 2010, 05:29 
Stratified TwoPhase Flow

#1 
New Member
Join Date: May 2010
Posts: 27
Rep Power: 9 
Hi,
I am currently attempting to model stratified flow in horizontal pipeline (water/steam) and is new to openFOAM. I would like to implement nonuniform boundary conditions for each phase but is finding it difficult to do so. The main boundary conditions which I am interested in is the phase velocities and void fraction. The solvers which I have been playing with have been interFoam and twoPhaseEuler. The main questions which I have is: Is the solvers which I am attempting to use capable of handling separate boundary conditions per phase? and of so how can I do it? Any help will be greatly appreciated 

May 20, 2010, 02:28 

#2 
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,910
Rep Power: 28 
Both the solvers can deal with nonuniform conditions on the variables they solve for.
The approach the solvers use are however very different. InterFoam is a VOF code, where the velocity is defined for the mixture. TwoPhaseEulerFoam uses the twofluid approach, solving one momentum equation for each phase. 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. 

May 20, 2010, 15:58 

#3 
New Member
Join Date: May 2010
Posts: 27
Rep Power: 9 
Thank you for your input.
It seems the twoPhaseEuler solver will be the best option. A question I do have is that we are mainly concerned with setting up the phase velocities depending on the mass flow rate of each fluid and the cross sectional area they occupy (Void Fraction). How can this be achieved or is this already set up in the solver? Due to me being a novice to openFOAM, how do I set the pressure boundary condition so that the pressure drop across the system is dependent on the fluids behaviour and not viceversa. 

May 20, 2010, 17:46 

#4 
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,910
Rep Power: 28 
I'm not sure I understand what you want to do :)
If you want to specify a nonuniform, constant in time, boundary condition you can simply set it by patching the values on the face (there are a few tools on the wiki that make your life easier like funkySetField, or you can use the macros to keep the initial condition as BC ($internalField, as done in some of the tutorial of single phase codes)). About the pressure, if you want to let the pressure change according to the velocity field (which is what you normally do, when you fix the velocity at inlets in incompressible flows), you simply set the pressure to zeroGradient at the inlet, and to fixedValue (athmospheric or the value you want) at the outlet. 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. 

May 20, 2010, 18:50 

#5 
New Member
Join Date: May 2010
Posts: 27
Rep Power: 9 
Thank you again for your input
Sorry about that, let me reword my problem. I am studying stratified horizontal twophase flow (steam and water) where I would like to determine the pressure drop across a section of pipe using CFD. I want to set up a model where I specify the mass flow rate of the two phases and openFOAM will simulate the problem with the end result being the pressure drop between the pipe inlet and outlet. I would like to used the twoPhaseEuler solver for this problem.The problem I'm having is that due to my limited experience with openFOAM I'm having difficulty setup the B.C. The problem is that the phase velocities is dependent on the mass flow rates and the cross sectional area each phase is occupying in the pipe (Conservation of mass). I don't know how to set this up in openFOAM and any help will be greatly appreciated. I hope this clarifies things. 

May 20, 2010, 19:08 

#6 
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,910
Rep Power: 28 
Well, in the twofluid approach, you assume the phases are incompressible, so you specify only the phase velocities and volume fractions at the inlet and the pressure at the outlet. The rest comes out from the simulation.
Do you know how the mass flow rate and what portion of the inlet crosssection each phase occupies? Do these quantities change in time? 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. 

May 20, 2010, 20:02 

#7 
New Member
Join Date: May 2010
Posts: 27
Rep Power: 9 
Thats great. Do we need to specify the internal field values for Ua, Ub and alpha or do I need to leave them at 0? We are assuming that the phase mass flow rates state constant but in reality there is flashing and condensation of the steam and water. This will be added to the solver code at a later date when I am more familiar with the software.
The phase velocities also change as the liquid gas interface tends to be wavy and therefore the cross sectional area occupied by each changes with time at a particular instant. Im just wondering if I need to set this up or is it automatically. 

May 20, 2010, 20:13 

#8  
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,910
Rep Power: 28 
Quote:
If the pipe is horizontal, for example you can do something like ================================= Steam here (Ua, alpha)  Liquid here (Ub, beta) ================================= You can do this with setField, very easily. If you specify the initial condition so that it is equal to the inlet condition initially, you can use $internalField in the definition of BC's. About the interface, twofluid methods are not very good to capture sharp interfaces. So you'll see the interface, but do not expect to obtain something comparable to what you would observe with a VOF approach. I hope this helps. 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. 

May 20, 2010, 21:58 

#9 
New Member
Join Date: May 2010
Posts: 27
Rep Power: 9 
Thats what I was going to attempt first. When it comes to the twoPhaseEuler solver is there a beta phase file similiar to the alpha phase? Or is this automatically derived from the alpha file.
When it comes to B.C can I use the setFields function to set the B.C for Ua and Ub? The mean velocity of the phases are different (due to different mass flow rates) but the same at the interface and zero at the wall (assuming no slip). How can this be captured with the standard 7th order turbulent velocity distribution? You have been so help full Alberto. Very much appreciated. Metro 

May 21, 2010, 01:29 

#10 
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,910
Rep Power: 28 
Hi,
beta = 1  alpha is computed automatically, so if you fix alpha, beta will be initialised consistently. Do you have an analytical expression for the BC's? If so check the wiki for groovy BC.
__________________
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. 

May 21, 2010, 03:17 

#11 
New Member
Join Date: May 2010
Posts: 27
Rep Power: 9 
I do have a couple but depends how easy it will be to implement as I am new to openFOAM. I was considering implementing a piecewise function which will apply a uniform mean velocity for each phase just as a starting point.
For nonuniform B.C I would have to specify the velocity profile separately for each phase when using groovyBC? How stable is groovyBC as the openFOAM wiki states that it is a beta version? I am using openFOAM 1.6x. Thank you Metro 

May 21, 2010, 13:35 

#12  
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,910
Rep Power: 28 
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. 

May 22, 2010, 22:24 

#13 
New Member
Join Date: May 2010
Posts: 27
Rep Power: 9 
I have been attempting to run a uniform BC scenario as detailed in one of your previous threads but I keep getting this error message when I try and run the solver
"DILUPBiCG: Solving for alpha, Initial residual = 0.895457, Final residual = 7.09895e11, No Iterations 80 Dispersed phase volume fraction = 0.0137154 Min(alpha) = 390.447 Max(alpha) = 419.758 DILUPBiCG: Solving for alpha, Initial residual = 0.999992, Final residual = 3.17554e11, No Iterations 8 Dispersed phase volume fraction = 6.99526e+09 Min(alpha) = 8.91999e+12 Max(alpha) = 1 #0 Foam::error:rintStack(Foam::Ostream&) in "/home/david/OpenFOAM/OpenFOAM1.6.x/lib/linuxGccDPOpt/libOpenFOAM.so" #1 Foam::sigFpe::sigFpeHandler(int) in "/home/david/OpenFOAM/OpenFOAM1.6.x/lib/linuxGccDPOpt/libOpenFOAM.so" #2 Uninterpreted: #3 Foam::GAMGSolver::scalingFactor(Foam::Field<double >&, Foam::Field<double> const&, Foam::Field<double> const&, Foam::Field<double> const&) const in "/home/david/OpenFOAM/OpenFOAM1.6.x/lib/linuxGccDPOpt/libOpenFOAM.so" #4 Foam::GAMGSolver::scalingFactor(Foam::Field<double >&, Foam::lduMatrix const&, Foam::Field<double>&, Foam::FieldField<Foam::Field, double> const&, Foam::UPtrList<Foam::lduInterfaceField const> const&, Foam::Field<double> const&, unsigned char) const in "/home/david/OpenFOAM/OpenFOAM1.6.x/lib/linuxGccDPOpt/libOpenFOAM.so" #5 Foam::GAMGSolver::Vcycle(Foam::PtrList<Foam::lduMa trix::smoother> const&, Foam::Field<double>&, Foam::Field<double> const&, Foam::Field<double>&, Foam::Field<double>&, Foam::Field<double>&, Foam::PtrList<Foam::Field<double> >&, Foam::PtrList<Foam::Field<double> >&, unsigned char) const in "/home/david/OpenFOAM/OpenFOAM1.6.x/lib/linuxGccDPOpt/libOpenFOAM.so" #6 Foam::GAMGSolver::solve(Foam::Field<double>&, Foam::Field<double> const&, unsigned char) const in "/home/david/OpenFOAM/OpenFOAM1.6.x/lib/linuxGccDPOpt/libOpenFOAM.so" #7 Foam::fvMatrix<double>::solve(Foam::dictionary const&) in "/home/david/OpenFOAM/OpenFOAM1.6.x/lib/linuxGccDPOpt/libfiniteVolume.so" #8 in "/home/david/OpenFOAM/OpenFOAM1.6.x/applications/bin/linuxGccDPOpt/twoPhaseEulerFoam" #9 __libc_start_main in "/lib/tls/i686/cmov/libc.so.6" #10 in "/home/david/OpenFOAM/OpenFOAM1.6.x/applications/bin/linuxGccDPOpt/twoPhaseEulerFoam" Floating point exception" Due to my limited experience with the software I am finding it very difficult to decipher . I was attempting to simulate a theoretical stratified flow scenario where the void fraction was 0.5 and the velocities for Ua and Ub was 10 and 1 m/s respectively. The inlet pressure was set at 50kPa. I have also attached files which contains my BC and pipe segment mesh. Any help will be greatly appreciated. Thank you in advance Metro 

May 23, 2010, 00:50 

#14 
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,910
Rep Power: 28 
Hi, well jumping on OpenFOAM without the time of learning it a bit surely makes things hard. I would recommend you to go through the user's guide and programmer's guide tutorials, and then do the tutorials for twoPhaseEulerFoam. Of course we can help here if you face problems.
About your case:
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. 

May 23, 2010, 01:52 

#15 
New Member
Join Date: May 2010
Posts: 27
Rep Power: 9 
Thank you for your advice, I have done some of those tutorials but due to the tight time schedules I am on I kinda have to dive into the deep end (its kinda a do or die situation). By saying it though I am learning so much going through this problem and most of that I owe to you Alberto.
I implemented your findings and I am still getting the same error message? Do you still have any other suggestions? Thank you in advance Metro 

May 23, 2010, 02:42 

#16  
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,910
Rep Power: 28 
Quote:
Quote:
Some comments:
__________________
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. 

May 23, 2010, 03:31 

#17 
New Member
Join Date: May 2010
Posts: 27
Rep Power: 9 
Yea its not really ideal and I do agree as there is so many different aspect of the software which I need to learn. When it comes to my problem the tips you provided finally allowed me to get some form of results which I can use as a starting point. Thank you for your help
Regards Metro 

May 25, 2010, 16:06 

#18 
New Member
Join Date: May 2010
Posts: 27
Rep Power: 9 
Hey Alberto
From your experience modelling two phase systems which solver would you have chosen to model two phase flow in pipes. The reason why I ask is that I have used both the interFoam (VOF) and twoPhaseEuler (EulerEuler) as described in previous threads. I have also now done some of the tutorials . I also now got stratified flow by modifying my BC with groovyBC. I am now evaluating which model/solver is best suited for my problem. From my understanding the twoPhaseEuler would allow me to model the effects of transportation between the steam and water and allow me to have BC control over both fluids. It doesnt though allow me to model the fluid interface to well. The interFoam will model the interface accurately but limits the control I have of the fluids and no transportation/entrainment. Is there an solver that harnesses both theories? Or do you know of other ways which I can achieve all the desired results such as interfacial accuracy and transportation/entrainment? 

May 25, 2010, 23:58 

#19  
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,910
Rep Power: 28 
Quote:
If you need to track the interface accurately, twoPhaseEulerFoam is not the right choice, while if you can give up on a good resolution of the interface, you'll have the advantage of being able to implement the other submodels in a well known and straightforward manner. There is some solver in OpenFOAM that deals with mass transfer. Take a look at cavitatingFoam. You might want to take a look at it. 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. 

May 26, 2010, 00:41 

#20 
New Member
Join Date: May 2010
Posts: 27
Rep Power: 9 
Thanks for the reply,
Well I actually need to simulate what is occuring at the interface as at high differential phase velocities the shear forces is high resulting in large pressure drop which I need to determine. This is done with the interFoam solver. But then I also need to model the diffusion of the liquid phase into the gaseous phase (Flashing of the liquid into steam) and vice versa. This effects the momentum and mass equations and the pressure drop results. This I know can be done with the EulerEuler solver. So I am at a dilemma as I require a "hybrid" solver . Any input will be greatly appreciated..... 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
mass flow in is not equal to mass flow out  saii  CFX  2  September 18, 2009 08:07 
Two phase flow with condensation  Sunnie  FLUENT  0  May 31, 2009 10:02 
Stratified Two Phase Flow  ravi1650  FLUENT  1  May 29, 2009 05:13 
Error in Laxwendroff with two phase flow  k.baker  Main CFD Forum  1  November 24, 2007 05:22 
fluid flow fundas  ram  Main CFD Forum  5  June 17, 2000 21:31 