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/)
-   -   Weird Courant Number Error in Couette Flow (https://www.cfd-online.com/Forums/openfoam-solving/211721-weird-courant-number-error-couette-flow.html)

ordinary November 17, 2018 15:07

Weird Courant Number Error in Couette Flow
 
Hello everyone,

I encounter incomprehensible Courant number errors and velocity magnitudes when I try to simulate 2D Couette flow.

U file:
Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | foam-extend: Open Source CFD                    |
|  \\    /  O peration    | Version:    4.0                                |
|  \\  /    A nd          | Web:        http://www.foam-extend.org        |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      volVectorField;
    object      U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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

internalField  uniform (0 0 0);

boundaryField
{
    movingWall
    {
        type            fixedValue;
    value        uniform (1 0 0);
    }

    stationaryWall
    {
        type            fixedValue;
    value        uniform (0 0 0);
    }

    inlet
    {
        type            zeroGradient;
    }

    outlet
    {
        type            zeroGradient;
    }

    frontAndBack
    {
        type            empty;
    }
}

p file
Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | foam-extend: Open Source CFD                    |
|  \\    /  O peration    | Version:    4.0                                |
|  \\  /    A nd          | Web:        http://www.foam-extend.org        |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      volScalarField;
    object      p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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

internalField  uniform 0;

boundaryField
{
    movingWall
    {
        type            zeroGradient;
    }

    stationaryWall
    {
        type            zeroGradient;
    }

    inlet
    {
        type            fixedValue;
    value        uniform 0;
    }

    outlet
    {
        type            fixedValue;
    value        uniform 0;
    }

    frontAndBack
    {
        type            empty;
    }
}

blockMeshDict file
Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | foam-extend: Open Source CFD                    |
|  \\    /  O peration    | Version:    4.0                                |
|  \\  /    A nd          | Web:        http://www.foam-extend.org        |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

convertToMeters 1;

vertices
(
    (0 0 0)
    (1 0 0)
    (1 0.25 0)
    (0 0.25 0)
    (0 0 0.1)
    (1 0 0.1)
    (1 0.25 0.1)
    (0 0.25 0.1)
);

blocks
(
    hex (0 1 2 3 4 5 6 7) (400 400 1) simpleGrading (1 1 1)
);

edges
(
);

boundary
(
    movingWall
    {
        type wall;
        faces
        (
            (3 7 6 2)
        );
    }
    inlet
    {
    type patch;
    faces
    (
        (0 4 7 3)
    );
    }
    outlet
    {   
    type patch;
    faces
    (
        (2 6 5 1)
    );
    }
    stationaryWall
    {
        type wall;
        faces
        (     
            (1 5 4 0)
        );
    }
    frontAndBack
    {
        type empty;
        faces
        (
            (0 3 2 1)
            (4 5 6 7)
        );
    }
);

mergePatchPairs
(
);

controlDict file
Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | foam-extend: Open Source CFD                    |
|  \\    /  O peration    | Version:    4.0                                |
|  \\  /    A nd          | Web:        http://www.foam-extend.org        |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application icoFoam;

startFrom      startTime;

startTime      0;

stopAt          endTime;

endTime        3;

deltaT          0.001;

writeControl    runTime;

writeInterval  1;

purgeWrite      0;

writeFormat    ascii;

writePrecision  6;

writeCompression uncompressed;

timeFormat      general;

timePrecision  6;

runTimeModifiable yes;

Courant number = u*DeltaT/DeltaX must be smaller than 1. My maximum velocity is 1 m/s which is at the moving wall. My DeltaX is 1/400=0.0025 m. So my DeltaT must be smaller than 0.0025. Thus, I set DeltaT to 0.001. So, how could this case give me an error and absurd velocity magnitutes like these:

Code:

Time = 0.044

Courant Number mean: 0.336637 max: 1944.94 velocity magnitude: 2431.17
BiCGStab:  Solving for Ux, Initial residual = 0.972023, Final residual = 9.93918e-06, No Iterations 80
BiCGStab:  Solving for Uy, Initial residual = 0.945448, Final residual = 6.14037e-06, No Iterations 82
DICPCG:  Solving for p, Initial residual = 0.849381, Final residual = 9.71391e-07, No Iterations 521
time step continuity errors : sum local = 6.37445e-07, global = 9.354e-09, cumulative = 1.45292e-08
DICPCG:  Solving for p, Initial residual = 0.920578, Final residual = 9.38132e-07, No Iterations 543
time step continuity errors : sum local = 9.62929e-06, global = 9.33402e-08, cumulative = 1.07869e-07
ExecutionTime = 133.78 s  ClockTime = 134 s

Time = 0.045

Courant Number mean: 168.34 max: 1.37785e+06 velocity magnitude: 3.28688e+06
BiCGStab:  Solving for Ux, Initial residual = 0.999994, Final residual = 3.24586e+18, No Iterations 1000
BiCGStab:  Solving for Uy, Initial residual = 0.999935, Final residual = 3.48908e+16, No Iterations 1000
DICPCG:  Solving for p, Initial residual = 1, Final residual = 2.42732e-08, No Iterations 3
time step continuity errors : sum local = 1.36528e+17, global = 1.55905e+10, cumulative = 1.55905e+10
DICPCG:  Solving for p, Initial residual = 0.985689, Final residual = 1.29964e-08, No Iterations 3
time step continuity errors : sum local = 1.3758e+17, global = -3.67509e+13, cumulative = -3.67353e+13
ExecutionTime = 148.01 s  ClockTime = 148 s

Time = 0.046

Courant Number mean: 6.45818e+24 max: 6.04572e+27 velocity magnitude: 1.51143e+28
Floating point exception (core dumped)

Any idea is appreciated.

Sincerely,

ordinary

pete20r2 November 18, 2018 08:06

Are you initialising with potentialFoam?
Otherwise you can try with timestep 2-3 orders of magnitude smaller than your CFL target.
Also maybe try first order schemes/ bounding/ limiters during startup and change the scheme once it's stable.

ordinary November 18, 2018 08:15

Quote:

Originally Posted by pete20r2 (Post 716049)
Are you initialising with potentialFoam?
Otherwise you can try with timestep 2-3 orders of magnitude smaller than your CFL target.
Also maybe try first order schemes/ bounding/ limiters during startup and change the scheme once it's stable.

Thank you very much. I have just tried as you proposed.

Code:

Create time

Create mesh for time = 0

--> FOAM FATAL IO ERROR:
keyword SIMPLE is undefined in dictionary "/home/emre/Desktop/boundarylayer/system/fvSolution"

file: /home/emre/Desktop/boundarylayer/system/fvSolution at line 21.

    From function dictionary::subDict(const word& keyword)
    in file db/dictionary/dictionary.C at line 474.

FOAM exiting

Here I post my fvSolution which seems the source of the problem:

Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | foam-extend: Open Source CFD                    |
|  \\    /  O peration    | Version:    4.0                                |
|  \\  /    A nd          | Web:        http://www.foam-extend.org        |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    object      fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

solvers
{
    p
    {
        solver          PCG;
        preconditioner  DIC;
        tolerance        1e-06;
        relTol          0;
    };

    U
    {
        solver          BiCGStab;
        preconditioner  DILU;
        tolerance        1e-05;
        relTol          0;
    };
}

PISO
{
    nCorrectors    2;
    nNonOrthogonalCorrectors 0;
    pRefCell        0;
    pRefValue      0;
}

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

Regards

Emre

pete20r2 November 18, 2018 12:31

Add this to your fvSolution. You may also need to add a solver for Phi and appropriate schemes. The error messages will tell you what's missing.
Code:

SIMPLE

{

nNonOrthogonalCorrectors 10;

}



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