Stratified TwoPhase Flow
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 
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, 
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. 
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, 
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. 
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, 
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. 
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, 
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 
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. 
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 
Quote:
Quote:
Best, 
1 Attachment(s)
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::printStack(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 :confused:. 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 
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, 
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 
1 Attachment(s)
Quote:
Quote:
Some comments:

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 
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? 
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, 
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 :rolleyes:. Any input will be greatly appreciated..... 
All times are GMT 4. The time now is 01:34. 