'checkUnbalanced' is not defined

Asked by maria aurora natale on 2019-01-15

Hello Yade friends!

 I'm just a beginner using yade. This for sure might be a dummie question, I was wondering if someone can help me.

I'm trying to execute the example script of the oedometric test. The prompt state the following information: "name 'checkUnbalanced' is not defined". I understand that this might be because of a reading procedure from the interpreter. I used a O.step() just after the interaction loop. Nonetheless I still having the same NameError. This is the script:

$ yade-batch --job-threads=1 03-oedometric-test.table 03-oedometric-test.py

# load parameters from file if run in batch
# default values are used if not run from batch
# make rMean, rRelFuzz, maxLoad accessible directly as variables later
from yade.params.table import *

# create box with free top, and ceate loose packing inside the box
from yade import pack, plot

   # sphere, facet, wall
      # the loading plate is a wall, we need to handle sphere+sphere, sphere+facet, sphere+wall
   # the label creates an automatic variable referring to this engine
   # we use it below to change its attributes from the functions called

# 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, unbalanced force can be low as there is only few contacts, but it does not mean the packing is stable
   if O.iter<5000: return
   # the rest will be run only if unbalanced is < .1 (stabilized packing)
   if unbalancedForce()>.1: return
   # add plate at the position on the top of the packing
   # the maximum finds the z-coordinate of the top of the topmost particle
   O.bodies.append(wall(max([b.state.pos[2]+b.shape.radius for b in O.bodies if isinstance(b.shape,Sphere)]),axis=2,sense=-1))
   global plate # without this line, the plate variable would only exist inside this function
   plate=O.bodies[-1] # the last particles is the plate
   # Wall objects are "fixed" by default, i.e. not subject to forces
   # prescribing a velocity will therefore make it move at constant velocity (downwards)
   # start plotting the data now, it was not interesting before
   # next time, do not call this function anymore, but the next one (unloadPlate) instead

Regards and thank all of you in advance!


Question information

English Edit question
Yade Edit question
No assignee Edit question
Solved by:
Bruno Chareyre
Last query:
Last reply:


>"I used a O.step() just after the interaction loop."

seems to be the problem, since in such case O.step() is "just before" defining checkUnbalanced.


Thanks Bruno Chareyre, that solved my question.

Hello Yade community.

One more question regarding this matter. I would like to know which type of incremental load did you used for this test? I mean, which type of pressure?

Thanks again!


Are there different types of pressure?

I think this would be a simple confining pressure.

Thank you so much for your precious time.