Using and Programming
Total Page:16
File Type:pdf, Size:1020Kb
Using and Programming Václav Šmilauer, Bruno Chareyre, Jérôme Duriez, Alexander Eulitz, Anton Gladky, Ning Guo, Christian Jakob, Janek Kozicki, François Kneib, Chiara Modenese, Jan Stránský, Klaus Thoeni Yade Documentation 2nd edition, 2015 based on Yade 1.14.0 Citing this document: Šmilauer V. et al. (2015). Using and Programming. In:Yade Documentation 2nd ed. doi:10.5281/zenodo.34043. http://yade-dem.org See also http://yade-dem/doc/citing.html. ii Contents 1 Installation 1 1.1 Packages ............................................. 1 1.2 Source code ............................................ 2 1.3 Yubuntu ............................................. 5 2 Introduction 7 2.1 Getting started .......................................... 7 2.2 Architecture overview ...................................... 11 3 Tutorial 19 3.1 Introduction ........................................... 19 3.2 Hands-on ............................................. 19 3.3 Data mining ........................................... 28 3.4 Towards geomechanics ...................................... 32 3.5 Advanced & more ........................................ 34 3.6 Examples ............................................. 34 4 User’s manual 45 4.1 Scene construction ........................................ 45 4.2 Controlling simulation ...................................... 63 4.3 Postprocessing .......................................... 75 4.4 Python specialties and tricks .................................. 83 4.5 Extending Yade ......................................... 83 4.6 Troubleshooting ......................................... 83 5 Parallel hierarchical multiscale modeling of granular media by coupling FEM and DEM with open-source codes Escript and YADE 87 5.1 Introduction ........................................... 87 5.2 Work on the YADE side ..................................... 87 5.3 Work on the Escript side .................................... 88 5.4 Example tests .......................................... 88 5.5 Disclaim ............................................. 89 6 Programmer’s manual 91 6.1 Build system ........................................... 91 6.2 Development tools ........................................ 92 6.3 Conventions ........................................... 93 6.4 Support framework ....................................... 97 6.5 Simulation framework ...................................... 117 6.6 Runtime structure ........................................ 123 6.7 Python framework ........................................ 124 6.8 Maintaining compatibility .................................... 126 6.9 Debian packaging instructions ................................. 127 7 Yade on GitHub 129 7.1 Fast checkout without GitHub account (read-only) ...................... 129 7.2 Using branches on GitHub (for frequent commits see git/trunk section below) ...... 129 iii 7.3 Working directly on git/trunk (recommended for frequent commits) ............ 131 7.4 General guidelines for pushing to yade/trunk ......................... 131 8 Acknowledging Yade 133 8.1 Citing the Yade Project as a whole (the lazy citation method) ............... 133 8.2 Citing chapters of Yade Documentation ............................ 133 Bibliography 135 iv Chapter 1 Installation Yade can be installed from packages (pre-compiled binaries) or source code. The choice depends on what you need: if you don’t plan to modify Yade itself, package installation is easier. In the contrary case, you must download and install the source code. 1.1 Packages Pre-built packages are provided for all currently supported Debian and Ubuntu versions of distributions and available on yade-dem.org/packages . These are daily versions of packages and are updating regularly and include all the newly added features. To install daily-version one needs to add this repository to your /etc/apt/sources.list, add a PGP-key AA915EEB as a trusted and install yadedaily sudo bash -c 'echo "deb http://www.yade-dem.org/packages/ trusty/" >> /etc/apt/sources.list' wget -O - http://www.yade-dem.org/packages/yadedev_pub.gpg | sudo apt-key add - sudo apt-get update sudo apt-get install yadedaily If you have another distribution, not Ubuntu Trusty (Version 14.04 LTS), be sure to use the correct name in the first line (for instance, precise, jessie or wheezy). For the list of currently supported distributions, please visit yade-dem.org/packages. After that you can normally start Yade using “yadedaily” or “yadedaily-batch” command. yadedaily on older distributions can have some disabled features due to older library versions, shipped with particular distribution. Git-repository for packaging stuff is available on GitHub. Each branch corresponds to one distribution e.g. precise, jessie etc. The scripts for building all of this stuff is here. It uses pbuilder to build packages, so all packages are building in a clean environment. If you do not need yadedaily-package any more, just remove the corresponding line in /etc/apt/sources.list and the package itself: sudo apt-get remove yadedaily To remove our key from keyring, execute the following command: sudo apt-key remove AA915EEB Since 2011 all Ubuntu versions (starting from 11.10, Oneiric) and Debian (starting from Wheezy) are having already Yade in their main repositories. There are only stable releases are placed. To install the program, run the following: sudo apt-get install yade 1 Using and Programming, Release Yade documentation 2nd ed. To check, what version of Yade is in specific distribution, visit the links for Ubuntu and Debian. Debian- Backports repository is updating regularly to bring the newest Yade to a users of stable Debians. Daily and stable Yade versions can coexist without any conflicts. 1.2 Source code Installation from source code is reasonable, when you want to add or modify constitutive laws, engines or functions... Installing the latest trunk version allows one to use newly added features, which are not yet available in packaged versions. 1.2.1 Download If you want to install from source, you can install either a release (numbered version, which is frozen) or the current development version (updated by the developers frequently). You should download the development version (called trunk) if you want to modify the source code, as you might encounter problems that will be fixed by the developers. Release version will not be modified (except for updates due to critical and easy-to-fix bugs), but they are in a more stabilized state that trunk generally. 1. Releases can be downloaded from the download page, as compressed archive. Uncompressing the archive gives you a directory with the sources. 2. developement version (trunk) can be obtained from the code repository at github. We use GIT (the git command) for code management (install the git package in your distribution and create a GitHub account): git clone [email protected]:yade/trunk.git will download the whole code repository of trunk. Check out Yade on GitHub for more. Alternatively, a read-only checkout is possible via https without a GitHub account (easier if you don’t want to modify the main Yade branch): git clone https://github.com/yade/trunk.git For those behind firewall, you can download the sources from our GitHub repository as compressed archive. Release and trunk sources are compiled in the same way. To be notified about new commits into the trunk, use watch option on GitHub. 1.2.2 Prerequisites Yade relies on a number of external software to run; they are checked before the compilation starts. Some of them are only optional. The last ones are only relevant for using the fluid coupling module (FlowEngine). • cmake build system • gcc compiler (g++); other compilers will not work; you need g++>=4.2 for openMP support • boost 1.35 or later • qt4 library • freeglut3 • libQGLViewer • python, numpy, ipython • matplotlib • eigen3 algebra library (minimal required version 3.2.1) 2 Chapter 1. Installation Using and Programming, Release Yade documentation 2nd ed. • gdb debugger • sqlite3 database engine • Loki library • VTK library (optional but recommended) • CGAL library (optional) • SuiteSparse sparse algebra library (fluid coupling, optional, requires eigen>=3.1) • OpenBLAS optimized and parallelized alternative to the standard blas+lapack (fluid coupling, optional) • Metis matrix preconditioning (fluid coupling, optional) Most of the list above is very likely already packaged for your distribution. In case you are confronted with some errors concerning not available packages (e.g. Package libmetis-dev is not available) it may be necessary to add yade external ppa from https://launchpad.net/~yade-users/+archive/external: sudo add-apt-repository ppa:yade-users/external sudo apt-get update The following commands have to be executed in command line of corresponding distributions. Just copy&paste to the terminal. To perform commands you should have root privileges Warning: If you have Ubuntu 12.10 or older, you need to install libqglviewer-qt4-dev package instead of libqglviewer-dev. • Ubuntu, Debian and their derivatives: sudo apt-get install cmake git freeglut3-dev libloki-dev \ libboost-all-dev fakeroot dpkg-dev build-essential g++ \ python-dev ipython python-matplotlib libsqlite3-dev python-numpy python-tk gnuplot \ libgts-dev python-pygraphviz libvtk5-dev python-scientific libeigen3-dev \ python-xlib python-qt4 pyqt4-dev-tools gtk2-engines-pixbuf python-argparse \ libqglviewer-dev python-imaging libjs-jquery python-sphinx python-git python-bibtex \ libxmu-dev libxi-dev libcgal-dev help2man