~ubuntu-branches/ubuntu/saucy/python-demgengeo/saucy

« back to all changes in this revision

Viewing changes to examples/gengeo_example3.py

  • Committer: Package Import Robot
  • Author(s): Anton Gladky
  • Date: 2011-11-18 21:47:18 UTC
  • Revision ID: package-import@ubuntu.com-20111118214718-4ysqm3dhpqwdd7gd
Tags: upstream-0.99~bzr106
ImportĀ upstreamĀ versionĀ 0.99~bzr106

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#############################################################
 
2
##                                                         ##
 
3
## Copyright (c) 2007-2011 by The University of Queensland ##
 
4
## Earth Systems Science Computational Centre (ESSCC)      ##
 
5
## http://www.uq.edu.au/esscc                              ##
 
6
##                                                         ##
 
7
## Primary Business: Brisbane, Queensland, Australia       ##
 
8
## Licensed under the Open Software License version 3.0    ##
 
9
## http://www.opensource.org/licenses/osl-3.0.php          ##
 
10
##                                                         ##
 
11
#############################################################
 
12
 
 
13
from gengeo import *
 
14
 
 
15
#An example python script to generate a cylinder of unbonded particles
 
16
 
 
17
# Define region extremities:
 
18
origin = Vector3(0.0,0.0,0.0)
 
19
axis = Vector3(0.0,1.0,0.0)
 
20
size = 5.0
 
21
minPoint = Vector3(-1.0*size,0.0,-1.0*size)
 
22
maxPoint = Vector3(size,3.0*size,size)
 
23
 
 
24
# Define the volume to be filled with spheres:
 
25
#       (e.g. a cylinder)
 
26
cylinder = CylinderVol ( origin = origin, axis = axis, length = 3.0*size, radius = size)
 
27
 
 
28
# Create a multi-group neighbour table to contain the particles:
 
29
mntable = MNTable3D (
 
30
   minPoint = minPoint,
 
31
   maxPoint = maxPoint,
 
32
   gridSize = 2.2
 
33
)
 
34
 
 
35
# Fill the volume with particles:
 
36
packer = InsertGenerator3D (
 
37
   minRadius = 0.2,
 
38
   maxRadius = 1.0,
 
39
   insertFails = 1000,
 
40
   maxIterations = 1000,
 
41
   tolerance = 1.0e-6
 
42
)
 
43
 
 
44
# Generate the packing
 
45
packer.generatePacking(
 
46
   volume = cylinder, 
 
47
   ntable = mntable
 
48
)
 
49
 
 
50
# write a geometry file in VTK format
 
51
mntable.write(
 
52
   fileName = "temp/geo_example3.vtu",
 
53
   outputStyle = 2
 
54
)
 
55
 
 
56
# write a geometry file in ESyS-Particle geo format
 
57
mntable.write(
 
58
   fileName = "temp/geo_example3.geo",
 
59
   outputStyle = 1
 
60
)