Order of defining object and engine is causing problems

Asked by Rohit John

Hello all,

I am new to yade. I have tried the basic tutorial scripts and in them the objects are defined first followed by the engines. In an advanced script (cylinderconnection-roots.py) I saw that the objects were defined after the engines.

Now I tried writing a script for a ball interacting with a beam made of cylinders. I defined the objects (cylinders and sphere) first and then the engines. When I ran the code, the beam sort of fell apart. I modified the code by defining the cylinder after the engines. It fixed the problem. I want to know what is causing this or if we are required to define the bodies after the engines.

I am using Ubuntu 20.04

Please find the bare minimum script that showed this issue.

###################################################################################
from yade.gridpfacet import *

#### params
young = 1e6
poiss = 3
dens = 1e3
sp_r = 0.05
fr_a = radians(10)

## cylinder
no_cyl = 5
dl_cyl = 0.1

#### materials

O.materials.append(
 FrictMat(
  young = young,
  poisson = poiss,
  density = dens,
  frictionAngle = fr_a,
  label = 'cyl_ext_mat'
 )
)

O.materials.append(
 CohFrictMat(
  young = young,
  poisson = poiss,
  density = dens,
  frictionAngle= fr_a,
  normalCohesion = 1e40,
  shearCohesion = 1e40,
  momentRotationLaw = True,
  label = 'cyl_int_mat'
 )
 )

#### cylinder
nodesIds=[]
cylIds=[]
verts = []
for i in range(no_cyl):
 verts.append([0.1 + dl_cyl*i, 0.5, 0.8])

cylinderConnection( # Defining the beam here is causing the issue
 verts,
 nodesIds = nodesIds,
 cylIds = cylIds,
 radius = 0.03,
 color = [1,0,0],
 extMaterial = 'cyl_ext_mat',
 intMaterial = 'cyl_int_mat'
)
O.bodies[nodesIds[-1]].state.blockedDOFs='xyzXYZ'

####
O.engines = [
 ForceResetter(),
 InsertionSortCollider([
  Bo1_GridConnection_Aabb(),
 ]),
 InteractionLoop(
  [
   Ig2_GridNode_GridNode_GridNodeGeom6D(),
   Ig2_GridConnection_GridConnection_GridCoGridCoGeom(),
  ],
  [
   Ip2_FrictMat_FrictMat_FrictPhys(),
   Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(setCohesionNow=True,setCohesionOnNewContacts=False)
  ],
  [
   Law2_ScGeom_FrictPhys_CundallStrack(),
   Law2_ScGridCoGeom_FrictPhys_CundallStrack(),
   Law2_ScGeom6D_CohFrictPhys_CohesionMoment(),
   Law2_GridCoGridCoGeom_FrictPhys_CundallStrack(),
  ]
 ),
 GlobalStiffnessTimeStepper(timestepSafetyCoefficient=0.1,label='ts'),
 NewtonIntegrator(gravity = (0,0,9.1))
]

# if I define the beam here, it fixes everything

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
Robert Caulk (rcaulk) said :
#1

Hello,

I am not familiar with cylinderConnections but I can offer some tips to find out the issue.

Does the problem occur when you use a single material for everything?
Are all 4 of those Laws in your engine list actually necessary?

Cheers,

Robert

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

Dear Robert,

Thanks for your reply.

I am using two materials: one for the internal nodes and one for the external surface. I tried your recommendation but it did not help. The cylinder is still falling apart.

I think we need all the Laws. I followed the code given here (https://gitlab.com/yade-dev/trunk/blob/master/examples/cylinders/cylinderconnection-roots.py). It says the following

   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

I tried removing Law2_ScGeom_FrictPhys_CundallStrack() and I got the following error

None of given Law2 functors can handle interaction #0+1, types geom:ScGeom=1 and phys:FrictPhys=3 (LawDispatcher::getFunctor2D returned empty functor)
QObject::~QObject: Timers cannot be stopped from another thread
Segmentation fault (core dumped)

I tried removing Law2_ScGridCoGeom_FrictPhys_CundallStrack() that did not do anything. Still the only fix is to define the cylinder after the engines. I don't understand why it works though.

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

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

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

Hello ,

Can anyone please help me with this issue

Revision history for this message
Jérôme Duriez (jduriez) said :
#5

Regarding
> None of given Law2 functors can handle interaction #0+1, types geom:ScGeom=1 and phys:FrictPhys=3 (LawDispatcher::getFunctor2D returned empty functor)

https://yade-dem.org/doc/user.html#base-engines, with all its "Functors" paragraphs, may help

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

Dear Jérôme Duriez,

Thanks for your advice.

However, I do not understand your comment. I have included Law2_ScGeom_FrictPhys_CundallStrack() which, as I understand, handles ScGeom and FrictPhys. I may be mistaken, so I would grealy appreciate it if you could elaborate.

Moreover, I get the same problem (CylinderConnection falling apart when I define it before the engine) when I tried the tutorial simulating spheres interacting with root [1]. To get this problem, cut and paste the list of engines after defining the objects.

The fact that I cannot define the objects before the engines is frustrating because I would like to use a partial engine to affect some objects based on their IDs. I can only get the IDs once I define the objects. One work around would be to first define the list of engine without the partial engine, then define the object and finally append the partial engine to O.engines.

I would still like to bring to the developers attention.

Kind regards,
Rohit John

[1] https://gitlab.com/yade-dev/trunk/blob/master/examples/cylinders/cylinderconnection-roots.py

Revision history for this message
Jérôme Duriez (jduriez) said :
#7

> I have included Law2_ScGeom_FrictPhys_CundallStrack() which, as I understand, handles ScGeom and FrictPhys

You're right. After a somewhat longer look, I do not understand everything either. In order to increase your chances getting developer attention (I'm not familiar with CylinderConnection myself), you may try to reduce your script.

We probably do not need for instance specific values for the material parameters. Defaut FrictMat() and CohFrictMat() in O.materials would probably also do the trick (to trigger the problem)

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

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