CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

How to use pressureInletVelocity BC

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 6, 2021, 06:28
Default How to use pressureInletVelocity BC
  #1
New Member
 
Belgium
Join Date: Nov 2021
Posts: 9
Rep Power: 4
fceyhuns is on a distinguished road
Hello,

How are we supposed to use pressureInletVelocity BC? This BC requires a value input and when I use it for U inlet, for which I define totalPressure in p file, it acts like a fixedValue (0 0 0) and no flow occurs on the domain.

I tried imposing a static pressure at the inlet but due to U (0 0 0), OpenFoam converts it equal to the totalPressure at all time steps. No surprise there is no flow when I have p=p0 and U = (0 0 0) at the inlet but how to make sure that U will vary at the inlet using pressureInletVelocity condition?



Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  5                                     |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     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
{
    inlet
    {
        type            pressureInletVelocity;
	value			uniform (0 0 0);
    }
    pressout
    {
        type            zeroGradient;
    }

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  5                                     |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    object      p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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

internalField   uniform 75050;

boundaryField
{
    inlet
    {
        type            totalPressure;
		p0				uniform 75050;
		U				U;
		gamma			1.4;
		value			uniform 75050;
		
    }
    pressout
    {
        type            waveTransmissive;
        field           p;
        psi             thermo:psi;
        gamma           1.4;
        fieldInf        7505;
        lInf            0.1;
        value           uniform 7505;
    }
fceyhuns is offline   Reply With Quote

Old   December 6, 2021, 08:41
Default
  #2
Member
 
Join Date: May 2017
Posts: 31
Rep Power: 9
sqek is on a distinguished road
Hello
The "Value" in pressureInletVelocity (and most things other than fixedValue) is a starting / placeholder value, not a fixed value - it only gets used before the first timestep, and gets overwritten during calculation

I notice that your internalField for p is set to your inlet pressure, so initially there won't be any flow at the inlet - until the lower pressure from fieldInf of your waveTransmissive outlet reaches it - and waveTransmissive applies fieldInf very slowly/gently, especially if lInf is long.

I'd set the internalField for p lower, then you should see flow straight away.
Also set internalField for U at a rough estimate of the mean velocity you're expecting, if you want it to converge / stabilise faster

So at the moment, whether you set p to be totalPressure or fixedValue, the reason you're getting no flow is that the internal cells next to the boundary are at the same pressure, not the boundary condition
sqek is offline   Reply With Quote

Old   December 6, 2021, 10:04
Default
  #3
New Member
 
Belgium
Join Date: Nov 2021
Posts: 9
Rep Power: 4
fceyhuns is on a distinguished road
Hello,

Thank you for your reply. Indeed for my knowledge that uniform value in pressureInletVelocity should only be a place holder however even if I put a static pressure value for inlet p (again a placeholder as the real BC is totalPressure) and the same static pressure as internal field initial condition, even with a non zero velocity for the internal field, I have no chance; OpenFoam fixes the static pressure at the inlet patch equal to total pressure and U to (0 0 0).

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  5                                     |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volVectorField;
    object      U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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

internalField   uniform (200 0 0);

boundaryField
{
    inlet
    {
        type            pressureInletVelocity;
		value			uniform (0 0 0);
    }
    pressout
    {
        type            zeroGradient;
    }

And I change p at pressureout to fixedValue to avoid slow progress of linf
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  5                                     |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    object      p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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

internalField   uniform 45000;

boundaryField
{
    inlet
    {
        type            totalPressure; 
		p0				uniform 75050;
		U				U;
		gamma			1.4;
		value			uniform 45000;
    }

    pressout
    {
        type            fixedValue;//waveTransmissive;
        value           uniform 7505;
    }
This is what I get for U:

Code:
(200 0.000396939 -0.000887003)
(200.001 0.010414 -0.0152804)
(200.01 0.0760145 -0.0261665)
(200 -0.000276074 -0.000678273)
(199.997 -0.00869393 -0.0139102)
(199.984 -0.0702511 -0.0244416)
(200 -0.000419646 -0.000865027)
(200.001 -0.0107308 -0.014821)
(200.011 -0.07769 -0.0258525)
(199.594 0.942092 -0.107135)
(197.422 0.861485 0.205162)
(199.427 0.224747 0.591596)
)
;

boundaryField
{
    inlet
    {
        type            pressureInletVelocity;
        value           uniform (-0 0 0);
    }
    pressout
    {
        type            zeroGradient;
    }
and p:

Code:
44999.8
44997.4
44985.8
44824.8
43634.3
44966.2
)
;

boundaryField
{
    inlet
    {
        type            totalPressure;
        rho             rho;
        psi             none;
        gamma           1;
        p0              uniform 75050;
        value           uniform 75050;
    }
    pressout
    {
        type            fixedValue;
        value           uniform 7505;
    }
I could understand a slow convergence but which mechanism is fixing the uniform p value at inlet back to p0 although I defined a lower starting value in the 0 folder?
fceyhuns is offline   Reply With Quote

Old   December 6, 2021, 15:53
Default
  #4
Member
 
Join Date: May 2017
Posts: 31
Rep Power: 9
sqek is on a distinguished road
I wonder if there could be a problem with your mesh, like if some face normals are pointed the wrong way? does checkMesh say anything?
Also, are you entirely sure that your flow direction is from the inlet? pressureInletVelocity can cause problems for crossflow or reversed flow

Can you visualise your pressure and velocity fields in paraview? From the tail end of the internalField section, it looks like the flow is different from your initial condition, but not by much - maybe have a look using paraview and see what's happening in the cells near the boundary, if that might give you a clue.

Also have you done anything that might change the names of your phi and rho fields, as those are read to calculate velocities from the flux

Also maybe try setting a zeroGradient for the inlet velocity - it probably won't be very stable as the flow direction isn't constrained (whereas pressureInletVelocity forces the flow to be normal to the boundary), but might show if it's pressureInletVelocity or something else that's causing the problem
sqek is offline   Reply With Quote

Old   December 7, 2021, 04:19
Default
  #5
New Member
 
Belgium
Join Date: Nov 2021
Posts: 9
Rep Power: 4
fceyhuns is on a distinguished road
Hello,

Thank you for your comments.

I did checkMesh and there are only 2 faces with high skewness where the limit is 4 and max. skewness is 4 point something. I know that the stl files are clean, and I used them in snappyHexMesh.

I am setting the inlet p0 10 times the static p on the other faces so I cannot imagine flow coming from another direction. Is it possible? How?

The sample U an p files are from the first time step (1e-5), so the change from 0 is very little, that's normal I guess. Attached are U and p near the inlet at time 4e-5. To me it seems like a low pressure is propagating into the field while leaving the inlet always at p=p0.

I have already tried different inlet BC's, trying to find the correct match to my problem. However I never observed reverse flow at the inlet and a pressure and U were always been calculated at the inlet, never set to p0 and (0 0 0) by the solver.
Attached Images
File Type: png Uat4e_5.png (51.1 KB, 8 views)
File Type: png pat4e_5.png (55.7 KB, 6 views)
fceyhuns is offline   Reply With Quote

Old   December 7, 2021, 04:23
Default
  #6
New Member
 
Belgium
Join Date: Nov 2021
Posts: 9
Rep Power: 4
fceyhuns is on a distinguished road
And I did not do anything to change the names of phi and rho fields, at least nothing intentionally.
fceyhuns is offline   Reply With Quote

Old   December 8, 2021, 08:34
Default
  #7
Member
 
Join Date: May 2017
Posts: 31
Rep Power: 9
sqek is on a distinguished road
That is very strange...
Check if your inlet is defined as a patch in constant/polyMesh/boundary? That could override the patch settings if it isn't.
Also, if you untick "Interpolate Volume Fields" in paraview, it gives each cell a uniform colour and shows you what OpenFoam's doing internally better. (or untick "Create cell-to-point filtered data" if using the other reader)
And tick "Use VTK Polyhedron" to get rid of the lines across your polyhedral cells (or untick Decompose polyhedra)
And guessing in your images that red is high, blue is low?

Have you tried running it for a little longer and seeing if it's some kind of weird transient for the first few iterations?

Also, maybe check system/fvSolution if solveFlow is true, nCorrectors etc aren't zero, and see if there's anything weird in fvSchemes or fvOptions

And maybe try making a new case, with a simple small (say 10x10x10 cell) blockmesh, with the same boundary conditions, and replace files and settings from something in $FOAM_TUTORIALS one-by-one until it works, to pinpoint where the problem is
sqek is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On



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