CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   internal flow BCs: pressure driven versus velocity driven (https://www.cfd-online.com/Forums/openfoam-solving/99981-internal-flow-bcs-pressure-driven-versus-velocity-driven.html)

MBA September 7, 2012 14:18

Since you are using simpleFoam just add the following:

type totalPressure;
gamma 1.0;
p0 uniform 0;
value uniform 0;

You should be O.K now.

vut March 6, 2014 10:00

BC Total Pressure
 
Dear OpenFoamers,

I would like to set up my study case: a water flow through a channel by simpleFoam.

I want to set boundary conditions as total pressure: (1 bar at inlet and 0 bar at outlet).

Now I have:

================================================== ====
p
================================================== ====
inlet
type fixedValue
uniform 100

? for simpleFoam pressure = pressure/mass density, right?

outlet
type fixedValue
uniform 0

================================================== ====
U
================================================== ====

inlet
type pressureInletVelocity
uniform (0 0 0)

outlet
type zeroGradient



It does not work when I ran simpleFoam! It stops after several iterations.

I really don't understand what happened.

Do you known why, rather why not?

I am looking to hear from you all...

Regards,

T


















Quote:

Originally Posted by Tobi (Post 379441)
Hi all,

for the totalPressure BC there are different ways for calculation. It depends on the initialization of the BC. But first to your question @lobstar.

gamma = Heat capacity ratio

That is the important code for totalPressure:
Code:

    if (psiName_ == "none" && rhoName_ == "none")
    {
        operator==(p0p - 0.5*(1.0 - pos(phip))*magSqr(Up));
    }
    else if (rhoName_ == "none")
    {
        const fvPatchField<scalar>& psip =
            patch().lookupPatchField<volScalarField, scalar>(psiName_);

        if (gamma_ > 1.0)
        {
            scalar gM1ByG = (gamma_ - 1.0)/gamma_;

            operator==
            (
                p0p
              /pow
                (
                    (1.0 + 0.5*psip*gM1ByG*(1.0 - pos(phip))*magSqr(Up)),
                    1.0/gM1ByG
                )
            );
        }
        else
        {
            operator==(p0p/(1.0 + 0.5*psip*(1.0 - pos(phip))*magSqr(Up)));
        }
    }
    else if (psiName_ == "none")
    {
        const fvPatchField<scalar>& rho =
            patch().lookupPatchField<volScalarField, scalar>(rhoName_);

        operator==(p0p - 0.5*rho*(1.0 - pos(phip))*magSqr(Up));
    }

depend on your BC initialization you calculate in different ways.
In the constructors you find the way how to set this bc correct and if you do not set an value which value would be set instead - an example that works:
Code:


outlet
{
        type              totalPressure;
        p0                  uniform 100000;
        psi                  none;
        gamma            0;
        rho                rho;
        value              uniform 100000;
}


and that lead you to that calculation:

operator==(p0p - 0.5*rho*(1.0 - pos(phip))*magSqr(Up));

If you set rho=none and psi=none (like in incompressible flows) you get the same calculation without rho:
Code:

operator==(p0p - 0.5*(1.0 - pos(phip))*magSqr(Up));

its here:

    if (psiName_ == "none" && rhoName_ == "none")
    {
        operator==(p0p - 0.5*(1.0 - pos(phip))*magSqr(Up));
    }

Hope it will help you.
Tobi


vut March 6, 2014 10:06

Thank MBA for your answer.

That's for p, right? And for both inlet and outlet?

Preciously, I change in constant/transportProperties nu = 1e-6 to simulate water. It's OK?

May you give me more details... That's would be useful.


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