# branch vector & contact normal

Hi all,

I want to get the macroscale stress for a local region. I use the equation in Catherine O’Sullivan's book (page 325, equation 9.38). this book is here:
https://www.dropbox.com/sh/1u8rg4updoqlk9b/AAB9VATX_QTs5-zrszLCZxBva?dl=0
In this equation, we need the branch vector, it said that the brach vector for contact c directed from particle a to particle b. we can get the branch vector in.
for branch vector: we can use p2-p1, we can also use p1-p2 (here p means the position vector of the particle),

In the excel I provided the results of the branch vector and the contact normal, I use the following code to get the branch vector as well we the contact normal.
######################
body_id1 = O.bodies[i.id1]
body_id2 = O.bodies[i.id2]
branch_vector_cal_1 = body_id1.state.pos-body_id2.state.pos
branch_vector_cal_2 = body_id1.state.pos-body_id2.state.pos
branch_vector_cal_3 = body_id1.state.pos-body_id2.state.pos
branch_vector_nrom_cal = math.sqrt((branch_vector_cal_1)**2+(branch_vector_cal_2)**2+(branch_vector_cal_3)**2)
contact_orientation_cal_1 = i.geom.normal
contact_orientation_cal_2 = i.geom.normal
contact_orientation_cal_3 = i.geom.normal
contact_orientation_norm_cal = math.sqrt((contact_orientation_cal_1)**2+(contact_orientation_cal_2)**2+(contact_orientation_cal_3)**2)
#########################
it shows that the norm for the branch vector and the contact normal are not the same. but  says that the contact normal is: Unit vector oriented along the interaction, from particle #1, towards particle #2.
the results in the excel shows that the components for the branch vector and contact normal for each contact point has the same ratio,(no matter its a negative or positive value)

so, the definition of the contact normal is the contact point to the center of the particle (which particle?) or the contact normal is the vector connects the center of these two particles? if it is the vector connects two centers, why the branch vector is not the same as the contact normal?

I know it's easy to implement this equation using python(no matter using the branch vector or contact normal), I just want to know the difference of the branch vector and contact normal in YADE.

thanks
Yong

## Question information

Language:
English Edit question
Status:
For:
Assignee:
No assignee Edit question
Last query:
2020-05-01
2020-05-02
 Jan Stránský (honzik) said on 2020-05-01: #1

Hi,

> why the branch vector is not the same as the contact normal?
> contact normal is: Unit vector

i.geom.normal is normalized (unit) vector from the branch vector (for the case of sphere-sphere contact)

> i mean which one should I choose.

consistently with which one force you choose (applied on body1 or body2)

cheers
Jan

 nobody (nobody01) said on 2020-05-01: #2

Hi Jan,

>consistently with which one force you choose (applied on body1 or body2)

could you explain more clearly?

thanks!
Yong

 Jan Stránský (honzik) said on 2020-05-02: #3

stress = ... f_i l_j
l ... branch
f ... force
Branch can be lAB (from particleA to particleB) or lBA (from particleB to particleA).
The same for force. It is internal force, and can be either fAB (force applied to particleB) or fBA (force applied to particleA).
It does not matter if you choose AB or BA (multiplication makes the result the same), but you have to be consistent (using the "same" for both branch and force).

This formula is usually denoted as Love-Weber stress tensor in Yade and is utilized in utils.bodyStressTensors [1,2], utils.getStress [3,4] and probably other places.

cheers
Jan

### non-uniqueness of branch and internal force
O.bodies.append((sphere((0,0,0),2),sphere((2,0,0),2)))
O.step()
i = O.interactions[0,1]
b1,b2 = [O.bodies[j] for j in (i.id1,i.id2)]
print("branch12",b2.state.pos - b1.state.pos)
print("branch21",b1.state.pos - b2.state.pos)
print("normal",i.geom.normal)
print("force",i.phys.normalForce + i.phys.shearForce)
print("force1",O.forces.f(i.id1))
print("force2",O.forces.f(i.id2))
###