RotBondPrms: mismatch with C++ signature

Asked by Michele Griffa

Hello everybody

I just want to report an error in the benchmark script for 2D shear cell experiment, /Python/esys/lsm/benchmarks/gouge2d/gouge2dbench.py

While I was trying to run a ESyS-Particle script for simulating a 2D shear cell experiment derived from the that one, I got this error regarding the elements of RotBondPrms:

mpirun -np 2 -machinefile hosts.txt mpipython gouge2dbench_MGriffa.py 1 1

[...]

Traceback (most recent call last):
  File "gouge2dbench_MGriffa.py", line 237, in <module>
    runSimulation()
  File "gouge2dbench_MGriffa.py", line 107, in runSimulation
    bip = RotBondPrms(bondTag,name,normalK,shearK,torsionK,bendingK,normalBrkForce,shearBrkForce,torsionBrkForce,bendingBrkForce)

Boost.Python.ArgumentError: Python argument types in
    RotBondPrms.__init__(RotBondPrms, int, str, float, float, float, float, float, float, float, float)
did not match C++ signature:
    __init__(_object*, std::string name, double normalK, double shearK, double torsionK, double bendingK, double normalBrkForce, double shearBrkForce, double torsionBrkForce, double bendingBrkForce, int tag=-2147483648)

Indeed, the error disappears if the bondTag element is defined as the last one instead of the first one and, in the Users Guide, chapter 5, Section 5.1.4, page 41 (version of March 19th 2009), there is the right definition of an object of that class.
I think gouge2dbench.py just needs to be updated.
Also the ESyS-Particle Python API must be update because it reports the tag as the first attribute for the class RotBondPrms.

Thanks a lot

Michele

Question information

Language:
English Edit question
Status:
Answered
For:
ESyS-Particle Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Dion Weatherley (d-weatherley) said :
#1

Hi Michele,

Thanks for reporting this error. I assume you are currently using ESyS-Particle-v2.0-rc1. Unfortunately this version is a transition version between the 2.0.0beta version and the 2.0 stable version to be released very soon. The 2.0-rc1 version has a slightly different Python interface to 2.0.0beta and that of the Tutorial and Python API. The new 2.0 stable release aims to fix most of these incompatibilities and a new Python API and Tutorial will be released along with the new source code. I hope to officially release 2.0 stable very soon. In the meantime, you can download a copy of version 2.0 source code from our SVN repository:

svn checkout https://svn.esscc.uq.edu.au/svn/esys3/lsm/trunk ESyS-Particle-2.0

The v2.0 release will supersede all previous versions so you are encouraged to familiarise with this version and report and problems you find.

Regarding your specific problem in this question, you are correct that the problem is resolved if the bondTag is provided as the last argument of RotBondPrms(...) instead of the first argument. Having the bondTag as the last argument is the preferred method but we may permit either syntax in v2.0 for backwards compatibility.

I hope this helps.

Cheers,

Dion.

Revision history for this message
zhongw (qhzw224) said :
#2

Dear All !
I meet the similar problem like Michele. I install Esys-particle at November,2014.While I was trying to run a ESyS-Particle script for simulating a 3D compress experiment , I got this error message of RotBondPrms:

Traceback (most recent call last):
  File "u_compress.py", line 57, in <module>
    truncated = 0.1,
Boost.Python.ArgumentError: Python argument types in
    RotBondPrms.__init__(RotBondPrms)
did not match C++ signature:
    __init__(_object*, std::string name, double normalK, double shearK, double torsionK, double bendingK, double normalBrkForce, double shearBrkForce, double torsionBrkForce, double bendingBrkForce, int tag, bool scaling, bool meanR_scaling, double truncated)
    __init__(_object*, std::string name, double normalK, double shearK, double torsionK, double bendingK, double normalBrkForce, double shearBrkForce, double torsionBrkForce, double bendingBrkForce, int tag, bool scaling, bool meanR_scaling)
    __init__(_object*, std::string name, double normalK, double shearK, double torsionK, double bendingK, double normalBrkForce, double shearBrkForce, double torsionBrkForce, double bendingBrkForce, int tag, bool scaling)
    __init__(_object*, std::string name, double normalK, double shearK, double torsionK, double bendingK, double normalBrkForce, double shearBrkForce, double torsionBrkForce, double bendingBrkForce, int tag)

My script is :
--------------------------------------------------------------------
from esys.lsm import *
from esys.lsm.util import *
from esys.lsm.geometry import *
from WallLoader import WallLoaderRunnable
from ServoWallLoader import ServoWallLoaderRunnable
from esys.lsm.util import Vec3, BoundingBox

#instantiate a simulation object:
sim = LsmMpi (numWorkerProcesses = 6, mpiDimList = [3,2,1])
xdim=100
ydim=100
zdim=100
minR = 0.9
maxR = 4.5
timestep = 60000
ramptime = 500
velocity = 0.001

#initialise the neighbour search algorithm:
sim.initNeighbourSearch (
particleType = "RotSphere",
gridSpacing = 2.5*maxR,
verletDist = 0.2*minR
)
#set the number of timesteps and timestep increment:
sim.setNumTimeSteps (timestep)
sim.setTimeStepSize (1.0e-3)
#specify the spatial domain for the simulation
domain = BoundingBox(Vec3(0,0,0), Vec3(120,120,120))
sim.setSpatialDomain (domain)
#create a prism of spherical particles:
sim.readGeometry("model-3d.geo")

#create rotational elastic-brittle bonds between clusters:
pp_bonds = sim.createInteractionGroup (
RotBondPrms(
name="pp_bonds",
normalK = 5.0e4,
shearK = 5.0e4,
torsionK = 5.0e4,
bendingK = 5.0e4,
normalBrkForce = 100.0,
shearBrkForce = 100.0,
torsionBrkForce = 100.0,
bendingBrkForce = 100.0,
tag=1,
scaling = True,
meanT_scaling = True,
truncated = 0.1,
#beta1 = 0.0,
#beta2 =0.0
)
)

#initialise frictional interactions for unbonded particles:
sim.createInteractionGroup (
NRotElasticPrms(
name="contaction",
normalK=5.0e4,
scaling = True
)
)

sim.createInteractionGroup (
FrictionPrms(
name="friction",
youngsModulus=5.0e4,
poissonsRatio=0.25,
dynamicMu=0.4,
staticMu=0.6
)
)

#sim.setParticleDensity (
#tag = 1,
#mask = -1,
#Density = 2500.0
#)

#create an exclusion between bonded and frictional interactions:
sim.createExclusion (
interactionName1 = "pp_bonds",
interactionName2 = "friction"
)

#create an exclusion between bonded and frictional interactions:
sim.createExclusion (
interactionName1 = "pp_bonds",
interactionName2 = "contaction"
)

############################## wall #########################################

#create a wall at the bottom of the model:
sim.createWall (
name = "bottom_wall",
posn = Vec3(0.0000, 0.0000, 0.0000),
normal = Vec3(0.0000, 1.0000, 0.0000)
)

#create a wall at the top of the model:
sim.createWall (
name = "top_wall",
posn = Vec3(0.0000, ydim, 0.0000),
normal = Vec3(0.0000, -1.0000, 0.0000)
)

#specify elastic repulsion from the bottom wall:
sim.createInteractionGroup (
NRotElasticWallPrms (
name = "bottom_wall_repel",
wallName = "bottom_wall",
normalK = 100000.0
)
)

#specify elastic repulsion from the top wall:
sim.createInteractionGroup (
NRotElasticWallPrms (
name = "top_wall_repel",
wallName = "top_wall",
normalK = 100000.0
)
)

#add translational viscous damping:
sim.createInteractionGroup (
LinDampingPrms(
name="damping1",
viscosity=10,
maxIterations=100
)
)

#add rotational viscous damping:
sim.createInteractionGroup (
RotDampingPrms(
name="damping2",
viscosity=10,
maxIterations=100
)
)

############################ load #################################

#add a wall loader to move the top wall:
wall_loader1 = WallLoaderRunnable(
LsmMpi = sim,
wallName = "top_wall",
vPlate = Vec3 (0.0, -1*velocity, 0.0),
startTime = 0,
rampTime = ramptime
)
sim.addPreTimeStepRunnable (wall_loader1)

#add a wall loader to move the bottom wall:
wall_loader2 = WallLoaderRunnable(
LsmMpi = sim,
wallName = "bottom_wall",
vPlate = Vec3 (0.0, velocity, 0.0),
startTime = 0,
rampTime = ramptime
)
sim.addPreTimeStepRunnable (wall_loader2)

########################### record ######################################

#create a FieldSaver to store number of bonds:
sim.createFieldSaver (
InteractionScalarFieldSaverPrms(
interactionName="pp_bonds",
fieldName="count",
fileName="u-nbonds.dat",
fileFormat="SUM",
beginTimeStep=0,
endTimeStep=timestep,
timeStepIncr=10
)
)

#create a FieldSaver to store the total kinetic energy of the particles:
sim.createFieldSaver (
ParticleScalarFieldSaverPrms(
fieldName="e_kin",
fileName="u-ekin.dat",
fileFormat="SUM",
beginTimeStep=0,
endTimeStep=timestep,
timeStepIncr=10
)
)
#create a FieldSaver to store potential energy stored in bonds:
sim.createFieldSaver (
InteractionScalarFieldSaverPrms(
interactionName="pp_bonds",
fieldName="potential_energy",
fileName="u-epot.dat",
fileFormat="SUM",
beginTimeStep=0,
endTimeStep=timestep,
timeStepIncr=10
)
)

#create a FieldSaver to wall positions:
posn_saver = WallVectorFieldSaverPrms(
wallName=["bottom_wall", "top_wall"],
fieldName="Position",
fileName="u-out_Position.dat",
fileFormat="RAW_SERIES",
beginTimeStep=0,
endTimeStep=timestep,
timeStepIncr=10
)
sim.createFieldSaver(posn_saver)

#create a FieldSaver to wall forces:
force_saver = WallVectorFieldSaverPrms(
wallName=["bottom_wall", "top_wall"],
fieldName="Force",
fileName="u-out_Force.dat",
fileFormat="RAW_SERIES",
beginTimeStep=0,
endTimeStep=timestep,
timeStepIncr=10
)
sim.createFieldSaver(force_saver)

sim.createCheckPointer (
CheckPointPrms (
fileNamePrefix = "u-snapshot",
beginTimeStep = 0,
endTimeStep = timestep,
timeStepIncr = 1000
)
)

#execute the simulation:
sim.run()
-----------------------------------------------------------------
Thanks a lot
ZhongWen

Revision history for this message
Dion Weatherley (d-weatherley) said :
#3

Hi ZhongWen,

I think the source of the error is a spelling mistake. Replace "meanT_scaling" with "meanR_scaling".

You may also need to uncomment the "beta1" and "beta2" arguments to RotBondPrms and set both of these parameters a value of 1.0.

Alternatively, try removing the comma at the end of the "truncated" line and leave "beta1" and "beta2" commented out.

Cheers,

Dion

Revision history for this message
zhongw (qhzw224) said :
#4

Thanks, Dion !

Can you help with this problem?

Provide an answer of your own, or ask Michele Griffa for more information if necessary.

To post a message you must log in.