Re: [Yade-users] [Question #707088]: Dynamic Compaction Can't Repeat

2023-06-30 Thread Huan
Question #707088 on Yade changed:
https://answers.launchpad.net/yade/+question/707088

Status: Needs information => Solved

Huan confirmed that the question is solved:
Thank Karol,

I resolve my issue.

Resolve of my 
code
import random
import math
from yade import geom, pack, utils, plot, ymport, export
import numpy as np

# Define cylinder parameters
diameter = 0.102
height = 0.18
center = (0, 0, height/2)

# 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)

# add sphere packing
O.bodies.append(ymport.textExt('packing_loose.txt',format='x_y_z_r'))

# materials Properties
gravel = CohFrictMat(young = 1e6, poisson = 0.25, density = 2700, label = 
'gravel')
asphalt_binder = CohFrictMat(young = 3e5, poisson = 0.25, density = 1060, 
frictionAngle = radians(40),  normalCohesion = 1e4, shearCohesion = 1e4, label 
= 'asphalt_binder')
weight = CohFrictMat(young = 1.9e8, poisson = 0.28, density = 
8645,frictionAngle = radians(0), label = 'weight')

# add properties
O.materials.append(gravel)
O.materials.append(asphalt_binder)
O.materials.append(weight)

# give color and properties to shpere
for body in O.bodies:
   if not isinstance(body.shape, Sphere): 
   continue
   if body.shape.radius == 0.01575/2 :
   body.shape.color = (0,0,1) #blue
   body.material = gravel
   if body.shape.radius == 0.011/2:
   body.shape.color = (1,0,0) #red
   body.material = gravel
   if body.shape.radius == 0.007125/2:
   body.shape.color = (0,1,0) #green
   body.material = gravel
   if body.shape.radius == 0.003555/2:
   body.shape.color = (1,1,0) #yellow
   body.material = gravel
   if body.shape.radius == 0.00160/2 :
   body.shape.color = (1,0,1) #magenta
   body.material = gravel
   if body.shape.radius == 0.0008/2 :
   body.shape.color = (0,0,0) #black
   body.material = asphalt_binder


# add clump plate
clump_bodies = ymport.textExt('clump_loose.txt',format='x_y_z_r')

# plate properties
clump_plate = CohFrictMat(young = 1.9e8, poisson = 0.28, density = 7500, label 
= 'clump_plate')

# add properties
O.materials.append(clump_plate)

# define layer
total_clump_bodies = len(clump_bodies)
bodies_per_layer = total_clump_bodies / 8

layer_7_bodies = []

for i, clump_body in enumerate(clump_bodies):
layer_number = i // bodies_per_layer  # Calculate the layer number for the 
clump body

if layer_number % 2 == 0:
color = (1, 0, 0)  # red for even-numbered layers
else:
color = (1, 1, 1)  # white for odd-numbered layers

clump_body.shape.color = color
clump_body.material = clump_plate

# Add clump body to layer 7 list
if layer_number == 7:
layer_7_bodies.append(clump_body)

# Calculate the mean z-coordinate of layer 7
center_top_clump_surface = np.mean([clump_body.state.pos[2] for clump_body in 
layer_7_bodies])

O.bodies.appendClumped(clump_bodies)

# clump center of mass
clump_z = np.mean([clump_body.state.pos[2] for clump_body in clump_bodies])  # 
clump (center of mass) z-coordinate
   
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
]
# set dt to stabilize the force in packing
O.dynDt = False

# function for stabalize
def impaction():

# stabalize the packing
O.dt = PWaveTimeStep()
print("dt=",O.dt)
O.run(2000,True)
print("2000")

# create large ball
idball = O.bodies.append(sphere((0, 0, center_top_clump_surface + 0.05721), 
0.1/2)) 
O.bodies[idball].material = weight
O.bodies[idball].shape.color = (0.5, 0.5, 0.5)
s = 0.445
g = 9.81
v = math.sqrt(2*g*s)
O.bodies[idball].state.vel = (0,0,-v)

# stabilize when ball impact packing
O.run(5000,True)
print("7000")
O.run(5000,True)
print("12000")
O.run(5000,True)
print("17000")

# remove ball after impact
O.bodies.erase(idball)
print("weight removed")

# list to store the bodies to be removed
to_remove = []

# remove asphalt and aggregate that is above clump
for body in O.bodies:
if isinstance(body.shape, Sphere) and (body.material == gravel or 
body.material == asphalt_binder):
if body.state.pos[2] > clump_z:
to_remo

[Yade-users] [Question #707088]: Dynamic Compaction Can't Repeat

2023-06-23 Thread Huan
New question #707088 on Yade:
https://answers.launchpad.net/yade/+question/707088

Hi,

I'm trying to create a simulation that would have large spherical ball drop and 
hit the clump plate repeatedly 100 times. and calculate the average z and mass 
every time. Also, use export.text to get position of the packing every 10th 
time. However, the calculation would calculated every time the large ball drop 
instead of calculating in after it hit the plate.
-This
 is my 
code
import random
import math
from yade import geom, pack, utils, plot, ymport, export
import numpy as np

# Define cylinder parameters
diameter = 0.102
height = 0.18
center = (0, 0, height/2)

# 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)

# add sphere packing
O.bodies.append(ymport.textExt('packing8.txt',format='x_y_z_r'))

# materials Properties
gravel = CohFrictMat(young = 1e7, poisson = 0.25, density = 2700, label = 
'gravel')
asphalt_binder = CohFrictMat(young = 1e7, poisson = 0.25, density = 1060, 
frictionAngle = radians(40),  normalCohesion = 5e4, shearCohesion = 5e4, label 
= 'asphalt_binder')
weight = CohFrictMat(young = 1e7, poisson = 0.25, density = 11450,frictionAngle 
= radians(0), label = 'weight')

# add properties
O.materials.append(gravel)
O.materials.append(asphalt_binder)
O.materials.append(weight)

# give color and properties to shpere
for body in O.bodies:
   if not isinstance(body.shape, Sphere): 
   continue
   if body.shape.radius == 0.01575/2 :
   body.shape.color = (0,0,1) #blue
   body.material = gravel
   if body.shape.radius == 0.011/2:
   body.shape.color = (1,0,0) #red
   body.material = gravel
   if body.shape.radius == 0.007125/2:
   body.shape.color = (0,1,0) #green
   body.material = gravel
   if body.shape.radius == 0.003555/2:
   body.shape.color = (1,1,0) #yellow
   body.material = gravel
   if body.shape.radius == 0.00160/2 :
   body.shape.color = (1,0,1) #magenta
   body.material = gravel
   if body.shape.radius == 0.0008/2 :
   body.shape.color = (0,0,0) #black
   body.material = asphalt_binder

# add clump plate
clump_bodies = ymport.textExt('clump8.txt',format='x_y_z_r')

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

# add properties
O.materials.append(clump_plate)

# define layer
total_clump_bodies = len(clump_bodies)
bodies_per_layer = total_clump_bodies / 8

for i, clump_body in enumerate(clump_bodies):
layer_number = i // bodies_per_layer  # Calculate the layer number for the 
clump body

if layer_number % 2 == 0:
color = (1, 0, 0)  # red for even-numbered layers
else:
color = (1, 1, 1)  # white for odd-numbered layers

clump_body.shape.color = color
clump_body.material = clump_plate

O.bodies.appendClumped(clump_bodies)

# z-coordinate for clump
clump_z = np.mean([clump_body.state.pos[2] for clump_body in clump_bodies])  # 
clump (center of mass) z-coordinate

# create large ball
O.bodies.append(sphere((0, 0, clump_z + 0.25), 0.1/2))

# give color and properties to shpere
for body in O.bodies:
   if not isinstance(body.shape, Sphere): 
   continue
   if body.shape.radius == 0.10/2 :
   body.shape.color = (0.5,0.5,0.5) #grey
   body.material = weight

# define original condition
x = 0
y = 0
window = 0.01575/2

def calculate_zmax(x, y, window):
zmax = float('-inf')  # Initialize zmax to negative infinity

# Define the square region
x_min = x - window
x_max = x + window
y_min = y - window
y_max = y + window

# Iterate over all bodies in the simulation
for body in O.bodies:
if isinstance(body.shape, Sphere) and (body.material == gravel or 
body.material == asphalt_binder or body.material == weight):
sphere_x, sphere_y, sphere_z = body.state.pos  # Get the position 
of the sphere
sphere_radius = body.shape.radius

# Check if the sphere is within the square region
if x_min <= sphere_x <= x_max and y_min <= sphere_y <= y_max:
z = sphere_z + sphere_radius  # Calculate the z-coordinate of 
the top of the sphere

# Update zmax if the current z-coordinate is higher
if z > zmax:
zmax = z 

return zmax

def hundredblows():
# Perform 100 blows of the large ball

for blow_number in range(100):
# Perform the blow
O.run()  # Adjust the number of iterations as needed

# Calculate clump_z
clump_z = np.mean([clump_body.state.pos[2] for clump_body in 
clump_bodies])  # clump (center of mass) z-coordinate

# 

[Yade-users] [Question #706864]: unable to export text

2023-06-01 Thread Huan
New question #706864 on Yade:
https://answers.launchpad.net/yade/+question/706864

Hello,
I'm try to to use the clump as wall to press on the sphere packing. After the 
clump press the packing I want to export the text of sphere position excluding 
the clump sphere, but it doesn't work. My question is that whether if it is 
correct to put the code under def checkunbalancedForce() and why do I get the 
error that said 
>>if body not in idClump:
(argument of type 'int' is not iterable)
-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)
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.025 
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 to move x and y axis by 2mm 
if layer % 2 == 0:
x_offset = 0.002
y_offset = 0.002
color = (1, 1, 1) # white
else:
x_offset = 0
y_offset = 0
color = (0.647, 0.165, 0.165) #brown
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
sphere_obj.shape.color = color
bodyList.append(O.bodies.append(sphere_obj))

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

# add sphere packing
O.bodies.append(ymport.textExt('initialization.txt',format='x_y_z_r'))

# materials Properties
gravel = CohFrictMat(young = 1e7, poisson = 0.25, density = 27000, label = 
'gravel')
asphalt_binder = CohFrictMat(young = 1e7, poisson = 0.25, density = 10600, 
label = 'asphalt_binder')

# add properties
O.materials.append(gravel)
O.materials.append(asphalt_binder)

# give color and properties to shpere
for body in O.bodies:
   if not isinstance(body.shape, Sphere): 
   continue
   if body.shape.radius == 0.01575/2 :
   body.shape.color = (0,0,1) #blue
   body.material = gravel
   if body.shape.radius == 0.011/2:
   body.shape.color = (1,0,0) #red
   body.material = gravel
   if body.shape.radius == 0.007125/2:
   body.shape.color = (0,1,0) #green
   body.material = gravel
   if body.shape.radius == 0.003555/2:
   body.shape.color = (1,1,0) #yellow
   body.material = gravel
   if body.shape.radius == 0.00160/2 :
   body.shape.color = (1,0,1) #magenta
   body.material = gravel
   if body.shape.radius == 0.0008/2 :
   body.shape.color = (0,0,0) #black
   body.material = asphalt_binder
   
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),
]
O.dt = PWaveTimeStep()

# if the unbalanced forces goes below .05, the packing
# is considered stabilized, therefore we stop collected
# data history and stop
def checkUnbalanced():
if unbalancedForce() < 0.05:
for body in O.bodies:
# Exclude the clumped spheres
if body not in idClump:
if isinstance(body.shape, Sphere):
export.txt("1st_flat.txt",format='x_y_z_r')
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   : 

Re: [Yade-users] [Question #706850]: Clumping can't give color to each layer

2023-06-01 Thread Huan
Question #706850 on Yade changed:
https://answers.launchpad.net/yade/+question/706850

Status: Answered => Solved

Huan confirmed that the question is solved:
Thanks but I solve it via using this:
# 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

-- 
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 #706850]: Clumping can't give color to each layer

2023-05-30 Thread Huan
New question #706850 on Yade:
https://answers.launchpad.net/yade/+question/706850

I try to change color for each sphere layer, but it doesn't seems to work. I 
want to give layer that is divisible by 2 to be brown and layer that isn't 
divisible by two as white.
--The method I tried that 
doesn't work---
# Check if the sphere is within the clump limit
if abs(xi) <= clumpLimit and abs(yi) <= clumpLimit and 
math.sqrt(xi**2 + yi**2) <= diameter/2:
# Move spheres in layers 2, 4, 6, and 8 in x and y axes by 2mm
if layer % 2:
xi += 0.002
yi += 0.002
color = (1, 1, 1) # white
else:
color = (0.647, 0.165, 0.165) #brown
sphere_obj = sphere([xi, yi, zi + z_offset], radius_clump)
# Assign material properties to the sphere
sphere_obj.material = clump_plate
# Assign color
sphere_obj.color = color
bodyList.append(O.bodies.append(sphere_obj))
---
 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)
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.1
radius_clump = 0.00221
clumpLimit = (diameter/2)  - 0.005
# layer and offset condition
num_layers = 8
z_offset_increment = 0.00128


for layer in range(num_layers):
z_offset = layer * z_offset_increment # Adjust the z-coordinate based on 
the layer

for xi in range(-50, 51, 4):
xi = xi / 1000
for yi in range(-50, 51, 4):
yi = yi / 1000

# Check if the sphere is within the clump limit
if abs(xi) <= clumpLimit and abs(yi) <= clumpLimit and 
math.sqrt(xi**2 + yi**2) <= diameter/2:
# Move spheres in layers 2, 4, 6, and 8 in x and y axes by 2mm
if layer % 2:
xi += 0.002
yi += 0.002
sphere_obj = sphere([xi, yi, zi + z_offset], radius_clump)
# Assign material properties to the sphere
sphere_obj.material = clump_plate
bodyList.append(O.bodies.append(sphere_obj))

-- 
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 #706838]: Clumping positioning and bursting

2023-05-30 Thread Huan
Question #706838 on Yade changed:
https://answers.launchpad.net/yade/+question/706838

Status: Answered => Solved

Huan confirmed that the question is solved:
My bad I'll open a new question

-- 
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 #706838]: Clumping positioning and bursting

2023-05-30 Thread Huan
New question #706838 on Yade:
https://answers.launchpad.net/yade/+question/706838

I create clumping with total of 8 layers, but for layer 2, 4, 6, and 8 the x 
axis and y axis will be move by 0.002. It would result in rhombohedral shape. 
However, the sphere is suppose to be within the cylinder range and once I press 
start the sphere would directly burst. In addition, I have try to set color but 
it doesn't work.

### Here is 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)
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)

bodyList = []
zi = 0.1
radius = 0.00221
clumpLimit = diameter - 0.005
num_layers = 8
z_offset_increment = 0.00128

for layer in range(num_layers):
z_offset = layer * z_offset_increment # Adjust the z-coordinate based on 
the layer

for xi in range(-50, 51, 4):
xi = xi / 1000
for yi in range(-50, 51, 4):
yi = yi / 1000

# Check if the sphere is within the clump limit
if abs(xi) <= clumpLimit and abs(yi) <= clumpLimit:
# Move spheres in layers 2, 4, 6, and 8 in x and y axes by 2mm
if layer in [2, 4, 6, 8]:
xi += 0.002
yi += 0.002
sphere_obj = sphere([xi, yi, zi + z_offset], radius)
# Assign material properties to the sphere
sphere_obj.material = clump_plate
bodyList.append(O.bodies.append(sphere_obj))

-- 
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 #706797]: I try to pack the sphere in the cylinder by gravity deposition. But it stop when it touches the funnel.

2023-05-26 Thread Huan
Question #706797 on Yade changed:
https://answers.launchpad.net/yade/+question/706797

Status: Answered => Open

Huan is still having a problem:
>What value to print?
Do you mean print unbalancedForce before O.pause()

> But how do I prevent the sphere from stopping when it touches the
funnel or how do I let it complete the simulation for me to get the
position when the sphere is static within the cylinder?

-- 
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 #706797]: I try to pack the sphere in the cylinder by gravity deposition. But it stop when it touches the funnel.

2023-05-26 Thread Huan
Question #706797 on Yade changed:
https://answers.launchpad.net/yade/+question/706797

Huan gave more information on the question:
I did modify the 1st script for lesser sphere to see if the same
reaction happens. Around 60k sphere particles also have the same
reaction once the sphere hit the funnel the simulation automatically.

-- 
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 #706797]: I try to pack the sphere in the cylinder by gravity deposition. But it stop when it touches the funnel.

2023-05-25 Thread Huan
New question #706797 on Yade:
https://answers.launchpad.net/yade/+question/706797

Hello,
I create a sphere packing position in the 1st script. However in second script, 
I import the position from the 1st script. I reduce the sphere value. I am 
confuse on why once the sphere hit the funnel the simulation stop right away.

### 1st script ###
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)
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)

# Define cylinder with funnel parameters
center1 = (0,0,height/2)
dBunker = 0.4
dOutput = 0.102
hBunker = 0
hOutput = 0.15
hPipe = 0

# create funnel as a bunker with diameter 0.102 m, height 0.064 m
funnel = geom.facetBunker(center=center1, dBunker=dBunker, dOutput=dOutput, 
hBunker=hBunker,hOutput=hOutput, hPipe=hPipe, segmentsNumber=80, wallMask=4)

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

def makeRandomBlocks(diameter, gridsize, minz, numblocks):
bunkerLimit = diameter/2
#
# Make grid blocks inside a bunker
#
grid = np.arange(-bunkerLimit, bunkerLimit, gridsize)
inGrid = []
for yi in grid:
for xi in grid:
c = [[xi, yi], [xi+gridsize, yi], [xi+gridsize, yi+gridsize], [xi, 
yi+gridsize]]
#
# Check if the block corners are outside of the bunker or not
#
out = False
for p in c:
r = (p[0]**2 + p[1]**2)**0.5
if r > bunkerLimit:
out = True
#
# If the block is inside the bunker, keep it
#
if not out:
inGrid.append(c)
layer = math.ceil(numblocks / len(inGrid))
blocks = []
for l in range(layer):
for g in inGrid:
zi = minz + l*gridsize
p1 = g[0].copy()
p1.append(zi)
p2 = g[2].copy()
p2.append(zi+gridsize)
blocks.append([p1, p2])
random.shuffle(blocks)
return blocks

minZ = 0.35
dbunker = 0.4
gridSize = dbunker/8
numblocks = 51
blockList = makeRandomBlocks(dbunker, gridSize, minZ, numblocks)

for i in range(numblocks):
print("Making cloud block", i+1, "/", numblocks)
corner = blockList.pop()
sp = pack.SpherePack()

# 15.75 mm 13 particles
if (i < 13): 
n1 = sp.makeCloud(minCorner=corner[0], maxCorner=corner[1], 
rMean=0.01575/2, num=1)
 
# 11 mm 51 particles 
n2 = sp.makeCloud(minCorner=corner[0], maxCorner=corner[1], rMean=0.011/2, 
num=1)
 
# 7.125 mm 51x11 = 561 particles
n3 = sp.makeCloud(minCorner=corner[0], maxCorner=corner[1], 
rMean=0.007125/2, num=11)

# 3.555 mm 51x100 = 5,100 particles 
n4 = sp.makeCloud(minCorner=corner[0], maxCorner=corner[1], 
rMean=0.003555/2, num=100)

# 1.60 mm 51x1400 = 71,400 particles 
n5 = sp.makeCloud(minCorner=corner[0], maxCorner=corner[1], rMean=0.0016/2, 
num=1400)

# 0.8 mm 51x4140 = 211,140 particles 
n6 = sp.makeCloud(minCorner=corner[0], maxCorner=corner[1], rMean=0.0008/2, 
num=4140)

sp.toSimulation()

export.text("testCloud.txt")
##

### 2nd script ###
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)
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)

# Define cylinder with funnel parameters
center1 = (0,0,height/2)
dBunker = 0.4
dOutput = 0.102
hBunker = 0
hOutput = 0.15
hPipe = 0

# create funnel as a bunker with diameter 0.102 m, height 0.064 m
funnel = geom.facetBunker(center=center1, dBunker=dBunker, dOutput=dOutput, 
hBunker=hBunker,hOutput=hOutput, hPipe=hPipe, segmentsNumber=80, wallMask=4)

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

# add sphere packing
O.bodies.append(ymport.textExt('testCloud.txt',format='x_y_z_r'))

# materials Properties
gravel = CohFrictMat(young = 1e7, poisson = 0.25, density = 27000, label = 
'gravel')
asphalt_binder = CohFrictMat(young = 1e7, poisson = 0.25, density = 10600, 
frictionAngle = radians(40),  normalCohesion = 2e5, shearCohesion = 2e5, label 
= 'asphalt_binder')

# add properties
O.materials.append(gravel)
O.materials.append(asphalt_binder)

# give color and properties to shpere
for body in O.bodies:
   if not isinstance(body.shape, Sphere): 
   continue
   if body.shape.radius == 0.01575/2 :
   body.shape.color = (0,0,1) #blue
   body.material = gravel
   if 

Re: [Yade-users] [Question #706790]: Sphere packing location

2023-05-25 Thread Huan
Question #706790 on Yade changed:
https://answers.launchpad.net/yade/+question/706790

Status: Solved => Open

Huan is still having a problem:
Hey,

Jan out of curiosity if the sphere that are generated are so small for
example my asphalt binder is 0.0003 wouldn't it just go through the
funnel and the cylinder for gravity deposition part?

-- 
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 #706790]: Sphere packing location

2023-05-25 Thread Huan
Question #706790 on Yade changed:
https://answers.launchpad.net/yade/+question/706790

Status: Answered => Solved

Huan confirmed that the question is solved:
Thanks Jan,
I was able to modify it by lowering the min z.
I think 5 millions spheres is not relevant, but my prof. want all of it even 
though my pc aren't able 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 #706790]: Sphere packing location

2023-05-25 Thread Huan
New question #706790 on Yade:
https://answers.launchpad.net/yade/+question/706790

Hello,

I create two python script.
1. Sphere Packing Position Saving
2. Importing the sphere packing from 1. to do gravity deposition
>>The Problem I encounter is that I try to move the ( zi = minz + l * gridsize 
>>) lower by dividing it by 8. However, after I import the postion in 2nd 
>>python script the sphere packing burst out which I am confuse on what is 
>>making them burst apart.

### SCRIPT 1 ###
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)
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)

# Define cylinder with funnel parameters
center1 = (0,0,height/2)
dBunker = 0.4
dOutput = 0.102
hBunker = 0
hOutput = 0.15
hPipe = 0

# create funnel as a bunker with diameter 0.102 m, height 0.064 m
funnel = geom.facetBunker(center=center1, dBunker=dBunker, dOutput=dOutput, 
hBunker=hBunker,hOutput=hOutput, hPipe=hPipe, segmentsNumber=80, wallMask=4)

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

def makeRandomBlocks(diameter, gridsize, minz, numblocks):
bunkerLimit = diameter/2
#
# Make grid blocks inside a bunker
#
grid = np.arange(-bunkerLimit, bunkerLimit, gridsize)
inGrid = []
for yi in grid:
for xi in grid:
c = [[xi, yi], [xi+gridsize, yi], [xi+gridsize, yi+gridsize], [xi, 
yi+gridsize]]
#
# Check if the block corners are outside of the bunker or not
#
out = False
for p in c:
r = (p[0]**2 + p[1]**2)**0.5
if r > bunkerLimit:
out = True
#
# If the block is inside the bunker, keep it
#
if not out:
inGrid.append(c)
layer = math.ceil(numblocks / len(inGrid))
blocks = []
for l in range(layer):
for g in inGrid:
zi = minz + l*gridsize
p1 = g[0].copy()
p1.append(zi)
p2 = g[2].copy()
p2.append(zi+gridsize)
blocks.append([p1, p2])
random.shuffle(blocks)
return blocks

minZ = 2.35
dbunker = 0.4
gridSize = dbunker/8
numblocks = 51
blockList = makeRandomBlocks(dbunker, gridSize, minZ, numblocks)

for i in range(numblocks):
print("Making cloud block", i+1, "/", numblocks)
corner = blockList.pop()
sp = pack.SpherePack()

# 15.75 mm 13 particles
if (i < 13): 
n1 = sp.makeCloud(minCorner=corner[0], maxCorner=corner[1], 
rMean=0.01575/2, num=1)
 
# 11 mm 51 particles 
n2 = sp.makeCloud(minCorner=corner[0], maxCorner=corner[1], rMean=0.011/2, 
num=1)
 
# 7.125 mm 51x11 = 561 particles
n3 = sp.makeCloud(minCorner=corner[0], maxCorner=corner[1], 
rMean=0.007125/2, num=11)

# 3.555 mm 51x100 = 5,100 particles 
n4 = sp.makeCloud(minCorner=corner[0], maxCorner=corner[1], 
rMean=0.003555/2, num=100)

# 1.77 mm 51x360 = 18,360 particles 
n5 = sp.makeCloud(minCorner=corner[0], maxCorner=corner[1], 
rMean=0.00177/2, num=360)

# 0.6 mm 51x19000 = 969,000 particles 
n6 = sp.makeCloud(minCorner=corner[0], maxCorner=corner[1], rMean=0.0006/2, 
num=19000)

# 0.3 mm 51x78510 = 4,004,010 particles 
n7 = sp.makeCloud(minCorner=corner[0], maxCorner=corner[1], rMean=0.0003/2, 
num=78510)

sp.toSimulation()

export.text("testCloud.txt")


### Script 2 ###
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)
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)

# Define cylinder with funnel parameters
center1 = (0,0,height/2)
dBunker = 0.4
dOutput = 0.102
hBunker = 0
hOutput = 0.15
hPipe = 0

# create funnel as a bunker with diameter 0.102 m, height 0.064 m
funnel = geom.facetBunker(center=center1, dBunker=dBunker, dOutput=dOutput, 
hBunker=hBunker,hOutput=hOutput, hPipe=hPipe, segmentsNumber=80, wallMask=4)

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

# add sphere packing
O.bodies.append(ymport.textExt('testCloud.txt',format='x_y_z_r'))

# materials Properties
gravel = CohFrictMat(young = 1e7, poisson = 0.25, density = 2700, label = 
'gravel')
asphalt_binder = CohFrictMat(young = 1e7, poisson = 0.25, density = 1060, 
frictionAngle = radians(40),  normalCohesion = 2e5, shearCohesion = 2e5, label 
= 'asphalt_binder')

# add properties

Re: [Yade-users] [Question #706786]: Can I add properties and color into export text file?

2023-05-25 Thread Huan
Question #706786 on Yade changed:
https://answers.launchpad.net/yade/+question/706786

Status: Open => Solved

Huan confirmed that the question is solved:
Nevermind I ended up only save the position of the sphere. Then, in the
second python file I import the position and give it properties in the
second file.

-- 
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 #706786]: Can I add properties and color into export text file?

2023-05-25 Thread Huan
Question #706786 on Yade changed:
https://answers.launchpad.net/yade/+question/706786

Description changed to:
Hi,
I am trying to save the position, properties, and color. Can I export it into 
one text file for future importing uses for example I will import the spherer 
packing from text when I implement gravity deposition?

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

# Materials Properties
gravel = CohFrictMat(young = 1e7, poisson = 0.25, density = 2700, label = 
'gravel')
asphalt_binder = CohFrictMat(young = 1e7, poisson = 0.25, density = 1060, 
frictionAngle = radians(40),  normalCohesion = 2e5, shearCohesion = 2e5, label 
= 'asphalt_binder')

# add properties
O.materials.append(gravel)
O.materials.append(asphalt_binder)

# Define cylinder with funnel parameters
center = (0, 0, 0)
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)

# Define cylinder with funnel parameters
center1 = (0,0,height/2)
dBunker = 0.4
dOutput = 0.102
hBunker = 0
hOutput = 0.15
hPipe = 0

# create funnel as a bunker with diameter 0.102 m, height 0.064 m
funnel = geom.facetBunker(center=center1, dBunker=dBunker, dOutput=dOutput, 
hBunker=hBunker,hOutput=hOutput, hPipe=hPipe, segmentsNumber=80, wallMask=4)

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

def makeRandomBlocks(diameter, gridsize, minz, numblocks):
bunkerLimit = diameter/2
#
# Make grid blocks inside a bunker
#
grid = np.arange(-bunkerLimit, bunkerLimit, gridsize)
inGrid = []
for yi in grid:
for xi in grid:
c = [[xi, yi], [xi+gridsize, yi], [xi+gridsize, yi+gridsize], [xi, 
yi+gridsize]]
#
# Check if the block corners are outside of the bunker or not
#
out = False
for p in c:
r = (p[0]**2 + p[1]**2)**0.5
if r > bunkerLimit:
out = True
#
# If the block is inside the bunker, keep it
#
if not out:
inGrid.append(c)
layer = math.ceil(numblocks / len(inGrid))
blocks = []
for l in range(layer):
for g in inGrid:
zi = minz + l*gridsize
p1 = g[0].copy()
p1.append(zi)
p2 = g[2].copy()
p2.append(zi+gridsize)
blocks.append([p1, p2])
random.shuffle(blocks)
return blocks

minZ = 2.35
dbunker = 0.4
gridSize = dbunker/8
numblocks = 51
blockList = makeRandomBlocks(dbunker, gridSize, minZ, numblocks)

for i in range(numblocks):
print("Making cloud block", i+1, "/", numblocks)
corner = blockList.pop()
sp = pack.SpherePack()

# 15.75 mm 13 particles
if (i < 13): 
n1 = sp.makeCloud(minCorner=corner[0], maxCorner=corner[1], 
rMean=0.01575/2, num=1)
 
# 11 mm 51 particles 
n2 = sp.makeCloud(minCorner=corner[0], maxCorner=corner[1], rMean=0.011/2, 
num=1)
 
# 7.125 mm 51x11 = 561 particles
n3 = sp.makeCloud(minCorner=corner[0], maxCorner=corner[1], 
rMean=0.007125/2, num=11)

# 3.555 mm 51x100 = 5,100 particles 
n4 = sp.makeCloud(minCorner=corner[0], maxCorner=corner[1], 
rMean=0.003555/2, num=100)

# 1.77 mm 51x360 = 18,360 particles 
n5 = sp.makeCloud(minCorner=corner[0], maxCorner=corner[1], 
rMean=0.00177/2, num=360)

# 0.6 mm 51x19000 = 969,000 particles 
n6 = sp.makeCloud(minCorner=corner[0], maxCorner=corner[1], rMean=0.0006/2, 
num=300)

# 0.3 mm 51x78510 = 4,004,010 particles 
n7 = sp.makeCloud(minCorner=corner[0], maxCorner=corner[1], rMean=0.0003/2, 
num=400)

sp.toSimulation()

for body in O.bodies:
   if not isinstance(body.shape, Sphere): 
   continue
   if body.shape.radius == 0.01575/2 :
   body.shape.color = (0,0,1) #blue
   if body.shape.radius == 0.011/2:
   body.shape.color = (1,0,0) #red
   if body.shape.radius == 0.007125/2:
   body.shape.color = (0,1,0) #green
   if body.shape.radius == 0.003555/2:
   body.shape.color = (1,1,0) #yellow
   if body.shape.radius == 0.00177/2 :
   body.shape.color = (1,0,1) #magenta
   if body.shape.radius == 0.0006/2 :
   body.shape.color = (1,1,1) #magenta
   if body.shape.radius == 0.0003/2 :
   body.shape.color = (0,0,0) #black

# give properties to sphere
for i in range(n1,n6):
O.bodies[i].mat = gravel
for i in range(n6, n7):
O.bodies[i].mat = asphalt_binder

# Save body IDs and materials to a text file
with open("body_properties.txt", "w") as file:
for b in O.bodies:
file.write(f"{b.id} {b.mat}\n")

export.text("testCloud.txt")

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

___
Mailing 

[Yade-users] [Question #706786]: Can I add properties and color into export text file?

2023-05-24 Thread Huan
New question #706786 on Yade:
https://answers.launchpad.net/yade/+question/706786

Hi,
I am trying to save the position, properties, and color(haven't made yet not 
sure how to). Can I export it into one text file for future importing uses for 
example I will import the text when I implement gravity deposition?

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

# Materials Properties
gravel = CohFrictMat(young = 1e7, poisson = 0.25, density = 2700, label = 
'gravel')
asphalt_binder = CohFrictMat(young = 1e7, poisson = 0.25, density = 1060, 
normalCohesion = 2e5, shearCohesion = 2e5, label = 'asphalt_binder')

# add properties
O.materials.append(gravel)
O.materials.append(asphalt_binder)

# Define cylinder with funnel parameters
center = (0, 0, 0)
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)

# Define cylinder with funnel parameters
center1 = (0,0,height/2)
dBunker = 0.4
dOutput = 0.102
hBunker = 0
hOutput = 0.15
hPipe = 0

# create funnel as a bunker with diameter 0.102 m, height 0.064 m
funnel = geom.facetBunker(center=center1, dBunker=dBunker, dOutput=dOutput, 
hBunker=hBunker,hOutput=hOutput, hPipe=hPipe, segmentsNumber=80, wallMask=4)

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

def makeRandomBlocks(diameter, gridsize, minz, numblocks):
bunkerLimit = diameter/2
#
# Make grid blocks inside a bunker
#
grid = np.arange(-bunkerLimit, bunkerLimit, gridsize)
inGrid = []
for yi in grid:
for xi in grid:
c = [[xi, yi], [xi+gridsize, yi], [xi+gridsize, yi+gridsize], [xi, 
yi+gridsize]]
#
# Check if the block corners are outside of the bunker or not
#
out = False
for p in c:
r = (p[0]**2 + p[1]**2)**0.5
if r > bunkerLimit:
out = True
#
# If the block is inside the bunker, keep it
#
if not out:
inGrid.append(c)
layer = math.ceil(numblocks / len(inGrid))
blocks = []
for l in range(layer):
for g in inGrid:
zi = minz + l*gridsize
p1 = g[0].copy()
p1.append(zi)
p2 = g[2].copy()
p2.append(zi+gridsize)
blocks.append([p1, p2])
random.shuffle(blocks)
return blocks

minZ = 2.35
dbunker = 0.4
gridSize = dbunker/8
numblocks = 51
blockList = makeRandomBlocks(dbunker, gridSize, minZ, numblocks)

for i in range(numblocks):
print("Making cloud block", i+1, "/", numblocks)
corner = blockList.pop()
sp = pack.SpherePack()

# 15.75 mm 13 particles
if (i < 13): 
n1 = sp.makeCloud(minCorner=corner[0], maxCorner=corner[1], 
rMean=0.01575/2, num=1)
 
# 11 mm 51 particles 
n2 = sp.makeCloud(minCorner=corner[0], maxCorner=corner[1], rMean=0.011/2, 
num=1)
 
# 7.125 mm 51x11 = 561 particles
n3 = sp.makeCloud(minCorner=corner[0], maxCorner=corner[1], 
rMean=0.007125/2, num=11)

# 3.555 mm 51x100 = 5,100 particles 
n4 = sp.makeCloud(minCorner=corner[0], maxCorner=corner[1], 
rMean=0.003555/2, num=100)

# 1.77 mm 51x360 = 18,360 particles 
n5 = sp.makeCloud(minCorner=corner[0], maxCorner=corner[1], 
rMean=0.00177/2, num=360)

# 0.6 mm 51x19000 = 969,000 particles 
n6 = sp.makeCloud(minCorner=corner[0], maxCorner=corner[1], rMean=0.0006/2, 
num=19000)

# 0.3 mm 51x78510 = 4,004,010 particles 
n7 = sp.makeCloud(minCorner=corner[0], maxCorner=corner[1], rMean=0.0003/2, 
num=78510)

sp.toSimulation()

# give properties to sphere
for i in range(n1,n6):
O.bodies[i].mat = gravel
for i in range(n6, n7):
O.bodies[i].mat = asphalt_binder

# Save body IDs and materials to a text file
with open("body_properties.txt", "w") as file:
for b in O.bodies:
file.write(f"{b.id} {b.mat}\n")

export.text("testCloud.txt")

-- 
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 #706765]: Batch file question

2023-05-23 Thread Huan
Question #706765 on Yade changed:
https://answers.launchpad.net/yade/+question/706765

Status: Answered => Open

Huan is still having a problem:
Ah the slash was the problem. So, I modify the table to:

### oedometric.table
rMean rRelFuzz num maxLoad minLoad
0.007875 0.2063 13 1e3 1e2
0.0055 0.1364 51 1e3 1e2
0.0035625 0. 563 1e3 1e2
0.0017775 0.3361 5101 1e3 1e2
0.85 0. 18369 1e3 1e2
0.295 0 950584 1e3 1e2
0.075 0 4003898 1e3 1e2
###

the log files are built correctly, but I get this error in the log files:
>readParamsFromTable(rMean=rMean, rRelFuzz=rRelFuzz,num=num, maxLoad=1e3, 
>minLoad=1e2)
>NameError: name 'rMean' is not defined

I did a typo and I did fix the spacing part

If I understand correctly, I assume that since I print the value in the
stopUnloading part if it run properly it would print the porosity into
the log files

-- 
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 #706765]: Batch file question

2023-05-23 Thread Huan
Question #706765 on Yade changed:
https://answers.launchpad.net/yade/+question/706765

Status: Answered => Open

Huan is still having a problem:
Hi,

I tried your example and it created 4 log file.

But I try to do mine by creating a oedometric.table with the following:
### oedometric.table
rMean rRelFuzz Num maxLoad
(0.0125+0.019)/4 (0.019-0.0125)/4/(0.0125+0.019)/4 13 1e3
(0.0095+0.0125)/4 (0.0125-0.0095)/4/(0.0095+0.0125)/4 51 1e3
(0.00475+0.0095)/4 (0.0095-0.00475)/4/(0.00475+0.0095)/4 563 1e3
(0.00236+0.00475)/4 (0.00475-0.00236)/4/(0.00236+0.00475)/4 5101 1e3
(0.00118+0.00236)/4 (0.00236-0.00118)/4/(0.00118+0.00236)/4 18369 1e3
0.00118/4 0 950584 1e3
0.0003/4 0 40038981e3
###

for the following code name cm2b.py:
import random
import math
from yade import geom, pack, utils, plot, ymport

# load parameters from file if run in batch
# default values are used if not run from batch
readParamsFromTable(rMean=rMean, rRelFuzz=rRelFuzz,num=Num maxLoad=1e3, 
minLoad=1e2)
# make rMean, rRelFuzz, maxLoad accessible directly as variables later
from yade.params.table import *
print(rMean, rRelFuzz, Num, maxLoad)

# Define material properties
youngModulus = 1e7
poissonRatio = 0.25
density = 2700
frictionAngle =0.7

# Create material
material = O.materials.append(FrictMat(young=youngModulus, 
poisson=poissonRatio, density=density))
material1 = O.materials.append(FrictMat(young=youngModulus, 
poisson=poissonRatio, density=density, frictionAngle=frictionAngle))

# Define cylinder with funnel parameters
center = (0, 0, 0)
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)

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

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

# Define cylinder with funnel parameters
center1 = (0,0,height/2)
dBunker = 0.4
dOutput = 0.102
hBunker = 0
hOutput = 0.15
hPipe = 0

# create funnel as a bunker with diameter 0.102 m, height 0.064 m
funnel = geom.facetBunker(center=center1, dBunker=dBunker, dOutput=dOutput, 
hBunker=hBunker,hOutput=hOutput, hPipe=hPipe, segmentsNumber=80, wallMask=4)

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

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

#create empty sphere packing
sp = pack.SpherePack()

# generate randomly sphere
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean, rRelFuzz = rRelFuzz, num = num)

# add the sphere pack to the simulation
sp.toSimulation(material = material1)

O.engines = [
ForceResetter(),
# sphere, facet, wall
InsertionSortCollider([Bo1_Sphere_Aabb(), Bo1_Facet_Aabb(), 
Bo1_Wall_Aabb()]),
InteractionLoop(
# the loading plate is a wall, we need to handle sphere+sphere, 
sphere+facet, sphere+wall
[Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom(), 
Ig2_Wall_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()]
),
NewtonIntegrator(gravity=(0, 0, -1000), damping=0.3),
# the label creates an automatic variable referring to this engine
# we use it below to change its attributes from the functions called
PyRunner(command='checkUnbalanced()', realPeriod=2, label='checker'),
]
O.dt = PWaveTimeStep()

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

# the following checkUnbalanced, unloadPlate and stopUnloading functions are 
all called by the 'checker'
# (the last engine) one after another; this sequence defines progression of 
different stages of the
# simulation, as each of the functions, when the condition is satisfied, 
updates 'checker' to call
# the next function when it is run from within the simulation next time
# check whether the gravity deposition has already finished
# if so, add wall on the top of the packing and start the oedometric test
def checkUnbalanced():
# at the very start, unbalanced force can be low as there is only few 
contacts, but it does not mean the packing is stable
if O.iter < 25000:
return
# add plate at the position on the top of the packing
# the maximum finds the z-coordinate of the top of the topmost particle
O.bodies.append(wall(max([b.state.pos[2] + b.shape.radius for b in 
O.bodies if isinstance(b.shape, Sphere)]), axis=2, sense=-1))
global plate  # without this line, the plate variable would only exist 
inside this function
plate = O.bodies[-1]  # the last particles is the plate
# Wall objects are "fixed" by default, i.e. not subject to forces
 

[Yade-users] [Question #706765]: Batch file question

2023-05-23 Thread Huan
New question #706765 on Yade:
https://answers.launchpad.net/yade/+question/706765

Hello,

Since my particles is almost 5 million, so my professor suggest that I use 
batch file to run it. But, when I read the file of Setting up a simulation from 
this "https://yade-dem.org/doc/tutorial-geo.html?highlight=batch.; I'm couldn't 
understand what exactly is readParamsFromTable(damping =.2) and where should I 
create it.

##This is my code##
import random
import math
from yade import geom, pack, utils, plot, ymport

# Define material properties
youngModulus = 1e7
poissonRatio = 0.25
density = 2700
frictionAngle =0.7

# Create material
material = O.materials.append(FrictMat(young=youngModulus, 
poisson=poissonRatio, density=density))
material1 = O.materials.append(FrictMat(young=youngModulus, 
poisson=poissonRatio, density=density, frictionAngle=frictionAngle))

# Define cylinder with funnel parameters
center = (0, 0, 0)
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)

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

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

# Define cylinder with funnel parameters
center1 = (0,0,height/2)
dBunker = 0.4
dOutput = 0.102
hBunker = 0
hOutput = 0.15
hPipe = 0

# create funnel as a bunker with diameter 0.102 m, height 0.064 m
funnel = geom.facetBunker(center=center1, dBunker=dBunker, dOutput=dOutput, 
hBunker=hBunker,hOutput=hOutput, hPipe=hPipe, segmentsNumber=80, wallMask=4)

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

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

# define sphere parameters and number of spheres
rMean1 = (0.0125+0.019)/4
rRelFuzz1 = (0.019-0.0125)/4/rMean1
num1 = 13
rMean2 = (0.0095+0.0125)/4
rRelFuzz2 = (0.0125-0.0095)/4/rMean2
num2 = 51
rMean3 = (0.00475+0.0095)/4
rRelFuzz3 = (0.0095-0.00475)/4/rMean3
num3 = 563
rMean4 = (0.00236+0.00475)/4
rRelFuzz4 = (0.00475-0.00236)/4/rMean4
num4 = 5101
rMean5 = (0.00118+0.00236)/4
rRelFuzz5 = (0.00236-0.00118)/4/rMean4
num5 = 18369
rMean6 = 0.00118/4
num6 = 950584
rMean7 = 0.0003/4
num7 = 4003898

#create empty sphere packing
sp = pack.SpherePack()

# generate randomly sphere
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean1, rRelFuzz = rRelFuzz1, num = num1)
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean2, rRelFuzz = rRelFuzz2, num = num2)
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean3, rRelFuzz = rRelFuzz3, num = num3)
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean4, rRelFuzz = rRelFuzz4, num = num4)
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean5, rRelFuzz = rRelFuzz5, num = num5)
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean6, num = num6)
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean7, num = num7)

# add the sphere pack to the simulation
sp.toSimulation(material = material1)

for body in O.bodies:
   if not isinstance(body.shape, Sphere): 
   continue
   if body.shape.radius >= rMean1 :
   body.shape.color = (0,0,1) #blue
   if body.shape.radius <= rMean1 and  body.shape.radius > rMean2:
   body.shape.color = (0,0,1) #blue
   if body.shape.radius <= rMean2 and  body.shape.radius > rMean3:
   body.shape.color = (1,0,0) #red
   if body.shape.radius <= rMean3 and  body.shape.radius > rMean4:
   body.shape.color = (0,1,0) #green
   if body.shape.radius <= rMean4 and  body.shape.radius > rMean5:
   body.shape.color = (1,1,0) #yellow
   if body.shape.radius <= rMean5 :
   body.shape.color = (1,0,1) #magenta
   if body.shape.radius <= rMean6 :
   body.shape.color = (1,1,1) #white
   if body.shape.radius <= rMean7 :
   body.shape.color = (0,0,0) #black

O.engines = [
ForceResetter(),
# sphere, facet, wall
InsertionSortCollider([Bo1_Sphere_Aabb(), Bo1_Facet_Aabb(), 
Bo1_Wall_Aabb()]),
InteractionLoop(
# the loading plate is a wall, we need to handle sphere+sphere, 
sphere+facet, sphere+wall
[Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom(), 
Ig2_Wall_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()]
),
NewtonIntegrator(gravity=(0, 0, -1000), damping=0.3),
# the label creates an automatic variable referring to this engine
# we use it below to change its attributes from the functions called
PyRunner(command='checkUnbalanced()', realPeriod=2, label='checker'),
]
O.dt = PWaveTimeStep()

# enable energy 

[Yade-users] [Question #706764]: How to set up cohesion

2023-05-23 Thread Huan
New question #706764 on Yade:
https://answers.launchpad.net/yade/+question/706764

Hello,

I want to set up cohesion value for rMean7 which is my asphalt binder with 
value of 0.2MPa. I found out that I have to use this 
"Ip2_CohFrictMat_CohFrictMat_CohFrictPhys," but I'm confuse if I can set up 
cohesion value for only rMean7 to have cohesion.

##Here is my code##

import random
import math
from yade import geom, pack, utils, plot, ymport

# Define material properties
youngModulus = 1e7
poissonRatio = 0.25
density = 2700
frictionAngle =0.7

# Create material
material = O.materials.append(FrictMat(young=youngModulus, 
poisson=poissonRatio, density=density))
material1 = O.materials.append(FrictMat(young=youngModulus, 
poisson=poissonRatio, density=density, frictionAngle=frictionAngle))

# Define cylinder with funnel parameters
center = (0, 0, 0)
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)

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

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

# Define cylinder with funnel parameters
center1 = (0,0,height/2)
dBunker = 0.4
dOutput = 0.102
hBunker = 0
hOutput = 0.15
hPipe = 0

# create funnel as a bunker with diameter 0.102 m, height 0.064 m
funnel = geom.facetBunker(center=center1, dBunker=dBunker, dOutput=dOutput, 
hBunker=hBunker,hOutput=hOutput, hPipe=hPipe, segmentsNumber=80, wallMask=4)

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

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

# define sphere parameters and number of spheres
rMean1 = (0.0125+0.019)/4
rRelFuzz1 = (0.019-0.0125)/4/rMean1
num1 = 13
rMean2 = (0.0095+0.0125)/4
rRelFuzz2 = (0.0125-0.0095)/4/rMean2
num2 = 51
rMean3 = (0.00475+0.0095)/4
rRelFuzz3 = (0.0095-0.00475)/4/rMean3
num3 = 563
rMean4 = (0.00236+0.00475)/4
rRelFuzz4 = (0.00475-0.00236)/4/rMean4
num4 = 5101
rMean5 = (0.00118+0.00236)/4
rRelFuzz5 = (0.00236-0.00118)/4/rMean4
num5 = 18369
rMean6 = 0.00118/4
num6 = 950584
rMean7 = 0.0003/4
num7 = 4003898

#create empty sphere packing
sp = pack.SpherePack()

# generate randomly sphere
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean1, rRelFuzz = rRelFuzz1, num = num1)
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean2, rRelFuzz = rRelFuzz2, num = num2)
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean3, rRelFuzz = rRelFuzz3, num = num3)
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean4, rRelFuzz = rRelFuzz4, num = num4)
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean5, rRelFuzz = rRelFuzz5, num = num5)
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean6, num = num6)
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean7, num = num7)

# add the sphere pack to the simulation
sp.toSimulation(material = material1)

for body in O.bodies:
   if not isinstance(body.shape, Sphere): 
   continue
   if body.shape.radius >= rMean1 :
   body.shape.color = (0,0,1) #blue
   if body.shape.radius <= rMean1 and  body.shape.radius > rMean2:
   body.shape.color = (0,0,1) #blue
   if body.shape.radius <= rMean2 and  body.shape.radius > rMean3:
   body.shape.color = (1,0,0) #red
   if body.shape.radius <= rMean3 and  body.shape.radius > rMean4:
   body.shape.color = (0,1,0) #green
   if body.shape.radius <= rMean4 and  body.shape.radius > rMean5:
   body.shape.color = (1,1,0) #yellow
   if body.shape.radius <= rMean5 :
   body.shape.color = (1,0,1) #magenta
   if body.shape.radius <= rMean6 :
   body.shape.color = (1,1,1) #white
   if body.shape.radius <= rMean7 :
   body.shape.color = (0,0,0) #black

O.engines = [
ForceResetter(),
# sphere, facet, wall
InsertionSortCollider([Bo1_Sphere_Aabb(), Bo1_Facet_Aabb(), 
Bo1_Wall_Aabb()]),
InteractionLoop(
# the loading plate is a wall, we need to handle sphere+sphere, 
sphere+facet, sphere+wall
[Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom(), 
Ig2_Wall_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()]
),
NewtonIntegrator(gravity=(0, 0, -1000), damping=0.3),
# the label creates an automatic variable referring to this engine
# we use it below to change its attributes from the functions called
PyRunner(command='checkUnbalanced()', realPeriod=2, label='checker'),
]
O.dt = PWaveTimeStep()

# enable energy tracking; any simulation parts supporting it
# can create and update 

Re: [Yade-users] [Question #706748]: Calculation in Marshall Mix Design

2023-05-22 Thread Huan
Question #706748 on Yade changed:
https://answers.launchpad.net/yade/+question/706748

Status: Needs information => Open

Huan gave more information on the question:
Hello,

I mistakenly took both sphere and air as bulk, but bulk is only sphere.

-By the same thing, I meant Bulk Volume, Bulk Density, VMA, and % air
void. Do I add the calculation code in the CheckUnblanced within the
O.iter?

-Bulk Volume is only the sphere I believe that the formula should have been 
(Total weight of sphere / Volume of Sphere)
-Bulk Density should have been (Total weight of sphere / Bulk Volume)
Which I assume that I should should do it by hand since I have the value of 
Total weight of sphere as (1200g)

-VMA is Void in the Mineral Aggregate
-So, % air void should've been (new_bulk_volume / volume_packing)

-- 
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 #706748]: Calculation in Marshall Mix Design

2023-05-22 Thread Huan
Question #706748 on Yade changed:
https://answers.launchpad.net/yade/+question/706748

Status: Needs information => Open

Huan gave more information on the question:
Hello Jan,

- Bulk mean both Sphere and Air
- Thanks for the idea, I will implement it since its easier to read
- I want to calculate the same thing but when it is still loose pack(before 
being compress), can I just put the same calculation method into unload plate 
section?

Thanks

-- 
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 #706748]: Calculation in Marshall Mix Design

2023-05-22 Thread Huan
New question #706748 on Yade:
https://answers.launchpad.net/yade/+question/706748

Hello,
I'm trying to calculate some data from my YADE Marshall Mix Design. I want to 
get value such as Bulk Volume, Bulk Density, VMA, % Air Void. But the result 
that I get seem to be negative and incorrect. So, I am confuse on my 
calculation part whether I set something wrong or my formula is inccorect?

##The Following is my Code##
import random
import math
from yade import geom, pack, utils, plot, ymport
import pandas as pd

# Define material properties
youngModulus = 1e7
poissonRatio = 0.25
density = 2700
frictionAngle =0.7

# Create material
material = O.materials.append(FrictMat(young=youngModulus, 
poisson=poissonRatio, density=density))
material1 = O.materials.append(FrictMat(young=youngModulus, 
poisson=poissonRatio, density=density, frictionAngle=frictionAngle))

# Define cylinder with funnel parameters
center = (0, 0, 0)
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)

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

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

# Define cylinder with funnel parameters
center1 = (0,0,height/2)
dBunker = 0.4
dOutput = 0.102
hBunker = 0
hOutput = 0.15
hPipe = 0

# create funnel as a bunker with diameter 0.102 m, height 0.064 m
funnel = geom.facetBunker(center=center1, dBunker=dBunker, dOutput=dOutput, 
hBunker=hBunker,hOutput=hOutput, hPipe=hPipe, segmentsNumber=80, wallMask=4)

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

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

# define sphere parameters and number of spheres
rMean1 = (0.0125+0.019)/4
rRelFuzz1 = (0.019-0.0125)/4/rMean1
num1 = 13
rMean2 = (0.0095+0.0125)/4
rRelFuzz2 = (0.0125-0.0095)/4/rMean2
num2 = 51
rMean3 = (0.00475+0.0095)/4
rRelFuzz3 = (0.0095-0.00475)/4/rMean3
num3 = 563
rMean4 = (0.00236+0.00475)/4
rRelFuzz4 = (0.00475-0.00236)/4/rMean4
num4 = 5101
rMean5 = (0.00118+0.00236)/4
rRelFuzz5 = (0.00236-0.00118)/4/rMean4
num5 = 18369

#create empty sphere packing
sp = pack.SpherePack()

# generate randomly sphere
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean1, rRelFuzz = rRelFuzz1, num = num1)
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean2, rRelFuzz = rRelFuzz2, num = num2)
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean3, rRelFuzz = rRelFuzz3, num = num3)
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean4, rRelFuzz = rRelFuzz4, num = num4)
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean5, rRelFuzz = rRelFuzz5, num = num5)

# add the sphere pack to the simulation
sp.toSimulation(material = material1)

for body in O.bodies:
   if not isinstance(body.shape, Sphere): 
   continue
   if body.shape.radius >= rMean1 :
   body.shape.color = (0,0,1) #blue
   if body.shape.radius <= rMean1 and  body.shape.radius > rMean2:
   body.shape.color = (0,0,1) #blue
   if body.shape.radius <= rMean2 and  body.shape.radius > rMean3:
   body.shape.color = (1,0,0) #red
   if body.shape.radius <= rMean3 and  body.shape.radius > rMean4:
   body.shape.color = (0,1,0) #green
   if body.shape.radius <= rMean4 and  body.shape.radius > rMean5:
   body.shape.color = (1,1,0) #yellow
   if body.shape.radius <= rMean5 :
   body.shape.color = (1,0,1) #magenta

O.engines = [
ForceResetter(),
# sphere, facet, wall
InsertionSortCollider([Bo1_Sphere_Aabb(), Bo1_Facet_Aabb(), 
Bo1_Wall_Aabb()]),
InteractionLoop(
# the loading plate is a wall, we need to handle sphere+sphere, 
sphere+facet, sphere+wall
[Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom(), 
Ig2_Wall_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()]
),
NewtonIntegrator(gravity=(0, 0, -1000), damping=0.3),
# the label creates an automatic variable referring to this engine
# we use it below to change its attributes from the functions called
PyRunner(command='checkUnbalanced()', realPeriod=2, label='checker'),
]
O.dt = 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

# the following checkUnbalanced, unloadPlate and stopUnloading functions are 
all called by the 'checker'
# (the last engine) one after another; this sequence defines progression of 
different stages of the
# simulation, as each of the functions, when the 

Re: [Yade-users] [Question #706693]: Is it possible to transform sphere to polyhedron particles?

2023-05-18 Thread Huan
Question #706693 on Yade changed:
https://answers.launchpad.net/yade/+question/706693

Status: Answered => Open

Huan is still having a problem:
Hello,

I tried understand both method potentialparticles and
polyhedra_utils.polyhedra, but it quite complicated for me. I meeting my
project deadline soon, if it not too troublesome can you show me method
to transform the sphere by using my code?

Thanks
Huan

-- 
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 #706693]: Is it possible to transform sphere to polyhedron particles?

2023-05-17 Thread Huan
New question #706693 on Yade:
https://answers.launchpad.net/yade/+question/706693

Hi,
I am try to modify my marshall mix design code that involves gravity deposition 
and oedometric test from using spheres to polyhedral shape materials. I 
couldn't find out anything about polyhedral, so I want to know if it is 
possible to change spheres for every sieve size to be polyhedron with different 
shape and size for each radius group. For example, I want to create polyhedron 
in radius1 as for x,y,z range from x(max, min)=(0.0347,0.0314), y(max, 
min)=(0.0202,0.0159), and z(max, min)=(0.01655,0.0139) and polyhedron faces 
range from 5-11. Is it possible?

##The following are my code that I'm currently working with##
import random
import math
from yade import geom, pack, utils, plot, ymport
import pandas as pd

# Define material properties
youngModulus = 1e7
poissonRatio = 0.25
density = 2000

# Create material
material = O.materials.append(FrictMat(young=youngModulus, 
poisson=poissonRatio, density=density))

# Define cylinder with funnel parameters
center = (0, 0, 0)
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)

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

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

# Define cylinder with funnel parameters
center1 = (0,0,height/2)
dBunker = 0.4
dOutput = 0.102
hBunker = 0
hOutput = 0.15
hPipe = 0

# create funnel as a bunker with diameter 0.102 m, height 0.064 m
funnel = geom.facetBunker(center=center1, dBunker=dBunker, dOutput=dOutput, 
hBunker=hBunker,hOutput=hOutput, hPipe=hPipe, segmentsNumber=80, wallMask=4)

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

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

# define sphere parameters and number of spheres
rMean1 = (0.0125+0.019)/4
rRelFuzz1 = (0.019-0.0125)/4/rMean1
num1 = 17
rMean2 = (0.0095+0.0125)/4
rRelFuzz2 = (0.0125-0.0095)/4/rMean2
num2 = 45
rMean3 = (0.00475+0.0095)/4
rRelFuzz3 = (0.0095-0.00475)/4/rMean3
num3 = 1267
rMean4 = (0.00236+0.00475)/4
rRelFuzz4 = (0.00475-0.00236)/4/rMean4
num4 = 11624

#create empty sphere packing
sp = pack.SpherePack()

# generate randomly sphere
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean1, rRelFuzz = rRelFuzz1, num = num1)
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean2, rRelFuzz = rRelFuzz2, num = num2)
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean3, rRelFuzz = rRelFuzz3, num = num3)
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean4, rRelFuzz = rRelFuzz4, num = num4)

# add the sphere pack to the simulation
sp.toSimulation(material = material)

for body in O.bodies:
   if not isinstance(body.shape, Sphere): 
   continue
   if body.shape.radius >= rMean1 :
   body.shape.color = (0,0,1) #blue
   if body.shape.radius <= rMean1 and  body.shape.radius > rMean2:
   body.shape.color = (0,0,1) #blue
   if body.shape.radius <= rMean2 and  body.shape.radius > rMean3:
   body.shape.color = (1,0,0) #red
   if body.shape.radius <= rMean3 and  body.shape.radius > rMean4:
   body.shape.color = (0,1,0) #green
   if body.shape.radius <= rMean4 :
   body.shape.color = (1,1,0) #yellow

O.engines = [
ForceResetter(),
# sphere, facet, wall
InsertionSortCollider([Bo1_Sphere_Aabb(), Bo1_Facet_Aabb(), 
Bo1_Wall_Aabb()]),
InteractionLoop(
# the loading plate is a wall, we need to handle sphere+sphere, 
sphere+facet, sphere+wall
[Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom(), 
Ig2_Wall_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()]
),
NewtonIntegrator(gravity=(0, 0, -1000), damping=0.3),
# the label creates an automatic variable referring to this engine
# we use it below to change its attributes from the functions called
PyRunner(command='checkUnbalanced()', realPeriod=2, label='checker'),
]
O.dt = 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

# the following checkUnbalanced, unloadPlate and stopUnloading functions are 
all called by the 'checker'
# (the last engine) one after another; this sequence defines progression of 
different stages of the
# simulation, as each of the functions, when the condition is satisfied, 
updates 'checker' to call
# the next function when it is run from within the simulation next time
# check whether the gravity deposition has already 

Re: [Yade-users] [Question #706573]: Troble with porosity calculation

2023-05-12 Thread Huan
Question #706573 on Yade changed:
https://answers.launchpad.net/yade/+question/706573

Status: Answered => Solved

Huan confirmed that the question is solved:
Thanks Karol Brzezinski, that solved my question.

-- 
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 #706573]: Troble with porosity calculation

2023-05-11 Thread Huan
Question #706573 on Yade changed:
https://answers.launchpad.net/yade/+question/706573

Status: Answered => Open

Huan is still having a problem:
Hello Bruno,

I tried to use pi*(diameter/2)^2*h at first which result in -25% too. So
I try diving diameter by hand which results in 0.051 which is also the
same result. Thus, I’m on where did the calculation wrong.

Thanks,
Huan

-- 
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 #706573]: Troble with porosity calculation

2023-05-10 Thread Huan
New question #706573 on Yade:
https://answers.launchpad.net/yade/+question/706573

Hello,
I was able to create a sphere packing with gravity deposition and oedometric 
test. So, I create a calculation to calculate the porosity, but the result that 
I get is negative which doesn't make sense. The result is around 25.00%

The following is my code: 

import random
import math
from yade import geom, pack, utils, plot, ymport
import pandas as pd

# Define material properties
youngModulus = 1e7
poissonRatio = 0.25
density = 2000

# Create material
material = O.materials.append(FrictMat(young=youngModulus, 
poisson=poissonRatio, density=density))

# Define cylinder with funnel parameters
center = (0, 0, 0)
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=200, wallMask=6)

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

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

# Define cylinder with funnel parameters
center1 = (0,0,height/2)
dBunker = 0.4
dOutput = 0.102
hBunker = 0
hOutput = 0.15
hPipe = 0

# create funnel as a bunker with diameter 0.102 m, height 0.064 m
funnel = geom.facetBunker(center=center1, dBunker=dBunker, dOutput=dOutput, 
hBunker=hBunker,hOutput=hOutput, hPipe=hPipe, segmentsNumber=200, wallMask=4)

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

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

# define sphere parameters and number of spheres
rMean1 = (0.0125+0.019)/4
rRelFuzz1 = ((0.019-0.0125)/4)/rMean1
num1 = 17
rMean2 = (0.0095+0.0125)/4
rRelFuzz2 = ((0.0125-0.0095)/4)/rMean2
num2 = 53
rMean3 = (0.00475+0.0095)/4
rRelFuzz3 = ((0.0095-0.00475)/4)/rMean3
num3 = 1267
rMean4 = (0.00236+0.00475)/4
rRelFuzz4 = ((0.00475-0.00236)/4)/rMean4
num4 = 11624

#create empty sphere packing
sp = pack.SpherePack()

# generate randomly sphere
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean1, rRelFuzz = rRelFuzz1, num = num1)
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean2, rRelFuzz = rRelFuzz2, num = num2)
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean3, rRelFuzz = rRelFuzz3, num = num3)
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean4, rRelFuzz = rRelFuzz4, num = num4)

# add the sphere pack to the simulation
sp.toSimulation(material = material)

for body in O.bodies:
   if not isinstance(body.shape, Sphere): 
   continue
   if body.shape.radius >= rMean1 :
   body.shape.color = (0,0,1) #blue
   if body.shape.radius <= rMean1 and  body.shape.radius > rMean2:
   body.shape.color = (0,0,1) #blue
   if body.shape.radius <= rMean2 and  body.shape.radius > rMean3:
   body.shape.color = (1,0,0) #red
   if body.shape.radius <= rMean3 and  body.shape.radius > rMean4:
   body.shape.color = (0,1,0) #green
   if body.shape.radius <= rMean4 :
   body.shape.color = (1,1,0) #yellow


O.engines = [
ForceResetter(),
# sphere, facet, wall
InsertionSortCollider([Bo1_Sphere_Aabb(), Bo1_Facet_Aabb(), 
Bo1_Wall_Aabb()]),
InteractionLoop(
# the loading plate is a wall, we need to handle sphere+sphere, 
sphere+facet, sphere+wall
[Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom(), 
Ig2_Wall_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()]
),
NewtonIntegrator(gravity=(0, 0, -1000), damping=0.3),
# the label creates an automatic variable referring to this engine
# we use it below to change its attributes from the functions called
PyRunner(command='checkUnbalanced()', realPeriod=2, label='checker'),
]
O.dt = PWaveTimeStep()

for body in O.bodies:
   if not isinstance(body.shape, Sphere): 
   continue
   if body.shape.radius == 0.0125/2: #SP
   body.shape.color = (0,0,1) #blue
   if body.shape.radius == 0.0095/2: #SP1
   body.shape.color = (1,0,0) #red
   if body.shape.radius == 0.00475/2: #SP2
   body.shape.color = (0,1,0) #green
   if body.shape.radius == 0.00236/2: #SP3
   body.shape.color = (1,1,1) #white

# the following checkUnbalanced, unloadPlate and stopUnloading functions are 
all called by the 'checker'
# (the last engine) one after another; this sequence defines progression of 
different stages of the
# simulation, as each of the functions, when the condition is satisfied, 
updates 'checker' to call
# the next function when it is run from within the simulation next time


# check whether the gravity deposition has already finished
# if so, add wall on the top of the packing and start the oedometric test
def checkUnbalanced():
# at the very start, 

Re: [Yade-users] [Question #706562]: Trying to add Oedometric test

2023-05-10 Thread Huan
Question #706562 on Yade changed:
https://answers.launchpad.net/yade/+question/706562

Status: Open => Solved

Huan confirmed that the question is solved:
I found the solution, but met with another problem so I will open
another question

-- 
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 #706562]: Trying to add Oedometric test

2023-05-09 Thread Huan
Question #706562 on Yade changed:
https://answers.launchpad.net/yade/+question/706562

Description changed to:
Hello,

I am confuse by the Oedometric test provided in the example: 
https://yade-dem.org/doc/tutorial-examples.html?highlight=oedometric
I don't understand where the max and min load come. I was able to add the test 
to my experiment, but I decided to remove it first because after the 
compression the sphere would be directly bounce off through the plate.


Following is my current code:

import random
import math
from yade import geom, pack, utils, plot, ymport
import pandas as pd

# Define material properties
youngModulus = 1e7
poissonRatio = 0.25
density = 2000

# Create material
material = O.materials.append(FrictMat(young=youngModulus, 
poisson=poissonRatio, density=density))

# Define cylinder with funnel parameters
center = (0, 0, 0)
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)

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

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

# Define cylinder with funnel parameters
center1 = (0,0,height/2)
dBunker = 0.4
dOutput = 0.102
hBunker = 0
hOutput = 0.15
hPipe = 0

# create funnel as a bunker with diameter 0.102 m, height 0.064 m
funnel = geom.facetBunker(center=center1, dBunker=dBunker, dOutput=dOutput, 
hBunker=hBunker,hOutput=hOutput, hPipe=hPipe, segmentsNumber=80, wallMask=4)

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

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

# define sphere parameters and number of spheres
rMean1 = (0.0125+0.019)/4
rRelFuzz1 = (0.019-0.0125)/4/rMean1
num1 = 28
rMean2 = (0.0095+0.0125)/4
rRelFuzz2 = (0.0125-0.0095)/4/rMean2
num2 = 86
rMean3 = (0.00475+0.0095)/4
rRelFuzz3 = (0.0095-0.00475)/4/rMean3
num3 = 2071
rMean4 = (0.00236+0.00475)/4
rRelFuzz4 = (0.00475-0.00236)/4/rMean4
num4 = 18997

#create empty sphere packing
sp = pack.SpherePack()

# generate randomly sphere
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean1, rRelFuzz = rRelFuzz1, num = num1)
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean2, rRelFuzz = rRelFuzz2, num = num2)
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean3, rRelFuzz = rRelFuzz3, num = num3)
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean4, rRelFuzz = rRelFuzz4, num = num4)

# add the sphere pack to the simulation
sp.toSimulation(material = material)

### Finding method to fix this color doesn't seems to work###
for body in O.bodies:
   if not isinstance(body.shape, Sphere): 
   continue
   if body.shape.radius == rMean1:
   body.shape.color = (0,0,1) #blue
   if body.shape.radius == rMean2:
   body.shape.color = (1,0,0) #red
   if body.shape.radius == rMean3:
   body.shape.color = (0,1,0) #green
   if body.shape.radius == rMean4:
   body.shape.color = (1,1,0) #yellow
   if body.shape.radius == rRelFuzz1:
   body.shape.color = (0,0,1) #blue
   if body.shape.radius == rRelFuzz2:
   body.shape.color = (1,0,0) #red
   if body.shape.radius == rRelFuzz3:
   body.shape.color = (0,1,0) #green
   if body.shape.radius == rRelFuzz4:
   body.shape.color = (1,1,0) #yellow
### Finding method to fix this color doesn't seems to work###

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() < 1e-2:
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
 

Re: [Yade-users] [Question #706562]: Trying to add Oedometric test

2023-05-09 Thread Huan
Question #706562 on Yade changed:
https://answers.launchpad.net/yade/+question/706562

Description changed to:
Hello,

I am confuse by the Oedometric test provided in the example: 
https://yade-dem.org/doc/tutorial-examples.html?highlight=oedometric
I don't understand where the max and min load come. I was able to add the test 
to my experiment, but I decided to remove it first because after the 
compression the sphere would be directly bounce off through the plate.


Following is my current code:

import random
import math
from yade import geom, pack, utils, plot, ymport
import pandas as pd

# Define material properties
youngModulus = 1e7
poissonRatio = 0.25
density = 2000

# Create material
material = O.materials.append(FrictMat(young=youngModulus, 
poisson=poissonRatio, density=density))

# Define cylinder with funnel parameters
center = (0, 0, 0)
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)

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

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

# Define cylinder with funnel parameters
center1 = (0,0,height/2)
dBunker = 0.4
dOutput = 0.102
hBunker = 0
hOutput = 0.15
hPipe = 0

# create funnel as a bunker with diameter 0.102 m, height 0.064 m
funnel = geom.facetBunker(center=center1, dBunker=dBunker, dOutput=dOutput, 
hBunker=hBunker,hOutput=hOutput, hPipe=hPipe, segmentsNumber=80, wallMask=4)

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

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

# define sphere parameters and number of spheres
rMean1 = (0.0125+0.019)/4
rRelFuzz1 = (0.019-0.0125)/4/rMean1
num1 = 28
rMean2 = (0.0095+0.0125)/4
rRelFuzz2 = (0.0125-0.0095)/4/rMean2
num2 = 86
rMean3 = (0.00475+0.0095)/4
rRelFuzz3 = (0.0095-0.00475)/4/rMean3
num3 = 2071
rMean4 = (0.00236+0.00475)/4
rRelFuzz4 = (0.00475-0.00236)/4/rMean4
num4 = 18997

#create empty sphere packing
sp = pack.SpherePack()

# generate randomly sphere
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean1, rRelFuzz = rRelFuzz1, num = num1)
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean2, rRelFuzz = rRelFuzz2, num = num2)
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean3, rRelFuzz = rRelFuzz3, num = num3)
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean4, rRelFuzz = rRelFuzz4, num = num4)

# add the sphere pack to the simulation
sp.toSimulation(material = material)

for body in O.bodies:
   if not isinstance(body.shape, Sphere): 
   continue
   if body.shape.radius == (rMean1, rRelFuzz1):
   body.shape.color = (0,0,1) #blue
   if body.shape.radius == (rMean2, rRelFuzz2):
   body.shape.color = (1,0,0) #red
   if body.shape.radius == (rMean3, rRelFuzz3):
   body.shape.color = (0,1,0) #green
   if body.shape.radius == (rMean4, rRelFuzz4):
   body.shape.color = (1,1,0) #yellow

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() < 1e-2:
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 

[Yade-users] [Question #706562]: Trying to add Oedometric test

2023-05-09 Thread Huan
New question #706562 on Yade:
https://answers.launchpad.net/yade/+question/706562

Hello,

I am confuse by the Oedometric test provided in the example: 
https://yade-dem.org/doc/tutorial-examples.html?highlight=oedometric
I don't understand where the max and min load come. I was able to add the test 
to my experiment, but I decided to remove it first because after the 
compression the sphere would be directly bounce off through the plate.


Following is my current code:

import random
import math
from yade import geom, pack, utils, plot, ymport
import pandas as pd

# Define material properties
youngModulus = 1e7
poissonRatio = 0.25
density = 2000

# Create material
material = O.materials.append(FrictMat(young=youngModulus, 
poisson=poissonRatio, density=density))

# Define cylinder with funnel parameters
center = (0, 0, 0)
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)

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

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

# Define cylinder with funnel parameters
center1 = (0,0,height/2)
dBunker = 0.4
dOutput = 0.102
hBunker = 0
hOutput = 0.15
hPipe = 0

# create funnel as a bunker with diameter 0.102 m, height 0.064 m
funnel = geom.facetBunker(center=center1, dBunker=dBunker, dOutput=dOutput, 
hBunker=hBunker,hOutput=hOutput, hPipe=hPipe, segmentsNumber=80, wallMask=4)

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

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

# define sphere parameters and number of spheres
rMean1 = (0.0125+0.019)/4
rRelFuzz1 = (0.019-0.0125)/4/rMean1
num1 = 28
rMean2 = (0.0095+0.0125)/4
rRelFuzz2 = (0.0125-0.0095)/4/rMean2
num2 = 86
rMean3 = (0.00475+0.0095)/4
rRelFuzz3 = (0.0095-0.00475)/4/rMean3
num3 = 2071
rMean4 = (0.00236+0.00475)/4
rRelFuzz4 = (0.00475-0.00236)/4/rMean4
num4 = 18997

#create empty sphere packing
sp = pack.SpherePack()

# generate randomly sphere
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean1, rRelFuzz = rRelFuzz1, num = num1)
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean2, rRelFuzz = rRelFuzz2, num = num2)
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean3, rRelFuzz = rRelFuzz3, num = num3)
sp.makeCloud((-dBunker/4,-dBunker/4,1.3*height),(dBunker/4,dBunker/4,2*height), 
rMean = rMean4, rRelFuzz = rRelFuzz4, num = num4)

# add the sphere pack to the simulation
sp.toSimulation(material = material)

for body in O.bodies:
   if not isinstance(body.shape, Sphere): 
   continue
   if body.shape.radius == rRelFuzz1: #SP
   body.shape.color = (0,0,1) #blue
   if body.shape.radius == rRelFuzz2: #SP1
   body.shape.color = (1,0,0) #red
   if body.shape.radius == rRelFuzz3: #SP2
   body.shape.color = (0,1,0) #green
   if body.shape.radius == rRelFuzz4: #SP3
   body.shape.color = (1,1,0) #yellow

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() < 1e-2:
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': 

Re: [Yade-users] [Question #706540]: Trouble in generating sphere packing

2023-05-09 Thread Huan
Question #706540 on Yade changed:
https://answers.launchpad.net/yade/+question/706540

Status: Answered => Solved

Huan confirmed that the question is solved:
Thanks Karol Brzezinski, that solved my question.

-- 
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 #706540]: Trouble in generating sphere packing

2023-05-09 Thread Huan
Question #706540 on Yade changed:
https://answers.launchpad.net/yade/+question/706540

Status: Open => Solved

Huan confirmed that the question is solved:
Thanks Karol Brzezinski, that solved my question.

-- 
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 #706540]: Trouble in generating sphere packing

2023-05-09 Thread Huan
Question #706540 on Yade changed:
https://answers.launchpad.net/yade/+question/706540

Status: Solved => Open

Huan is still having a problem:

Thanks Karol, that solve my problem.

# set color for sphere
for body in O.bodies:
   if not isinstance(body.shape, Sphere):
   continue
   if body.shape.radius == rMean1: #SP1
   body.shape.color = (0,0,1) #blue
   if body.shape.radius == rMean2: #SP1
   body.shape.color = (1,0,0) #red
   if body.shape.radius == rMean3: #SP2
   body.shape.color = (0,1,0) #green
   if body.shape.radius == rMean4: #SP3
   body.shape.color = (1,1,1) #white
I try this to create color for the spheres, but it doesn't seems to work. Any 
idea?

Also, I would like to use oedometric test on the simulation. My question
is how would I know the load that I should use?

-- 
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 #706540]: Trouble in generating sphere packing

2023-05-09 Thread Huan
Question #706540 on Yade changed:
https://answers.launchpad.net/yade/+question/706540

Huan posted a new comment:
Thanks Karol, that solve my problem.

# set color for sphere
for body in O.bodies:
   if not isinstance(body.shape, Sphere): 
   continue
   if body.shape.radius == rMean1: #SP1
   body.shape.color = (0,0,1) #blue
   if body.shape.radius == rMean2: #SP1
   body.shape.color = (1,0,0) #red
   if body.shape.radius == rMean3: #SP2
   body.shape.color = (0,1,0) #green
   if body.shape.radius == rMean4: #SP3
   body.shape.color = (1,1,1) #white
I try this to create color for the spheres, but it doesn't seems to work. Any 
idea?

Also, I would like to use oedometric test on the simulation. My question
is how would I know the load that I should use?

-- 
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 #706540]: Trouble in generating sphere packing

2023-05-09 Thread Huan
Question #706540 on Yade changed:
https://answers.launchpad.net/yade/+question/706540

Status: Answered => Open

Huan is still having a problem:
Thanks Karol, that solve my problem.

# set color for sphere
for body in O.bodies:
   if not isinstance(body.shape, Sphere): 
   continue
   if body.shape.radius == rMean1: #SP1
   body.shape.color = (0,0,1) #blue
   if body.shape.radius == rMean2: #SP1
   body.shape.color = (1,0,0) #red
   if body.shape.radius == rMean3: #SP2
   body.shape.color = (0,1,0) #green
   if body.shape.radius == rMean4: #SP3
   body.shape.color = (1,1,1) #white
I try this to create color for the spheres, but it doesn't seems to work. Any 
idea?

Also, I would like to use oedometric test on the simulation. My question
is how would I know the load that I should use?

-- 
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 #706540]: Trouble in generating sphere packing

2023-05-08 Thread Huan
Question #706540 on Yade changed:
https://answers.launchpad.net/yade/+question/706540

Description changed to:
Hello,

I'm trying to create a random sphere packing that consists of roughly 21,182 
particles for Marshall hot mix design simulation.
I am trying to generate:
28 particles of aggregates size (0.0125<=x<0.019)
86 particles of aggregates size (0.0095<=x<0.0125)
2,071 particles of aggregates size (0.000475<=x<0.0095)
18,997 particles of aggregates size (0.00236<=x<0.00475)
I want to create it randomly to the following code, but I was only able to 
generate it in layer per layer by using makeCloud.

import random
import math
from yade import geom, pack, utils, plot, ymport

# Define material properties
youngModulus = 1e7
poissonRatio = 0.25
density = 2000

# Create material
material = O.materials.append(FrictMat(young=youngModulus, 
poisson=poissonRatio, density=density))

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

# 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)

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

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

# Define cylinder with funnel parameters
center1 = (0,0,height/2)
dBunker = 0.2
dOutput = 0.102
hBunker = 0
hOutput = 0.08
hPipe = 0

# create funnel as a bunker with diameter 0.102 m, height 0.064 m
funnel = geom.facetBunker(center=center1, dBunker=dBunker, dOutput=dOutput, 
hBunker=hBunker,hOutput=hOutput, hPipe=hPipe, segmentsNumber=80, wallMask=4)

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

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

Thank you,
Huan

-- 
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 #706540]: Trouble in generating sphere packing

2023-05-08 Thread Huan
New question #706540 on Yade:
https://answers.launchpad.net/yade/+question/706540

Hello,

I'm trying to create a random sphere packing that consists of roughly 21,182 
particles for Marshall hot mix design simulation.
I am trying to generate:
28 particles of aggregates size (0.0125<=x<0.019)
86 particles of aggregates size (0.0095<=x<0.0125)
2,071 particles of aggregates size (0.000475<=x<0.0095)
18,997 particles of aggregates size (0.00236<=x<0.00475)
I want to create it randomly, but I was only able to generate it in layer per 
layer by using makeCloud.

Thank you,
Huan

-- 
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 #706332]: Reduce or remove rebound after contact

2023-04-21 Thread Huan
Question #706332 on Yade changed:
https://answers.launchpad.net/yade/+question/706332

Status: Needs information => Open

Huan gave more information on the question:
Hello,

I just recently picked up coding and starting to learn about YADE. If
there is a better way to implement the coding and simulation, I'm all
ears.

1. pandas actually isn't needed but I just use it for my data saving purposes.
2. I have a project to study about the particle packing by using free fall 
action, while the particles generated are related to sieve analysis e.g. 
4.75mm, 4.00mm, 3.35 etc. Due to the simulation being slow, I am thinking of 
using free server to simulate the simulation.

I was trying to created a box allow the sphere to ricochet against it
and rebound into the cylinder.

The next process of my project is to transform the sphere in this
simulation into polyhedron.

Thanks
Huan

-- 
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 #706332]: Reduce or remove rebound after contact

2023-04-20 Thread Huan
Question #706332 on Yade changed:
https://answers.launchpad.net/yade/+question/706332

Description changed to:
import random
import math
from yade import geom, pack, utils
import pandas as pd

# Define cylinder parameters
center = (0, 0, 0)
cyl_radius = 0.102
cyl_height = 0.064

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

# define material properties
mat = utils.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)

# Define box dimensions
box_dimensions = (0.1, 0.1, 0.1)

# Create box at origin
box = geom.facetBox(center=(0,0,0), extents=box_dimensions, wallMask=31)

# Define material properties for box
mat = O.materials.append(FrictMat(density=2600, young=1E6, poisson=0.3, 
frictionAngle=0.6))

# Assign material to each facet of box
for body in box:
body.bodyMat = mat

# Add box to simulation
O.bodies.append(box)

# define sphere parameters and number of spheres
radius = 0.01575
num = 6
radius1 = 0.01175
num1 = 7
radius2 = 0.011
num2 = 8
radius3 = 0.01025
num3 = 8
radius4 = 0.0083125
num4 = 31
radius5 = 0.007125
num5 = 31
radius6 = 0.0059375
num6 = 32
radius7 = 0.0041525
num7 = 25
radius8 = 0.003555
num8 = 26
radius9 = 0.0029575
num9 = 26
radius10 = 0.002065
num10 = 25
radius11 = 0.00177
num11 = 26
radius12 = 0.001475
num12 = 26
radius13 = 0.001035
num13 = 155
radius14 = 0.00089
num14 = 155
radius15 = 0.000745
num15 = 156
radius16 = 0.00045
num16 = 9735

## create empty sphere packing
sp = pack.SpherePack()
sp1 = pack.SpherePack()
sp2 = pack.SpherePack()
sp3 = pack.SpherePack()
sp4 = pack.SpherePack()
sp5 = pack.SpherePack()
sp6 = pack.SpherePack()
sp7 = pack.SpherePack()
sp8 = pack.SpherePack()
sp9 = pack.SpherePack()
sp10 = pack.SpherePack()
sp11 = pack.SpherePack()
sp12 = pack.SpherePack()
sp13 = pack.SpherePack()
sp14 = pack.SpherePack()
sp15 = pack.SpherePack()
sp16 = pack.SpherePack()

# generate randomly sphere
sp.makeCloud((-0.055,-0.055,0.0105), (0.055,0.055,0.0105), rMean=radius, 
rRelFuzz=0, num=num)
sp1.makeCloud((-0.055,-0.055,0.0380), (0.055,0.055,0.0380), rMean=radius1, 
rRelFuzz=0, num=num1)
sp2.makeCloud((-0.055,-0.055,0.0608), (0.055,0.055,0.0608), rMean=radius2, 
rRelFuzz=0, num=num2)
sp3.makeCloud((-0.055,-0.055,0.0820), (0.055,0.055,0.0820), rMean=radius3, 
rRelFuzz=0, num=num3)
sp4.makeCloud((-0.0605,-0.0605,0.1006), (0.0605,0.0605,0.1006), rMean=radius4, 
rRelFuzz=0, num=num4)
sp5.makeCloud((-0.0615,-0.0615,0.1160), (0.0615,0.0615,0.1160), rMean=radius5, 
rRelFuzz=0, num=num5)
sp6.makeCloud((-0.0605,-0.0605,0.1291), (0.0605,0.0605,0.1291), rMean=radius6, 
rRelFuzz=0, num=num6)
sp7.makeCloud((-0.0605,-0.0605,0.1392), (0.0605,0.0605,0.1392), rMean=radius7, 
rRelFuzz=0, num=num7)
sp8.makeCloud((-0.0605,-0.0605,0.1469), (0.0605,0.0605,0.1469), rMean=radius8, 
rRelFuzz=0, num=num8)
sp9.makeCloud((-0.0605,-0.0605,0.1534), (0.0605,0.0605,0.1534), rMean=radius9, 
rRelFuzz=0, num=num9)
sp10.makeCloud((-0.0605,-0.0605,0.1584), (0.0605,0.0605,0.1584), 
rMean=radius10, rRelFuzz=0, num=num10)
sp11.makeCloud((-0.0605,-0.0605,0.1622), (0.0605,0.0605,0.1622), 
rMean=radius11, rRelFuzz=0, num=num11)
sp12.makeCloud((-0.0605,-0.0605,0.1655), (0.0605,0.0605,0.1655), 
rMean=radius12, rRelFuzz=0, num=num12)
sp13.makeCloud((-0.0605,-0.0605,0.1680), (0.0605,0.0605,0.1680), 
rMean=radius13, rRelFuzz=0, num=num13)
sp14.makeCloud((-0.0605,-0.0605,0.1699), (0.0605,0.0605,0.1699), 
rMean=radius14, rRelFuzz=0, num=num14)
sp15.makeCloud((-0.0605,-0.0605,0.1715), (0.0605,0.0605,0.1715), 
rMean=radius15, rRelFuzz=0, num=num15)
sp16.makeCloud((-0.0605,-0.0605,0.1727), (0.0605,0.0605,0.1727), 
rMean=radius16, rRelFuzz=0, num=num16)

# add the sphere pack to the simulation
sp.toSimulation()
sp1.toSimulation()
sp2.toSimulation()
sp3.toSimulation()
sp4.toSimulation()
sp5.toSimulation()
sp6.toSimulation()
sp7.toSimulation()
sp8.toSimulation()
sp9.toSimulation()
sp10.toSimulation()
sp11.toSimulation()
sp12.toSimulation()
sp13.toSimulation()
sp14.toSimulation()
sp15.toSimulation()
sp16.toSimulation()

# add interaction of gravity of sphere and cylinder
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),
]
O.dt = 0.1 * PWaveTimeStep()

# run the simulation for 1000 steps
O.run(1000, wait=True)

for body in O.bodies:
   if not isinstance(body.shape, Sphere): 
   continue
   if 

[Yade-users] [Question #706332]: Reduce or remove rebound after contact

2023-04-20 Thread Huan
New question #706332 on Yade:
https://answers.launchpad.net/yade/+question/706332

import random
import math
from yade import geom, pack, utils
import pandas as pd

# Define cylinder parameters
center = (0, 0, 0)
cyl_radius = 0.102
cyl_height = 0.064

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

# define material properties
mat = utils.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)

# Define box dimensions
box_dimensions = (0.1, 0.1, 0.1)

# Create box at origin
box = geom.facetBox(center=(0,0,0), extents=box_dimensions, wallMask=31)

# Define material properties for box
mat = O.materials.append(FrictMat(density=2600, young=1E6, poisson=0.3, 
frictionAngle=0.6))

# Assign material to each facet of box
for body in box:
body.bodyMat = mat

# Add box to simulation
O.bodies.append(box)

# define sphere parameters and number of spheres
radius = 0.01575
num = 6
radius1 = 0.01175
num1 = 7
radius2 = 0.011
num2 = 8
radius3 = 0.01025
num3 = 8
radius4 = 0.0083125
num4 = 31
radius5 = 0.007125
num5 = 31
radius6 = 0.0059375
num6 = 32
radius7 = 0.0041525
num7 = 25
radius8 = 0.003555
num8 = 26
radius9 = 0.0029575
num9 = 26
radius10 = 0.002065
num10 = 25
radius11 = 0.00177
num11 = 26
radius12 = 0.001475
num12 = 26
radius13 = 0.001035
num13 = 155
radius14 = 0.00089
num14 = 155
radius15 = 0.000745
num15 = 156
radius16 = 0.00045
num16 = 9735

## create empty sphere packing
sp = pack.SpherePack()
sp1 = pack.SpherePack()
sp2 = pack.SpherePack()
sp3 = pack.SpherePack()
sp4 = pack.SpherePack()
sp5 = pack.SpherePack()
sp6 = pack.SpherePack()
sp7 = pack.SpherePack()
sp8 = pack.SpherePack()
sp9 = pack.SpherePack()
sp10 = pack.SpherePack()
sp11 = pack.SpherePack()
sp12 = pack.SpherePack()
sp13 = pack.SpherePack()
sp14 = pack.SpherePack()
sp15 = pack.SpherePack()
sp16 = pack.SpherePack()

# generate randomly sphere
sp.makeCloud((-0.055,-0.055,0.0105), (0.055,0.055,0.0105), rMean=radius, 
rRelFuzz=0, num=num)
sp1.makeCloud((-0.055,-0.055,0.0380), (0.055,0.055,0.0380), rMean=radius1, 
rRelFuzz=0, num=num1)
sp2.makeCloud((-0.055,-0.055,0.0608), (0.055,0.055,0.0608), rMean=radius2, 
rRelFuzz=0, num=num2)
sp3.makeCloud((-0.055,-0.055,0.0820), (0.055,0.055,0.0820), rMean=radius3, 
rRelFuzz=0, num=num3)
sp4.makeCloud((-0.0605,-0.0605,0.1006), (0.0605,0.0605,0.1006), rMean=radius4, 
rRelFuzz=0, num=num4)
sp5.makeCloud((-0.0615,-0.0615,0.1160), (0.0615,0.0615,0.1160), rMean=radius5, 
rRelFuzz=0, num=num5)
sp6.makeCloud((-0.0605,-0.0605,0.1291), (0.0605,0.0605,0.1291), rMean=radius6, 
rRelFuzz=0, num=num6)
sp7.makeCloud((-0.0605,-0.0605,0.1392), (0.0605,0.0605,0.1392), rMean=radius7, 
rRelFuzz=0, num=num7)
sp8.makeCloud((-0.0605,-0.0605,0.1469), (0.0605,0.0605,0.1469), rMean=radius8, 
rRelFuzz=0, num=num8)
sp9.makeCloud((-0.0605,-0.0605,0.1534), (0.0605,0.0605,0.1534), rMean=radius9, 
rRelFuzz=0, num=num9)
sp10.makeCloud((-0.0605,-0.0605,0.1584), (0.0605,0.0605,0.1584), 
rMean=radius10, rRelFuzz=0, num=num10)
sp11.makeCloud((-0.0605,-0.0605,0.1622), (0.0605,0.0605,0.1622), 
rMean=radius11, rRelFuzz=0, num=num11)
sp12.makeCloud((-0.0605,-0.0605,0.1655), (0.0605,0.0605,0.1655), 
rMean=radius12, rRelFuzz=0, num=num12)
sp13.makeCloud((-0.0605,-0.0605,0.1680), (0.0605,0.0605,0.1680), 
rMean=radius13, rRelFuzz=0, num=num13)
sp14.makeCloud((-0.0605,-0.0605,0.1699), (0.0605,0.0605,0.1699), 
rMean=radius14, rRelFuzz=0, num=num14)
sp15.makeCloud((-0.0605,-0.0605,0.1715), (0.0605,0.0605,0.1715), 
rMean=radius15, rRelFuzz=0, num=num15)
sp16.makeCloud((-0.0605,-0.0605,0.1727), (0.0605,0.0605,0.1727), 
rMean=radius16, rRelFuzz=0, num=num16)

# add interaction of gravity of sphere and cylinder
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),
]
O.dt = 0.1 * PWaveTimeStep()

# run the simulation for 1000 steps
O.run(1000, wait=True)

for body in O.bodies:
   if not isinstance(body.shape, Sphere): 
   continue
   if body.shape.radius == radius: #SP
   body.shape.color = (0,0,1) #blue
   if body.shape.radius == radius1: #SP1
   body.shape.color = (1,0,0) #red
   if body.shape.radius == radius2: #SP2
   body.shape.color = (0,1,0) #green
   if body.shape.radius == radius3: #SP3
   body.shape.color = (1,1,1) #white
   if body.shape.radius == radius4: #SP4
   body.shape.color = (1,1,0) #yellow
   

[Yade-users] [Question #706232]: the sphere should be generated around 9000+ but its only around 1800

2023-04-15 Thread Huan
New question #706232 on Yade:
https://answers.launchpad.net/yade/+question/706232

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=40, 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)

# Define sphere parameters and percentages
radii = [0.01575, 0.01175, 0.011, 0.01025, 0.0083125, 0.007125, 0.0059375, 
0.0041525, 0.003555, 0.0029575, 0.002065, 0.00177, 0.001475, 0.001035, 0.00089, 
0.000745, 0.000525, 0.00045, 0.000375, 0.0002625, 0.000225, 0.0001875, 0.75]
numSphere = [6, 7, 8, 8, 31, 31, 32, 25, 26, 26, 25, 26, 26, 155, 155, 156, 
155, 156, 156, 155, 156, 156, 8000]

# Generate sphere pack
sp = pack.SpherePack()
for r, num in zip(radii, numSphere):
sp.makeCloud((-0.055,-0.055,0.35), (0.055,0.055,0.01), rMean=r, rRelFuzz=0, 
num=num)

# add the sphere pack to the simulation
sp.toSimulation()

# Define gravity engine
O.engines = [ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom6D(), Ig2_Facet_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()]
),
GlobalStiffnessTimeStepper(defaultDt=0.0001, timestepSafetyCoefficient=0.8),
NewtonIntegrator(gravity=(0,0,-9.81), damping=0.4),
]

# Define simulation duration and time step
O.dt = 1e-5
O.run(1000, wait=True)

# Count the number of spheres in the cylinder
num_spheres_in_cylinder = 0
for body in O.bodies:
if body.id == 0:  # skip the cylinder
continue
sphere_center = body.state.pos
dist_to_axis = math.sqrt(sphere_center[0]**2 + sphere_center[1]**2)
if dist_to_axis <= radius and sphere_center[2] >= center[2] and 
sphere_center[2] <= center[2] + height:
num_spheres_in_cylinder += 1

# Calculate volume of spheres in cylinder
volume_of_spheres_in_cylinder = 0
for body in O.bodies:
if body.id == 0:  # skip the cylinder
continue
sphere_center = body.state.pos
dist_to_axis = math.sqrt(sphere_center[0]**2 + sphere_center[1]**2)
if dist_to_axis <= radius and sphere_center[2] >= center[2] and 
sphere_center[2] <= center[2] + height:
if isinstance(body.shape, Sphere):  # check if body is a sphere
sphere_volume = (4/3) * math.pi * body.shape.radius**3
volume_of_spheres_in_cylinder += sphere_volume

# Calculate volume of cylinder
volume_of_cylinder = (math.pi * radius**2) * height

# Calculate porosity
porosity = (volume_of_cylinder - volume_of_spheres_in_cylinder) / 
volume_of_cylinder
porosity_percent = porosity * 100

# Print results
print("Number of spheres in cylinder:", num_spheres_in_cylinder)
print("Volume of spheres in cylinder:", volume_of_spheres_in_cylinder)
print("Volume of cylinder:", volume_of_cylinder)
print("Porosity:", porosity)
print("Porosity:", porosity_percent, "%")

-- 
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 #706022]: Is it possible to add hue to each radii sphere radius? Also, after simulation is my calculation wrong?

2023-03-31 Thread Huan
Question #706022 on Yade changed:
https://answers.launchpad.net/yade/+question/706022

Status: Answered => Solved

Huan confirmed that the question is solved:
Thanks Jan Stránský, that solved my question.

-- 
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 #706022]: Is it possible to add hue to each radii sphere radius? Also, after simulation is my calculation wrong?

2023-03-30 Thread Huan
New question #706022 on Yade:
https://answers.launchpad.net/yade/+question/706022

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

# Define cylinder parameters
center = (0, 0, 0)
radius = 0.08
height = 0.10

# create cylindrical body with radius 0.08 m and height 0.0605 m
cylinder = yade.geom.facetCylinder(center=center, radius=radius, height=height, 
segmentsNumber=80, wallMask=6)
O.bodies.append(cylinder)

# Define sphere parameters and percentages
radii = [0.75, 0.0006, 0.00236, 0.00475, 0.0095, 0.0125]
percentages = [0.04, 0.06, 0.05, 0.35, 0.2, 0.3]

# Generate sphere pack
sp = pack.SpherePack()
for r, ratio in zip(radii, percentages):
   num_spheres = int(ratio * 1000)
   sp.makeCloud((-0.055,-0.055,0.35), (0.055,0.055,0.01), rMean=r, rRelFuzz=0, 
num=num_spheres)

# add the sphere pack to the simulation
sp.toSimulation()

# Define gravity engine
O.engines = [ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom6D(), Ig2_Facet_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()]
),
GlobalStiffnessTimeStepper(defaultDt=0.0001, timestepSafetyCoefficient=0.8),
NewtonIntegrator(gravity=(0,0,-9.81), damping=0.4),
]

# Define simulation duration and time step
O.dt = 1e-5
O.run(1000)

# Count the number of spheres in the cylinder
num_spheres_in_cylinder = 0
for body in O.bodies:
if body.id == 0:  # skip the cylinder
continue
sphere_center = body.state.pos
dist_to_axis = math.sqrt(sphere_center[0]**2 + sphere_center[1]**2)
if dist_to_axis <= radius and sphere_center[2] >= center[2] and 
sphere_center[2] <= center[2] + height:
num_spheres_in_cylinder += 1

# Calculate volume of spheres in cylinder
volume_of_spheres_in_cylinder = 0
for body in O.bodies:
if body.id == 0:  # skip the cylinder
continue
sphere_center = body.state.pos
dist_to_axis = math.sqrt(sphere_center[0]**2 + sphere_center[1]**2)
if dist_to_axis <= radius and sphere_center[2] >= center[2] and 
sphere_center[2] <= center[2] + height:
if isinstance(body.shape, Sphere):  # check if body is a sphere
sphere_volume = (4/3) * math.pi * body.shape.radius**3
volume_of_spheres_in_cylinder += sphere_volume

# Calculate volume of cylinder
volume_of_cylinder = (math.pi * radius**2) * height

# Calculate porosity
porosity = (volume_of_cylinder - volume_of_spheres_in_cylinder) / 
volume_of_cylinder
porosity_percent = porosity * 100

# Print results
print("Number of spheres in cylinder:", num_spheres_in_cylinder)
print("Volume of spheres in cylinder:", volume_of_spheres_in_cylinder)
print("Volume of cylinder:", volume_of_cylinder)
print("Porosity:", porosity)
print("Porosity:", porosity_percent, "%")

I have two question
1. Is it possible to add color to each radii sphere radius?
2. After simulation, the sphere seems to pack well in the container, but my 
porosity after calculation if above 80+%
did I have mistake in my calculation process?

-- 
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 #706005]: I am trying to create a simulation within yade with different sphere radius to fall by gravity into a container

2023-03-30 Thread Huan
Question #706005 on Yade changed:
https://answers.launchpad.net/yade/+question/706005

Status: Answered => Solved

Huan confirmed that the question is solved:
Thanks Jan Stránský, that solved my question.

-- 
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 #706005]: I am trying to create a simulation within yade with different sphere radius to fall by gravity into a container

2023-03-29 Thread Huan
New question #706005 on Yade:
https://answers.launchpad.net/yade/+question/706005

import random
import math
from yade import geom, pack, plot


# create cylindrical body with radius 6 cm and height 6.05 cm
cylinder = yade.geom.facetCylinder((0,0,0), radius=0.06, height=0.065, 
segmentsNumber=80, wallMask=6)
O.bodies.append(cylinder)


# create empty sphere packing
sp = pack.SpherePack()


# specify the radii and ratios
radii_ratios = [(0.75, 0.04), (0.0006, 0.06), (0.00236, 0.05), (0.00475, 
0.35), (0.0095, 0.20), (0.0125, 0.30)]

# generate spheres with specified radii and ratios
for r, ratio in radii_ratios:
   num_spheres = int(ratio * 1000)
   sp.makeCloud((-0.055,-0.055,0.20), (0.055,0.055,0.09), rMean=r, rRelFuzz=0, 
num=num_spheres)


# 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),
]
O.dt = 2 * PWaveTimeStep()


# run the simulation for 1000 steps
O.run(1000)


# calculate the volume of the packing
volume_packing = 0
num_spheres = 0
for b in O.bodies:
  if isinstance(b.shape, yade.wrapper.Sphere):
  volume_packing += 4/3 * math.pi * b.shape.radius**3
  num_spheres += 1


# calculate the volume of the cylinder
volume_cylinder = math.pi * 0.06**2 * 0.0605


# calculate the porosity and porosity percentage
porosity = (volume_cylinder - volume_packing) / volume_cylinder
porosity_percent = porosity * 100


print("Number of spheres:", "{:.2f}".format(num_spheres))
print("V Packing:", "{:.2f}".format(volume_packing))
print("V Cylinder:", "{:.2f}".format(volume_cylinder))
print("Porosity:", "{:.2f}".format(porosity))
print("Porosity:", "{:.2f}%".format(porosity_percent))

I was able to complete the simulation but the simulation doesn't fully packed 
and V packing and V cylinder are calculated as 0
Is there any guide on how to make the sphere pack better in the container?
Why does the calculation is calculated as 0?

-- 
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