FAQ
From Yade
Frequently asked questions on YADE
Installation questions
I have made some changes to the code. How can I apply it to the Yade build?
You just need to go to trunk directory and type:
scons
If you want, you can add -j2, for example: in this case the number of threads will be 2, what makes the compiling process faster, if you have 2-core processor.
I would like to update my YADE to latest at Bzr. Do I need do build the YADE again?
No, You just need to go to trunk directory and type:
bzr up scons
If you want, you can add -j2, for example: in this case the number of threads will be 2, what makes the compiling process faster, if you have 2-core processor.
Also in file scons.current-profile it is necessary to insert next line:
version='something_to_add'
In this case the compiler will not recompile whole code, just changed files. So the process runs much more faster.
Sometimes recompilation process can take a lot of time. To make the recompilation faster, one can use linkStrategy=monolithic option
scons linkStrategy=monolithic
It will essentially decrease recompilation time. By doing this be sure to have as least 4GB RAM on you computer, unless you will have an opposite result with this option.
Where to get an information about scons parameters and what they mean?
You should go to your trunk directory and then type:
scons -h
At the end of output you will see all possible scons parameters, what they mean and default values for it.
How can I create the latest documentation on YADE code?
C++ Documentation (less and less used)
If you want to get the latest Doxygen documentation, you just need to do the next:
cd trunk scons doc
Be sure Doxygen and python-pygraphviz are installed.
You can get generated files in ./trunk/doc/doxygen/html/index.html
Python Documentation (more and more used)
Python documentation for latest bzr revision is (somewhat regularly) uploaded to https://www.yade-dem.org/sphinx/.
Sources for the documentation can be obtained via bzr from https://code.launchpad.net/~eudoxos/+junk/ydoc, but to generate on your computer, you need to tweak your local configuration: we depend on development version of sphinx from https://bitbucket.org/birkenfeld/sphinx-domains/; besides that, these lines have to be added to /etc/python2.6/sitecustomize.py (on debian/ubuntu):
import sys sys.setdefaultencoding('utf-8')
This process will be properly documented and the ydoc branch will eventually (in the summer) become part of yade source tree itself.
(There used to be lesss friendly documentation generated by epydoc (python=epydoc package), still to be found in doc/yade-epydoc.py; it is no longer supported, but an olden version is still at https://www.yade-dem.org/epydoc/, for curious people)
Programming/debugging questions
I would like to get some debugging messages during updating the YADE code, what should I use?
You have to use logging framework LOG4Cxx http://logging.apache.org/log4cxx/index.html
You must set logging level for the class of which logger you use, in the file ~/.yade-trunk/logging.conf (or whatever is the version you use) -- see trunk/doc/logging.conf.sample for commented sample, see also log4cxx website for details. You can set loglevel from within python:
import yade.log yade.log.setLevel('TheClassOfWhichLoggerYouWantToSet',yade.log.TRACE)
(e.g. in scripts/test/facet-topo.py)
Note however that in the optimized builds (optimize=1 option during compiling), LOG_TRACE and LOG_DEBUG are eliminated altogether from the code. TRVAR1 ... TRVAR5 macros use LOG_TRACE, so they also will not work. (Václav Šmilauer)
TIP. For the temporary "quick" debugging, you can use LOG_WARN. It works always. But don't forget to delete it.
Questions on DEM and (or) YADE simulation
I have a problem with "peak results". What is wrong?
Has anybody the problem with "peak results"? I mean, when you record the data from anything, for example force affecting on facet or sphere, sometimes you get "pick results" which are twice or more larger than normal result. It happens just for a short period, like a noise.
Eh, probably everybody has had that problem.
Taking force on 1 particle makes no sense, you have to average it somehow. DEM doesn't solve for equilibrium, therefore you can either let the simulation stabilize somehow (dissipate all the kinetic energy), or average somehow what you see over larger area (or both). You can compute forces on a specimen cross-section or some meaningfully defined set of particles; if you have a facet that touches many spheres, that could be a good candidate as well, as long as the sphere move independently.
You can try taking force from 1 single particle and smooth it using moving average or similar techniques (they are available in the numpy package), but that is just "graph aesthetics".
e.g. examples/concrete/uniaxial sums forces (in UniaxialStrainer) on all particles that are considered supports and lower and higher supports are then averaged. There are still some osciallations (as there are waves going back and forth in the specimen), but that is not so marked unless you go to very high loading rates. The same example also plots cross-section forces (i.e. forces in interactions that cross that plane) and you can see that they differ.
Vaclav
What is "Young" in ElastMat material?
Be careful, the parameters does not always represent what you think they could be representing.
The same ElastMat is used for different contact models, and its parameters can play different roles in each model. For instance: - In CundallStrack, ElastMat::Young will be proportional to Young's modulus of the packing (with the proportionality factor usually close to one). - In HM, it is the real Young's modulus of the solid phase. - In ConcretePM, it is the directional Young modulus of the contact bonds.
It is similar for Poisson: 1- Correlated with packing's Poisson, 2- Poisson of the solid phase, 3- not used
Read the documentation for each specific interaction physics (Ip2_***) functor, to see how to define the material properties consistently.
Bruno
Common questions
What Should I know to start YADE using/programming
Actually, YADE is a framework for simulations. To use it completely, you should have some programming knowledges.
- C++ (classes, templates, inheritance, pointers, boost)
- Python
- Matplotlib
I would like to add a new page to YADE wiki. How can I do it?
If you want to add a page to wiki, you need to put its name in address panel of your browser, for example:
http://yade.wikia.com/wiki/NEW_PAGE_NAME
Then you can create the normal wiki-page. After that you need to define to what category belongs your page. And add this name, pushing "Add category" at the end. Save page.
Also it is necessary to add your page to Structurized_content to allow others to find your page quickly.
I want to get 2 plots, how can I do it?
I want 2 diagrams to appear:
yade.plot.plots={'t':('Z_pr',),'F':('t')}
It works,
but when I change F and t:
yade.plot.plots={'t':('Z_pr',),'t':('F')}
I receive only 't':('F') diagram, first one does not appear...
That's normal, python dicts have only one value per key; try this:
a={'a':1,'a':2} print a # {'a': 2}
since 'a':1 was overwritten. What you have to do is to create differently-named t axis:
yade.plot.plots={'t':('Z_pr',),'t_':('F',)}
(you can name it as you want, I just appended the "_" (and do not forget the comma after 'F' again)) and in addPlotData, you will have
't':O.time,'t_':O.time,...
Vaclav
Is it possible to make different y-values from right side of the diagram?
You should use:
yade.plot.plots={'t':('F','|||',('F2', 'go-'))}
note 1: F and Z_pr will be plotted on y1, F2 on y2; '|||' separates those
note 2: ('go-') is marker specifier as in matlab, see http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.plot (and scripts/simple-scene-graph.py).
How to run the simulation in 1 thread?
OMP_NUM_THREADS=1 yade-trunk ...
or to apply it also to next invocations in the same shell (terminal)
export OMP_NUM_THREADS=1
If you use yade-multi, columns prefixed with bang are passed as env vars to the process automatically:
!OMP_NUM_THREADS some 1 3.4 2 3.4 3 3.4
See examples/collider-perf/perf.table
Vaclav.
Is it possible to make another color of the background from python script?
You should add to your script:
from yade import qt r=qt.Renderer() r['Background_color']=0,0,0
Other parameters to change:
r.keys() # get just the keys r.dict() # get both keys and values;
Vaclav.
Can I start YADE in background like a daemon?
Yes, definitely. Command screen is great for background calculations. Look for some screen tutorial on the web.
inside screen command Ctrl-A-? gives a list of all keybindings.
most often used are
Ctrl-A-C create new shell Ctrl-A-N next shell Ctrl-A-P previous shell Ctrl-A-0 shell no. 0 Ctrl-A-1 shell no. 1 Ctrl-A-2 shell no. 2 Ctrl-A-Ctrl-Esc allows to scroll up
Janek