ERROR:root:Unable to guess python type from cxx type 'vector<shared_ptr<Body> >'

Asked by _guessWhat

dear all,

The terminal outputs "ERROR:root:Unable to guess python type from cxx type 'vector<shared_ptr<Body> >'" while I was running the script"cylinder-cylinder.py". I wonder why this happens and how to resolve it.

besides, I am new to yade and try to use yade to simulate fibre reinforced soil, is there any script from which I can how to model the fibre reinforced soil?

sincerely appriciate your help.

best regrads,
xxxe

please see script below:

#!/usr/bin/python
# -*- coding: utf-8 -*-
"Beam-like behaviour with cylinderConnections for roots interaction with spheres."

from yade import pack
from yade.gridpfacet import *

#### Parameter ####
young=4.0e6
poisson=3
density=1e3
frictionAngle1=radians(15)
frictionAngle2=radians(15)
frictionAngle3=radians(15)

#### Engines ####
O.engines=[
 ForceResetter(),
 InsertionSortCollider([
  Bo1_Box_Aabb(),
  Bo1_Sphere_Aabb(),
  Bo1_GridConnection_Aabb(),
 ]),
 InteractionLoop([
  Ig2_Sphere_Sphere_ScGeom(),
  Ig2_Box_Sphere_ScGeom(),
  Ig2_GridNode_GridNode_GridNodeGeom6D(),
  Ig2_Sphere_GridConnection_ScGridCoGeom(),
  Ig2_GridConnection_GridConnection_GridCoGridCoGeom()
 ],
 [
  Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(setCohesionNow=True,setCohesionOnNewContacts=False), # internal cylinder physics
  Ip2_FrictMat_FrictMat_FrictPhys() # physics for external interactions, i.e., cylinder-cylinder, sphere-sphere, cylinder-sphere
 ],
 [
  Law2_ScGeom_FrictPhys_CundallStrack(), # contact law for sphere-sphere
  Law2_ScGridCoGeom_FrictPhys_CundallStrack(), # contact law for cylinder-sphere
  Law2_ScGeom6D_CohFrictPhys_CohesionMoment(), # contact law for "internal" cylinder forces
  Law2_GridCoGridCoGeom_FrictPhys_CundallStrack() # contact law for cylinder-cylinder interaction
 ]
 ),
 GlobalStiffnessTimeStepper(timestepSafetyCoefficient=0.1,label='ts'),
 NewtonIntegrator(gravity=(1,-9.81,0),damping=0.5,label='newton'),
]

#### Spheres ####
O.materials.append(FrictMat(young=4.0e6,poisson=0.5,frictionAngle=frictionAngle1,density=1600,label='spheremat'))

Ns=90
sp=pack.SpherePack()

if os.path.exists("cloud4cylinders"+`Ns`):
  print "loading spheres from file"
 sp.load("cloud4cylinders"+`Ns`)
else:
  print "generating spheres"
  Ns=sp.makeCloud(Vector3(-0.3,0.2,-1.0),Vector3(+0.3,+0.5,+1.0),-1,.2,Ns,False,0.8)
 sp.save("cloud4cylinders"+`Ns`)

O.bodies.append([sphere(center,rad,material='spheremat') for center,rad in sp])

#### Walls ####
O.materials.append(FrictMat(young=1.0e6,poisson=0.2,density=2.60e3,frictionAngle=frictionAngle2,label='wallmat'))
walls=aabbWalls((Vector3(-0.3,-0.15,-1),Vector3(+0.3,+1.0,+1)),thickness=.1,material='wallmat')
wallIds=O.bodies.append(walls)

#Assemble cylinders in sinusoidal shapes
O.materials.append( CohFrictMat( young=10*young,poisson=poisson,density=density,frictionAngle=frictionAngle3,normalCohesion=1e40,shearCohesion=1e40,momentRotationLaw=True,label='cylindermat') ) # material to create the gridConnections
O.materials.append( FrictMat( young=young,poisson=poisson,density=13.0*density,frictionAngle=frictionAngle3,label='fMat' ) ) # material for general interactions with cylinders

Ne=30 # number of cylinders
dy=0.03
dx=0.2
dz=0.2
Nc=1 # number of additional cylinderConnection

nodesIds=[]
cylIds=[]
for j in range(-Nc, Nc+1):
 dyj = abs(float(j))*dy
 dxj = abs(float(j))*dx
 dzj = float(j)*dz
 vertices=[]
 for i in range(0, Ne+1):
  omega=20/float(Ne); hy=0.0; hz=0.05; hx=1.5;
  px=float(i)*hx/float(Ne)-0.8+dxj; py=sin(float(i)*omega)*hy+dyj; pz=cos(float(i)*omega)*hz+dzj;
  vertices.append([pz,py,px])
 cylinderConnection(vertices,0.02,nodesIds,cylIds,color=[1,0,0],highlight=False,intMaterial='cylindermat',extMaterial='fMat')
 O.bodies[nodesIds[-1]].state.blockedDOFs='xyzXYZ'
 O.bodies[nodesIds[-Ne-1]].state.blockedDOFs='xyzXYZ'

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

#### Allows to reload the simulation ####
O.saveTmp()

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
_guessWhat
Solved:
Last query:
Last reply:
Revision history for this message
Jan Stránský (honzik) said :
#1

Hello,

> I am new to yade

welcome :-)

I have tried the code, and (except a few syntax errors) it worked both using yade 2018.02b and recent trunk version.

> The terminal outputs ...

please provide a complete error message and other information below. Also please read [1]
What yade version and operating system you use?
Haw did you install Yade (from package, from source, ...)?

thanks
Jan

[1] https://www.yade-dem.org/wiki/Howtoask

Revision history for this message
Robert Caulk (rcaulk) said :
#2

By any chance, does this error only arise when you use the GUI to click on and inspect bodies?

Revision history for this message
_guessWhat (fuckuuu-deactivatedaccount) said :
#3

Hi Robert Caulk,

you are right, the error only arise when I try to inspect bodies.

thank you so much!
xxxe

Revision history for this message
_guessWhat (fuckuuu-deactivatedaccount) said :
#4

 The error only arise when I try to inspect bodies.

Revision history for this message
_guessWhat (fuckuuu-deactivatedaccount) said :
#5

Hi Jan

thank you so much for your help, my yade version is 2018.02b and I use it on ubuntu18.04. With Caulk's advice I rerun the script and find that the error only arise when I try to inspect bodies. Now my problem is solved and thanks again for your help!

best wishes,
xxxe

Revision history for this message
Robert Caulk (rcaulk) said :
#6

Sadly, the problem is definitely not solved. This will need to be bug reported - I will try to do that sometime soon.

Revision history for this message
_guessWhat (fuckuuu-deactivatedaccount) said :
#7

dear all,

this problem is solved by Robert Caulk, I must click button unconsciously and Idk how to change it……sorry.

thanks
xxxe

Revision history for this message
_guessWhat (fuckuuu-deactivatedaccount) said :
#8

god……I post the wrong code and here is the exact code of script "cylinder-cylinder.py" .

# encoding: utf-8
"An example showing how to create two cylinders which are interacting."

from yade.gridpfacet import *

#### Parameter ####
L=1. # length of the cylinder element
r=0.1 # radius of the cylinder element
phi=30. # friction angle
E=1e6 # Young's modulus

#### Engines ####
O.engines=[
 ForceResetter(),
 InsertionSortCollider([
  Bo1_GridConnection_Aabb(),
 ]),
 InteractionLoop([
  Ig2_GridNode_GridNode_GridNodeGeom6D(),
  Ig2_GridConnection_GridConnection_GridCoGridCoGeom(),
 ],
 [
  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_GridCoGridCoGeom_FrictPhys_CundallStrack() # contact law for cylinder-cylinder interaction
 ]
 ),
 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 cylinders ####
nodesIds=[]
cylIds=[]
cylinder((0,0,0),(L,0,0),radius=r,nodesIds=nodesIds,cylIds=cylIds,
     fixed=True,color=[1,0,0],intMaterial='cMat',extMaterial='fMat')
cylinder((L/4,2*L/3,L),(L/4,-L/3,L),radius=r,nodesIds=nodesIds,cylIds=cylIds,
     fixed=False,color=[0,1,0],intMaterial='cMat',extMaterial='fMat')
cylinder((0,2*L/3,L),(0,-L/3,L),radius=r,nodesIds=nodesIds,cylIds=cylIds,
     fixed=False,color=[0,1,0],intMaterial='cMat',extMaterial='fMat')
cylinder((L/2,L/2,L),(L/2,-L/2,L),radius=r,nodesIds=nodesIds,cylIds=cylIds,
     fixed=False,color=[0,1,1],intMaterial='cMat',extMaterial='fMat')
cylinder((3*L/4,L/3,L),(3*L/4,-2*L/3,L),radius=r,nodesIds=nodesIds,cylIds=cylIds,
     fixed=False,color=[0,0,1],intMaterial='cMat',extMaterial='fMat')
cylinder((L,L/3,L),(L,-2*L/3,L),radius=r,nodesIds=nodesIds,cylIds=cylIds,
     fixed=False,color=[0,0,1],intMaterial='cMat',extMaterial='fMat')

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

#### Set a time step ####
O.dt=1e-06

#### Allows to reload the simulation ####
O.saveTmp()

Revision history for this message
Robert Caulk (rcaulk) said :
#9

It is ok to make this thread solved, since you can continue using yade without issue. But the underlying problem that caused the error message is a problem we need to solve on gitlab. Thanks for raising this point.

Revision history for this message
Rohit John (rohitkjohn) said :
#10

Hello all,

I was facing a similar issue in Yade 2018.02b in Ubuntu 18.04.5 LTS. I tried it on Yade 2020-11-05.git-7d0ae90 and I did not get an error. So this problem is fixed in a new version of YADE.

Kind regards,
Rohit K. John