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

courant number explodes

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 20, 2014, 15:27
Default courant number explodes
  #1
Senior Member
 
Ali reza
Join Date: Mar 2014
Posts: 110
Rep Power: 12
1988 is on a distinguished road
hello everyone
I am somehow new in openfoam please help me to solve the problem.
I have a simulated a pipe which water is flowing in and I am using icoFoam solver the check mesh is here
Code:
Create time

Create polyMesh for time = 0

Time = 0

Mesh stats
    points:           96136
    faces:            267065
    internal faces:   246979
    cells:            85674
    faces per cell:   6
    boundary patches: 3
    point zones:      0
    face zones:       1
    cell zones:       1

Overall number of cells of each type:
    hexahedra:     85674
    prisms:        0
    wedges:        0
    pyramids:      0
    tet wedges:    0
    tetrahedra:    0
    polyhedra:     0

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                  
    body                19650    19700    ok (non-closed singly connected)  
    inlet               218      244      ok (non-closed singly connected)  
    outlet              218      244      ok (non-closed singly connected)  

Checking geometry...
    Overall domain bounding box (-0.0142294 0 -0.0151572) (0.0129588 0.0472016 0.0022)
    Mesh (non-empty, non-wedge) directions (1 1 1)
    Mesh (non-empty) directions (1 1 1)
    Boundary openness (8.88725e-17 9.11711e-17 1.4754e-17) OK.
    Max cell openness = 2.45267e-16 OK.
    Max aspect ratio = 5.50297 OK.
    Minimum face area = 5.30557e-09. Maximum face area = 1.31635e-07.  Face area magnitudes OK.
    Min volume = 1.66462e-12. Max volume = 3.77399e-11.  Total volume = 1.09182e-06.  Cell volumes OK.
    Mesh non-orthogonality Max: 20.6887 average: 5.3841
    Non-orthogonality check OK.
    Face pyramids OK.
    Max skewness = 0.435615 OK.
    Coupled point location match (average 0) OK.

Mesh OK.

End
I can not understand why the solution is diverged and why the courant number suddenly explodes to unbelievable amounts.
here I put fvsolution and fv schemes
Code:
ddtSchemes
{
    default         Euler;
}

gradSchemes
{
    default         Gauss linear;
    grad(p)         Gauss linear;
}

divSchemes
{
    default         none;
    div(phi,U)      Gauss linear;
}

laplacianSchemes
{
    default         none;
    laplacian(nu,U) Gauss linear orthogonal;
    laplacian((1|A(U)),p) Gauss linear orthogonal;
}

interpolationSchemes
{
    default         linear;
    interpolate(HbyA) linear;
}

snGradSchemes
{
    default         orthogonal;
}

fluxRequired
{
    default         no;
    p               ;
}
Code:
solvers
{
    p
    {
        solver          PCG;
        preconditioner  DIC;
        tolerance       1e-06;
        relTol          0;
    }

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

PISO
{
    nCorrectors     2;
    nNonOrthogonalCorrectors 2;
    pRefCell        0;
    pRefValue       0;
}
but this is courant numbers after just one time step(time steps are 0.001)
Code:
Time = 0.004

Courant Number mean: 2.82932e+17 max: 1.79062e+21
Is there any idea?
1988 is offline   Reply With Quote

Old   May 5, 2014, 07:12
Default
  #2
Pj.
Member
 
Luca
Join Date: Mar 2013
Posts: 68
Rep Power: 13
Pj. is on a distinguished road
I'm not an expert either with icoFoam.

You could look at the number of iterations for each field (u,p) to see which one diverges.
Sometimes the problem is also caused by bad cells (even few can create big problems). Try run a checkMesh to see if the cells are all ok.
If the mesh is ok you can try lowering the time-step to have a more stable problem.

The question "why my simulation diverges?" is not an easy one to answer to, there could be tons of reasons...
Pj. is offline   Reply With Quote

Old   May 5, 2014, 08:38
Default
  #3
Senior Member
 
ArathoN
Join Date: Jul 2011
Posts: 137
Rep Power: 16
ArathoN is on a distinguished road
How did you compute the Courant number? remember to choose the smallest grid space when you'll calculate it. And try to change the solver in fvschemes or fvsolutions.
ArathoN is offline   Reply With Quote

Old   May 5, 2014, 10:42
Default
  #4
Pj.
Member
 
Luca
Join Date: Mar 2013
Posts: 68
Rep Power: 13
Pj. is on a distinguished road
Quote:
Originally Posted by ArathoN View Post
How did you compute the Courant number? remember to choose the smallest grid space when you'll calculate it. And try to change the solver in fvschemes or fvsolutions.
You does not compute it: OpenFOAM automatically return the mean and the max value at each iteration.

I think that such a rapid "explosion" is a mesh related problem.

However you can also try to plot the value of Courant using the "Co" utility (just tipe "Co" in the prompt) and visualise it with paraView. This can help to understand where the Courant is exploded and to find the corresponding cells. This however works when you have "fisical" Co. Such an huge Co suggest the that U field is already (excuse me the technical term ) fucked up.
Pj. is offline   Reply With Quote

Old   May 5, 2014, 12:32
Default
  #5
Senior Member
 
ArathoN
Join Date: Jul 2011
Posts: 137
Rep Power: 16
ArathoN is on a distinguished road
I said computed because you need to set the time step in controldict, and to do so you need the grid spacing (better the smallest one) and a desired Co (i usually set it to 0.5 for stability). You can also try to limit the Max Co in controldict and see if it works.

I had a similar problem and i solved it by lowering the time step and changing the schemes.
ArathoN is offline   Reply With Quote

Old   May 6, 2014, 06:40
Default
  #6
Senior Member
 
Olivier
Join Date: Jun 2009
Location: France, grenoble
Posts: 272
Rep Power: 18
olivierG is on a distinguished road
hello,
You should add the 0/U and 0/p file if you want some help here.
However, common mistake are:
- bad scalling for your mesh see bounding box, here ~4 cm box is ok ?
- bad BC and initial value.

regards,
Olivier
olivierG is offline   Reply With Quote

Old   May 7, 2014, 16:43
Default
  #7
Senior Member
 
Ali reza
Join Date: Mar 2014
Posts: 110
Rep Power: 12
1988 is on a distinguished road
thanks all of you for your attention
the mesh was made in gambit and scaled to mm in openfoam.I have put check mesh result and my time step as you can see is some thing about 0.001 and I have to decrease it to 0.00001 but it is really time consuming and it is not logically true in this case.
these are my p and u boundary conditions.
Code:
dimensions      [0 1 -1 0 0 0 0];

internalField   uniform (0 0 0);

boundaryField
{
    inlet
    {
      type            groovyBC;
      valueExpression "vector(0,0.15-0.15*cos(2.5*pi*time()),0)";
      gradientExpression "vector(0,0,0)";
      fractionExpression "1";
      value           uniform (0 0 0);
    }

    outlet
    {
        type            zeroGradient;
    }

    body
    {
        type            fixedValue;
        value           uniform (0 0 0);
    }
}
Code:
dimensions      [0 2 -2 0 0 0 0];

internalField   uniform 0;

boundaryField
{
    inlet
    {
        type            zeroGradient;
    }

    outlet
    {
       type            groovyBC;
      valueExpression "12000-2667*cos(2.5*pi*time())";
      gradientExpression "0";
      fractionExpression "1";
      value           uniform 0;
    }
Is there any idea?
1988 is offline   Reply With Quote

Old   May 7, 2014, 17:01
Default
  #8
Pj.
Member
 
Luca
Join Date: Mar 2013
Posts: 68
Rep Power: 13
Pj. is on a distinguished road
as Olivier pointed out: is it correct for the mesh to bee THAT SMALL?

Your overall domain is about 4cm large! The cells side are less than 1mm, is that correct?

Your smallest cell is 1.66462e-12 m^3. With a 0.3 maximum inlet velocity 0.001s time step is not very small.
Pj. is offline   Reply With Quote

Old   May 8, 2014, 02:21
Default
  #9
Senior Member
 
Ali reza
Join Date: Mar 2014
Posts: 110
Rep Power: 12
1988 is on a distinguished road
yes that is true but let me explain it maybe you have better idea.
I am working on a vein which is in mm scale and it needs 100000 mesh but I ran in in meter scale with no problem and the courant number even with 1 second time steps(not 0.001 or small ones) was less than 1 by IcoFoam solver however I have got the wrong answer for wall shear stress .By scaling the geometry to mm my wall shear stress come closer to fact nevertheless the courant number explode and I prefer to change my solver to PimpleFoam because I think that it lets me to define a courant number and it adjusts the time steps but I am not sure this is the right decision and I need to help me to solve the problem.
thank you
1988 is offline   Reply With Quote

Old   May 8, 2014, 14:31
Default
  #10
Senior Member
 
ArathoN
Join Date: Jul 2011
Posts: 137
Rep Power: 16
ArathoN is on a distinguished road
Quote:
Originally Posted by 1988 View Post
yes that is true but let me explain it maybe you have better idea.
I am working on a vein which is in mm scale and it needs 100000 mesh but I ran in in meter scale with no problem and the courant number even with 1 second time steps(not 0.001 or small ones) was less than 1 by IcoFoam solver however I have got the wrong answer for wall shear stress .By scaling the geometry to mm my wall shear stress come closer to fact nevertheless the courant number explode and I prefer to change my solver to PimpleFoam because I think that it lets me to define a courant number and it adjusts the time steps but I am not sure this is the right decision and I need to help me to solve the problem.
thank you
Are you working with blood flow? because you need to consider a non-newtonian flow with the appropriate coefficients. Unfortunately I have no knowledge on such flows but in transport properties you can set the constants.

To calculate the time step you need to choose a Co number (less than 0.5 for LES or less than 1 generally, I usually tend to choose a given Co less than 0.5 for stability even if sometimes it isn't needed), then you need to see the smallest grid spacing possibly in all the 3 direction.

Now you can calculate the time step needed and choose the smallest, obviously if the mesh is really small the time step will be really small.

As a partially OT matter what is the smallest mesh/geometry than openfoam can study because i'm studying a channel with a height of 0.025m and a relative timestep of 2e-6 (Max Co 0.5). The solver has some problems especially if i use cyclic BCs with LES+pimplefoam (or even RANS+pimpleFoam).
ArathoN is offline   Reply With Quote

Old   May 9, 2014, 12:48
Default
  #11
Senior Member
 
Ali reza
Join Date: Mar 2014
Posts: 110
Rep Power: 12
1988 is on a distinguished road
I don't use now newtonian methods because of some special biological things and you can consider it as laminar, unsteady,newtonian flow but the dimensions are the same as things which you saw in check mesh part.
1988 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
ERROR #001100279 has occurred in subroutine ErrAction. smnaryal CFX 11 December 20, 2017 17:32
[blockMesh] --> foam fatal error: lillo763 OpenFOAM Meshing & Mesh Conversion 0 March 5, 2014 11:27
Courant number and CFL number snandish13 STAR-CCM+ 3 January 7, 2013 05:14
LES near wall model & courant number kasim CFX 5 March 16, 2008 19:23
IcoFoam parallel woes msrinath80 OpenFOAM Running, Solving & CFD 9 July 22, 2007 03:58


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