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/)
-   -   SimpleFoam - incorrect pressure result (https://www.cfd-online.com/Forums/openfoam-solving/235561-simplefoam-incorrect-pressure-result.html)

OBG April 19, 2021 12:48

SimpleFoam - incorrect pressure result
 
Dear all,


I've been working on a case with a cylindrical pipe and internal laminar flow. When I run the simulation, I conclude that the pressure drop over the length of the pipe is incorrect. Can someone help me to solve this?

When this model gives me correct results, I would like to add the totalPressure condition at the inlet and pressureInletvelocity at the outlet. Finally I want to be able to conduct a turbulent simulation.

Since my mesh is made out of tetrahedral elements using Salome, I changed the snGradSchemes to leastSquares in fvSchemes. Is this possible or would it be better to use Gauss linear?

At the inlet I define the velocity to a fixedValue, but there is also a noSlip condition on the wall of the pipe. I noticed that some sort of "high pressure concentration" form at the inlet near the wall. Is this because of those contradicting definitions (fixedValue vs noSlip)?


Thank you in advance!


Sincerely,


Gijs


p
Code:

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

//#include        "include/initialConditions"

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

internalField  uniform 0;

boundaryField
{
    //- Set patchGroups for constraint patches
//    #includeEtc "caseDicts/setConstraintTypes"

    Inlet
    {
        type        zeroGradient; //totalPressure;
                          //p0        uniform 0.1;

     
    }
    Outlet
    {
        type            fixedValue;
        value          uniform 0;
       
    }
   
    Wall
    {
        type            zeroGradient;
    }
  //  #include "include/frontBackUpperPatches"
}

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

U
Code:

/*--------------------------------*- C++ -*----------------------------------*\
  =========                |
  \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox
  \\    /  O peration    | Website:  https://openfoam.org
    \\  /    A nd          | Version:  8
    \\/    M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      volVectorField;
    location    "0";
    object      U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

//#include        "include/initialConditions"

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

internalField  uniform (0 0 0);

boundaryField
{
    //- Set patchGroups for constraint patches
    //#includeEtc "caseDicts/setConstraintTypes"

    //#include "include/fixedInlet"

  Inlet
    {
        type            fixedValue; //pressureInletVelocity;
        value        uniform (0.01 0 0); //(0.01 0 0)
       
       
    }
    Outlet
    {
        type            zeroGradient;
    }

   
    Wall
    {
        type            noSlip;
    }

    //#include "include/frontBackUpperPatches"
}


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

fvSchemes
Code:

/*--------------------------------*- C++ -*----------------------------------*\
  =========                |
  \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox
  \\    /  O peration    | Website:  https://openfoam.org
    \\  /    A nd          | Version:  8
    \\/    M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    object      fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

ddtSchemes
{
    default        steadyState;
}

gradSchemes
{
    default            leastSquares; //Gauss linear;
    //grad(U)        cellLimited Gauss linear 1;
}

divSchemes
{
    default        none;
    div(phi,U)      bounded Gauss linearUpwindV grad(U);
    div(phi,k)      bounded Gauss upwind;
    div(phi,omega)  bounded Gauss upwind;
    div((nuEff*dev2(T(grad(U))))) Gauss linear;
}

laplacianSchemes
{
    default        Gauss linear corrected;
    //default        Gauss linear limited corrected 0.5;
}

interpolationSchemes
{
    default        linear;
}

snGradSchemes
{
    default        corrected;
    //default        limited corrected 0.5;
}

wallDist
{
    method meshWave;
}


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

fvSolutions
Code:

/*--------------------------------*- C++ -*----------------------------------*\
  =========                |
  \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox
  \\    /  O peration    | Website:  https://openfoam.org
    \\  /    A nd          | Version:  8
    \\/    M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    object      fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

solvers
{
    p
    {
        solver          GAMG;
        smoother        GaussSeidel;
        tolerance      1e-7;
        relTol          0.01;
    }

    Phi
    {
        $p;
    }

    U
    {
        solver          smoothSolver;
        smoother        GaussSeidel;
        tolerance      1e-8;
        relTol          0.1;
        nSweeps        1;
    }

    k
    {
        solver          smoothSolver;
        smoother        GaussSeidel;
        tolerance      1e-8;
        relTol          0.1;
        nSweeps        1;
    }

    omega
    {
        solver          smoothSolver;
        smoother        GaussSeidel;
        tolerance      1e-8;
        relTol          0.1;
        nSweeps        1;
    }
}

SIMPLE
{
    nCorrectors          0;
    nNonOrthogonalCorrectors 0;
    consistent yes;
}

potentialFlow
{
    nNonOrthogonalCorrectors 0;
}

relaxationFactors
{
    fields
    {
        p        0.3;
    }
    equations
    {
        U              0.9;
        k              0.7;
        omega          0.7;
    }
}

cache
{
    grad(U);
}

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


klausb April 20, 2021 16:34

There are plenty of tutorials online which cover your case e.g.:

http://files.the-foam-house5.webnode...pter4_Pipe.pdf

OBG April 21, 2021 10:12

Dear klausb,

Thank you for your response. I've read the document, but I concluded that I already tried those BC's and settings in the system files.

Do you have any tips for me or have you managed to find a mistake in my codes?

Thank you in advance.

Sincerely,

Gijs

Tobermory April 22, 2021 16:15

Dear Gijs - there's quite a lot about your case that you're not telling us, and my telepathy powers are not great, so let me ask a few questions, that might help you think this through logically:

1. Is your pipe straight, or does it have bends? What is the "correct value" are you comparing against?
2. Where are you measuring your dp? Right from the inlet? Bear in mind that you are applying a tophat velocity profile, instead of a developed profile and that the flow will develop over the first few diameters or so ...
3. What is your mesh quality? What is your mesh resolution? Have you tried increasing the resolution, and if so do the results change (in which case you are not yet mesh independent). Remember, the root of all evil/pain if often the mesh (when it's not the boundaries)
4. You have 1st order differencing on turbulence - clearly not an issue for your laminar flow, but a note to you to change that for later, turbulent runs.

Trying to fix this will clearly be frustrating for you, but the good news is that you will learn a lot about OF in the process - so good luck!

OBG April 23, 2021 06:27

2 Attachment(s)
Dear Tobermory,

I indeed may have forgotten to mention all the details.

To anwser your first question:
The pipe is indeed straight, you can compare it with an exdruded cylinder. The correct value I'm comparing with is for this case 0.064 Pa pressure drop based on formula's found in "Fluid Mechanics Fundamentals and Applications (Cengel)". Later I've found this calculator which gives me the same results as my manual calculations: https://www.lmnoeng.com/Pressure/PressureDrop.php

At first I measured the dp at the inlet and outlet. I quickly realised that, as you wrote in your post, the flow is not fully developed at the inlet. When measuring the pressure 10cm further down the pipe we should get a value of 0.051 Pa. The obtained values from OF are about 0.1 - 0.2 Pa.

I begin to doubt that indeed the mesh quality could be a problem. Since I use Tet elements, the non-orthogonality isn't ideal. I already tried to decrease the size of the elements including adding a growth rate of 30% and adding viscous layers, but this gave me the same deviatons in pressure drop.
Attached you can find the mesh used for the simulation and an other screenshot of a mesh with viscous layers i created in Salome. At first sight, could these be a problem using laminar simulations?

Thank you for your response and encouraging words. I learned a lot of OF during the last half year. The learning process is challenging, but rewarding when you reach your goals.

Sincerely,

Gijs

Attachment 83961

Attachment 83962

klausb April 27, 2021 07:46

Try a structured mesh with a case specific boundary layer mesh with y+ < 1.

Tobermory April 27, 2021 10:56

That's a good description Gijs - it's clear what you are trying to do now. I agree with Klaus that a layered mesh next to the wall will probably give you better results, and you need much better near wall resolution (remember that without a wall function, your wall gradient, which is proportional to the shear stress, is Up/yp, where Up is the velocity in the near wall cell and yp is the wall distance of the first cell; now you can start to see the impact of a coarse mesh). It's trickier to build such a structured mesh, but it will allow you to control the near wall spacing much better.

Note also that an alternative simple measure instead of the pressure drop is the wall shear stress, which you can plot directly in paraFoam.

Good luck!


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