yade.utils.getStressProfile_contact() - did not match C++ signature

Asked by agastya

Hello All,

I am running this example 'Gravity Deposition' with a slight modification:

# gravity deposition in box, showing how to plot and save history of data,
# and how to control the simulation while it is running by calling
# python functions from within the simulation loop

# import yade modules that we will use below
from yade import pack, plot

# create rectangular box from facets
O.bodies.append(geom.facetBox((.5,.5,.5),(.5,.5,.5),wallMask=63))

# create empty sphere packing
# sphere packing is not equivalent to particles in simulation, it contains only the pure geometry
sp=pack.SpherePack()
# generate randomly spheres with uniform radius distribution
sp.makeCloud((0,0,0),(1,1,1),rMean=.05,rRelFuzz=.5)
# add the sphere pack to the simulation
sp.toSimulation()

O.engines=[
   ForceResetter(),
   InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
   InteractionLoop(
      # handle sphere+sphere and facet+sphere collisions
      [Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom()],
      [Ip2_FrictMat_FrictMat_FrictPhys()],
      [Law2_ScGeom_FrictPhys_CundallStrack()]
   ),
   NewtonIntegrator(gravity=(-9.81,0,0),damping=0.5),-----------------------------------------(1)
   # call the checkUnbalanced function (defined below) every 2 seconds
   PyRunner(command='checkUnbalanced()',realPeriod=2),
   # call the addPlotData function every 200 steps
   PyRunner(command='addPlotData()',iterPeriod=100)
]
O.dt=.5*PWaveTimeStep()

# enable energy tracking; any simulation parts supporting it
# can create and update arbitrary energy types, which can be
# accessed as O.energy['energyName'] subsequently
O.trackEnergy=True

# if the unbalanced forces goes below .05, the packing
# is considered stabilized, therefore we stop collected
# data history and stop
def checkUnbalanced():
   if unbalancedForce()<.05:
      O.pause()
      plot.saveDataTxt('bbb.txt.bz2')
      # plot.saveGnuplot('bbb') is also possible

# collect history of data which will be plotted
def addPlotData():
   # each item is given a names, by which it can be the unsed in plot.plots
   # the **O.energy converts dictionary-like O.energy to plot.addData arguments
   plot.addData(i=O.iter,CN=utils.getStressProfile_contact(volume=1,ncell=10,dz=1.00,zRef=0.00))----------------------------(2)

# define how to plot data: 'i' (step number) on the x-axis, unbalanced force
# on the left y-axis, all energies on the right y-axis
# (O.energy.keys is function which will be called to get all defined energies)
# None separates left and right y-axis
#plot.plots={'i':('unbalanced',None,O.energy.keys)}
plot.plots={'i':('CN')}
# show the plot on the screen, and update while the simulation runs
plot.plot()

O.saveTmp()

Basically I have just changed the direction of gravity and I am trying to check the static stress profile in the pile.

But doing this throws an error:
ArgumentError: Python argument types in
    yade._utils.getStressProfile_contact()
did not match C++ signature:
    getStressProfile_contact(double volume, int nCell, double dz, double zRef)

Also true with getDepthProfiles/ getStressProfile,etc.
The simulation obviously runs fine without any problem.

I am on the latest YADE version,"Yade 2018.02a-11-dff52bc~xenial".

What exactly is causing this problem?
How to resolve it?
How to get the stress profile otherwise?

Thank you,
Agastya.

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Jérôme Duriez
Solved:
Last query:
Last reply:
Revision history for this message
Raphaël Maurin (raphael-maurin) said :
#1

Dear Agastya,

getStressProfile_contact is a function to evaluate the stress tensor on a vertical grid (along z) of spacing dz and starting from zRef. Therefore, it returns a vector of stress tensor. This means that there will be a problem in the line

plot.addData(i=O.iter,CN=utils.getStressProfile_contact(volume=1,ncell=10,dz=1.00,zRef=0.00))----------------------------(2)

As you are trying to plot a vector of 3x3 matrix, which does not have any meaning.

Second, I believe that the error you are pointing out comes from the fact that you wrote "ncell" instead of "nCell" in the abovementionned line.

Raphael

Revision history for this message
agastya (agastya10) said :
#2

Hello Raphael,

Thank you for your reply, but I don't think I clearly understand what you mean by 'returns a vector of stress tensor'. Can you please elaborate on this point?
And replacing ncell with nCell did resolve the above mentioned error but gives a new error :

"plot.addData given unhandled sequence type(is a tuple , must be number or Vector3/Matrix3/Vector2)"

just as you mentioned.

Thank you.
Agastya.

Revision history for this message
agastya (agastya10) said :
#3

Hello Raphael,

To be more precise what I want to know is that whether the function getStressProfile_contact() returns a vector with a scalar value at each grid point or a vector with a 3x3 matrix at each grid point.

Thank you.

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

Hi Agastya,

It's exactly "a vector with a 3x3 matrix at each grid point"

To be sure about that, see

https://github.com/yade/trunk/blob/243ee130ba97e628763d36c1b2442700e38d9185/pkg/dem/Shop_02.cpp#L484
and
https://github.com/yade/trunk/blob/243ee130ba97e628763d36c1b2442700e38d9185/pkg/dem/Shop_02.cpp#L559

in the source code of getStressProfile_contact()

Revision history for this message
agastya (agastya10) said :
#5

Thanks Jérôme Duriez, that solved my question.