CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

Manipulating the alpha1-field after every time step

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   May 8, 2013, 03:36
Default Manipulating the alpha1-field after every time step
  #1
New Member
 
Join Date: Aug 2011
Posts: 17
Rep Power: 3
idefix is on a distinguished road
Hello,

I am using the interFoam-solver. 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.1e-6), 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
idefix is offline   Reply With Quote

Old   May 8, 2013, 04:02
Default
  #2
Member
 
Pablo Higuera
Join Date: Jan 2011
Posts: 98
Rep Power: 4
Phicau is on a distinguished road
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(alpha1-threshold) * neg(alpha1-1+threshold) + pos(alpha1-1+threshold)
Best,

Pablo
Phicau is offline   Reply With Quote

Old   Today, 11:03
Default
  #3
New Member
 
Join Date: Nov 2012
Posts: 13
Rep Power: 2
sophie_l is on a distinguished road
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:
Courant Number mean: 0.00685244 max: 0.558313
Interface Courant Number mean: 6.62914e-05 max: 0.558313
deltaT = 0.00132421
Time = 0.186161

MULES: Solving for alpha1
Liquid phase volume fraction = 0.666668 Min(alpha1) = 0 Max(alpha1) = 1.16009
MULES: Solving for alpha1
Liquid phase volume fraction = 0.666668 Min(alpha1) = 0 Max(alpha1) = 1.57337
GAMG: Solving for p_rgh, Initial residual = 5.1474e-05, Final residual = 6.30767e-06, No Iterations 1
time step continuity errors : sum local = 1.13037e-05, global = -3.39547e-08, cumulative = -6.81206e-06
DILUPBiCG: Solving for epsilon, Initial residual = 0.00528157, Final residual = 7.39422e-09, No Iterations 7
DILUPBiCG: Solving for k, Initial residual = 0.00656354, Final residual = 3.16796e-09, No Iterations 8
ExecutionTime = 1408.43 s ClockTime = 1465 s
I am thinking it should be due to the input boundary conditions, however, I haven't got a clue where the check should start with. Do you some suggestions on this please?

Thanks a lot!
Sophie
sophie_l is offline   Reply With Quote

Old   Today, 11:30
Default
  #4
Member
 
Pablo Higuera
Join Date: Jan 2011
Posts: 98
Rep Power: 4
Phicau is on a distinguished road
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
Phicau is offline   Reply With Quote

Old   Today, 15:24
Default
  #5
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Posts: 1,118
Rep Power: 19
ngj will become famous soon enough
Hi Sophie,

From the snap-shot 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 PIMPLE-algorithm, 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 3-4 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
ngj is online now   Reply With Quote

Old   Today, 16:00
Default
  #6
New Member
 
Join Date: Nov 2012
Posts: 13
Rep Power: 2
sophie_l is on a distinguished road
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
sophie_l is offline   Reply With Quote

Old   Today, 16:14
Default
  #7
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Posts: 1,118
Rep Power: 19
ngj will become famous soon enough
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},
}
which will aid you in understand the importance of the settings for the PISO-algorithm.

Kind regards,

Niels
ngj is online now   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
mixerVesselAMI2D's mass is not balancing sharonyue OpenFOAM Running, Solving & CFD 2 March 22, 2013 07:09
Orifice Plate with a fully developed flow - Problems with convergence jonmec OpenFOAM Running, Solving & CFD 3 July 28, 2011 05:24
Extrusion with OpenFoam problem No. Iterations 0 Lord Kelvin OpenFOAM 6 April 12, 2011 11: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


All times are GMT -4. The time now is 16:16.