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 convergence issue (https://www.cfd-online.com/Forums/openfoam-solving/222510-simplefoam-convergence-issue.html)

dnsuman November 27, 2019 03:55

simpleFoam convergence issue
 
I am new to OpenFoam. I am trying to simulate flow over an aircraft fuselage at Re=36000000. I have created my mesh in ansys meshing using cutcell method with inflation layers and y+ ~ 30 and imported it in Openfoam. I am using k omega SST model and I have specified all boundary conditions to the best of my knowledge. I am using simpleFoam as the solver. The solution does not converge and I am getting completely wrong results. I am pasting my case files below. Can someone please take a look and tell me where the problem is? Any help would be greatly appreciated.



K

Code:

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

internalField  uniform 18.37479;

boundaryField
{
    inlet
    {
      type            fixedValue;
      value          uniform 18.37479;
    }

    outlet
    {
      type            zeroGradient;
    }
    wall
    {
        type            zeroGradient;
    }
    fuselage
    {
        type            kqRWallFunction;
    value        uniform 18.37479;
    }
    symmetry
    {
        type            symmetry;
    }
}

nut
Code:

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

internalField  uniform 1.6496e-5;

boundaryField
{
    inlet
    {
        type            freestream;
        freestreamValue uniform 1.6496e-5;
    }

    outlet
    {
        type            freestream;
        freestreamValue uniform 1.6496e-5;
    }

    wall
    {
        type            nutkWallFunction;
        value          uniform 1.6496e-5;
    }

    fuselage
    {
        type            nutkWallFunction;
        value          uniform 1.6496e-5;
    }

    symmetry
    {
        type            symmetry;
    }
}

omega
Code:

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

internalField  uniform 5.4941;

boundaryField
{
    inlet
    {
      type            fixedValue;
      value          uniform 5.4941;
    }

    outlet
    {
      type            zeroGradient;
    } 
 
    wall
    {
        type            zeroGradient;
    }

    fuselage
    {
        type            omegaWallFunction;
    value        uniform 5.4941;
    }

    symmetry
    {
        type            symmetry;
    }
}

p
Code:

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

internalField  uniform 0;

boundaryField
{
    inlet
    {
        type            zeroGradient;
    }
    outlet
    {
        type            freestreamPressure;
        freestreamValue $internalField;
    }

    wall
    {
        type            zeroGradient;
    }

    fuselage
    {
        type            zeroGradient;
    }

    symmetry
    {
        type            symmetry;
    }
}

U
Code:

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

internalField  uniform (70 0 0);

boundaryField
{
    inlet
    {
        type            freestreamVelocity;
        freestreamValue $internalField;
    }

    outlet
    {
        type            zeroGradient;
    }

    wall
    {
        type            slip;
    }

    fuselage
    {
        type            noSlip;
    }

    symmetry
    {
        type            symmetry;
    }
}

fvSolution
Code:

solvers
{
    p
    {
        solver            GAMG;
        tolerance        1e-10;
        relTol            0.01;
        smoother        GaussSeidel;
        nPreSweeps        0;
        nPostSweeps    2;
        cacheAgglomeration on;
        agglomerator faceAreaPair;
        nCellsInCoarsestLevel 120;
        mergeLevels    1;
        maxIter            500;
    }

    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
{     
    nNonOrthogonalCorrectors 3;
    nCorrectors 1;
}

potentialFlow
{
    nNonOrthogonalCorrectors 10;
}

relaxationFactors
{
    fields
    {
        p              0.2;
    }   
    equations
    {
        U              0.5;
        k              0.5;
        omega          0.5;
    }
}

cache
{
    grad(U);
}

fvSchemes
Code:

ddtSchemes
{
    default        steadyState;
}

gradSchemes
{
    default        cellMDLimited Gauss linear 0.5;
    grad(U)        Gauss linear;
}

divSchemes
{
    default        none;

    div(phi,U)      bounded Gauss linearUpwind 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 uncorrected;
}

interpolationSchemes
{
    default        linear;
}

snGradSchemes
{
    default        corrected;
}

fluxRequired
{
    default no;
    p;
}

wallDist
{
    method meshWave;
}


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

ControlDict

Code:

application    simpleFoam;

startFrom      startTime;

startTime      0;

stopAt          endTime;

endTime        1000;

deltaT          1;

writeControl    timeStep;

writeInterval  50;

purgeWrite      0;

writeFormat    ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision  6;

runTimeModifiable true;

functions
{
    forces
    {
        type            forceCoeffs;
        libs            ("libforces.so");
        writeControl    writeTime;

        patches
        (
            fuselage
        );

    rho        rhoInf;
        rhoInf      1.0556;

        CofR        (0.4127 0 0);
        liftDir    (0 0 1);
        dragDir    (1 0 0);
        pitchAxis  (0 1 0);
        magUInf    70;
        lRef        8.669;
        Aref        5.01095;
    }
}

Please let me know where the problem is.

mAlletto November 27, 2019 04:10

did you run checkMesh to check if the quality of your mesh is Ok? Can you post snapshot of you mesh. I had the experience that if there are a lot of thetrahedra in the mesh you use openfoam has convergence problems

mAlletto November 27, 2019 04:13

by the way are you sure you want to use an incompressible solver for an inflow velocity of 70m/s. I would guess that in some parts of your domain you will reach velocities where the Ma number is above the limit where the flow can be regarded as incompressible

dnsuman November 27, 2019 23:53

2 Attachment(s)
Hi

I have attached the snapshot of the mesh and after giving the check mesh I have got


Code:

/*---------------------------------------------------------------------------*\
  =========                |
  \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox
  \\    /  O peration    | Website:  https://openfoam.org
    \\  /    A nd          | Version:  7
    \\/    M anipulation  |
\*---------------------------------------------------------------------------*/
Build  : 7-6ef561967074
Exec  : checkMesh
Date  : Nov 28 2019
Time  : 10:12:13
Host  : "freedom"
PID    : 4545
I/O    : uncollated
Case  : /home/leapaero/OpenFOAM/leapaero-7/run/tutorials/incompressible/simpleFoam/fuselage
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create polyMesh for time = 0

Time = 0

Mesh stats
    points:          1854705
    faces:            5569374
    internal faces:  5433716
    cells:            1853250
    faces per cell:  5.93719
    boundary patches: 5
    point zones:      0
    face zones:      1
    cell zones:      1

Overall number of cells of each type:
    hexahedra:    1614876
    prisms:        192058
    wedges:        0
    pyramids:      4933
    tet wedges:    16
    tetrahedra:    5274
    polyhedra:    36093
    Breakdown of polyhedra by number of faces:
        faces  number of cells
            5  252
            6  8929
            7  7546
            8  291
            9  12017
          10  83
          11  255
          12  4974
          13  9
          15  1710
          18  25
          21  2

Checking topology...
    Boundary definition OK.
    Cell to face addressing OK.
    Point usage OK.
    Upper triangular ordering OK.
    Face vertices OK.
    Number of regions: 1 (OK).

Checking patch topology for multiply connected surfaces...
                  Patch    Faces  Points                  Surface topology
                fuselage    41276    33202  ok (non-closed singly connected)
                  inlet    5202    5356  ok (non-closed singly connected)
                    wall    41616    42025  ok (non-closed singly connected)
                symmetry    42362    43443  ok (non-closed singly connected)
                  outlet    5202    5356  ok (non-closed singly connected)

Checking geometry...
    Overall domain bounding box (-130 -0.000285276 -65) (130 65 65)
    Mesh has 3 geometric (non-empty/wedge) directions (1 1 1)
    Mesh has 3 solution (non-empty) directions (1 1 1)
    Boundary openness (7.31581e-16 4.9481e-15 -8.75319e-16) OK.
    Max cell openness = 5.31195e-15 OK.
    Max aspect ratio = 185.675 OK.
    Minimum face area = 1.22156e-06. Maximum face area = 1.62551.  Face area magnitudes OK.
    Min volume = 7.9565e-09. Max volume = 2.07182.  Total volume = 2.197e+06.  Cell volumes OK.
    Mesh non-orthogonality Max: 82.2994 average: 6.16104
  *Number of severely non-orthogonal (> 70 degrees) faces: 445.
    Non-orthogonality check OK.
  <<Writing 445 non-orthogonal faces to set nonOrthoFaces
    Face pyramids OK.
    Max skewness = 2.57593 OK.
    Coupled point location match (average 0) OK.

Mesh OK.

Also I had not thought about the mach number limit thanks for reminding about that but would you be able to help me out in terms of setting the case for compressible or any inputs that would help me a lot.


Thank You

dnsuman November 27, 2019 23:55

Also after around a 150 iterations the solution used to give a error and i suspect the mesh would be the reason for that error

mAlletto November 28, 2019 00:40

The mesh seems ok. Did you try to write out the solution a few iterations before it converges. This may give you a hint what's going wrong

mAlletto November 28, 2019 00:42

Why do you use so many non orthogonal correctors. The mesh quantity does non require this from my experience

dnsuman November 28, 2019 01:18

Should I set both of the non orthogonal correctors to 0 one in potential flow and SIMPLE and try running the case?

mAlletto November 28, 2019 01:33

Only for simple. For potentialflow it is fine since I assume you use potentialfoam to initialize the flow field

dnsuman November 28, 2019 01:35

Sure thank you I'll run the case and post the updates

dnsuman November 28, 2019 03:36

1 Attachment(s)
I made the non orthogonal correctors 0 and ran the simulation please go through the logs attached.


Attachment 73550

Bazinga November 28, 2019 07:47

If mesh and boundary conditions are fine and initialization with potentialFoam does not help, you might want to consider running a case with more numerical diffusion first. For example, use a coarser mesh, and choose 1st order upwind for the div terms of the momentum equations. If this one converges use mapFields to initialize your simulation with 2nd order schemes and finer mesh.

HPE November 28, 2019 16:39

Some ideas from my bed:
- numerical predictions might not be time-invariant. might be there appears considerable extent time-variant patterns.
- relaxation factors: increase p to 0.9 and the rest 0.7.
- might use simplec instead of simple. if you use simplec, remove relaxation factor for p completely (delete those lines)
- find alternative boundary conditions to freestream bpundary conditions, and do the tests.
- depending on Ma number might consider to use an equivalent compressible solver


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