CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

how to calculate courant number in unstructured grids.

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 1 Post By sbaffini
  • 2 Post By FMDenaro
  • 1 Post By mprinkey

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 23, 2016, 16:13
Default how to calculate courant number in unstructured grids.
  #1
Member
 
a
Join Date: Oct 2014
Posts: 49
Rep Power: 12
cfd@kgp is on a distinguished road
Dear All,

I have developed a unstructured code in 3d, which is basically a implicit code, with SIMPLE algorithm. For accurate transient results, I want to track CFL condition, i.e max Co<1.

Can any one help me how to use the face velocities (for the given cell say "P") and cell volume (V) to calculate local Courant number?


here is the way OPENFOAM does it, but I am unable to decode it

Code:
scalar CoNum = 0.0;
scalar meanCoNum = 0.0;

if (mesh.nInternalFaces())
{
    scalarField sumPhi
    (
        fvc::surfaceSum(mag(phi))().internalField()
    );

    CoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue();

    meanCoNum =
        0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue();
}

Info<< "Courant Number mean: " << meanCoNum
    << " max: " << CoNum << endl;
can anyone help me to write the equation for the red lines, as I am not a expert in C or Openfoam programming


Thanks in advance!
cfd@kgp is offline   Reply With Quote

Old   October 23, 2016, 16:20
Default
  #2
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,882
Rep Power: 73
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
have a look to this response

http://www.cfd-online.com/Forums/ope...nt-number.html
FMDenaro is offline   Reply With Quote

Old   October 23, 2016, 16:30
Smile
  #3
Member
 
a
Join Date: Oct 2014
Posts: 49
Rep Power: 12
cfd@kgp is on a distinguished road
refer next reply
cfd@kgp is offline   Reply With Quote

Old   October 23, 2016, 16:41
Default
  #4
Member
 
a
Join Date: Oct 2014
Posts: 49
Rep Power: 12
cfd@kgp is on a distinguished road
Thanks FMDenaro for a quick and useful reply.

But It will be helpful, if you can elaborate on the following queries,

Does it mean ----> surfaceSum(mag(phi))().internalField() = U*A ? (U is a vector)

and also why 0.5 is multiplied to Co in openfoam implementation?

Also I want to compute Courant number for generalised 3d unstructured (non-uniform) grid, the equation in the suggested blog is restricted to uniform grids --->"The above equation is strictly true only for homogeneous uniform hex-grids"

It will be a great help, if someone can write a equation in terms of "summation of face velocities."
cfd@kgp is offline   Reply With Quote

Old   October 24, 2016, 04:47
Default
  #5
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 2,192
Blog Entries: 29
Rep Power: 39
sbaffini will become famous soon enoughsbaffini will become famous soon enough
Send a message via Skype™ to sbaffini
Consider pages 175-176 in the following book:

https://books.google.it/books?id=r-e...ctured&f=false

CFL is sigma in those equations.

Not an OF expert here but, your excerpt seems to compute the CFL as 0.5 times the ratio between "sum of convective fluxes over faces of a cell" and "volume of the cell" (then, the max over all the cells is considered as final CFL... i think). Factors like 0.5 usually appear in such expressions, which are never actually exact (more often than not they are based on heuristics). It also depends on how such CFL is used. Here it seems that it is just used as a postprocessing step (and not to compute the actual time step to advance the simulation), so it should be relatively unimportant.

I have much more doubts on how the mean CFL is computed, which looks total crap to me... but that's just a personal opinion.
cfd@kgp likes this.
sbaffini is offline   Reply With Quote

Old   October 24, 2016, 04:52
Default
  #6
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,882
Rep Power: 73
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
My opinion is that the CFL parameter is not indipendent from the scheme... I mean, it must be defined by the non-dimensional group appearing in the discretization.
Therefore, for unstructured grid I would consider that equation as an approximation.
sbaffini and cfd@kgp like this.
FMDenaro is offline   Reply With Quote

Old   October 24, 2016, 10:59
Default
  #7
Senior Member
 
Michael Prinkey
Join Date: Mar 2009
Location: Pittsburgh PA
Posts: 363
Rep Power: 25
mprinkey will become famous soon enough
The velocity in the cell is a well-defined quantity in collocated schemes. The problem then becomes the definition of the length scale. For stability purposes, the best definition (IMO) of limiting length scale is the diameter of the largest sphere fitting within the cell. If your mesh doesn't change, you can compute and store that length scale at the start of the simulation and re-use it.

Definitions like what you've posted from OF fail to incorporate the skewness of the cell into the length-scale calculation. For stability, that sort of thing is very important. A hex cell that measures 1x1x0.001 is going to have a length scale of 0.1 (or 0.05?) based on the OF scheme. But for stability, that length scale is more appropriately 0.001.
FMDenaro likes this.
mprinkey is offline   Reply With Quote

Old   October 24, 2016, 12:16
Default
  #8
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,882
Rep Power: 73
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
I agree, the key is the correct definition of the lenght along which a fluid particle moves with its transport velocity. The general meaning of the Courant number is the ratio bewteen the exact trajectory slope and the discrete one defined by grid and discretization. For this reason, defining an arbitrary non-dimensional group is not correct in terms of stability constraint.

I have time, I will collect some of my previous notes on the stability analysis and I will post.
FMDenaro is offline   Reply With Quote

Old   October 24, 2016, 13:03
Default
  #9
Senior Member
 
Michael Prinkey
Join Date: Mar 2009
Location: Pittsburgh PA
Posts: 363
Rep Power: 25
mprinkey will become famous soon enough
I am interested to read your thoughts on this. I view the embedded sphere diameter as a sufficient condition for stability, but perhaps not a necessary one. It seems that there should be a vector dependence in the stability calculation because intuitively, a 2d flow with dx = 1 and dy = 0.001 could have a dt ~ 1 if, say, u=1 and v=0 (or even 0.0001).

I looked briefly at computing stability based on an ellipsoid fully contained within each cell and then taking the length scale as the distance across that ellipsoid along the direction of velocity vector. I think that this is a valid approach, but the fitting of "optimal" ellipsoids inside cells was a geometry problem that I couldn't find time to tackle. I was considering an arbitrary ellipsoid with maximum volume fully contained within a unstructured cell. It becomes a problem of constrained optimization--making it eminently solvable but also a nuisance involving normal distance from planes to the ellipsoid and slack variables--ICK! Problems like that make me wish that I had grad students running around. 8)
mprinkey is offline   Reply With Quote

Old   October 24, 2016, 13:27
Default
  #10
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,882
Rep Power: 73
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Quote:
Originally Posted by mprinkey View Post
I am interested to read your thoughts on this. I view the embedded sphere diameter as a sufficient condition for stability, but perhaps not a necessary one. It seems that there should be a vector dependence in the stability calculation because intuitively, a 2d flow with dx = 1 and dy = 0.001 could have a dt ~ 1 if, say, u=1 and v=0 (or even 0.0001).

I looked briefly at computing stability based on an ellipsoid fully contained within each cell and then taking the length scale as the distance across that ellipsoid along the direction of velocity vector. I think that this is a valid approach, but the fitting of "optimal" ellipsoids inside cells was a geometry problem that I couldn't find time to tackle. I was considering an arbitrary ellipsoid with maximum volume fully contained within a unstructured cell. It becomes a problem of constrained optimization--making it eminently solvable but also a nuisance involving normal distance from planes to the ellipsoid and slack variables--ICK! Problems like that make me wish that I had grad students running around. 8)

I am not sure about the constraint based on the sphere, perhaps also for the fact that a correct velocity component should be addressed. And, what is more, the stability depends on the non-dimensional group appearing in the scheme. I will try to make a brief note as soon as possible.
FMDenaro is offline   Reply With Quote

Old   October 24, 2016, 16:04
Default
  #11
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,882
Rep Power: 73
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
I just recollect a brief note developed for the simple triangular tesselation of a structured grid. I highlighted the role of the non-dimensional parameter but I did not specify the spatial discretization of integrals and derivatives.
You can see that the skweness of the cell is taken into account.
After one specify the spatial discretization, the stability analysis can be performed by the Von Neumann method.
Attached Files
File Type: pdf stability - unstructured.pdf (39.7 KB, 43 views)
FMDenaro is offline   Reply With Quote

Old   October 28, 2016, 10:47
Default Coefficient of Torque
  #12
Member
 
Radwanma
Join Date: Oct 2014
Posts: 30
Rep Power: 12
Radwanma is on a distinguished road
Hi All,

I am just wondering is this form ct = Turbine_Torque / (0.5*density*pi*R^3*wind_speed^2) correct to calculate the torque coefficient directly from FLUENT, PLEASE?
Regards,
Radwanma is offline   Reply With Quote

Old   October 28, 2016, 12:53
Default
  #13
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,882
Rep Power: 73
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Quote:
Originally Posted by Radwanma View Post
Hi All,

I am just wondering is this form ct = Turbine_Torque / (0.5*density*pi*R^3*wind_speed^2) correct to calculate the torque coefficient directly from FLUENT, PLEASE?
Regards,
you are in the wrong section
FMDenaro is offline   Reply With Quote

Reply

Tags
implementation courant


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
decomposePar no field transfert Jeanp OpenFOAM Pre-Processing 3 June 18, 2022 13:01
simpleFoam parallel AndrewMortimer OpenFOAM Running, Solving & CFD 12 August 7, 2015 19:45
SigFpe when running ANY application in parallel Pj. OpenFOAM Running, Solving & CFD 3 April 23, 2015 15:53
foam-extend_3.1 decompose and pyfoam warning shipman OpenFOAM 3 July 24, 2014 09:14
Cluster ID's not contiguous in compute-nodes domain. ??? Shogan FLUENT 1 May 28, 2014 16:03


All times are GMT -4. The time now is 22:50.