Debian Codegraph @

examples/gengeo_example3.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
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 )