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 + cyclic pipe = unstable? (https://www.cfd-online.com/Forums/openfoam-solving/145056-simplefoam-cyclic-pipe-unstable.html)

RodriguezFatz November 27, 2014 05:25

simpleFoam + cyclic pipe = unstable?
 
3 Attachment(s)
Hi all,

I usually use profile for U,k,epsilon,omega from cyclic pipe simulations as input for my actual case. Unfortunately, I don't get them converged in openFOAM.

So the setup is a short pipe that I mesh with ICEM:
Attachment 35559

After loading the mesh to openFoam (fluent3dMeshtoFoam), I change the constant/polyMesh/boundary file to:
Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.3.x                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      polyBoundaryMesh;
    location    "constant/polyMesh";
    object      boundary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

3
(
    PER_PIPE_INLET
    {
        type            cyclic;
        nFaces          3060;
        startFace      170068;
        neighbourPatch    PER_PIPE_OUTLET;
    }
    PER_PIPE_OUTLET
    {
        type            cyclic;
        nFaces          3060;
        startFace      173128;
        neighbourPatch    PER_PIPE_INLET;
    }
    PER_PIPE_WALL
    {
        type            wall;
        inGroups        1(wall);
        nFaces          2584;
        startFace      176188;
    }
)
// ************************************************************************* //

Then, I change every boundary condition (p,U,k,epsilon) for the inlet and outlet in my 0/ directory to "cyclic":
Code:

PER_PIPE_INLET
    {
        type cyclic;
    }

    PER_PIPE_OUTLET
    {
        type cyclic;
    }

I set the system/fvOptions to
Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.2.1                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    location    "system";
    object      fvOptions;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

momentumSource
{
    type            pressureGradientExplicitSource;
    active          on;            //on/off switch
    selectionMode  all;      //cellSet // points //cellZone

    pressureGradientExplicitSourceCoeffs
    {
        fieldNames  (U);
        Ubar        ( 70 0 0 );
    }
}


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

In this case, I use realizableKE model with wallfunctions for the pipe walls. But this whole problem also happens for wall resolved flow and other turbulence models.

This is how a typical residual plot looks like:
Attachment 35560

So I get these crazy jumps in residuals and no smooth convergence at all. However, profiles of the solution look reasonable (here "U"):

Attachment 35561

What I already tried:
  • all different kinds of schemes, for gradient, with and without limiters, also for convective fluxes. Laplacian with and without correction... I think I tried every possible combination in that file...
  • solver settings, more or less tolerance, reducing relaxation factors,...
  • changing initial conditions
I know from a different thread, that others have comparable problems with channel flows + cyclic + simpleFoam.


Now: Can anyone please help me? :(

RodriguezFatz November 27, 2014 10:06

1 Attachment(s)
With the mappedPatch boundary I get pretty nice convergence, just as I expected:
Attachment 35569

alexeym November 27, 2014 12:05

2 Attachment(s)
Hi,

maybe I my guess on dimensions of the tube is not quite correct. Here's the case (attached to the message) with cyclic inlet/outlet and it seems to be converging (though rather slow). I've stopped simulation around 900th iteration (decided to reduce relTol of linear solvers and it seems to increase convergence rate), residuals evolution plot is also attached to the message.

As usual, mesh is in GEO format, so you need Gmsh to run the case.

alexeym November 27, 2014 15:26

Though it seems, simulation got stuck at pressure residuals of order 1e-2.

RodriguezFatz November 28, 2014 06:13

Right, it's always like "Yeahaaa it works!!! .... well... no..."

itchy November 28, 2014 06:42

Hi Philipp,

I have the same problem with pipe. When I do the simulation with LES it works fine, but with RANS I don't get a convergent case.

For RANS I tried pimpleFoam and simpleFoam. The results looks not so bad (but not good enough), but the residuals are far from good.

How do you use mappedPatch boundary for pipeflow???
Do you use it with fvOptions??

kind regard
Florian

RodriguezFatz December 1, 2014 03:53

Hi,

I changed the boundary file to
Code:

Inlet
    {
        type            mappedPatch;
        samplePatch    Outlet;
        sampleMode    nearestPatchFace;
        offsetMode uniform;
        offset (0 0 0.075);
        nFaces 6180;
        startFace 3689820;
    }
    Outlet
    {
              type patch;
              nFaces 6180;
              startFace 3696000;
    }

and deleted the fvOptions. "Offset" is obviously the offset between inlet and outlet.
Now, in my "0" directory I made some changes:
Velocity:
Code:

    Inlet
    {
        type mapped;
    value uniform (0 0 9.2);
    setAverage true;
    average (0 0 9.2);
    }
    Outlet
    {
        type inletOutlet;
    inletValue uniform (0 0 0);
    value uniform (0 0 0);
    }

Here, velocity will be regulated to an average of 9.2

pressure:
Code:


  Inlet
    {
        type            zeroGradient;
    }
    Outlet
    {
        type fixedValue;
        value uniform 0;
    }

All other values, such as "k":
Code:

    Inlet
    {
        type            mapped;
    value          uniform 1e-12;
    setAverage    false;
    average    1e-12;
    }
    Outlet
    {
        type        inletOutlet;
    inletValue    uniform 1e-12;
    value uniform    1e-12;
    }

I hope it works.
Philipp.

itchy December 1, 2014 04:56

Hi Philipp,

thx for your help.
k-epsilon works now. I will test some other models (k-omega, v2f ...).
I am a little bit confused why the cyclic bc + fvOptions does not work. I have done it with LES and everything works, but for RANS no chance.

kind regards
Florian

RodriguezFatz December 1, 2014 05:17

I read a comment in this forum (don't know where) where someone states, that he thinks SIMPLE needs some kind of additional correction to work with cyclic. I don't know if that is true, but if PIMPLE / PISO works and SIMPLE doesn't it is at least some good idea...

itchy December 1, 2014 05:28

Hi,

I have tested it with piso and pimple. The convergence was better but not good. With PISO/Pimple you can do some pseudo-timestepping. This improves your convergence. This works as well with the mapped bc. I will give it a shot and compare the rate of convergence.

I can live with your solution (using mapped boundary + SIMPLE). :)

kind regards
Florian


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