← Back to team overview

yade-users team mailing list archive

Re: [Question #685596]: GridConnection and PFacet: Segmentation fault

 

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

    Status: Answered => Open

Justin is still having a problem:
Klaus,

I updated the code to be a MWE.

Items to note:
I increased the thickness for the pFacets
I could not recreate the problem with one or even two grass strands. I used 4, and had the once sphere far in the center-ish of the four. This recreates the problem every time.

My thoughts, since half the sphere is in the grass strand when the grass
is release, it is simply causing too much force? Thoughts? Or would that
not be an issue.


Thanks,
Justin

from yade.gridpfacet import *
import numpy as np
from yade import utils
from yade import ymport
import sys,time,math,random

from yade import qt
qt.View()

boxCenter = (0,0,.025)
boxDem = (.07,.07,.025)  ### 
O.materials.append(FrictMat(young=200e9,density=8050,poisson=.3, label='steel')) # used steel properties to make rigid

blen = boxDem[0]*2  ## Length of Ball pit
bhei = .025       ## Height of Ball pit

# Spheres information
sphereRadius = .004 # [m]
nu = .48 
den_rub = 89724 # [kg/m^3]
yng_rub = 3000000 # [Pa] 
fric_rub = radians(38)  # [degrees] 
O.materials.append(FrictMat(frictionAngle=fric_rub,young=yng_rub,density=den_rub,poisson=nu,label='rubber'))

#### SPHERES
phi=20.
E=3.*1e8
O.materials.append( FrictMat( young=E,poisson=0.5,density=260050,frictionAngle=radians(phi),label='frictMat' ) )
O.bodies.append( sphere(center=(Vector3(-0.0015,-0.0015-.04,0.05)),radius=sphereRadius,material='frictMat',fixed=False) )

## Time step set to 20% of Rayleigh Wave
O.dt=.2*utils.RayleighWaveTimeStep() # 0.0011302534626965682

### Steps needed to run sim
sphereFalls = 20000					### Steps spheres need to fall and level out and turn on studs

O.engines=[
		###Reset all forces stored in Scene::forces (O.forces in python). Typically, this is the first engine to be run at every step. 		In addition, reset those energies that should be reset, if energy tracing is enabled.
		## Resets forces and moments that act on bodies
		ForceResetter(),

		## Using bounding boxes find possible body collisions.
		InsertionSortCollider([
		Bo1_Facet_Aabb(), 
		Bo1_Sphere_Aabb(),
		Bo1_GridConnection_Aabb(),
		Bo1_PFacet_Aabb(),
		]),
		InteractionLoop([
			Ig2_Facet_Sphere_ScGeom(),
			Ig2_Wall_PFacet_ScGeom(),
			Ig2_Wall_Sphere_ScGeom(),
			Ig2_Sphere_Sphere_ScGeom(),
			Ig2_Sphere_GridConnection_ScGridCoGeom(),
			Ig2_Sphere_PFacet_ScGridCoGeom(),
			Ig2_GridNode_GridNode_GridNodeGeom6D(),
			Ig2_GridConnection_GridConnection_GridCoGridCoGeom(),
			Ig2_GridConnection_PFacet_ScGeom(),
			Ig2_PFacet_PFacet_ScGeom(),
			],
			[
			Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(setCohesionNow=True,setCohesionOnNewContacts=True),	# internal cylinder physic
			Ip2_FrictMat_FrictMat_FrictPhys() # physics for external interactions, i.e., cylinder-cylinder, sphere-sphere, cylinder-sphere
			],
			[
			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
		]),
	NewtonIntegrator(damping=.2,gravity=[0,0,-9.81], label='newtonInt'),
	PyRunner(command='turnongrass()',firstIterRun=sphereFalls, nDo=6, dead=False, label='freeGrass'),
]


## Grass Information
O.materials.append(CohFrictMat(young=100,poisson=0.3,density=40,frictionAngle=np.radians(30),normalCohesion=1e5,shearCohesion=1e5,momentRotationLaw=True,label='grass'))
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.006
y_gap = 0.006
range_x = 2 ## finding the range for x
range_y = 2 ## finding the range for z
cen_y = -(range_y/2)*y_gap  ## Allows the "box" of grass to be center in Z

for ii in range(0,range_y):
  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 z in np.linspace(0,L,nL):
      nodesIds.append(O.bodies.append(gridNode([cen_x,cen_y-.04,z+sphereRadius+.004],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))
  cen_y += y_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 turnongrass():
	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
		O.bodies[nodesIds[kk+nL-1]].state.blockedDOFs=''  ## Top of Grass
	freeGrass.dead = True


color=[255./255.,102./255.,0./255.]
steel_r = .005
box = []
box.append(O.bodies.append( gridNode([-boxDem[0],-boxDem[1],0],steel_r,wire=False,fixed=True,material='steel',color=color) ))
box.append(O.bodies.append( gridNode([boxDem[0],-boxDem[1],0],steel_r,wire=False,fixed=True,material='steel',color=color) ))
box.append(O.bodies.append( gridNode([boxDem[0],boxDem[1],0],steel_r,wire=False,fixed=True,material='steel',color=color) ))
O.bodies.append( gridConnection(box[0],box[1],steel_r,color=color) )
O.bodies.append( gridConnection(box[1],box[2],steel_r,color=color) )
O.bodies.append( gridConnection(box[2],box[0],steel_r,color=color) )
O.bodies.append( pfacet(box[0],box[1],box[2],wire=False,color=color,material='steel') )

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