Multiple Geogrids

Asked by Luis Barbosa

Dear all,

I'm modelling the interaction of different particle layers separeted by geogrids. However, I came to this practical implementation of multiple geogrids, I couldn't find in the examples and I am facing troubles to create the grid layers in the conventional way:

from yade import pack,geom,qt
from yade.gridpfacet import *
from pylab import *

O.engines=[
 ForceResetter(),
 InsertionSortCollider([
  Bo1_Sphere_Aabb(),Bo1_Facet_Aabb(),Bo1_GridConnection_Aabb(),
 ]),
 InteractionLoop(
  [Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom(),Ig2_GridNode_GridNode_GridNodeGeom6D(),Ig2_Sphere_GridConnection_ScGridCoGeom(),Ig2_GridConnection_GridConnection_GridCoGridCoGeom()],
  [Ip2_FrictMat_FrictMat_FrictPhys(),Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(setCohesionNow=True,setCohesionOnNewContacts=False)],
  [Law2_ScGeom_FrictPhys_CundallStrack(),Law2_ScGeom6D_CohFrictPhys_CohesionMoment(),Law2_ScGridCoGeom_FrictPhys_CundallStrack()]
 ),
 NewtonIntegrator(gravity=(0,0,-5),damping=0.3,label='newton')
]

O.materials.append(FrictMat(young=10e7,poisson=.25,frictionAngle=0.5,density=1e2,label='sphere'))
O.materials.append(FrictMat(young=10e7,poisson=.25,frictionAngle=0.5,density=1e2,label='walls'))
O.materials.append(CohFrictMat(young=3e5,poisson=0.3,density=1e1,frictionAngle=10,normalCohesion=1e7,shearCohesion=1e7,momentRotationLaw=True,label='spheremat'))

### Parameters of a rectangular grid 1 ###
L=0.1 #length [m]
l=0.05 #width [m]
nbL=10 #number of nodes for the length [#]
nbl=5 #number of nodes for the width [#]
r=L/100. #radius
color=[255./255.,102./255.,0./255.]
nodesIds=[]
#Create all nodes first :
for i in range(0,nbL):
 for j in range(0,nbl):
  nodesIds.append( O.bodies.append(gridNode([i*L/nbL,j*l/nbl,0],r,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<=L/nbL*1.01):
   #O.bodies.append( gridConnection(i,j,r,color=color) )

### Parameters of a rectangular grid 2 ###
L2=0.1 #length [m]
l2=0.05 #width [m]
nbL2=10 #number of nodes for the length [#]
nbl2=5 #number of nodes for the width [#]
r2=L2/100. #radius
color2=[255./255.,102./255.,0./255.]
nodesIds2=[]
#Create all nodes first :
for q in range(0,nbL):
 for u in range(0,nbl):
  nodesIds2.append( O.bodies.append(gridNode([q*L2/nbL2,u*l2/nbl2,0.05],r2,wire=False,fixed=False,material='spheremat',color=color)) )

#Create connection between the nodes
for q in range(0,len(nodesIds2)):
 for u in range(q+1,len(nodesIds2)):
  dist2=(O.bodies[q].state.pos - O.bodies[u].state.pos).norm()
  if(dist2<=L2/nbL2*1.01):
   O.bodies.append( gridConnection(q,u,r2,color=color) )

#O.bodies.append([sphere((0.05,0.025,0.05),.01, material='sphere')])
mn,mx=Vector3(0.01,0,0.015),Vector3(0.09,0.04,0.1) #m
sp=pack.SpherePack()
sp.makeCloud(mn,mx,rMean=0.005)
sp.toSimulation(material='sphere')

mn1,mx1=Vector3(0.01,0,-0.02),Vector3(0.09,0.04,-0.1) #m
spp=pack.SpherePack()
spp.makeCloud(mn1,mx1,rMean=0.005)
spp.toSimulation(material='sphere')

O.bodies.append(geom.facetBox((0.05,0.02,0),(0.045,0.0245,0.11),wallMask=1+2+4+8+16+32,material='walls'))

O.dt=1e-05
O.saveTmp()
qt.View()

Do you have any idea of how to implement it? The issue is on creating the connection:
  if(dist2<=L2/nbL2*1.01):
   O.bodies.append( gridConnection(q,u,r2,color=color) )

Thank you in advance,
Luis

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Luis Barbosa
Solved:
Last query:
Last reply:
Revision history for this message
Luis Barbosa (luis-pires-b) said :
#1

Deal all, I solved the problem by doing:

#Create all nodes first :
for i in range(0,nbL):
 for j in range(0,nbl):
  nodesIds.append( O.bodies.append(gridNode([i*L/nbL,j*l/nbl,0],r,wire=False,fixed=False,material='spheremat',color=color)) )
  nodesIds2.append( O.bodies.append(gridNode([i*L/nbL,j*l/nbl,0.05],r,wire=False,fixed=False,material='spheremat',color=color)) )
  nodesIds3.append( O.bodies.append(gridNode([i*L/nbL,j*l/nbl,-0.05],r,wire=False,fixed=False,material='spheremat',color=color)) )

#Create connection between the nodes
a=len(nodesIds)
b=len(nodesIds2)
c=len(nodesIds3)
d=a+b+c

for i in range(0,d):
 for j in range(i+1,d):
  dist=(O.bodies[i].state.pos - O.bodies[j].state.pos).norm()
  if(dist<=L/nbL*1.01):
   O.bodies.append( gridConnection(i,j,r,color=color) )

Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#2

Thanks for answering your question. :)
Bruno