HG-MD  1
Introduction to the Code

How to use this documentation

Information for users of this application

General Information

This code is written in C++ and does make use of both templates and the object oriented nature of C++. This basic architecture is to have a core kernel code (located in scr) that is general and flexible and then very small driver codes (located in DRIVERS) that pick out the parts of the kernel required to solve specific problems.

Introduction to the Code

How to use this documentation

Information for users of this application

General Information

This code is written in C++ and does make use of both templates and the object oriented nature of C++. This basic architecture is to have a core kernel code (located in scr) that is general and flexible and then very small driver codes (located in DRIVERS) that pick out the parts of the kernel required to solve specific problems.

Directory Structure

At the top level you will find three main directories
DRIVERS/
scr/
DOCUMENTATION/

In the DOCUMENTATION direction is located the documentation, i.e. this file. Please note, if you find no documentation there it can be generated by going into the DRIVERS/ direction and typing "make doc". If the documentation becomes corrupt the following will force it to regenerate "make doc_clean; make doc"

The scr direction contains the heart of the code and as a users you should not need to known much about it.

The DRIVERS directory has a series of subdirectories for example Simple_MD/ that each contain a series of demo codes illustrating how to use the main src code. Typing "make selftest" in the top level of drivers would perform checks on all parts of the code to confirm everything is functioning as intended.

In each subdirectory (e.g. Simple_MD) there is a makefile that can be used to compile the individual codes. Note typing "make selftest" at this level will perform the test for that section of the code only. Also in subdirectory they is a second subdirectory call run/. If you move in this directory from here any driver can be run with the command "sc/quick_run driver_name". This command will compile and run driver_name.

Finally running a code will (in general) generate three files called some_name.data, some_name.disp and some_name.stat. The files with .data extension contain all the position and velocity information for every particles. The .stat extension, contains macroscopic statistics about the problem (the information contained is semi-driver dependent). Finally .disp extension is an a script file that to run to plot for .data output file using xballs.

The Scripts

Along with this code you will find a directory called scripts. This contains a number of bash scripts designed to work with both the MD and finite volume programs. A brief summary of each script is as follows

Creating your own DRIVERS directory for your code

It you look in the DRIVERS directory you will see several subdirectories. These subdirectories contain collections of similar codes and, as a new user, you probably want to create a new directory for your own driver codes. To do this copy the TEMPLATE direction to you YOUR_DIR_NAME (if your are a developer and have access to svn repository it is advisable to svn copy to create your new DRIVERS directory)

Information for developers of this application

Variables and Equations

  1. global parameters: for details refer to MD class documentation.
    • time domain $[0,t_{\mbox{max}}]$,
    • spatial domain $[x_{\mbox{min}},x_{\mbox{max}}] \times [y_{\mbox{min}},y_{\mbox{max}}] \times [z_{\mbox{min}},z_{\mbox{max}}]$,
    • number of particles $ N $,
    • number of (regular) walls $ N_{wall}$,
    • number of periodic walls $ N_{wall,periodic}$
    • gravitational acceleration $ \vec{g}$,
    • Walls are defined by outward unit normal $ \vec{n}_{\mbox{w}}$ and position $ p_{\mbox{w}}$: $ \mbox{w} = \{\vec{x}:\ \vec{n}_{\mbox{w}} \cdot \vec{x} = p_{\mbox{w}} \}$
  2. global variables: for details refer to MD class documentation.
    • time $ t $,
  3. parameters for particle $ \mbox{P}_i $ : for details refer to CParticle class documentation
    • radius $ a_i $,
    • mass $ m_i = \frac{4}{3} \pi a_i^3 $,
    • inertia $ I_i = \frac{2}{5} m_i $,
    • normal spring constant $ k $ (globally set)
    • normal dissipation coefficient $ \gamma $,
    • tangential dissipation coefficient $ \gamma^t $,
    • Coulomb friction coefficient $ \mu $
  4. variables for particle $ \mbox{P}_i $: for details refer to CParticle class documentation
    • position $ \vec{r}_i(t)$,
    • velocity $ \vec{v}_i(t)$,
    • angle $ \vec{\alpha}_i(t)$,
    • angular velocity $ \vec{\omega}_i(t)$.
  5. initial values:
    • position $ \vec{r}_i(0) = \vec{r}_i^0 $,
    • velocity $ \vec{v}_i(0) = \vec{v}_i^0 $,
    • angle $ \vec{\alpha}_i(0)=\vec{0} $,
    • angular velocity $ \vec{\omega}_i(0) = \vec{\omega}_i^0 $.
  6. variables for each collision between particles $\mbox{P}_i$ and $\mbox{P}_j$:
    • relative position $ \vec{r}_{ij} = \vec{r}_i - \vec{r}_j $,
    • normal direction $ \vec{n}_{ij} = \frac{\vec{r}_{ij}}{\|\vec{r}_{ij}\|}$,
    • overlap $ \delta_{ij} = (\vec{a}_i - \vec{a}_j) - \vec{r}_{ij}$,
    • relative velocity $ \vec{v}_{ij}=\vec{v}_i-\vec{v}_j + (a_i-\frac{\delta_{ij}}{2}) \vec{n}_{ij} \times \vec{\omega}_i + (a_j-\frac{\delta_{ij}}{2}) \vec{n}_{ij} \times \vec{\omega}_j $
    • relative normal velocity $ v_{ij}^n = - \vec{v}_{ij} \cdot \vec{n}_{ij}$ ($= \dot{\delta}_{ij} $),
    • normal force (spring-dashpot model) $ f_{ij}^n = k \delta_{ij} + \gamma v_{ij}^n $,
    • relative tangential velocity $ \vec{v}_{ij}^t = \vec{v}_{ij} - v_{ij}^n \vec{n}_{ij} $,
    • tangential direction $ \vec{t}_{ij} = \frac{\vec{v}_{ij}^t}{\|\vec{v}_{ij}^t\|}$,
    • tangential force (sliding friction model) $ f_{ij}^t = - \max( \gamma^t v_{ij}^t,\ \mu f_{ij}^n)$,
    • collision force $ \vec{f}_{ij} = f_{ij}^n \vec{n}_{ij} + f_{ij}^t \vec{t}_{ij},\ \mbox{if } \delta_{ij}\leq 0,\ 0\ \mbox{else} $,
  7. Variables for collisions between particle $ \mbox{P}_i $ and wall $ \mbox{w}_j $:
    • normal direction $ \vec{n}_{ij}^{wall} = - \vec{n}_{\mbox{w}_j}$,
    • overlap $ \delta_{ij}^{wall} = \vec{a}_i - (p_{\mbox{w}_j} - n_{\mbox{w}_j} \cdot x)$,
    • relative velocity $ \vec{v}_{ij}^{wall}=\vec{v}_i + (a_i-\frac{\delta_{ij}}{2}) \vec{n}_{ij} \times \vec{\omega}_i $,
    • all else is the same as for particle collisions
  8. Force and torque calculations

    \[ \vec{f}_i = m_i \vec{g} + \sum_{j=1}^N \vec{f}_{ij} + \sum_{j=1}^{N_{wall}} \vec{f}_{ij}^{wall}, \]

    \[ \vec{t}_i = \sum_{j=1}^N (a_i-\frac{\delta_{ij}}{2}) \vec{n}_{ij} \times \vec{f}_{ij} + \sum_{j=1}^{N_{wall}} (a_i-\frac{\delta_{ij}^{wall}}{2}) \vec{n}_{ij}^{wall} \times \vec{f}_{ij}^{wall}. \]

  9. Time integration

    \[ \vec{\dot{r}}_i = \vec{v}_i,\ m_i \vec{\dot{v}}_i = \vec{f}_i,\quad \vec{\dot{\alpha}}_i = \vec{\omega}_i,\ I_i \vec{\dot{\omega}}_i = \vec{t}_i \]

Implementation

Time Stepping

Verlet integration for $ \vec{r}_i $, forward Euler for $ \vec{\alpha}_i $, $ \vec{\omega}_i $, fixed time step $ dt $.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines