← Back to team overview

yade-users team mailing list archive

Re: [Question #632960]: How to erase GridConnection

 

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

Loic Dugelas posted a new comment:
Hi Klaus,

Thank you for your help, this is working, I can now delete and replace
the cylinder. But there is a new problem, the new cylinder is here but
it seems that the new interaction is not activated. I modify a little
your script to show this problem. I think this comes from the fact that
the new interaction is not taken into account but I don't know how to
deal with it. Any idea ?

In the script if you don't change the cylinder, the node1 is falling as
expect but if you change the cylinder, the interaction don't hold it:

############

# encoding: utf-8
from yade.gridpfacet import *

#### Parameters ####
L=2. # minimum length
r=0.5 # radius of the cylinder element
phi=30. # friction angle
E=1e6 # Young's modulus

#### Engines ####
O.engines=[
 ForceResetter(),
 InsertionSortCollider([
  Bo1_GridConnection_Aabb(),
  Bo1_Sphere_Aabb(),
  Bo1_Wall_Aabb(),
 ]),
 InteractionLoop([
  Ig2_GridNode_GridNode_GridNodeGeom6D(),
  Ig2_GridConnection_GridConnection_GridCoGridCoGeom(),
  Ig2_Wall_Sphere_ScGeom(),
 ],
 [
  Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(setCohesionNow=True,setCohesionOnNewContacts=False),
  Ip2_FrictMat_FrictMat_FrictPhys()
 ],
 [
  Law2_ScGeom6D_CohFrictPhys_CohesionMoment(), # contact law for "internal" cylider forces
  Law2_ScGridCoGeom_FrictPhys_CundallStrack(), # contact law for Cylinder-pFacet interaction
  Law2_GridCoGridCoGeom_FrictPhys_CundallStrack() # contact law for cylinder-cylinder interaction
 ]
 ),
 GlobalStiffnessTimeStepper(timestepSafetyCoefficient=0.1,label='ts'),
 NewtonIntegrator(gravity=(0.,-10,0),damping=0.5,label='newton'),
 PyRunner(initRun=True,iterPeriod=200,command='delcylinder()'),
 PyRunner(initRun=True,iterPeriod=200,command='createcylinder()')
]

#### 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,2*r),(0,0,L+2*r),radius=r,nodesIds=nodesIds,cylIds=cylIds,fixed=False,intMaterial='cMat',extMaterial='fMat')

O.bodies[nodesIds[0]].state.blockedDOFs='xyzXYZ' #fixe the sides
O.bodies[nodesIds[1]].state.blockedDOFs='xyzXYZ'

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

#### Delete and create cylinder/gridConnection ####
def delcylinder():
 O.bodies.erase(cylIds[0]) # first delete the cylinder
 O.interactions.erase(nodesIds[0],nodesIds[1]) # then delete the real interaction between the gridNodes
 O.interactions.eraseNonReal() # finally delete non real interactions

def createcylinder():
 O.bodies.append(gridConnection(nodesIds[0],nodesIds[1],r,wire=False, material = 'cMat') )
 O.bodies[nodesIds[1]].state.blockedDOFs='' #release one side after changing the cylinder

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