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 do createFields.H in interFoam read separate transport properties? (https://www.cfd-online.com/Forums/openfoam-programming-development/203052-how-do-createfields-h-interfoam-read-separate-transport-properties.html)

shinri1217 June 15, 2018 17:11

How do createFields.H in interFoam read separate transport properties?
 
Hi all,

I'm new to OpenFOAM. This might be a dumb question, but I just cannot figure out. I'm working on modifying the interFoam solver, and I start to read the source code.

In the createFields.H, there are some codes as follow. I'm wondering how they get rho1 and rho2. I thought the "rho" in the IOobject should be the file name, but indeed rho is stored in transportProperties.

Also, how do they put rho for two different phases as rho1 and rho2? It is easy to understand in icoFoam, since there is lookup function there. However in the interFoam, I cannot find where is the lookup and how it identify two different rho in "transportProperties".

Code:

#include "createPhi.H"

Info<< "Reading transportProperties\n" << endl;
immiscibleIncompressibleTwoPhaseMixture mixture(U, phi);

volScalarField& alpha1(mixture.alpha1());
volScalarField& alpha2(mixture.alpha2());

const dimensionedScalar& rho1 = mixture.rho1();
const dimensionedScalar& rho2 = mixture.rho2();

// Need to store rho for ddt(rho, U)
volScalarField rho
(
    IOobject
    (
        "rho",
        runTime.timeName(),
        mesh,
        IOobject::READ_IF_PRESENT
    ),
    alpha1*rho1 + alpha2*rho2
);
rho.oldTime();

Thanks for your reading and I hope someone could tell me why.

Thanks.

hyFoam June 17, 2018 05:41

Hi Shinri,


rho1 and rho2 are read from the transportDict when constructing the mixture object.
Code:

immiscibleIncompressibleTwoPhaseMixture mixture(U, phi);
You can investigate this further by first looking at this file: $WM_PROJECT_DIR/src/transportModels/incompressible/incompressibleTwoPhaseMixture/incompressibleTwoPhaseMixture.C
Code:

nuModel1_
    (
        viscosityModel::New
        (
            "nu1",
            subDict(phase1Name_),
            U,
            phi
        )
    ),
    nuModel2_
    (
        viscosityModel::New
        (
            "nu2",
            subDict(phase2Name_),
            U,
            phi
        )
    ),

    rho1_("rho", dimDensity, nuModel1_->viscosityProperties()),
    rho2_("rho", dimDensity, nuModel2_->viscosityProperties()),

Thanks,


Vince


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