1
#############################################################
3
## Copyright (c) 2007-2011 by The University of Queensland ##
4
## Earth Systems Science Computational Centre (ESSCC) ##
5
## http://www.uq.edu.au/esscc ##
7
## Primary Business: Brisbane, Queensland, Australia ##
8
## Licensed under the Open Software License version 3.0 ##
9
## http://www.opensource.org/licenses/osl-3.0.php ##
11
#############################################################
14
from random import random
16
#An example python script to generate a bonded rectangle of particles with a discrete fracture network included
20
# Define region extremities:
21
minPoint = Vector3(0.0,0.0,0.0)
22
maxPoint = Vector3(width,height,0.0)
24
# Define the geometrical constraints for packing
25
# (e.g. lines bordering a rectangular region in 2D)
26
# QUESTION: Is there a particular order for defining endpoints of lines?
28
startPoint = Vector3(width,0.0,0.0),
32
bottom_line = Line2D (
33
startPoint = maxPoint,
34
endPoint = Vector3(0.0,height,0.0)
38
startPoint = Vector3(width,0.0,0.0),
43
startPoint = minPoint,
44
endPoint = Vector3(0.0,height,0.0)
47
# Define the Volume to be filled with spheres:
48
# (e.g. a BoxWithLines2D)
49
box = BoxWithLines2D (
55
box.addLine(bottom_line)
56
box.addLine(left_line)
57
box.addLine(right_line)
60
# Create a multi-group neighbour table to contain the particles:
67
# Fill the volume with particles:
68
packer = InsertGenerator2D (
72
maxIterations = 10000,
76
packer.generatePacking( volume = box, ntable = mntable, tag = 0)
78
# create bonds between neighbouring particles:
79
mntable.generateBonds(
84
#Add a discrete fracture network
87
for f in range(n_faults):
89
x0 = random()*0.8*width + 0.1*width
90
y0 = random()*0.8*height + 0.1*height
91
x1 = random()*0.8*width + 0.1*width
92
y1 = random()*0.8*height + 0.1*height
94
brkLine = LineSegment2D (
95
startPoint = Vector3(x0,y0,0.0),
96
endPoint = Vector3(x1,y1,0.0)
98
breakLines.append(brkLine)
100
mntable.breakBondsAlongLineSegment(
101
lineSegment = brkLine,
106
# write a geometry file
108
fileName = "temp/geo_DFN_2.vtu",