← Back to team overview

yade-users team mailing list archive

Some issues with Facet objects (python newbie inside)

 

Hi all,

maybe due to recent changes in the code (I work with the 1870 revision!), I
have some problems when I try to use facet objects in very simple
simulations.

First, I tried to duplicate the gts-horse example in order to test another
geometry (sphere5.gts from the same source), and the result is quite strange
with some spheres going through the facets, even with a very small timestep.

Second, I generated a simple example in order to be familiar with the
"python way" of scripting (testGravity_Box.py  and testGravity_Facet.py
attached). Even if I am still confused with the different attributes to
define in the dispatchers, simulations run, but, I get an error when I use
Facet instead of Box which says:

FATAL yade.InteractingFacet
/home/sch50p/yade/pkg/common/DataClass/InteractingGeometry/InteractingFacet.cpp:32
postProcessAttributes: InteractingFacet has coincident vertices 2 (0 0 0)
and 0 (0 0 0)!


Do you have any suggestions? I saw that Wall objects can also be defined.
Are they suitable? How is defined their AABB (InteractingWall2AABB)?


Thanks in advance for your help!


  Luc
# -*- coding: utf-8 -*-
"""Script showing how to use GTS to import arbitrary triangulated surface,
which can further be either filled with packing (if used as predicate) or converted
to facets representing the surface."""

from yade import pack
import gts, os.path

# coarsen the original mesh if we have it
# do nothing if we have the coarsened horse already
if not os.path.exists('sphere5.coarse.gts'):
	if os.path.exists('sphere5.gts'):
		surf=gts.read(open('sphere5.gts')); surf.coarsen(1000); surf.write(open('sphere5.coarse.gts','w'))
	else:
		print """sphere5.gts not found, you need to download input data:

		wget http://gts.sourceforge.net/samples/sphere5.gts.gz
		gunzip sphere5.gts.gz
		"""
		quit()

surf=gts.read(open('sphere5.coarse.gts'))

if surf.is_closed():
	pred=pack.inGtsSurface(surf)
	aabb=pred.aabb()
	dim0=aabb[1][0]-aabb[0][0]; radius=dim0/30. # get some characteristic dimension, use it for radius
	O.bodies.append(pack.regularHexa(pred,radius=radius,gap=radius/4.))
	#O.bodies.append(pack.regularOrtho(pred,radius=radius,gap=radius/4.))
	#O.bodies.append(pack.randomDensePack(pred,radius=radius,rRelFuzz=.3,memoizeDb='/tmp/triaxPackCache.sqlite',spheresInCell=3000))
	surf.translate(0,0,-(aabb[1][2]-aabb[0][2])) # move surface down so that facets are underneath the falling spheres
O.bodies.append(pack.gtsSurface2Facets(surf,wire=True))

O.engines=[
	BexResetter(),
	BoundDispatcher([InteractingSphere2AABB(),InteractingFacet2AABB(),MetaInteractingGeometry2AABB()]),
	InsertionSortCollider(label='collider'),
	InteractionDispatchers(
		[ef2_Sphere_Sphere_Dem3DofGeom(),ef2_Facet_Sphere_Dem3DofGeom()],
		[SimpleElasticRelationships()],
		[Law2_Dem3Dof_Elastic_Elastic()],
	),
	GravityEngine(gravity=[0,0,-1e4]),
	NewtonsDampedLaw(damping=.1)
]

from yade import qt
v=qt.Controller()
v=qt.View()

collider['sweepLength'],collider['nBins'],collider['binCoeff']=.1*dim0/30.5,10,2
O.dt=1.5*utils.PWaveTimeStep()
O.saveTmp()
O.timingEnabled=True
from yade import timing
O.run(10000,True)
timing.stats()
# -*- coding: utf-8 -*-
# encoding: utf-8


O=Omega()

O.initializers=[BoundDispatcher([InteractingSphere2AABB(),InteractingBox2AABB(),MetaInteractingGeometry2AABB()])]

O.engines=[

####################### with Box

	BexResetter(),
	BoundDispatcher([InteractingSphere2AABB(),InteractingBox2AABB(),MetaInteractingGeometry2AABB()]),
	InsertionSortCollider(),

	InteractionGeometryDispatcher([InteractingSphere2InteractingSphere4SpheresContactGeometry(),InteractingBox2InteractingSphere4SpheresContactGeometry()]),
	InteractionPhysicsDispatcher([SimpleElasticRelationships()]),
	ElasticContactLaw(),

	GravityEngine(gravity=[0,0,-10]),
	NewtonsDampedLaw(damping=0.01)

]

from yade import pack,utils

############################ Definition of the ground (Box)

O.bodies.append(utils.box(center=[0,0,-0.01],extents=[10,10,.01],color=[0,0,1],dynamic=False))

############################ Sphere assembly: cylindric sample

pred=pack.inAlignedBox((-1,-1,0),(1,1,3))
O.bodies.append(pack.randomDensePack(pred,radius=0.1,rRelFuzz=.3,memoizeDb='/tmp/triaxPackCache.sqlite'))
#O.bodies.append(pack.regularHexa(pred,radius=0.1,gap=0.1/4.))
#O.bodies.append(pack.regularOrtho(pred,radius=0.1,gap=0.1/4.))

############################  

O.dt=0.3*utils.PWaveTimeStep()

O.save('/home/sch50p/Desktop/YADE/bin/test.xml');

from yade import qt
v=qt.Controller()
v=qt.View()

O.run(20000); O.wait()
# -*- coding: utf-8 -*-
# encoding: utf-8


O=Omega()

O.initializers=[BoundDispatcher([InteractingSphere2AABB(),InteractingFacet2AABB(),MetaInteractingGeometry2AABB()])]

O.engines=[

######################## with Facet -> FATAL yade.InteractingFacet /home/sch50p/yade/pkg/common/DataClass/InteractingGeometry/InteractingFacet.cpp:32 postProcessAttributes: InteractingFacet has coincident vertices 2 (0 0 0) and 0 (0 0 0)!
	
	BexResetter(),
	BoundDispatcher([InteractingSphere2AABB(),InteractingFacet2AABB(),MetaInteractingGeometry2AABB()]),
	InsertionSortCollider(),

	InteractionDispatchers([ef2_Sphere_Sphere_Dem3DofGeom(),ef2_Facet_Sphere_Dem3DofGeom()],[SimpleElasticRelationships()],[Law2_Dem3Dof_Elastic_Elastic()],),

	GravityEngine(gravity=[0,0,-10]),
	NewtonsDampedLaw(damping=0.01)

]

from yade import pack,utils

############################ Definition of the ground (Facet)

O.bodies.append(utils.facetBox((0,0,0),(10,10,0),wallMask=63,color=(1,1,1),wire=True))

############################ Sphere assembly: cylindric sample

pred=pack.inAlignedBox((-1,-1,0),(1,1,3))
O.bodies.append(pack.randomDensePack(pred,radius=0.1,rRelFuzz=.3,memoizeDb='/tmp/triaxPackCache.sqlite'))
#O.bodies.append(pack.regularHexa(pred,radius=0.1,gap=0.1/4.))
#O.bodies.append(pack.regularOrtho(pred,radius=0.1,gap=0.1/4.))

############################  

O.dt=0.3*utils.PWaveTimeStep()

O.save('/home/sch50p/Desktop/YADE/bin/test.xml');

from yade import qt
v=qt.Controller()
v=qt.View()

O.run(20000); O.wait()

Follow ups