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

icoFoam @ Courant Uncontrolled

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes
  • 1 Post By Tushar@cfd
  • 2 Post By wyldckat
  • 2 Post By wyldckat

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 31, 2014, 00:19
Default icoFoam @ Courant Uncontrolled
  #1
New Member
 
Filippo
Join Date: May 2014
Posts: 27
Rep Power: 11
fs.chemech is on a distinguished road
Hi mates! Greetings for everyone!

I'm completely new here and resonably new in working with CFD. All my previous experience was in Ansys Fluent. Now, due to all recognized capabilities, I'm trying to transit my work to OpenFoam. That's what brings me here looking for experienced help.

So, I'm trying to simulate a Newtonian fluid in a kind of a vein with an aneurysm. I built the mesh in Ansys Meshing and then I exported it in ASCII format. Conversion to OpenFOAM was made with fluent3DMeshToFOam and no problem ocurred. Please see my checkMesh results in the appropriate attachement.

In OpenFoam, I defined several properties. My boundaries are a velocity inlet, an outlet and a wall. My experimental velocity is 0.4 m/s; defining a dynamic viscosity of 0.0035 Pa.s and a density of 1050 kg/m3, I obtained a kinematic viscosity of 0.000003 m2/s. I think I'm dealing with a transient flow because when I ran a simulation in fluent, this one was a time-dependent. So icoFoam looks a good solver to make my first OpenFoam test.

With the parameters referred above I created my initial conditions files, "p" and "U"; and the file "transportProperties". (see attached)

Then, I defined my fvSchemes and fvSolution files and tried to run the simulation and it was when my problems started. (see attached)

I cannot run a simulation because Courant starts increasing and eventually the simulation crashes even changing and trying different schemes (can you please suggest the schemes that you consider most appropriate?).

I also noticed that my icoFoam.C code (I'm using OpenFOAM 2.3.0) is different from the code in http://openfoamwiki.net/index.php/IcoFoam. Can someone explain me what are the advantages of the 2.3.0 code?
In this new code I cannot define laplacian(1|A(U)),p), as I saw in many examples, because OpenFoam gives an error...

Is it possible for you to help me in this battle? I cannot understand what is going wrong and I'm getting a little concerned.

Hope to hear from you soon.

Cheers

FS
Attached Files
File Type: docx checkMesh.docx (4.3 KB, 5 views)
File Type: docx p.docx (3.6 KB, 0 views)
File Type: docx U.docx (3.6 KB, 3 views)
File Type: docx controlDict.docx (3.6 KB, 2 views)
File Type: docx fvScheme_fvSolution.docx (3.9 KB, 6 views)
fs.chemech is offline   Reply With Quote

Old   May 31, 2014, 01:14
Default
  #2
Senior Member
 
T. Chourushi
Join Date: Jul 2009
Posts: 321
Blog Entries: 1
Rep Power: 17
Tushar@cfd is on a distinguished road
Use the following:

Quote:
divSchemes
{
default none;
div(phi,U) Gauss upwind;
}
fs.chemech likes this.
Tushar@cfd is offline   Reply With Quote

Old   May 31, 2014, 10:28
Default
  #3
New Member
 
Filippo
Join Date: May 2014
Posts: 27
Rep Power: 11
fs.chemech is on a distinguished road
Hi Tushar!!
Thank you for your answer! I implemented the change you suggested and take a look to what happened:

Code:
Create time
Create mesh for time = 0
Reading transportProperties
Reading field p
Reading field U
Reading/calculating face flux field phi

Starting time loop

Time = 1e-05

Courant Number mean: 2.41852e-05 max: 0.00380174
smoothSolver:  Solving for Ux, Initial residual = 1, Final residual = 6.31843e-08, No Iterations 2
smoothSolver:  Solving for Uy, Initial residual = 0, Final residual = 0, No Iterations 0
smoothSolver:  Solving for Uz, Initial residual = 0, Final residual = 0, No Iterations 0
DICPCG:  Solving for p, Initial residual = 1, Final residual = 9.76551e-07, No Iterations 774
DICPCG:  Solving for p, Initial residual = 0.0614092, Final residual = 9.92326e-07, No Iterations 679
DICPCG:  Solving for p, Initial residual = 0.0127107, Final residual = 9.45319e-07, No Iterations 665
time step continuity errors : sum local = 9.51532e-09, global = -9.62547e-12, cumulative = -9.62547e-12
DICPCG:  Solving for p, Initial residual = 0.00756706, Final residual = 8.8731e-07, No Iterations 688
DICPCG:  Solving for p, Initial residual = 0.00562685, Final residual = 9.85765e-07, No Iterations 636
DICPCG:  Solving for p, Initial residual = 0.00128206, Final residual = 9.38453e-07, No Iterations 621
time step continuity errors : sum local = 9.40152e-09, global = 6.07268e-11, cumulative = 5.11013e-11
ExecutionTime = 92.51 s  ClockTime = 93 s

Time = 2e-05

Courant Number mean: 0.0179757 max: 2.38782
smoothSolver:  Solving for Ux, Initial residual = 0.461852, Final residual = 1.32265e-06, No Iterations 2
smoothSolver:  Solving for Uy, Initial residual = 0.331689, Final residual = 8.72061e-06, No Iterations 2
smoothSolver:  Solving for Uz, Initial residual = 0.328512, Final residual = 3.61271e-06, No Iterations 2
DICPCG:  Solving for p, Initial residual = 0.0220829, Final residual = 9.36066e-07, No Iterations 721
DICPCG:  Solving for p, Initial residual = 0.109775, Final residual = 8.84565e-07, No Iterations 689
DICPCG:  Solving for p, Initial residual = 0.0242443, Final residual = 9.11028e-07, No Iterations 673
time step continuity errors : sum local = 4.80933e-09, global = 1.98207e-13, cumulative = 5.12995e-11
DICPCG:  Solving for p, Initial residual = 0.0293799, Final residual = 9.9181e-07, No Iterations 693
DICPCG:  Solving for p, Initial residual = 0.0124883, Final residual = 9.81143e-07, No Iterations 654
DICPCG:  Solving for p, Initial residual = 0.00276061, Final residual = 9.69987e-07, No Iterations 641
time step continuity errors : sum local = 5.00113e-09, global = -4.68781e-11, cumulative = 4.42141e-12
ExecutionTime = 180.89 s  ClockTime = 181 s

Time = 3e-05

Courant Number mean: 0.0179777 max: 2.66871
smoothSolver:  Solving for Ux, Initial residual = 0.879423, Final residual = 2.53102e-06, No Iterations 2
smoothSolver:  Solving for Uy, Initial residual = 0.905511, Final residual = 1.6888e-06, No Iterations 3
smoothSolver:  Solving for Uz, Initial residual = 0.850206, Final residual = 6.18339e-07, No Iterations 3
DICPCG:  Solving for p, Initial residual = 0.0370043, Final residual = 9.38748e-07, No Iterations 719
DICPCG:  Solving for p, Initial residual = 0.110386, Final residual = 9.87811e-07, No Iterations 689
DICPCG:  Solving for p, Initial residual = 0.0243131, Final residual = 9.62949e-07, No Iterations 672
time step continuity errors : sum local = 5.08276e-09, global = 4.86047e-12, cumulative = 9.28187e-12
DICPCG:  Solving for p, Initial residual = 0.0284932, Final residual = 9.11382e-07, No Iterations 694
DICPCG:  Solving for p, Initial residual = 0.0124214, Final residual = 9.7251e-07, No Iterations 652
DICPCG:  Solving for p, Initial residual = 0.00273733, Final residual = 9.39018e-07, No Iterations 641
time step continuity errors : sum local = 4.84587e-09, global = 7.69859e-12, cumulative = 1.69805e-11
ExecutionTime = 270.1 s  ClockTime = 270 s

Time = 4e-05

Courant Number mean: 0.0179769 max: 3.0971
smoothSolver:  Solving for Ux, Initial residual = 0.458201, Final residual = 1.34985e-06, No Iterations 2
smoothSolver:  Solving for Uy, Initial residual = 0.337188, Final residual = 9.04215e-06, No Iterations 2
smoothSolver:  Solving for Uz, Initial residual = 0.350229, Final residual = 4.7718e-06, No Iterations 2
DICPCG:  Solving for p, Initial residual = 0.0382503, Final residual = 9.55375e-07, No Iterations 716
DICPCG:  Solving for p, Initial residual = 0.110442, Final residual = 9.76752e-07, No Iterations 689
DICPCG:  Solving for p, Initial residual = 0.0243546, Final residual = 9.5275e-07, No Iterations 673
time step continuity errors : sum local = 5.03835e-09, global = -1.32744e-12, cumulative = 1.5653e-11
DICPCG:  Solving for p, Initial residual = 0.0301959, Final residual = 9.74834e-07, No Iterations 693
DICPCG:  Solving for p, Initial residual = 0.0128837, Final residual = 9.67135e-07, No Iterations 656
DICPCG:  Solving for p, Initial residual = 0.00298399, Final residual = 9.96337e-07, No Iterations 658
time step continuity errors : sum local = 5.13711e-09, global = -2.13298e-12, cumulative = 1.352e-11
ExecutionTime = 359.37 s  ClockTime = 360 s
Courant number started increasing again and now is going around 28! I think that it is going to stop again...

Do you have anything more in mind?

---------

Current state:
Code:
Time = 0.00016

Courant Number mean: 18656.3 max: 4.99486e+07
smoothSolver:  Solving for Ux, Initial residual = 0.947036, Final residual = 0.0129704, No Iterations 1000
smoothSolver:  Solving for Uy, Initial residual = 0.945245, Final residual = 0.00689459, No Iterations 1000
smoothSolver:  Solving for Uz, Initial residual = 0.939256, Final residual = 0.00414839, No Iterations 1000
DICPCG:  Solving for p, Initial residual = 0.265358, Final residual = 8.83444e-07, No Iterations 797
DICPCG:  Solving for p, Initial residual = 1.88099e-05, Final residual = 8.63976e-07, No Iterations 4
DICPCG:  Solving for p, Initial residual = 3.96301e-06, Final residual = 8.59129e-07, No Iterations 1
time step continuity errors : sum local = 1069.33, global = -0.00135854, cumulative = 1.15191
DICPCG:  Solving for p, Initial residual = 9.39898e-05, Final residual = 9.71092e-07, No Iterations 694
DICPCG:  Solving for p, Initial residual = 0.000568404, Final residual = 9.76443e-07, No Iterations 271
DICPCG:  Solving for p, Initial residual = 0.000120666, Final residual = 9.75063e-07, No Iterations 253
time step continuity errors : sum local = 35.8032, global = -0.120198, cumulative = 1.03172
ExecutionTime = 1594.06 s  ClockTime = 1597 s

Time = 0.00017

Courant Number mean: 218504 max: 6.79505e+08
smoothSolver:  Solving for Ux, Initial residual = 0.947021, Final residual = 0.00293852, No Iterations 1000
smoothSolver:  Solving for Uy, Initial residual = 0.927894, Final residual = 0.00292788, No Iterations 1000
smoothSolver:  Solving for Uz, Initial residual = 0.91814, Final residual = 0.00307126, No Iterations 1000
DICPCG:  Solving for p, Initial residual = 0.465531, Final residual = 9.33192e-07, No Iterations 786
DICPCG:  Solving for p, Initial residual = 5.86024e-05, Final residual = 9.52133e-07, No Iterations 18
DICPCG:  Solving for p, Initial residual = 8.17322e-06, Final residual = 9.31323e-07, No Iterations 3
time step continuity errors : sum local = 2957.47, global = 66.147, cumulative = 67.1787
DICPCG:  Solving for p, Initial residual = 0.00299787, Final residual = 9.42929e-07, No Iterations 725
DICPCG:  Solving for p, Initial residual = 0.00127555, Final residual = 9.87174e-07, No Iterations 401
DICPCG:  Solving for p, Initial residual = 0.000201239, Final residual = 9.04691e-07, No Iterations 399
time step continuity errors : sum local = 152.35, global = 12.6086, cumulative = 79.7873
ExecutionTime = 1721.84 s  ClockTime = 1725 s

Last edited by wyldckat; May 31, 2014 at 11:50. Reason: posted only a few minutes in between
fs.chemech is offline   Reply With Quote

Old   May 31, 2014, 12:21
Default
  #4
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings to all!

@FS: There are several problems with your case. My guess is that you did not properly study the OpenFOAM User Guide, more specifically the very first tutorial, which indicates how the mesh and flow speed relates to the Courant Number and deltaT.
The other detail I suspect is that you're going head first into a solver you're not familiar with yet. This is a very big no-no when it comes to using OpenFOAM, because it was not designed to be "user friendly" like some other CFD software; it was designed to be used by those who understand what should be done for things to work correctly . With OpenFOAM, even the slightest detail you might think it isn't important, can equate to either getting correct or incorrect results . Well, in all honesty, CFD itself is usually this detailed, but some of the more user friendly software might restrain the user from shooting him or herself in the foot.

OK, sorry, ranting aside, the issues I can see are:
  1. icoFoam is one of the most basic transient solvers in OpenFOAM. It lacks several features that more advanced solvers - such as pisoFoam and pimpleFoam - have got. One such example is that icoFoam does not use the options "adjustTimeStep" and "maxCo".
    Since it does not auto-adjust deltaT, this means that you need a proper value defined in the respective entry.
  2. Related to #1, the checkMesh output you provided indicates this:
    Code:
    Min volume = 9.66168e-16. Max volume = 1.10239e-11.
    Don't see how important this detail is? Have a look into the OpenFOAM User Guide, section 2.1, namely the tutorial about the "cavity" case and search for the word "Courant". There you'll find a simplified equation on how to calculate the Courant Number and how to calculate the deltaT to get an agreeable Courant Number during the simulation.
    • So, if we do an oversimplified deduction of what deltaT you should be using... using the minimum volume, calculate the cubic root of it and use 0.4 m/s as the flow speed, we get a deltaT of:
    Code:
    (9.66168e-16)^(1/3) * 1 / 0.4 = 2.4714e-5
    OK, you're using 1e-5 for deltaT, so it's not too bad on a first glance.
    • Problem is that if the solver is telling you that you're getting a Courant Number way over 0.5 or even 1.0, then that means that the flow speed in the smallest cells is actually far greater than the speed at the inlet.
    • Or the problem could be even worse, where larger cells are really way larger speed values!
  3. The mesh has way too many tetrahedral cells for OpenFOAM to use them in a sane way. This is related to what I was indirectly trying to explain above: you tried to use a complex mesh generated in "Ansys Meshing", without first doing some more of the simple mesh tests to assess if the mesh would be an agreeable one with OpenFOAM's way of doing CFD .
    As a curiosity, here's a blog post with some information on what kinds of meshes that don't work: OpenFOAM: Interesting cases of bad meshes and bad initial conditions - There you'll find a few examples of how distorted cells or incorrect refinement transitions can break the simulation.

As for a silver bullet for your problem? There isn't one. My advice is to not go directly into solving your final problem and to take several steps back into more simple and basic case setups. Then gradually increase the complexity of your case, so that you can isolate each problem, one at a time; instead of having this major problem, riddled with several unknown variables which may or may not have a "solver tweaking" solution at this point.

Best regards,
Bruno
adambarfi and fs.chemech like this.
__________________

Last edited by wyldckat; May 31, 2014 at 13:10. Reason: fixed a few phrases...
wyldckat is offline   Reply With Quote

Old   May 31, 2014, 13:22
Default
  #5
New Member
 
Filippo
Join Date: May 2014
Posts: 27
Rep Power: 11
fs.chemech is on a distinguished road
Hi wyldckat!!

Thank you very much for you entirely relevant and valuable answer!!

I will give a more careful reading to Cavity Tut and the post you suggested and I will try again with a simpler mesh. You know, with my 3D geometry I don't think that it is possible to avoid tetrahedral cells...

Anyway, do you think that initial conditions and fvschemes are well defined? I have some doubts about them too and I would like to know if they are acceptable and I can use them in future simulations!

Cheers,

FS
fs.chemech is offline   Reply With Quote

Old   May 31, 2014, 13:34
Default
  #6
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi FS,

The dictionary files "fvSchemes" and "fvSolution" can depend strongly on the solver being used and the simulation itself. Hence my suggestion to start with a simpler case and work from there, preferably from a tutorial case in OpenFOAM's long list of "tutorials" folder... preferably one related to the solver you're planning on using.

The one thing that pops-out to me as a possible shot in the foot is the use of "QUICK" in the "fvSchemes" file. All I know about it is that it's not easy to use...

As for the mesh: as of OpenFOAM 2.3.0, there is a new mesher called foamyHexMesh. AFAIK it generates a mesh starting from the surface into the solution domain (i.e. into the volume mesh) and should provide meshes that are mostly made of hexahedral cells.

Occasional tetrahedral cells aren't necessarily bad for FVM based CFD, but too many or in the wrong places or with distorted shapes should be avoided. But when there are a lot of tetrahedral cells, getting a good solution and/or tetrahedral mesh can get very complicated

Best regards,
Bruno
Tushar@cfd and fs.chemech like this.
__________________
wyldckat is offline   Reply With Quote

Old   June 1, 2014, 18:57
Default
  #7
New Member
 
Filippo
Join Date: May 2014
Posts: 27
Rep Power: 11
fs.chemech is on a distinguished road
Thanks Bruno!!

I'll keep in touch!

Cheers,

FS
fs.chemech is offline   Reply With Quote

Old   June 2, 2014, 00:36
Default
  #8
Senior Member
 
T. Chourushi
Join Date: Jul 2009
Posts: 321
Blog Entries: 1
Rep Power: 17
Tushar@cfd is on a distinguished road

Bruno Santos
, gave better explanation. I hope you are getting solution.
Tushar@cfd 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
High Courant numbre, icoFoam NACA4415 Unknox90 OpenFOAM Running, Solving & CFD 1 June 26, 2014 12:41
Micro Scale Pore, icoFoam gooya_kabir OpenFOAM Running, Solving & CFD 2 November 2, 2013 13:58
same geometry,structured and unstructured mesh,different behaviour. sharonyue OpenFOAM Running, Solving & CFD 13 January 2, 2013 22:40
IcoFoam parallel woes msrinath80 OpenFOAM Running, Solving & CFD 9 July 22, 2007 02:58
Could anybody help me see this error and give help liugx212 OpenFOAM Running, Solving & CFD 3 January 4, 2006 18:07


All times are GMT -4. The time now is 20:15.