# yade-users team mailing list archive

## [Question #693670]: how to fix pfacets

 Thread Previous • Date Previous • Date Next • Thread Next

```New question #693670 on Yade:

hi all,

i want to simulate a 2D rectangular made of pfacets in which exist many sparse spheres, i need to add gravity so that they can fall down to a dense pack, the problem is that the pfacets fall down too...is there any way to fix these pfacets?

#------------------------------------------------how to fix pfacets--------------------------------------------------
#!/usr/bin/python
# -*- coding: utf-8 -*-
"Beam-like behaviour with cylinderConnections for roots interaction with spheres."
from yade.gridpfacet import *
from yade import pack, plot
from random import random
import numpy as np
from numpy import *
import math
import os

#parameters
mi,ma = (-500e-3,0.,0.),(500e-3,0,250e-3)
width = int(1000e-3),
height = int(250e-3),

#=============================meterials========================================
O.materials.append(FrictMat(young=4.0e6,poisson=.3,frictionAngle=30,density=2630e+6,label='sphereMat'))#for sphere

O.materials.append( CohFrictMat( young=3e8,poisson=0.15,density=910e6,frictionAngle=20,normalCohesion=3e100,shearCohesion=3e100,momentRotationLaw=True,label='gridNodeMat' ) )#for gridNodes
#O.materials.append(CohFrictMat(young=3e9,poisson=.15,density=910e6,frictionAngle=20,normalCohesion=1e40,shearCohesion=1e40,momentRotationLaw=True,label='gridNodeMat'))#for gridNodes
O.materials.append(FrictMat(young=4e6,poisson=0.3,density=10e1000,frictionAngle=20,label='pFacetMat')) #for pfacet

#==============================Engines=========================================
O.engines=[
ForceResetter(),
InsertionSortCollider([
Bo1_Box_Aabb(),
Bo1_Sphere_Aabb(),
Bo1_GridConnection_Aabb(),
Bo1_PFacet_Aabb(),
]),
InteractionLoop([
Ig2_Sphere_Sphere_ScGeom(),
Ig2_Box_Sphere_ScGeom(),
Ig2_GridNode_GridNode_GridNodeGeom6D(),
Ig2_Sphere_GridConnection_ScGridCoGeom(),
Ig2_GridConnection_GridConnection_GridCoGridCoGeom(),
Ig2_GridConnection_PFacet_ScGeom(),
Ig2_PFacet_PFacet_ScGeom(),
Ig2_Sphere_PFacet_ScGridCoGeom()
],
[
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_GridCoGridCoGeom_FrictPhys_CundallStrack()	# contact law for cylinder-cylinder interaction
]
),
GlobalStiffnessTimeStepper(timestepSafetyCoefficient=0.1,label='ts'),
NewtonIntegrator(gravity=(0,0,-9.81),damping=0.5,label='newton'),
]

#=======================================pfacet=================================================
color=[255./255.,102./255.,0./255.]
r=0.002

O.bodies.append( gridNode([-500e-3, 5e-3,0],r,wire=False,fixed=True,material='gridNodeMat',color=color) )
O.bodies.append( gridNode([ 500e-3, 5e-3,0],r,wire=False,fixed=True,material='gridNodeMat',color=color) )
O.bodies.append( gridNode([ 500e-3,-5e-3,0],r,wire=False,fixed=True,material='gridNodeMat',color=color) )
O.bodies.append( gridNode([-500e-3,-5e-3,0],r,wire=False,fixed=True,material='gridNodeMat',color=color) )
O.bodies.append( gridNode([-500e-3, 5e-3,250e-3],r,wire=False,fixed=True,material='gridNodeMat',color=color) )
O.bodies.append( gridNode([ 500e-3, 5e-3,250e-3],r,wire=False,fixed=True,material='gridNodeMat',color=color) )
O.bodies.append( gridNode([ 500e-3,-5e-3,250e-3],r,wire=False,fixed=True,material='gridNodeMat',color=color) )
O.bodies.append( gridNode([-500e-3,-5e-3,250e-3],r,wire=False,fixed=True,material='gridNodeMat',color=color) )

O.bodies.append( gridConnection(0,1,r,color=color,material='gridNodeMat') )
O.bodies.append( gridConnection(2,3,r,color=color,material='gridNodeMat') )
O.bodies.append( gridConnection(2,1,r,color=color,material='gridNodeMat') )
O.bodies.append( gridConnection(2,0,r,color=color,material='gridNodeMat') )
O.bodies.append( gridConnection(3,0,r,color=color,material='gridNodeMat') )
O.bodies.append( pfacet(2,1,0,wire=False,material='pFacetMat',color=color) )
O.bodies.append( pfacet(2,0,3,wire=False,material='pFacetMat',color=color) )

O.bodies.append( gridConnection(4,5,r,color=color,material='gridNodeMat') )
O.bodies.append( gridConnection(5,6,r,color=color,material='gridNodeMat') )
O.bodies.append( gridConnection(6,7,r,color=color,material='gridNodeMat') )
O.bodies.append( gridConnection(7,4,r,color=color,material='gridNodeMat') )
O.bodies.append( gridConnection(4,6,r,color=color,material='gridNodeMat') )
O.bodies.append( pfacet(4,5,6,wire=False,material='pFacetMat',color=color) )
O.bodies.append( pfacet(4,6,7,wire=False,material='pFacetMat',color=color) )

O.bodies.append( gridConnection(1,5,r,color=color,material='gridNodeMat') )
O.bodies.append( gridConnection(2,6,r,color=color,material='gridNodeMat') )
O.bodies.append( gridConnection(1,6,r,color=color,material='gridNodeMat') )
O.bodies.append( pfacet(1,2,6,wire=False,material='pFacetMat',color=color) )
O.bodies.append( pfacet(1,6,5,wire=False,material='pFacetMat',color=color) )

O.bodies.append( gridConnection(0,4,r,color=color,material='gridNodeMat') )
O.bodies.append( gridConnection(3,7,r,color=color,material='gridNodeMat') )
O.bodies.append( gridConnection(0,7,r,color=color,material='gridNodeMat') )
O.bodies.append( pfacet(0,3,7,wire=False,material='pFacetMat',color=color) )
O.bodies.append( pfacet(0,7,4,wire=False,material='pFacetMat',color=color) )

#============================================Spheres==============================================================
#O.materials.append(FrictMat(young=4.0e6,poisson=0.5,frictionAngle=frictionAngle1,density=1600,label='spheremat'))
sp.makeCloud(mi,ma,porosity=0.7/1.7,psdSizes=[.00014,0.00016,0.00022,.0003,.00035],psdCumm=[0.,0.1,0.3,0.6,1.],num=3500)
spheres=sp.toSimulation(color=(0,0.5,0.7),material='sphereMat')
print "spheres"

#### Walls ####
O.materials.append(FrictMat(young=1.0e6,poisson=0.2,density=2.60e3,frictionAngle=20,label='wallmat'))
walls=aabbWalls((Vector3(-500e-3,-150e-3,-50e-3),Vector3(+500e-3,+150e-3,+250e-3)),thickness=.5e-3,material='wallmat')

for i in O.bodies:
if isinstance(i.shape,Sphere):
i.state.blockedDOFs="yXZ"
if isinstance(i.shape,GridNode):
i.state.blockedDOFs="yXZ"

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

thanks.

--