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/)
-   -   Boundary Layer strange result (https://www.cfd-online.com/Forums/openfoam-solving/147142-boundary-layer-strange-result.html)

fernexda January 14, 2015 04:18

Boundary Layer strange result
 
2 Attachment(s)
Dear all,
I'm coming to you because I'm facing a boundary layer problem on a simulation...

I'm simulating a body in a flow with an inlet velocity Ux=5m/s. But right from the first iterations, the results close to the body gets strange... This can be seen on the attached pictures.

One can see that the velocity is 0 on the wall, but gets much bigger around the first cell, and then decreases again. And because of this my simulation blows up after a few iterations.

What I've done :
  • Turbulent/laminar simulation
  • Different algorithms (SIMPLE,PISO,PIMPLE, changin nCorrections and nOuterCorrections)
  • Different fvSolutions
  • Different fvSchemes (diffusive schemes for better convergence, and more accurate schemes)
  • OpenFoam 2.1 and 2.3
None of this could solve my problem. The only thing that did work is decreasing the cells' size around the wall. But my goal is to use a wall function so that I can have bigger cells (and increase the timeStep). So reducing the mesh size goes against this goal.


I'm running out of ideas, so if anyone has any hint it would be very appreciated !


Regards,
Daniel

RodriguezFatz January 14, 2015 07:07

Daniel, what do you need, steady-state or unsteady solutions?

fernexda January 14, 2015 07:46

Hi, thanks for the quick reply.

In the end I need an unsteady simulation with moving mesh (with pimpleDyMFoam), but the error occurs for all cases.

I am currently trying with a steady-state simulation to check the mesh convergence (minimum mesh size to have a mesh-independent solution).

RodriguezFatz January 14, 2015 07:47

That means simpleFoam? Then post the log output of that until it becomes ugly...

fernexda January 14, 2015 08:53

4 Attachment(s)
Yes I'm using simpleFoam.

Here a sample of the log :

Code:

Time = 319

smoothSolver:  Solving for Ux, Initial residual = 0.057221157, Final residual = 3.568287e-06, No Iterations 16
smoothSolver:  Solving for Uy, Initial residual = 0.063087545, Final residual = 4.5084555e-06, No Iterations 18
GAMG:  Solving for p, Initial residual = 0.0037987384, Final residual = 2.7417897e-07, No Iterations 23
GAMG:  Solving for p, Initial residual = 0.00020201867, Final residual = 9.5084443e-08, No Iterations 12
time step continuity errors : sum local = 1.6112304, global = -0.03484718, cumulative = -0.77715832
smoothSolver:  Solving for nuTilda, Initial residual = 0.046411558, Final residual = 4.2056708e-06, No Iterations 3
ExecutionTime = 870.68 s  ClockTime = 886 s

forces forcesPaddle0 output:
    sum of forces:
        pressure : (0 0 0)
        viscous  : (2.6813238e+13 5.6435289e+11 -1.4963997)
        porous  : (0 0 0)
    sum of moments:
        pressure : (0 0 0)
        viscous  : (-2.8217644e+11 1.3406619e+13 -2.6081707e+13)
        porous  : (0 0 0)

forceCoeffs forceCoeffsPaddle0 output:
    Cm    = -5.2163414e+11
    Cd    = 5.3626477e+11
    Cl    = 1.1287058e+10
    Cl(f) = -5.1599061e+11
    Cl(r) = 5.2727767e+11

forceCoeffs forceCoeffsPaddle1 output:
    Cm    = -96904.785
    Cd    = -66422.036
    Cl    = 297601.6
    Cl(f) = 51896.014
    Cl(r) = 245705.58

Time = 320

smoothSolver:  Solving for Ux, Initial residual = 0.052995367, Final residual = 4.8433206e-06, No Iterations 15
smoothSolver:  Solving for Uy, Initial residual = 0.062183782, Final residual = 5.6252108e-06, No Iterations 17
GAMG:  Solving for p, Initial residual = 0.0037642096, Final residual = 3.4332139e-07, No Iterations 21
GAMG:  Solving for p, Initial residual = 0.00017745207, Final residual = 5.9287776e-08, No Iterations 12
time step continuity errors : sum local = 1.085192, global = -0.02221701, cumulative = -0.79937533
smoothSolver:  Solving for nuTilda, Initial residual = 0.061514173, Final residual = 3.6499883e-06, No Iterations 3
ExecutionTime = 874.44 s  ClockTime = 890 s

forces forcesPaddle0 output:
    sum of forces:
        pressure : (0 0 0)
        viscous  : (3.1377491e+13 6.8424339e+11 -1.8496672)
        porous  : (0 0 0)
    sum of moments:
        pressure : (0 0 0)
        viscous  : (-3.421217e+11 1.5688745e+13 -3.0631529e+13)
        porous  : (0 0 0)

forceCoeffs forceCoeffsPaddle0 output:
    Cm    = -6.1263058e+11
    Cd    = 6.2754982e+11
    Cl    = 1.3684868e+10
    Cl(f) = -6.0578814e+11
    Cl(r) = 6.1947301e+11

forceCoeffs forceCoeffsPaddle1 output:
    Cm    = -114884.08
    Cd    = -78823.833
    Cl    = 351014.44
    Cl(f) = 60623.139
    Cl(r) = 290391.3

Time = 321

And some results are shown on the pictures.

And as I said, this simulation works just fine when the mesh on the BL is finer.

RodriguezFatz January 14, 2015 08:58

1) In my experience your linear solvers take too many iterations in each outer (SIMPLE) iteration. Did you set relTol to 1e-4? This is normally not needed in SIMPLE. But fixing this will make your solver only faster... not better ;) You can post the fvSolution to get some help.
2) Can you post checkMesh output and fvSchemes? What about your boundary conditions? Are you sure, they are correct? If not, you can post them, too.

fernexda January 14, 2015 09:18

I'm rather confident about the boundary conditions. After trying many of them, the only one working are those from the motorBike example (with Spalart-Allmaras model).

The problem occurs with different schemes (accurate as well as diffusive schemes).

Same with the tolerances. I've tried with maxIter=1000 (tolerance and relTol = 0) just for fun, and it still doesn't work.

To sum up, the problem appears as soon as I increase the cells size around the body. I understand this could cause troubles with a turbulent case without using a wall function, but it also causes troubles in laminar...

Concerning the wall function, as far as I know I just have to specify the wall function in 0/nut, right ? Are the initial conditions as posted here ok considering I'm using a wall function ?

nut

Code:


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

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

internalField  uniform 0;


boundaryField
{
    Inlet
    {
        type            calculated;
        value          uniform 0;
    }
    Outlet
    {
        type            calculated;
        value          uniform 0;
    }
    upperSym
    {
        type            symmetryPlane;
        value          uniform 0;
    }
    lowerSym
    {
        type            symmetryPlane;
        value          uniform 0;
    }
    paddle0
    {
        type            nutUSpaldingWallFunction;
        value          uniform 0;
    }
    paddle1
    {
        type            nutUSpaldingWallFunction;
        value          uniform 0;
    }
    AMI_P0S
    {
        type            cyclicAMI;
        value          $internalField;
    }
    AMI_P1S
    {
        type            cyclicAMI;
        value          $internalField;
    }
    AMI_SP0
    {
        type            cyclicAMI;
        value          $internalField;
    }
    AMI_SP1
    {
        type            cyclicAMI;
        value          $internalField;
    }
    AMI_SF
    {
        type            cyclicAMI;
        value          $internalField;
    }
    AMI_FS
    {
        type            cyclicAMI;
        value          $internalField;
    }
}


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

nuTilda

Code:

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

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

internalField    uniform 0.05;
//internalField  uniform 0.05;

boundaryField
{
    Inlet
    {
        type            fixedValue;
        value          uniform 0.05;
    }
    Outlet
    {
        type            inletOutlet;
        inletValue      uniform 0.05;
        value          uniform 0.05;
    }
    upperSym
    {
        type            symmetryPlane;
    }
    lowerSym
    {
        type            symmetryPlane;
    }
    paddle0
    {
        type            fixedValue;
        value          uniform 0;
    }
    paddle1
    {
        type            fixedValue;
        value          uniform 0;
    }
    AMI_P0S
    {
        type            cyclicAMI;
        value          $internalField;
    }
    AMI_P1S
    {
        type            cyclicAMI;
        value          $internalField;
    }
    AMI_SP0
    {
        type            cyclicAMI;
        value          $internalField;
    }
    AMI_SP1
    {
        type            cyclicAMI;
        value          $internalField;
    }
    AMI_SF
    {
        type            cyclicAMI;
        value          $internalField;
    }
    AMI_FS
    {
        type            cyclicAMI;
        value          $internalField;
    }
}


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

U

Code:

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


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

internalField  uniform (5 0 0);

boundaryField
{
    Inlet
    {
      type              fixedValue;
      value            uniform (5 0 0);
    }
    Outlet
    {
        type            inletOutlet;
        inletValue      uniform (0 0 0);
        value          uniform (5 0 0);
    }
    upperSym
    {
        type            symmetryPlane;
    }

    lowerSym
    {
        type            symmetryPlane;
    }
    paddle0
    {
        type            fixedValue;
        value          uniform (0 0 0);
    }
    paddle1
    {
        type            fixedValue;
        value          uniform (0 0 0);
    }
    AMI_P0S
    {
        type            cyclicAMI;
        value          $internalField;
    }
    AMI_P1S
    {
        type            cyclicAMI;
        value          $internalField;
    }
    AMI_SP0
    {
        type            cyclicAMI;
        value          $internalField;
    }
    AMI_SP1
    {
        type            cyclicAMI;
        value          $internalField;
    }
    AMI_SF
    {
        type            cyclicAMI;
        value          $internalField;
    }
    AMI_FS
    {
        type            cyclicAMI;
        value          $internalField;
    }

}


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

p

Code:

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

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

internalField  uniform 0;

boundaryField
{
    Inlet
    {
        type            zeroGradient;
    }
    Outlet
    {
        type            fixedValue;
        value          uniform 0;
    }
    upperSym
    {
        type            symmetryPlane;
    }
    lowerSym
    {
        type            symmetryPlane;
    }
    paddle0
    {
        type            fixedValue;
        value          uniform 0;
    }
    paddle1
    {
        type            fixedValue;
        value          uniform 0;
    }
    AMI_P0S
    {
        type            cyclicAMI;
        value          $internalField;
    }
    AMI_P1S
    {
        type            cyclicAMI;
        value          $internalField;
    }
    AMI_SP0
    {
        type            cyclicAMI;
        value          $internalField;
    }
    AMI_SP1
    {
        type            cyclicAMI;
        value          $internalField;
    }
    AMI_SF
    {
        type            cyclicAMI;
        value          $internalField;
    }
    AMI_FS
    {
        type            cyclicAMI;
        value          $internalField;
    }

}


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


RodriguezFatz January 14, 2015 09:20

paddle0 and paddle1 are walls? If so, why did you set pressure to zero and not zerogradient?

fernexda January 14, 2015 09:25

Oh my god............

I hadn't noticed, it the same for all simulations I've run......... I guess I'm sometimes being confused with all the files... This could definitely create problems...

I change this and I keep you posted. Thank you for seeing this !

fernexda January 14, 2015 09:28

And concerning the wall function definition, do you agree on what I've put ?

RodriguezFatz January 14, 2015 09:29

I don't use SA-model but the airfoil2d tutorial uses it the same way.

fernexda January 15, 2015 07:14

Ok, that was the problem... Everything works just fine now !

I would never have thought the error could come from initial conditions... Thanks a lot for this, you saved me many hours of work !

Regards,
Daniel

RodriguezFatz January 15, 2015 07:16

Maybe just a typo, but it should be "boundary" not "initial" conditions in your last post.

fernexda January 15, 2015 07:18

You don't miss anything :)

It's boundary condition indeed.

RodriguezFatz January 15, 2015 07:21

Now you can tune your solver settings to get rid of these horrible iterations. If you need any consecutive help or are not sure just post again.


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