'ScGeom' object has no attribute 'connectionBody'

Asked by Hanying Zhang

Hi,

I try to clump gridnode and pfacet together and test how it can interact with spheres, sample can be generated without O.engine code, once I add O.engine to the script it would go wrong. The error says:

Traceback (most recent call last):
  File "/usr/bin/yade", line 182, in runScript
    execfile(script,globals())
  File "1-29-2.py", line 44, in <module>
    pfacet(nodes[0],nodes[1],nodes[2],wire=True,material='pFacetMat',color=color),\
  File "/usr/lib/x86_64-linux-gnu/yade/py/yade/gridpfacet.py", line 211, in pfacet
    GridC1=O.bodies[O.interactions[id1,id2].geom.connectionBody.id]
AttributeError: 'ScGeom' object has no attribute 'connectionBody'

 I use ubuntu 18.04 and my yade version is 2018.02b.

################################################
from yade.gridpfacet import *
from yade import pack, plot
#from random import random as r
import numpy as np
from numpy import *
import math
from yade import utils, qt
import random
from yade import polyhedra_utils, qt

#### Parameter ####
young=4.0e6
poisson=3
density=1e3
stabilityThreshold=0.01
mi,ma = (-100e-3,-100e-3,-200e-3),(100e-3,100e-3,200e-3)
color=[0.,1.,1.]

#=============================meterials========================================
O.materials.append(FrictMat(young=4.0e6,poisson=.3,frictionAngle=30,density=2630e0,label='sphereMat'))#for sphere
O.materials.append( CohFrictMat( young=3e6,poisson=0.15,density=910e0,frictionAngle=20,normalCohesion=3e100,shearCohesion=3e100,momentRotationLaw=True,label='gridNodeMat' ) )#for gridNodes
O.materials.append(FrictMat(young=4e6,poisson=0.3,density=1000,frictionAngle=20,label='pFacetMat')) #for pfacet

RNode=0.00002
nodes=[]
#up 0123
aa= nodes.append(O.bodies.append( gridNode([-110e-3, 110e-3,-200e-3],RNode,wire=True,fixed=True,material='gridNodeMat') ))
bb= nodes.append(O.bodies.append( gridNode([ 110e-3, 110e-3,-200e-3],RNode,wire=True,fixed=True,material='gridNodeMat') ))
cc= nodes.append(O.bodies.append( gridNode([ 110e-3,-110e-3,-200e-3],RNode,wire=True,fixed=True,material='gridNodeMat') ))
dd= nodes.append(O.bodies.append( gridNode([-110e-3,-110e-3,-200e-3],RNode,wire=True,fixed=True,material='gridNodeMat') ))

clump1=O.bodies.appendClumped([\
gridNode([-110e-3, 110e-3,-200e-3],RNode,wire=True,fixed=True,material='gridNodeMat'),\
gridNode([ 110e-3, 110e-3,-200e-3],RNode,wire=True,fixed=True,material='gridNodeMat'),\
gridNode([ 110e-3,-110e-3,-200e-3],RNode,wire=True,fixed=True,material='gridNodeMat'),\
gridNode([-110e-3,-110e-3,-200e-3],RNode,wire=True,fixed=True,material='gridNodeMat'),\
gridConnection(nodes[0],nodes[1],RNode,wire=True,material='gridNodeMat'),\
gridConnection(nodes[0],nodes[2],RNode,wire=True,material='gridNodeMat'),\
gridConnection(nodes[0],nodes[3],RNode,wire=True,material='gridNodeMat'),\
gridConnection(nodes[1],nodes[2],RNode,wire=True,material='gridNodeMat'),\
gridConnection(nodes[2],nodes[3],RNode,wire=True,material='gridNodeMat'),\
pfacet(nodes[0],nodes[1],nodes[2],wire=True,material='pFacetMat',color=color),\
pfacet(nodes[0],nodes[2],nodes[3],wire=True,material='pFacetMat',color=color)
])

O.bodies.append(utils.sphere([0,0,0.2],.1))

#==============================Engines=========================================
O.engines=[
 ForceResetter(),
 InsertionSortCollider([
  Bo1_Sphere_Aabb(),
  Bo1_GridConnection_Aabb(),
  Bo1_PFacet_Aabb(),
  Bo1_Box_Aabb(),
  Bo1_Wall_Aabb()
 ]),
 InteractionLoop([
  Ig2_Sphere_Sphere_ScGeom(),
  Ig2_Box_Sphere_ScGeom(),
  Ig2_GridNode_GridNode_GridNodeGeom6D(),
  Ig2_Sphere_GridConnection_ScGridCoGeom(),
  Ig2_GridConnection_GridConnection_GridCoGridCoGeom(),
  Ig2_GridConnection_PFacet_ScGeom(),
  Ig2_PFacet_PFacet_ScGeom(),
  Ig2_Sphere_PFacet_ScGridCoGeom(),
  Ig2_Wall_PFacet_ScGeom(),
  Ig2_Wall_Sphere_ScGeom()
 ],
 [
  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

  Ip2_FrictMat_CpmMat_FrictPhys(),
 ],
 [
  #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
  #Law2_GridCoGridCoGeom_CohFrictPhys_CundallStrack(),
  Law2_ScGeom_CpmPhys_Cpm(),
 ]
 ),
 GlobalStiffnessTimeStepper(timestepSafetyCoefficient=0.1,label='ts'),
 #triax,
 NewtonIntegrator(gravity=(0,0,10),damping=0.5,label='newton'),
 ]
########################################################

Thanks for any help!!

Question information

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

Hello,

any significant difference from [2]? I just repeat what I wrote there:

> GridC1=O.bodies[O.interactions[id1,id2].geom.connectionBody.id]
> AttributeError: 'ScGeom' object has no attribute 'connectionBody'

please provide a MWE [1]. W = works for the problem you want to solve.
There is no 'connectionBody' in your code..
The line producing the error "GridC1=O.bodies[O.interactions[id1,id2].geom.connectionBody.id]" is missing..

My guess is that you use some generic code, which assumes interaction.geom to be GridNodeGeom6D (which has connectionBody attribute), but there are some interactions with ScGeom (sphere-sphere contacts?), which (as the error says) has no attribute 'connectionBody'

cheers
Jan

[1] https://www.yade-dem.org/wiki/Howtoask
[2] https://answers.launchpad.net/yade/+question/694667

Revision history for this message
Launchpad Janitor (janitor) said :
#2

This question was expired because it remained in the 'Needs information' state without activity for the last 15 days.