Manual
Manual
Abstract
U nBlocksgen is a Python 3 library for the generation and analysis
of 3D rock block systems. This technical documentation gives an
introduction to the three main features provided by the library: Discrete
Fracture Network construction; block system generation; and rock
blocks’ shape and size analysis. Instructions as to the installation,
compilation from source and library usage are also provided.
1
Contents
1 Introduction 3
1.1 Compilation from Source and Installation . . . . . . . . . . . 3
2 Examples 4
2.1 Simple Rock Mass . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2 Rock Mass with a Tunnel . . . . . . . . . . . . . . . . . . . . 8
2.3 Open Pit Slope Model . . . . . . . . . . . . . . . . . . . . . . 15
5 Acknowledging U nBlocksgen 20
2
1 Introduction
Instructions on how to compile U nBlocksgen from source and installing the
library are provided. The library has been developed for Python 3 and tested
in Ubuntu 18.04 Bionic Beaver and Ubuntu 20.04 Focal Fossa. It has not
been prepared for Windows or other Linux distributions, however with few
modifications it may also work in these operational systems.
• cmake
• build-essential
• python3
• python3-numpy
• python3-matplotlib
• coinor-clp
• coinor-libclp-dev
• libboost-python-dev
• paraview
3
In case Ubuntu 20.04 Focal Fossa is the operational system used, the
following additional packages available from Ubuntu Package archive must
also be installed:
• libboost1.67-dev
• libboost-python1.67-dev
’cmake ..’
’make’.
Compilation will start and the library file ’unblocks.so’ will be produced.
In this way, compilation of U nBlocksgen from source is concluded. It should
be reminded that, to use the library, the files ’unblocks.so’, ’plotTools.py’
and ’TriangularPlot.png’ should be kept together in the same folder.
2 Examples
Three examples are given to introduce the user to the main features of
U nBlocksgen :
4
2.1 Simple Rock Mass
In this first example, it is shown how the user can interact with U nBlocksgen
in Python 3. A simple deterministic Discrete Fracture Network containing
two fracture sets will be created. Each fracture set will contain two fractures
and will provide the input for the 3D block system generation.
In order to start, in Ubuntu terminal access the library file ’unblocks.so’
location and run Python 3. In the Python terminal, write the following
command:
1 >>> from unblocks import *
In case the library was successfully loaded, the screen should appear
similar to the one presented in Fig. 1 below:
It is now necessary that the fracture sets be filled with one or more
fractures. A triangular and a circular fracture will be added to each set:
5
1 >>> dfn . fractureSets [0]. add _T ri ang ul ar Fr act ur e
([10 ,10 ,10] ,[80 ,90 ,70] ,[35 ,60 ,15])
2 Triangular fracture id 0 added !
3 >>> dfn . fractureSets [0]. add_CircularFracture
([50 ,50 ,50] ,90 ,45 ,40)
4 Fracture id 1 added !
5 >>> dfn . fractureSets [1]. add _T ri ang ul ar Fr act ur e
([60 ,35 ,75] ,[15 ,45 ,20] ,[85 ,70 ,40])
6 Triangular fracture id 0 added !
7 >>> dfn . fractureSets [1]. add_CircularFracture
([30 ,30 ,60] ,180 ,90 ,30)
8 Fracture id 1 added !
When inserting a triangular fracture, the three corner points that form
the triangle should be informed. When inserting a circular fracture, the
center point of the fracture is first provided, followed by the dip direction,
dip angle and fracture radius values. U nBlocksgen assumes that the north
direction is defined by the X axis and dip direction is a clockwise angular
rotation from X. Fig. 2 illustrates the convention used with an example.
Discontinuity 045°/30°
z
y x N
45°
30°
The constructed DFN and the model region can be exported to VTK files
so as to be visualized. The commands below show the export commands which
will generate the VTK files named ’dfnCreated.vtk’ and ’modelRegion.vtk’.
These can be visualized in Paraview, as shown in Fig. 3
1 >>> dfn . export_DFNVtk ( " dfnCreated " )
2 DFN Vtk exported !
3 >>> dfn . export_RegionVtk ( " modelRegion " )
4 DFN Region Vtk exported !
Once the desired DFN has been constructed, the next step consists in
the generation of the 3D block system. This can be achieved by means of
the Generator class, which should be instantiated into a Python object. The
Generator object provides access to the commands for generating the 3D
block system from a constructed DFN.
The commands below shows the instantiation of a Python object from the
6
Figure 3: DFN fractures and model region. Fracture sets indicated by the
red and blue colors.
Generator class, the generation of the block system based on the DFN object
previously constructed, and the creation of the VTK file ’rockBlocks.vtk’ for
visualization in Paraview.
1 >>> generator = Generator ()
2 >>> generator . generate_RockMass ( dfn )
3 Fracture id 0 from Fracture Set 0 is being analysed !
4 Fracture id 1 from Fracture Set 0 is being analysed !
5 Fracture id 0 from Fracture Set 1 is being analysed !
6 Fracture id 1 from Fracture Set 1 is being analysed !
7 Generated Block 0 Geometry
8 Generated Block 1 Geometry
9 Generated Block 2 Geometry
10 Generated Block 3 Geometry
11 Generated Block 4 Geometry
12 Generated Block 5 Geometry
13 Generated Block 6 Geometry
14 Generated Block 7 Geometry
15 Generated Block 8 Geometry
16 Generated Block 9 Geometry
17 Generated Block 10 Geometry
18 Generated Block 11 Geometry
19 Generated Block 12 Geometry
20 >>> generator . export_BlocksVtk ( " rockBlocks " )
7
approach, the model region is sliced sequentially, starting with the first
fracture of the first fracture set until the last fracture of the last fracture set.
Therefore, it is strongly recommended that fracture sets with more persistent
fractures are defined first during the DFN construction phase.
Figure 4: 3D block system generated from the constructed DFN. Blocks have
been shrunk to facilitate their visualization.
8
2. Orientations are defined by the Fisher distribution.
The table below presents the calibrated stochastic DFN parameters from
the Monte Seco tunnel section analyzed.
In order to construct the stochastic DFN for the Monte Seco tunnel rock
mass using U nBlocksgen , it will be necessary to make use of two mapping
classes: the line and volume mappings. While line mapping provides for the
calculation of P10 fracture frequency, the volume mapping gives P30 and
P32 fracture intensity values. P10, P30 and P32 are values based on the
P-system proposed by Dershowitz and Herda [4].
In order to start, first U nBlocksgen library and ’plotTools’ should be
imported into Python. In this example, ’plotTools.py’ (make sure this file
is available together with ’TriangularPlot.png’) will used to generate three
blocks’ shape and size analysis plots: block volume distribution, block shape
diagram and block shape distribution. These plots have been suggested by
Kalenchuk et al. [5] to assist with the rock block analysis process. The
Python commands are:
1 >>> from unblocks import *
2 >>> import plotTools
Subsequently, the dfn object shoud be instantiated from the DFN class
and the models’ size set equal to 10m x 30m x 30m. A seed value to
the pseudo-random number generation system should also be selected. To
add a line mapping, two points representing the extremes ends of the line
are required. In the current version of the library, a volume mapping
automatically encompasses the whole model region. The commands below
show the DFN object creation with the inclusion of three fracture sets as
well as a line and a volume mapping:
1 >>> dfn = DFN ()
2 >>> dfn . set_RegionMaxCorner ([10 ,30 ,30])
3 >>> dfn . set_RandomSeed (100)
4 >>> dfn . add_FractureSet ()
5 Fracture Set number 0 added !
6 >>> dfn . add_FractureSet ()
9
7 Fracture Set number 1 added !
8 >>> dfn . add_FractureSet ()
9 Fracture Set number 2 added !
10 >>> dfn . add_LineMapping ([10 ,30 ,0] ,
[0.766582 ,4.631392 ,24.30794])
11 Line mapping added !
12 >>> dfn . add_VolumeMapping ()
13 Volume mapping added !
1. Dip direction.
2. Dip angle.
Once the loops start, thousands of fractures will be added. In the end
of the process, the stochastic DFN can be exported to a VTK file with the
following command for visualization in Paraview. In case necessary, the
DFN of each fracture set can be exported to a VTK file separately and
the commands for achieving this are also shown below. Fig. 6 shows the
resulting DFN model.
10
1 >>> dfn . export_DFNVtk ( " dfn " )
2 DFN Vtk exported !
3 >>> dfn . fractureSets [0]. e xport _Fra ctur eSetV tk ( " fracSet0 " )
4 >>> dfn . fractureSets [1]. e xport _Fra ctur eSetV tk ( " fracSet1 " )
5 >>> dfn . fractureSets [2]. e xport _Fra ctur eSetV tk ( " fracSet2 " )
Figure 6: Constructed stochastic DFN for the Monte Seco tunnel rock mass.
11
1 >>> generator = Generator ()
2 >>> generator . s e t _ M i n I n s c r i b e d S p h e r e R a d i u s (0.05)
3 >>> generator . set_MaxAspectRatio (30)
4 >>> generator . generate_RockMass ( dfn )
5 >>> generator . export_BlocksVtk ( " blo ck sB ef ore Ex ca vat io n " )
In order to analyze the resulting block system, the library provides for
the creation of three different plots: block volume distribution, block shape
diagram and block shape distribution. These plots were proposed in the
work of Kalenchuck et al. [5] and the reader is referred to this publication
for further information. It is recommended that these plots be generated and
visualized before any excavation is performed, otherwise cut blocks, which
are no longer representative of the constructed DFN, would be analyzed as
well. As stated before, the ’plotTools.py’ Python script is used for generating
12
the plots based on the Matplotlib package [6] and the commands that should
be used are:
1 >>> plotTools . bl o ck Vo l um e Di st r ib u ti o n ( generator . get_Volumes (
False ) )
2 >>> plotTools . blockShapeDiagram ( generator . get_AlphaValues ( False
) , generator . get_BetaValues ( False ) , generator . get_Volumes (
False ) , 0.05)
3 >>> plotTools . Blo ck Sh ape Di st ri but io n ( generator . get_AlphaValues (
False ) , generator . get_BetaValues ( False ) , generator .
get_Volumes ( False ) )
4 >>> plotTools . showPlots ()
13
Figure 9: Block shape distribution.
14
for delimiting the excavation region. The excavation elements are triangles
with vertices and connectivity defined by an external file with extension
’OBJ’. This files should be written with the following configuration: first, all
vertices are inserted, followed by the triangles’ connectivity. Every line with
vertice data should begin with the ’v’ letter and every line with connectivity
information should start with the ’f’ letter. This example comes with the
’tunnel.obj’ file, which should be studied and understood.
The tunnel excavation is performed and the block system VTK file
generated by the following commands. The block system including the
tunnel excavation is presented in Fig. 11.
1 >>> generator . i m p o r t _ E x c a v a t i o n E l e m e n t s O b j ( " tunnel " )
2 >>> generator . e x p o r t _ E x c a v a t i o n E l e m e n t s V t k ( " tunnelvtk " )
3 >>> generator . excavate_RockMass ()
4 >>> generator . export_BlocksVtk ( " b lock sAfte rExc avat ion " )
Figure 11: 3D block system generated from the constructed DFN with a
tunnel excavation.
15
Fig. 12 shows the open pit excavation region in darker gray color and
Fig. 13 the block system generated considering the excavation. Of note, the
observant user may realize that, apparently, "extra" blocks are generated
near the benches. This is due to the fictitious excavation planes that are
used to assist in adjusting the model geometry to the excavation process.
However, the blocks’ ID number define the block that should be clumped
after the excavation. In this way, make sure that blocks with the same ID
are checked when determining the blocks real geometry, in case they are used
in other software packages (e.g. DEM or DDA simulation tools).
Figure 12: Excavation region being represented by the darker gray color.
Figure 13: 3D block system generated from the constructed DFN with an
open pit excavation.
The Python commands for this example can be found in the examples
folder.
16
3 Library Python Commands
3.1 Discrete Fracture Network construction
The following commands are available from a DFN object:
17
• add_BaecherFracture(meanDipDirection, meanDipAngle, fisherConstant,
"sizeDistribution", meanFractureSize, stdFractureSize) - Add
a new circular stochastic fracture with location following a Poisson
process, orientation being defined by the Fisher distribution and
persistence (i.e. fracture radius) following either a deterministic value,
exponential distribution or log-normal distribution. The distribution
is selected by setting "sizeDistribution" equal to "det", "exp" or "log".
’stdFractureSize’ value is not used by both deterministic and exponentially
distributed persistence.
18
3.2 3D Block System generation
The following commands are available from a Generator object:
19
• get_Order() - Get the order of the block.
5 Acknowledging U nBlocksgen
In case U nBlocksgen was used for a scientific research, please provide the
citation to the following SoftwareX journal paper: (recently submitted to
SoftwareX)
20
References
[1] U. Ayachit, “The paraview guide: A parallel visualization application,”
2015.
[2] C. Boon, G. Houlsby, and S. Utili, “A new rock slicing method based on
linear programming,” Computers and Geotechnics, vol. 65, pp. 12 – 29,
2015.
21