PeriTriaxController not initiating next stage

Asked by Danny (Dingeman) van der Haven

Hello,

I'm trying to do a uniaxial compression of a periodic box with a 3x3x3 grid of particles.

I'm implementing periodic boundary conditions for level-set particles. I had some unexpected results (level set spheres gave a much lower density). Now I want to do a unit test by comparing a very simple simulation using analytical spheres and level-set spheres.

Whenever I run the simulation (see code below), the pressure increases to the target pressure properly. However, hereafter the simulation keeps iterating but does not initiate the decompression stage defined by compactionFinished(). I have attempted to change maxUnbalanced and relStressTol to see if the issue is there but had no success.

Would any of you happen to know why the next stage is not initiated by PeriTriaxController?

With kind regards,
Danny

###########################################################
# encoding: utf-8

from __future__ import print_function
sigmaIso = -1e6
ydim = 1.0
xdim = 1.0
zdim = 1.0
r = 1.0/3.0/2.0

#import matplotlib
#matplotlib.use('Agg')

# generate loose packing
from yade import pack, qt, plot

O.periodic = True

O.bodies.append(
        [
                # In xy-plane
                sphere(center=(r, r, r), radius=r, fixed=True),
                sphere(center=(3*r, r, r), radius=r, fixed=True),
                sphere(center=(5*r, r, r), radius=r, fixed=True),
                sphere(center=(r, 3*r, r), radius=r, fixed=True),
                sphere(center=(3*r, 3*r, r), radius=r, fixed=True),
                sphere(center=(5*r, 3*r, r), radius=r, fixed=True),
                sphere(center=(r, 5*r, r), radius=r, fixed=True),
                sphere(center=(3*r, 5*r, r), radius=r, fixed=True),
                sphere(center=(5*r, 5*r, r), radius=r, fixed=True),
                # Repeat in z-direction
                sphere(center=(r, r, 3*r), radius=r, fixed=True),
                sphere(center=(3*r, r, 3*r), radius=r, fixed=True),
                sphere(center=(5*r, r, 3*r), radius=r, fixed=True),
                sphere(center=(r, 3*r, 3*r), radius=r, fixed=True),
                sphere(center=(3*r, 3*r, 3*r), radius=r, fixed=True),
                sphere(center=(5*r, 3*r, 3*r), radius=r, fixed=True),
                sphere(center=(r, 5*r, 3*r), radius=r, fixed=True),
                sphere(center=(3*r, 5*r, 3*r), radius=r, fixed=True),
                sphere(center=(5*r, 5*r, 3*r), radius=r, fixed=True),
                # Repeat in z-direction
                sphere(center=(r, r, 5*r), radius=r, fixed=True),
                sphere(center=(3*r, r, 5*r), radius=r, fixed=True),
                sphere(center=(5*r, r, 5*r), radius=r, fixed=True),
                sphere(center=(r, 3*r, 5*r), radius=r, fixed=True),
                sphere(center=(3*r, 3*r, 5*r), radius=r, fixed=True),
                sphere(center=(5*r, 3*r, 5*r), radius=r, fixed=True),
                sphere(center=(r, 5*r, 5*r), radius=r, fixed=True),
                sphere(center=(3*r, 5*r, 5*r), radius=r, fixed=True),
                sphere(center=(5*r, 5*r, 5*r), radius=r, fixed=True)
        ]
)

O.cell.hSize = Matrix3(xdim, 0.0, 0.0, 0.0, ydim, 0.0, 0.0, 0.0, zdim)

O.engines = [
        ForceResetter(),
        InsertionSortCollider([Bo1_Sphere_Aabb()]),
        InteractionLoop([Ig2_Sphere_Sphere_ScGeom()], [Ip2_FrictMat_FrictMat_FrictPhys()], [Law2_ScGeom_FrictPhys_CundallStrack()]),
        PeriTriaxController(
                label='triax',
                # specify target values and whether they are strains or stresses
                goal=(0, 0, sigmaIso),
                stressMask=4,
                # type of servo-control
                dynCell=True,
                maxStrainRate=(0, 0, 0.005),
                # wait until the unbalanced force goes below this value
                maxUnbalanced=.05,
                relStressTol=1e-4,
                # call this function when goal is reached and the packing is stable
                doneHook='compactionFinished()'
        ),
        NewtonIntegrator(damping=.2),
        PyRunner(command='addPlotData()', iterPeriod=100),
]
O.dt = .25 * PWaveTimeStep()

def compactionFinished():
 # set the current cell configuration to be the reference one
 O.cell.trsf = Matrix3.Identity
 # change control type: keep constant confinement in x,y, 20% compression in z
 triax.goal = (0, 0, .2)
 triax.stressMask = 3
 # allow faster deformation along x,y to better maintain stresses
 triax.maxStrainRate = (0, 0, 0.005)
 # next time, call triaxFinished instead of compactionFinished
 triax.doneHook = 'triaxFinished()'
 # do not wait for stabilization before calling triaxFinished
 triax.maxUnbalanced = 10

def triaxFinished():
 print('Finished')
        plot.saveDataTxt('results_ptt3.txt',vars=('compDens','sz'))
 O.pause()

totalMass = 0
for b in O.bodies:
        totalMass+=b.state.mass

def addPlotData():
 plot.addData(
         unbalanced=unbalancedForce(),
         i=O.iter,
         sz=abs(triax.stress[2]),
                compDens=totalMass/O.cell.volume
 )

# ez=abs(triax.strain[2]),

print("The total mass is", totalMass)
print("The number of particles is",len(O.bodies))
#print("The volume is", O.cell.volume)

# define what to plot
plot.plots = {
        'i': ('unbalanced'),
        'compDens': ('sz'),
}
# show the plot
plot.plot()

O.run()

Question information

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

Hi Danny,

Did you monitor unbalancedForce() (to compare with PeriTriaxController.maxUnbalanced) and abs( (sigma_ii - goal)/goal) for every stress-controlled axis i (to compare with PeriTriaxController.relStressTol) ?

If, for some reason, those would stay higher than their PeriTriaxController reference values, it would be just normal next stage does not start.

Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#2

 > # allow faster deformation along x,y to better maintain stresses
 > triax.maxStrainRate = (0, 0, 0.005)

0 is faster? ;)

B

Revision history for this message
Danny (Dingeman) van der Haven (dlhvdh) said (last edit ):
#3

Hi Jerome and Bruno,

Thank you for your replies.

I checked and the simulations always reach abs((sigma_ii - goal)/goal) < PeriTriaxController.relStressTol for the z-axis. Because stressMask = 4, only the z-axis stress should matter.

On another note, PeriTriaxController.relStressTol does not allow itself to be plotted. However, I can print it and the value it has is as specified in the setup script. I can also create a boolean to check if abs((sigma_ii - goal)/goal) < PeriTriaxController.relStressTol, which becomes true near the end of the defined compression stage.

If I do not fix the particles then the simulation reaches unbalancedForce() < PeriTriaxController.maxUnbalanced. The simulation advances to the next stage and completes successfully. However, this is only the case if I set the target stress to -0.8e6 or smaller absolute values. If I set the target stress to -1e6, the simulation stops the compression around sigma_zz = -0.83e6 and does not continue to the next stage but does keep iterating. (The unbalancedForce() is well below the tolerance.) Why does YADE stop the compression and how can we reach higher absolute stress values?

If I fix the particles then unbalancedForce() = NaN. The target stress is reached but the simulation does not initiate the decompression stage. Likely, PeriTriaxController cannot evaluate unbalancedForce() < PeriTriaxController.maxUnbalanced due to the NaN value. Is there a way to circumvent this? I would very much like to compare fixed normal particles vs fixed level set particles.

I am sure the next stage is not reached in case of fixed particles, because if I replace the next stage with

def compactionFinished():
           triax.maxUnbalanced = 10

the value of maxUnbalanced in PeriTriaxController (labelled 'triax') has not changed.

@Bruno: If I set triax.maxStrainRate=(0,0,0) for any stage, that stage stops progressing at all.

Kind regards,
Danny

Revision history for this message
Jérôme Duriez (jduriez) said :
#4

Regarding your NaN unbalanced force values: this is by design of unbalancedForce() with fixed (non-dynamic) particles.

I would advice against combining unbalancedForce considerations (to advance a simulation) with the use of fixed particles.

Revision history for this message
Danny (Dingeman) van der Haven (dlhvdh) said :
#5

I agree, considering unbalancedForce() with fixed particles does not make much sense. There doesn't seem to be an option to disable the maxUnbalanced threshold though. Setting PeriTriaxController.maxUnbalanced() to zero does not appear to disable it.

Revision history for this message
Launchpad Janitor (janitor) said :
#6

This question was expired because it remained in the 'Open' state without activity for the last 15 days.