CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Bugs (http://www.cfd-online.com/Forums/openfoam-bugs/)
-   -   Minor bug in cellQualityC (http://www.cfd-online.com/Forums/openfoam-bugs/62317-minor-bug-cellqualityc.html)

lr103476 February 13, 2009 07:15

Dear all, I observed for 2
 
Dear all,

I observed for 2D cases that the nonOrthogonality() and faceNonOrthogonality() functions in cellQuality can cause a 'floating points exceptions'. This occurs in the calculation of cosDDotS = Foam::acos((d & s)/(mag(d)*magS + VSMALL)), apparently VSMALL is too small and indeed, when I change this in SMALL, everything works fine again.

Regards, Frank

henry February 13, 2009 07:45

The problem is that for very s
 
The problem is that for very small geometries you will find that SMALL is too big. I guess we will need to make VSMALL a bit bigger, could you find out how much bigger VSMALL has to be for your case?

Thanks

H

lr103476 February 13, 2009 08:12

I already did that. in my case
 
I already did that. in my case VSMALL need to be 1e-16, so almost SMALL.

The case is not very small, just a moving 2D block on a 2D domain which is 25 squared. Overall domain bounding box (-12.5 -12.5 -0.1) (12.5 12.5 0.1).

Frank

mattijs February 13, 2009 08:24

Is the problem in acos getting
 
Is the problem in acos getting a number >1 or in the division?

Could you try something like

Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL)))

gschaider February 13, 2009 08:28

Just my two cents: the point i
 
Just my two cents: the point in that VSMALL constant is to avoid division by zero, and get zero if (d&s) is zero, is it? How about replacing it with max(VSMALL,SMALL*max(mag(d),mag(s))) or something similar that would correlate it to the local sizes. But I havn't looked at the full source so I may be talking nonsense

Bernhard

lr103476 February 13, 2009 08:28

Thanks Mattijs, this solved th
 
Thanks Mattijs, this solved the problem.

Frank


All times are GMT -4. The time now is 11:01.