Debian Codegraph @

examples/gengeo_example5.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 sphere 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 = SphereVol (
24 centre = origin,
25 radius = size
26 )
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 = sphereVol,
47 ntable = mntable
48 )
49
50 # write a geometry file in VTK format
51 mntable.write(
52 fileName = "temp/geo_example5.vtu",
53 outputStyle = 2
54 )
55
56 # write a geometry file in ESyS-Particle geo format
57 mntable.write(
58 fileName = "temp/geo_example5.geo",
59 outputStyle = 1
60 )