porosity control

Asked by Fedor

Hello, dear Team. For controlling porosity (0.43), I maintained a constant stress (-4e4) and decrease friction progressively based on recommendation I found here (stress-free packing asked by Sergei Dorofeenko on 2011-04-16). I tried to modify script from tutorial examples (periodic triax). The thing is that strains and stress are zero during simulation. Could you please help me?

from __future__ import print_function

import time
import datetime
import os

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

#FIXED PARAMETERS

poisson=0.2
R=1e-3
rate=1e-4
dimcell = 0.03
density= 1e5
young=1e9
frictionAngle=radians(30)
targetPorosity=0.43

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

sp = pack.SpherePack()
sp.makeCloud((0, 0, 0), (dimcell, dimcell, dimcell), rMean=R, rRelFuzz=.1, periodic=True)

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

sp.toSimulation(material='spheres')

O.engines = [
        ForceResetter(
               ),
        InsertionSortCollider([Bo1_Sphere_Aabb()]),
        InteractionLoop([Ig2_Sphere_Sphere_ScGeom6D()], [Ip2_CohFrictMat_CohFrictMat_CohFrictPhys()],[Law2_ScGeom6D_CohFrictPhys_CohesionMoment(useIncrementalForm=True,always_use_moment_law=True)]),
 TriaxialStressController(
  stressMask = 7,label='triax'),
 NewtonIntegrator(damping=.2),
        PyRunner(command='addPlotData()', iterPeriod=500),
 ]

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

triax.goal1=triax.goal2=triax.goal3=-40000

while triax.porosity>targetPorosity:
 frictionAngle = 0.95*frictionAngle
 setContactFriction(radians(30))
 print (frictionAngle," porosity:",triax.porosity)
 O.run(500,1)

def addPlotData():
 plot.addData(
         i=O.iter,
         Ezz=log(O.cell.trsf[2,2]),
  Eyy=log(O.cell.trsf[1,1]),
  Exx=log(O.cell.trsf[0,0]),
  szz=utils.getStress()[2,2],
  syy=utils.getStress()[1,1],
  sxx=utils.getStress()[0,0],
         u=utils.porosity()
 )

# define what to plot
plot.plots = {
        'i ': ('sxx', 'syy', 'szz'),
        ' i': ('Exx', 'Eyy', 'Ezz'),
 ' i ':('u')
        # energy plot

}
# show the plot
plot.plot()

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Fedor
Solved:
Last query:
Last reply:
Revision history for this message
Jérôme Duriez (jduriez) said :
#1

Hi,

It looks like you're decreasing friction in a gas-like packing with no contacts in between particles anyway. You first need to reach a confined state before decreasing friction. Running iterations before
while triax.porosity>targetPorosity:

seems mandatory.

Revision history for this message
Fedor (vodovozov) said :
#2

Hello,
thank you for reply. But when I put some iterations there is another issue File "<string>", line 1, in <module>
NameError: name 'addPlotData' is not defined
Please look at my script below
##########################################################
from __future__ import print_function

import time
import datetime
import os

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

#FIXED PARAMETERS

poisson=0.2
R=1e-3
rate=1e-4
dimcell = 0.03
density= 1e5
young=1e9
frictionAngle=radians(30)
targetPorosity=0.43

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

sp = pack.SpherePack()
sp.makeCloud((0, 0, 0), (dimcell, dimcell, dimcell), rMean=R, rRelFuzz=.1, periodic=True)

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

sp.toSimulation(material='spheres')

O.engines = [
        ForceResetter(
               ),
        InsertionSortCollider([Bo1_Sphere_Aabb()]),
        InteractionLoop([Ig2_Sphere_Sphere_ScGeom6D()], [Ip2_CohFrictMat_CohFrictMat_CohFrictPhys()],[Law2_ScGeom6D_CohFrictPhys_CohesionMoment(useIncrementalForm=True,always_use_moment_law=True)]),
 TriaxialStressController(
  stressMask = 7,label='triax'),
 NewtonIntegrator(damping=.2),
        PyRunner(command='addPlotData()', iterPeriod=500),
 ]

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

triax.goal1=triax.goal2=triax.goal3=-10000

while 1:
  O.run(1000, 1)
  unb=unbalancedForce()
  if abs(10000-getStress().trace() / 3.)/10000<0.1:
   O.cell.velGrad=Matrix3(0,0,0,0,0,0,0,0,0)
 break

triax.goal1=triax.goal2=triax.goal3=-40000
while triax.porosity>targetPorosity:
 frictionAngle = 0.95*frictionAngle
 setContactFriction(radians(30))
 print (frictionAngle," porosity:",triax.porosity)
 O.run(500,1)

def addPlotData():
 plot.addData(
         i=O.iter,
         Ezz=log(O.cell.trsf[2,2]),
  Eyy=log(O.cell.trsf[1,1]),
  Exx=log(O.cell.trsf[0,0]),
  szz=utils.getStress()[2,2],
  syy=utils.getStress()[1,1],
  sxx=utils.getStress()[0,0],
         u=utils.porosity()
 )

# define what to plot
plot.plots = {
        'i ': ('sxx', 'syy', 'szz'),
        ' i': ('Exx', 'Eyy', 'Ezz'),
 ' i ':('u')
        # energy plot

}
# show the plot
plot.plot()

Revision history for this message
Jan Stránský (honzik) said :
#3

> NameError: name 'addPlotData' is not defined
>
> O.engines = [
> ...
> PyRunner(command='addPlotData()', iterPeriod=500),
> ]
> ...
> while 1:
> O.run(1000, 1)
> ...
>
> def addPlotData():
> ...

Python executes the code line by line from the top.
In the time of the first O.run, the addPlotData function has not been defined yet, python know anything about it (as it have not read it yet).
Just put the definition before O.run and is should work.

Ideally, you should have created a new question [1], as the error is not related to the porosity control, which your original question is about.

Cheers
Jan

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

Revision history for this message
Fedor (vodovozov) said :
#4

Hello,
thank you very much for clarification. But the problem with zero strains and stress has not solved. I put preliminar iteration but I could not reach a confined state (-1e4).

from __future__ import print_function

import time
import datetime
import os

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

#FIXED PARAMETERS

poisson=0.2
R=1e-3
rate=1e-4
dimcell = 0.03
density= 1e9
young=1e9
frictionAngle=radians(30)
targetPorosity=0.43

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

sp = pack.SpherePack()
sp.makeCloud((0, 0, 0), (dimcell, dimcell, dimcell), rMean=R, rRelFuzz=.1, periodic=True)

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

sp.toSimulation(material='spheres')

O.engines = [
        ForceResetter(
               ),
        InsertionSortCollider([Bo1_Sphere_Aabb()]),
        InteractionLoop([Ig2_Sphere_Sphere_ScGeom6D()], [Ip2_CohFrictMat_CohFrictMat_CohFrictPhys()],[Law2_ScGeom6D_CohFrictPhys_CohesionMoment(useIncrementalForm=True,always_use_moment_law=True)]),
 TriaxialStressController(
  stressMask = 7,label='triax'),
 NewtonIntegrator(damping=.2),
        PyRunner(command='addPlotData()', iterPeriod=500),
 ]

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

triax.goal1=triax.goal2=triax.goal3=-10000

def addPlotData():
 plot.addData(
         i=O.iter,
         Ezz=log(O.cell.trsf[2,2]),
  Eyy=log(O.cell.trsf[1,1]),
  Exx=log(O.cell.trsf[0,0]),
  szz=utils.getStress()[2,2],
  syy=utils.getStress()[1,1],
  sxx=utils.getStress()[0,0],
         u=utils.porosity()
 )

while 1:
 O.run(100, 1)
 print(getStress().trace() / 3.)
 if getStress().trace() / 3.<-10000:
    break

triax.goal1=triax.goal2=triax.goal3=-40000
while triax.porosity>targetPorosity:
 frictionAngle = 0.95*frictionAngle
 setContactFriction(radians(30))
 print (frictionAngle," porosity:",triax.porosity)
 O.run(500,0)

# define what to plot
plot.plots = {
        'i ': ('sxx', 'syy', 'szz'),
        ' i': ('Exx', 'Eyy', 'Ezz'),
 ' i ':('u')
        # energy plot

}
# show the plot
plot.plot()

Revision history for this message
Fedor (vodovozov) said :
#5

Hello,
I double check everything, I applied stress but I cannot compress specimen. I need help)

Revision history for this message
Fedor (vodovozov) said :
#6

Thank you