CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

SimpleFoam - incorrect pressure result

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Tobermory

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 19, 2021, 12:48
Default SimpleFoam - incorrect pressure result
  #1
OBG
New Member
 
Join Date: Nov 2020
Posts: 3
Rep Power: 5
OBG is on a distinguished road
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);
}

// ************************************************************************* //
OBG is offline   Reply With Quote

Old   April 20, 2021, 16:34
Default
  #2
Senior Member
 
Klaus
Join Date: Mar 2009
Posts: 252
Rep Power: 22
klausb will become famous soon enough
There are plenty of tutorials online which cover your case e.g.:

http://files.the-foam-house5.webnode...pter4_Pipe.pdf
klausb is offline   Reply With Quote

Old   April 21, 2021, 10:12
Default
  #3
OBG
New Member
 
Join Date: Nov 2020
Posts: 3
Rep Power: 5
OBG is on a distinguished road
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
OBG is offline   Reply With Quote

Old   April 22, 2021, 16:15
Default
  #4
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 670
Rep Power: 14
Tobermory will become famous soon enough
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!
HPE likes this.
Tobermory is offline   Reply With Quote

Old   April 23, 2021, 06:27
Default
  #5
OBG
New Member
 
Join Date: Nov 2020
Posts: 3
Rep Power: 5
OBG is on a distinguished road
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

mesh_used.jpg

Mesh_viscousLayers.jpg
OBG is offline   Reply With Quote

Old   April 27, 2021, 07:46
Default
  #6
Senior Member
 
Klaus
Join Date: Mar 2009
Posts: 252
Rep Power: 22
klausb will become famous soon enough
Try a structured mesh with a case specific boundary layer mesh with y+ < 1.
klausb is offline   Reply With Quote

Old   April 27, 2021, 10:56
Default
  #7
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 670
Rep Power: 14
Tobermory will become famous soon enough
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!
Tobermory 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


Similar Threads
Thread Thread Starter Forum Replies Last Post
simpleFoam - pressure igor.leo93 OpenFOAM Post-Processing 5 August 24, 2016 06:12
CFX Solver stopped with error when requested for backup during solver running Mfaizan CFX 40 May 13, 2016 06:50
simpleFoam - pressure (coefficient) of head shape GJM1991 OpenFOAM Running, Solving & CFD 4 May 12, 2015 17:15
[swak4Foam] Swak4Foam/GroovyBC for total pressure in simpleFoam fivos OpenFOAM Community Contributions 5 February 14, 2014 11:51
Neumann pressure BC and velocity field Antech Main CFD Forum 0 April 25, 2006 02:15


All times are GMT -4. The time now is 12:47.