Unexpected Termination of Yade Script After Particle Deletion

Asked by Masataka Shiga

Hello Yade Community,

I'm working on a simulation to create a sample through natural sedimentation. Here's a brief description of my issue:

I'm trying to create a specimen through natural sedimentation.
By setting O.periodic=True, I've established periodic boundary conditions laterally and fixed boundary conditions vertically using a Facet whose position is fixed at the bottom.
I generate particles at a height well above the target, allow them to settle under gravity, and once the average coordination number surpasses 3, I aim to delete particles above a specific height to achieve a group of particles at the desired height.
However, after deleting the particles using the code below, the program stops after a certain number of iterations (ranging from a few tens to thousands). There's no error message displayed in the terminal.
Moreover, the iteration at which the program stops varies with each script execution.

I'm puzzled by this unexpected behavior, especially given the absence of any error messages. Any insights or suggestions would be greatly appreciated.

Thank you in advance for your assistance.

# Environment:

Execution Command: yade -j16 code.py
Yade Version: 2022.01a
Linux Version: Ubuntu 22.04.3 LTS
Architecture: amd64

# Script (MWE):

from yade import pack, utils
import numpy as np

state_index = 0

pack_sp = pack.SpherePack()
pack_sp.makeCloud((0.02, 0.02, 0.02),
                  (0.08, 0.98, 0.08),
                  rMean=0.01)
sphere_id = pack_sp.toSimulation()

O.periodic = True

base_facet_1 = utils.facet([Vector3(-0.02, 0, -0.02),
                            Vector3(0.12, 0, -0.02),
                            Vector3(-0.02, 0, 0.12)],
                            fixed=True)
base_facet_2 = utils.facet([Vector3(0.12, 0, 0.12),
                            Vector3(0.12, 0, -0.02),
                            Vector3(-0.02, 0, 0.12)],
                            fixed=True)

base_facet_id = O.bodies.append([base_facet_1, base_facet_2])

O.cell.hSize = Matrix3(0.1, 0, 0,
                       0, 1, 0,
                       0, 0, 0.1)
O.periodic = True

O.engines = [
    ForceResetter(),
    InsertionSortCollider(
        [Bo1_Sphere_Aabb(), Bo1_Facet_Aabb()], allowBiggerThanPeriod=True),
    InteractionLoop(
        [Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom()],
        [Ip2_FrictMat_FrictMat_FrictPhys()],
        [Law2_ScGeom_FrictPhys_CundallStrack()]),
    NewtonIntegrator(damping=0.2, gravity=(0, -9.81, 0)),
    PyRunner(iterPeriod=100, command="checkState()")
    ]

O.dt = PWaveTimeStep() * 0.5

def checkState():
    global sphere_id, state_index

    if state_index == 0:

        temp_sphere_coord_num = [len(O.interactions.withBody(i)) for i in sphere_id]
        temp_sphere_Y = [O.bodies[i].state.pos[1] for i in sphere_id]
        temp_sphere_data = np.array([sphere_id, temp_sphere_coord_num, temp_sphere_Y])

        if temp_sphere_data[1, :].mean() >=3:

            temp_unused_sphere_id = temp_sphere_data[0, temp_sphere_data[2, :] > 0.1]

            for temp_unused_sphere_id_each in temp_unused_sphere_id:
                O.bodies.erase(int(temp_unused_sphere_id_each))
                sphere_id.remove(int(temp_unused_sphere_id_each))

            print("some particles are deleted at", O.iter)

            state_index = 1

    elif state_index == 1:
        pass

Question information

Language:
English Edit question
Status:
Expired
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Masataka Shiga (masamasace) said :
#1

I did not notice the #707886 announcement. I will move this question to gitlab.
Many thanks.

Revision history for this message
Launchpad Janitor (janitor) said :
#2

This question was expired because it remained in the 'Open' state without activity for the last 15 days.