← Back to team overview

yade-users team mailing list archive

Re: [Question #240620]: tetra +facet

 

Question #240620 on Yade changed:
https://answers.launchpad.net/yade/+question/240620

Oguz Cebeci posted a new comment:
Hi,
i tried to start the examples in the "examples/polyhedra"  folder. But i always get the following error:
"ImportError: cannot import name polyhedra_utils"
Is there a solution to fix this?

from yade import plot, polyhedra_utils
from yade import qt

m = PolyhedraMat()
m.density = 2600 #kg/m^3 
m.Ks = 20000
m.Kn = 1E6 #Pa
m.frictionAngle = 0.6 #rad

maxLoad = 3E6
minLoad = 1E3

O.bodies.append(utils.wall(0,axis=2,sense=1, material = m))

t = polyhedra_utils.polyhedralBall(0.025, 100, m, (0,0,0))
t.state.pos = (0,0,0.5)
O.bodies.append(t)

def checkUnbalanced():   
  print "unbalanced forces = %.5f, position %f, %f, %f"%(utils.unbalancedForce(), t.state.pos[0], t.state.pos[1], t.state.pos[2])
    	
   

O.engines=[
   ForceResetter(),
   InsertionSortCollider([Bo1_Polyhedra_Aabb(),Bo1_Wall_Aabb(),Bo1_Facet_Aabb()]),
   InteractionLoop(
      [Ig2_Wall_Polyhedra_PolyhedraGeom(), Ig2_Polyhedra_Polyhedra_PolyhedraGeom(), Ig2_Facet_Polyhedra_PolyhedraGeom()], 
      [Ip2_PolyhedraMat_PolyhedraMat_PolyhedraPhys()], # collision "physics"
      [PolyhedraVolumetricLaw()]   # contact law -- apply forces
   ),
   #GravityEngine(gravity=(0,0,-9.81)),
   NewtonIntegrator(damping=0.5,gravity=(0,0,-9.81)),
   PyRunner(command='checkUnbalanced()',realPeriod=3,label='checker')
]


#O.dt=0.025*polyhedra_utils.PWaveTimeStep()
O.dt=0.00025


qt.Controller()
V = qt.View()


O.saveTmp()
#O.run()


--------------------------------------------------------------------------------------------------------------------------------------------------

Another problem is in the "examples/tetra" folder:
"NameError: name 'tetraPoly' is not defined"


################################################################################
# 
# Script to test tetra gl functions and prescribed motion
#
################################################################################
v1 = (0,0,0)
v2 = (1,0,0)
v3 = (0,1,0)
v4 = (0,0,1)

t1 = tetraPoly((v1,v2,v3,v4),color=(0,1,0))
O.bodies.append((t1))

def changeVelocity():
	if O.iter == 50000:
		t1.state.vel = (-1,0,0)
	if O.iter == 100000:
		t1.state.vel = (0,1,-1)
	if O.iter == 150000:
		t1.state.vel = (0,0,0)
		t1.state.angMom = (0,0,10)
	if O.iter == 200000:
		O.pause()

O.engines = [
	ForceResetter(),
	InsertionSortCollider([Bo1_Polyhedra_Aabb()]),
	InteractionLoop([],[],[]),
	NewtonIntegrator(),
	PyRunner(iterPeriod=1,command="changeVelocity()"),
]
O.step()


try:
	from yade import qt
	qt.View()
except:
	pass

O.dt = 1e-5
t1.state.vel = (1,0,0)
O.run()

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.