[Yade-users] [Question #665379]: penetrationDepth calculation

2018-03-08 Thread Andrea Puglisi
New question #665379 on Yade:
https://answers.launchpad.net/yade/+question/665379

Hi, I would like to understand the way "penetrationDepth" is calculated. For 
instance, in a simple collision between two identical spheres I've seen that it 
does not correspond to x1-x2-2*r where r is the radius of the spheres. I've 
been looking into the code and found for instance in Sphere_Sphere_ScGeom 
https://github.com/yade/trunk/blob/master/pkg/dem/Ig2_Sphere_Sphere_ScGeom.cpp 
(line 21)
that the distance is shifted by a vector "shift2" which is passed to the 
function
Vector3r normal=(se32.position+shift2)-se31.position;
but whose definition I cannot trace back 

I suspect that this serves the purpose of interlaced force evaluation for runge 
kutta etc. but I would like to have a confirmation

Thanks for any help

Andrea



-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #665379]: penetrationDepth calculation

2018-03-09 Thread Jan Stránský
Question #665379 on Yade changed:
https://answers.launchpad.net/yade/+question/665379

Status: Open => Answered

Jan Stránský proposed the following answer:
Hello Andrea,
shift2 is used for periodic contact detection, have a look at [1]. See [2] for 
the meaning of Interaction::cellDist.
cheers
Jan

[1] 
https://github.com/yade/trunk/blob/master/pkg/common/InteractionLoop.cpp#L113
[2] 
https://yade-dem.org/doc/formulation.html#collision-detection-in-periodic-cell

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #665379]: penetrationDepth calculation

2018-03-09 Thread Bruno Chareyre
Question #665379 on Yade changed:
https://answers.launchpad.net/yade/+question/665379

Bruno Chareyre proposed the following answer:
Hi, 
It does correspond to x1-x2-2*r.
Cheers
Bruno

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #665379]: penetrationDepth calculation

2018-03-09 Thread Andrea Puglisi
Question #665379 on Yade changed:
https://answers.launchpad.net/yade/+question/665379

Status: Answered => Open

Andrea Puglisi is still having a problem:
Thanks Jan and Bruno. From Jan'answer I understand that the variable
shift2 should not be a problem in my example (I have no periodicity, it
is just a collision between two spheres). From Bruno's answer I learn
that there is something wrong in my script where I measure both the
quantity overlap=2*r-(x2-x1)  (I have x2>x1) and the quantity
interaction.geom.penetrationDepth and they do not coincide.

My script is the following. The graph of the two quantity  penetrationDepth vs. 
overlap can be found at this shared link
https://drive.google.com/file/d/1r6YWwbg56jIN3EGB4RzoBRGHgHyHAhir/view?usp=sharing

#!/usr/bin/python
# -*- coding: utf-8 -*-

from yade import pack,ymport,export,geom,bodiesHandling,qt,plot
import math

rad = 0.00774

f=open("forces.dat" , "w")
def forces():
x1 = O.bodies[0].state.pos[0]
v1 = O.bodies[0].state.vel[0]
v2 = O.bodies[1].state.vel[0]
x2 = O.bodies[1].state.pos[0]
ov = 2*rad-(x2-x1)
intrs = O.bodies[0].intrs()
if (len(intrs)):
nfx = intrs[0].phys.normalForce[0]
nfy = intrs[0].phys.normalForce[1]
nfz = intrs[0].phys.normalForce[2]
sfx = intrs[0].phys.shearForce[0]
sfy = intrs[0].phys.shearForce[1]
sfz = intrs[0].phys.normalForce[2]
dep = intrs[0].geom.penetrationDepth

else:
nfx = nfy = nfz = sfx = sfy = sfz = dep = 0
f.write ("%6d %12.8f %12.8f %12.8f %12.8f %9.6f %9.6f %9.6f %9.6f %9.6f 
%9.6f %12.8f\n" %   (O.iter,O.time,ov,v1,v2,nfx,nfy,nfz,sfx,sfy,sfz,dep))
f.flush()

O.materials.append(FrictMat(young=0.1e9,poisson=.22,frictionAngle=0,density=2300,label='glass'))
Sph_1 = O.bodies.append([sphere([0,0,0], radius=rad, material = "glass")])
Sph_2 = O.bodies.append([sphere([0.1,0,0], radius=rad, material = "glass")])
O.bodies[1].state.vel = Vector3(-0.3,0,0)
O.bodies[0].state.vel = Vector3(0.3,0,0)

O.engines=[
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb(),  
],label='collider'),
InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_MindlinPhys()],  
[Law2_ScGeom_MindlinPhys_Mindlin()],
),
NewtonIntegrator(damping=0.0,exactAsphericalRot=True,gravity=(0,0,0)),
PyRunner(command='forces()', iterPeriod=1),
]


O.dt=PWaveTimeStep()  
try:
from yade import qt
qt.Controller()
qt.View()
except ImportError: pass
O.saveTmp()
O.timingEnabled=True

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #665379]: penetrationDepth calculation

2018-03-09 Thread Andrea Puglisi
Question #665379 on Yade changed:
https://answers.launchpad.net/yade/+question/665379

Status: Open => Solved

Andrea Puglisi confirmed that the question is solved:
A, I've understood my error! The overlap contained in
penetrationDepth is the one computed for the force, which corresponds to
positions at the previous step! Sorry to make you lose your precious
time and thanks for help anyway!

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp