← Back to team overview

yade-users team mailing list archive

Re: [Question #662576]: How to model Grass?

 

Question #662576 on Yade changed:
https://answers.launchpad.net/yade/+question/662576

    Status: Answered => Open

Justin is still having a problem:
Thank you both for the help. Now I'm stuck on gridConnection.

I'm trying to use gridConnection. I cannot seem to get it to stay
connected. Once I turn off blockedDOFs on all nodes within the "grass",
the grass explodes. Can someone see the cause? I'm trying to only
blockedDOFs on the bottom nodes, but need the rest to stay together as
one piece. I do blockedDOFs at first because I will need spheres to fall
around them.

Thank You


Complete Code:

from yade import qt
from yade.gridpfacet import *
import numpy as np

qt.View()

### Engines need to be defined first since the function gridConnection creates the interaction
O.engines=[
	ForceResetter(),
	InsertionSortCollider([
		Bo1_Sphere_Aabb(),
		Bo1_GridConnection_Aabb(),
	]),
	InteractionLoop(
		# Geometric interactions
		[
          Ig2_GridNode_GridNode_GridNodeGeom6D(),
          Ig2_Sphere_GridConnection_ScGridCoGeom(),	# used for the cohesive sphere-cylinder interaction
        ],
		[
		# Interaction phusics
          Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(setCohesionNow=True,setCohesionOnNewContacts=False),
        ],
		# Interaction law
		[
          Law2_ScGeom6D_CohFrictPhys_CohesionMoment(),
          Law2_ScGridCoGeom_CohFrictPhys_CundallStrack(),	# used for the cohesive sphere-cylinder interaction
        ]
	),
	NewtonIntegrator(gravity=(0,-9.81,0),damping=0.3,label='newton'),
	PyRunner(command='main()',initRun=1000),
]

O.dt=5e-07

O.materials.append(CohFrictMat(young=8e5,poisson=0.3,density=4e3,frictionAngle=radians(30),normalCohesion=1e5,shearCohesion=1e5,momentRotationLaw=True,label='grass'))
## Properties Need to be corrected

blen = 0.21230  ## Length of Ball pit
bhei = .025     ## Height of Ball pit

#rCyl = (0.00635+0.003175)/4  ## Lump with of "grass" on back is 1/4 X 1/8 inch, Note 4 is due to radius times two average of the two.
rCyl = 0.0026  ## Grass was about 1.2 [mm] wide
nL = 4           ## No exact Number here, just trial and error
L = bhei           ## Height of spheres

### Grass Creation
### Create all nodes first :
nodesIds=[]
idxc = -1
x_gap = 0.009 ## Between lumps is roughly 9 [mm]
z_gap = 0.01905 ## Between lines of backing is .75 inch apart
range_x = int(math.floor(blen/x_gap)) ## finding the range for x
range_z = int(math.floor(blen/z_gap)) ## finding the range for z
cen_z = -(range_z/2)*z_gap  ## Allows the "box" of grass to be center in Z
#sys.exit()

for ii in range(0,range_z):
  cen_x = -(range_x/2)*x_gap  # Allows the "box" of grass to be center in X
  for jj in range(0,range_x):
    for y in np.linspace(0,L,nL):
      nodesIds.append(O.bodies.append(gridNode([cen_x,y,cen_z],rCyl,wire=False,fixed=False,material='grass')))
    idxc += 1
    d = idxc*nL ## Start of grass fiber
    cen_x += x_gap
#### Now create connection between the nodes
    for k,j in zip(nodesIds[d:d+nL-1],nodesIds[d+1:nodesIds[-1]+1]):
      O.bodies.append(gridConnection(k,j,rCyl,material='grass'))
  cen_z += z_gap 

for kk in range(0,len(nodesIds)):   ## First Blocking all DOF's until balls fall around.
  O.bodies[nodesIds[kk]].state.blockedDOFs='xyzXYZ'  

def main():
	print "Turning on Grass"
	for kk in range(0,len(nodesIds)):
 		O.bodies[nodesIds[kk]].state.blockedDOFs=''       ## Unblocking all DOF's
	for kk in range(0,len(nodesIds),nL):
 		O.bodies[nodesIds[kk]].state.blockedDOFs='xyzXYZ' ## Blocking DOF's for Bottom nodes

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.