
[Sponsors] 
May 8, 2013, 03:36 
Manipulating the alpha1field after every time step

#1 
Member
Join Date: Aug 2011
Posts: 83
Rep Power: 7 
Hello,
I am using the interFoamsolver. Alpha1 is characterizing the volume fraction (alpha1= 0 means: there is only gas in the cell, alpha1=1 means: there is only liquid in the cell). Now I´ve got the problem, that alpha1 is getting negative or greater than 1 which is not realistic. My idea is to "correct" the alpha1 after every time step. I need something which goes into every cell: If alpha1 is negative or nearly 0 (for example 0.1e6), alpha1 should be put to 0. If alpha1 is greater than or nearly 1, alpha1 should be put to 1. I would put this function in tha alphaEn.H  file after the for loop. Can anybody help me? Thanks a lot 

May 8, 2013, 04:02 

#2 
Senior Member
Pablo Higuera
Join Date: Jan 2011
Location: Singapore
Posts: 313
Rep Power: 8 
Hi,
I would not suggest doing this, as MULES handles itself the boundedness, continuity and conservation of alpha1. Although you may obtain vales slightly lower than 0 or larger than 1, if your BCs are correctly set, these will only be on the order of machine precision. However, to do what you asked: Code:
threshold = 0.01; // You name it alpha1 = alpha1 * pos(alpha1threshold) * neg(alpha11+threshold) + pos(alpha11+threshold) Pablo 

May 13, 2013, 11:03 

#3  
Member
Join Date: Nov 2012
Location: Liverpool, UK
Posts: 51
Rep Power: 5 
Hi Pablo,
I am using interFoam/waveFoam as well. I remember in the code, the value of alpha1 is restricted between 0 and 1. However, the case I am running at the moment gives out results like this, where Max(alpha1) = 1.57337. But the case is still running even though. Quote:
Thanks a lot! Sophie 

May 13, 2013, 11:30 

#4 
Senior Member
Pablo Higuera
Join Date: Jan 2011
Location: Singapore
Posts: 313
Rep Power: 8 
Hi
it is very likely that your alpha1 unboundedness is caused by the BCs. I suggest you take a look at this post for BC reference: Waves2Foam Related Topics if that does not solve your problems, explain your case there and I am sure they will be able to help you. Best, Pablo 

May 13, 2013, 15:24 

#5 
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,702
Rep Power: 27 
Hi Sophie,
From the snapshot of the log file, it is clear that: 1. You are not solving the momentum equation. 2. You are only solving the pressure equation one (1) time per time step. If you relate that with the fact that interFoam/waveFoam is based on a PIMPLEalgorithm, then you will have no chance what so ever in obtaining mass conservation on the cell level; in your case the error in mass conservation is considerable. This is most probably the reason for the unboundedness of alpha1. So: start solving for the momentum equation and have 34 iterations in the pressure equation per time step. This will greatly improve on your mass conservation problems and therefore improve on the boundedness of alpha1. Kind regards, Niels 

May 13, 2013, 16:00 

#6 
Member
Join Date: Nov 2012
Location: Liverpool, UK
Posts: 51
Rep Power: 5 
Hi Niels,
Thank you so much for your reply. Really appreciate your help so far! That's quite inspiring really. I'll resort to the code to work it out. By the way, I am using OF 1.7.1 based on PISO algorithm. However, in the cases I ran earlier, I didn't see alpha1 could be larger than 1.5, at most 1.0*. Many thanks, Sophie 

May 13, 2013, 16:14 

#7 
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,702
Rep Power: 27 
Hi Sophie,
If you are using the PISO algorithm, the problem is at least as bad as using PIMPLE (though, if your relaxing factors are 1, then the results should be identical). You do not need to modify/read the code, but merely change some keywords in fvSolution. Furthermore, I can recommend that you read the section on the PISO algortihm in Code:
@book { Ferziger2002, Author = {Ferziger, J. H. and Peric, M}, Title = {Computational Methods for Fluid Dynamics}, Publisher = {Springer}, Year = {2002}, Edition = {3rd}, } Kind regards, Niels 

May 13, 2013, 16:27 

#8 
Member
Join Date: Nov 2012
Location: Liverpool, UK
Posts: 51
Rep Power: 5 
Hi Niels,
Thanks a lot! Fortunately, I've borrowed this book from the library. I'll read this part right now. Cheers, Sophie 

May 14, 2013, 03:01 

#9  
Member
Join Date: Aug 2011
Posts: 83
Rep Power: 7 
Hi,
the discussion is really helpful for me and I have got one question to it. My simulations are not running very well. Soon after the beginning the velocities are increasing and as a result my time step is decreasing till the simulation stopps ( I am using adjustableRunTime). The turbulent viscosity is getting very small too. I am using the kepsilonmodel. At the beginning I thought that alpha1 is the reason for this behaviour but the discussion here gives some hints that the problem could be somewhere else. Is there a possiblity to change something in the fvSolutionfile so that the simulation get stable? At the moment my fvSolutionfile looks like: Quote:
Quote:


May 14, 2013, 03:55 

#10 
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,702
Rep Power: 27 
Hi Idefix,
Try running your simulation without a turbulence closure. Your turbulence quantities are diverged, so poor boundary conditions on k/epsilon could be the source of your crash. Kind regards Niels 

May 14, 2013, 04:29 

#11 
Member
Join Date: Aug 2011
Posts: 83
Rep Power: 7 
Hi Niels,
thanks for your answer but I am not so familiar with OpenFoam. How can I run my simulation without turbulence closure? Going away from URANS? thanks again Idefix 

May 14, 2013, 05:07 

#12 
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,702
Rep Power: 27 
Hi Idefix,
Open the file Code:
constant/RASProperties Code:
RASModel laminar; Niels 

May 14, 2013, 06:34 

#13 
Member
Join Date: Aug 2011
Posts: 83
Rep Power: 7 
Hi Niels,
in my case I´ve got a pipe flow and the Reynoldsnumbers says that I have got a turbulent flow. For my understanding I should calculate the flow turbulent. Is there something else I can try? Thanks a lot, Idefix 

May 14, 2013, 06:53 

#14 
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,702
Rep Power: 27 
Hi Idefix,
My suggestion is only meant for debugging. Turning off the turbulence, you can lower the complexity and see, whether the turbulence model is the cause of your problems. If yes, you know that you need to change e.g. the boundary conditions to stabilise the model. You could also try to use upwind on all of the divergence schemes in fvSchemes. Kind regards Niels 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Extrusion with OpenFoam problem No. Iterations 0  Lord Kelvin  OpenFOAM Running, Solving & CFD  8  March 28, 2016 11:08 
mixerVesselAMI2D's mass is not balancing  sharonyue  OpenFOAM Running, Solving & CFD  6  June 10, 2013 09:34 
Orifice Plate with a fully developed flow  Problems with convergence  jonmec  OpenFOAM Running, Solving & CFD  3  July 28, 2011 05:24 
Full pipe 3D using icoFoam  cyberbrain  OpenFOAM  4  March 16, 2011 10:20 
Differences between serial and parallel runs  carsten  OpenFOAM Bugs  11  September 12, 2008 11:16 