# Periodic boundary of a cylinder

Hi,

I want to study a rotating drum.In order to shorten the simulation time,I want to shorten the length of the drum by making the ends of the drum periodic boundaries.But I found there is no periodic option in facetCylinder.

Thanks

James

## Question information

Language:
English Edit question
Status:
Solved
For:
Assignee:
No assignee Edit question
Solved by:
Jan Stránský
Solved:
2019-07-19
Last query:
2019-07-19
2019-07-19
 Jan Stránský (honzik) said on 2019-07-18: #1

Hi James

> But I found there is no periodic option in facetCylinder.

just make the cylinder open and make it "long enough".
Also consider using boxes instead of facets.

A MWE. Notice, that the sphere fly away after a few bounces (read [1])
###
r = 3 # cyl radius
h = 2 # cyl "height"
e = 3 # cyl height multiplicator to capture "overflown" spheres
#
O.bodies.append(cyl)
O.periodic = True
O.cell.setBox(10,10,h)
#
rs = 0.5
s = sphere((1.1*rs,r,0),rs)
s.state.vel = 1e-2*Vector3(1,1,.5)
O.bodies.append(s)
#
O.engines[1].allowBiggerThanPeriod = True # or set it to collider in O.engines definition
# or divide the cylinder also along axis not to have large bodies
###

cheers
Jan

 jamespaul (jamespauljames) said on 2019-07-19: #2

Thanks Jan,

I added your code into mine.It could generate the cylinder and sphere successfully at beginning.But after running,I reported an error.

In [1]: FATAL /build/yade-AmJP7C/yade-2018.02b/pkg/common/InsertionSortCollider.cpp:495 spatialOverlapPeri: Body #24 spans over half of the cell size 2 (axis=2, see flag allowBiggerThanPeriod)

Here is my script:
##################################################

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

sphere1=O.materials.append(FrictMat(young=6e5,poisson=0.3,density=2460,frictionAngle=float(atan(0.3)),label='sphere1'))

r = 3 # cyl radius
h = 2 # cyl "height"
e = 1 # cyl height multiplicator to capture "overflown" spheres

O.bodies.append(cyl)
O.periodic = True
O.cell.setBox(6,6,h)

rs = 0.05
s = sphere((1.1*rs,r,0),rs)
s.state.vel = 1e-2*Vector3(1,1,.5)
O.bodies.append(s)

O.engines[1].allowBiggerThanPeriod = True # or set it to collider in O.engines definition

O.engines=[
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()]

),
NewtonIntegrator(gravity=(0,0,-9.81),damping=0.1),
PyRunner(command='motion()',virtPeriod=.4,nDo=2),
]

O.dt=.01*PWaveTimeStep()
qt.Controller()
O.saveTmp()

def motion():
O.engines += [RotationEngine(ids=Cylinder,rotationAxis=[1,0,0],rotateAroundZero=True,angularVelocity=1.77)];

 Jan Stránský (honzik) said on 2019-07-19: #3

> O.engines[1].allowBiggerThanPeriod = True # or set it to collider in O.engines definition
> # (!) Read [1] carefully

InsertionSortCollider(..., allowBiggerThanPeriod=True)

cheers
Jan

 jamespaul (jamespauljames) said on 2019-07-19: #4

Thanks Jan Stránský, that solved my question.