gridnode interaction with sphere cannot display the grid

Asked by gaoxuesong

I have learned examples in the folder of trunk/examples/grids/ on github. The example of "CohesiveGridConnectionSphere" deal with a line of girds interacting with a sphere. The example of Simple_Grid_Falling deals with a free falling grid plane. I want to simulate a
scene where a moving mesh plane hits a sphere then the mesh plane deforms at the interaction spot and the the sphere gets momentum to move.
So i combine the codes from the examples above. But when i run it, i can not see the mesh in the views, only the sphere(qt. View). Here is the code,

from yade import qt, plot, geom
from yade.gridpfacet import *
import numpy as np
from pprint import pprint

### materials definition###
O.materials.append(CohFrictMat(young=8e5,poisson=0.3,density=4e3,frictionAngle=radians(30),normalCohesion=4e4,shearCohesion=1e5,momentRotationLaw=False,label='spheremat'))

### engines####
O.engines=[
 ForceResetter(),
 InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_GridConnection_Aabb(),]),
 InteractionLoop(
            [Ig2_GridNode_GridNode_GridNodeGeom6D(), Ig2_Sphere_GridConnection_ScGridCoGeom()],#, Ig2_Facet_Sphere_ScGeom6D()],
  [Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(setCohesionNow=True,setCohesionOnNewContacts=False)],
  [Law2_ScGeom6D_CohFrictPhys_CohesionMoment(), Law2_ScGridCoGeom_CohFrictPhys_CundallStrack()]
 ),
    NewtonIntegrator(gravity=(0,0,0),damping=0.3,label='newton'),
    PyRunner(command='main()',iterPeriod=100),
# PyRunner(iterPeriod=500, command='history()')
# PyRunner(iterPeriod=1,command='changeValues()'),
]

### Parameters of a square grid ###
zl = 0.1 #z [m]
yl = 0.1 #y [m]
nzl = 10 #number of nodes for the length [#]
nyl = 10 #number of nodes for the width [#]
rssp = 2e-3
rscl = 2e-3
color=[255./255.,102./255.,0./255.]
bblen = yl/(nyl-1)

nodesIds=[]
#Create all nodes first :
for i in np.linspace(0, yl, nyl):
 for j in np.linspace(0, zl, nzl):
  nodesIds.append(O.bodies.append(gridNode([0,i,j], rssp, wire=False, fixed=False, material='spheremat', color=color)) )

#Create connection between the nodes
for i in range(0,len(nodesIds)):
 for j in range(i+1,len(nodesIds)):
  dist=(O.bodies[i].state.pos - O.bodies[j].state.pos).norm()
  if(dist<=bblen*1.01):
   O.bodies.append(gridConnection(i, j, rscl, color=color, material='spheremat'))

### the sphere ###
spx, spy, spz = 20e-3, 50e-3, 10e-3
rsp = 10e-3
idsp=O.bodies.append(sphere([spx,spy,spz], rsp, wire=False, fixed=False, material='spheremat'))

### the top edge of the grid node, set a veloicty, make the mesh move ###
mknodeids = []
for each in nodesIds:
    ez = O.bodies[each].state.pos[2]
    if ez > zl-0.5*bblen:
        mknodeids.append(each)

def main():
    for each in mknodeids:
        O.bodies[each].dynamic = False
        O.bodies[each].state.vel[0] = 1.0

qt.Controller()
qt.View()

O.dt=1e-05
O.run()

I find that if i remove the Ig2_Sphere_GridConnection_ScGridCoGeom(), i can see the mesh in the view but it will go through the sphere if it is set a velocity, that means there is no interaction between sphere and the mesh. I know the Ig2_Sphere_GridConnection_ScGridCoGeom() is used to deal with interaction between the sphere and the cylinder. But why the example of "CohesiveGridConnectionSphere" succeed, the only difference is that my mesh is a 2d mesh.

Then my question is that:
1. How can i adapt my code to realise my intention.

2. In fact, i want to simulate a deformable wiper sweeping particles. If the particle is too large, the wiper will deform to go over it. Does the gird module in yade works?

Thanks a lot.

Xuesong Gao

Question information

Language:
English Edit question
Status:
Answered
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#1

Hi,
First of all, if you want to see the result of a script better don't append O.run() at the end of it.
It solves the "i can not see the mesh in the views" part of your question, since at iteration 0 the grid _is_ visible.

Second, since there are multiple grid segments in the problem and they have overlapping bounds near their common nodes, you then need a dedicated Ig functor to handle them: Ig2_GridConnection_GridConnection_GridCoGridCoGeom.
Else, dispatching will fallback to another functor (in your case Ig2_Sphere_GridConnection) to handle the interactions and, obviously, it doesn't work very well since with your script you see the grid disappear as soon as you run some steps.

You can find an advanced example of combining spheres, nodes, connections, and pfacets, in examples/pfacets/pFacets_grids_spheres_interacting.py

Regards

Bruno

Can you help with this problem?

Provide an answer of your own, or ask gaoxuesong for more information if necessary.

To post a message you must log in.