/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  9
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    format      ascii;
    class       dictionary;
    object      phaseProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#include "$FOAM_CASE/constant/globalVars"

type interfaceCompositionPhaseChangePopulationBalanceMultiphaseSystem;

phases (gas liquid);

populationBalances (bubbles);

gas
{
    type            multiComponentPhaseModel;//pureIsothermalPhaseModel;
   
    diameterModel   velocityGroup;

    velocityGroupCoeffs
    {
        populationBalance    bubbles;

        shapeModel           spherical;

        sizeGroups
        (
            f1 {dSph  1.4e-3; value 0.0;}
            f2 {dSph  1.8e-3; value 0.0;}
            f3 {dSph  2.2e-3; value 0.0;}
            f4 {dSph  2.6e-3; value 0.0;}
            f5 {dSph  3e-3; value 1.0;}
            f6 {dSph  3.4e-3; value 0.0;}
            f7 {dSph  3.8e-3; value 0.0;}
            f8 {dSph  4.2e-3; value 0.0;}
            f9 {dSph  4.6e-3; value 0.0;}
            f10 {dSph 5.0e-3; value 0.0;}
        );
    }

    residualAlpha   1e-6;

    Sc              0.7;
}

liquid
{
    type            multiComponentPhaseModel;//pureIsothermalPhaseModel;

    diameterModel   constant;

    constantCoeffs
    {
        d               1e-4;
    }
    Sc   #codeStream 
    { 
        code 
        #{ 
            os  << ($LeLiqMix * $CpMixLiq * $muMixLiq / $kThermLiq); 
        #}; 
    }; 

    residualAlpha   1e-6;
}

populationBalanceCoeffs
{
    bubbles
    {
        continuousPhase liquid;

        coalescenceModels
        (
            LehrMilliesMewes{
               efficiency 4.695;
               uCrit 0.08;
               alphaMax 0.6;
            }
        );

        binaryBreakupModels
        ();

        breakupModels
        (
            Laakkonen {
                efficiency 13.83;
                daughterSizeDistributionModel Laakkonen;
            }

        );

        driftModels
        (
            densityChange{}
        );

        nucleationModels
        ();
    }
}

blending
{
    default
    {   
        type            linear;
        minFullyContinuousAlpha.gas 0.7;
        minPartlyContinuousAlpha.gas 0.3;
        minFullyContinuousAlpha.liquid 0.7;
        minPartlyContinuousAlpha.liquid 0.3;
    }
    heatTransfer
    {   
        type            linear;
        minFullyContinuousAlpha.gas 1;
        minPartlyContinuousAlpha.gas 0;
        minFullyContinuousAlpha.liquid 1;
        minPartlyContinuousAlpha.liquid 0;
    }
    massTransfer
    {
        $heatTransfer;
    }
}

surfaceTension
(
    (gas and liquid)
    {
        type            constant;
        sigma           $sigmaLiq;
    }
);

interfaceCompression
();

aspectRatio
(
    (gas in liquid)
    {
        type            Wellek;
    }
);


drag
(
    (gas in liquid)
    {
        type           Grace; // Need to install the model available at https://github.com/NREL/BioReactorDesign
        //type           IshiiZuber;
        residualRe 1e-3;
        swarmCorrection
        {
            type        none;
        }
    }
);

virtualMass
(
    (gas in liquid)
    {
        type            constantCoefficient;
        Cvm             0.5;
    }
);

// heatTransfer
// ();

heatTransfer.gas
(
    (gas in liquid)
    {
        type spherical;
        residualAlpha 1e-4;
    }

    (liquid in gas)
    {
        type RanzMarshall;
        residualAlpha 1e-4;
    }
);

heatTransfer.liquid
(
    (gas in liquid)
    {
        type RanzMarshall;
        residualAlpha 1e-4;
    }

    (liquid in gas)
    {
        type spherical;
        residualAlpha 1e-4;
    }
);

interfaceComposition.gas
();

interfaceComposition.liquid
(
    (liquid and gas)
    {
        type Henry;
        species ( CO2 H2 );
        k ( $He_CO2 $He_H2 );
        Le $LeLiqMix;
    }
);

diffusiveMassTransfer.gas
();

diffusiveMassTransfer.liquid
(
    (gas in liquid)
    {
        type Higbie; // Need to install the model available at https://github.com/NREL/BioReactorDesign
        //type Frossling;
        Le $LeLiqMix;
    }

    (liquid in gas)
    {
        type spherical;
        Le 1.0; //not used for spherical
    }
);

phaseTransfer
();

lift
(
    (gas in liquid)
    {
        type            wallDamped;

        wallDamping
        {
            type        cosine;
            Cd          3.0;
        }

        lift
        {
            type        Tomiyama;

            swarmCorrection
            {
                type    none;
            }
        }
    }

);

wallLubrication
(
    (gas in liquid)
    {
        type            Antal;
        Cw1             -0.01;
        Cw2             0.05;
    }
);

turbulentDispersion
(
    (gas in liquid)
    {
        type            Burns;
        sigma           0.9;
    }
);

// ************************************************************************* //
