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/)
-   -   How to ensure sum of alphas are equal to 1 for a four-phase simulation? (https://www.cfd-online.com/Forums/openfoam-programming-development/237558-how-ensure-sum-alphas-equal-1-four-phase-simulation.html)

clarkent July 23, 2021 08:12

How to ensure sum of alphas are equal to 1 for a four-phase simulation?
 
Hello everyone,

I am trying to simulate a four-phase case by modifying interPhaseChangeFoam solver.

Phase changes (due to cavitation in this case) occur between alpha1(liquid1)<-->alpha2(vapor1) and alpha3(liquid2)<-->alpha4(vapor2), which is modeled with SchneerSauer.

In the results, I receive that alpha1 and alpha3 have almost similar value in most of the individual cells, i.e. in the same cell and same timestep both alpha1 and alpha3 are equal to 1.


My question is that how we can ensure that sum of all alphas are equal to 1?

Regards.

geth03 August 10, 2021 05:03

you have two options:

1. either calculate the last alpha with alpha = 1 - sum of other alphas

2. or normalize all seperate calculated alphas, i.e. alpha/sum of alphas

if everything is correct both ways should lead to nearly the same result, if something is not correct, the deviation will be large.

clarkent August 10, 2021 08:10

Quote:

Originally Posted by geth03 (Post 810005)
you have two options:

1. either calculate the last alpha with alpha = 1 - sum of other alphas

2. or normalize all seperate calculated alphas, i.e. alpha/sum of alphas

if everything is correct both ways should lead to nearly the same result, if something is not correct, the deviation will be large.

Thank you for the answer geth.

Actually I am already following the first approach in your reply, which is inherited from original interPhaseChangeFoam solver.

Code:

alpha4 = scalar(1) - alpha1 - alpha2 - alpha3;
In my case I have excluded the MULES solver, do you think that the problem might be connected to this? Do you know how within one transport equation the solver enforce the individual alpha is between 0 and 1?

Transport equation of my case for the first phase can be seen below (it is repeated for the other phases) :

Code:

fvScalarMatrix alpha1Eqn
        (
              fvm::ddt(alpha1)
            + fvm::div(phi, alpha1, "div(phi,alpha)")
            - fvm::Sp(divU, alpha1)
            ==
              fvm::Sp(vDotvmcAlphal, alpha1)
            + vDotcAlphal
        );
          alpha1Eqn.solve();

Use of a phase transport equation without MULES can also be found in this study (section 2.1).

Regards.

geth03 August 11, 2021 02:39

yeah most likely,
the mules algo guarrantees boundedness of mass/volume fractions.

how do you want to keep alpha between 0 and 1 if your equation has maybe sources that produce unphysical values?
if your values are positive the best way to keep them below 1 is to normalize like i wrote in 2. in my earlier post.

i read the publication, looks like they are doing more than just solving for the equation you wrote, they also correct in further steps.
maybe that helps to keep alpha between 0 and 1.

clarkent August 13, 2021 07:43

Quote:

Originally Posted by geth03 (Post 810073)
how do you want to keep alpha between 0 and 1 if your equation has maybe sources that produce unphysical values?

I was using below equation for this purpose:
Code:

alpha1 = min(max(alpha1, scalar(0)), scalar(1));
In case above equation is off and normalization is added for each alpha, then the sum is equal to 1. But then individual alphas within the domain can go below 0 or above 1. And non-physical high velocities are produced.


Switching off the source terms in transport equations produce meaningful results, so the problem might be coming from there actually.


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