appendClumped

Asked by Namzu

I was trying to run a code for which i already have an inputfile generated fro another code in the x_y_z_r_clumpid format.
For the following part of my code i am getting error. What is the correct format to use appendClumped and ymport.textClumps? What discretization means?? In yade document it tells ymport.textsClumps have default x_y_z_r format..how to change that??

# ----------------- Adding Spheres to the Simulation ---------------------------------
inputfile = 'Clumped.txt'
spheres=O.bodies.appendClumped(ymport.textClumps(inputfile),material=material,discretization=0)
# Adding spheres to the simulation

Traceback (most recent call last):
  File "/usr/bin/yade", line 336, in runScript
    execfile(script,globals())
  File "/usr/lib/python3/dist-packages/past/builtins/misc.py", line 87, in execfile
    exec_(code, myglobals, mylocals)
  File "2_Edited_Clump.py", line 70, in <module>
    spheres=O.bodies.appendClumped(ymport.textClumps(input_file),material=concreteId,discretization=0,format='x_y_z_r_clumpId') # Adding spheres to the simulation
Boost.Python.ArgumentError: Python argument types in
    BodyContainer.appendClumped(BodyContainer, list)
did not match C++ signature:
    appendClumped(yade::pyBodyContainer {lvalue}, std::vector<boost::shared_ptr<yade::Body>, std::allocator<boost::shared_ptr<yade::Body> > >, unsigned int discretization=0)

Question information

Language:
English Edit question
Status:
Answered
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Jan Stránský (honzik) said (last edit ):
#1

Hello,

please provide a MWE [1], i.e.:
- content of Clumped.txt (following M=minimal, on e or a few clumps)
- maybe also a MWE how you created the Clumped.txt file

> What ...

source code is always a good reference [2]

> What is the correct format to use appendClumped and ymport.textClumps?

for the start, use brackets correctly:
spheres=O.bodies.appendClumped(ymport.textClumps(inputfile,material=material,discretization=0))

It not a bad idea to use multiple lines instead of oneliners:
spheres = ymport.textClumps(inputfile,material=material,discretization=0)
sphereIDs = O.bodies.appendClumped(spheres)

here you can see a misconception you load clumps, and then appendClumped them..
Normally you use appendClumped for standalone (not yet clumped) particles...

> What discretization means??

[3] :-)
here it is argument passed to O.bodies.appendClumped [4]

> In yade document it tells ymport.textsClumps have default x_y_z_r format..how to change that??

this is error in documentation, format keyword is not present.
You can check in Yade console:
help(ymport.textClumps)
or in online documentation, "format" is not present as a parameter.

> In yade document it tells

more importantly for your case, the documentation [5] tells that it "Load clumps-members ... insert them to the simulation"
So they are loaded and inserted in the simulation, you do not O.bodies.append the ymport.textClumps result (!)

Cheers
Jan

[1] https://www.yade-dem.org/wiki/Howtoask
[2] https://gitlab.com/yade-dev/trunk/-/blob/master/py/ymport.py#L116
[3] https://www.dictionary.com/browse/discretization
[4] https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.BodyContainer.appendClumped
[5] https://yade-dem.org/doc/yade.ymport.html#yade.ymport.textClumps

Can you help with this problem?

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

To post a message you must log in.