# Cylinders with different materials

Asked by Petrucio Santos Junior on 2019-10-07

I am trying to create a weld type between two bars. These bars would be the cylinders. Each cylinder is composed of a different material and the weld is another cylinder with a weaker material. When I try to move one of the bars to test the solder the connection disappears. Is it possible to make this type connection? It would be like having two cylinders in different planes connected by each other and each composed of a different material. This is my script:

# encoding: utf-8
"An example showing how to create two cylinders which are interacting."

from yade import plot, bodiesHandling, pack, ymport, geom

#### define parameters for the net
# wire diameter
d = 0.01
# define piecewise lineare stress-strain curve
strainStressValues=[(0.00019230769,9e7),(0.032,4.28e8),(0.036,4.61e8),(0.045,4.95e8),(0.06,5.05e8),(0.075,5.15e8),(0.09,5.20E+08),(0.12,5.36E+08),(0.14,5.41E+08),(0.16,5.46E+08),(0.21,5.57E+08),(0.28,5.65E+08),(0.35,5.67E+08)]
particleMass = 3.9/1000.
density = particleMass/particleVolume
young = 2e11
poisson = 0.3

#### Parameter ####
L=1. # length of the cylinder element
#r=0.01 # radius of the cylinder element
phi=30. # friction angle
E=1e13 # Young's modulus
n=5 # number of nodes used to generate the beam

#### Creat materials ####
O.materials.append( CohFrictMat( young=E,poisson=0.3,density=1000,frictionAngle=radians(phi),normalCohesion=1e40,shearCohesion=1e40, momentRotationLaw=True,label='cMat' ) ) # material to create the gridConnections
O.materials.append( FrictMat( young=E,poisson=0.3,density=1000000,frictionAngle=radians(phi),label='fMat' ) ) # material for general interactions
O.materials.append( CohFrictMat(young=E,poisson=0.3,density=1100,frictionAngle=radians(10),normalCohesion=1e30,shearCohesion=1e30, momentRotationLaw=True,label='wMat' ) ) # material to create the gridConnections

#### Engines ####
Factor=1.5 # wire
O.engines=[
ForceResetter(),
InsertionSortCollider([
Bo1_Sphere_Aabb(aabbEnlargeFactor=Factor, label="aabb"),
Bo1_Box_Aabb(),
Bo1_Sphere_Aabb(),
Bo1_GridConnection_Aabb(),
]),
InteractionLoop([
Ig2_Sphere_Sphere_ScGeom(),
Ig2_Box_Sphere_ScGeom(),
Ig2_GridNode_GridNode_GridNodeGeom6D(),
Ig2_Sphere_GridConnection_ScGridCoGeom(),
Ig2_GridConnection_GridConnection_GridCoGridCoGeom(),
Ig2_Sphere_Sphere_ScGeom6D(interactionDetectionFactor=Factor,label="Ig2"),
],
[
Ip2_WireMat_WireMat_WirePhys(),
#Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(label='gridinteraction'),
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_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_ScGeom_WirePhys_WirePM(), # manter o contato entre os cilindros wire
Law2_GridCoGridCoGeom_FrictPhys_CundallStrack() # contact law for cylinder-cylinder interaction
]
),
#GlobalStiffnessTimeStepper(timestepSafetyCoefficient=0.1,label='ts'),
NewtonIntegrator(gravity=(0,0,0),damping=0.5,label='newton'),
PyRunner(command='main()',iterPeriod=20)
]

#### Create bars ####

#### simulation
## to define interaction range for which cohesive links will be created
bar1=[]
bar2=[]
bar3=[]
sph1=[]
for i in range(0,n):
bar1.append( [i*L/(n-1),0,0] )
bar2.append( [L/2,(L/2)-i*L/(n-1),3.1*r] )
bar3.append( [i*L/(n-1),0.4,L] )
sph1.append( [i*L/(n-1),0.4,2*L] )

#### Create cylinder connections ####
nodesIds1=[]
cylIds1=[]
nodesIds2=[]
cylIds2=[]
nodesIds3=[]
cylIds3=[]
nodesIds_c=[]
cylIds_c=[]

for i in range(0,n):
nodesIds1.append( O.bodies.append(gridNode(bar1[i],r,wire=False,fixed=False, material='cMat', color=[1,0,0])) )

for i in range(0,n):
nodesIds2.append( O.bodies.append(gridNode(bar2[i],r,wire=False,fixed=False, material='wire', color=[1,1,1])) )

for i in range(0,len(nodesIds1)-1):
O.bodies.append( gridConnection(nodesIds1[i],nodesIds1[i+1],r,color=[1,0,0], material='cMat') )

for i in range(0,len(nodesIds2)-1):
O.bodies.append( gridConnection(nodesIds2[i],nodesIds2[i+1],r,color=[1,1,1], material='wire') )

gridNode(bar1[2],r,wire=False,fixed=False, material='wMat', color=[1,1,0])
gridNode(bar2[2],r,wire=False,fixed=False, material='wMat', color=[1,1,0])

O.bodies.append(gridConnection(nodesIds1[2],nodesIds2[2],r,color=[1,1,0],material='wMat') )

for i in nodesIds1:
O.bodies[i].state.blockedDOFs='xyzXYZ'

def main():
O.bodies[nodesIds2[0]].state.blockedDOFs='xyzXYZ'
O.bodies[nodesIds2[0]].state.vel[2]=0.1
O.interactions.eraseNonReal()

#### For viewing ####
qt.View()
Gl1_Sphere.stripes=True

#### Set a time step ####
#O.dt=1e-06
O.dt=utils.PWaveTimeStep()

#### Allows to reload the simulation ####
O.saveTmp()

## Question information

Language:
English Edit question
Status:
Expired
For: