Introduction¶
Getting started¶
Before you start moving around in Yade, you should have some prior knowledge.
- Basics of command line in your Linux system are necessary for running yade. Look on the web for tutorials.
- Python language; we recommend the official Python tutorial. Reading further documents on the topic, such as Dive into Python will certainly not hurt either.
You are advised to try all commands described yourself. Don’t be afraid to experiment.
Hint
Sometimes reading this documentation in a .pdf format can be more comfortable. For example in okular pdf viewer clicking links is faster than a page refresh in the web browser and to go back press the shortcut Alt Shift ←
. To try it have a look at the inheritance graph of PartialEngine then go back.
Starting yade¶
Yade is being run primarily from terminal; the name of command is yade
. [1] (In case you did not install from package, you might need to give specific path to the command [2]):
$ yade
Welcome to Yade
TCP python prompt on localhost:9001, auth cookie `sdksuy'
TCP info provider on localhost:21000
[[ ^L clears screen, ^U kills line. F12 controller, F11 3d view, F10 both, F9 generator, F8 plot. ]]
Yade [1]:
These initial lines give you some information about
- some information for Remote control, which you are unlikely to need now;
- basic help for the command-line that just appeared (
Yade [1]:
).
Type quit()
, exit()
or simply press ^D
(^
is a commonly used written shortcut for pressing the Ctrl
key, so here ^D
means Ctrl D
) to quit Yade.
The command-line is ipython, python shell with enhanced interactive capabilities; it features persistent history (remembers commands from your last sessions), searching and so on. See ipython’s documentation for more details.
Typically, you will not type Yade commands by hand, but use scripts, python programs describing and running your simulations. Let us take the most simple script that will just print “Hello world!”:
print("Hello world!")
Saving such script as hello.py
, it can be given as argument to Yade:
$ yade hello.py
Welcome to Yade
TCP python prompt on localhost:9001, auth cookie `askcsu'
TCP info provider on localhost:21000
Running script hello.py ## the script is being run
Hello world! ## output from the script
[[ ^L clears screen, ^U kills line. F12 controller, F11 3d view, F10 both, F9 generator, F8 plot. ]]
Yade [1]:
Yade will run the script and then drop to the command-line again. [3] If you want Yade to quit immediately after running the script, use the -x
switch:
$ yade -x script.py
There is more command-line options than just -x
, run yade -h
to see all of them.
- Options:
-v, --version show program’s version number and exit -h, --help show this help message and exit -j THREADS, --threads=THREADS Number of OpenMP threads to run; defaults to 1. Equivalent to setting OMP_NUM_THREADS environment variable. --cores=CORES Set number of OpenMP threads (as –threads) and in addition set affinity of threads to the cores given. --update Update deprecated class names in given script(s) using text search & replace. Changed files will be backed up with ~ suffix. Exit when done without running any simulation. --nice=NICE Increase nice level (i.e. decrease priority) by given number. -x Exit when the script finishes -f Set logging verbosity, default is -f3 (yade.log.WARN) for all classes -n Run without graphical interface (equivalent to unsetting the DISPLAY environment variable) --test Run regression test suite and exit; the exists status is 0 if all tests pass, 1 if a test fails and 2 for an unspecified exception. --check Run a series of user-defined check tests as described in scripts/checks-and-tests/checks/README and Regression tests --performance Starts a test to measure the productivity. --stdperformance Starts a standardized test to measure the productivity, which will keep retrying to run the benchmark until standard deviation of the performance is below 1%. A common type of simulation is done: the spheres fall down in a box and are given enough time to settle in there. Note: better to use this with argument -j THREADS (explained above). --quickperformance Starts a quick test to measure the productivity. Same as above, but only two short runs are performed, without the attempts to find the computer performance with small error. --no-gdb Do not show backtrace when yade crashes (only effective with –debug) [4].
Footnotes
[1] | The executable name can carry a suffix, such as version number (yade-0.20 ), depending on compilation options. Packaged versions on Debian systems always provide the plain yade alias, by default pointing to latest stable version (or latest snapshot, if no stable version is installed). You can use update-alternatives to change this. |
[2] | In general, Unix shell (command line) has environment variable If Yade executable is not in directory contained in To save typing, you can add the directory where Yade is installed to your Details depend on what shell you use (bash, zsh, tcsh, …) and you will find more information in introductory material on Linux/Unix. |
[3] | Plain Python interpreter exits once it finishes running the script. The reason why Yade does the contrary is that most of the time script only sets up simulation and lets it run; since computation typically runs in background thread, the script is technically finished, but the computation is running. |
[4] | On some linux systems stack trace will produce Operation not permitted error. See debugging section for solution. |
Quick inline help¶
All of functions callable from ipython shell have a quickly accessible help by appending ?
to the function name, or calling help(…)
command on them:
Yade [1]: O.run?
Docstring:
run( (Omega)arg1 [, (int)nSteps=-1 [, (bool)wait=False]]) -> None :
Run the simulation. *nSteps* how many steps to run, then stop (if positive); *wait* will cause not returning to python until simulation will have stopped.
Type: method
Yade [2]: help(O.pause)