CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Calling twophasemixture member function (http://www.cfd-online.com/Forums/openfoam-programming-development/123998-calling-twophasemixture-member-function.html)

styleworker September 25, 2013 12:43

Calling twophasemixture member function
 
Hello foamers!

I'm quite familiar with using OpenFoam, but now I want to go further and learn more about programming in OF. At the moment I'm playing around with MRconjugateHeatFoam. I tried to extend it to a two phase flow solver, but I'm not able to call the twoPhaseProperties function.

This part of the boundary function is of interest:
HTML Code:

Foam::tmp<Foam::scalarField>
Foam::regionCoupleTemperatureFvPatchScalarField::flux() const
{

    const dimensionedScalar& rho1 = twoPhaseProperties.rho1();

    const fvPatchScalarField& T = *this;

    return rho1.value()*T.snGrad();
}

At the beginning of the file, the header file twoPhaseMixture.H is included. Somehow I'm getting the error: »twoPhaseProperties« is not defined

Did I included the wrong header file?

sharonyue September 25, 2013 20:01

I think you should construct transportProperties like this :
Code:

incompressibleTwoPhaseMixture twoPhaseProperties(U, phi);
If I am wrong correct me pls.

styleworker September 26, 2013 08:43

Thank you for your reply. Indeed you're right.

It seems incompressibleTwoPhaseMixture was renamed to twoPhaseMixture in OF. In my case (OF-2.2.0) it should be:

Code:

twoPhaseMixture twoPhaseProperties(U, phi,"alpha1");
Certainly the U-, and phi-field has to be defined/read:
Code:

const volVectorField& U = db().lookupObject<volVectorField>("U");
const surfaceScalarField& phi = db().lookupObject<surfaceScalarField>("phi");

The complete code-snippet:
Code:

Foam::tmp<Foam::scalarField>
Foam::regionCoupleTemperatureFvPatchScalarField::flux() const
{
    const volVectorField& U = db().lookupObject<volVectorField>("U");
    const surfaceScalarField& phi = db().lookupObject<surfaceScalarField>("phi");   
    twoPhaseMixture twoPhaseProperties(U, phi,"alpha1");

    const dimensionedScalar& rho1 = twoPhaseProperties.rho1();
    const fvPatchScalarField& T = *this;
    return rho1.value()*T.snGrad();
}



All times are GMT -4. The time now is 08:53.