CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Verification & Validation (https://www.cfd-online.com/Forums/openfoam-verification-validation/)
-   -   interFoam modification for mass transfer (https://www.cfd-online.com/Forums/openfoam-verification-validation/237034-interfoam-modification-mass-transfer.html)

Mano2903 June 27, 2021 06:58

interFoam modification for mass transfer
 
2 Attachment(s)
Dear Foamers,

I'm working on a project involving multi-phase flows and was tasked with plugging in a mass transfer term into the interFoam solver. After reading some literature, I found a paper by Dr. Nima Samkhaniani, where he had added a source term to the volume fraction equation, which considered mass transfer rate and I made the following modification to alphaSuSp.H file based on the same:
Code:

zeroField Sp;
zeroField divU;

volScalarField Su
(
    IOobject
    (
        "Su",
        runTime.timeName(),
        mesh
    ),
    -mdot*((1/rho1)-(alpha1*(1/rho1-1/rho2)))
);

where mdot is the mass flow rate in kg/m3s and is defined explicitly. The value is defined in a case file's /constant directory and I've assigned random values (0.005).
I made this change and compiled the solver. I ran two simulations: Rising Bubble case and Cavitation over a hydrofoil. The contours of water of the simulations are below. Could someone please explain the physics behind what's going on here and why is the contour very different from a typical interFoam contour?:confused:
Attachment 85115

Attachment 85116
I'm running OpenFOAM v8. Thanks in advance. :)

Mano2903 July 3, 2021 11:35

A theory as to why the "tiger stripes" appear is that since I have defined the source term explicitly in the volume fraction(alpha.water) equation, the value of the same has has changed in the entire domain.

I would really appreciate suggestions as to how I can eliminate these stripes while still keeping the source term in the equation. Thank you!

Mano2903 July 12, 2021 02:31

Now I wish to add mass transfer only at the interface, i.e, where 0<alpha.water<1. I've found a solution here, but the latest openfoam version does not let me modify alphaEqn.H file found in /opt/openfoam8/src/twoPhaseModels/twoPhaseMixture/VoF. And I'm not able to add "if" conditions to alphaSuSp.H file either.

Any advice would be appreciated! :)

lxufeishi July 16, 2021 05:44

Hi Mano2903
Have you tried to define the source term in an implicit way? like:

Code:

zeroField Su;
zeroField divU;
volScalarField Sp ("Sp", (1.0/rho1 * mdot)/(alpha1 + SMALL));

And I remind you to add a source term to the mass equation as well, by modifying the pEqn.H:

Code:

fvScalarMatrix p_rghEqn
(
fvm::laplacian(rAUf, p_rgh) == fvc::div(phiHbyA) - mdot*(1.0/rho1 - 1.0/rho2)
);

Hope this will help you.

Mano2903 July 19, 2021 15:27

Hi lxufeishi,

Thanks for replying!

I haven't considered implementing the mass transfer as an implicit source term yet. I look forward to implementing your code. But I have a question.
Code:

volScalarField Sp ("Sp", (1.0/rho1 * mdot)/(alpha1 + SMALL));
What does "SMALL" mean?

lxufeishi July 19, 2021 20:44

SMALL is a constant already defined in src/OpenFOAM/primitives/Scalar/scalar/scalar.H and it is used here to prevent from dividing by 0.

Code:

GREAT = 1.0e+6;
VGREAT = 1.0e+37;
ROOTVGREAT = 1.0e+18;
SMALL = 1.0e-6;
VSMALL = 1.0e-37;
ROOTVSMALL = 1.0e-18;


Mano2903 July 30, 2021 10:53

Quote:

Originally Posted by lxufeishi (Post 808271)
Code:

zeroField Su;
zeroField divU;
volScalarField Sp ("Sp", (1.0/rho1 * mdot)/(alpha1 + SMALL));

Code:

fvScalarMatrix p_rghEqn
(
fvm::laplacian(rAUf, p_rgh) == fvc::div(phiHbyA) - mdot*(1.0/rho1 - 1.0/rho2)
);


Hi lxufeishi,

Update: The implicit method worked! Thank you.

Could you help me understand, how the Su and Sp implementation vary and why?

Regards,
Mano2903


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