Debian Codegraph @

examples/gengeo_example9.py

raw
1 #############################################################
2 ## ##
3 ## Copyright (c) 2007-2017 by The University of Queensland ##
4 ## Centre for Geoscience Computing ##
5 ## http://earth.uq.edu.au/centre-geoscience-computing ##
6 ## ##
7 ## Primary Business: Brisbane, Queensland, Australia ##
8 ## Licensed under the Open Software License version 3.0 ##
9 ## http://www.apache.org/licenses/LICENSE-2.0 ##
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 )