DISCRETE ELEMENT METHOD (DEM) SIMULATION · PDF filediscrete element method (dem) simulation...

39
DISCRETE ELEMENT METHOD (DEM) SIMULATION USING OPEN-SOURCE CODES Introduction - Linux Dr Daniel Barreto 1 Lecturer in Geotechnical Engineering B [email protected] July 8 th , 2015 D. Barreto (ENU) DEM-ZJU-2015 July 8 th , 2015 1 / 33

Transcript of DISCRETE ELEMENT METHOD (DEM) SIMULATION · PDF filediscrete element method (dem) simulation...

DISCRETE ELEMENT METHOD (DEM)SIMULATION USING OPEN-SOURCE CODES

Introduction - Linux

Dr Daniel Barreto

1Lecturer in Geotechnical EngineeringB [email protected]

July 8th, 2015

D. Barreto (ENU) DEM-ZJU-2015 July 8th , 2015 1 / 33

Lecture Outline

1 DEM SoftwareDEM - Commercial and Open-Source SoftwareA few comments on choosing the right DEM softwareComparison of Open-Source DEM programs

2 YADE - An introduction

3 LINUX → UbuntuUbuntu - What you need to knowLINUX - Basic Commands

D. Barreto (ENU) DEM-ZJU-2015 July 8th , 2015 2 / 33

Some existing DEM codes

(Just a list of those most commonly used for geotechnics and soil mechanics research)

Commercial - For purchase

PFC2D and PFC3D by Itasca Consulting Group

EDEM by DEM Solutions Ltd

DEMPack by CIMNE (Barcelona)

Open-Source - Free

BALL and TRUBAL (Original DEM code)

LMGC90

LAMMPS and LIGGGHTS

ESyS Particle

Oval

YADE

D. Barreto (ENU) DEM-ZJU-2015 July 8th , 2015 3 / 33

Choosing the right DEM software

(A personal view...)

What is important?

Cost

Ease of installation

Ease of use

Reliability

Documentation quality

Processing capability (i.e. Parallelisation)

Support

Ease of modification/update

D. Barreto (ENU) DEM-ZJU-2015 July 8th , 2015 4 / 33

A (subjective) comparison of Open-Source DEM software

Software Installation Ease of Use Documentation SupportTRUBAL Easy Very easy Good NoneLAMMPS Complex Difficult Poor Good

ESyS-Particle Very easy Easy Good GoodYADE Very easy Average Very good ExcellentOVAL Average Average Good Average

Software Processing Update/Modification LanguageTRUBAL Single processor Average FORTRANLAMMPS Parallel processing Easy C++

ESyS-Particle Parallel processing Average PYTHONYADE OpenMPI Easy PYTHONOVAL Single processor Average FORTRAN

Ease of use → Assumes knowledge of corresponding programming languageUpdate/modification → How easy is to create a new contact law and/or servo-control

D. Barreto (ENU) DEM-ZJU-2015 July 8th , 2015 5 / 33

YADE

“Yade is an extensible open-source framework for discrete numerical models, focused onDiscrete Element Method. The computation parts are written in c++ using flexible objectmodel, allowing independent implementation of new alogrithms and interfaces. Python isused for rapid and concise scene construction, simulation control, postprocessing anddebugging.”

https://yade-dem.org/doc/

D. Barreto (ENU) DEM-ZJU-2015 July 8th , 2015 6 / 33

YADE - Website

D. Barreto (ENU) DEM-ZJU-2015 July 8th , 2015 7 / 33

YADE - Launchpad

D. Barreto (ENU) DEM-ZJU-2015 July 8th , 2015 8 / 33

YADE - The “need” for LINUX

“Yade is an extensible open-source framework for discrete numerical models, focused onDiscrete Element Method. The computation parts are written in c++ using flexible objectmodel, allowing independent implementation of new alogrithms and interfaces. Python isused for rapid and concise scene construction, simulation control, postprocessing anddebugging.”

https://yade-dem.org/doc/

Further than that:

YADE uses gnuplot, OpenGL amongst others for simulation inspection

YADE produces .vtu files for 3D visualisation output

Pre-compiled versions of YADE are available within Ubuntu and Debian (LINUXdistributions) → Installation is extremelly easy for general use.

LINUX is much quicker than Windows!

D. Barreto (ENU) DEM-ZJU-2015 July 8th , 2015 9 / 33

Installing Ubuntu

1 Download the latest (32 bit or 64 bit version - depending on your computer) Ubuntuversion to your computer.

2 Burn a CD image with the file you downloaded using your favourite CD burningsoftware.

3 Introduce the Ubuntu CD in your CD tray.

4 If the CD does not start automatically look for the CD contents in the File Manager(i.e. Windows) and double-click on top of the Ubuntu executable file.

5 Follow on screen instructions.

You may choose to install Ubuntu in parallel with your existing disk operating system (i.e.Windows) to avoid loss of existing data. Note however that some laptops and desktop PC’shave restrictions imposed on the “boot” sector of the hard drive as well as the “BIOS”memory. In this case Ubuntu installation in parallel with Windows is much more complex.

D. Barreto (ENU) DEM-ZJU-2015 July 8th , 2015 10 / 33

Ubuntu - What you need to know

Launch Bar and the “Start” Menu

Ubuntu Software Centre

File Manager

System Monitor

A text editor → gedit

Terminal (Command window)

... and also some basic LINUX commands to be used in “Terminal” mode. Some of thesewill be introduced later

D. Barreto (ENU) DEM-ZJU-2015 July 8th , 2015 11 / 33

Ubuntu - The Launch Bar & “Start” Menu

D. Barreto (ENU) DEM-ZJU-2015 July 8th , 2015 12 / 33

Ubuntu - The Launch Bar & “Start” Menu

The “Start” menu does the same as in Windows Operating Systems but also providesadditional programs, websites, etc. which relate to whatever you type at the top.

Everything is user-friendly and very intuitive and easy to use. The days in which you had tolove computers, be almost a hacker and know computer programming to use LINUX aregone.

The Launch Bar is vertical (instead of horizontal in Windows systems) and is also fullycustomisable by the user. It provides quick access to installed/favourite programs.

Recommendations (for YADE users)Pin to the Launch Bar:

System Monitor

Terminal

Calculator

Libre Calc

Note: Libre is the open-source version of Windows’ Office Suite

D. Barreto (ENU) DEM-ZJU-2015 July 8th , 2015 13 / 33

Ubuntu - The Launch Bar & “Start” Menu

The “Start” menu does the same as in Windows Operating Systems but also providesadditional programs, websites, etc. which relate to whatever you type at the top.

Everything is user-friendly and very intuitive and easy to use. The days in which you had tolove computers, be almost a hacker and know computer programming to use LINUX aregone.

The Launch Bar is vertical (instead of horizontal in Windows systems) and is also fullycustomisable by the user. It provides quick access to installed/favourite programs.

Recommendations (for YADE users)Pin to the Launch Bar:

System Monitor

Terminal

Calculator

Libre Calc

Note: Libre is the open-source version of Windows’ Office Suite

D. Barreto (ENU) DEM-ZJU-2015 July 8th , 2015 13 / 33

Ubuntu Software Centre

D. Barreto (ENU) DEM-ZJU-2015 July 8th , 2015 14 / 33

Ubuntu Software Centre

D. Barreto (ENU) DEM-ZJU-2015 July 8th , 2015 15 / 33

Ubuntu Software Centre

D. Barreto (ENU) DEM-ZJU-2015 July 8th , 2015 16 / 33

Ubuntu Software Centre

D. Barreto (ENU) DEM-ZJU-2015 July 8th , 2015 17 / 33

Program Installation

You may want to check if the following software packages are in your computer. Pleaseinstall if not already available as they might be needed for running (and analysing) DEMsimulations.

yade

gnuplot

gfortran

gcc

paraview

octave

qtoctave

Note: You need “administrator” rights to install these programs. You will be asked for thepassword that you used when installing your LINUX distribution (i.e. Ubuntu)

D. Barreto (ENU) DEM-ZJU-2015 July 8th , 2015 18 / 33

The File Manager

D. Barreto (ENU) DEM-ZJU-2015 July 8th , 2015 19 / 33

The File Manager

Recommendations:

Use ‘view items as a list’

File names are case sensitive (i.e. “i” is not the same as “I”)

Adopt a folder (and file) nomenclature from the beginning

Name “running” (YADE input) files starting with “1” - Makes it easy to find them.

These recommendations are important because when you use DEM you are likely togather significantly high amounts of data.

... and it is not just about data (i.e managing files and having enough space in your harddrive). It is also about computer power. That leads us to the System Monitor...

D. Barreto (ENU) DEM-ZJU-2015 July 8th , 2015 20 / 33

The System Monitor

D. Barreto (ENU) DEM-ZJU-2015 July 8th , 2015 21 / 33

The System Monitor

In the “Processes” Tab, the “%CPU” and “Memory” columns are key:

“%CPU” indicates memory share, but it also changes when application are active.

A constant value of “Memory” for an application over a long application indicates a“stalled” application (i.e. blocked, not working) that needs to be “killed”

D. Barreto (ENU) DEM-ZJU-2015 July 8th , 2015 22 / 33

The System Monitor

D. Barreto (ENU) DEM-ZJU-2015 July 8th , 2015 23 / 33

The System MonitorIn the “Resources” Tab, the “CPU History” and “Memory and Swap History” sections arethe most important:

“CPU History” tells you how many CPU processors/cores you have at your disposaland how they are being used.

“Memory and Swap History” gives you and indication of the amount of memory thatis being transferred between units (these might be cores, but also output processesfor files, etc)

Recommendations (for YADE use):

Do not use all your processors for running DEM simulations. Always leave at leastone for the computer to run other necessary processes. If you do not do this thespeed of simulation will radically slow.

When the Memory Swap is higher than 80% your computer might slow down andpotentially stall (the equivalent of the Windows “Blue Screen” that requires shutdownand re-start).

Keep checking both of these indicators periodically while you run DEM simulations.They might be fine at the start, but not as simulation progresses (or the contrary)

D. Barreto (ENU) DEM-ZJU-2015 July 8th , 2015 24 / 33

The System Monitor

D. Barreto (ENU) DEM-ZJU-2015 July 8th , 2015 25 / 33

The System Monitor

In the “File Systems” tab your only concern should be to have enough hard drive space tostore all the data you are expecting to get from your DEM simulation(s).

D. Barreto (ENU) DEM-ZJU-2015 July 8th , 2015 26 / 33

gedit - A good text editor...

gedit is the default text editor for Ubuntu. As it happens it is quite a useful tool for what weneed to do to efficiently run DEM simulations.

So let’s play with gedit and text files for a while...

Remember: gedit will change its behaviour depending on your file extension (i.e. “.f(or.f90)” for FORTRAN files, “.py” for PYTHON files).

D. Barreto (ENU) DEM-ZJU-2015 July 8th , 2015 27 / 33

Terminal

You (normally) need it to run and control DEM simulations with YADE. It is the equivalent ofthe DOS “Command Window” in Windows operating systems. You need to know a fewbasic LINUX commands to work with it (and once you execute YADE, it becomes aPYTHON window). So you need to learn a little bit about both LINUX and PYTHON.

So let’s look at some basic commands for LINUX first...

D. Barreto (ENU) DEM-ZJU-2015 July 8th , 2015 28 / 33

Linux - Basic commands

It is advisable to create a folder for each DEM simulation you run. You can do this with themkdir command or using the left-click of your mouse. Using the terminal...

Using mkdir to create a folderuser@user:~$ mkdir Folder1

You can use the File Manager to find where this new folder was created. You will noticethat a way to navigate within the various levels (or drawers/folders) of the File Managerwhen using the terminal is needed...

D. Barreto (ENU) DEM-ZJU-2015 July 8th , 2015 29 / 33

Linux - Basic commands

The command cd allows to ascend/descend within the file structure of existing files andfolders. You can go down with the command cd followed by the name of the folder whereyou want to go

Using cd to go “down” within the file directoryuser@user:~$ cd Desktop

user@user:~/Desktop$

You go up with the command cd followed by ..

Using cd to ascend within the file directoryuser@user:~/Desktop$ cd ..

user@user:~$

D. Barreto (ENU) DEM-ZJU-2015 July 8th , 2015 30 / 33

Linux - Basic commands

The command cd allows to ascend/descend within the file structure of existing files andfolders. You can go down with the command cd followed by the name of the folder whereyou want to go

Using cd to go “down” within the file directoryuser@user:~$ cd Desktop

user@user:~/Desktop$

You go up with the command cd followed by ..

Using cd to ascend within the file directoryuser@user:~/Desktop$ cd ..

user@user:~$

D. Barreto (ENU) DEM-ZJU-2015 July 8th , 2015 30 / 33

Linux - Basic commands

The command ls provides a list of folders and files existing within the current directory

Using lsuser@user:~$ cd Desktop

user@user:~/Desktop$ ls

The command ls has the possibility of being used with options to reduce the size of the listproduced. In order to use how to use options for the command ls (and any other LINUXcommands), the command man can be used.

Using manuser@user:~$ man ls

D. Barreto (ENU) DEM-ZJU-2015 July 8th , 2015 31 / 33

Linux - Basic commands

The command ls provides a list of folders and files existing within the current directory

Using lsuser@user:~$ cd Desktop

user@user:~/Desktop$ ls

The command ls has the possibility of being used with options to reduce the size of the listproduced. In order to use how to use options for the command ls (and any other LINUXcommands), the command man can be used.

Using manuser@user:~$ man ls

D. Barreto (ENU) DEM-ZJU-2015 July 8th , 2015 31 / 33

Linux - Executing programs

Pre-installed programs within Ubuntu can be executed within a terminal window using theirname and followed by their options [options] if any.

Pre-installed programsuser@user:~$ cd Desktop

user@user:~/Desktop$ yade

What about existing options for YADE?

Programs that have been compiled by a user and used “locally” can be executed using ./followed by the program file name.

Local programsuser@user:~$ cd Desktop

user@user:~/Desktop$ ./hello

D. Barreto (ENU) DEM-ZJU-2015 July 8th , 2015 32 / 33

Linux - Executing programs

Pre-installed programs within Ubuntu can be executed within a terminal window using theirname and followed by their options [options] if any.

Pre-installed programsuser@user:~$ cd Desktop

user@user:~/Desktop$ yade

What about existing options for YADE?

Programs that have been compiled by a user and used “locally” can be executed using ./followed by the program file name.

Local programsuser@user:~$ cd Desktop

user@user:~/Desktop$ ./hello

D. Barreto (ENU) DEM-ZJU-2015 July 8th , 2015 32 / 33

Linux - Executing programs

Pre-installed programs within Ubuntu can be executed within a terminal window using theirname and followed by their options [options] if any.

Pre-installed programsuser@user:~$ cd Desktop

user@user:~/Desktop$ yade

What about existing options for YADE?

Programs that have been compiled by a user and used “locally” can be executed using ./followed by the program file name.

Local programsuser@user:~$ cd Desktop

user@user:~/Desktop$ ./hello

D. Barreto (ENU) DEM-ZJU-2015 July 8th , 2015 32 / 33

More LINUX commands

An A-Z Index of the Bash command line for Linux.http://ss64.com/bash/

The Linux Command Line. A Book By William Shotts.http://linuxcommand.org/tlcl.php

D. Barreto (ENU) DEM-ZJU-2015 July 8th , 2015 33 / 33

More LINUX commands

An A-Z Index of the Bash command line for Linux.http://ss64.com/bash/

The Linux Command Line. A Book By William Shotts.http://linuxcommand.org/tlcl.php

D. Barreto (ENU) DEM-ZJU-2015 July 8th , 2015 33 / 33