Grid connections/nodes interact with gmsh files?

Asked by Justin

Thanks for looking into the grid connection bug/error. Now I am stuck again.

How do you get grid connections/nodes to interact with gmsh files?

I import an object using ymport.gmsh. The balls interact with the object just find, but the grid does not. It goes straight through the object. Is there something I need to add to my InteractionLoop?

Thank You,
Justin

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
Jérôme Duriez (jduriez) said :
#1

Hi,

No offense but "get grid connections/nodes to interact with gmsh files" is meaningless. In YADE only bodies (not files of any kind) interact with each other.

This being said, the question thus is : "how make bodies created from gmsh files interact with other bodies" ?

As usual, the answer depends on the shape of those bodies, and indeed requires the correct definition of appropriate "Ig2..." functors in InteractionLoop, see [*] where "collide" / "collision" means "interact" ("are prone to interaction", actually).

In case this theoretical answer is not helpful enough, you will have to specify the kind of bodies you're referring to (with a Minimal Working Example, for instance !)

Jérôme

[*] https://yade-dem.org/doc/user.html#ig2-functors

Revision history for this message
Justin (justin-l-rittenhouse) said :
#2

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()

Revision history for this message
Klaus Thoeni (klaus.thoeni) said :
#3

Hi,

GridConnections cannot interact with Facets. Use PFacets instead. You can find some examples here [1].

HTH Klaus

[1] https://github.com/yade/trunk/tree/master/examples/pfacet

Can you help with this problem?

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

To post a message you must log in.