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


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


[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 #664343]: Lack of recoil in sphere-pfacet impact?

2018-02-21 Thread Andrea Puglisi
Question #664343 on Yade changed:
https://answers.launchpad.net/yade/+question/664343

Status: Answered => Open

Andrea Puglisi is still having a problem:
Dear Bruno, thanks for your comment. I understand what you mean and in fact I'm 
not surprised by the behaviour in my last posted code (pfacet-pfacet 
collision). My problem is with the code posted in my first message where a 
sphere collides with a pfacet e the (non-fixed) pfacet does not recoil. Any 
hint about that? Thanks
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 #664343]: Lack of recoil in sphere-pfacet impact?

2018-02-20 Thread Andrea Puglisi
Question #664343 on Yade changed:
https://answers.launchpad.net/yade/+question/664343

Status: Answered => Open

Andrea Puglisi is still having a problem:
Dear Jérôme, thanks for your answer. Unfortunately I found no change in
behavior after changing the variables O.bodies[i].state.blockedDOFs  of
the elements of the pfacet. Most importantly, I can exhibit many
examples where the pfacet moves after interaction among themselves, even
if their degrees of freedom (according to the variable blockedDOFs) are
totally blocked. For instance

from yade.gridpfacet import *
from yade import pack,ymport,export,geom,bodiesHandling,qt

phimat=30.  # friction angle
E=1e8   # Young's modulus

 Engines 
O.engines=[
ForceResetter(),
InsertionSortCollider([
Bo1_Sphere_Aabb(),
Bo1_Wall_Aabb(),
Bo1_PFacet_Aabb(),
Bo1_Facet_Aabb(),
]),
InteractionLoop(
[
  Ig2_GridNode_GridNode_GridNodeGeom6D(),#internal = ScGeom6D
 Ig2_Sphere_PFacet_ScGridCoGeom(), #cyl-facet 
 Ig2_Wall_Sphere_ScGeom(),#cyl-wall
 Ig2_Wall_PFacet_ScGeom(),
 Ig2_PFacet_PFacet_ScGeom(),
 Ig2_Sphere_Sphere_ScGeom(),
 Ig2_Facet_Sphere_ScGeom(),
],
[
  
Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(setCohesionNow=True,setCohesionOnNewContacts=False),
 
 Ip2_FrictMat_FrictMat_FrictPhys()  
],
[
  Law2_ScGeom6D_CohFrictPhys_CohesionMoment(),  
 Law2_ScGeom_FrictPhys_CundallStrack(),   
]
),
  NewtonIntegrator(gravity=(0.,0,-0.01),damping=0),
]


O.materials.append( CohFrictMat( 
young=E*1e2,poisson=0.3,density=100,frictionAngle=radians(phimat),normalCohesion=1e10,shearCohesion=1e10,momentRotationLaw=True,label='cMat'
 ) ) 
O.materials.append( FrictMat( 
young=E,poisson=0.3,density=1000,frictionAngle=radians(phimat),label='fMat' ) ) 

# Create two pfacets
rr=0.02

v1=Vector3(0,0,5)
v2=Vector3(0,1,5)
v3=Vector3(1,0,3)
vertices=[v1,v2,v3]
pfacetCreator1(vertices,rr,nodesIds=[],cylIds=[],pfIds=[],wire=False,color=[1,1,1],fixed=False,materialNodes='cMat',material='fMat')

v1=Vector3(-1,-1,0)
v2=Vector3(-1,2,0)
v3=Vector3(2,-1,0)
vertices=[v1,v2,v3]
pfacetCreator1(vertices,rr,nodesIds=[],cylIds=[],pfIds=[],wire=False,color=[1,1,1],fixed=True,materialNodes='cMat',material='fMat')


 For viewing 
from yade import qt
qt.View()
qtr = qt.Renderer()

 Set a time step 
O.dt=PWaveTimeStep()  # non accurate time-step

 Allows to reload the simulation 
O.saveTmp()


--
(sorry I have no idea how ti make smaller examples)

-- 
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


[Yade-users] [Question #664343]: Lack of recoil in sphere-pfacet impact?

2018-02-13 Thread Andrea Puglisi
New question #664343 on Yade:
https://answers.launchpad.net/yade/+question/664343

I am studying the interaction of pfacets with other objects, since I have it 
not completely clear in my mind. I've seen that pfacets interact "apparently 
realistically" with other pfacets. However I have an example where a sphere 
collides with a pfacet, bounces back correctly but does not transfer any 
momentum to the pfacet (no nodes or connections move after the end of the 
impact). Why?

This is my code

---

from yade.gridpfacet import *
from yade import pack,ymport,export,geom,bodiesHandling,qt

vr=0.2  
vh=0.4   
rr=0.02  

phimat=30.  # friction angle
E=1e8   # Young's modulus

f = open("state.dat", "w")

intf = 0

def state(si,intf):
  if (len(O.interactions.withBody(si))>0):
forc = O.interactions.withBody(si)[0].phys.normalForce[1]
  else:
forc = 0
  intf += forc*O.dt/O.bodies[si].state.mass
  f.write ("%d %f %f %f %f\n" % 
(O.iter,O.bodies[si].state.se3[0][1],O.bodies[si].state.vel[1],forc,intf))
  #tempo  coord y sfera vel y 
sfera  forza sulla sfera integr-forza
  f.flush()
  return intf


 Engines 
O.engines=[
ForceResetter(),
InsertionSortCollider([
Bo1_Sphere_Aabb(),
Bo1_Wall_Aabb(),
Bo1_PFacet_Aabb(),
Bo1_Facet_Aabb(),
]),
InteractionLoop(
[
  Ig2_GridNode_GridNode_GridNodeGeom6D(),#internal = ScGeom6D
 Ig2_Sphere_PFacet_ScGridCoGeom(), #cyl-facet 
 Ig2_Wall_Sphere_ScGeom(),#cyl-wall
 Ig2_Wall_PFacet_ScGeom(),
 Ig2_PFacet_PFacet_ScGeom(),
 Ig2_Sphere_Sphere_ScGeom(),
 Ig2_Facet_Sphere_ScGeom(),
],
[
  
Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(setCohesionNow=True,setCohesionOnNewContacts=False),
 
 Ip2_FrictMat_FrictMat_FrictPhys()  
],
[
  Law2_ScGeom6D_CohFrictPhys_CohesionMoment(),  
 Law2_ScGeom_FrictPhys_CundallStrack(),   
]
),
NewtonIntegrator(gravity=(0.,0,0),damping=0),
#
qt.SnapshotEngine(fileBase='experiment',iterPeriod=2000,label='snapshot'),
PyRunner(command='intf = state(sphId,intf)',iterPeriod=1), # call 
myFunction every 100 steps
]



 Creat materials 
O.materials.append( CohFrictMat( 
young=E*1e2,poisson=0.3,density=100,frictionAngle=radians(phimat),normalCohesion=1e10,shearCohesion=1e10,momentRotationLaw=True,label='cMat'
 ) ) # material to create the gridConnections
O.materials.append( FrictMat( 
young=E,poisson=0.3,density=1000,frictionAngle=radians(phimat),label='fMat' ) ) 
# material for general interactions

# Create ONE WALL #
xw = 0
yw = 0
lwall = 10*vr
hwall = 2*vh

v1=Vector3(xw,yw,0)
v2=Vector3(xw+lwall,yw,0)
v3=Vector3(xw,yw,hwall)
vertices=[v1,v2,v3]
pfacetCreator1(vertices,rr,nodesIds=[],cylIds=[],pfIds=[],wire=False,color=[1,1,1],fixed=False,materialNodes='cMat',material='fMat')


#sphId = O.bodies.append(sphere([xw+lwall/3.,yw+rr*4,hwall/3.], 
radius=rr,color=(1,0,0)))
sphId = O.bodies.append(sphere([0,rr*4,0], radius=rr,color=(1,0,0)))

O.bodies[sphId].state.vel = Vector3(0,-0.1,0)



 For viewing 
from yade import qt
qt.View()
Gl1_Sphere.stripes=True
qtr = qt.Renderer()

 Set a time step 
#O.dt=1e-05
O.dt=PWaveTimeStep()  # non accurate time-step

 Allows to reload the simulation 
O.saveTmp()



-- 
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 #660871]: run a script in background

2017-11-24 Thread Andrea Puglisi
Question #660871 on Yade changed:
https://answers.launchpad.net/yade/+question/660871

Andrea Puglisi posted a new comment:
Thanks also to Klaus, but your suggestion (interesting) is more than
what I needed.

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


[Yade-users] [Question #660871]: run a script in background

2017-11-17 Thread Andrea Puglisi
New question #660871 on Yade:
https://answers.launchpad.net/yade/+question/660871

Hi,

is there any possibility of running a simulation without any prompt? I 
understand that I can run with "yade -n" to avoid graphical interface, but 
still it need to open a python prompt and wait for my input. I would like to 
launch it from command line and let it run in background (for instance with 
final "&").

Any hint? I looked for thin info in the manual, but I could not find it.

Thanks

 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 #643798]: gridpfacet.cylinder interacting with walls, spheres, facetbox etc.

2017-11-15 Thread Andrea Puglisi
Question #643798 on Yade changed:
https://answers.launchpad.net/yade/+question/643798

Andrea Puglisi confirmed that the question is solved:
Thanks Klaus Thoeni, that solved my question.

-- 
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 #643798]: gridpfacet.cylinder interacting with walls, spheres, facetbox etc.

2017-11-14 Thread Andrea Puglisi
Question #643798 on Yade changed:
https://answers.launchpad.net/yade/+question/643798

Andrea Puglisi posted a new comment:
In particular I don't undestand why a simple grid (connection of nodes
and cylinders) works reasonably well, it does not work anymore as soon
as I create pfacets.  This is a minimal example

---

from yade.gridpfacet import *

# Parameter 
r=1 # base radius
rr=0.1  #cyl radius
phi=30. # friction angle
E=1e7   # Young's modulus

 Engines 
O.engines=[
 ForceResetter(),
 InsertionSortCollider([
  Bo1_Sphere_Aabb(),
  Bo1_Wall_Aabb(),
  Bo1_PFacet_Aabb(),
 ]),
 InteractionLoop([
  Ig2_GridNode_GridNode_GridNodeGeom6D(),#internal
  Ig2_Wall_Sphere_ScGeom(),#cyl-wall
  Ig2_Sphere_PFacet_ScGridCoGeom(), #cyl-facet
 ],
 [
  
Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(setCohesionNow=True,setCohesionOnNewContacts=False),
 # internal
  Ip2_FrictMat_FrictMat_FrictPhys() # external (cyl-wall, cyl-facet)
 ],
 [
  Law2_ScGeom6D_CohFrictPhys_CohesionMoment(),  # contact law for "internal" 
cylinder forces
  Law2_ScGeom_FrictPhys_CundallStrack(),# contact law for "external" 
cylinder forces
 ]
 ),
 NewtonIntegrator(gravity=(-0.,0,-10),damping=0.5,label='newton'),
]

 Creat materials 
O.materials.append( CohFrictMat( 
young=E,poisson=0.3,density=1000,frictionAngle=radians(phi),normalCohesion=1e10,shearCohesion=1e10,momentRotationLaw=True,label='cMat'
 ) ) # material to create the gridConnections
O.materials.append( FrictMat( 
young=E,poisson=0.3,density=1000,frictionAngle=radians(phi),label='fMat' ) ) # 
material for general interactions

 Create box and wall 
wallId = O.bodies.append( wall(position=(0,0,0),sense=0, 
axis=2,color=[0,1,1],material='fMat') )
O.bodies[wallId].state.vel=Vector3(1.,0,0)
O.bodies[wallId].mask=3

 Create cylinder 
nodeIds=[]
cylIds=[]
nodeIds.append( O.bodies.append( 
gridNode([0,2*r,r],rr,wire=False,fixed=False,material='cMat',color=[1,0,0]) ) )
nodeIds.append( O.bodies.append( 
gridNode([0,2*r,3*r],rr,wire=False,fixed=False,material='cMat',color=[1,0,0]) ) 
)
nodeIds.append( O.bodies.append( 
gridNode([0,4*r,r],rr,wire=False,fixed=False,material='cMat',color=[1,0,0]) ) )

for id in nodeIds:
  O.bodies[id].bounded=1
  O.bodies[id].mask=2

cylIds.append( O.bodies.append( 
gridConnection(nodeIds[1],nodeIds[0],rr,color=[1,0,0],material='fMat') ) )
cylIds.append( O.bodies.append( 
gridConnection(nodeIds[2],nodeIds[1],rr,color=[1,0,0],material='fMat') ) )
cylIds.append( O.bodies.append( 
gridConnection(nodeIds[0],nodeIds[2],rr,color=[1,0,0],material='fMat') ) )

#COMMENT THE FOLLOWING LINE AND PHYSICS SEEMS WORK WELL - OTHERWISE IT FALLS 
THROUGH THE FLOOR
O.bodies.append( 
pfacet(nodeIds[0],nodeIds[1],nodeIds[2],wire=False,color=[1,1,0],highlight=False,material='fMat')
 )

 For viewing 
from yade import qt
qt.View()
Gl1_Sphere.stripes=True
qtr = qt.Renderer()

 Set a time step 
O.dt=1e-05

 Allows to reload the simulation 
O.saveTmp()

-- 
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 #643798]: gridpfacet.cylinder interacting with walls, spheres, facetbox etc.

2017-11-13 Thread Andrea Puglisi
Question #643798 on Yade changed:
https://answers.launchpad.net/yade/+question/643798

Status: Answered => Open

Andrea Puglisi is still having a problem:
Dear Klaus,

with quite a large delay I wish to thank you. I continued to work with
clumps of spheres, it seemed to me simpler. Now I would like to try
again with the pfacet approach. I am trying a simple exercise, i.e.
replace your cylinder with an object (a tetrahedron from a .gts file,
http://gts.sourceforge.net/samples/tetrahedron.gts.gz ) which *should*
be transported by the horizontal belt.

Again I face the problem already described to you at the beginning. The
object apparently does not interact with the belt. I can't understand
the basic rules of interaction of grids.

from yade.gridpfacet import *

# Parameter 
   
r=1 # radius cylinder   
   
phi=30. # friction angle
   
E=1e7   # Young's modulus   
   

 Engines    
   
O.engines=[
 ForceResetter(),
 InsertionSortCollider([
  Bo1_Sphere_Aabb(),
  Bo1_Wall_Aabb(),
  Bo1_PFacet_Aabb(),
 ]),
 InteractionLoop([
  Ig2_GridNode_GridNode_GridNodeGeom6D(),
  Ig2_Wall_Sphere_ScGeom(),
  Ig2_Sphere_PFacet_ScGridCoGeom(),
 ],
 [
  
Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(setCohesionNow=True,setCohesionOnNewContacts=False),
 # internal cylinder physics
  Ip2_FrictMat_FrictMat_FrictPhys() # physics for external interactions, 
i.e., cylinder-cylinder interaction   
 ],
 [
  Law2_ScGeom6D_CohFrictPhys_CohesionMoment(),  # contact law for "internal" 
cylinder forces   
  Law2_ScGeom_FrictPhys_CundallStrack(),
 ]
 ),
 NewtonIntegrator(gravity=(-0.,0,-10),damping=0.5,label='newton'),
]

 Creat materials    
   
O.materials.append( CohFrictMat( 
young=E,poisson=0.3,density=1000,frictionAngle=radians(phi),normalCohesion=1e10,shearCohesion=1e10,momentRota\
tionLaw=True,label='cMat' ) ) # material to create the gridConnections  
   
O.materials.append( FrictMat( 
young=E,poisson=0.3,density=1000,frictionAngle=radians(phi),label='fMat' ) ) # 
material for general interactions

 Create box and wall    
   
wallId = O.bodies.append( wall(position=(0,0,0),sense=0, 
axis=2,color=[0,1,1],material='fMat') )
O.bodies[wallId].state.vel=Vector3(1.,0,0)
O.bodies[wallId].mask=3

 Create cylinder    
   
#nodeIds=[] 
   
#cylIds=[]  
   
#nodeIds.append( O.bodies.append( 
gridNode([0,2*r,0],r,wire=False,fixed=False,material='cMat',color=[1,0,0]) ) )  
 
#nodeIds.append( O.bodies.append( 
gridNode([0,2*r,2*r],r,wire=False,fixed=False,material='cMat',color=[1,0,0]) ) 
) 


nodeIds,cylIds,pfIds =  
gtsPFacet('tetra.gts',shift=(0,0,3),scale=1.,radius=1e-2,wire=False,fixed=False,materialNodes='cMat',material='fMat',c\
olor=[0,0,1])

for id in nodeIds:
  O.bodies[id].bounded=1
  O.bodies[id].mask=2

#cylIds.append( O.bodies.append(
gridConnection(nodeIds[1],nodeIds[0],r,color=[1,0,0],material='fMat') )
)


 Creat a pFacets -> based on 3 vertices 

#v1=Vector3(0,4*r,0)
   
#v2=Vector3(20*r,-r,0)  
   
#v3=Vector3(20*r,-r,10*r)   
   
#vertices=[v1,v2,v3]
   
#pfacetCreator1(vertices,r/2.,nodesIds=[],cylIds=[],pfIds=[],wire=False,color=[1

Re: [Yade-users] [Question #657564]: continuous creation and destruction of bodies

2017-09-06 Thread Andrea Puglisi
Question #657564 on Yade changed:
https://answers.launchpad.net/yade/+question/657564

Andrea Puglisi posted a new comment:
Dear Jan
thanks also for your message. Your conclusion is puzzling, i.e. it seems to 
contradict some statements found in the .cpp and .hpp linked by Jerome above.

Indeed in [2] at line 60 I read  
"b->id=-1;//else it sits in the python scope without a chance to be 
inserted again"

And in [1] at line 22 I read

 "Container of bodies implemented as flat std::vector. It handles body removal 
and
 intelligently reallocates free ids for newly added ones. 
 The nested iterators and the specialized FOREACH_BODY macros above will 
silently skip null body pointers which may exist after 
 removal. The null pointers can still be accessed via the [] operator. "


One explanation could be that your example is too small, i.e. the engine
of shared_ptr allocation does not reuse old (freed) memory until it is
really necessary, that is after many new insertions. As soon as I have
time I will try to conceive a modification of Jan's example with a much
larger number of bodies deleted and inserted.

Any other ideas?

Thanks a lot to everybody for the prompt help

Andrea


[1] https://github.com/yade/trunk/blob/master/core/BodyContainer.hpp
[2] https://github.com/yade/trunk/blob/master/core/BodyContainer.cpp

-- 
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 #657564]: continuous creation and destruction of bodies

2017-09-06 Thread Andrea Puglisi
Question #657564 on Yade changed:
https://answers.launchpad.net/yade/+question/657564

Andrea Puglisi posted a new comment:
Thanks to both Duriez and Caulk, your answers seem very useful. I study
them and I will let you know if everything is ok (as it seems from your
discussion).

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


[Yade-users] [Question #657564]: continuous creation and destruction of bodies

2017-09-05 Thread Andrea Puglisi
New question #657564 on Yade:
https://answers.launchpad.net/yade/+question/657564

Hi,
the simulation I am writing aims at reproducing a conveyor belt that transports 
certain objects from an inlet to an outlet. This implies that I need to create 
bodies - at the inlet - at a given rate during the whole simulation's time, not 
only at the beginning. Moreover, bodies should disappear from the simulation 
when they reach the outlet (in principle at a similar rate). Both operations 
(creation and destruction of bodies) are not a problem. However I am not sure 
that yade disposes of freed memory in an optimal way. Is there a risk of 
consuming all the memory with the ghosts of unused bodies? In c or c++ there 
are ways to reallocate freed memory. Does yade provide to it automatically?

 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 #643666]: plot.plot giving QObject::connect: cannot connect (apt-get installed yade)

2017-06-14 Thread Andrea Puglisi
Question #643666 on Yade changed:
https://answers.launchpad.net/yade/+question/643666

Status: Answered => Open

Andrea Puglisi is still having a problem:
"Line by line" was just to specify that I ensured to have the correct
indentation. I had not realized that I do not need to copypaste from the
website, since the file is in /usr/share/doc/yade/examples. If I launch
with just

> yade simple-scene-plot.py

I get:

Welcome to Yade 2016.06a
TCP python prompt on localhost:9001, auth cookie `ecdays'
XMLRPC info provider on http://localhost:21001
Running script simple-scene-plot.py
Now calling plot.plot() to show the figures. The timestep is artificially
low so that you can watch graphs being updated live.
QObject::connect: Cannot connect NavigationToolbar2QT::message(QString) to
(null)::_show_message()
Traceback (most recent call last):
  File "/usr/bin/yade", line 182, in runScript
execfile(script,globals())
  File "simple-scene-plot.py", line 46, in 
plot.plot(subPlots=False)
  File "/usr/lib/x86_64-linux-gnu/yade/py/yade/plot.py", line 592, in plot
createPlots(subPlots=subPlots)
  File "/usr/lib/x86_64-linux-gnu/yade/py/yade/plot.py", line 380, in
createPlots
if not subPlots: pylab.figure()
  File "/usr/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 527,
in figure
**kwargs)
  File
"/usr/lib/python2.7/dist-packages/matplotlib/backends/backend_qt5agg.py",
line 43, in new_figure_manager
return new_figure_manager_given_figure(num, thisFig)
  File
"/usr/lib/python2.7/dist-packages/matplotlib/backends/backend_qt5agg.py",
line 51, in new_figure_manager_given_figure
return FigureManagerQT(canvas, num)
  File
"/usr/lib/python2.7/dist-packages/matplotlib/backends/backend_qt5.py", line
465, in __init__
self.toolbar.message.connect(self._show_message)
TypeError: connect() failed between NavigationToolbar2QT.message[str] and
_show_message()
[[ ^L clears screen, ^U kills line. F12 controller, F11 3d view (use h-key
for showing help), F10 both, F9 generator, F8 plot. ]]


On Wed, Jun 14, 2017 at 2:23 PM, Bruno Chareyre <
question643...@answers.launchpad.net> wrote:

> Your question #643666 on Yade changed:
> https://answers.launchpad.net/yade/+question/643666
>
> Status: Open => Answered
>
> Bruno Chareyre proposed the following answer:
> >1) If I launch yade and immediately press F8
>
> In this situation there is nothing to plot, hence the message
> "warnings.warn('plot.plot not showing figure"
>
> >2) If I launch yade and paste (line by line) the example
>
> Why do you specify "line by line"? Does it mean that simply running the
> script is not giving the error?
>
> --
> If this answers your question, please go to the following page to let us
> know that it is solved:
> https://answers.launchpad.net/yade/+question/643666/+confirm?answer_id=0
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.launchpad.net/yade/+question/643666
>
> You received this question notification because you asked the question.
>

-- 
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


[Yade-users] [Question #643798]: gridpfacet.cylinder interacting with walls, spheres, facetbox etc.

2017-06-14 Thread Andrea Puglisi
New question #643798 on Yade:
https://answers.launchpad.net/yade/+question/643798

I would like to have cylinders moving on a conveyor belt (horizontal wall with 
given velocity) and colliding with lateral walls (facetboxes). I am trying to 
compare the performance of two kinds of cylnders: clumps of spheres and 
gridpfacets. I prepared this basic script. The clumps do all I wish (they are 
transported by the conveyor horizontal wall, interact with the lateral 
facetboxes and among themselves). The gridpfacet cylinder is not transported 
(it seems it does not interact with the horizontal wall neither with the 
newtonintegrator). If I impose a velocity to it - uncommenting the commented 
line - (perhaps not in a very smart way), I see a part of the cylinder moving 
but it does not interact with the walls or with the spheres.



from yade import pack,ymport,export,geom,bodiesHandling
from yade.gridpfacet import *

rad,gap=.05,.01
r=0.5   
phi=30. 
E=1e6   

O.materials.append(FrictMat(young=10e9,poisson=.25,frictionAngle=0.5,density=1e3))
O.materials.append( CohFrictMat( 
young=E,poisson=0.3,density=1000,frictionAngle=radians(phi),normalCohesion=1e10,shearCohesion=1e10,momentRotationLaw=True,label='cMat'
 ) ) 
O.materials.append( FrictMat( 
young=E,poisson=0.3,density=1000,frictionAngle=radians(phi),label='fMat' ) )  


kw={'material':0}
kwBoxes={'color':[1,0,0],'wire':False,'dynamic':False,'material':0}
kwMeshes={'color':[1,1,0],'wire':True,'dynamic':False,'material':0}


nodesIds=[]
cylIds=[]
color=[1,0,0]
cylgrid = 
cylinder((2,0,0.),(2,0,0.5),radius=r,nodesIds=nodesIds,cylIds=cylIds,fixed=False,color=color,intMaterial='cMat',extMaterial='fMat',mask=3)
# uncomment this to make the pfacet-cylinder move
# O.bodies[cylIds[0]].state.vel=Vector3(0,1,0)


cylTuple =  
O.bodies.appendClumped(pack.regularOrtho(pack.inCylinder((0,1,0),(0,1,0.5),0.5),radius=rad,gap=gap,color=(0,0,1),**kw))
O.bodies[cylTuple[0]].mask=3

cylTuple2 =  
O.bodies.appendClumped(pack.regularOrtho(pack.inCylinder((0,-1,0),(0,-1,0.5),0.5),radius=rad,gap=gap,color=(0,0,1),**kw))
O.bodies[cylTuple2[0]].mask=3

beltId = O.bodies.append(wall((0,0,0),axis=2))
O.bodies[beltId].state.vel=Vector3(-1,0,0)

wall1Id = 
O.bodies.append(geom.facetBox((0,-3,0),(1,5,5),orientation=Quaternion((0, 0, 
1), (pi/2.4)),wallMask=2,**kwBoxes))
wall2Id = 
O.bodies.append(geom.facetBox((0,+3,0),(1,5,5),orientation=Quaternion((0, 0, 
1), (-pi/2.4)),wallMask=2,**kwBoxes))


O.engines=[
ForceResetter(),

InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb(),Bo1_Wall_Aabb(),  
   Bo1_GridConnection_Aabb(),   
   Bo1_PFacet_Aabb(),   
],label='collider'),
InteractionLoop(

[Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom(),Ig2_Wall_Sphere_ScGeom(), 
 Ig2_Wall_PFacet_ScGeom(),  
 Ig2_GridNode_GridNode_GridNodeGeom6D(),
 Ig2_GridConnection_GridConnection_GridCoGridCoGeom(),  
 Ig2_Sphere_PFacet_ScGridCoGeom(),  
 Ig2_GridConnection_PFacet_ScGeom(),
 Ig2_Sphere_GridConnection_ScGridCoGeom(),
],
[Ip2_FrictMat_FrictMat_FrictPhys(),
],  
[Law2_ScGeom_FrictPhys_CundallStrack(), 
 Law2_ScGeom6D_CohFrictPhys_CohesionMoment(),
 Law2_ScGridCoGeom_FrictPhys_CundallStrack(),   
 Law2_GridCoGridCoGeom_FrictPhys_CundallStrack()
],
),

NewtonIntegrator(damping=.1,exactAsphericalRot=True,gravity=(1e-2,1e-2,-1000),mask=2),
GlobalStiffnessTimeStepper(timestepSafetyCoefficient=0.1,label='ts'), 
]
O.dt=PWaveTimeStep()
O.run(1,True)
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


[Yade-users] [Question #643666]: plot.plot giving QObject::connect: cannot connect (apt-get installed yade)

2017-06-13 Thread Andrea Puglisi
New question #643666 on Yade:
https://answers.launchpad.net/yade/+question/643666

I installed yade 2016.06a using 2016.06a-4 apt package (ubuntu 16.04). Perhaps 
there is a problem with qt support. Should I recompile by hand?

Symptoms:

1) If I launch yade and immediately press F8 I get


Yade [1]: import yade.plot; yade.plot.plot();
---
IndexErrorTraceback (most recent call last)
/usr/bin/yade in ()
> 1 import yade.plot; yade.plot.plot();

/usr/lib/x86_64-linux-gnu/yade/py/yade/plot.py in plot(noShow, subPlots)
593 global currLineRefs
594 figs=set([l.line.axes.get_figure() for l in currLineRefs])
--> 595 if not hasattr(list(figs)[0],'show') and not noShow:
596 import warnings
597 warnings.warn('plot.plot not showing figure (matplotlib 
using headless backend?)')

IndexError: list index out of range



2) If I launch yade and paste (line by line) the example in 
https://github.com/yade/trunk/blob/master/examples/simple-scene/simple-scene-plot.py

as soon as I press return on the line
 plot.plot(subPlots=False)
I get 

Yade [18]: plot.plot(subPlots=False)
QObject::connect: Cannot connect NavigationToolbar2QT::message(QString) to 
(null)::_show_message()
---
TypeError Traceback (most recent call last)
/usr/bin/yade in ()
> 1 plot.plot(subPlots=False)

/usr/lib/x86_64-linux-gnu/yade/py/yade/plot.py in plot(noShow, subPlots)
590 .. note:: For backwards compatibility reasons, *noShow* option 
will return list of figures for multiple figures but a single figure (rather 
than list with 1 element) if there is only 1 figure.
591 """
--> 592 createPlots(subPlots=subPlots)
593 global currLineRefs
594 figs=set([l.line.axes.get_figure() for l in currLineRefs])

/usr/lib/x86_64-linux-gnu/yade/py/yade/plot.py in createPlots(subPlots, 
scatterSize, wider)
378 for nPlot,p in enumerate(plots.keys()):
379 pStrip=p.strip().split('=',1)[0]
--> 380 if not subPlots: pylab.figure()
381 else: pylab.subplot(subRows,subCols,nPlot+1)
382 if plots[p]==None: # image plot

/usr/lib/python2.7/dist-packages/matplotlib/pyplot.pyc in figure(num, figsize, 
dpi, facecolor, edgecolor, frameon, FigureClass, **kwargs)
525 frameon=frameon,
526 FigureClass=FigureClass,
--> 527 **kwargs)
528 
529 if figLabel:

/usr/lib/python2.7/dist-packages/matplotlib/backends/backend_qt5agg.pyc in 
new_figure_manager(num, *args, **kwargs)
 41 FigureClass = kwargs.pop('FigureClass', Figure)
 42 thisFig = FigureClass(*args, **kwargs)
---> 43 return new_figure_manager_given_figure(num, thisFig)
 44 
 45 

/usr/lib/python2.7/dist-packages/matplotlib/backends/backend_qt5agg.pyc in 
new_figure_manager_given_figure(num, figure)
 49 """
 50 canvas = FigureCanvasQTAgg(figure)
---> 51 return FigureManagerQT(canvas, num)
 52 
 53 

/usr/lib/python2.7/dist-packages/matplotlib/backends/backend_qt5.pyc in 
__init__(self, canvas, num)
463 if self.toolbar is not None:
464 self.window.addToolBar(self.toolbar)
--> 465 self.toolbar.message.connect(self._show_message)
466 tbs_height = self.toolbar.sizeHint().height()
467 else:

TypeError: connect() failed between NavigationToolbar2QT.message[str] and 
_show_message()


-- 
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