← Back to team overview

yade-users team mailing list archive

Re: Be carefull with "normalize"

 

Luc Sibille said:     (by the date of Wed, 04 Feb 2009 18:09:01 +0100)

> Hi,
> 
>   Is the "normalize" function from wm3 used currently in Yade? I mean 
> not in specific packages your are developing at the present time but in 
> some basic and usual computation made in Yade.
> I think for instance to the computation of the normal vector defining 
> the intergranular contact plane (for the DEM), or something else. If yes 
> it could a real problem...
> 
> Bruno have you got an idea of the default value of the "tolerance" 
> value?  The reason for this check could be to avoid a division by zero 
> or "something" to close to zero.

see: 

lib/miniWm3/Wm3Vector3.inl line 301

lib/miniWm3/Wm3Math.cpp line 29:

  template<> const double Math<double>::ZERO_TOLERANCE = 1e-20;


In my snow grains simulation I'm dealing with really small triangles,
because the base unit is meter. And the snow grain average diameter is
0.001m and the size of triangles that form a polyhedron representing
the whole grain is about 0.000001m (but smaller are possible).

I was calculating normals for those triangles (it's necessary for
collision detection between polyhedrons), and suddenly some triangles
were disappearing. Finally I've found the reason - the length of
cross product was less than 1e-20, for example: 1.221342351454256e-21
(we have 16 digits of precision with double).

This function Normalize() is used everywhere in yade. But I don't know where :)
We could try 'grep Normalize ./* -R' to see where it is used.
For example I don't see it in ElasticContactLaw.

If someone is making simulations with spheres smaller than... I don't
know, maybe 0.00001m then maybe he has a problem...

-- 
Janek Kozicki                                                         |



References