How to move the facetBox side

Asked by enki

I've created four cylinder particles in a facetBox, but my new question is how to move the facetBox side?

I try to use TranslationEngine, but it did not work in my case...

Additionally, can I assign the specific side in facetBox as periodic boundary?

Here are my statement scripts:

from __future__ import print_function
from yade.gridpfacet import *
from yade import pack, plot,qt
import gts, os.path, locale

from numpy import arange

#locale.setlocale(locale.LC_ALL, 'en_US.UTF-8') # Note: gts is locale-dependent. If, for example, german locale is used, gts.read()-function does not import floats normally

#### Parameters ####

# radius of cylinder
cyl_R=0.2
# length of cylinder
cyl_L=0.1
# friction angle
phi=30.0
# Young's modulus
E=1e6

idSteel=O.materials.append(FrictMat(young=210e9,poisson=.25,frictionAngle=.8,density=7.85e3,label="steel"))
# wallMask=31 >> +/-x, +/-y, -z
O.bodies.append(geom.facetBox((0,0,0),(2.5,2.5,1),wallMask=63,material="steel" ))

### create materials ###

# gridConnections material

gridConMat= O.materials.append(CohFrictMat(young=E, poisson=0.5, density=1500, frictionAngle=radians(phi), normalCohesion=1e10, shearCohesion=1e10, momentRotationLaw=True, label='gcMat'))

# general interactions

cylMat= O.materials.append(FrictMat(young=E, poisson=0.5, density=1500, frictionAngle=radians(phi), label='cMat'))

### create particles/packing: cylinders ###

nodesIds=[]
cylIds=[]

dx=0.5
dy=0.5
nx=2
ny=2
nz=1
dz=0

for i in range(0,nx):
 x=0+i*dx
 for j in range(0,ny):
  y=0+j*dy
  for k in range(0,nz):
   z=0+k*dz
   cylinder((x,y+cyl_L,z),(x,y,z),radius=cyl_R,nodesIds=nodesIds,cylIds=cylIds,
      color=[1,0,0],fixed=False,intMaterial='gcMat',extMaterial='cMat')

### Engines ###

O.engines = [
        ForceResetter(),
        InsertionSortCollider([Bo1_GridConnection_Aabb(),Bo1_PFacet_Aabb(), Bo1_Wall_Aabb()]),
        InteractionLoop([
   Ig2_GridNode_GridNode_GridNodeGeom6D(),
                  Ig2_GridConnection_GridConnection_GridCoGridCoGeom(),
   Ig2_Facet_Sphere_ScGeom(),
   #Ig2_Wall_Sphere_ScGeom(),
   #Ig2_Sphere_Sphere_ScGeom(),
   #Ig2_Sphere_GridConnection_ScGridCoGeom()
                ],
                [
# internal cylinder physics
           Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(setCohesionNow=True,setCohesionOnNewContacts=False),
# physics for external interactions, i.e., cylinder-cylinder
                        Ip2_FrictMat_FrictMat_FrictPhys()
                ],
                [
                        Law2_ScGeom6D_CohFrictPhys_CohesionMoment(), # contact law for "internal" cylinder forces
                        Law2_GridCoGridCoGeom_FrictPhys_CundallStrack(), # contact law for cylinder-cylinder interaction
   Law2_ScGeom_FrictPhys_CundallStrack(),
   Law2_ScGridCoGeom_FrictPhys_CundallStrack()
   ]
        ),
 GlobalStiffnessTimeStepper(timestepSafetyCoefficient=0.5),
        NewtonIntegrator(gravity=(0., 0, -9.81), damping=0.5, label='newton'),
 #PyRunner(iterPeriod=1e-3,command="")
]

#### For viewing ####
qt.View()

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

Question information

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

Hello,

> I try to use TranslationEngine, but it did not work in my case...

please provide the specific code.
This statement as is has no value for us and actually can be confusing.

> how to move the facetBox side?

Please be more specific and define "move".
Shift it instantly and let it fixed in new position?
Make it move with certain velocity? With changing velocity? ... ?
... ?

> Additionally, can I assign the specific side in facetBox as periodic boundary?

Yes.
Delete the sides which you want to be periodic.
Set the periodic cell size such that it is periodic in your desired direction and the other two directions are enlarged enough such that the periodicity in these two directions does not influence the simulation.
Similar concept is illustrated in [1], where the vertical direction is enlarged such that it is not in fact periodic.

Cheers
Jan

[1] https://gitlab.com/yade-dev/trunk/-/blob/master/examples/PeriodicBoundaries/periodicSandPile.py

Revision history for this message
enki (kikiyu) said :
#2

Hi Jan,

1) I tried the below code: but I'm not sure about it make sense or not...

>> move= TranslationEngine(translationAxis=[0,0,1],velocity=1.0,ids=[0,1,2,3,4,5])

I would like to move (add velocity to all facets of the facetBox) in my case...

2) For the description " Set the periodic cell size such that it is periodic in your desired direction and the other two directions are enlarged enough such that the periodicity in these two directions does not influence the simulation."

Could you make more detailed information for this step?

3) And I found that when I start running my script above, the cylinder particles are segmented and the whole cylinder particle extends over time. I do not know why...

Revision history for this message
enki (kikiyu) said :
#3

I would like to move / add velocity for the all facets in facetBox

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

> I tried the below code: but I'm not sure about it make sense or not...
> move= TranslationEngine(translationAxis=[0,0,1],velocity=1.0,ids=[0,1,2,3,4,5])
> I would like to move (add velocity to all facets of the facetBox) in my case...

The code is fine.
But, have you added "move" to O.engines? alone this code "does nothing".

Alternatively, you can just set velocity of the faces:
###
for id in range(6):
    b = O.bodies[id]
    b.state.vel = (0,0,1)
###

> For the description " Set the periodic cell size such that it is periodic in your desired direction and the other two directions are enlarged enough such that the periodicity in these two directions does not influence the simulation."
> Could you make more detailed information for this step?

E.g. for periodicity in x direction:
###
wmask = 4 | 8 | 16 | 32 # y and z walls
O.bodies.append(geom.facetBox((0,0,0),(2.5,2.5,1),wallMask=wmask,material="steel" ))
O.periodic = True
O.cell.setBox(2.5,20,20)
###

3) And I found that when I start running my script above, the cylinder particles are segmented and the whole cylinder particle extends over time. I do not know why...

Please, open a new question for a new problem [1].

Cheers
Jan

[1] https://www.yade-dem.org/wiki/Howtoask (currently down, but should be ok soon)

Revision history for this message
enki (kikiyu) said :
#5

Thanks Jan, I will open a new question for 3).

1) move= TranslationEngine(translationAxis=[0,0,1],velocity=1.0,ids=[0,1,2,3,4,5])
        I would like to move (add velocity to all facets of the facetBox) in my case...

The code is fine.
But, have you added "move" to O.engines? alone this code "does nothing".

>> I think I have already add "move" in the O.engines[], but it didn't show anything, and I have opened a new question with the script error, hope it can work right now.

Can you help with this problem?

Provide an answer of your own, or ask enki for more information if necessary.

To post a message you must log in.