[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


[Yade-users] [Question #706571]: Problem with using rolling resistance in ViscElCap physics

2023-05-10 Thread Roxana Saghafian Larijani
New question #706571 on Yade:
https://answers.launchpad.net/yade/+question/706571

Hi all,
I am trying to add rolling resistance (mR) to my simulation . When I add mR to 
my script, the simulation does not run (I think it gets stuck somehow as it 
does not give me any output that it gives in the case I do not add mR). I was 
wondering what might be the problem. 
I have attached my script below.


from yade import pack
from yade import utils, wrapper

###functions for exporting data
os.mkdir(os.getcwd()+'/VTK/')

def savePropData(O):
from yade import export
import numpy as np

path = os.getcwd()+'/VTK/'
vtkExporter = export.VTKExporter(path)
vtkExporter.exportSpheres(numLabel = O.iter, what = dict( \
  dist = 'b.state.pos.norm()', \
   linVelocity = 'b.state.vel', \
   angVelocity = 'b.state.angVel', \
   mass = 'b.state.mass', \
   mat_rand = 'b.material.id', \
   id='b.id' , \
   numOfContacts = 'len(b.intrs())'))
   

##Material properties  
   

fr=0.9

rho = 3000

r = 0.0005 


Gamma = 0.0 
Theta = 0.0
vB = 0.0 

CapType="Rabinovich"

kkN= 2*(100)
kkS= 2*(30)
ccN= 2*(0.0005)
ccS= 2*(0.0005)
###en=0.3
#time parameters
O.dt = 5*1e-6
it=math.floor(0.1/O.dt )
simT=10
#drum 
drumr=0.05
druml=0.03

mat=O.materials.append(
ViscElCapMat(frictionAngle=fr, density=rho, mR=0.001, Vb=vB, 
gamma=Gamma,  theta=Theta, Capillar=True, CapillarType=CapType, kn=kkN, ks=kkS, 
cn=ccN, cs=ccS )
)
mat2=O.materials.append(
ViscElCapMat(frictionAngle=fr, density=rho, mR=0.001, Vb=vB, 
gamma=Gamma, theta=90, Capillar=True, CapillarType=CapType, kn=kkN, ks=kkS, 
cn=ccN, cs=ccS )
)


#defining the spheres

sp=pack.SpherePack()
sp.makeCloud((drumr-0.7*drumr,drumr-0.7*drumr,0.0015),(drumr+0.7*drumr,drumr+0.7*drumr,0.0285),rMean=r,num=45000)
sp.toSimulation(material=mat)

Nprtcl=len(O.bodies)
print(Nprtcl)



#liquidMigration
VV=0.0
Vmin=0.0

for s in O.bodies:
if not type(s.shape)==wrapper.Sphere:
continue
s.state.Vf=VV * (4/3) * 3.14*(s.shape.radius)**3
s.state.Vmin=Vmin

Drum=geom.facetCylinder(material=mat2,center=(0.05,0.05,0.015), 
segmentsNumber=32, wallMask=4, 
radius=drumr,height=20*druml,orientation=Quaternion(Vector3(0,0,1),(pi/2.0)))
walls = O.bodies.append(Drum)
O.periodic = True
O.cell.setBox(0.5,0.5,0.03)




##engine
O.engines = [
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb(), Bo1_Facet_Aabb()], 
allowBiggerThanPeriod = True),
InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom()],
[Ip2_ViscElCapMat_ViscElCapMat_ViscElCapPhys()],
[Law2_ScGeom_ViscElCapPhys_Basic()],

),
   
NewtonIntegrator(gravity=[0, -9.8, 0]),
RotationEngine(ids=walls,rotationAxis=[0,0,1],rotateAroundZero=True, 
zeroPoint=[0.05,0.05,0.015], angularVelocity=0.45),
PyRunner(command='savePropData(O)', iterPeriod=it)
]

#Functions 




import math

duration=simT/O.dt
O.run( 1 * math.floor(duration),True)




###saving for Restart
O.save('test.bz2')

import pandas as pd

intrState = pd.DataFrame(columns = 
['id1','id2','Fn','Fv','sCrit','normalForce0','normalForce1','normalForce2', 
'shearForce0','shearForce1','shearForce2'], dtype=object)

for ii in O.interactions:
iiState = 
pd.DataFrame({'id1':[ii.id1],'id2':[ii.id2],'Fn':[ii.phys.Fn],'Fv':[ii.phys.Fv],
 'sCrit':[ii.phys.sCrit], 'normalForce0':[ii.phys.normalForce[0]], 
'normalForce1':[ii.phys.normalForce[1]], 
'normalForce2':[ii.phys.normalForce[2]], 'shearForce0':[ii.phys.shearForce[0]], 
'shearForce1':[ii.phys.shearForce[1]], 'shearForce2':[ii.phys.shearForce[2]]})
intrState = intrState.append(iiState,ignore_index = True)

intrState.to_csv('tmpIntrState.csv')


###




Thanks in advance for your response!

Regards,
Roxana


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

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

Hi, I am new to Yade. plz help me with the following:
I want to simulate a load-controlled triaxial test, i.e. axial load is a 
function of time. 
I understand the periodic triaxial test example 
(https://gitlab.com/yade-dev/trunk/blob/master/doc/sphinx/tutorial/06-periodic-triaxial-test.py).
 Now I want to modify this example to apply a time-varying axial load. 
What possible libraries/functions should I explore to find the solution? 
I appreciate any help you can provide. 

-- 
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 #706560]: Removing a box side

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

Status: Open => Answered

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

next time, please do not merge two problems into one question ([1], point 5).
Also more information then just very general one sentence description is 
usually better for good answers [1]

> How to drop particles in the box

Depends on definition of "drop" and "the box".
E.g. using gravity deposition [2].
Or triaxial test tutorial [3].
Or ...

> to a certain void ratio

In general modifying material parameters, "drop" loading or particle size 
distribution.
One version in [3] does exactly a process how to match certain void ratio

> remove one side of the box

O.bodies.erase(bodyID) # [4]

> see them roll

depends on definition of "see".
Probably just using Yade GUI..
Or export them and use external visualizing software (Paraview).
Or ...

Cheers
Jan

[1] https://www.yade-dem.org/wiki/Howtoask
[2] https://yade-dem.org/doc/tutorial-examples.html#gravity-deposition
[3] https://gitlab.com/yade-dev/trunk/-/tree/master/examples/triax-tutorial
[4] https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.BodyContainer.erase

-- 
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 #706529]: Seeking any guidance on beginning using yade

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

Status: Answered => Solved

Hongwei confirmed that the question is solved:
Thanks for your help. I am turing to 22.04 LTS version.

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