New open-source ANSYS-SolidWorks-FLAC3D geometry conversion programs

Numerical calculations are used increasingly often to obtain a stress-strain state in many engineering problems. A popular program for this type of calculation which makes use of the ﬁnite difference method (a continuous method) is Itasca ' s FLAC3D. However, an important limitation of FLAC3D is the difﬁculty of geometry creation. This paper presents new open-source programs allowing the preparation of numerical models in a third-party software (ANSYS, SolidWorks) and their conversion to internal FLAC3D geometry ﬁles. The converters have been written in BASH-scripting language and published under the terms of the GNU General Public License, which allows the free distribution and/or modiﬁcation of the software with some limitations.


Introduction
The process of designing and planning engineering structures may use analytical, empirical, and numerical methods. In light of the rapid increase in the data processing capacity of computers and the development of increasingly enhanced software for numerical modelling, it is advantageous to use numerical methods when searching for design solutions e especially in cases that need to take into consideration a great number of factors. Another important advantage of numerical modelling is the possibility of using 3D models, which becomes practically necessary in many current challenges of engineering and allows the proper representation of geological structure (Nielsen, Cunningham, Hay, Partington, & Stokes, 2015;Payne et al., 2015), but also the proper simulation of excavation, support and ground reinforcement, interaction between different types of support and/or coupling thermo-hydro-geomechanical approach (He, Feng, & Sun, 2008;Javeri, 2008;Hokmabadi, Fatahi, & Samali, 2014;Rutqvist, 2011;Safari & Ghassemi, 2015). The development of the geometry of 3D models could be performed in a dedicated software such as SolidWorks or ANSYS, but unfortunately it is not possible then to import these models directly into FLAC3D, which is one of the accepted softwares for geomechanical calculations. This paper presents solutions to bypass this limitation. Two converters have been written allowing the conversion of discretized models prepared in ANSYS and SolidWorks to a format compatible with FLAC3D.

Standard grid generation in FLAC3D
In older versions of FLAC3D (up to version 4.0) geometry generation was practically limited to the creation of assembly from simple, regular shaped objects (Fig. 1). It is possible to distort the grids to fit arbitrary volumes, but it is a laborious task. This is mainly due to the fact that each shape has a specific type of grid connectivity and its distortion must strictly follow the axis convention and the order of the points definition. During geometry generation using predefined grid shapes (primitives), it is possible to create a complete model with the desired geometry and to perform complex numerical calculations. Such an approach to geometry generation is often used in the analysis of various aspects of longwall mining (Jiang et al., 2012;Oraee, Oraee, & Bangian, 2010;Ross, Yu, & Nyikos, 2005;Xie, Chang, & Yang, 2009;Yasitli & Unver, 2005), but also in other fields, such as seismic (Chugh, 2005) or surface subsidence (Shahriar, Amoushahi, & Arabzadeh, 2009). The main advantage of using predefined shapes is the possibility to parametrize the geometric properties of objects and therefore the ability to generate a series of models quickly e for example shafts with various diameters and lining thickness (Fig. 2).
Geometry generation in FLAC3D has been extended in the current version 5.01 with the ability to import geometric data (e.g. DXF files) to filter objects by assigning group names. This technique may be useful for example in the analysis of multiple coal seam extractions (Fig. 3). In connection with another algorithm which is available and allows the densifying of mesh e realised by subdividing zones into two or more smaller zones in the same space (Fig. 4). In version 5.01, FLAC3D also provides a command which generates a grid between the faces of an existing grid and a geometry set. This tool may be particularly useful when generating the topography of a surface (Fig. 5).
The tools described were introduced in a FLAC3D version 5.0 which enables the creation of enough complex geometry to simulate and solve a large number of engineering problems. However, in some cases it is more convenient or even necessary to create geometry using third-party programs.

Existing mesh converters
Another approach to mesh creation is to prepare geometry in external programs and then to convert or discretize it using converters. Three such converters are available to the public:     The last converter, Kubrix Geo, seems to be the most widely used. One of the reasons for this is the possibility to create accurate and complex meshing of geometry, which is created in an external CAD software (Fig. 6).
Kubrix Geo creates mesh based on an STL file with closed, non-manifold, surface meshes (i.e., the volumes are "watertight" and all edges are shared by exactly two faces). However, the requirement is difficult to achieve in more complex models with a   j o u r n a l o f s u s t a i n a b l e m i n i n g 1 4 ( 2 0 1 5 ) 1 2 4 e1 3 2 large number of parts/groups. Another disadvantage of the Kubrix Geo is the closed source of the program and its high price. Due to these limitations, other converters have been developed which allow the conversion of already discretized mesh in ANSYS (2015) and SolidWorks (2015). The proof-of-concept version of the converters have been written in the BASHscripting language and published under the terms of the GNU General Public License (2015), which allows the free distribution and/or modification of the software with some limitations.

New open-source mesh converters
The main idea of ANSYS and SolidWorks converters is based on the ability of FLAC3D code to import a grid using IMPGRID command from third-party grid generators. IMPGRID creates a new gridpoint for each point specified in the input file. An example of a FLAC3D grid file is shown in Table 1. The analysis of the file structure shows that there are some similarities to the ANSYS FEModeler mesh in a format compatible with Mechanical APDL input (Table 2) and Geostar file, which is the default file type for exporting in Solid-Works (Table 3).
The very similar structure of these files means that a simple conversion between them can be made using, for example, a Bash shell, which is a default macro processor that executes commands in Linux OS. The GNU Project (2015) describes it as: …both a command interpreter and a programming language. As a command interpreter, the shell provides the user interface to the rich set of GNU utilities. The j o u r n a l o f s u s t a i n a b l e m i n i n g 1 4 ( 2 0 1 5 ) 1 2 4 e1 3 2 programming language features allow these utilities to be combined. Files containing commands can be created, and become commands themselves. These new commands have the same status as system commands in directories such as/bin, allowing users or groups to establish custom environments to automate their common tasks. The last feature allows external programs to be used in the same way as internal commands e and as a result new tools can be easily and quickly developed. For the ANSYS/SolidWorks converters, the following standard GNU core utilities (2015) and additional programs have been used: standard GNU core utilities: basename e strip directory and suffix from filenames cat e concatenate files and print on the standard output cut e remove sections from each line of files date e print or set the system date and time echo e display a line of text head e output the first part of files rm e remove files or directories tail e output the last part of files tr e translate or delete characters wc e print newline, word, and byte counts for each file additional programs: gawk e GNU awk pattern scanning and processing language (2015) grep e GNU regular expression matcher (2015) perl e The Perl Programming Language (2015) The source codes of the converters are provided in Appendix 1 (ANSYS-FLAC3D converter) and Appendix 2 (SolidWorks-FLAC3D converter). Both of the programs should function without additional requirements on any computer operating under Linux OS. The additional programs (gawk, grep and perl) although not belonging to the standard GNU core utilities, are basic tools installed by default during Linux installation.
The ANSYS-FLAC3D converter allows the transformation of mesh discretized using tetrahedral, wedge and brick type zones (Figs. 7e9). The mesh may be mixed with any of the listed types.
The second converter for discretized models created in SolidWorks allows the transformation of tetrahedral type zones only (Fig. 10).
The main difference between the developed converters and the Kubrix Geo software is that the new converters use an already discretized geometry, including the division of solids Table 3 e A part of a typical SolidWorks (Geostar) geometry file. j o u r n a l o f s u s t a i n a b l e m i n i n g 1 4 ( 2 0 1 5 ) 1 2 4 e1 3 2 Fig. 8 e Model of a coal longwall extraction using brick type zones (W8) generated with ANSYS-FLAC3D converter. Fig. 9 e Model of a shaft inset using tetrahedral type zones generated with ANSYS-FLAC3D converter. Fig. 7 e Model of an underground coal bunker using mixed tetrahedral and wedge type zones generated with an ANSYS-FLAC3D converter with regular mesh needed for the modelling of concrete beam reinforcement.
j o u r n a l o f s u s t a i n a b l e m i n i n g 1 4 ( 2 0 1 5 ) 1 2 4 e1 3 2 into specific parts (groups). Such an approach makes it possible to use a complex geometry with a large number of groups, which is difficult to achieve with Kubrix Geo due to the limitation of an STL-file. Therefore the functioning of the new converters is more like that of the gocad2flac3d.py program, which also uses the existing partitioning of solid objects created in GoCAD. The unique feature of the ANSYS-FLAC3D converter is the possibility to use mixed mesh type zones (tetrahedral, wedge and brick) and thus the optimization of a mesh. From all of the analysed programs, the F2F seems to have the lowest applicability because it can only be used for extruding an existing 2D geometry.

Summary
The newer versions of FLAC3D (version 5.0 and above) allow the creation of complex geometry using new tools for mesh manipulation and for the importing of geometry created in third-party CAD software. However, in some specific cases it is more convenient or even necessary to import an already discretized model prepared in ANSYS or SolidWorks. This paper presents two programs that allow such conversion to a format compatible with FLAC3D. The converters, published under the terms of the GNU General Public License, use the BASH shell. This allows for simple implementation of developed algorithms, however at the cost of a low speed of conversion. Therefore, in the future, newer versions of converters developed using JAVA language are planned. j o u r n a l o f s u s t a i n a b l e m i n i n g 1 4 ( 2 0 1 5 ) 1 2 4 e1 3 2