How to create cyclic boundary condition as udf for pure granular flow

See discussion at Particle not moving in a packed manner