Commit eece68e5 authored by Klaus Thoeni's avatar Klaus Thoeni
Browse files

examples for cylinder and cylinderConnection

parent b02620e8
# encoding: utf-8
"An example showing various bending beams."
from yade.gridpfacet import *
#### Parameters ####
L=10. # length of the beam
n=12 # number of nodes used to generate the beam
r=L/50. # radius of the beam element
#### Engines ####
O.engines=[
ForceResetter(),
InsertionSortCollider([Bo1_GridConnection_Aabb()]),
InteractionLoop(
[Ig2_GridNode_GridNode_GridNodeGeom6D()],
[Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(setCohesionNow=True,setCohesionOnNewContacts=False)],
[Law2_ScGeom6D_CohFrictPhys_CohesionMoment()]
),
NewtonIntegrator(gravity=(0,0,-10),damping=0.5,label='newton')
]
#### Creat materials and set different properties ####
O.materials.append(CohFrictMat(young=1e6,poisson=0.3,density=1e1,frictionAngle=10,normalCohesion=1e7,shearCohesion=1e7,momentRotationLaw=False,label='mat1'))
O.materials.append(CohFrictMat(young=1e6,poisson=0.3,density=1e1,frictionAngle=10,normalCohesion=1e7,shearCohesion=1e7,momentRotationLaw=True,label='mat2'))
O.materials.append(CohFrictMat(young=3e6,poisson=0.3,density=1e1,frictionAngle=10,normalCohesion=1e7,shearCohesion=1e7,momentRotationLaw=True,label='mat3'))
O.materials.append(CohFrictMat(young=1e7,poisson=0.3,density=1e1,frictionAngle=10,normalCohesion=1e7,shearCohesion=1e7,momentRotationLaw=True,label='mat4'))
#### Vertices ####
vertices1=[]
vertices2=[]
vertices3=[]
vertices4=[]
for i in range(0,n):
vertices1.append( ([i*L/n,0,0]) )
vertices2.append( ([i*L/n,1,0]) )
vertices3.append( ([i*L/n,2,0]) )
vertices4.append( ([i*L/n,3,0]) )
#### Create cylinder connections ####
nodesIds=[]
cylIds=[]
cylinderConnection(vertices1,r,nodesIds,cylIds,color=[1,0,0],highlight=False,intMaterial='mat1')
cylinderConnection(vertices2,r,nodesIds,cylIds,color=[0,1,0],highlight=False,intMaterial='mat2')
cylinderConnection(vertices3,r,nodesIds,cylIds,color=[0,0,1],highlight=False,intMaterial='mat3')
cylinderConnection(vertices4,r,nodesIds,cylIds,color=[1,1,1],highlight=False,intMaterial='mat4')
#### Set boundary conditions ####
for i in range(0,4):
O.bodies[nodesIds[i*n]].dynamic=False
# O.bodies[nodesIds[i*n]].state.blockedDOFs='xyzXYZ'
# O.bodies[nodesIds[i*n]].state.blockedDOFs='xyz'
#### For viewing ####
from yade import qt
qt.View()
#### Set a time step ####
O.dt=1e-05
#### Allows to reload the simulation ####
O.saveTmp()
# encoding: utf-8
"An example showing how to create two cylinders which are interacting."
from yade.gridpfacet import *
#### Parameters ####
L=1. # length of the cylinder element
r=0.1 # radius of the cylinder element
phi=30. # friction angle
E=1e6 # Young's modulus
#### Engines ####
O.engines=[
ForceResetter(),
InsertionSortCollider([
#Bo1_Sphere_Aabb(),
Bo1_GridConnection_Aabb(),
]),
InteractionLoop([
Ig2_GridNode_GridNode_GridNodeGeom6D(),
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 interaction
],
[
Law2_ScGeom6D_CohFrictPhys_CohesionMoment(), # contact law for "internal" cylider forces
Law2_GridCoGridCoGeom_FrictPhys_CundallStrack() # contact law for cylinder-cylinder interaction
]
),
NewtonIntegrator(gravity=(-0.,0,-10),damping=0.5,label='newton'),
]
#### Creat materials ####
O.materials.append( CohFrictMat( young=E,poisson=0.3,density=1000,frictionAngle=radians(phi),normalCohesion=1e10,shearCohesion=1e10,momentRotationLaw=True,label='cMat' ) ) # material to create the gridConnections
O.materials.append( FrictMat( young=E,poisson=0.3,density=1000,frictionAngle=radians(phi),label='fMat' ) ) # material for general interactions
#### Create cylinders ####
nodesIds=[]
cylIds=[]
cylinder((0,0,0),(L,0,0),radius=r,nodesIds=nodesIds,cylIds=cylIds,
fixed=True,color=[1,0,0],intMaterial='cMat',extMaterial='fMat')
cylinder((L/4,2*L/3,L),(L/4,-L/3,L),radius=r,nodesIds=nodesIds,cylIds=cylIds,
fixed=False,color=[0,1,0],intMaterial='cMat',extMaterial='fMat')
cylinder((0,2*L/3,L),(0,-L/3,L),radius=r,nodesIds=nodesIds,cylIds=cylIds,
fixed=False,color=[0,1,0],intMaterial='cMat',extMaterial='fMat')
cylinder((L/2,L/2,L),(L/2,-L/2,L),radius=r,nodesIds=nodesIds,cylIds=cylIds,
fixed=False,color=[0,1,1],intMaterial='cMat',extMaterial='fMat')
cylinder((3*L/4,L/3,L),(3*L/4,-2*L/3,L),radius=r,nodesIds=nodesIds,cylIds=cylIds,
fixed=False,color=[0,0,1],intMaterial='cMat',extMaterial='fMat')
cylinder((L,L/3,L),(L,-2*L/3,L),radius=r,nodesIds=nodesIds,cylIds=cylIds,
fixed=False,color=[0,0,1],intMaterial='cMat',extMaterial='fMat')
#### For viewing ####
from yade import qt
qt.View()
Gl1_Sphere.stripes=True
#### Set a time step ####
O.dt=1e-06
#### Allows to reload the simulation ####
O.saveTmp()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment