Debian Codegraph @

examples/jointed_box_file.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 __future__ import print_function
14 from gengeo import *
15 from read_jointset import *
16 import sys
17
18 # An example python script to generate a bonded rectangular prism,
19 # import joint sets and tag bonds crossing joints
20 # takes file name of joint set as an argument
21
22 # particle properties
23 minRadius = 0.2
24 maxRadius = 1.0
25
26 #set up joint set
27 joints=TriPatchSet()
28
29 # read joints from file
30 readJointFileTagSet(joints,sys.argv[1])
31
32 # output bounding box of joint set
33 print("Bounding Box of Joint Set: " , joints.getMinPoint(), joints.getMaxPoint())
34
35 # Define region extremities using the bounding box of the joint set
36 minPoint = joints.getMinPoint()-Vector3(1.0,1.0,1.0)
37 maxPoint = joints.getMaxPoint()-Vector3(1.0,1.0,1.0)
38
39
40 # Define the volume to be filled with spheres:
41
42 box = BoxWithPlanes3D (
43 minPoint = minPoint,
44 maxPoint = maxPoint
45 )
46
47 # boundary planes
48 box.addPlane(Plane(minPoint,Vector3(1.0,0.0,0.0)))
49 box.addPlane(Plane(minPoint, Vector3(0.0,1.0,0.0)))
50 box.addPlane(Plane(minPoint, Vector3(0.0,0.0,1.0)))
51 box.addPlane(Plane(maxPoint, Vector3(-1.0,0.0,0.0)))
52 box.addPlane(Plane(maxPoint, Vector3(0.0,-1.0,0.0)))
53 box.addPlane(Plane(maxPoint, Vector3(0.0,0.0,-1.0)))
54
55 # Create a multi-group neighbour table to contain the particles:
56 mntable = MNTable3D (
57 minPoint = minPoint,
58 maxPoint = maxPoint,
59 gridSize = 2.5*maxRadius
60 )
61
62
63 # Fill the volume with particles:
64 packer = InsertGenerator3D (
65 minRadius = minRadius,
66 maxRadius = maxRadius,
67 insertFails = 1000,
68 maxIterations = 1000,
69 tolerance = 1.0e-6,
70 seed=42
71 )
72
73 packer.generatePacking(
74 volume = box,
75 ntable = mntable,
76 tag = 2
77 )
78
79
80 #bonding
81 tol=1.0e-5
82 basetag=1 # tag for the "normal" bonds
83 mntable.generateBondsWithJointSet(joints,0,tol,basetag)
84
85 # write a geometry and a VTK file
86 mntable.write("temp/box_"+str(maxRadius)+".geo",1)
87 mntable.write("temp/box_"+str(maxRadius)+".vtu",2)