# icoFoam crashing due to high courant numbers

 Register Blogs Members List Search Today's Posts Mark Forums Read

January 20, 2021, 08:38
icoFoam crashing due to high courant numbers
#1
New Member

Join Date: Jan 2021
Posts: 3
Rep Power: 5
Hi everyone,

I have a problem with icoFoam crashing due to very high courant numbers.
Code:
```Time = 0.0062

Courant Number mean: 1.70314 max: 1.70807
smoothSolver:  Solving for Ux, Initial residual = 0.321492, Final residual = 1.39023e+44, No Iterations 1000
smoothSolver:  Solving for Uy, Initial residual = 0.321716, Final residual = 3.3051e+44, No Iterations 1000
smoothSolver:  Solving for Uz, Initial residual = 0.483206, Final residual = 1.01409e+46, No Iterations 1000
DICPCG:  Solving for p, Initial residual = 1, Final residual = 0.045319, No Iterations 27
DICPCG:  Solving for p, Initial residual = 0.0597692, Final residual = 0.00264667, No Iterations 15
DICPCG:  Solving for p, Initial residual = 0.0159539, Final residual = 0.000757184, No Iterations 22
time step continuity errors : sum local = 3.0971e+41, global = 2.73201e+39, cumulative = 2.73201e+39
DICPCG:  Solving for p, Initial residual = 0.443715, Final residual = 0.0178101, No Iterations 10
DICPCG:  Solving for p, Initial residual = 0.0497066, Final residual = 0.0021327, No Iterations 31
DICPCG:  Solving for p, Initial residual = 0.0169567, Final residual = 8.78265e-07, No Iterations 54
time step continuity errors : sum local = 3.20666e+38, global = -6.63929e+36, cumulative = 2.72537e+39
ExecutionTime = 9.1 s  ClockTime = 9 s

Time = 0.0063

Courant Number mean: 4.11596e+44 max: 1.69555e+47
#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::sigFpe::sigHandler(int) at ??:?
#3  Foam::symGaussSeidelSmoother::smooth(Foam::word const&, Foam::Field<double>&, Foam::lduMatrix const&, Foam::Field<double> const&, Foam::FieldField<Foam::Field, double> const&, Foam::UPtrList<Foam::lduInterfaceField const> const&, unsigned char, int) at ??:?
#4  Foam::symGaussSeidelSmoother::smooth(Foam::Field<double>&, Foam::Field<double> const&, unsigned char, int) const at ??:?
#5  Foam::smoothSolver::solve(Foam::Field<double>&, Foam::Field<double> const&, unsigned char) const at ??:?
#6  Foam::fvMatrix<Foam::Vector<double> >::solveSegregated(Foam::dictionary const&) at ??:?
#7  Foam::fvMatrix<Foam::Vector<double> >::solveSegregatedOrCoupled(Foam::dictionary const&) at ??:?
#8  Foam::fvMesh::solve(Foam::fvMatrix<Foam::Vector<double> >&, Foam::dictionary const&) const at ??:?
#9  ? in /opt/OpenFOAM/OpenFOAM-v2012/platforms/linux64GccDPInt32Opt/bin/icoFoam
#10  __libc_start_main in /lib/x86_64-linux-gnu/libc.so.6
#11  ? in /opt/OpenFOAM/OpenFOAM-v2012/platforms/linux64GccDPInt32Opt/bin/icoFoam```
The goal is to simulate the flow of water through a simple cylinder with fixed pressure values of 2.4 bar at the inlet and 1 bar at the outlet.
I'm new to OpenFoam and have set-up the simulation case to my best knowledge. The attached files should include everything needed to run the case including the blockMeshDict.
It would be nice if someone could give me a hint what I made wrong and what parameter I have to change to achieve my goal.

Thomas
Attached Files
 icofoam_cylinder.zip (4.5 KB, 5 views)

 January 21, 2021, 03:42 #2 Senior Member   Join Date: Dec 2019 Posts: 215 Rep Power: 7 I think you cant use fixedValue for the static pressure at both ends, because there are infinity solutions. Maybe thats the reason why your velocity becomes very big and thus the Courant number. I am quite sure its due to ill posed BCs. Try using totalPressure with pressureInletOutletVelocity for U at one end and fixedPressure at the other end with zeroGradient for U.

 January 21, 2021, 04:22 #3 Senior Member   anonymous Join Date: Jan 2016 Posts: 416 Rep Power: 14 Hi! You are using icoFoam and already exceeded Co = 1 before the crash. You can't do that with the PISO algorithm. Keep the Co bellow 1 or bellow 0.8 so you will be in safe. Or change to pimpleFoam and you can exceed Co = 1 with inner loops.

January 21, 2021, 09:59
#4
New Member

Join Date: Jan 2021
Posts: 3
Rep Power: 5
Quote:
 Originally Posted by shock77 Try using totalPressure with pressureInletOutletVelocity for U at one end and fixedPressure at the other end with zeroGradient for U.
So p and U would look like this?
Code:
```inlet
{
type    totalPressure;
p0      uniform 240;
}

outlet
{
type    fixedValue;
value   uniform 100;
}```
Code:
```inlet
{
type    pressureInletOutletVelocity;
value   uniform (0 0 0);
}

outlet
{
}```

 January 21, 2021, 10:17 #5 Senior Member   Join Date: Dec 2019 Posts: 215 Rep Power: 7 I suppose you are running an incompressible case, so yes. For your furhter information on the totalPressure BC: https://cpp.openfoam.org/v3/a02627.html

 January 26, 2021, 10:37 #6 New Member   Join Date: Jan 2021 Posts: 3 Rep Power: 5 With the initial conditions you proposed I get the same Courant number problem, but you are right that the boundary conditions are the reason for it. I ran a case with pressures of fixedValue at the inlet and zeroGradiend at the outlet and the simulation was successful. Not sure how to proceed now.

January 26, 2021, 11:01
#7
Senior Member

anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14
Before you dig deeper into that, drop your mesh to the trash and create a correct one. This is bad. Really bad.
Attached Images
 Screenshot from 2021-01-26 17-00-58.jpg (50.1 KB, 32 views)

 Tags courant, cylinder, icofoam