File: simple_box_compact.py.tex

package info (click to toggle)
esys-particle 2.3.5%2Bdfsg2-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 13,132 kB
  • sloc: cpp: 81,480; python: 5,872; makefile: 1,259; sh: 313; perl: 225
file content (46 lines) | stat: -rw-r--r-- 918 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
\subsection{\texttt{simple\_box.py}}\label{geocode:box}

\begin{verbatim}
# --- geometry setup script for simple box ---
from gengeo import *

#  -- parameters  --
# block dimensions
xdim=10
ydim=20
zdim=10

# particle size range
minRadius = 0.2
maxRadius = 1.0
# ---------------------

# corner points
minPoint = Vector3(0.0,0.0,0.0)
maxPoint = Vector3(xdim,ydim,zdim)

# block volume
box = BoxWithPlanes3D(minPoint,maxPoint)

# neighbour table 
mntable = MNTable3D(minPoint,maxPoint,2.5*maxRadius,1)

# -- setup packer --
# iteration parameters
insertFails = 1000
maxIter = 1000
tol = 1.0e-6

# packer
packer = InsertGenerator3D(minRadius,maxRadius,insertFails,maxIter,tol)

# pack particles into volume
packer.generatePacking(box,mntable)
	
# create bonds between neighbouring particles:
mntable.generateBonds(0,1.0e-5,0)

# write a geometry file
mntable.write("box.geo",1)
mntable.write("box.vtu",2)
\end{verbatim}