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

Weird Courant Number Error in Couette Flow

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 17, 2018, 15:07
Default Weird Courant Number Error in Couette Flow
  #1
Member
 
Emre
Join Date: Nov 2015
Location: Izmir, Turkey
Posts: 97
Rep Power: 10
ordinary is on a distinguished road
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
ordinary is offline   Reply With Quote

Old   November 18, 2018, 08:06
Default
  #2
Senior Member
 
Peter Baskovich
Join Date: Jul 2014
Posts: 127
Rep Power: 11
pete20r2 is on a distinguished road
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.
pete20r2 is offline   Reply With Quote

Old   November 18, 2018, 08:15
Default
  #3
Member
 
Emre
Join Date: Nov 2015
Location: Izmir, Turkey
Posts: 97
Rep Power: 10
ordinary is on a distinguished road
Quote:
Originally Posted by pete20r2 View Post
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
ordinary is offline   Reply With Quote

Old   November 18, 2018, 12:31
Default
  #4
Senior Member
 
Peter Baskovich
Join Date: Jul 2014
Posts: 127
Rep Power: 11
pete20r2 is on a distinguished road
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;

}
pete20r2 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
TwoPhaseEulerFoam high courant number mwaqas OpenFOAM Running, Solving & CFD 11 July 11, 2017 14:19
[OpenFOAM.org] OF2.3.1 + OS13.2 - Trying to use the dummy Pstream library aylalisa OpenFOAM Installation 23 June 15, 2015 14:49
foam-extend_3.1 decompose and pyfoam warning shipman OpenFOAM 3 July 24, 2014 08:14
Upgraded from Karmic Koala 9.10 to Lucid Lynx10.04.3 bookie56 OpenFOAM Installation 8 August 13, 2011 04:03
Courant number calculation - unsteady flow Kuba FLUENT 0 November 8, 2005 22:44


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