error when reducing psdSizes in drainage-2PFV-Yuan_and_Chareyre_2017.py

Asked by Saeed on 2019-02-08

Hi There,
when i reducing particle size distribution in UnsaturatedEngine() or TwoPhaseFlowEngine() and run code , receiving some error and crash :

WARNING! rmin>rmax. rmin=3.08144 ,rmax=1e-10
WARNING! rmin>rmax. rmin=1.78088 ,rmax=1e-10
WARNING! rmin>rmax. rmin=1.81328 ,rmax=1e-10
WARNING! rmin>rmax. rmin=1.28869 ,rmax=1e-10
WARNING! rmin>rmax. rmin=1.76467 ,rmax=1e-10
WARNING! rmin>rmax. rmin=1.88304 ,rmax=1e-10
WARNING! rmin>rmax. rmin=1.80516 ,rmax=1e-10
WARNING! rmin>rmax. rmin=1.81328 ,rmax=1e-10
WARNING! rmin>rmax. rmin=1.80516 ,rmax=1e-10
WARNING! rmin>rmax. rmin=1.88304 ,rmax=1e-10
WARNING! rmin>rmax. rmin=3.08144 ,rmax=1e-10
WARNING! rmin>rmax. rmin=2.00033 ,rmax=1e-10
WARNING! rmin>rmax. rmin=2.00033 ,rmax=1e-10
WARNING! rmin>rmax. rmin=1.78088 ,rmax=1e-10
WARNING! rmin>rmax. rmin=1.76467 ,rmax=1e-10
WARNING! rmin>rmax. rmin=1.28869 ,rmax=1e-10
WARNING! rmin>rmax. rmin=3.46775 ,rmax=1e-10
WARNING! rmin>rmax. rmin=3.46775 ,rmax=1e-10

my PSD is :
psdSizes,psdCumm=[.1,0.11,0.849,0.85,1.0,1.40],[0.,0.35,0.35,0.70,.70,1.]

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Chao Yuan
Solved:
2019-07-27
Last query:
2019-07-27
Last reply:
2019-02-18

This question was reopened

Robert Caulk (rcaulk) said : #1

Hello,

Please provide an MWE [1].

With out an MWE all I can do is ctrl-F the source code for that error :-) Brings me to [2] which leads to [3].

Cheers,

Robert

[1]https://yade-dem.org/wiki/Howtoask
[2]https://gitlab.com/yade-dev/trunk/blob/master/pkg/pfv/TwoPhaseFlowEngine.cpp#L346
[3]https://gitlab.com/yade-dev/trunk/blob/master/lib/triangulation/FlowBoundingSphere.ipp#L739

Saeed (saeed0668191) said : #2

Hello Robert
Thank you

I got updating yadedaily to the latest package but my problem not solved

code is :

import matplotlib; matplotlib.rc('axes',grid=True)
from yade import pack
import pylab
from numpy import *

utils.readParamsFromTable(seed=1,num_spheres=1000,compFricDegree = 15.0)
from yade.params import table

seed=table.seed
num_spheres=table.num_spheres# number of spheres
compFricDegree = table.compFricDegree # initial contact friction during the confining phase (will be decreased during the REFD compaction process)
confiningS=-1e5

## creat a packing with a specific particle side distribution (PSD)
psdSizes,psdCumm=[.1,0.11,0.849,0.85,1.0,1.40],[0.,0.35,0.35,0.70,.70,1.]
sp=pack.SpherePack()
mn,mx=Vector3(0,0,0),Vector3(10,10,10)
sp.makeCloud(minCorner=mn,maxCorner=mx,psdSizes=psdSizes,psdCumm=psdCumm,distributeMass=True,num=num_spheres,seed=seed)

## create material #0, which will be used as default
O.materials.append(FrictMat(young=15e7,poisson=.4,frictionAngle=radians(compFricDegree),density=2600,label='spheres'))
O.materials.append(FrictMat(young=15e7,poisson=.4,frictionAngle=0,density=0,label='frictionless'))

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

O.bodies.append([utils.sphere(center,rad,material='spheres') for center,rad in sp])

triax=TriaxialStressController(
 internalCompaction=True,
 goal1=confiningS,
 goal2=confiningS,
 goal3=confiningS,
 max_vel=10,
 label="triax"
)

newton=NewtonIntegrator(damping=0.4)

O.engines=[
 ForceResetter(),
 InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Box_Aabb()]),
 InteractionLoop(
  [Ig2_Sphere_Sphere_ScGeom(),Ig2_Box_Sphere_ScGeom()],
  [Ip2_FrictMat_FrictMat_FrictPhys()],
  [Law2_ScGeom_FrictPhys_CundallStrack()]
 ),
 GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=100,timestepSafetyCoefficient=0.8),
 triax,
 newton
]

while 1:
  O.run(1000,True)
  unb=unbalancedForce()
  if unb<0.01 and abs(triax.goal1-triax.meanStress)/abs(triax.goal1)<0.001:
    break

#############################
## REACH NEW EQU. STATE ###
#############################
finalFricDegree = 30 # contact friction during the deviatoric loading

#We move to deviatoric loading, let us turn internal compaction off to keep particles sizes constant
triax.internalCompaction=False
# Change contact friction (remember that decreasing it would generate instantaneous instabilities)
setContactFriction(radians(finalFricDegree))

while 1:
  O.run(1000,True)
  unb=unbalancedForce()
  if unb<0.001 and abs(triax.goal1-triax.meanStress)/abs(triax.goal1)<0.001:
    break

triax.depth0=triax.depth
triax.height0=triax.height
triax.width0=triax.width
O.save('1kPacking.yade') #save the packing, which can be reloaded later.

O.run(1000,True)
ei0=-triax.strain[0];ei1=-triax.strain[1];ei2=-triax.strain[2]
si0=-triax.stress(0)[0];si1=-triax.stress(2)[1];si2=-triax.stress(4)[2]

from yade import plot
O.engines=O.engines+[PyRunner(iterPeriod=20,command='history()',dead=1,label='recorder')]

def history():
   plot.addData(e11=-triax.strain[0]-ei0, e22=-triax.strain[1]-ei1, e33=-triax.strain[2]-ei2,
      s11=-triax.stress(0)[0]-si0,
      s22=-triax.stress(2)[1]-si1,
      s33=-triax.stress(4)[2]-si2,
      pc=-unsat.bndCondValue[2],
      sw=unsat.getSaturation(False),
      i=O.iter
      )

plot.plots={'pc':('sw',None,'e22')}
plot.plot()

#######################################################
## Drainage Test under oedometer conditions ###
#######################################################
##oedometer conditions
triax.stressMask=2
triax.goal1=triax.goal3=0
goalTop=triax.stress(3)[1]
triax.goal2=goalTop
triax.wall_bottom_activated=0
recorder.dead=0

##Instantiate a two-phase engine
unsat=TwoPhaseFlowEngine()
meanDiameter=(O.bodies[-1].shape.radius + O.bodies[6].shape.radius) / 2.

##set boundary conditions, the drainage is controlled by decreasing W-phase pressure and keeping NW-phase pressure constant
unsat.bndCondIsPressure=[0,0,1,1,0,0]
unsat.bndCondValue=[0,0,-1e8,0,0,0]
unsat.isPhaseTrapped=True #the W-phase can be disconnected from its reservoir
unsat.initialization()
unsat.surfaceTension = 10

##start invasion, the data of normalized pc-sw-strain will be written into pcSwStrain.txt
file=open('pcSwStrain.txt',"w")
for pg in arange(1.0e-5,15.0,0.1):
  #increase gaz pressure at the top boundary
  unsat.bndCondValue=[0,0,(-1.0)*pg*unsat.surfaceTension/meanDiameter,0,0,0]
  #compute the evolution of interfaces
  unsat.invasion()
  #save the phases distribution in vtk format, to be displayed by paraview
  unsat.savePhaseVtk("./")
  #compute and apply the capillary forces on each particle
  unsat.computeCapillaryForce()
  for b in O.bodies:
    O.forces.setPermF(b.id, unsat.fluidForce(b.id))
  #reac
  while 1:
    O.run(1000,True)
    unb=unbalancedForce()
    if unb<0.01:
      break
  file.write(str(pg)+" "+str(unsat.getSaturation(False))+" "+str(triax.strain[1]-ei1)+"\n")
file.close()

---------------------------------------
the original code start psdSizes with 0.5 but when i reducing psdSizes and starts with 0.1 , receive this error and crash:

RNING! rmin>rmax. rmin=3.08144 ,rmax=1e-10
WARNING! rmin>rmax. rmin=1.78088 ,rmax=1e-10
WARNING! rmin>rmax. rmin=1.81328 ,rmax=1e-10
WARNING! rmin>rmax. rmin=1.28869 ,rmax=1e-10
WARNING! rmin>rmax. rmin=1.76467 ,rmax=1e-10
WARNING! rmin>rmax. rmin=1.88304 ,rmax=1e-10
WARNING! rmin>rmax. rmin=1.80516 ,rmax=1e-10
WARNING! rmin>rmax. rmin=1.81328 ,rmax=1e-10
WARNING! rmin>rmax. rmin=1.80516 ,rmax=1e-10
WARNING! rmin>rmax. rmin=1.88304 ,rmax=1e-10
WARNING! rmin>rmax. rmin=3.08144 ,rmax=1e-10
WARNING! rmin>rmax. rmin=2.00033 ,rmax=1e-10
WARNING! rmin>rmax. rmin=2.00033 ,rmax=1e-10
WARNING! rmin>rmax. rmin=1.78088 ,rmax=1e-10
WARNING! rmin>rmax. rmin=1.76467 ,rmax=1e-10
WARNING! rmin>rmax. rmin=1.28869 ,rmax=1e-10
WARNING! rmin>rmax. rmin=3.46775 ,rmax=1e-10
WARNING! rmin>rmax. rmin=3.46775 ,rmax=1e-10

Chao Yuan (chaoyuan2012) said : #3

hi,
the timestep you are using for preparing the sample is too large, leading to some grains out of the box. Change it to:
O.dt=.1*PWaveTimeStep()
O.dynDt=False
it should work.

cheers,
chao

Saeed (saeed0668191) said : #5

Thanks Chao Yuan, that solved my question.
another question
after drying ends ,I want to wetting model for example to sr 50% . is it possible?

Best Chao Yuan (chaoyuan2012) said : #6

Yes. you can continue to simulate wetting by decreasing capillary pressure:

unsat.isDrainageActivated=False
unsat.isImbibitionActivated=True
for pg in arange(15.0,1.0e-5,-0.1):
  #decrease gaz pressure at the top boundary
  unsat.bndCondValue=[0,0,(-1.0)*pg*unsat.surfaceTension/meanDiameter,0,0,0]
  unsat.invasion()
  if unsat.getSaturation(False)>0.5:
      break

the entry capillary pressure of wetting follows [1].
chao

[1] Sweijen, Thomas, et al. "The effects of swelling and porosity change on capillarity: DEM coupled with a pore-unit assembly method." Transport in porous media 113.1 (2016): 207-226.

Saeed (saeed0668191) said : #7

Thanks Chao Yuan, that solved my question.