← Back to team overview

yade-users team mailing list archive

Re: [Question #670838]: Cohesive gridConnection Cylinder&Sphere

 

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

Justin requested more information:
Bruno,

I have a similar issue. Please see my MWE below.

When I remove all BC's from "other_nodes" (root_nodes stay fixed) in the
function turnonstuds, my two cylinders explode. Do you know the cause?

Thanks,
Justin


#!/usr/bin/python
# -*- coding: utf-8 -*-

import sys

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

from yade import qt
qt.View()

root_nodes=[]
other_nodes=[]
spheres_fall = 5
All_steps =54817+spheres_fall

class YadePythonSimulation():
	blen = 0.21230  ## Length of Ball pit
	O.materials.append(CohFrictMat(young=3e9,density=1e1,poisson=.3,frictionAngle=10,normalCohesion=1e7,shearCohesion=1e7,momentRotationLaw=True,label='grass')) 
	rCyl = (0.00635+0.003175)/4  ## Lump with of "grass" on back is 1/4 X 1/8
	nL = 3         ## Number of spheres, No exact Number here, just trial and error
	L = .022       ## Height of spheres after leveling

	## Time step set to 20% of Rayleigh Wave
	O.dt=0.0020719234774279633

	## Engines 
	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_Sphere_Aabb(), 
		Bo1_Facet_Aabb(), 
		Bo1_GridConnection_Aabb(),
		Bo1_Box_Aabb(),
		
#        Bo1_GridConnection_Aabb(),
	]),
	InteractionLoop([
#		Ig2_GridConnection_GridConnection_GridCoGridCoGeom(),
#		Ig2_GridNode_GridNode_GridNodeGeom6D(),
#		Ig2_Sphere_GridConnection_ScGridCoGeom(),
		
		
		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_GridCoGridCoGeom_FrictPhys_CundallStrack(),
				
		
		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='turnonstuds()',iterPeriod=spheres_fall, nDo = 11, label='switchstuds', dead = False),
	]
	
	### Create all nodes first :
	idxc = -1
	x_gap = 0.09 ## tmp
	z_gap = 0.1905 ## tmp
	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
	tmpi = 0.0

	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 i in np.linspace(0,L,nL):
				if i != 0.0:
					other_nodes.append(O.bodies.append(gridNode([cen_x,i,cen_z],rCyl,wire=False,fixed=True,material='grass')))
					if tmpi == 0.0:
						O.bodies.append(gridConnection(root_nodes[-1], other_nodes[-1], rCyl))
					else: 
						O.bodies.append(gridConnection(other_nodes[-2], other_nodes[-1], rCyl))
					print(i, "other", cen_x, "x", cen_z, "z")
				elif i == 0.0:
					root_nodes.append(O.bodies.append(gridNode([cen_x,i,cen_z],rCyl,wire=False,fixed=True,material='grass')))
				tmpi = i
			idxc += 1
			d = idxc*nL ## Start of grass fiber
			cen_x += x_gap
		cen_z += z_gap 

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

def turnonstuds():
	### Turning off BC's to non-rooted nodes
	for kk in range(0,len(root_nodes)):
		O.bodies[other_nodes[kk]].state.blockedDOFs='' 

if __name__ == "__main__":
    yaPySi = YadePythonSimulation()
    sim1 = yaPySi.run()

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