periodic boundary in the direction of the length of a rotating drum (cylinder )

Asked by Roxana Saghafian Larijani

Hello,
I am trying to simulate a rotating drum. To avoid the effect of the front and back wall of the drum, instead of choosing the length of the drum very long I want to set periodic boundary only in this direction(z direction). So I defined a box with the same dimension of the drum in the z direction, and bigger than the radius of the drum. The drum center is located on (0,0,0) with the radius 0.5m and length of 0.2. So I defined the box as :

sp=pack.SpherePack()
sp.makeCloud((-0.3,-0.3,-0.05),(0.3,0.3,0.05),rMean=r)
sp.toSimulation(material=mat)

walls = O.bodies.append(ymport.stl('Drum.stl',material=mat2))

O.periodic = True
O.cell.setBox(5,5,0.2)

Based on the answers to some similar questions I also added allowBiggerThanPeriod=True:
InsertionSortCollider([Bo1_Sphere_Aabb(), Bo1_Facet_Aabb()],allowBiggerThanPeriod=True ),

But I get a very weird simulation.
 Is the center of the created box using O.cell.setBox(5,5,0.2) on (0,0,0) ?

I was wondering if you could help me find where are my mistakes and how I can apply the boundary condition in this case.

Regards,
Roxana Saghafian

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Jan Stránský
Solved:
Last query:
Last reply:
Revision history for this message
Jan Stránský (honzik) said :
#1

Hello,

> But I get a very weird simulation.

please be (much) more specific.

> Is the center of the created box using O.cell.setBox(5,5,0.2) on (0,0,0) ?

Periodic cell has no center. Or has arbitrary center at any point. It is one of the (possibly non-intuitive) features of periodicity.

> I was wondering if you could help me find where are my mistakes and how I can apply the boundary condition in this case.

The code seems OK.
Please describe your problem more in detail.
Please provide a MWE [1], i.e. provide Drum.stl or replace it e.g. with something like geom.facetCylinder

Cheers
Jan

[1] https://www.yade-dem.org/wiki/Howtoask

Revision history for this message
Roxana Saghafian Larijani (r-saghafian) said :
#2

Hello Jan,
The problem is that I think the periodic boundary is being applied in all directions (but I only need z direction to have period boundary condition ). So, when I increase the dimensions of O.cell.setBox, it gets devided to four different parts that might be right for other cases but for my case it does not seem like a rotating drum. With smaller dimensions of O.cell.setBox, also it does not give me good result as I think the periodic boundary condition is being implemented in all directions.
This is my script; I have also attached the Drum.stl file.

from yade import ymport
from yade import pack
from yade import utils, plot,wrapper

###functions for exporting data
os.mkdir(os.getcwd()+'/VTK/')

def savePropData(O):
        from yade import export
        import numpy as np

        path = os.getcwd()+'/VTK/'
        vtkExporter = export.VTKExporter(path)
        vtkExporter.exportSpheres(numLabel = O.iter, what = dict( \
                                      dist = 'b.state.pos.norm()', \
                               linVelocity = 'b.state.vel', \
                               angVelocity = 'b.state.angVel', \
                               mass = 'b.state.mass', \
                               mat_rand = 'b.material.id', \
                               numOfContacts = 'len(b.intrs())'))

####

fr = 0.38
rho = 2500
En = 0.7
Et = 0.7
poi=0.21
yoM=63e6
O.dt = 0.000005
r = 0.008 #0.002381
Gamma =0.073 #20.6 * 1e-3
Theta = 35
vB = 0.0
CapType="Rabinovich"

##definig material

mat=O.materials.append(
        ViscElCapMat(frictionAngle=fr, density=rho, poisson=poi, young= yoM, Vb=vB, gamma=Gamma, theta=Theta, Capillar=True, CapillarType=CapType,en=En, et=Et)
)
mat2=O.materials.append(
        ViscElCapMat(frictionAngle=0.29, density=rho, poisson=0.35, young= 12e6, Vb=vB, gamma=Gamma, theta=90, Capillar=True, CapillarType=CapType,en=0.72, et=0.72)
)
#defining the spheres

sp=pack.SpherePack()
sp.makeCloud((-0.2,-0.2,-0.05),(0.2,0.2,0.05),rMean=r)
sp.toSimulation(material=mat)
Nprtcl=len(O.bodies)

walls = O.bodies.append(ymport.stl('Drum.stl',material=mat2))
##periodic boundary

O.periodic = True
O.cell.setBox(0.4,0.4,0.1)

##engine
O.engines = [
        ForceResetter(),
        InsertionSortCollider([Bo1_Sphere_Aabb(), Bo1_Facet_Aabb()],allowBiggerThanPeriod=True ),
        InteractionLoop(
                [Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom()],
                [Ip2_ViscElCapMat_ViscElCapMat_ViscElCapPhys()],
                [Law2_ScGeom_ViscElCapPhys_Basic()],

        ),

        NewtonIntegrator(gravity=[0, -9.8, 0]),
        RotationEngine(ids=walls,rotationAxis=[0,0,1],rotateAroundZero=True,angularVelocity=1.68),
        PyRunner(command='savePropData(O)', iterPeriod=5000)
]

O.run()

Thank you!

Regards,
Roxana Saghafian

________________________________
From: <email address hidden> <email address hidden> on behalf of Jan Stránský <email address hidden>
Sent: Monday, August 15, 2022 9:30 AM
To: Saghafian Larijani, Roxana (UT-ET) <email address hidden>
Subject: Re: [Question #702751]: periodic boundary in the direction of the length of a rotating drum (cylinder )

Your question #702751 on Yade changed:
https://answers.launchpad.net/yade/+question/702751

    Status: Open => Needs information

Jan Stránský requested more information:
Hello,

> But I get a very weird simulation.

please be (much) more specific.

> Is the center of the created box using O.cell.setBox(5,5,0.2) on
(0,0,0) ?

Periodic cell has no center. Or has arbitrary center at any point. It is
one of the (possibly non-intuitive) features of periodicity.

> I was wondering if you could help me find where are my mistakes and
how I can apply the boundary condition in this case.

The code seems OK.
Please describe your problem more in detail.
Please provide a MWE [1], i.e. provide Drum.stl or replace it e.g. with something like geom.facetCylinder

Cheers
Jan

[1] https://www.yade-dem.org/wiki/Howtoask

--
To answer this request for more information, you can either reply to
this email or enter your reply at the following page:
https://answers.launchpad.net/yade/+question/702751

You received this question notification because you asked the question.

Revision history for this message
Jan Stránský (honzik) said :
#3

> I have also attached the Drum.stl

attachments are not possible here in launchpad questions..
Please either provide the content of the file, or make your code using alternatives, like facetCylinder

> it gets devided to four different parts that might be right for other cases but for my case it does not seem like a rotating drum.

Thanks for clarification.
Actually, it IS proper rotating drum and is "right" :-)
It is just the way it is displayed, particles positions wrapped inside the periodic cell, not outside.
To overcome this issue, you can:
- postprocess the positions to look more natural
- put the drum and particles to the "center" of the cell (i.e. the visualization of particles is natural). Note that the results should be exactly the same as in the "default" case.

Cheers
Jan

Revision history for this message
Roxana Saghafian Larijani (r-saghafian) said :
#4

Isn’t it the case that the periodic boundary is being implemented in all three directions? Is there any way I can avoid periodic boundary condition in x and y direction?

Regards,
Roxana Saghafian

Roxana Saghafian Larijani | PhD student
ET-CME, UTwente | https://tusail.eu<https://tusail.eu/>

________________________________
From: <email address hidden> <email address hidden> on behalf of Jan Stránský <email address hidden>
Sent: Monday, August 15, 2022 1:31 PM
To: Saghafian Larijani, Roxana (UT-ET) <email address hidden>
Subject: Re: [Question #702751]: periodic boundary in the direction of the length of a rotating drum (cylinder )

Your question #702751 on Yade changed:
https://answers.launchpad.net/yade/+question/702751

    Status: Open => Answered

Jan Stránský proposed the following answer:
> I have also attached the Drum.stl

attachments are not possible here in launchpad questions..
Please either provide the content of the file, or make your code using alternatives, like facetCylinder

> it gets devided to four different parts that might be right for other
cases but for my case it does not seem like a rotating drum.

Thanks for clarification.
Actually, it IS proper rotating drum and is "right" :-)
It is just the way it is displayed, particles positions wrapped inside the periodic cell, not outside.
To overcome this issue, you can:
- postprocess the positions to look more natural
- put the drum and particles to the "center" of the cell (i.e. the visualization of particles is natural). Note that the results should be exactly the same as in the "default" case.

Cheers
Jan

--
If this answers your question, please go to the following page to let us
know that it is solved:
https://answers.launchpad.net/yade/+question/702751/+confirm?answer_id=2

If you still need help, you can reply to this email or go to the
following page to enter your feedback:
https://answers.launchpad.net/yade/+question/702751

You received this question notification because you asked the question.

Revision history for this message
Jan Stránský (honzik) said :
#5

It depends on definition.
In Yade, if you enable periodicity, it is applied in 3 direction, no matter what.
But enlarging the periodic cell dimensions, you can "disable" some directions, making the simulation being practically periodic only in some direction(s).
Still, the **visualization** is done such that all particles are displayed inside the cell. But the periodicity itself (i.e. periodic contact detection between particles and periodic images of other particles) is not effectively present in "disabled" directions.

Cheers
Jan

Revision history for this message
Roxana Saghafian Larijani (r-saghafian) said :
#6

Thank you for your response! I managed to display the rotating drum in the same way as the default case by shifting the drum and the particles.
However, I still have a problem. It seems that there are some problems with the contact detection of some particles, and they get out of the drum. Might it be because I am using (
Law2_ScGeom_ViscElCapPhys_Basic()
) as it is mentioned in the question 429604?

Regards,
Roxana Saghafian

________________________________
From: <email address hidden> <email address hidden> on behalf of Jan Stránský <email address hidden>
Sent: Monday, August 15, 2022 2:25 PM
To: Saghafian Larijani, Roxana (UT-ET) <email address hidden>
Subject: Re: [Question #702751]: periodic boundary in the direction of the length of a rotating drum (cylinder )

Your question #702751 on Yade changed:
https://answers.launchpad.net/yade/+question/702751

    Status: Open => Answered

Jan Stránský proposed the following answer:
It depends on definition.
In Yade, if you enable periodicity, it is applied in 3 direction, no matter what.
But enlarging the periodic cell dimensions, you can "disable" some directions, making the simulation being practically periodic only in some direction(s).
Still, the **visualization** is done such that all particles are displayed inside the cell. But the periodicity itself (i.e. periodic contact detection between particles and periodic images of other particles) is not effectively present in "disabled" directions.

Cheers
Jan

--
If this answers your question, please go to the following page to let us
know that it is solved:
https://answers.launchpad.net/yade/+question/702751/+confirm?answer_id=4

If you still need help, you can reply to this email or go to the
following page to enter your feedback:
https://answers.launchpad.net/yade/+question/702751

You received this question notification because you asked the question.

Revision history for this message
Jan Stránský (honzik) said :
#7

> However, I still have a problem.

please, provide a MWE as discussed above.

> Might it be because I am using (Law2_ScGeom_ViscElCapPhys_Basic()) as it is mentioned in the question 429604?

What is the result with Law2_ScGeom_FrictPhys_CundallStrack?

But firstly I would guess the problem is due to the fact
"If I remember correctly, the large bodies are not "periodically copied", so the spheres from "next" cells do not interact with the wall."
discussed in [2], #4
If it is this case or not would be clear with the MWE.

Cheers
Jan

[2] https://answers.launchpad.net/yade/+question/701266

Revision history for this message
Roxana Saghafian Larijani (r-saghafian) said :
#8

Please find the MWE below:

from yade import ymport
from yade import pack
from yade import utils, plot,wrapper

fr = 0.38
rho = 2500
En = 0.7
Et = 0.7
poi=0.21
yoM=63e6

O.dt = 0.000005

r = 0.01 #0.002381

##definig material

mat=O.materials.append(
        ViscElCapMat(frictionAngle=fr, density=rho, poisson=poi, young= yoM,en=En, et=Et)
)

#defining the spheres

sp=pack.SpherePack()
sp.makeCloud((0.6,0.6,0.05),(1,1,0.15),rMean=r)
sp.toSimulation(material=mat)
Nprtcl=len(O.bodies)

Drum=geom.facetCylinder((0.8,0.8,0.1),radius=0.5,height=0.2,orientation=Quaternion(Vector3(0,0,1),(pi/2.0)), wallMask=4)
walls = O.bodies.append(Drum)
##periodic boundary

O.periodic = True
O.cell.setBox(5,5,0.2)
####
##engine
O.engines = [
        ForceResetter(),
        InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb(),Bo1_Wall_Aabb()],allowBiggerThanPeriod = True),
        InteractionLoop(
                [Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom(),Ig2_Wall_Sphere_ScGeom()],
                [Ip2_ViscElCapMat_ViscElCapMat_ViscElCapPhys()],
                [Law2_ScGeom_ViscElCapPhys_Basic()],

        ),

        NewtonIntegrator(gravity=[0, -9.8, 0]),
        RotationEngine(ids=walls,rotationAxis=[0,0,1],rotateAroundZero=True,zeroPoint=[0.8,0.8,0.1],angularVelocity=1.68)

]

from yade import qt
qt.View()

O.run()

>What is the result with Law2_ScGeom_FrictPhys_CundallStrack?
I checked it and the problem does not get solved by changing to Cundall.

>But firstly I would guess the problem is due to the fact
"If I remember correctly, the large bodies are not "periodically copied", so the spheres from "next" cells do not interact with the wall."
discussed in [2], #4
I think this is the problem! Because it is like the particles pass through the drum wall and does not interact with it!

Regards,
Roxana Saghafian

________________________________
From: <email address hidden> <email address hidden> on behalf of Jan Stránský <email address hidden>
Sent: Thursday, August 18, 2022 9:20 AM
To: Saghafian Larijani, Roxana (UT-ET) <email address hidden>
Subject: Re: [Question #702751]: periodic boundary in the direction of the length of a rotating drum (cylinder )

Your question #702751 on Yade changed:
https://answers.launchpad.net/yade/+question/702751

    Status: Open => Needs information

Jan Stránský requested more information:
> However, I still have a problem.

please, provide a MWE as discussed above.

> Might it be because I am using (Law2_ScGeom_ViscElCapPhys_Basic()) as
it is mentioned in the question 429604?

What is the result with Law2_ScGeom_FrictPhys_CundallStrack?

But firstly I would guess the problem is due to the fact
"If I remember correctly, the large bodies are not "periodically copied", so the spheres from "next" cells do not interact with the wall."
discussed in [2], #4
If it is this case or not would be clear with the MWE.

Cheers
Jan

[2] https://answers.launchpad.net/yade/+question/701266

--
To answer this request for more information, you can either reply to
this email or enter your reply at the following page:
https://answers.launchpad.net/yade/+question/702751

You received this question notification because you asked the question.

Revision history for this message
Best Jan Stránský (honzik) said :
#9

Thanks for MWE.
The issue seems to to be the same from [2]
If I enlarge the cylinder
Drum=geom.facetCylinder(...,height=2,...)
I get no spheres passing through the drum.

If you have STL model, you can:
- modify the file to make it longer
- "copy" the original drum sufficiently along the axis

Cheers
Jan

Revision history for this message
Roxana Saghafian Larijani (r-saghafian) said :
#10

Thanks for your time and responses to my questions!

Regards,
Roxana Saghafian