Micro and Nano Mechanics Group
(Difference between revisions)
m (Gnuplot)
m (Gnuplot)

Revision as of 15:50, 12 January 2011

Under construction by Jie Yin

Here is a practical guide to ParaDiS corresponding to the latest version. It is especially useful for beginners with latest command templates and programming tips. This guide includes following how-tos:

Contents

How to obtain the latest ParaDiS codes

It is highly recommended to create directory Codes under your home directory. Currently ParaDiS codes are maintained through Subversion. For current group members or collaborators, you can obtain the latest version of ParaDiS by typing the following,

 cd ~/Codes
 svn co https://micro.stanford.edu/svn/ParaDiS [./dirname]

Directory ~/Codes/ParaDiS (or ~/Codes/dirname) will be created with latest checked out revision. It is your svn local repository. You can update your local ParaDiS codes by simply typing

 cd ~/Codes/ParaDiS
 svn update

If you create a new file called newfile.c, you can add it to your local repository ~/Codes/ParaDiS

$ svn add newfile.c

or commit the change to ParaDiS codes after some modifications

$ svn commit newfile.c

How to compile ParaDiS

Before compilation, you need to modify the settings in makefile.setup, which is under directory ~/Codes/ParaDiS. Currently many system types are supported. In the first few lines, you can see following lines

SYS = wcr

MODE = SERIAL
#MODE = PARALLEL

#XLIB_MODE = OFF
XLIB = MODE = ON

SYS defines the system type. Detailed descriptions can be found in file makefile.sys. You can also change to linux if it best described your system type.

MODE is the execution mode. PARALLEL is to enable compile-time support for MPI and multi-CPU support and SERIAL is for single-CPU compilation. Usually SERIAL is used for debugging and visulization purpose. For computation intensive jobs, you should choose PARALLEL mode.

XLIB_MODE = ON is only valid when you want to enable xwindow plotting capability (at the same time MODE = SERIAL ). Otherwise you should set it OFF.

After saving your settings, you can start compilation by simply typing the following,

$ make

If you want to compile faster on a multi-CPU machine, you can use command

$ make -j8

where 8 means the number of processors used for compilation.

If you want to re-compile ParaDiS, e.g. after some modification to source files or system settings, you need to "make clean" before "make"

$ make clean

How to run a test case

To run a DD simulation, you need to prepare .ctrl file and .data file. .ctrl file includes controlling parameters needed for the simulation while .data file usually describe the geometric parameters of the simulation system, e.g. cell size, nodal coordinates. To run a test case, the basic command is shown as following

bin/paradis -d runs/testfile.data runs/testfile.ctrl

The executable is paradis. When -d is used, your .data file does not have to be in the same directory or of the same name as your .ctrl file. In most cases, people create the two files with same names and put them under the same directory, then you can use

bin/paradis runs/testfile.ctrl

How to set up data-file

In most .data files, following lines exist

How to set up ctrl-file

How to create input files with Matlab

How to record properties

Settings in the ctrl file

At the bottom of .ctrl file, following lines are needed,

#Save Properties
saveprop = 1 
savepropfreq = 1

which indicate saving properties is enabled and the saving frequency is once per simulation step.

Description of recorded properties

By default, properties are saved to the following path

~/Codes/ParaDiS/outputs/ctrl_file_name/properties

Usually there are six files.

1 time_Plastic_strain contains two columns of data:

1: elapsed simulation time
2: plastic strain

2 stress_Plastic_strain is generated only if loadType = 1 (constant strain rate) or 4 (cyclic loading). The first two columns of this file are plastic strain and stress respectively. 3 stress_Total_strain is generated only if loadType = 1. The first two columns of this file are total strain and stress. Notice that total strain is the sum of plastic strain and elastic strain. 4 density The first three columns of this file are

1: plastic strain
2: total strain
3: dislocation density (/m^2)

5 alleps contrains 9 columns of data:

1: smulation timestep number
2: elapsed simulation time
3-8: plastic strain component
9: dislocation density

6 epsdot contains 2 columns of data

1: elapsed simulation time
2: plastic strain rate

For detailed descriptions of the recorded data, please refer to the official ParaDiS manual.

Gnuplot

Before using gnuplot, make sure it is installed on your cluster. You also need to enable X server (test by typing xclock). By typing gnuplot, you can start using following command lines. For a given (X,Y) data pair, the gnuplot command is

gnuplot> plot "filename" using 1:2 with lines

where "using 1:2" means plotting using the 1st and 2nd column from the given data file. "with lines" is a style option, you can change to "with points", "with steps", "with dots" or "with impulses". Click [1] for a detailed description of the styles. To draw multiple lines, you can type

gnuplot> plot "A" using 1:2 title "data A" with lines, \
"B" u 1:2 t "data B" with p, \
"C" u 2:3 t "data C" w d

You can use \ to separate continuous lines. title is used to label different lines. You can abbreviate some of the commands, for example, u for using, t for title, w for with, l for lines, p for points and d for dots.

To change the labels of X and Y axes, you can use

gnuplot> set xlabel "x-axis"
gnuplot> set ylabel "y-xais"
gnuplot> set title "y vs x"
gnuplot> replot

You can also change the ranges of X and Y axes,

gnuplot> set xrange [0:2]
gnuplot> set yrange [0:1]
gnuplot> replot

To assign the color of the line, you need to add corresponding number after "l". For example, black solid(-1), black dot(0), red(1), green (2), blue(3), margenta(4), cyan(5) and yellow(6).

How to visualize the results

xwindow

Atomeye

How to submit parallel jobs

pbs file

What if the job is stopped