CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   Courant number goes crazy (http://www.cfd-online.com/Forums/openfoam/118495-courant-number-goes-crazy.html)

 pechwang May 28, 2013 14:40

Courant number goes crazy

Hello everyone,

I'm new to OpenFOAM. I'm using interFoam to simulate a simple two-phase flow. First I used a very simple geometry, it worked very well. Then I moved that to a complex geometry, the problem came. I monitored the Umax and Pmax. At the very beginning, everything worked well. After some steps, courant number increased directly to several thousands then went to infinity. At the same time, samething happened to Umax and Pmax. I don't know what is the reason. I think since it works with the simple geometry, it should work with the complex geometry as well. Is there anyone who has a similar experience before? Can anyone help me with this?

Thanks

 gregjunqua May 28, 2013 21:30

Hi
This occur for me when i don't compute the current number
http://www.openfoam.org/docs/user/cavity.php . Did you check it out?

 pechwang May 28, 2013 21:38

Hi,

I used adjust time step, the time step will change based on the previous courant number. But right now, I have no idea.

Quote:
 Originally Posted by gregjunqua (Post 430629) Hi This occur for me when i don't compute the current number http://www.openfoam.org/docs/user/cavity.php . Did you check it out?

 Irish09 June 1, 2013 13:09

Limiting the Courant Number

Hello,

I would suspect that your time step is becoming too large to stay stable. As the Courant number grows, and with a fixed mesh, all that can change is the timestep. Try limiting the value that the courant number can reach, in essence setting a maximum timestep value, for stability. You will have to decide what a sufficient value is, maybe using a value from the stable and simple geometry as the maximum.

 pechwang June 10, 2013 09:18

Hi Thomas,

I set the maximum Courant to 0.25 and the maximum time step is 1. However, when I monitored the Courant number, it changed so fast that it changed from 0.2 to around 3000 in one time step. I don't know why.

Quote:
 Originally Posted by Irish09 (Post 431376) Try limiting the value that the courant number can reach, in essence setting a maximum timestep value, for stability.

 cfdonline2mohsen June 10, 2013 10:46

Quote:
 Originally Posted by Irish09 (Post 431376) Hello, I would suspect that your time step is becoming too large to stay stable. As the Courant number grows, and with a fixed mesh, all that can change is the timestep. Try limiting the value that the courant number can reach, in essence setting a maximum timestep value, for stability. You will have to decide what a sufficient value is, maybe using a value from the stable and simple geometry as the maximum.
Dear Pengchuan & Thomas

According to the definition of CFL (or Courant) number Co=U*deltat/Deltax.
Since your mesh is constant (not dynamic mesh) then the Max Co depends on 2 parameters: deltat & Max U, so Max Co depends also on Max U.
as you said in your case Max U becomes very large so Co number too.
there is something about Time step control in section 2.3.6 of user guide for interFoam solver that I quote in here:
" Time step control is an important issue in free surface tracking since the surface-tracking algorithm is considerably more sensitive to the Courant number Co than in standard fluid flow calculations. Ideally, we should not exceed an upper limit Co=0.5 in the region of the interface. In some cases, where the propagation velocity is easy to predict, the user should specify a fixed time-step to satisfy the Co criterion. For more complex cases, this is considerably more difficult. interFoam therefore offers automatic adjustment of the time step as standard in the controlDict. The user should specify adjustTimeStep to be on and the the maximum Co for the phase fields, maxAlphaCo, and other fields, maxCo, to be 0.5. The upper limit on time step maxDeltaT can be set to a value that will not be exceeded in this simulation, e.g. 1.0. "

Try adjustTimeStep and see what happens.
Afterward, there is another issue regarding bounded schemes in fvsheme so that you can use schemes that bound a quantity between desired values. Take a deep look at them to see whether you can use it in your case.

 pechwang June 10, 2013 21:17

Hi Mohsen,

Thank you for your reply. I did use the adjust time step and I did exactly the same as the tutorial. What confused me was the same setup worked for the simple geometry but it didn't work for the complex model. I don't know why. And I was stuck here for about a whole month.

 Tobi June 11, 2013 04:35

Hi pechwang,

I am using interFoam for complex simulations a lot of times. For a beginner is this Kind of solver a very heavy meal :rolleyes:

Summarize:

- As shown above you are using Co=0.25 and adjustableRunTime yes
- You think that you Simulation "should/must" work couse it run with a simple mesh befor

So first:

- 2D and 3D are completely different, so you can not handle the Argument, that the simulation should/must work with your complex geometry

- How did you generate your mesh?
- Is it a snappyHexMesh mesh?
- Is it a tet-mesh or hexadominant or just hex cells?

- you checked out the output of the application checkMesh?

- Did you set your BC correct ?
In some cases a 2D case is working with not good BC too but in a 3D simulation everythings wrong after a few iterations.

- Did you check to set your Co-Max to 0.1 ?
- Did you try to start with a very very low time step (e.g. 0.00000001)

- You can check out some simulations (interFoam) on my Homepage

General interFoam tutorials:

http://www.holzmann-cfd.de/index.php...asen/interfoam

Videos and Inspiration:

http://www.holzmann-cfd.de/index.php/brueckensimulation
http://www.holzmann-cfd.de/index.php/bierflasche
http://www.holzmann-cfd.de/index.php...lischer-sprung
http://www.holzmann-cfd.de/index.php...abenbefuellung
http://www.holzmann-cfd.de/index.php/brunnen

After you told me more Information about the mesh and other stuff (see above), I can help you in a better way.

Good luck,

Tobi

 pechwang June 11, 2013 14:37

1 Attachment(s)
Hi Tobi,

Thank you for your reply. Both my simple geometry and complex geometry are in 3D. I use blockMesh to generate basic hex cells. I generate the blockMeshDict file by hand. And both meshes work in icoFoam and simpleFoam.
I have attached my setup in the attachment. If you have time, please have a look at it. Thank you so much.

Pengchuan

Quote:
 Originally Posted by Tobi (Post 433299) Hi pechwang, - How did you generate your mesh? - Is it a snappyHexMesh mesh? - Is it a tet-mesh or hexadominant or just hex cells? Tobi

 Tobi June 11, 2013 14:42

Give me 1 hour :) I have to set up my home phone :D

 Tobi June 11, 2013 15:18

At the moment non case is working.

I am wondering how you set up your controlDict and you fvSchemes!

I change that now and test again

 pechwang June 11, 2013 15:20

Hi Tobi,

I copied them from the dambreak tutorial. I only made some small changes on them.

Thanks,
Pengchuan

 Tobi June 11, 2013 15:28

Hi,

I added a picture.
Is that setup correct?

I am a bit confused of the "sence" of that simulation!

1. inlet is in the inner side (red)
2. outlet is at the outer side
3. Velocity is cross due to inlet and outlet ??

Any symmetric? I can not find the meaning and sence of the simulation.

PS: complex geometry is not working (blockMesh failed)

 pechwang June 11, 2013 15:42

Hi Tobi,

I cannot see the picture. But yes, inlet is inner radius and outlet is outer raidus. I use cyclic boundary condition on the two side walls. Basiclly it is a part of the whole 360 model. I applied zero pressure conditions at the inlet and outlet. Right now, for these two models, I just want to see the propogation of oil in the domain. I want to see whether there is some pattern changes after changing the geometry.
As to the complex model, maybe it is out of memory, maybe I need to change the number of elements to a smaller number.

 Tobi June 11, 2013 16:07

1 Attachment(s)
Quote:
 Originally Posted by pechwang (Post 433454) Hi Tobi, As to the complex model, maybe it is out of memory, maybe I need to change the number of elements to a smaller number.
I have 36 GB of memory :)

Well okay I understand what you wanna do.
Here the picture!

 pechwang June 11, 2013 16:14

1 Attachment(s)
Thanks Tobi. What are the small pyramids on the top surface? Maybe the blockMeshDict file is broken. I attach a new one for you. Does the simple geometry work?

 Tobi June 11, 2013 16:48

Hi, that are vectors :)
So the setup is correct?

 pechwang June 12, 2013 08:27

Yes. The setup is right for the simple geometry. Since the complex had some problems, one of my friend changed the boundary conditions to zero pressure on the two parallel walls. But I think that was not right. Thanks.

 Tobi June 13, 2013 07:00

Quote:
 Originally Posted by pechwang (Post 433560) Yes. The setup is right for the simple geometry. Since the complex had some problems, one of my friend changed the boundary conditions to zero pressure on the two parallel walls. But I think that was not right. Thanks.
Hi,

the simple geometry is not working at my computer (2.2.x)
Did you calculate that one with variable time step couse in the case you have a fix time step declared.

 pechwang June 13, 2013 08:24

Hi Tobi,

Yes, I used adjust time step in the simple case once. The simple case didn't work on you comoputer? I'm kind of confusing now. It worked on my computer. But I didn't use parallel computing for these two cases.

 All times are GMT -4. The time now is 09:35.