full paper id226 rashed iccesd2012 preprint (1)

10
Proceedings of the 1st International Conference on Civil Engineering for Sustainable Development (ICCESD-2012), 2~3 March 2012, KUET, Khulna, Bangladesh DEVELOPMENT AND EVALUATION OF AN OPEN SOURCE FINITE ELEMENT ANALYSIS FRAMEWORK Md. Golam Rashed 1* 1 Lecturer, Department of Civil Engineering, Ahsanullah University of Science and Technology, Dhaka-1208, Bangladesh, e-mail: [email protected] ABSTRACT The use of Finite Element Method (FEM) in engineering simulation has been increasing with the rapid advancement of computing power. Complete control of the simulation process can not be achieved by using proprietary commercial FEM codes as they tend to act like a black box. This problem can be eliminated by using calls to existing compiled libraries from a high level language, preferably a scripting language like python. This paper discusses the benefits can be taken by employing open source software development approach in developing a FEM framework using freely available python libraries and wraping legacy C/C++ or FORTRAN libraries around python. It also discusses the working procedure of the developed framework and its evaluation as an answer to the black box dilemma. Keywords: Finite Element Method, Numerical Modeling, Engineering Simulation, Scientific Computing, Python. 1. INTRODUCTION The finite element analysis is a computer-based numerical technique that is widely used to solve engineering problems. Major applications for FEA include static, dynamic and thermal characterizations of mechanical phenomenon occuring in nature. Advances in computer hardware have made FEA easier and very efficient into solving complex engineering problems on desktop computers (Abaqus/CAE, 2011). In spite of the great power of FEA, the disadvantages of computer solutions must be kept in mind when using this method. They do not necessarily reveal how the stresses are influenced by important problem variables such as materials properties and geometrical features, and errors in input data can produce wildly incorrect results that may be overlooked by the analyst. Perhaps the most important function of theoretical modeling is that of sharpening the user’s intuition, users of finite element codes should plan their strategy toward this end by supplementing the computer simulation with as much closed-form and experimental analysis as possible (Roylance, 2001). Moreover, To avoid input errors and increase the simulation reliability, the user must have the access to the source code level. 2. PRACTICES IN ENGINEERING SIMULATION Basically, there are three possible approaches by which finite element analysis is performed for an engineering phenomena. Firstly, one can use a propritery finite element analysis software package, such as ABAQUS (Abaqus/CAE, 2011), ANSYS (ANSYS - Simulation Driven Product Development, 2011) or even general purpose prototyping framework MATLAB (MATLAB - The Language Of Technical Computing, 2011). The main advantage of these FEA software packages is that they come with both pre and post-prossesor equiped. The operation of a specific software is usually detailed in the documentation accompanying the software, and vendors of the more expensive codes will often offer workshops or training sessions as well to help users learn the intricacies of code operation. One problem users may have even after this training is that the code tends to be a "black box" whose inner workings are not understood by the end user. Thus, although ABAQUS, ANSYS are good for finite element analysis, they are not suitable for full-blown research projects, where complete control is the top most priority. Furthermore, they have fixed keywords, are not open source, very expensive and not wildly accepted in academia. Secondly, one could develop their own FEA program, in a high-level language. However, one should realize that, Most of the high level language is scripting type, so the concern for speed is great if the whole program is coded in that language alone. FEA involves solution of large matrices which require high computing power as well as efficient algorithm. In many cases, pre-written library routines offer solutions to numerical problems which are pretty hard to improve upon. Thirdly, coding can be done in a high-level language like python (Python Programming Language – Official Website, 2011), but using calls to pre-written, pre-compiled routines in commonly available subroutine libraries, such as UMFPACK (UMFPACK: unsymmetric multifrontal sparse LU factorization package, 2011), LAPACK

Upload: biondav

Post on 01-Dec-2015

11 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Full Paper ID226 Rashed ICCESD2012 Preprint (1)

Proceedings of the 1st International Conference on Civil Engineering for Sustainable Development (ICCESD-2012), 2~3 March 2012, KUET, Khulna, Bangladesh

DEVELOPMENT AND EVALUATION OF AN OPEN SOURCE FINITE ELEMENT

ANALYSIS FRAMEWORK

Md. Golam Rashed 1*

1 Lecturer, Department of Civil Engineering, Ahsanullah University of Science and Technology, Dhaka-1208, Bangladesh, e-mail: [email protected]

ABSTRACT The use of Finite Element Method (FEM) in engineering simulation has been increasing with the rapid advancement of computing power. Complete control of the simulation process can not be achieved by using proprietary commercial FEM codes as they tend to act like a black box. This problem can be eliminated by using calls to existing compiled libraries from a high level language, preferably a scripting language like python. This paper discusses the benefits can be taken by employing open source software development approach in developing a FEM framework using freely available python libraries and wraping legacy C/C++ or FORTRAN libraries around python. It also discusses the working procedure of the developed framework and its evaluation as an answer to the black box dilemma. Keywords: Finite Element Method, Numerical Modeling, Engineering Simulation, Scientific Computing, Python.

1. INTRODUCTION The finite element analysis is a computer-based numerical technique that is widely used to solve engineering problems. Major applications for FEA include static, dynamic and thermal characterizations of mechanical phenomenon occuring in nature. Advances in computer hardware have made FEA easier and very efficient into solving complex engineering problems on desktop computers (Abaqus/CAE, 2011). In spite of the great power of FEA, the disadvantages of computer solutions must be kept in mind when using this method. They do not necessarily reveal how the stresses are influenced by important problem variables such as materials properties and geometrical features, and errors in input data can produce wildly incorrect results that may be overlooked by the analyst. Perhaps the most important function of theoretical modeling is that of sharpening the user’s intuition, users of finite element codes should plan their strategy toward this end by supplementing the computer simulation with as much closed-form and experimental analysis as possible (Roylance, 2001). Moreover, To avoid input errors and increase the simulation reliability, the user must have the access to the source code level.

2. PRACTICES IN ENGINEERING SIMULATION Basically, there are three possible approaches by which finite element analysis is performed for an engineering phenomena. Firstly, one can use a propritery finite element analysis software package, such as ABAQUS (Abaqus/CAE, 2011), ANSYS (ANSYS - Simulation Driven Product Development, 2011) or even general purpose prototyping framework MATLAB (MATLAB - The Language Of Technical Computing, 2011). The main advantage of these FEA software packages is that they come with both pre and post-prossesor equiped. The operation of a specific software is usually detailed in the documentation accompanying the software, and vendors of the more expensive codes will often offer workshops or training sessions as well to help users learn the intricacies of code operation. One problem users may have even after this training is that the code tends to be a "black box" whose inner workings are not understood by the end user. Thus, although ABAQUS, ANSYS are good for finite element analysis, they are not suitable for full-blown research projects, where complete control is the top most priority. Furthermore, they have fixed keywords, are not open source, very expensive and not wildly accepted in academia. Secondly, one could develop their own FEA program, in a high-level language. However, one should realize that, Most of the high level language is scripting type, so the concern for speed is great if the whole program is coded in that language alone. FEA involves solution of large matrices which require high computing power as well as efficient algorithm. In many cases, pre-written library routines offer solutions to numerical problems which are pretty hard to improve upon. Thirdly, coding can be done in a high-level language like python (Python Programming Language – Official Website, 2011), but using calls to pre-written, pre-compiled routines in commonly available subroutine libraries, such as UMFPACK (UMFPACK: unsymmetric multifrontal sparse LU factorization package, 2011), LAPACK

Page 2: Full Paper ID226 Rashed ICCESD2012 Preprint (1)

1st International Conference on Civil Engineering for Sustainable Development (ICCESD-2012)

2

(LAPACK - Linear Algebra PACKage, 2011) and BLAS (BLAS, 2011), to perform all of the real numerical work. This approach is most beneficial for the coding easiness and the performance point of view. This approach is used by the majority of researchers & scientists in their modern FEA simulation program. So, it is evident that the use of open source FEA software is beneficial for both the user and research, and it will further enhance the simulation reliability if it is a self coded one.

3. OPEN SOURCE FINITE ELEMENT ANALYSIS FRAMEWORK To overcome all the difficulties and errors associated with commercial FEA packages, an open source FEA framework named "simple finite element in python" or "Sfepy" has been developed. SfePy is a finite element analysis software written almost entirely in Python (Millman, 2011), with exception of the most time demanding routines, those are written in C and wrapped by Cython or written directly in Cython (SfePy, 2011). SfePy is a software for solving systems of coupled partial differential equations by the finite element method in 2D and 3D. Solution of linear, nonlinear problems are possible in sfepy. The collection of modules sfepy carries are FE engine, problem description facilities, interfaces to various solvers, post-processing utilities. It can be viewed both as black-box PDE solver, and as a Python package which can be used for building custom applications. As a black box PDE solver, After preparing a problem description file in Python Sfepy will solve it where no real programming is involved. For Installation Sfepy prerequisites are recent NumPy (van der Walt, 2011), SciPy with Umfpack wrapper, Cython (SciPy, 2011) (Cython: C-Extensions for Python, 2011). Sfepy depends on matplotlib, pyparsing, Umfpack, pytables for smooth running. Some tests and functions use sympy. For post-processing, mayavi2 is required (Ramachandran, 2011). All these libraries are available as single package from Pythonxy (pythonxy - Scientific-oriented Python Distribution based on Qt and Spyder - Google Project Hosting, 2011) and Enthought python distribution (Enthought Python Distribution :: Products :: Enthought, Inc., 2011). The typical working mechanism of Sfepy is described below.

1. A top-level script, usually simple.py reads in an input file. Following the contents of the input file, a ProblemDefinition instance is created; this is the input file coming to life. The problem sets up its domain, regions, fields, the equations and the solvers. The equations determine the materials and variables in use, only those are fully instantiated, so the input file can safely contain definitions of items that are not used actually.

2. Prior to solution, problem.time_update() function has to be called to setup boundary conditions, material parameters and other potentially time-dependent data. This holds also for stationary problems with a single “time step”.

3. The solution is then obtained by calling problem.solve() function. 4. Finally, the solution can be stored using problem.save_state() 5. Step 2, 3 & 4 are essentially repeated for each time step. So using the code a black-box PDE solver,

shields the user from having to create the ProblemDefinition instance by hand.

3.1 Open Source vs. Closed Source Optimum simulation depends on complete control over the finite element analysis framework but commercial products failed do so as they are proprietary, closed source. So a user is unable to see what is going on behind the scene during the simulation. Developing a finite element analysis framework, or at least using an open source finite element analysis software will help the end user by achieving complete control over the simulation process. Open source software is community driven, so large number of users can contribute to the continuing development of the software. And the uses of freely available modules ensure least cost in both usability and maintenance.

3.2 Development The finite element method is comprised of three major phases: (1) Pre-processing, in which the analyst develops a finite element mesh to divide the subject geometry into subdomains for mathematical analysis, and applies material properties and boundary conditions, (2) Solution, during which the program derives the governing matrix equations from the model and solves for the primary quantities, and (3) Post-processing, in which the analyst checks the validity of the solution, examines the values of primary quantities such as displacements and stresses, and derives and examines additional quantities such as specialized stresses and error indicators.

3.2.1 Pre-processing The goals of pre-processing are to develop an appropriate finite element mesh, assign suitable material properties, and apply boundary conditions in the form of restraints and loads. The finite element mesh subdivides the geometry into elements, upon which are found nodes. The model's degrees of freedom are

Page 3: Full Paper ID226 Rashed ICCESD2012 Preprint (1)

1st International Conference on Civil Engineering for Sustainable Development (ICCESD-2012)

3

assigned at the nodes. The assignment of nodal dof also depends on the class of analysis. For a thermal analysis, only one temperature dof exists at each node. Developing the mesh is usually the most time-consuming task in FEA. In the past, node locations were keyed in manually to approximate the geometry. The more modern approach is to develop the mesh directly on the CAD geometry, which will be (1) wireframe, with points and curves representing edges, (2) surfaced, with surfaces defining boundaries, or (3) solid, defining where the material is. Solid geometry is preferred, but often a surfacing package can create a complex blend that a solids package will not handle. As far as geometric detail, an underlying rule of FEA is to "model what is there", and yet simplifying assumptions simply must be applied to avoid huge models. A badly distorted element will cause a matrix singularity, killing the solution. A less distorted element may solve, but can deliver very poor answers. Acceptable levels of distortion are dependent upon the solver being used. Material properties required vary with the type of solution. A linear statics analysis, will require an elastic modulus, Poisson's ratio and perhaps a density for each material. Thermal properties are required for a thermal analysis. Examples of restraints are declaring a nodal translation or temperature. Loads include forces, pressures and heat flux. Gmsh provides a reliable pre-processing solution and is the pre-processor of the developed FEA framework (Gmsh, 2011). The simplest way of using SfePy is to mesh the geometry using Gmsh and then solve a system of PDEs describing the physical problem in python programming language defined in a problem description file, also referred to as input file. In such a file, the problem is described using several keywords that allow one to define the equations, variables, finite element approximations, solvers, solution domain and subdomains etc. The syntax of the problem description file is very simple yet powerful, as the file itself is just a regular Python module that can be normally imported, no special parsing is necessary (Comparing Python to Other Languages, 1997). The keywords are regular Python variables, usually of the dict type with special names. The different components of problem description file are shown in Table 1.

Table 1: Structure of Problem description file

Sl No. Keyword Description 1 Finite Element

Mesh FE meshes defines domain geometry. Four types of geometry elements are supported (Figure 1).

2 Regions Regions serve to select a certain part of the computational domain. It is the selection of nodes and elements of a FE mesh. They are used to define the boundary conditions, the domains of terms and materials etc.

3 Fields Fields correspond to Finite Element spaces. 4 Integrals Define the integral type and quadrature rule. This keyword is optional. 5 Variables Variables use the Finite Element approximation given by the specified field. 6 Boundary

Conditions The boundary conditions apply in a given region given by its name, and, optionally, in selected times. The times can be given either using a list of tuples (t0, t1) making the condition active for t0 <= t < t1, or by a name of a function taking the time argument and returning True or False depending on whether the condition is active at the given time or not.

7 Initial conditions

Initial conditions are applied prior to the boundary conditions; no special care must be used for the boundary dof’s.

8 Materials Materials are used to define constitutive parameters such as stiffness, permeability, or viscosity, and other non-field arguments of terms such as known traction or volume forces. Depending on a particular term, the parameters can be constants, functions defined over Finite Element mesh nodes, functions defined in the elements, etc.

9 Equations Equations can be built by combining terms listed in Term Table. User can create the required term in Sfepy before building equation.

10 Solvers In Sfepy, a non-linear solver has to be specified even when solving a linear problem. The linear problem is thus solved by one iteration of the nonlinear solver.

11 Functions Functions are a way of customizing Sfepy behavior. They make it possible to define material properties, boundary conditions, parametric sweeps, and other items in an arbitrary manner. Functions are normal Python functions declared in the Problem definition file, so they can invoke the full power of Python. In order for Sfepy to make use of the functions, they must be declared using the function keyword.

12 Miscellaneous The options can be used to select solvers, output file format, output directory, to register functions to be called at various phases of the solution, and for other settings.

Page 4: Full Paper ID226 Rashed ICCESD2012 Preprint (1)

1st International Conference on Civil Engineering for Sustainable Development (ICCESD-2012)

4

Figure 1: Supported geometry elements

3.2.2 Solution While the pre-processing and post-processing phases of the finite element method are interactive and time-consuming for the analyst, the solution is often a batch process, and is demanding of computer resource. The governing equations are assembled into matrix form and are solved numerically. The assembly process depends not only on the type of analysis such as static or dynamic, but also on the model's element types and properties, material properties and boundary conditions. The dataset prepared by the preprocessor is used as input to the finite element code itself, which constructs and solves a system of linear or nonlinear algebraic equations in the form Kd = r, where K is the system stiffness matrix, d is the nodal degree of freedom dof displacement vector, and r is the applied nodal load vector. The strain-displacement relation may be introduced into the stress-strain relation to express stress in terms of displacement. Under the assumption of compatibility, the differential equations of equilibrium in concert with the boundary conditions then determine a unique displacement field solution, which in turn determines the strain and stress fields. The chances of directly solving these equations are slim to none for anything but the most trivial geometries, hence the need for approximate numerical techniques presents itself. Solution methods for finite element matrix equations are plentiful. In the case of the linear static Kd = r, inverting K is computationally expensive and numerically unstable. A better technique is Cholesky factorization, a form of Gauss elimination, and a minor variation on the "LDU" factorization theme. The K matrix may be efficiently factored into LDU, where L is lower triangular, D is diagonal, and U is upper triangular, resulting in LDUd = r. Since L and D are easily inverted, and U is upper triangular, d may be determined by back-substitution. Another popular approach is the wavefront method, which assembles and reduces the equations at the same time. Some of the best modern solution methods employ sparse matrix techniques. Because node-to-node stiffnesses are non-zero only for nearby node pairs, the stiffness matrix has a large number of zero entries. This can be exploited to reduce solution time and storage by a factor of 10 or more. Improved solution methods are continually being developed. The key point is that the analyst must understand the solution technique being applied. Sfepy employs sparse matrix solver integrated in scipy library, hence it is quite fast to solve large matrices. Optimized mathematical library such as Umfpack, BLAS can also be used in sfepy during solution to obtain maximum speed (UMFPACK: unsymmetric multifrontal sparse LU factorization package, 2011).

3.2.3 Post-processing After a finite element model has been prepared and checked, boundary conditions have been applied, and the model has been solved, it is time to investigate the results of the analysis. This activity is known as the post-processing phase of the finite element method. A typical postprocessor display overlays colored contours representing the unknown parameters on the model, showing a full-field picture. Once the solution is verified to be free of numerical problems, the quantities of interest may be examined. Many display options are available, the choice of which depends on the mathematical form of the quantity as well as its physical meaning. For example, the displacement of a solid linear brick element's node is a 3-component spatial vector, and the model's overall displacement is often displayed by superposing the deformed shape over the undeformed shape. Dynamic viewing and animation capabilities aid greatly in obtaining an understanding of the deformation pattern. Stresses, being tensor quantities, currently lack a good single visualization technique, and thus derived stress quantities are extracted and displayed. Principal stress vectors are displayed as color-coded arrows, indicating both direction and magnitude. The magnitude of principal stresses or of a scalar failure stress such as the Von Mises stress are displayed on the model as colored bands.

Page 5: Full Paper ID226 Rashed ICCESD2012 Preprint (1)

1st International Conference on Civil Engineering for Sustainable Development (ICCESD-2012)

5

Sfepy uses matplotlib for 2D and Mayavi for 3D visualization of solution results (Ramachandran, 2011). Paraview is also used as a fully functional post-processor (ParaView - Open Source Scientific Visualization, 2011).

3.3 Evaluation The typical process to solve a problem using the developed framework is as followes, a model is meshed in Gmsh, a problem definition file is drafted in python programming language, SfePy is run to solve the problem and finally the results of the analysis are visualised. The tensile strength test of concrete which is also known as split cylinder test is simulated with the developed finite element analysis framework (Figure 2(a)). In this test a cylindrical specimen is loaded across its diameter to failure. To model this problem using finite elements the indirect tensile test can be simplified to represent a diametrically point loaded disk as shown in Figure 2(b).

Figure 2: (a) Indirect Tesnsile Strength test setup, (b) Simplified 2D diametrically point loaded disk

The tensile and compressive stresses that develop in the specimen as a result of the point loads P are a function of the diameter (D) and thickness (t) of the cylindrical specimen. At the centre of the specimen, the compressive stress is 3 times the tensile stress and the analytical formulation for these are, respectively:

tD

Pt

2

(1)

tD

Pc

6

(2)

These solutions are approximated using finite element methods and the finite element solution is finally compared to the analytical solution to verify the developed FEA framework.

3.3.1 Pre-processing The specimen has a diameter of 150 mm. Assuming plane strain conditions, the indirect tensile test may be modelled using a 2D finite element mesh. Furthermore, the geometry of the model is symmetrical about the x- and y-axes passing through the centre of the circle. To take advantage of this symmetry only one quarter of the 2D model will be meshed and boundary conditions will be established to indicate this symmetry. The meshing program Gmsh is used here to very quickly mesh the model (Gmsh, 2011). In meshing, Triangle elements are used (Figure 1).

. Figure 3: meshed geometry

Page 6: Full Paper ID226 Rashed ICCESD2012 Preprint (1)

1st International Conference on Civil Engineering for Sustainable Development (ICCESD-2012)

6

3.3.2 Solution For the analysis it is assumed that the material of the test specimen is linear elastic and isotropic. The problem definition file is named as its2D_1.py and is in the same directory as the simple.py script. The problem definition file is shown in Appendix A. Two material constants are defined, Young’s modulus and Poisson’s ratio. The material is assumed to be asphalt concrete having a Young’s modulus of 2,000 MPa and a Poisson’s ration of 0.4. Four regions are defined:

1. Omega: all the elements in the mesh 2. Left: the y-axis 3. Bottom: the x-axis 4. Top: the topmost node. This is where the load is applied.

To ensure symmetry about the x-axis, the vertical or y-displacement of the nodes in the Bottom region are prevented or set to zero. Similarly, for symmetry about the y-axis, any horizontal or displacement in the x-direction of the nodes in the Left region or y-axis is prevented. Material constants are provided in terms of Young’s modulus and Poisson’s ratio, but the linear elastic isotropic equation used requires as input Lamé’s parameters. The youngpoisson_to_lame function is thus used for conversion. One option to solve the problem is to run the SfePy simple.py script from the command shell:

$ ./simple.py its2D_1.py

SfePy solves the problem and outputs the solution to the output path provided in the problem description file. The output file will be in the vtk format by default if this is not explicitly specified and the name of the output file will be the same as that used for the mesh file except with the vtk extension.

3.3.3 Post-processing SfePy includes a post-processing script to quickly view the solution.

$ ./postproc.py its2D.vtk

The postproc.py script generates the image shown below, which by default shows the displacements in the model as arrows and their magnitude as color scale.

Figure 4: Visualization of the solution

The stresses in the model had been calculated but these were averaged from those calculated at Gauss quadrature points within the elements. It is possible to provide custom integrals to allow the calculation of stresses with the Gauss quadrature points at the element nodes. This will provide a more accurate estimate of the stress at the centre of the specimen located at node 0. The new problem definition file is named as its2D_2.py and is executed in the same directory as the simple.py script. The analytic solution is independent of mesh refinement influence, so it’ll always be same for as long as the whole geometry remains intact. On the other hand, the finite elemnt analysis solution is influenced by mesh refinement. The finer the mesh is, the more

Page 7: Full Paper ID226 Rashed ICCESD2012 Preprint (1)

1st International Conference on Civil Engineering for Sustainable Development (ICCESD-2012)

7

accurate the result will be. A fine mesh of the same geometric property is drafted and again its2D_2.py script is executed to obtain the solution. The FEA result for both the coarse and fine mesh is shown in Table 2.

Table 2: Analysis summary

Mesh type

Applied load (N)

Analytic horizontal

tensile stress

(MPa/mm)

FEA horizontal

tensile stress (MPa/mm)

% error w.r.t

Analytic solution

Analytic vertical

compressive stress

(MPa/mm)

FEA vertical compressive

stress (MPa/mm)

% error w.r.t

Analytic solution

Coarse - 83

Elements 2000

8.48826

7.57220 +10.79

25.4648

25.8660 -1.57

Fine - 5568

Elements 2000 8.50042 -0.14 25.4300 +0.13

From Table 2 it is established that the developed FEA framework works correctly as the FEA approximate solution is very close to the analytical solution. It has also been observed that with certain amount of mesh refinement, the FEA solution will be well converged. From table 2, results obtained using fine mesh converges better towards zero error.

4. CONCLUSION Taking the advantages of full control over the Engineering simulation using custom coded finite element analysis software along with its structure and working procedure is focused in this paper. It has been established that by using open source finite element analysis software developed from freely available scientific python tools, one can optimize the code by great extent. As the source code is freely available to use and modify, many user can contribute their individual knowledge regarding various aspect of numerical modeling. The use of one of the most popular scripting language python, results in readability increment of the source code. This paper also focuses on the necessity & easiness of developing engineering simulation framework. The evaluation of the developed framework is presented with comparison to an analytical solution. It has been observed that development and use of open source engineering simulation software offers four main benefits:

1. Anyone can contribute to the continuing development of the software, as it is open source. 2. Optimum simulation is obtained as the user can see what is running behind the scene. 3. The use of legacy mathematical libraries written in static language offers great code reuse and saves

time; also it is easier to change the underlying legacy library. 4. Use of freely available libraries provides maximum economy.

ACKNOWLEDGMENTS The Author is an active developer of “Sfepy” open source finite element analysis framework and would like to extend thanks to co-developers. The author make extensive use of freely available software such as GNU/Linux operating system, GCC compilers, Python, SciPy, Pythonxy, Enthought python distribution and Lapack, Blas, Umfpack and others. Many thanks to open source community for those excellent products.

APPENDIX A: Problem definition file named its2D_1.py from sfepy.mechanics.matcoefs import youngpoisson_to_lame from sfepy.fem.utils import refine_mesh from sfepy import data_dir # Fix the mesh file name if you run this file outside the SfePy directory. filename_mesh = data_dir + '/its2D.mesh' refinement_level = 0 filename_mesh = refine_mesh(filename_mesh, refinement_level) output_dir = '.' # set this to a valid directory you have write access to young = 2000.0 # Young's modulus [MPa] poisson = 0.4 # Poisson's ratio

Page 8: Full Paper ID226 Rashed ICCESD2012 Preprint (1)

1st International Conference on Civil Engineering for Sustainable Development (ICCESD-2012)

8

options = { 'output_dir' : output_dir, } regions = { 'Omega' : ('all', {}), 'Left' : ('nodes in (x < 0.001)', {}), 'Bottom' : ('nodes in (y < 0.001)', {}), 'Top' : ('node 2', {}), } materials = { 'Asphalt' : ({ 'lam' : youngpoisson_to_lame(young, poisson)[0], 'mu' : youngpoisson_to_lame(young, poisson)[1], },), 'Load' : ({'.val' : [0.0, -1000.0]},), } fields = { 'displacement': ('real', 'vector', 'Omega', 1), } equations = { 'balance_of_forces' : """dw_lin_elastic_iso.2.Omega(Asphalt.lam, Asphalt.mu, v, u ) = dw_point_load.0.Top(Load.val, v)""", } variables = { 'u' : ('unknown field', 'displacement', 0), 'v' : ('test field', 'displacement', 'u'), } ebcs = { 'XSym' : ('Bottom', {'u.1' : 0.0}), 'YSym' : ('Left', {'u.0' : 0.0}), } solvers = { 'ls' : ('ls.scipy_direct', {}), 'newton' : ('nls.newton', { 'i_max' : 1, 'eps_a' : 1e-6, 'problem' : 'nonlinear' }), }

APPENDIX B: Problem definition file named its2D_2.py from its2D_1 import * from sfepy.mechanics.matcoefs import stiffness_tensor_youngpoisson from sfepy.fem.geometry_element import geometry_data from sfepy.fem import Field,FieldVariable import numpy as nm gdata = geometry_data['2_3'] nc = len(gdata.coors) def nodal_stress(out, pb, state, extend=False):

Page 9: Full Paper ID226 Rashed ICCESD2012 Preprint (1)

1st International Conference on Civil Engineering for Sustainable Development (ICCESD-2012)

9

''' Calculate stresses at nodal points. ''' # Point load. mat = pb.get_materials()['Load'] P = 2.0 * mat.get_data('special', None, 'val')[1] # Calculate nodal stress. pb.time_update() stress = pb.evaluate('dq_cauchy_stress.ivn.Omega(Asphalt.D, u)', mode='qp') sfield = Field('stress', nm.float64, (3,), pb.domain.regions['Omega']) svar = FieldVariable('sigma', 'parameter', sfield, 3, primary_var_name='(set-to-None)') svar.data_from_qp(stress, pb.integrals['ivn']) print '\n==================================================================' print 'Given load = %.2f N' % -P print '\nAnalytical solution' print '===================' print 'Horizontal tensile stress = %.5e MPa/mm' % (-2.*P/(nm.pi*150.)) print 'Vertical compressive stress = %.5e MPa/mm' % (-6.*P/(nm.pi*150.)) print '\nFEM solution' print '============' print 'Horizontal tensile stress = %.5e MPa/mm' % (svar()[0][0]) print 'Vertical compressive stress = %.5e MPa/mm' % (-svar()[0][1]) print '==================================================================' return out asphalt = materials['Asphalt'][0] asphalt.update({'D' : stiffness_tensor_youngpoisson(2, young, poisson)}) options.update({'post_process_hook' : 'nodal_stress',}) integrals = { 'ivn' : ('v', 'custom', gdata.coors, [gdata.volume / nc] * nc), }

REFERENCES Abaqus/CAE. (2011). “Optimizing Product Performance with Finite Element Analysis & Multiphysics

Simulation”, http://www.simulia.com/products/abaqus_cae.html ANSYS - Simulation Driven Product Development. (2011). “ANSYS - Simulation Driven Product

Development”, http://www.ansys.com/ BLAS. (2011). “The Netlib”, http://www.netlib.org/blas/index.html Comparing Python to Other Languages. (1997). “Python Programming Language – Official Website”,

http://www.python.org/doc/essays/comparisons/ Cython: C-Extensions for Python. (2011). “Cython: C-Extensions for Python”, http://cython.org/ Enthought Python Distribution (2011). “Enthought, Inc. :: Scientific Computing Solutions”,

http://www.enthought.com/products/epd.php Gmsh. (2011). “Gmsh”, http://geuz.org/gmsh/ LAPACK — Linear Algebra PACKage. (2011). “The Netlib” http://www.netlib.org/lapack/index.html Millman, K. (2011). “Python for Scientists and Engineers”. Computing in Science & Engineering , Vol. 13 (2), 9

- 12. ParaView - Open Source Scientific Visualization. (2011). “ParaView - Open Source Scientific Visualization”,

http://www.paraview.org/

Page 10: Full Paper ID226 Rashed ICCESD2012 Preprint (1)

1st International Conference on Civil Engineering for Sustainable Development (ICCESD-2012)

10

Python Programming Language – Official Website. (2011). “Python Programming Language – Official Website”, http://www.python.org

pythonxy - Scientific-oriented Python Distribution based on Qt and Spyder - Google Project Hosting. (2011). “pythonxy - Scientific-oriented Python Distribution based on Qt and Spyder - Google Project Hosting” http://code.google.com/p/pythonxy/

Ramachandran, P. (2011). “Mayavi: 3D Visualization of Scientific Data”. Computing in Science & Engineering , Vol. 13 (2), 40 - 51.

Roylance, D. (2001). “MIT OpenCourseWare | Materials Science and Engineering | 3.11 Mechanics of Materials, Fall 1999 | Home”. MIT OpenCourseWare. http://ocw.mit.edu/courses/materials-science-and-engineering/3-11-mechanics-of-materials-fall-1999/

SciPy. (2011). “SciPy”, http://www.scipy.org/ SfePy. (2011). “SfePy”, http://sfepy.org/ UMFPACK: unsymmetric multifrontal sparse LU factorization package. (2011). “University of Florida ::

Department of Computer and Information Science and Engineering (CISE)”, http://www.cise.ufl.edu/research/sparse/umfpack/

van der Walt, S. (2011). “The NumPy Array: A Structure for Efficient Numerical Computation”. Computing in Science & Engineering , Vol. 13 (2), 22 - 30.