Debian Codegraph @

examples/gengeo_example4.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 dogbone of unbonded particles
15
16 # Define region extremities:
17 l2 = 10.0
18 r2 = 2.5
19 origin = Vector3(0.0,0.0,0.0)
20 axis = Vector3(0.0,1.0,0.0)
21 size = 5.0
22 minPoint = Vector3(-1.0*size,0.0,-1.0*size)
23 maxPoint = Vector3(size,3.0*size,size)
24
25 # Define the volume to be filled with spheres:
26 dogbone = DogBone (
27 origin = origin,
28 axis = axis,
29 length = 3.0*size,
30 radius = size,
31 l2 = l2,
32 r2 = r2
33 )
34
35 # Create a multi-group neighbour table to contain the particles:
36 mntable = MNTable3D (
37 minPoint = minPoint,
38 maxPoint = maxPoint,
39 gridSize = 2.2
40 )
41
42 # Fill the volume with particles:
43 packer = InsertGenerator3D (
44 minRadius = 0.2,
45 maxRadius = 1.0,
46 insertFails = 1000,
47 maxIterations = 1000,
48 tolerance = 1.0e-6
49 )
50
51 # Generate the packing
52 packer.generatePacking(
53 volume = dogbone,
54 ntable = mntable
55 )
56
57 # write a geometry file in VTK format
58 mntable.write(
59 fileName = "temp/geo_example4.vtu",
60 outputStyle = 2
61 )
62
63 # write a geometry file in ESyS-Particle geo format
64 mntable.write(
65 fileName = "temp/geo_example4.geo",
66 outputStyle = 1
67 )