ttrr is a software package to do topology optimization of a truss with respect to robustness and redundancy.
Before you install, make sure to have:
- Python http://www.python.org/
- NumPy http://numpy.scipy.org/ http://pypi.python.org/pypi/numpy
- SciPy http://www.scipy.org/ http://pypi.python.org/pypi/scipy
- and also for NumPy/SciPy: BLAS and LAPACK libraries
- GLPK http://www.gnu.org/software/glpk/
To get graphical output (picture, movie, animation) you need some of the following programs:
- gnuplot http://www.gnuplot.info/
- POV-Ray http://www.povray.org/
- png2yuv from MJPEG http://mjpeg.sourceforge.net/
- ffmpeg2theora http://www.v2v.cc/~j/ffmpeg2theora/
- png2theora from libtheora http://www.theora.org
- FFmpeg http://ffmpeg.org/
- APNG Assembler http://sourceforge.net/projects/apngasm/
- convert from ImageMagick http://www.imagemagick.org/
At least for pictures you need gnuplot and/or POV-Ray. The frames for all movie and animation output are rendered with POV-Ray.
There is also a small extra command to check for availability of necessary python modules:
python setup.py check_modules
If you want to use this complete software you should have no modules which are not available.
If you use Python3, you must convert to Python3 via 2to3:
tar xzf ttrr-*.tar.*
cd ttrr-*/
2to3 -w .
To install this software global to / the following steps are to perform:
tar xzf ttrr-*.tar.*
cd ttrr-*/
python setup.py build_c_scripts
python setup.py install
Please recognize the extra step python setup.py build_c_scripts here.
To install this software to your $HOME the following steps are to perform:
tar xzf ttrr-*.tar.*
cd ttrr-*/
python setup.py build_c_scripts
python setup.py install --home=~
Please recognize the extra step python setup.py build_c_scripts here.
GLPK 4.38 and 4.40 do not work.
GLPK 4.43 and 4.44 and 4.45 and 4.47 work.
GLPK 4.52.1 gives other binary results compared to “results.tar.bz2”. But these are only numerical rounding errors.
Keep in mind to have the right pathes.
For the above installation to $HOME the software installs in:
~/bin
~/lib/python
Please make sure to have these pathes in $PATH and $PYTHONPATH, respectively. For example:
export PATH=$PATH:~/bin
export PYTHONPATH=~/lib/python
You can use your own compiler-flags. For example:
CFLAGS="-march=amdfam10 -O3 -msse4a -mfpmath=sse -pipe -fomit-frame-pointer" python setup.py build_c_scripts
If you have libraries in a not default path, please let it know.
For example (e. g. OpenBSD or FreeBSD):
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/lib
export CPATH=$CPATH:/usr/local/include
Because we are doing scientific computing (repeatable: conform to IEEE-754 standard; with the same result each time the computing is done — independent of the load of the machine) the default floating point arithmetic unit is set to sse by the use flag “-mfpmath=sse” in “setup.py”.
If you really wish to use 387 read the gcc man page to understand what you do. In principle if you calculate with 387 the results may be different every time! Caused by the simplex algorithm mostly used in ttrr through GLPK the basis of the result will mostly be the same. The final calculation of the objective function value is not very time consuming. Therefore the results could be the same.
SciPy has missing dependencies in Gentoo Linux amd64 at the moment (2012-02-26) (see https://bugs.gentoo.org/show_bug.cgi?id=380597 ). You need sci-libs/clapack and sci-libs/lapack-atlas, too. For example:
emerge sci-libs/clapack sci-libs/lapack-atlas
eselect blas set atlas
eselect cblas set atlas
eselect lapack set atlas
emerge sci-libs/scipy
Fedora needs not only glpk but glpk-devel and gcc, too. gcc should come as a dependency of SciPy, but it does not.
Fedora lacks multimedia software. The repository http://rpmfusion.org/ provides MJPEG, ffmpeg2theora and FFmpeg (and more), but not povray. It is possible to install it manually (see other hint).
Since in debian the module argparse is not included in python, one needs the package python-argparse in addition.
However, in debian png2yuv from MJPEG http://mjpeg.sourceforge.net/ is not in the package management system. But it can be installed as mjpegtools from: http://deb-multimedia.org
If povray is not in the package management system (ubuntu 12.04, Fedora 16, Fedora 17, LMDE 201204, debian 6.0.5), it can be installed from http://www.povray.org/ http://www.povray.org/redirect/www.povray.org/ftp/pub/povray/Official/Linux/povlinux-3.6.tgz
Unfortunately the install script does not work with a simple shell. Replacing sh with bash in the first line of the install script gives a working script in many distributions. (Sometimes /bin/sh is a link to /bin/bash and then it is working out of the box.)
openSUSE 12.1 x86_64 behave in a different way from typical linux.
The software SciPy and GLPK are not in the package management system; but are available from the repository http://download.opensuse.org/repositories/science/ (see http://www.scipy.org/Installing_SciPy/Linux#head-3dbbf9abe395e974d3ec911ae56863f4af70df9b ).
Not only glpk but also glpk-devel is needed.
To install ttrr software to your $HOME in openSUSE the following steps are to perform:
tar xzf ttrr-*.tar.*
cd ttrr-*/
python setup.py build_c_scripts
python setup.py install --prefix=~
Please make sure to have these pathes in $PATH and $PYTHONPATH, respectively. For openSUSE you need:
export PATH=$PATH:~/bin
export PYTHONPATH=~/lib/python2.7/site.packages
The software ffmpeg2theora and FFmpeg are in the repository: http://packman.links2linux.org/
Tested and developed with Gentoo Linux http://www.gentoo.org/ and the gentoo-packages
in the following versions/USE-flags:
ttrr was successfully tested with:
- Gentoo Linux amd64 http://www.gentoo.org/ (with Python2 and Python3; see hints above)
- ubuntu 11.10 desktop i386 http://www.ubuntu.com/
- ubuntu 11.10 desktop amd64 http://www.ubuntu.com/
- ubuntu 12.04 desktop amd64 http://www.ubuntu.com/ (since povray is not in the package management system, it was manually installed; see hints above)
- ubuntu 13.04 desktop amd64 http://www.ubuntu.com/ (since povray is not in the package management system, it was manually installed)
- FreeBSD 9.0 i386 http://www.freebsd.org/ (see hints above)
- FreeBSD 9.0 amd64 http://www.freebsd.org/ (see hints above)
- OpenBSD 5.0 i386 http://www.openbsd.org/ (see hints above)
- OpenBSD 5.0 amd64 http://www.openbsd.org/ (see hints above)
- OpenBSD 5.1 amd64 http://www.openbsd.org/ (see hints above)
- Fedora 16 x86_64 Desktop http://fedoraproject.org/ (without povray; see hints above)
- Fedora 17 x86_64 Desktop http://fedoraproject.org/ (since povray is not in the package management system, it was manually installed; see hints above)
- LMDE 201204 with MATE 64-bit http://www.linuxmint.com/ (since povray is not in the package management system, it was manually installed; see hints above)
- debian 6.0.5 amd64 http://www.debian.org/ (since povray is not in the package management system, it was manually installed; see hints above)
- Arch Linux 2011.08.19 core x86_64 http://www.archlinux.org/ (with Python3)
- openSUSE 12.1 x86_64 http://www.opensuse.org/ (with required additional repositories; see hints above)
You can check your installation with the examples in the examples directory:
./test
The results are compared with the reference results in “results.tar.bz2”. You should view the images and pictures with your preferred software, too.
Under GLPK 4.52.1 you get different binary results compared to “results.tar.bz2”. But these are only numerical rounding errors.
The most time (about 98 % cpu time) is spent on rendering by povray.
If the bash script “test” is not working for you, you can try single examples, e. g.:
python batch_2_load_cases_3_dim.py
python compareresults.py --compare_results -f *.bz2
ttrr_tools.py --png_gnuplot --png_pov --ogv --apng --mng --gif -f 2_load_cases_3_dim.tar.bz2 -xm 100 -ym 100 -frames 50 -framerate 5 -x 400 -y 400
On a laptop (lenovo T410s, 4 intel-cores with 2.53 GHz, 4 GB RAM) it takes about 4 seconds for test_short and about 178 minutes (real time, 478 minutes user time) for test_long with povray V3.6.
On a desktop computer (8 amd-cores with 3.60 GHz, 16 GB RAM) it takes about 12 seconds for test_short and about 70 minutes (real time, 365 minutes user time) for test_long with povray V3.7.