# Placticity

Source code for this project can be found in the plasticity github code repository.

## SECTION 1: MESH GENERATION

There are several ways to generate an acceptable polygon surface for particle diffusion. Essentially the surface is a tetrahedral mesh with vertices located in 3D space at x,y,z cartesian coordinates, such that each vertex-point is of data-type 'double' machine precision. Here's a vertex-point example in double precision:

```   x=1.859184868755403e+01
y=4.894117244518976e+01
z=-6.007788068750699e+01
```

Each vertex also has a unique positive integer index number, that range from 1-N where N is the total number of vertices in the mesh. Note that since Python indexing starts at 0, index numbers actually range from 0-[N-1]; in Matlab indexing starts at 1, so keep this in mind when passing data between Python and Matlab. Python's fenics/dolfin meshing package renders XML output for a single vertex as:

```   <vertex index="0" x="-5.000000000000000e+01" y="-4.619397662556434e+01" z="-3.086582838174552e+01" />
```

In a tetrahedral mesh each vertex-point is connected by straight lines to other vertices, forming a closed triangular mesh. Thus, to go along with a list of vertex points, the mesh also requires a triangulation connectivity list. This matrix contains the following information:

• Each row represents a triangle or tetrahedron in the triangulation.
• Each index number is a unique ID for each triangle or tetrahedron.
• Each element is a vertex ID.

Python's fenics/dolfin meshing package renders XML output for a single tetrahedron as:

```   <tetrahedron index="0" v0="224" v1="325" v2="1334" v3="1576" />
```

Here's a more complete example of the XML file generated using fenics/dolfin:

```<?xml version="1.0"?>
<dolfin xmlns:dolfin="http://fenicsproject.org">
<mesh celltype="tetrahedron" dim="3">
<vertices size="1870">
<vertex index="0" x="-5.00000e+01" y="-4.61939e+01" z="-3.08658e+01" />
<vertex index="1" x="-5.00000e+01" y="-4.04219e+01" z="-2.08183e+01" />
<vertex index="2" x="-5.00000e+01" y="-3.25491e+01" z="-1.23416e+01" />
...
<vertex index="1867" x="1.35696e+02" y="3.91776e+01" z="-5.20005e+01" />
<vertex index="1868" x="2.11946e+02" y="4.14023e+01" z="-2.20125e+01" />
<vertex index="1869" x="6.98190e+00" y="1.10172e+01" z="-7.31615e+01" />
</vertices>
<cells size="7759">
<tetrahedron index="0" v0="224" v1="325" v2="1334" v3="1576" />
<tetrahedron index="1" v0="1111" v1="1201" v2="1265" v3="1427" />
<tetrahedron index="2" v0="92" v1="129" v2="329" v3="1306" />
...
<tetrahedron index="7756" v0="1132" v1="1501" v2="1640" v3="1869" />
<tetrahedron index="7757" v0="1132" v1="1230" v2="1640" v3="1869" />
<tetrahedron index="7758" v0="1230" v1="1501" v2="1640" v3="1869" />
</cells>
</mesh>
</dolfin>
```

## SHELL PATH

#### APPLE PYTHON 2.7

```   export PATH="\$PATH:/Library/Frameworks/Python.framework/Versions/2.7/bin"
```

#### FENICS-DOLFIN

```   source "/Applications/FEniCS.app/Contents/Resources/share/fenics/fenics.conf"
```

#### CANOPY PYTHON (COMPATIBLE WITH FENICS-DOLFIN)

```   export PATH="\$PATH:/Users/bradleymonk/Library/Enthought/Canopy_64bit/User/bin"
```