[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 #706740]: Excess pore-water pressure in triaxial test

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

Fedor posted a new comment:
Hi Yuri, thanks for your comment

-- 
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 #706740]: Excess pore-water pressure in triaxial test

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

Fedor posted a new comment:
Hello Bruno, thank you for reply. 
Script is attached below. I want to see as in theory the result of increasing 
of pore pressure up to a constant constant value. 



from __future__ import print_function

import time
import datetime
import os

from yade import pack, plot, export
import numpy as np

# VTK RECORDER PARAMS
vtk_output = True
vtk_iter = 100
vtk_dir = 'vtk_output'
vtk_recorders = ['all']
if vtk_output == True:
vtk_dir += '/' + datetime.datetime.now().strftime("%Y-%m-%d_%H.%M.%S") + '/'
if not os.path.exists(vtk_dir):
os.makedirs(vtk_dir)


#FIXED PARAMETERS
k=3E7
poisson=0.2
R=1e-4
dimcell = 0.002
density= 1e12
sigmaIso=-1e5
young=np.abs(k*sigmaIso*R*2)
targetVoid=0.7
frictionAngle=radians(30)
alphaKr=2
alphaKtw=2
etaRoll=.15

#SETTINGS
# removed O.periodic = True
# removed O.cell.hSize = Matrix3(dimcell , 0, 0, 0, dimcell , 0, 0, 0, dimcell )


sp = pack.SpherePack()


diameter=[0.75,0.000106,0.00015,0.00025,0.00030,0.000425,0.000850]

part=[0.0037,0.0263,0.1319,0.7136,0.8681,0.9939,1]


sp.makeCloud((0, 0, 0), (dimcell, dimcell, dimcell), 
psdSizes=diameter,psdCumm=part,distributeMass=True,seed=1)


pp = O.materials.append(CohFrictMat(
young=young,
poisson=poisson,
frictionAngle=radians(30),
density=density,
isCohesive=False,
momentRotationLaw=True,
etaRoll=etaRoll,label='spheres'
))


walls = aabbWalls(((0, 0, 0), (dimcell, dimcell, dimcell)),
  thickness=0,
  material='spheres')
wallIds = O.bodies.append(walls)
sp.toSimulation(material='spheres')

O.engines = [
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb(), Bo1_Box_Aabb()]),
InteractionLoop([Ig2_Sphere_Sphere_ScGeom6D(), Ig2_Box_Sphere_ScGeom6D()],
[Ip2_CohFrictMat_CohFrictMat_CohFrictPhys()],
[Law2_ScGeom6D_CohFrictPhys_CohesionMoment(
useIncrementalForm=True,
always_use_moment_law=True),
 Law2_ScGeom_FrictPhys_CundallStrack()]),
TriaxialStressController(
goal1=sigmaIso,
goal2=sigmaIso,
goal3=sigmaIso,
thickness=0,
stressMask=7,
max_vel=0.05,
internalCompaction = False,
label='triax',
),
FlowEngine(dead=True,
   label="flow",
   ),
NewtonIntegrator(damping=.2),
PyRunner(command='addPlotData()',
 iterPeriod=500,
 label='plotter',
 dead=True),
PyRunner(command='testHook()',
 iterPeriod=10,
 label='test_hook',
 dead=False),
PyRunner(command='triaxFinished()',
 iterPeriod=10,
 label='triax_finished',
 dead=True),
VTKRecorder(fileName=vtk_dir+'3d-vtk-',
recorders=vtk_recorders,
iterPeriod=vtk_iter,
dead=not vtk_output)
]

O.dt = 0.1 * PWaveTimeStep()
print('time step',O.dt)

def triaxDone():
u=utils.porosity()
ev=u/(1-u)
frictionAngle = radians(30)
while ev > targetVoid:
frictionAngle *= 0.99
setContactFriction(frictionAngle)
O.run(3000, True)
u=utils.porosity()
ev=u/(1-u)
print ("Iteration: ", O.iter, "\tFriction angle: ", 
frictionAngle,"\tVoid:",ev)


def addPlotData():
plot.addData(
i=O.iter,
Ezz=-triax.strain[2],
Eyy=triax.strain[1],
Exx=triax.strain[0],
e=utils.porosity()/(1-utils.porosity()),
q=abs(utils.getStress()[2,2]-utils.getStress()[0,0]),
V=triax.volumetricStrain,
p=flow.getPorePressure((0.0015,0.0015,0.0015)),
t=O.time,
)


def testHook():
if abs(sigmaIso)*0.99 <= abs(triax.meanStress) <= abs(sigmaIso)*1.01:
O.pause()
test_hook.dead = True
print("FIRST STAGE DONE")

def Deviatoric():
flow.dead = False
#flow.defTolerance = 0.8
flow.meshUpdateInterval = 800
#flow.useSolver = 3
flow.permeabilityFactor = 1
flow.viscosity = 0.00298
flow.bndCondIsPressure = [0, 0, 0, 0, 0, 0]
flow.fluidBulkModulus=0.1  
flow.bndCondValue = [0, 0, 0, 0, 0, 0]
flow.boundaryUseMaxMin = [0, 0, 0, 0, 0, 0]


#flow.imposePressure(Vector3(triax.width/2,triax.height/2,triax.depth/2),100.001)
triax.wall_bottom_activated = True
triax.wall_top_activated = True
triax.wall_back_activated = True
triax.wall_front_activated = True
triax.wall_left_activated = True
triax.wall_right_activated = True
triax.stressMask = 3
triax.goal1 = sigmaIso
triax.goal2 = sigmaIso
triax.goal3 = -0.0001
triax.max_vel=0.0001
triax_finished.dead = False
setContactFriction(radians(17))
O.dt = 0.1e-3
  

O.run(1,1)
flow.updateTriangulation=True #force remeshing to reflect new BC immediately
newton.damping=0


Re: [Yade-users] [Question #706740]: Excess pore-water pressure in triaxial test

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

Status: Open => Answered

Bruno Chareyre proposed the following answer:
Hi Fedor,

Mathematically it should be possible to solve for pressure when the fluid is 
compressible (else it is ill-posed), but it requires that at least the initial 
value of pressure is defined. I don't think I've tried that before.
Do you have a (non-)working example?
Regards
Bruno

-- 
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 #706569]: Dynamic Triaxial test

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

Yuri Bezmenov confirmed that the question is solved:
Thanks Bruno Chareyre, 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 #706766]: How to get Micro-strain field from a 2D simulation in YADE

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

Status: Answered => Solved

Leonard confirmed that the question is solved:
Thanks Karol, this is a great idea!

Cheers,
Leonard

-- 
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 #706664]: Export Local Porosity to vtk file

2023-05-25 Thread Jan Stránský
Question #706664 on Yade changed:
https://answers.launchpad.net/yade/+question/706664

Status: Open => Answered

Jan Stránský proposed the following answer:
Hello,

thanks for the code, now it is much more clear

> except for the last line

see below

> From the documentation I understood, that it is also calculating the
porosity for various subvolumina (in this case 200), but it is not clear
to me, how I can access this data.

No.
voxelPorosity calculates porosity in given cubic region (determined by 
coordinates of "start" and "end" corners). It returns one number.
200 here is resolution. In this case, it divides the region into 200x200x200 
voxels and for each voxel it determines if it is particle or void. From these 
values, porosity is computed and returned.
The higher resolution, the more accurate is the result, but also the more RAM 
and more time is used.

> So I turned to defining subvolumina in the code

This is how I meant it to be used :-)

> which I find to be a tedious process.

In what sense is it tedious?
Code writing of each command separately? If so, use a for loop.

> My resort would be to save them as a txt document and convert it to
vtk.

good idea, or I think Paraview can just load the data from .txt file (?)

> so I tried to use the VTKExporter.
> The yade documentation says, with VTKExporter, the user is able to export any 
> user defined variable.
> any variable, but related to existing spheres (taking spheres as the 
> example). 

VTKExporter can export any value, but related to existing spheres (if spheres 
are exported).
So e.g. you can export sphere color, material properties, volume etc.
It is not meant to export literally any variables (e.g. here porosity defined 
in arbitrary points in space).

I would stick to the txt file first. If it does not work, you can
convert the txt file to vtk, or change export directly to vtk (either
"manually" as VTKExporter is implemented, or using some external
package)

Cheers
Jan

-- 
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 #706740]: Excess pore-water pressure in triaxial test

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

Yuri Bezmenov posted a new comment:
Hi Fedor!
I was also trying to simulate a similar problem when I used 
'flow.bndCondIsPressure = [0, 0, 0, 0, 0, 0]' to simulate undrained condition, 
the software throws an errors :
negative volume for an ordinary pore (temp warning, should still be safe)
Failed to triangulate body with id=36 Point=-0.342856 -0.282828 1.24841 
rad=0.0553163
and ultimately, it terminates with 'segementation fault'. 
If I tried with some boundaries having pressure conditions, e.g. ' 
'flow.bndCondIsPressure = '[0, 0, 0, 1, 0, 0]',  the software works fine.  But 
applying any pressure condition doesn't reflect the actual scenario. 

I believe using DFNFlowEngine could help, but I am so naive that I couldn't 
compile to yade. If you could do that and check, that may serve the purpose for 
both of us. 
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


Re: [Yade-users] [Question #706664]: Export Local Porosity to vtk file

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

Status: Needs information => Open

Anton gave more information on the question:
Hello Jan and thanks for coming back to me.

Here is the code I am using right now:

# gravity deposition in box, showing how to plot and save history of data,
# and how to control the simulation while it is running by calling
# python functions from within the simulation loop

# import yade modules that we will use below
from yade import pack, plot
from yade import utils, export
from minieigen import Vector3

# create rectangular box from facets
O.bodies.append(geom.facetBox((.5, .5, .5), (.5, .5, .5), wallMask=31))

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

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

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

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


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


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

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

O.saveTmp()


# overall porosity
pa = utils.voxelPorosity(200,(0, 0, 0),(1, 1, 1))
pb = utils.porosity()
print('porosity of whole sample computed with voxel porosity', pa)
print('porosity of whole sample computed with porosity', pb)

# porosity from sub volumes (8 total)
p1 = utils.voxelPorosity(200,(0, 0, 0),(0.5, 0.5, 0.5))
p2 = utils.voxelPorosity(200,(0, 0.5, 0),(0.5, 1, 0.5))
p3 = utils.voxelPorosity(200,(0.5, 0, 0),(1, 0.5, 0.5))
p4 = utils.voxelPorosity(200,(0.5, 0.5, 0),(1, 1, 0.5))
p5 = utils.voxelPorosity(200,(0, 0, 0.5),(0.5, 0.5, 1))
p6 = utils.voxelPorosity(200,(0.5, 0, 0.5),(1, 0.5, 1))
p7 = utils.voxelPorosity(200,(0, 0.5, 0.5),(0.5, 1, 1))
p8 = utils.voxelPorosity(200,(0.5, 0.5, 0.5),(1, 1, 1))

# print porosity obtained by subvolumina
print(p1, p2, p3, p4, p5, p6, p7, p8)

#vtk = yade.export.VTKExporter('/home/antonsie/DEM/Test/M01/pa-')
#vtk.export('pa')

The code is working fine except for the last line. It returns the
porosity calculated with utils.voxelPorosity() for the whole sample.
>From the documentation I understood, that it is also calculating the
porosity for various subvolumina (in this case 200), but it is not clear
to me, how I can access this data. Can you help me out here?

So I turned to defining subvolumina in the code which I find to be a
tedious process. My resort would be to save them as a txt document and
convert it to vtk.

The VTKRecorder can't return the values I would need to calculate the porosity, 
which are the volumes of the subvolumina defined through utils.voxelPorosity() 
so I tried to use the VTKExporter.
The yade documentation says, with VTKExporter, the user is able to export any 
user defined variable. However, it is not clear to me, how to do that. I 
searched in the documentation and in examples on GitLab. Could you provide more 
infomation?

Thanks in advance!

-- 
You received this question notification because your team 

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

2023-05-25 Thread Jan Stránský
Question #706790 on Yade changed:
https://answers.launchpad.net/yade/+question/706790

Jan Stránský posted a new comment:
I understand that for actual simulation, you use that many particles.
My point was that for this forum and for higher probability of good answer (I 
was not able to run the script on my laptop, so I was only guessing), always 
try to create a script focusing just on the problem, trying to make it minimal 
(both from the point of view of code and resources needed for run).
As a byproduct, by creating such MWE, often you can find the problem yourself.

"Small" particles (in fact any particle) can "go through" a barrier, it depends 
on many factors, mainly:
- if velocity of the particle is not as high as that in one time step it fully 
goes from one side of the barrier to the other, without any possibility of 
contact detection
- if stiffness / force / inertia interplay is not such that the barrier cannot 
prevent the particle from passing through.

Cheers
Jan

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


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

2023-05-25 Thread Jan Stránský
Question #706790 on Yade changed:
https://answers.launchpad.net/yade/+question/706790

Status: Open => Answered

Jan Stránský proposed the following answer:
Hello,

please provide a MWE [1], M = minimal
Is 5 millions spheres needed to demonstrate your problem?

"bursting" might be caused by particle overlap.
Which coordinate "dividing it by 8" supports (if I understand it correctly)..

Cheers
Jan

[1] https://www.yade-dem.org/wiki/Howtoask

-- 
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 Jan Stránský
Question #706786 on Yade changed:
https://answers.launchpad.net/yade/+question/706786

Jan Stránský posted a new comment:
Hello,

> ##My Code##

please try to use MWE [1], M = minimal.
For this case, a few "hardcoded" spheres is enough for the export / import 
purposes (see below what I mean)

Option 1:
it is python script, so you can "manually" export anything anyhow you like.

Option2:
using yade's predefined export.textExt function [2]:
###
from yade import export
mat1 = FrictMat(label="mat1")
mat2 = FrictMat(label="mat2")
mat1id = O.materials.append(mat1)
mat2id = O.materials.append(mat2)
s1 = sphere((0,0,0),1,material=mat1,color=(0.9,0.2,0.1))
s2 = sphere((2,0,0),1,material=mat2,color=(0.3,0.4,0.8))
O.bodies.append([s1,s2])
export.textExt("test.txt",format="x_y_z_r_attrs",comment="color_r color_g 
color_b mat_id",attrs=["b.shape.color","b.mat.id"])
# note: b.shape.color "vector" is split into 3 numbers
###

For import you can use ymport.textExt [3]:
###
from yade import ymport
attrs = []
spheres = ymport.textExt("test.txt",format="x_y_z_r_attrs",attrs=attrs)
print(spheres)
print(attrs)
###

Cheers
Jan

[1] https://www.yade-dem.org/wiki/Howtoask
[2] https://yade-dem.org/doc/yade.export.html#yade.export.textExt
[3] https://yade-dem.org/doc/yade.ymport.html#yade.ymport.textExt

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

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 #706787]: Materials changes after shpere generation

2023-05-25 Thread Jan Stránský
Question #706787 on Yade changed:
https://answers.launchpad.net/yade/+question/706787

Status: Open => Needs information

Jan Stránský requested more information:
> By adding the the spheres the material type of walls change

please provide the method how you got this information.
I could not reproduce it.

If I add this check at the end of the script
for b in O.bodies: print(type(b.shape).__name__,b.mat.label)
I get this output:
###
Box walls
Box walls
Box walls
Box walls
Box walls
Box walls
Sphere cube
Sphere cube
Sphere cube
Sphere cube
Sphere cube
Sphere cube
Sphere cube
Sphere cube
###

Cheers
Jan

-- 
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 #706779]: Wall disappearing

2023-05-25 Thread Jan Stránský
Question #706779 on Yade changed:
https://answers.launchpad.net/yade/+question/706779

Jan Stránský posted a new comment:
I have no idea myself.
I suspect the triax engine to do some division by O.dt for stress controlled 
walls.
You / somebody else can dig into source code if you want or somebody with the 
knowledge can answer.
Cheers
Jan

-- 
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 #706709]: Segmentation error

2023-05-25 Thread Jan Stránský
Question #706709 on Yade changed:
https://answers.launchpad.net/yade/+question/706709

Status: Open => Needs information

Jan Stránský requested more information:
> and provide the output

Cheers
Jan

-- 
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 #706758]: Force between wall and particle

2023-05-25 Thread Jan Stránský
Question #706758 on Yade changed:
https://answers.launchpad.net/yade/+question/706758

Status: Open => Needs information

Jan Stránský requested more information:
> i want to check

it depends on what, how, ... it should do..
print?
save?
check = compare to some expected value?
...?

> at iter= 50

it depends on what, how, ... it should do..
inside finish() function?
as a separate PyRunner?
O.run(500,wait=True)?
... ?

Cheers
Jan

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

Re: [Yade-users] [Question #706787]: Materials changes after shpere generation

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

Summary changed to:
Materials changes after shpere generation

Description changed to:
In the name of God
Hi every one!
I encountered an strange problem. When i add some spheres bonded to each other 
using CohFrictMat in a triaxial box, exactly after addition of bonded 
particles, the wall material type changes from 'walls' to 'cube'. here is the 
MWE:

from yade import pack

### DEFINING VARIABLES AND MATERIALS ###


# The following 5 lines will be used later for batch execution

ConPre=-10
ConPre1=-5000
key='t_20%_25_100' # put you simulation's name here
targetPorosity = 0.38#the porosity we want for the packing
compFricDegree = 30 # initial contact friction during the confining phase (will 
be decreased during the REFD compaction process)
finalFricDegree = 30 # contact friction during the deviatoric loading

young=1e9 # contact stiffness
mn,mx=Vector3(0,0,0),Vector3(.3,.3,.3) # corners of the initial packing
O.materials.append(CohFrictMat(young=1e9,poisson=0.2,density=1500,isCohesive=False,frictionAngle=0,label='walls'))

## create walls around the packing
walls=aabbWalls([mn,mx],thickness=0)
wallIds=O.bodies.append(walls)

## create materials for spheres and plates
O.materials.append(CohFrictMat(young=1e6,poisson=0.48,density=1500,label='cube',frictionAngle=radians(compFricDegree),
isCohesive=True,
normalCohesion=5000,
shearCohesion=5000,
momentRotationLaw=True
))

sp=pack.SpherePack()
sp.makeCloud((0,0,0),(.3,.3,.3),rMean=.05,distributeMass=False,seed=1)

#
### DEFINING ENGINES ###


triax=TriaxialStressController(
maxMultiplier=1.+2e4/young, # spheres growing factor (fast growth)
finalMaxMultiplier=1.+2e3/young, # spheres growing factor (slow growth)
thickness = 0,
stressMask = 7,
internalCompaction=False, # If true the confining pressure is generated by 
growing particles
)

newton=NewtonIntegrator(damping=.1)

O.engines=[
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Box_Aabb()]),
InteractionLoop(

[Ig2_Sphere_Sphere_ScGeom6D(interactionDetectionFactor=1.12),Ig2_Box_Sphere_ScGeom6D()],
[Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(
setCohesionNow=True,
setCohesionOnNewContacts=False,
)],

[Law2_ScGeom6D_CohFrictPhys_CohesionMoment(),Law2_ScGeom_FrictPhys_CundallStrack()]
),
triax,
newton,
]

triax.goal1=triax.goal2=ConPre1
triax.goal3=ConPre1
O.dt=0
yade.qt.Controller()

for x in [.1,.2]:
for y in [.1,.2]:
for z in [.1,.2]:
s = utils.sphere((x,y,z),.08,material='cube')
O.bodies.append(s)

###By adding the the spheres the material type of walls changes


-- 
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 #706779]: Wall disappearing

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

Status: Answered => Open

mohsen is still having a problem:
Hi Jan
That works for me too! but would you please let me know what happen if dt set 
non-zero?

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