~esys-p-dev/esys-particle/gengeo

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#############################################################
##                                                         ##
## Copyright (c) 2007-2014 by The University of Queensland ##
## Centre for Geoscience Computing                         ##
## http://earth.uq.edu.au/centre-geoscience-computing      ##
##                                                         ##
## Primary Business: Brisbane, Queensland, Australia       ##
## Licensed under the Open Software License version 3.0    ##
## http://www.opensource.org/licenses/osl-3.0.php          ##
##                                                         ##
#############################################################

from __future__ import print_function
from gengeo     import *
from read_jointset import *
import sys

# An example python script to generate a bonded rectangular prism,
# import joint sets and tag bonds crossing joints
# takes file name of joint set as an argument

# particle properties
minRadius = 0.2
maxRadius = 1.0

#set up joint set
joints=TriPatchSet()

# read joints from file
readJointFileTagSet(joints,sys.argv[1])

# output bounding box of joint set
print("Bounding Box of Joint Set: " , joints.getMinPoint(), joints.getMaxPoint())

# Define region extremities using the bounding box of the joint set
minPoint = joints.getMinPoint()-Vector3(1.0,1.0,1.0)
maxPoint = joints.getMaxPoint()-Vector3(1.0,1.0,1.0)


# Define the volume to be filled with spheres:

box = BoxWithPlanes3D (
   minPoint = minPoint,
   maxPoint = maxPoint
)

# boundary planes
box.addPlane(Plane(minPoint,Vector3(1.0,0.0,0.0)))
box.addPlane(Plane(minPoint, Vector3(0.0,1.0,0.0)))
box.addPlane(Plane(minPoint, Vector3(0.0,0.0,1.0)))
box.addPlane(Plane(maxPoint, Vector3(-1.0,0.0,0.0)))
box.addPlane(Plane(maxPoint, Vector3(0.0,-1.0,0.0)))
box.addPlane(Plane(maxPoint, Vector3(0.0,0.0,-1.0)))

# Create a multi-group neighbour table to contain the particles:
mntable = MNTable3D (
   minPoint = minPoint,
   maxPoint = maxPoint,
   gridSize = 2.5*maxRadius
)


# Fill the volume with particles:
packer = InsertGenerator3D (
   minRadius = minRadius,
   maxRadius = maxRadius,
   insertFails = 1000,
   maxIterations = 1000,
   tolerance = 1.0e-6,
   seed=42
)

packer.generatePacking(
   volume = box, 
   ntable = mntable,
   tag = 2
)


#bonding
tol=1.0e-5
basetag=1 # tag for the "normal" bonds
mntable.generateBondsWithJointSet(joints,0,tol,basetag)

# write a geometry and a VTK file
mntable.write("temp/box_"+str(maxRadius)+".geo",1)
mntable.write("temp/box_"+str(maxRadius)+".vtu",2)