CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   calcAlphas() of multiphaseSystem (https://www.cfd-online.com/Forums/openfoam-programming-development/131257-calcalphas-multiphasesystem.html)

maybee March 12, 2014 04:43

calcAlphas() of multiphaseSystem
 
hi,

I don`t understand method calcAlphas() of multiphaseSystem

Code:

void Foam::multiphaseSystem::calcAlphas()
  48 {
  49    scalar level = 0.0;
  50    alphas_ == 0.0;
  51
  52    forAllIter(PtrDictionary<phaseModel>, phases_, iter)
  53    {
  54        alphas_ += level*iter();  //volScalarField alphas_
  55        level += 1.0;
  56    }
  57
  58    alphas_.correctBoundaryConditions();
  59 }

By the "forAllIter" Macro we iterate through all objects of type "phaseModel" which should be the phasefractions of the different phases in first place, right?

If this is right I don`t understand what is calculated with this procedure. As far as I understand line 54 would technically mean the following
Code:

volScalarField alphas_ = phasefraction1*0 + phasefraction2*1 + phasefraction3*2 ...
Initially I thought volScalarField alphas_ would just be the sum of all phasefraction fields of the different phases, but when I look at the code it does not seem so.

What is calculated here?

greetings maybee

GerhardHolzinger March 12, 2014 04:50

The sum of the volume fractions of all phases must be 1. There is little information in field that is 1 throughout the domain.
The intention behind alphas is to provide one field to visualize all phases.

If you have a water-oil-air system, you have three volume fraction fields. Three fields are hard to visualize in one image. This is where alphas comes to the rescue.
In the alphas field 0 means water, 1 means oil and 2 means air. This way you can depict all phases at once.

maybee March 12, 2014 05:05

Thx, nice idea, but I am thinking about the following now:

Let s assume we have initial water-oil-air alpha fields like

Code:

water
(
1
1
1
1
0
0
0
)

oil
(
0
0
0
0
0.3
0.5
0.7
)

air
(
0
0
0
0
0.7
0.5
0.3
)

So, the resulting volScalarField alphas_ would be something like

Code:

alphas_
(
0
0
0
0
1*0.3 + 2*0.7 = 1.7
1*0,5 + 2*0.5 = 1.5
1*0.7 + 2*0.3 = 1.3
)

Your visualization theory in which 0 is water, 1 is oil and 2 is air would only work if each cell is initially full of water OR oil OR air, right?
Isn`t this some kind of limitating at least the intitial conditions of the cells if only 0 or 1 for each phase in a cell were possible?

GerhardHolzinger March 12, 2014 05:32

1 Attachment(s)
Yes, you can have values in between. I attached the alphas field from the damBreak4phase tutorial case of multiphaseEulerFoam.

The phases are water-oil-mercury-air.


If you have any doubts or ideas. Play with the tutorial case.


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