CFD Online Discussion Forums

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

mihaipruna April 17, 2012 14:29

internal flow BCs: pressure driven versus velocity driven
 
this is what I have in my p and U files for a flow driven by velocity. it seems to run fine:

for velocity:
SDuctWallface1
{
type fixedValue;
value uniform (0 0 0);
}
SDuctWallface2
{
type fixedValue;
value uniform (0 0 0);
}
SDuctInletface1
{
type surfaceNormalFixedValue;
refValue uniform -20.000000;
}
SDuctOutletface1
{
type zeroGradient;
}





for pressure:

SDuctWallface1
{
type zeroGradient;
}
SDuctWallface2
{
type zeroGradient;
}
SDuctInletface1
{
type zeroGradient;
}
SDuctOutletface1
{
type fixedValue;
value uniform 0.000000;
}


now, trying on a case where I want to run a flow driven by the difference between inlet total pressure and outlet pressure:

for velocity:
SDuctWallface1
{
type fixedValue;
value uniform (0 0 0);
}
SDuctWallface2
{
type fixedValue;
value uniform (0 0 0);
}
SDuctInletface1
{
type pressureInletVelocity;
}
SDuctOutletface1
{
type zeroGradient;
}



for pressure:
SDuctWallface1
{
type zeroGradient;
}
SDuctWallface2
{
type zeroGradient;
}
SDuctInletface1
{
type totalPressure;
value uniform 100000.000000;
}
SDuctOutletface1
{
type fixedValue;
value uniform 0.000000;
}

error:

--> FOAM FATAL IO ERROR:
keyword gamma is undefined in dictionary "/home/cadne
/run/sductpres/0/p::boundaryField::SDuctInletface1"

file: /home/cadnexus/OpenFOAM/cadnexus-2.1.0/run/sduc
DuctInletface1 from line 51 to line 52.

From function dictionary::lookupEntry(const word&
in file db/dictionary/dictionary.C at line 400.


I'm running simpleFoam so it's incompressible.

kmooney April 18, 2012 16:01

It's complaining because there are more components required to define the totalPressure boundary condition you have set at the inlet. You might have meant fixedValue, like this:

SDuctInletface1
{
type fixedValue;
value uniform 100000.000000;
}

mihaipruna April 18, 2012 16:34

Quote:

Originally Posted by kmooney (Post 355466)
It's complaining because there are more components required to define the totalPressure boundary condition you have set at the inlet. You might have meant fixedValue, like this:

SDuctInletface1
{
type fixedValue;
value uniform 100000.000000;
}

if you set it as a fixed value, and set an outlet pressure, while leaving the velocity as I set it, will it work as intended?
to me it seems there would be too many unknowns to establish the flow field.

kmooney April 18, 2012 16:38

You might need to set your velocity inlet as zeroGradient.

mihaipruna April 18, 2012 16:48

it's worth a try.

mihaipruna April 19, 2012 09:18

that didn't yield good results. At all.

Can anyone give me a good example of a total pressure BC and extra parameters set up?

kmooney April 19, 2012 09:30

Quote:

Originally Posted by mihaipruna (Post 355619)
that didn't yield good results. At all.

Can anyone give me a good example of a total pressure BC and extra parameters set up?

Works just fine for me....

https://udrive.oit.umass.edu/kmooney...nElbowFlow.jpg

mihaipruna April 19, 2012 10:19

is this one of the tutorials? if so, which one?
thanks!

kmooney April 19, 2012 10:22

It's the elbow tutorial (modified) for icoFoam. I changed the BC's to be pressure driven. I put zeroGradient U BC's on inlets and the outlet, no slip on the walls. I assigned a pressure drop of 10 Pa.

mihaipruna April 19, 2012 10:38

Quote:

Originally Posted by kmooney (Post 355640)
It's the elbow tutorial (modified) for icoFoam. I changed the BC's to be pressure driven. I put zeroGradient U BC's on inlets and the outlet, no slip on the walls. I assigned a pressure drop of 10 Pa.

Can you please paste the content of your p and U files? Maybe I'm making a silly mistake.
Thanks!

kmooney April 19, 2012 10:59

/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open Source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [0 2 -2 0 0 0 0];

internalField uniform 0;

boundaryField
{
wall-4
{
type zeroGradient;
}

velocity-inlet-5
{
type fixedValue;
value uniform 10;
}

velocity-inlet-6
{
type fixedValue;
value uniform 10;
}

pressure-outlet-7
{
type fixedValue;
value uniform 0;
}

wall-8
{
type zeroGradient;
}

frontAndBackPlanes
{
type empty;
}
}

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



/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM Extend Project: Open Source CFD |
| \\ / O peration | Version: 1.6-ext |
| \\ / A nd | Web: www.extend-project.de |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [0 1 -1 0 0 0 0];

internalField uniform (0 0 0);

boundaryField
{
wall-4
{
type fixedValue;
value uniform (0 0 0);
}

velocity-inlet-5
{
type zeroGradient;
}

velocity-inlet-6
{
type zeroGradient;
}

pressure-outlet-7
{
type zeroGradient;
}

wall-8
{
type fixedValue;
value uniform (0 0 0);
}

frontAndBackPlanes
{
type empty;
}
}






mihaipruna April 19, 2012 11:11

this is the velocity driven flow, not pressure driven.

kmooney April 19, 2012 11:15

I've assigned a fixed deltaP between the inlets and the outlets. Dirchlet BC's are assigned for U at the walls only as no slip, no penetration. Von Neumann conditions at the inlet and outlet for U.

Please explain your reasoning for describing this as a velocity driven flow.

mihaipruna April 19, 2012 11:25

my bad, since the patches were named velocity, didn't look at the header properly :)
sorry
thanks

saba_saeb April 19, 2012 16:38

I think you just missed to specify a value for gamma, in case of using totalpressure, you also have to set a value for gamma, the boundary conditions that you sent in your first posts seem right.

mihaipruna April 20, 2012 12:48

Quote:

Originally Posted by saba_saeb (Post 355719)
I think you just missed to specify a value for gamma, in case of using totalpressure, you also have to set a value for gamma, the boundary conditions that you sent in your first posts seem right.

Thanks.
I also had to change value uniform to p0 uniform.
it's running now with inlet specifying total pressure.
keep your fingers crossed.

saba_saeb April 21, 2012 15:25

Quote:

Originally Posted by mihaipruna (Post 355876)
Thanks.
I also had to change value uniform to p0 uniform.
it's running now with inlet specifying total pressure.
keep your fingers crossed.

Good to hear that, but do you happen to know why we are supposed to use totalpressure boundary condition instead of fixedValue at inlet? I've read somewhere in the forum that it does not physically make sense to set both inlet and outlet fixedValue when we are considering pressure driven flow, but I didn't figure out the reason.

Cheers,
Saba

mihaipruna April 21, 2012 18:10

from what i understand, it has to do with the way pressure is transmitted via waves. if you set both inlet and outlet to fixed pressures you are overconstraining the problem.
i think if you set fixed inlet you have to set wavetransmissive at the outlet.
with total pressure,it adjusts itself i guess.
not sure :)


my solution even with total pressure at inlet has a singularity and i am trying to figure out if the mesh is causing it or something else.

lobstar August 13, 2012 10:16

What does gamma stand for in openFOAM?

Tobi August 30, 2012 03:53

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


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