← Back to team overview

yade-users team mailing list archive

Problem with dispatcher and simulation

 

Hello, I'm trying to use the interactionDispatcher but i have this
warning:

Traceback (most recent call last):
  File "/home/marco/YADE5/lib/yade-svn1691/gui/PythonUI_rc.py", line 43,
in <module>
    try: execfile(runtime.script)
  File "SIMmmPIVISC2.py", line 182, in <module>
    [EngineUnit('Spheres_Viscoelastic_SimpleViscoelasticContactLaw'),],
ArgumentError: Python argument types in
    InteractionDispatchers.__init__(InteractionDispatchers, list, list,
list, list, list, list)
did not match C++ signature:
    __init__(_object*, boost::python::list, boost::python::list,
boost::python::list)
    __init__(_object*)
    __init__(_object*, std::string)
    __init__(_object*, std::string, boost::python::dict)


I have problem also cause speres compenetrate and pass the stl imported
facets.
Could you give me some advice?
How can I modify my script to use openMPI?

Thank you so much

Marco


My script is:

#!/usr/local/bin/yade-trunk -x
# -*- encoding=utf-8 -*-

from yade import utils
from math import *
from numpy import arange
import random

## Omega
o=Omega()

#Parametri cilindro
rCyl=0.0401   ##Raggio superiore tronco cono
rCyl2=0.0401  ##Raggio inferiore tronco cono
hCyl=0.0202  ##altezza base inferiore cono
hCyl2=0.0205 ##altezza base superiore cono
nPoly=28 ##Poligoni di cui è composto il contenitore
h1=0.010
h2=0.032

hBox=hCyl/8
phiStep=2*pi/nPoly

## PhysicalParameters
Density=3000
frictionAngle=radians(30)
#sphereRadius=0.05
tc = 0.001
en = 0.3
es = 0.2

## Import wall's geometry
p=utils.getViscoelasticFromSpheresInteraction(10e3,tc,en,es)
head =
utils.import_stl_geometry('TestaPiattaSim2.stl',frictionAngle=frictionAngle,physParamsClass="SimpleViscoelasticBodyParameters",physParamsAttr={'kn':0.0001*p['kn'],'cn':0.0001*p['cn'],'ks':0.0001*p['ks'],'cs':0.0001*p['cs']})

print "kn: %f" % p['kn']
print "ks: %f" % p['ks']
print "cn: %f" % p['cn']
print "cs: %f" % p['cs']

for n in range(nPoly):
        phi1,phi2=n*phiStep,(n+1)*phiStep
        def pt(angle,radius,z):
                return radius*sin(angle),radius*cos(angle),z
a,b,c,d=pt(phi1,rCyl,hCyl2),pt(phi2,rCyl,hCyl2),pt(phi1,rCyl2,hCyl),pt(phi2,rCyl2,hCyl)
        e,f=pt(phi1,rCyl,h1),pt(phi2,rCyl,h1)
        g,h=pt(phi1,rCyl2,h2),pt(phi2,rCyl2,h2)
        p=utils.getViscoelasticFromSpheresInteraction(10e3,tc,en,es)
        o.bodies.append([
                utils.facet([a,b,e],frictionAngle=frictionAngle,
color=[0.5,0.5,0.5],physParamsClass="SimpleViscoelasticBodyParameters",physParamsAttr={'kn':0.0001*p['kn'],'cn':0.0001*p['cn'],'ks':0.0001*p['ks'],'cs':0.0001*p['cs']}),
                utils.facet([b,e,f],frictionAngle=frictionAngle,
color=[0.5,0.5,0.5],physParamsClass="SimpleViscoelasticBodyParameters",physParamsAttr={'kn':0.0001*p['kn'],'cn':0.0001*p['cn'],'ks':0.0001*p['ks'],'cs':0.0001*p['cs']}),
])

for b in o.bodies: b['isDynamic']=False

print "kn: %f" % p['kn']
print "ks: %f" % p['ks']
print "cn: %f" % p['cn']
print "cs: %f" %p['cs']

box =
utils.box([0,0,hCyl2+hBox/2],[rCyl,rCyl,hBox/2],density=10000,wire=True,
color=[0,0,1],frictionAngle=frictionAngle,physParamsClass="SimpleViscoelasticBodyParameters")

b=utils.getViscoelasticFromSpheresInteraction(box.phys['mass'],tc,en,es)
box.phys['kn'],box.phys['cn'],box.phys['ks'],box.phys['cs']=0.0001*b['kn'],0.0001*b['cn'],0.0001*b['ks'],0.0001*b['cs']

boxId=o.bodies.append(box)

box.phys.blockedDOFs=['x','y','rz','ry','rx']
#for c in o.bodies: c['isDynamic']=False

print "kn: %f" % p['kn']
print "ks: %f" % p['ks']
print "cn: %f" % p['cn']
print "cs: %f" % p['cs']

## Spheres
rSphere=0.0005
Col=3
Color=0.8
divisioni=0
red=0
green=0
blue=0
Bande=5
LarghezzaBande=rCyl2/Bande
nSphere=0

for z in arange(rSphere,Col*1.9*rSphere,1.9*rSphere):
        red=0.7
        green=0.2
        blue=0.7

        for r in arange(2.2*rSphere,rCyl2-1*rSphere,2*rSphere):
                divisioni=2*pi*r/(rSphere*2)

                for n in arange(1,divisioni,1):

                        if r>LarghezzaBande and r<LarghezzaBande*2:
                                red=1
                                green=0
                                blue=0

                        if r>LarghezzaBande*2 and r<LarghezzaBande*3:
                                red=1
                                green=0.9
                                blue=0

                        if r>LarghezzaBande*3 and r<LarghezzaBande*4:
                                red=0.1
                                green=1
                                blue=0.1

                        if r>LarghezzaBande*4 and r<LarghezzaBande*5:
                                red=0
                                green=0
                                blue=1
                        theta=2*pi/divisioni*n
                        nSphere=nSphere+1
s=utils.sphere([r*sin(theta),r*cos(theta),hCyl2-z],rSphere*(1-.2*(random.random())),density=Density,frictionAngle=frictionAngle,color=[red,green,blue],physParamsClass="SimpleViscoelasticBodyParameters")
p=utils.getViscoelasticFromSpheresInteraction(s.phys['mass'],tc,en,es)
s.phys['kn'],s.phys['cn'],s.phys['ks'],s.phys['cs']=5*p['kn'],5*p['cn'],5*p['ks'],5*p['cs']
                        o.bodies.append(s)

print "Number of spheres: %d" % nSphere
print "kn: %f" % p['kn']
print "ks: %f" % p['ks']
print "cn: %f" % p['cn']
print "cs: %f" % p['cs']

## Timestep
o.dt=0.00008

## Initializers
o.initializers=[
        ## Create and reset to zero container of all PhysicalActions
that will be used
        StandAloneEngine('PhysicalActionContainerInitializer'),
        ## Create bounding boxes. They are needed to zoom the 3d view
properly before we start the simulation.
MetaEngine('BoundingVolumeMetaEngine',[EngineUnit('InteractingSphere2AABB'),EngineUnit('InteractingFacet2AABB'),EngineUnit('InteractingBox2AABB'),EngineUnit('MetaInteractingGeometry2AABB')])
        ]

## Engines
o.engines=[

        ## Resets forces and momenta the act on bodies
        StandAloneEngine('PhysicalActionContainerReseter'),

        InteractionDispatchers(
[EngineUnit('InteractingSphere2InteractingSphere4SpheresContactGeometry'),],
[EngineUnit('InteractingSphere2InteractingSphere4SpheresContactGeometry'),],
[EngineUnit('InteractingFacet2InteractingSphere4SpheresContactGeometry'),],
[EngineUnit('InteractingBox2InteractingSphere4SpheresContactGeometry'),],
                [EngineUnit('SimpleViscoelasticRelationships'),],
[EngineUnit('Spheres_Viscoelastic_SimpleViscoelasticContactLaw'),],
        ),

        ## Associates bounding volume to each body.
        MetaEngine('BoundingVolumeMetaEngine',[
                EngineUnit('InteractingSphere2AABB'),
                EngineUnit('InteractingFacet2AABB'),
                EngineUnit('InteractingBox2AABB'),
                EngineUnit('MetaInteractingGeometry2AABB')
        ]),
        ## Using bounding boxes find possible body collisions.
        #StandAloneEngine('SpatialQuickSortCollider'),
        StandAloneEngine('PersistentSAPCollider'),
        ## Create geometry information about each potential collision.
        #MetaEngine('InteractionGeometryMetaEngine',[
        #
EngineUnit('InteractingSphere2InteractingSphere4SpheresContactGeometry'),
        #
EngineUnit('InteractingFacet2InteractingSphere4SpheresContactGeometry'),
        #
EngineUnit('InteractingBox2InteractingSphere4SpheresContactGeometry')
        #]),
        ## Create physical information about the interaction.
#MetaEngine('InteractionPhysicsMetaEngine',[EngineUnit('SimpleViscoelasticRelationships')]),
        ## Constitutive law
#MetaEngine('ConstitutiveLawDispatcher',[EngineUnit('Spheres_Viscoelastic_SimpleViscoelasticContactLaw')]),
        ## Apply gravity

        DeusExMachina('GravityEngine',{'gravity':[0,0,9.81]}),

        ## Applica forza alla base
        DeusExMachina('ForceEngine',{'subscribedBodies':[boxId],
'force':[0,0,-0.5],'label':'forcer'}),
        ## Cundall damping must been disabled!
        DeusExMachina('NewtonsDampedLaw',{'damping':0}),
        ## Apply kinematics to walls
DeusExMachina('RotationEngine',{'subscribedBodies':head,'rotationAxis':[0,0,1],'rotateAroundZero':True,'angularVelocity':0.1047}),

StandAloneEngine('PeriodicPythonRunner',{'iterPeriod':250,'nDo':20,'command':'setForce()'}),
#StandAloneEngine('PeriodicPythonRunner',{'iterPeriod':5000,'nDo':120,'command':'setForce1()'}),
#StandAloneEngine('PeriodicPythonRunner',{'iterPeriod':5001,'nDo':120,'command':'setForce2()'}),

#StandAloneEngine('ForceRecorder',{'startId':boxId-1,'endId':boxId,'outputFile':'forceTC2.dat','interval':100}),
StandAloneEngine('SQLiteRecorder',{'recorders':['se3','rgb'],'dbFile':'/home/marco/replays/TestaPiatta.sqlite','virtPeriod':0.04})

]

def setForce():
        fz=forcer["force"][2]
        forcer["force"]=[0,0,-0.5+fz]
        #if fz==9.5:
        #       forcer["force"]=[0,0,10]
        pz=forcer["force"][2]
        print "Carico assiale N: %f" % pz

def setForce1():
        fz=forcer["force"][2]
        forcer["force"]=[0,0,+1+fz]
        pz=forcer["force"][2]
        print "Carico assiale percussione N: %f" % pz

def setForce2():
        fz=forcer["force"][2]
        forcer["force"]=[0,0,-1+fz]
        pz=forcer["force"][2]
        print "Carico assiale percussione N: %f" % pz

o.saveTmp('init');

o.stopAtIter=400000
-- 
This message was sent from Launchpad by the user
MarcoDottor (https://launchpad.net/~marcodottor)
using the "Contact this team" link on the yade-users team page.
For more information see
https://help.launchpad.net/YourAccount/ContactingPeople