← Back to team overview

yade-users team mailing list archive

Re: [Question #663245]: Grid connections/nodes interact with gmsh files?

 

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

    Status: Answered => Open

Justin is still having a problem:
The problem is with the Ig2, I do not see a:
Ig2_Facet_GridConnection_ScGeom() or something of that nature. In the
code below, the grid connection goes straight through the box I created
and has no collision. I need to use a gmsh file later for complex
geometries, hence using Yade's built in box functions won't help.

I'm not sure how to attach files, I could email someone the .mesh and
.sqlite files, if need be.

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

# Spheres information
sphereRadius = .004 # [m]
nu = .48 
#G = 300000 # [Pa]
den_rub = 24299.1 # [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'))

### Steps
spheres_fall = 300
Trans = 105280+spheres_fall
All_steps = 252510+spheres_fall


blen = 0.21230  ## Length of Ball pit
bhei = .025     ## Height of Ball pit
pred = pack.inAlignedBox((-blen/2,(0+bhei+.005),-blen/2),(blen/2,(bhei+bhei+.005),blen/2))
sp = pack.randomDensePack(pred, spheresInCell=2732, radius=sphereRadius, memoizeDb='/home/justin/Desktop/real/tmp/ball_packing65_r4_h25.sqlite', returnSpherePack=True)
sp.toSimulation(color=(255,0,0),wire=False,material='rubber')


## Steel box informaion
steel = O.materials.append(FrictMat(young=200e9,density=8050,poisson=.3)) # Pa, kg/m^3
metal_base45 = O.bodies.append(ymport.gmsh("geo/flipped/based_70.mesh",scale=.001,shift=Vector3(0,-.00635,0), material=steel,color=(0,0,1),wire=True))


## Grid Information
O.materials.append(CohFrictMat(young=3e2,poisson=0.3,density=1e1,frictionAngle=10, normalCohesion=1e7,shearCohesion=1e7,momentRotationLaw=True,label='gridmat')) ## Properties Need to be corrected
rCyl = (0.00635+0.003175)/4  
nL = 5        
L = .022       ## Height of spheres after leveling

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

O.engines=[
	ForceResetter(),
	InsertionSortCollider([
		Bo1_Sphere_Aabb(), 
		Bo1_Facet_Aabb(), 
		Bo1_GridConnection_Aabb(),
		Bo1_Box_Aabb()
	]),
	InteractionLoop([
		Ig2_Facet_Sphere_ScGeom(),
		Ig2_Sphere_Sphere_ScGeom(),
		Ig2_Box_Sphere_ScGeom(),
		Ig2_GridNode_GridNode_GridNodeGeom6D(),
		Ig2_Sphere_GridConnection_ScGridCoGeom(),
		Ig2_GridConnection_GridConnection_GridCoGridCoGeom()
		],
		[
		Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(setCohesionNow=True,setCohesionOnNewContacts=False),	# internal cylinder physics
		Ip2_FrictMat_FrictMat_FrictPhys()	# physics for external interactions, i.e., cylinder-cylinder, sphere-sphere, cylinder-sphere
		],
		[
		Law2_ScGridCoGeom_CohFrictPhys_CundallStrack(),
		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,-9.81,0],label='newtonInt'),
	PyRunner(command='turnongrid()',firstIterRun=spheres_fall, nDo = 3, dead = False),
]


### Grid 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 grid 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 grid to be center in X
  for jj in range(0,range_x):
    for i in np.linspace(0,L,nL):
      nodesIds.append(O.bodies.append(gridNode([cen_x,i,cen_z],rCyl,wire=False,fixed=False,material='gridmat')))
    idxc += 1
    d = idxc*nL ## Start of grid
    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='gridmat'))
  cen_z += z_gap 


for kk in range(0,len(nodesIds)):
  O.bodies[nodesIds[kk]].state.blockedDOFs='xyzXYZ' 


btm_nodes = range(0,len(nodesIds),nL)
def turnongrid():
	print "Turning on Grid"
	for kk in range(0,len(nodesIds)):
		if any(x == kk for x in btm_nodes) == False:
 			O.bodies[nodesIds[kk]].state.blockedDOFs=''       ## Unblocking all DOF's

def run(self):
	iterToRun=All_steps
	O.run(iterToRun, True)

from yade import qt
qt.View()

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