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

« back to all changes in this revision

Viewing changes to examples/gengeo_example9.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
#An example python script to generate a rough ellipsoid of unbonded particles
 
15
 
 
16
# Define region extremities:
 
17
origin = Vector3(0.0,0.0,0.0)
 
18
size = 5.0
 
19
minPoint = Vector3(-1.0*size,-1.0*size,-1.0*size)
 
20
maxPoint = Vector3(size,size,size)
 
21
 
 
22
# Define the volume to be filled with spheres:
 
23
sphereVol = EllipsoidVol (
 
24
   centre = origin,
 
25
   Lx = 8.0,
 
26
   Ly = 6.0,
 
27
   Lz = 3.0
 
28
)
 
29
 
 
30
# Create a multi-group neighbour table to contain the particles:
 
31
mntable = MNTable3D (
 
32
   minPoint = minPoint,
 
33
   maxPoint = maxPoint,
 
34
   gridSize = 2.2
 
35
)
 
36
 
 
37
# Fill the volume with particles:
 
38
packer = InsertGenerator3D (
 
39
   minRadius = 0.2,
 
40
   maxRadius = 1.0,
 
41
   insertFails = 1000,
 
42
   maxIterations = 1000,
 
43
   tolerance = 1.0e-6
 
44
)
 
45
 
 
46
# Generate the packing
 
47
packer.generatePacking(
 
48
   volume = sphereVol, 
 
49
   ntable = mntable
 
50
)
 
51
 
 
52
# write a geometry file in VTK format
 
53
mntable.write(
 
54
   fileName = "temp/geo_example9.vtu",
 
55
   outputStyle = 2
 
56
)
 
57
 
 
58
# write a geometry file in ESyS-Particle geo format
 
59
mntable.write(
 
60
   fileName = "temp/geo_example9.geo",
 
61
   outputStyle = 1
 
62
)