CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (https://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   Stratified Two-Phase Flow (https://www.cfd-online.com/Forums/openfoam-pre-processing/76248-stratified-two-phase-flow.html)

 metro May 19, 2010 05:29

Stratified Two-Phase 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 non-uniform 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

 alberto May 20, 2010 02:28

Both the solvers can deal with non-uniform 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 two-fluid approach, solving one momentum equation for each phase.

Best,

 metro May 20, 2010 15:58

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 vice-versa.

 alberto May 20, 2010 17:46

I'm not sure I understand what you want to do :-)

If you want to specify a non-uniform, 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,

 metro May 20, 2010 18:50

Thank you again for your input

Sorry about that, let me reword my problem. I am studying stratified horizontal two-phase 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.

 alberto May 20, 2010 19:08

Well, in the two-fluid 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 cross-section each phase occupies? Do these quantities change in time?

Best,

 metro May 20, 2010 20:02

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.

 alberto May 20, 2010 20:13

Quote:
 Originally Posted by metro (Post 259623) 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.
You can either start from an empty domain or from an already filled domain. Probably starting with a basic non-uniform initial condition will help convergence and also shorten the computational time.

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, two-fluid 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,

 metro May 20, 2010 21:58

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

 alberto May 21, 2010 01:29

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.

 metro May 21, 2010 03:17

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 piece-wise function which will apply a uniform mean velocity for each phase just as a starting point.

For non-uniform 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

 alberto May 21, 2010 13:35

Quote:
 Originally Posted by metro (Post 259663) 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 piece-wise function which will apply a uniform mean velocity for each phase just as a starting point. For non-uniform B.C I would have to specify the velocity profile separately for each phase when using groovyBC?
GroovyBC makes it very easy to specify complex profiles at boundaries. Yes you have to specify different profiles for each phase.

Quote:
 How stable is groovyBC as the openFOAM wiki states that it is a beta version? I am using openFOAM 1.6x.
It's stable enough to be used regularly.

Best,

 metro May 22, 2010 22:24

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.09895e-11, 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.17554e-11, 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/OpenFOAM-1.6.x/lib/linuxGccDPOpt/libOpenFOAM.so"
#1 Foam::sigFpe::sigFpeHandler(int) in "/home/david/OpenFOAM/OpenFOAM-1.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/OpenFOAM-1.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/OpenFOAM-1.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/OpenFOAM-1.6.x/lib/linuxGccDPOpt/libOpenFOAM.so"
#6 Foam::GAMGSolver::solve(Foam::Field<double>&, Foam::Field<double> const&, unsigned char) const in "/home/david/OpenFOAM/OpenFOAM-1.6.x/lib/linuxGccDPOpt/libOpenFOAM.so"
#7 Foam::fvMatrix<double>::solve(Foam::dictionary const&) in "/home/david/OpenFOAM/OpenFOAM-1.6.x/lib/linuxGccDPOpt/libfiniteVolume.so"
#8
in "/home/david/OpenFOAM/OpenFOAM-1.6.x/applications/bin/linuxGccDPOpt/twoPhaseEulerFoam"
#9 __libc_start_main in "/lib/tls/i686/cmov/libc.so.6"
#10
in "/home/david/OpenFOAM/OpenFOAM-1.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

 alberto May 23, 2010 00:50

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:
• You are specifying the pressure at a boundary where you imposed the velocity. You should not do that. Fix the pressure at the outlet.
• Use a much smaller time step (10^-5 s).
I would also replace the inletOutlet for Ua and Ub at the outlet with zeroGradient.

Best,

 metro May 23, 2010 01:52

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

 alberto May 23, 2010 02:42

1 Attachment(s)
Quote:
 Originally Posted by metro (Post 259866) 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.
It is surely something I don't like to encourage. Doing things in such a hurry and with this approach = bad idea. But probably your boss wants it... :D

Quote:
 I implemented your findings and I am still getting the same error message? Do you still have any other suggestions?
See the attachment.

Some comments:

• The time step is very small (10^-6) to let the simulation start, but after a few iterations you can simply activate the adaptive time stepping, set the maximum Co to 0.4 and the max time step to 10^-4s. Probably this is due to some other problem in the initial condition / simulation setup, but I didn't have the time to check.
• You should set the no-slip condition at the pipe wall (check how I changed Ua and Ub for "pipe").
• The inlet condition won't keep the flow stratified, since alpha is set to be uniform.
Good luck!

 metro May 23, 2010 03:31

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

 metro May 25, 2010 16:06

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 (Euler-Euler) 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?

 alberto May 25, 2010 23:58

Quote:
 Originally Posted by metro (Post 260223) 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 (Euler-Euler) 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?
The question is what are you interested in modelling? :-)

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,

 metro May 26, 2010 00:41

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 Euler-Euler 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 06:35.