Question about the "0.05" in (O.bodies[i.id2].state.jointNormal1.cross(nRef)).norm()>0.05)

Asked by Jiannan Wang

Hello,

I'm quit a newbie of Yade. As I am reading through the /examples/jointedCohesiveFrictionalPM/, there is this if condition in [1] that is puzzling to me: where is the number 0.05 came from? What is the reason of choosing this particular number? Thanks.

Best
Jiannan

[1]. https://github.com/yade/trunk/blob/master/examples/jointedCohesiveFrictionalPM/identifBis.py#L53

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Jiannan Wang
Solved:
Last query:
Last reply:
Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#1

Hi,
You made me realize that the obsolete github repository was still available though obsolete for quite some time now.
Your link is now broken since I turned that repo private (to avoid confusion in the future), sorry for that.
You'll find a similar line on the gitlab repo hopefully.
Regards
Bruno

Revision history for this message
Jiannan Wang (jnwang) said :
#2

Hello Bruno,

Thank you for that. There is the github link:

https://gitlab.com/yade-dev/trunk/-/blob/master/examples/jointedCohesiveFrictionalPM/identifBis.py#L53

Best
Jiannan

Revision history for this message
Jérôme Duriez (jduriez) said :
#3

Hi,

This line wants to check whether two unit normal vectors are different (or not equal).
(please ask if more explanation are necessary here)

If they were equal (including the n1 = - n2 case), their cross product would be strictly the zero vector, with a zero norm. Because we were maybe not too ambitious in terms of precision here, we did not check against zero but against 0.05.

You can see this as a 5% tolerance for error (responsible for false positive in equal comparison). Or as the fact that two vectors whose directions just deviate from 2.9 degrees are here considered as equal (even though they're not)

Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#4

 > not too ambitious in terms of precision here, we did not check against zero but against 0.05

That's fairly tolerant... False positive is no issue?
If you want to check equality as described I think you can check it directly (n1==n2 or n1==-n2).
B

Revision history for this message
Jiannan Wang (jnwang) said :
#5

Hello Jerome and Bruno,

Thank you very much for the explanations. That really helps me understand a lot. Just a follow up question in case I'm not fully grasp the full scope of this, if that is OK: In the case of [1], while it find out the sphere is on the joint with 3 facets already, why not reorient the normal with the fourth facet as before? It is because there is not such thing as state.jointNormal4 or there are more to it?

I hope it is OK to follow up in the same thread. Thank you.

Best
Jiannan

[1]. https://gitlab.com/yade-dev/trunk/-/blob/master/examples/jointedCohesiveFrictionalPM/identifBis.py#L67-69

Revision history for this message
Jérôme Duriez (jduriez) said :
#6

> It is because there is not such thing as state.jointNormal4

That's exactly that. By current design, the JCFpm code is limited to a maximum of 3 different discontinuity planes crossing a given sphere.

Revision history for this message
Jiannan Wang (jnwang) said :
#7

Hello Jerome,

Thank you so much for the helps. Now I can carry on my happy reading :p

Best
Jiannan