[Yade-users] [Question #706865]: Erasing entire clump in simulation

2023-06-01 Thread Lassakorn Eawsakul
New question #706865 on Yade:
https://answers.launchpad.net/yade/+question/706865

Hi,
I wonder if I am doing correct about deleting clumps in my simulation. My 
intention is to let the clump fall onto the sphere particles inside the 
cylinder container but I cut off the code about particles first (it's more than 
260K particles) to make sure that the clump would be erase after 
unbalancedForce is smaller than 0.5. I tried several ways to write it but 
nothing work, Please give me some piece of advice
Cheers.

### My code ###
import random
import math
from yade import geom, pack, utils, plot, ymport, export
import numpy as np

# Define cylinder with funnel parameters
center = (0, 0, 0.1)
diameter = 0.102
height = 0.18

# create cylindrical body with radius 0.102 m and height 0.064 m
cylinder = geom.facetCylinder(center=center, radius=diameter/2, height=height, 
segmentsNumber=80, wallMask=6)

# add cylinder to simulation
O.bodies.append(cylinder)

# plate properties
clump_plate = CohFrictMat(density=7500, label='clump_plate')

# add properties
O.materials.append(clump_plate)

# clumping parameters
bodyList = []
zi = 0.115
radius_clump = 0.00221
clumpLimit = (diameter/2) - 0.005
# layer and offset condition
num_layers = 8
z_offset_increment = 0.00128

# adjust the z-coordinate based on the layer
for layer in range(num_layers):
z_offset = layer * z_offset_increment
# if layer is divisible by 2, move x and y axis by 2mm
if layer % 2 == 0:
x_offset = 0.002
y_offset = 0.002
else:
x_offset = 0
y_offset = 0

for xi in range(-60, 60, 4):
x = xi / 1000 + x_offset
for yi in range(-60, 60, 4):
y = yi / 1000 + y_offset

# Check if the sphere is within the clump limit
if (math.sqrt(x**2 + y**2) + radius_clump) <= clumpLimit:
sphere_obj = sphere([x, y, zi + z_offset], radius_clump)
# Assign material properties to the sphere
sphere_obj.material = clump_plate
bodyList.append(O.bodies.append(sphere_obj))

# set color
for index, layer in enumerate(O.bodies):
if not isinstance(layer.shape, Sphere):
continue
if index % 2 == 0:
layer.shape.color = (1, 1, 1)  # white color
else:
layer.shape.color = (0.5, 0, 0)  # navy-blue color

# add clump to bodyList
idClump = O.bodies.clump(bodyList)


O.engines = [
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb(), Bo1_Facet_Aabb()]),
InteractionLoop(
# handle sphere+sphere and facet+sphere collisions
[Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()]
),
NewtonIntegrator(gravity=(0, 0, -9.81), damping=0.4),
# call the checkUnbalanced function (defined below) every 600 seconds
PyRunner(command='checkUnbalanced()', realPeriod=2)
]
O.dt = .5 * PWaveTimeStep()


def checkUnbalanced():

if unbalancedForce() < .3 :
# Remove clumps from the simulation
O.bodies.erase(idClump)
# Stop the simulation
O.pause()



-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-users] [Question #706257]: Can YADE generate specific number of polyhedral particles in a packing?

2023-04-18 Thread Lassakorn Eawsakul
Question #706257 on Yade changed:
https://answers.launchpad.net/yade/+question/706257

Status: Answered => Open

Lassakorn Eawsakul is still having a problem:
Thanks for the answer,

Is there any docs or sources where I can find about how to replacing it

Thanks in advance

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


[Yade-users] [Question #706257]: Can YADE generate specific number of polyhedral particles in a packing?

2023-04-17 Thread Lassakorn Eawsakul
New question #706257 on Yade:
https://answers.launchpad.net/yade/+question/706257

I'm making the simulation of gravity deposition for polyhedral particles to 
fall into container, I wonder if we can generate a pack of polyhedral particles 
in specific number (I have min/max size in vector for each size I want to 
generate) 

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


[Yade-users] [Question #706256]: Particles fall out the container

2023-04-17 Thread Lassakorn Eawsakul
New question #706256 on Yade:
https://answers.launchpad.net/yade/+question/706256

import random
import math
from yade import geom, pack, utils, ymport
from yade import export
import numpy as np

# Define cylinder parameters
center = (0, 0, 0)
radius = 0.102
height = 0.064

# create cylindrical body with radius 0.102 m and height 0.064 m
cylinder = yade.geom.facetCylinder(center=center, radius=radius, height=height, 
segmentsNumber=200, wallMask=6)

# define material properties
mat = PolyhedraMat()
mat.density = 2600  # kg/m^3
mat.young = 1E6  # Pa
mat.poisson = 2 / 1E6
mat.frictionAngle = 0.6  # rad

# assign material to each body in the cylinder
for body in cylinder:
body.bodyMat = mat

# add cylinder to simulation
O.bodies.append(cylinder)


# Generate sphere pack

O.materials.append(FrictMat(young=1E6, poisson=2/1E6, density=10, 
label='agg'))

sp = pack.SpherePack()
sp.makeCloud((-0.05,-0.05,0), 
(0.05,0.05,0.09),rMean=0.01575,rRelFuzz=0,periodic=False,num=6)

sp2_1 = pack.SpherePack()
sp2_1.makeCloud((-0.03,-0.03,0.1), 
(0.03,0.03,0.15),rMean=0.01175,rRelFuzz=0,periodic=False,num=7)

sp2_2 = pack.SpherePack()
sp2_2.makeCloud((-0.03,-0.03,0.16), 
(0.03,0.03,0.2),rMean=0.011,rRelFuzz=0,periodic=False,num=8)

sp2_3 = pack.SpherePack()
sp2_3.makeCloud((-0.03,-0.03,0.21), 
(0.03,0.03,0.25),rMean=0.01025,rRelFuzz=0,periodic=False,num=8)

sp3_1 = pack.SpherePack()
sp3_1.makeCloud((-0.03,-0.03,0.26), 
(0.03,0.03,0.3),rMean=0.0083125,rRelFuzz=0,periodic=False,num=31)

sp3_2 = pack.SpherePack()
sp3_2.makeCloud((-0.03,-0.03,0.31), 
(0.03,0.03,0.35),rMean=0.007125,rRelFuzz=0,periodic=False,num=31)

sp3_3 = pack.SpherePack()
sp3_3.makeCloud((-0.03,-0.03,0.36), 
(0.03,0.03,0.4),rMean=0.0059375,rRelFuzz=0,periodic=False,num=32)

sp4_1 = pack.SpherePack()
sp4_1.makeCloud((-0.03,-0.03,0.41), 
(0.03,0.03,0.45),rMean=0.0041525,rRelFuzz=0,periodic=False,num=25)

sp4_2 = pack.SpherePack()
sp4_2.makeCloud((-0.03,-0.03,0.46), 
(0.03,0.03,0.5),rMean=0.003555,rRelFuzz=0,periodic=False,num=26)

sp4_3 = pack.SpherePack()
sp4_3.makeCloud((-0.03,-0.03,0.51), 
(0.03,0.03,0.55),rMean=0.0029575,rRelFuzz=0,periodic=False,num=26)

sp5_1 = pack.SpherePack()
sp5_1.makeCloud((-0.03,-0.03,0.56), 
(0.03,0.03,0.6),rMean=0.002065,rRelFuzz=0,periodic=False,num=25)

sp5_2 = pack.SpherePack()
sp5_2.makeCloud((-0.03,-0.03,0.61), 
(0.03,0.03,0.65),rMean=0.00177,rRelFuzz=0,periodic=False,num=26)

sp5_3 = pack.SpherePack()
sp5_3.makeCloud((-0.03,-0.03,0.66), 
(0.03,0.03,0.7),rMean=0.001475,rRelFuzz=0,periodic=False,num=26)

sp6_1 = pack.SpherePack()
sp6_1.makeCloud((-0.03,-0.03,0.56), 
(0.03,0.03,0.6),rMean=0.001035,rRelFuzz=0,periodic=False,num=155)

sp6_2 = pack.SpherePack()
sp6_2.makeCloud((-0.03,-0.03,0.61), 
(0.03,0.03,0.65),rMean=0.00089,rRelFuzz=0,periodic=False,num=155)

sp6_3 = pack.SpherePack()
sp6_3.makeCloud((-0.03,-0.03,0.66), 
(0.03,0.03,0.7),rMean=0.000745,rRelFuzz=0,periodic=False,num=156)

sp7_1 = pack.SpherePack()
sp7_1.makeCloud((-0.03,-0.03,0.71), 
(0.03,0.03,0.75),rMean=0.000525,rRelFuzz=0,periodic=False,num=155)

sp7_2 = pack.SpherePack()
sp7_2.makeCloud((-0.03,-0.03,0.76), 
(0.03,0.03,0.8),rMean=0.00045,rRelFuzz=0,periodic=False,num=155)

sp7_3 = pack.SpherePack()
sp7_3.makeCloud((-0.03,-0.03,0.81), 
(0.03,0.03,0.85),rMean=0.000375,rRelFuzz=0,periodic=False,num=156)

sp8_1 = pack.SpherePack()
sp8_1.makeCloud((-0.03,-0.03,0.86), 
(0.03,0.03,0.9),rMean=0.0002625,rRelFuzz=0,periodic=False,num=155)

sp8_2 = pack.SpherePack()
sp8_2.makeCloud((-0.03,-0.03,0.91), 
(0.03,0.03,0.95),rMean=0.000225,rRelFuzz=0,periodic=False,num=155)

sp8_3 = pack.SpherePack()
sp8_3.makeCloud((-0.03,-0.03,0.96), 
(0.03,0.03,1),rMean=0.0001875,rRelFuzz=0,periodic=False,num=156)

sp9 = pack.SpherePack()
sp9.makeCloud((-0.03,-0.03,0.01), 
(0.03,0.03,0.05),rMean=0.75,rRelFuzz=0,periodic=False,num=8000)

sp10 = pack.SpherePack()
sp10.makeCloud((-0.03,-0.03,0.04), 
(0.03,0.03,1),rMean=0.5,rRelFuzz=0,periodic=False,num=8)

# add the sphere pack to the simulation
sp.toSimulation(material='agg')
sp2_1.toSimulation(material='agg')
sp2_2.toSimulation(material='agg')
sp2_3.toSimulation(material='agg')
sp3_1.toSimulation(material='agg')
sp3_2.toSimulation(material='agg')
sp3_3.toSimulation(material='agg')
sp4_1.toSimulation(material='agg')
sp4_2.toSimulation(material='agg')
sp4_3.toSimulation(material='agg')
sp5_1.toSimulation(material='agg')
sp5_2.toSimulation(material='agg')
sp5_3.toSimulation(material='agg')
sp6_1.toSimulation(material='agg')
sp6_2.toSimulation(material='agg')
sp6_3.toSimulation(material='agg')
sp7_1.toSimulation(material='agg')
sp7_2.toSimulation(material='agg')
sp7_3.toSimulation(material='agg')
sp8_1.toSimulation(material='agg')
sp8_2.toSimulation(material='agg')
sp8_3.toSimulation(material='agg')
sp9.toSimulation(material='agg')
sp10.toSimulation(material='agg')

# Define gravity engine
O.engines = [ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
   InteractionLoop(
   

[Yade-users] [Question #705016]: Can we generate randomly particles shape in yade eg.rocks?

2023-02-09 Thread Lassakorn Eawsakul
New question #705016 on Yade:
https://answers.launchpad.net/yade/+question/705016

Hi, I wonder if I could generate polyhedron particles randomly shape 
(aggregates) and add its density, weight to use in gravity deposition. Thank 
you in advance.
PS. I’m trying to do the particles packing and let it fall down by gravity into 
container and measure its void.

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp


[Yade-users] [Question #704153]: Porosity of a particles inside the container

2022-12-18 Thread Lassakorn Eawsakul
New question #704153 on Yade:
https://answers.launchpad.net/yade/+question/704153

Hi everyone I'm very new to this program and I have a problem for adding 
porosity calculation function into my code I'm trying to let the cloud of 
spheres particles fall down in to a cylinder by gravity and find the void 
ration inside the container, do you guys have any idea what should i do to my 
code
##
# gravity deposition in box, showing how to plot and save history of data,
# and how to control the simulation while it is running by calling
# python functions from within the simulation loop

# import yade modules that we will use below
from yade import pack, plot

# create cylinder box from facets
O.bodies.append(yade.geom.facetCylinder((0,0,0),radius=5.08,height=5.08,segmentsNumber=40,wallMask=6))

# create empty sphere packing
# sphere packing is not equivalent to particles in simulation, it contains only 
the pure geometry
sp = pack.SpherePack()
# generate randomly spheres with uniform radius distribution
sp.makeCloud((-8, -8, 8, (8, 8, 20), rMean=0.9, rRelFuzz=0)
# add the sphere pack to the simulation
sp.toSimulation()

O.engines = [
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb(), Bo1_Facet_Aabb()]),
InteractionLoop(
# handle sphere+sphere and facet+sphere collisions
[Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()]
),
NewtonIntegrator(gravity=(0, 0, -9.81), damping=0.4),
# call the checkUnbalanced function (defined below) every 2 seconds
PyRunner(command='checkUnbalanced()', realPeriod=2),
# call the addPlotData function every 200 steps
PyRunner(command='addPlotData()', iterPeriod=100)
]
O.dt = .5 * PWaveTimeStep()

# enable energy tracking; any simulation parts supporting it
# can create and update arbitrary energy types, which can be
# accessed as O.energy['energyName'] subsequently
O.trackEnergy = True


# if the unbalanced forces goes below .05, the packing
# is considered stabilized, therefore we stop collected
# data history and stop
def checkUnbalanced():
if unbalancedForce() < .05:
O.pause()
plot.saveDataTxt('bbb.txt.bz2')
# plot.saveGnuplot('bbb') is also possible


# collect history of data which will be plotted
def addPlotData():
# each item is given a names, by which it can be the unsed in plot.plots
# the **O.energy converts dictionary-like O.energy to plot.addData 
arguments
plot.addData(i=O.iter, unbalanced=unbalancedForce(), **O.energy)


# define how to plot data: 'i' (step number) on the x-axis, unbalanced force
# on the left y-axis, all energies on the right y-axis
# (O.energy.keys is function which will be called to get all defined energies)
# None separates left and right y-axis
plot.plots = {'i': ('unbalanced', None, O.energy.keys)}

# show the plot on the screen, and update while the simulation runs
plot.plot()

O.saveTmp()

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.

___
Mailing list: https://launchpad.net/~yade-users
Post to : yade-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp