Interrupt when using the bf module in a periodic boundary
Hello,
I try to carry out a shear flow experiment in a periodic boundary, which contains particle breakage, so I used the bf module. I read the code of the bf module and refer to the case 'uniaxial_sphere_batch.py'. (I don't need to implement clump breakage, crushing of individual particles is enough)
I set up the bottom and top plates in the Z direction, which are represented by clumps of closely arranged balls. The bottom plate is fixed, and a constant force in the -z direction and a constant velocity in the x direction are applied to the top plate.
- The problem is that: once particle breakage occurs, the whole simulation stops and no error message is indicated. How do we fix this?
- I'm guessing that the bf module hasn't taken periodic boundary into account? Since the 'master_predicate' used to generate the 'regularHexa' particles could potentially cross the boundaries and can't take into account the NEIGHBOUR particles on the other side as a reasonable exclusion. However, I don't think this is the cause of problem 1, because I tried setting 'outer_predicate' inside the periodic boundary and it still doesn't solve the problem 1.
- By the way, if I want to fix the shortcoming of the bf module in periodic boundary, is this programmatically possible? Can you point me in some direction.
Here's my code:
from bf import stressTensor, checkFailure, replaceSphere, evalClump
from yade import pack,ymport,export,geom,bodiesHandling,qt,plot
from yade import *
import numpy as np
import os
O.materials.append(FrictMat(young=1.5e7,poisson=0.2,frictionAngle=0.35,density=2500,label='boxxx'))
O.materials.append(FrictMat(young=1.5e7,poisson=0.2,frictionAngle=0.35,density=920,label='particle1'))
O.periodic=True
O.cell.hSize=Matrix3(
0.2, 0, 0,
0, 0.1, 0,
0, 0, 0.14)
###particle by densepack###
ParticleBox = pack.inAlignedBox((0,0,0.01),(0.2,0.1,0.11))
sp = pack.randomDensePack(
ParticleBox,
spheresInCell = 2000,
radius = .005,
rRelFuzz = 0.05,
material = 'particle1',
returnSpherePack = True,
)
origin_particles = sp.toSimulation(material='particle1')
###END particle by densepack###
###create bottom###
bottombox = pack.inAlignedBox((-0.002,-0.002,0),(0.202,0.102,0.01))
bottom = pack.regularHexa(bottombox, 0.0025, gap=0.0)
#ids = bottom.toSimulation()
id_bottom = O.bodies.append(bottom)
#bottomclump, _ = O.bodies.appendClumped(bottom)
for i in id_bottom:
growParticle(i, 1.1)
bottomclump=O.bodies.clump(id_bottom,discretization=10)
O.bodies[bottomclump].state.blockedDOFs='xyzXYZ'
###End create bottom###
###create top###
topbox = pack.inAlignedBox((-0.002,-0.002,0.13),(0.202,0.102,0.14))
top = pack.regularHexa(topbox, 0.0025, gap=0.0)
id_top = O.bodies.append(top)
for i in id_top:
growParticle(i, 1.1)
topclump=O.bodies.clump(id_top,discretization=10)
O.bodies[topclump].state.blockedDOFs='xyXYZ'
O.bodies[topclump].state.vel = (0.05, 0, 0)
O.forces.setPermF(topclump,(0,0,-1000.0))
###End create top###
###bf module###
bfBoundary = pack.inAlignedBox((0,0,0),(0.2,0.1,0.11))
def stateUpdate(radius_ratio, tension_strength, compressive_strength, wei_V0, wei_P, wei_m):
for b in O.bodies:
if b.isStandalone :
effort = checkFailure(O.bodies[b.id], tension_strength, compressive_strength, wei_V0, wei_P, wei_m)
if effort >= 1:
replaceSphere(
b.id,
radius_ratio=radius_ratio,
relative_gap=0,
grow_radius=1,
outer_predicate=bfBoundary,
max_scale=3.0
)
# refresh time step
O.dt = 0.3 * PWaveTimeStep()
O.engines = [
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb()]),
InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()],
),
NewtonIntegrator(damping=0.2, label='newton'),
PyRunner(command="stateUpdate(radius_ratio=3, tension_strength=800000.0, compressive_strength=2000000.0, wei_V0=0.000001, wei_P=0.63, wei_m=3 )", iterPeriod=500),
#PyRunner(command="recordF()", iterPeriod=500)
]
O.dt = 0.3* PWaveTimeStep()
def recordF():
F = O.forces.f(topclump)
#print(str(F))
O.run()
Thanks for help!
Edited by wangyu-93