26
Adding elements into FEAP January 2004 [email protected] 1 1 Introduction 1.1 About this paper The present paper introduces to an implementation of a new element module to the finite element program FEAP, Finite Element Analysis Program. Introductory the implementation process regards a simple plane bilinear elastic element. The intension of this paper is to help remembering the necessary steps to do if other elements or material models need to be incorporated in FEAP. Furthermore, this paper is useful to illustrate the basic ideas in the finite element method. 1.2 Relevant subroutines for 2D solid element The main idea is to write the dummy routine elmt_01.f, which calls the necessary subroutines de- pending on the value of the task parameter ISW. In table, 1.1 appears the feasible tasks in FEAP. It is not necessary that all options be coded. However to use the features available in FEAP at least the tasks 0-6, 8 and 10 have to be programmed. Task Description Access command 0 Output label Show,elem (sol) 1 Input d(*) parameters Mate,n (mesh) 2 Check elements Check (sol) 3 Compute tangent/residual Tang (sol) 3 Compute tangent/residual Utan (store in S/r) 4 Output element variables Stress (sol) 5 Compute mass matrix Mass (sol) 5 Compute mass matrix Mass,lump (store in S/r) 6 Compute residual Form,reac (sol), Reac (plot) 7 Surface loads/tangents Sload (mesh) 8 Nodal projections Stres,node (sol), stre,pstr (plot) 9 Damping Damp (sol) 10 Aug. Langrangian update Augm (sol) 11 Error estimator Erro (sol) 12 History update Time (sol) 13 Energy/momentum Tplot,ener (sol) 14 Initialise history Batch, inter 15 Body force Body (mesh) 17 Set after activation Acti (sol) 18 Set after deactivation Deac (sol) 20 Element plotting Pelm (plot) Table 1.1 Options for FEAP sub element program. [1] Table 2.1 shows the relevant subroutines for a static or dynamic analysis using the linear elastic solid element solid2d.f in the standard FEAP routine. The calling sequence is: pcontr.f L pmacr3.f L bfgs.f (iterat) L formfe.f (isw = 6) L pform.f L elmlib.f L elmtxx.f (solid2d.f)

Adding Elements Into FEAP

Embed Size (px)

Citation preview

Page 1: Adding Elements Into FEAP

Adding elements into FEAP January 2004

[email protected] 1

1 Introduction 1.1 About this paper The present paper introduces to an implementation of a new element module to the finite element program FEAP, Finite Element Analysis Program. Introductory the implementation process regards a simple plane bilinear elastic element. The intension of this paper is to help remembering the necessary steps to do if other elements or material models need to be incorporated in FEAP. Furthermore, this paper is useful to illustrate the basic ideas in the finite element method. 1.2 Relevant subroutines for 2D solid element The main idea is to write the dummy routine elmt_01.f, which calls the necessary subroutines de-pending on the value of the task parameter ISW. In table, 1.1 appears the feasible tasks in FEAP. It is not necessary that all options be coded. However to use the features available in FEAP at least the tasks 0-6, 8 and 10 have to be programmed.

Task Description Access command 0 Output label Show,elem (sol) 1 Input d(*) parameters Mate,n (mesh) 2 Check elements Check (sol) 3 Compute tangent/residual Tang (sol) 3 Compute tangent/residual Utan (store in S/r) 4 Output element variables Stress (sol) 5 Compute mass matrix Mass (sol) 5 Compute mass matrix Mass,lump (store in S/r) 6 Compute residual Form,reac (sol), Reac (plot) 7 Surface loads/tangents Sload (mesh) 8 Nodal projections Stres,node (sol), stre,pstr (plot) 9 Damping Damp (sol)

10 Aug. Langrangian update Augm (sol) 11 Error estimator Erro (sol) 12 History update Time (sol) 13 Energy/momentum Tplot,ener (sol) 14 Initialise history Batch, inter 15 Body force Body (mesh) 17 Set after activation Acti (sol) 18 Set after deactivation Deac (sol) 20 Element plotting Pelm (plot)

Table 1.1 Options for FEAP sub element program. [1]

Table 2.1 shows the relevant subroutines for a static or dynamic analysis using the linear elastic solid element solid2d.f in the standard FEAP routine. The calling sequence is: pcontr.f è pmacr3.f è bfgs.f (iterat) è formfe.f (isw = 6) è pform.f è elmlib.f è elmtxx.f (solid2d.f)

Page 2: Adding Elements Into FEAP

Adding elements into FEAP January 2004

[email protected] 2

solid2d.f

inpt2d.f pltri3.f pltri6.f sld2d1.f surf2d.f therm2.f mass2d.f n4d2.f

uconst.f invert.fint2dc.f

inputroutine

elmlib.f

ster2d.f stcn2d.f pstr2d.f resid2d.f rays2d.f modlsd.f strn2d.f trishp.f int2d.f shp2d.f tint2d.f

shp2d.ftrishp.f int2d.f tint2d.f

epps2d.fmises.fumodel.fviscoe.f pzstrs.fgplas3.f estrsd.f shapef.fshap2.f

dmat2.f dmat2.fdmat2.f

cktris.f ckisop.f

shp2d.f

Table 1.2 Diagram of the respective routines for the element solid2d.f. For a general view of the process, some features in the subroutines are excluded. This means that triangular elements, body forces, thermal effects etc. are not considered. For that reason is it possi-ble to modify some of the routines and dispense with other subroutines. The routines marked with blue are necessary to use the elastic element. Furthermore, the subroutine therm2d.f calls other sub-routines, which are not pictured. 1.3 How to build the project in a UNIX system Before making modifications in the subroutines, it is recommended to compile an additional code to the source code. The source directory will contain two files: makefile and makefile.in. These files may be used to build an active (library) and executable for the program. The file makefile.in is used to set the compiler types (e.g., f90, f77, g77; cc, gcc; etc.), location of the include files (*.h), com-piler options (e.g., archive type and location), and location of libraries. Compile all source files and create library archive "Feap71.a" using: make install. The files makefile and makefile.in have to be included in the folder ver7j. In the file, makefile the following is written in the end of the file if the additional library is called e.g. ropecode: ropecode: (cd rope/ropecode/; make install) (cd main; make feap) @@echo "--> Rope's routines installed <--" The program file (Feap71.f) itself is placed in the folder main, exiting in the folder ver7j. In this folder there is also a file called makefile. The text in this file is written here: include ../../makefile.in SOURCES = $(FSOURCE)*.$(FEXT) This type of file is also a necessity in the library with the new code. Additional a file called go with following text has to be included in the new library: cd ../.. make ropecode If the go command is applied then the new files and changes are coupled with standard FEAP:

Page 3: Adding Elements Into FEAP

Adding elements into FEAP January 2004

[email protected] 3

mech043 /usr3/pedersen/feap_new/ver7j/rope/ropecode> go If a file from the source code is moved into, the new library without changing the name of the file FEAP will overwrite the oldest version. Generally, one should be careful about both changing the names of the files and changing something in the code. You have to be sure you know all the sub-routines that are calling the specific file. See table 2.1. 2 Code of procedures and algorithms implementation The starting point is FEAP calling the subroutine elmt01.f, which is the same file as solid2d.f in table 1.2. However, only all subroutines marked with blue are used in elmt01.f. 2.1 Input material properties, isw=1 The subroutine inpt2d(d,tdof,nen,1) is used to incorporate the material parameters in FEAP stored in an array d(*) with the pointer np(25). It is chosen to modify this routine. Therefore, the file is moved to the new library. The inpt2d.f contains the file uconst.f, which allows one to create user constitutions that will be added to FEAP’s material library for use with internal elements elmt01. To set up a user constitution one needs to edit the file uconst.f to include the code for reading input data for the new model. This will be stored in the ud(*) array and kept separate from FEAP’s own mate-rial data array. The d(*) has from the beginning 200 entries, but can be extended with additional 50 entries using the above mentioned file containing the elements in the ud(*) array. If a value in the ud(*) array is needed in a arbitrary subroutine the same pointer can be used as for the standard ma-terial vector: Ex: call xxx(eps,d,ud, sig,dd, isw) or call xxx(eps,hr(np(25),ud, sig,dd, isw) will have the same effect. E = d(21) Alfa=d(203) Then it is possible to get the necessary values from the material array. The uconst.f file calls another file that is able to read specific data from the input file using UCON BINE and endbine, which are user-defined names. The file reads the data between the two lines and store the values for alfa, beta and gamma in the ud(*) array by using uconst.f. MATEerial,1 USER 01 ELAStic 2100 0.3 QUADrature data 2 2 Density data 2 UCON BINE alpha,4 beta,2000 gamma,30000 endBine END You have to be careful about changing the sflag and the value for e1 in the inpt2d.f file after uconst.f is called. Otherwise, FEAP ignores the standard data and reads only the user defined prop-erties.

Page 4: Adding Elements Into FEAP

Adding elements into FEAP January 2004

[email protected] 4

The other routine to be edited is the umodel.f file, which will be called when the stresses need to be computed for residual and tangent operations etc. For plane 2D solid elements, the routine that is calling umodel.f is modlsd.f. By means of this file, it is possible to add new constitutive models into FEAP. In the user-element, elmt01.f the umodel.f calls the same routines as modlsd.f except from umodel.f itself. If you want to make modifications e.g. change something in the elastic consti-tutive model, it is possible here. You can always run the standard elastic routine by typing solid instead of user 01 in the input file. The main steps in creating a user constitution are:

o Edit uconst.f to set the material identifier number umat that correspond to the user model type requested in the input file (user 01 in the case above).

o Edit the uconst.f so that it reads in the data and passes it to ud(*) e.g. calling another user defined subroutine.

o Edit umodel.f so that it responds to the respective isw switches. 2.2 Allocating arrays In the previous passage, a pointer was mentioned. That is used to allocate arrays in FEAP. A subprogram palloc.f controls the allocation of all standard arrays in FEAP and a subprogram ual-loc.f permits users to add their own arrays. The basic use of the routines is provided by introducing following to the file pcontr.f, which is the control program for FEAP problems. If (up(1).eq.0) then setvar = ualloc(1,'GDATA',9*3*numel, 2) if(.not.setvar) then write(*,*) 'UALLOC error - GDATA' stop endif call pzero(hr(up(1)),9*3*numel) endif

Ualloc takes 4 arguments. The first is the numerical location of the user array in the list in ualloc.f, the second is the name of the array, the third is the desired length of the array, and the forth is the precision of the array ( 1 for integer and 2 for double precision real). After the call to ualloc the pointer array up( ) will contain the correct pointers into the blank common.

Access of information in each of the arrays is performed using a pointer which are the include files pointer.h and upointer.h for palloc and ualloc, respectively. As an example for the use of the above allocation method, consider the array d with the material properties. When it is necessary to call the subroutine inpt2d.f it is possible to write inpt2d(d,tdof,nen,1) but another possibility is to write inpt2d(hr(np(25)),tdof,nen,1). The file, ualloc.f in the user directory that allows one to define named arrays for dynamic allocation out of FEAP's blank common memory management system. To set up a user allocatable array one merely needs to edit the file ualloc.f to include the new array name and update the number of user allocatable arrays.

For instance to add the user allocatable arrays 'GDATA’ to the program one needs to edit the file ualloc.f as follows:

o Edit the parameter statement so that list = 2 (two user arrays are being defined) o Edit the data list for names and add 'GDATA’

Page 5: Adding Elements Into FEAP

Adding elements into FEAP January 2004

[email protected] 5

o Not required but recommended, provide a description of the array in the comment list.

To use the arrays that have been compiled into the program one uses the ualloc( ) logical function to allocate memory, resize memory, or delete memory. This also involves the use of common blocks comblk.h and upointer.h. To use the ualloc call you must specify both the name of the array and its numerical location in the list. Specifically:

o ualloc is called to allocte, resize or delete memory o upointer.h contains the array up( ) of pointers into the blank common for the user de-

fined arrays; eg. up(1) is the blank common pointer for the first user defined array, up(2) is the blank common pointer for the second user defined arrary, etc.

o comblk.h is the common block containing the blank common; real arrays are found in hr( ) and integer arrays are found in mr( ).

This allocation technique is used in the part about post processing utilities in FEAP. Another possi-bility to access the data in the arrays from an arbitrary subroutine is to define the array as a common block. 2.3 Check elements for errors, isw=2 The subroutine ckisop.f in table 2.1 checks isoparametric elements for data input errors. Negative Jacobian etc. 2.4 Plane linear elastic element routine, isw=3,4,6,8 In the subroutine solid2d.f are several models available to compute the stiffness matrix and the stress divergence. In this paper, routines in the displacement method are explained (etype.eq.1), in which the displacements at nodes of elements are considered as the fundamental unknowns. Fur-thermore, only small displacement gradients are treated (dtype.gt.0). For these conditions, the sub-routine sld2d1.f is called from solid2d1.f.

Table 2.1 Plane stress equations of linear

elastostatics displayed as a Tonti diagram with the relevant routines and arrays in FEAP. In case of plane stress (stype.eq.1), it is assumed that all loads applied to the plate act in the mid-plane direction, and are symmetric with respect to the midplane. All support conditions are symmet-ric about the midplane and the in-plane displacements, strains and stresses can be taken to be uni-

eps(9,3) sig(9,9)

ul(ndf,nen)

strn2d.f

modlsd.f

sld2d1.f

resid2d.f

Page 6: Adding Elements Into FEAP

Adding elements into FEAP January 2004

[email protected] 6

form through the thickness. The transverse displacement component is generally nonzero because of Poisson’s ratio effects, and depends on z. However, this displacement does not appear in the gov-erning equations. Consequently the dependence on z disappears and all components in the govern-ing equations become functions of x and y only. In the general three-dimensional elasticity problem, 15 unknowns quantities must be determined at every point in the body. This is 6 cartesian components of stress, the 6 cartesian components of strain and the 3 components of displacement. In order to solve for the above-mentioned 15 un-known quantities, 15 independent equations are required. The three internal fields: displacements, strains and stresses are connected by three field equations: 6 kinematic, 6 constitutive and 3 inter-nal-equilibrium equations. In continuum mechanics these governing equations are satisfied in every single point (x,y) in the domain by means of e.g. Airys stress function and the biharmonic equation as the differential equation to be solved directly. Instead of the displacement method, the force method can be applicable. Using the force method consideration is needed for the compatibility condition, which states the relation that exits among the strains if a displacements field is compati-ble. In the displacement method, the compatibility condition is automatically satisfied. The finite element method is a numerical procedure for analysing structures and continua. Usually the problem is too complicated to be solved satisfactorily by classical analytical methods in the the-ory of elasticity. Besides solving differential equations for complex geometries, the finite element method has a structured procedure that is easy to implement in a computational framework. The basic finite element concepts are to discretizise the domain, and model a structure as an assem-blage of small elements. Each element is of simple geometry and therefore is much easier to analyse than the actual structure. As degrees of freedom, finite elements use nodal values of the field. De-grees of freedom is independent quantities used to define a configuration of the domain that does not violates the compatibility condition and boundary conditions.

Figure 2.1 Finite element discretization and extraction of generic element.

Another crucial step is to transform the differential equations, equation of motion (IVP), and equi-librium equation (BVP) from the strong form into a weak format. This is done by variational meth-ods

o Energy methods, Rayleigh Ritz. o Method of weighted residuals, Galerkin.

2.4.1 Isoparametric formulation The construction of shape functions that satisfy consistency requirements for higher order elements with curved boundaries becomes increasingly complicated and integrals that appear in the expres-

Page 7: Adding Elements Into FEAP

Adding elements into FEAP January 2004

[email protected] 7

sions of the element stiffness matrix and consistent nodal force vector can no longer be carried out in closed form. These difficulties can be overcome through the concepts of isoparametric elements and numerical quadrature, respectively. The isoparametric formulation makes it possible to generate elements that are nonrectangular and have curved sides. In formulating these elements, natural co-ordinates are used. Displacements are then expressed in natural coordinates, but are differentiated with respect to the global coordinates to get the strains. Therefore, a transformation matrix, called Jacobian matrix, is needed. The key idea is to use the shape functions to represent both the element geometry and the problem unknowns, which in structural mechanics are displacements. Hence the name isoparametric element (“iso” means equal), often abbreviated to iso-P element.

Figure 2.2 Isoparametric representation of arbitrary 2D elements:

We shall assume that the same interpolation functions are used for both displacement components. This is the so-called element isotropy condition, which is studied and justified in advanced FEM courses. It is continuous over domain and it satisfies exactly any displacement boundary condition. The minimum conditions on the shape functions are that it must take the value one at its own node and zero at all others, so that the interpolation is correct at the nodes. If the shape functions for the displacements are of higher degree than the shape functions for the geometry, the element is called sub-parametric. If the shape function for the geometry is of higher degree then the elements are called super-parametric. Isoparametric coordinates in a plane are shown in figure 2.3. The coordinates vary from -1 on one side to +1 at the other, taking the value zero on the medians.

Figure 2.2 Four-node plane isoparametric element in xy space (left). Plane isoparametric element in ξη space. The axes in the natural space need not to be parallel to the axes in global space and the axes in the natural system need not to be orthogonal.

Page 8: Adding Elements Into FEAP

Adding elements into FEAP January 2004

[email protected] 8

For quadrilateral elements with four nodes shape functions are bilinear along each direction. In the local reference system, they take the following form.

Figure 2.3 Shape functions for a bilinear element.

The numbering of nodes is referred to the order shown in figure 2.2. Because the isoparametric elements are geometrically isotropic, the numerical values of coefficients in the stiffness matrix do not depend on how the nodes are labeled. However, the cyclic order must be maintained and run counter-clockwise if the Jacobian is not to become negative. This is examined in the check routine ckisop.f. If the Jacobian becomes negative, the diagonal coefficients of the stiffness matrix would be negative. The shape functions vary linearly on quadrilateral coordinate lines .const=ξ and,

.const=η . The shape functions can be established by any of the usual methods, formal substitution, Lagrange’s interpolation formula, or inspection and trial. The subroutine shp2d.f computes the shape functions, the derivatives and determines the transfor-mation matrix, Jacobian. Shape functions shp2d.f Subroutine shp2d(ss,xl,shp,xsj,ndm,nel,ix,flg) c * * F E A P * * A Finite Element Analysis Program c.... Copyright (c) 1984-1999: Robert L. Taylor c-----[--.----+----.----+----.-----------------------------------------] c Purpose: Computes shape function and derivatives for c quadrilateral elements c Inputs: c ss(2) - Natural coordinates for point c xl(ndm,*) - Nodal coordinates for element c ndm - Spatial dimension of mesh c nel - Number of nodes on element c ix(*) - Nodes attached to element c flg - Flag, compute global x/y derivatives if false, c else derivatives are w/r natural coords. c Outputs: c shp(3,*) - Shape functions and derivatives at point c shp(1,i) = dN_i/dx or dN_i/dxi_1 c shp(2,i) = dN_i/dy or dN_i/dxi_2 c shp(3,i) = N_i c xsj - Jacobian determinant at point c-----[--.----+----.----+----.-----------------------------------------] c Set values of half natural coords at nodes data s/-0.5d0,0.5d0,0.5d0,-0.5d0/,t/-0.5d0,-0.5d0,0.5d0,0.5d0/ è Input the natural coordinates in two arrays s and t. c Form 4-node quadrilateral shape functions

Page 9: Adding Elements Into FEAP

Adding elements into FEAP January 2004

[email protected] 9

do i = 1,4 shp(3,i) = (0.5d0+s(i)*ss(1))*(0.5d0+t(i)*ss(2)) è The shape function for a bilinear element.

shp(1,i) = s(i)*(0.5d0+t(i)*ss(2)) è The first derivative. ξ∂

∂N

shp(2,i) = t(i)*(0.5d0+s(i)*ss(1)) è The second derivative. η∂

∂N

enddo Construct Jacobian and its inverse do i = 1,max(3,ndm) do j = 1,2 xs(i,j) = 0.0d0 do k = 1,nel xs(i,j) = xs(i,j) + xl(i,k)*shp(j,k) è Form the elements in the Jacobian matrix

end do [ ]

=

=

∑∑∑∑

iiii

iiii

yNxNyNxN

yyyx

Jηη

ξξ

ηξξξ

,,

,,

,,,,

end do end do if(ndm.eq.2) then è Compute the determinant of the Jacobian xsj = xs(1,1)*xs(2,2)-xs(1,2)*xs(2,1) elseif(ndm.eq.3) then

endif ( ) 12212211det JJJJJ −= if(.not.flg) then if(xsj.eq.0.0d0) then temp = 1.0d0 else temp = 1.d0/xsj endif sx(1,1) = xs(2,2)*temp è Compute the inverse of the Jacobian matrix sx(2,2) = xs(1,1)*temp

sx(1,2) =-xs(1,2)*temp [ ] ( )

−=−

1121

12221

det1

JJJJ

JJ

sx(2,1) =-xs(2,1)*temp c Form global derivatives do i = 1,nel temp = shp(1,i)*sx(1,1)+shp(2,i)*sx(2,1) è Form the global derivatives. Used to form the B matrix shp(2,i) = shp(1,i)*sx(1,2)+shp(2,i)*sx(2,2)

shp(1,i) = temp x

Nx

NxN

∂∂

∂∂

+∂∂

∂∂

=∂∂ ξ

ξη

η

enddo

yN

yN

yN

∂∂

∂∂

+∂∂

∂∂

=∂∂ ξ

ξη

η

( )

+−+−+−+−

−−−−=

ηξηξηξηξ

ηξηξηξηξ

,411,412,311,312,211,112,111,112

,412,422,312,322,212,222,112,122

det1

NJNJNJNJNJNJNJNJNJNJNJNJNJNJNJNJ

JB

Page 10: Adding Elements Into FEAP

Adding elements into FEAP January 2004

[email protected] 10

Completeness Checks

Figure 2.4 Shape functions for a bilinear element.

The sum of the shape functions must be unity. This is also called the unit sum condition. It can be easily verified by hand for simple elements. It is necessary to check if the correct geometry of the quadrilateral is preserved by the mapping from the natural reference state to the global. The com-mon side 1-2 in figure 2.4 must remain a straight line to preclude interelement gaps or interpenetra-tion. This is equivalent to the question of interelement displacement compatibility, which is posed as item (C). The statement “the displacement along a side must be uniquely determined by nodal displacements on that side” translates to “the coordinates of a side must be uniquely determined by nodal coordinates on that side.” The idea is to develop the shape functions in a way that the solution of the weak format of the gov-erning equations converges to the exact solution. There are three basic convergence requirements:

1 Smooth, at least C1 on the element interior 2 Continuous across each element boundary 3 Completeness

This means if the shape function is not continuous on the element boundary then the derivatives are delta functions and it is not possible to make sense out of the quantities that would appear in the stiffness matrix. But 1 and 2 guarantee that jumps only can appear in the derivatives of the shape functions. Finite elements are called compatible if there is Cm continuity in the element and Cm-1

continuity across the elements in case of the stiffness integrand involves derivatives of order m. The uses of elements that violate this property are called incompatible.

Page 11: Adding Elements Into FEAP

Adding elements into FEAP January 2004

[email protected] 11

Kinematics strn2d.f Because the deformation method is used, the prescribed displacements are used directly to deter-mine the strains. Only infinitesimal strains are considered. Subroutine strn2d(d,xl,ul,u0,tl,shp,ndf,ndm,nel,xx,yy,ta,eps) c * * F E A P * * A Finite Element Analysis Program c.... Copyright (c) 1984-1999: Robert L. Taylor c-----[--.----+----.----+----.-----------------------------------------] c Purpose: c Inputs: c Outputs: c-----[--.----+----.----+----.-----------------------------------------] implicit none c Compute strains and coordinates do j = 1,6 eps(j,1) = 0.0d0 eps(j,3) = 0.0d0 end do xx = 0.0d0 yy = 0.0d0 ta = -d(9) do j = 1,nel è nel is the maximum number of nodes on the element xx = xx + shp(3,j)*xl(1,j) è computes the global coordinate to the integration points yy = yy + shp(3,j)*xl(2,j) ta = ta + shp(3,j)*tl(j)

eps(1,1) = eps(1,1) + shp(1,j)*(ul(1,j,1) - u0(1,j))

∂∂

∂∂

∂∂

∂∂

=

uu

yx

y

x

xy

xx

xx

0

0

γεε

eps(2,1) = eps(2,1) + shp(2,j)*(ul(2,j,1) - u0(2,j)) eps(3,1) = eps(3,1) + shp(3,j)*(ul(1,j,1) - u0(1,j)) eps(4,1) = eps(4,1) + shp(2,j)*(ul(1,j,1) - u0(1,j)) è u0 is the initially strain, which is defined in solid2d.f & + shp(1,j)*(ul(2,j,1) - u0(2,j)) eps(1,3) = eps(1,1) + shp(1,j)*ul(1,j,2) eps(2,3) = eps(2,1) + shp(2,j)*ul(2,j,2) eps(3,3) = eps(3,1) + shp(3,j)*ul(1,j,2) eps(4,3) = eps(4,1) + shp(2,j)*ul(1,j,2) + shp(1,j)*ul(2,j,2) end do c Set 3-strain (thickness/hoop) if(stype.eq.3) then eps(3,1) = eps(3,1)/xx eps(3,2) = eps(3,2)/xx eps(3,3) = eps(3,3)/xx else eps(3,1) = 0.0d0 è The strain out of plane is set to zero eps(3,2) = 0.0d0 eps(3,3) = 0.0d0 endif end

Page 12: Adding Elements Into FEAP

Adding elements into FEAP January 2004

[email protected] 12

Stress modlsd.f Material is linearly elastic, obeying Hooke’s law, and that displacements and strains are infinitesi-mal. The subroutine dmat2d.f constructs the material moduli. The routine sld2d1.f calls the routine modlsd.f, which again calls the routine estrsd.f where the constitutive relation for an elastic material is placed. As explain previously, it is also possible to develop a user defined material model and add it to FEAP. Then the routine modlsd.f is calling the file umodel.f. Subroutine estrsd(d,ta,eps,sig,dd,dr) c * * F E A P * * A Finite Element Analysis Program c.... Copyright (c) 1984-1999: Robert L. Taylor c-----[--.----+----.----+----.-----------------------------------------] c Linear Elastic Constitutive Model implicit none save c Stress: call dmat2d(d,d(31),dd,beta) è dmat2d.f forms the elasticity matrix using the material array d(*) do i = 1,6 è 6 independently stress terms in case of 3D. sig(i) = sig(i) - beta(i)*ta 4 independently stress terms in case of 2D. do j = 1,6 sig(i) = sig(i) + dd(i,j)*eps(j) è Hooke’s Law dr(i,j) = dd(i,j) end do end do c Set plane stress case (dd(3,3) = 0.0d0) è Plane stress if(dd(3,3) .eq. 0.0d0 ) then eps(3) = d(90)*sig(1) + d(91)*sig(2) + d(92)*ta sig(3) = 0.0d0 endif end With a linear stress-strain, relationship is it possible to write the general stress-strain expression as follow ijijklij C εσ = , which is the generalized Hooke’s law. C contains the elastic coefficients. If the elements in C are constant throughout, the continuum is called homogeneous. C is assumed to sat-isfy the properties:

o Symmetry § Major symmetry klijijkl CC = § Minor symmetries jiklijkl CC = , ijlkijkl CC =

o Positive-definiteness Because of the major symmetry the stiffness matrix become symmetric and because of the first mi-nor symmetry, Cauchy stress tensor is symmetric. In the basic continuum, mechanics the symmetry of the stress tensor is due to the balance of angular momentum. The positive definiteness of the elastic tensor combined with suitable boundary conditions on the displacements make the stiffness matrix positive definiteness. These are important properties, which result in a non-singular matrix and this influence the type of a necessary solver.

Page 13: Adding Elements Into FEAP

Adding elements into FEAP January 2004

[email protected] 13

Because of the symmetry of the elastic tensor, the numbers of material constants are reduced from 81 to 54. In a similar fashion, we can make use of the symmetry of the strain tensor. This further reduces the number of material constants to 36. These coefficients are not all independent. By strain energy considerations, the numbers of coefficients are further reduced to 21. The most general ani-sotropic linear elastic material therefore has 21 material constants. If the material is isotropic, i.e., that the elastic constants are the same in all directions and therefore independent on the choice of the reference system, the 21 coefficients is reduced to two constants. The stress-strain relation then reduce to

zxzx

yzyz

xyxy

zzzz

yyyy

xxxx

JJJ

µγτ

µγτ

µγτµελσ

µελσµελσ

=

=

=+=

+=+=

2

22

1

1

1

Here λ and µ are Lamé’s constant and shear modulus respectively.

)21)(1( ννν

λ−+

=E

)1(2 νµ

+=

E

These coefficients arise from a mathematical treatment of the general linear relation. In experimen-tal work, Lamé’s constant is rarely used because it has no physical significance. Unlike the shear modulus, has physical significance and can be measured. The above equations give a relation be-tween Lamé’s constant, the shear modulus and Poisson’s ratio and Young’s modulus. There exist a fifth elastic constant, which is called the bulk modulus, K, and is the ratio between of the applied hydrostatic pressure and the volume dilatation.

)21(3 ν−= EK

In matrix format, the stress strain relation can be written as.

Page 14: Adding Elements Into FEAP

Adding elements into FEAP January 2004

[email protected] 14

( )( ) ( ) ( )[ ]

( )( ) ( ) ( )[ ]

( )( ) ( ) ( )[ ]

( )

( )

( )

( )[ ]

( )[ ]

( )[ ]( )

( )

( )zxzx

yzyz

xyxy

xxyyzzzz

zzxxyyyy

zzyyxxxx

zxzx

yzyz

xyxy

yyxxzzzz

zzxxyyyy

zzyyxxxx

E

E

E

E

E

E

E

E

E

E

E

E

τν

γ

τν

γ

τν

γ

σσνσε

σσνσε

σσνσε

γν

τ

γν

τ

γν

τ

εενεννν

σ

εενεννν

σ

εενεννν

σ

+=

+=

+=

+−=

+−=

+−=

+=

+=

+=

++−−+

=

++−−+

=

++−−+

=

12

12

12

1

1

112

12

12

1211

1211

1211

In case of plane strain, the strain in plane, i.e. in the x and y direction are functions of x and y alone, and the strain in the z direction is equal zero. This is true for thick bodies in the z direction.

00

22

1

1

1

=

=

==

+=+=

zx

yz

xyxy

zz

yyyy

xxxx

JJJ

τ

τ

µγτλσ

µελσµελσ

Page 15: Adding Elements Into FEAP

Adding elements into FEAP January 2004

[email protected] 15

In case of plane stress, the stress out of the plane is assume to be zero. This is true in those cases where the body thickness is small relative to its lateral dimensions.

( )

( )

( )

( ) yyyyxxyy

xxyyxxxx

yyxx

yyxxzz

zzzz

zx

yz

xyxy

yyyy

xxxx

J

J

JJ

µεεεµλ

λµσ

µεεεµλ

λµσ

εεµλ

µ

εεµλ

λε

µελστ

τ

µγτ

µελσµελσ

22

2

22

22

22

020

0

22

1

1

1

1

+++

=

+++

=

++

=

++

−=

=+==

=

=

+=+=

Page 16: Adding Elements Into FEAP

Adding elements into FEAP January 2004

[email protected] 16

Numerical integration int2d.f The concept of parametric representation of functions is crucial in the modern FEM. Together with numerical integration; it has become a key tool for the systematic development of elements in two and three dimensions. The isoparametric formulation makes it possible to generate elements that are nonrectangular and have curved sides. In formulation isoparametric elements, natural coordinate systems must be used. Displacements are expressed in terms of these coordinates. To get the strains the displacements are differentiated with respect to the global coordinates. Therefore a transforma-tion matrix is necessary to switch between the to reference systems. The isoparametric formulation allows the simple application of numerical integration. In FEAP the weights and the location of the integration point within the elements are computed in the subroutine int2d.f . The connection with the other routines is shown in table 1.2. c$Id: int2d.f,v 1.1 1999/08/25 21:54:03 rlt Exp $ subroutine int2d(l,lint,sg) c * * F E A P * * A Finite Element Analysis Program c.... Copyright (c) 1984-1999: Robert L. Taylor c Set number of total points lint = l*l è Number of integration points per element. c 5 pt. integration if(l.eq.0) then lint = 5 g = sqrt(0.6d0) do i = 1,4 sg(1,i) = g*lr(i) sg(2,i) = g*lz(i) sg(3,i) = 5.d0/9.d0 end do sg(1,5) = 0.0d0 sg(2,5) = 0.0d0 sg(3,5) = 16.d0/9.d0 c 1x1 integration elseif(l.eq.1) then sg(1,1) = 0.d0 sg(2,1) = 0.d0 if(nel.eq.3) sg(2,1) = -1./3.0d0 sg(3,1) = 4.d0 c 2x2 integration è Full integration for the bilinear element elseif(l.eq.2) then g = 1.d0/sqrt(3.d0) do i = 1,4 sg(1,i) = g*lr(i) sg(2,i) = g*lz(i) sg(3,i) = 1.d0 end do c 3x3 integration elseif(l.eq.3) then g = sqrt(0.6d0) h = 1.d0/81.d0 do i = 1,9 sg(1,i) = g*lr(i)

Page 17: Adding Elements Into FEAP

Adding elements into FEAP January 2004

[email protected] 17

sg(2,i) = g*lz(i) sg(3,i) = h*lw(i) end do c 4x4 integration elseif(l.eq.4) then g = sqrt(4.8d0) h = sqrt(30.0d0)/36.0d0 ss(1) = sqrt((3.d0+g)/7.d0) ss(4) = - ss(1) ss(2) = sqrt((3.d0-g)/7.d0) ss(3) = -ss(2) ww(1) = 0.5d0 - h ww(2) = 0.5d0 + h ww(3) = 0.5d0 + h ww(4) = 0.5d0 - h i = 0 do j = 1,4 do k = 1,4 i = i + 1 sg(1,i) = ss(k) sg(2,i) = ss(j) sg(3,i) = ww(j)*ww(k) end do end do c 5x5 integration elseif(l.eq.5) then g = sqrt(1120.d0) ss(1) = sqrt((70.d0 + g)/126.d0) ss(2) = sqrt((70.d0 - g)/126.d0) ss(3) = 0.0d0 ss(4) = -ss(2) ss(5) = -ss(1) ww(1) = (21.d0*g + 117.6d0)/(g*(70.d0 + g)) ww(2) = (21.d0*g - 117.6d0)/(g*(70.d0 - g)) ww(3) = 2.d0*(1.d0 - ww(1) - ww(2)) ww(4) = ww(2) ww(5) = ww(1) i = 0 do j = 1,5 do k = 1,5 i = i + 1 sg(1,i) = ss(k) sg(2,i) = ss(j) sg(3,i) = ww(j)*ww(k) end do end do endif end Example of numerical integration, linear 1D element For the linear element in one dimension, the analytical integration is straightforward. However, in case of elements in two dimensions, the integration would be lengthy and numerical integration is applicable. There are many quadrature rules. Here is the Gauss quadrature used.

Page 18: Adding Elements Into FEAP

Adding elements into FEAP January 2004

[email protected] 18

Sampling points and weights for Gauss Quadrature [3].

For numerically integrated elements, full integration is defined as a quadrature rule sufficient to provide the exact integrals of all entries in the element stiffness matrix.

2n order polynomial => n+1 IP for exact solution n points => 2n-1 order polynomial exactly

One point Gauss quadrature

212

210

21 22

111 =⋅

−=

−== ∑

=i

n

iii

Ti wxwBBEAk

:= k_1 EA

12 0 -1

20 0 0-12 0

12

Page 19: Adding Elements Into FEAP

Adding elements into FEAP January 2004

[email protected] 19

Two point Gauss quadrature

676667.11

21

311

21

31

21

21

22

1

2

1

2

111 ==

−−+

−=

−+

−== ∑

=

wxwxwBBEAkn

iii

Ti

k_2 EA :=

+

33

12

2

− −

33

12

2

− + 2

33

12 3

3

2

− −

33

12 3

3

, ,

+

33

12

+

33

12

− −

33

12

− +

33

12

− + 2

33

12 3

3

2

− −

33

12 3

383 − +

2 3

+

33

12

3

2 3

− +

33

12

3

, ,

+

33

12

+

33

12

− −

33

12

− +

33

12

,

− + 2 3

+

33

12

3

2 3

− +

33

12

3 +

+

33

12

2

− +

33

12

2

,

:= k_2 EA

1.166666666 -1.333333334 0.1666666669-1.333333334 2.666666667 -1.3333333340.1666666669 -1.333333334 1.166666666

Because the coefficients in the B matrix are linear, the elements in the integrand are quadratic. Two integration points are therefore minimum to obtain an exact solution.

Page 20: Adding Elements Into FEAP

Adding elements into FEAP January 2004

[email protected] 20

Three point Gauss quadrature

676667.1

98

210

95

21

53

95

21

53 222

111 ==

−+

−−+

−=== ∑

=

n

iii

Ti wBBEAk

k_3 EA :=

+ + 5

− +

12

155

2

9

5

− −

12

155

2

929

,

− + 2

− +

12

155 15

9

2

− −

12

155 15

9 ,

+ − 5

− +

12

155

+

155

12

9

5

− −

12

155

− +

155

12

929

− + 2

− +

12

155 15

9

2

− −

12

155 15

983

, ,

− + 2 15

+

155

12

9

2 15

− +

155

12

9

+ − 5

− +

12

155

+

155

12

9

5

− −

12

155

− +

155

12

929

,

− + 2 15

+

155

12

9

2 15

− +

155

12

9 + + 5

+

155

12

2

9

5

− +

155

12

2

929,

Page 21: Adding Elements Into FEAP

Adding elements into FEAP January 2004

[email protected] 21

:= k_3 EA

1.166666667 -1.333333333 0.1666666666-1.333333333 2.666666667 -1.3333333330.1666666666 -1.333333333 1.166666667

As expected, we end up with the same stiffness matrix as for a two-point integration. Isoparametric formulation Natural coordinates

:= ξ1 -1 := ξ2 0 := ξ3 1 Global coordinates

:= xx1 0 := xx3 L

:= xx2 L

2 The shape functions are derived in the same way as shown above but now expressed in natural co-ordinates. Transformation between natural and global coordinates is the shape functions expressed in natural coordinates multiplied by the nodal coordinates in the global reference system.

:= X − − ( )− − 1 ξ ( ) − 1 ξ L

2( )− − 1 ξ ξ L

2

For 0=ξ the global coordinates is 2L etc.

The Jacobian is the shape functions differentiated with respect to natural coordinates multiplied with the global coordinates.

:= J −

+ ξ

12 L ξ L

Page 22: Adding Elements Into FEAP

Adding elements into FEAP January 2004

[email protected] 22

Strain-displacement vector. TBB is:

:= BB

− ξ

12

2

+ ξ

12 L ξ L

−2

− ξ

12 ξ

+ ξ

12 L ξ L

− ξ

12

+ ξ

12

+ ξ

12 L ξ L

−2

− ξ

12 ξ

+ ξ

12 L ξ L

4 ξ2

+ ξ

12 L ξ L

−2

+ ξ

12 ξ

+ ξ

12 L ξ L

− ξ

12

+ ξ

12

+ ξ

12 L ξ L

−2

+ ξ

12 ξ

+ ξ

12 L ξ L

+ ξ

12

2

+ ξ

12 L ξ L

Gauss integration is used in the parent domain.

:= ke EA

2.333333332L −

2.666666667L

0.3333333339L

−2.666666667

L5.333333333

L −2.666666668

L0.3333333339

L −2.666666668

L2.333333333

L It is clear if the mid node is placed in the physical mid of the element, Jacobian is constant L/2. Because one has to transform the strain-displacement matrix into the global domain, B is simply the derivatives of the shape functions expressed in natural coordinates and then divided by Jacobian. In case that the mid node is not placed in the middle of the element, Jacobian is no longer constant and the analytical solution is not possible, because the natural coordinate is present in both numera-tor and denominator when integrating the above matrix BB. For example, if the mid node is placed in L/4 the formulas are changed

:= ξ1 -1 := ξ2 0 := ξ3 1

:= xx1 0 := xx2 L4

:= xx3 L

:= X − − ( )− − 1 ξ ( ) − 1 ξ L

4( )− − 1 ξ ξ L

2

Page 23: Adding Elements Into FEAP

Adding elements into FEAP January 2004

[email protected] 23

:= J − + ξ L2

+ ξ

12 L

:= BB

− ξ

12

2

− + ξ L2

+ ξ

12 L

− ξ

12

+ ξ

12

− + ξ L2

+ ξ

12 L

−2

− ξ

12 ξ

− + ξ L2

+ ξ

12 L

− ξ

12

+ ξ

12

− + ξ L2

+ ξ

12 L

+ ξ

12

2

− + ξ L2

+ ξ

12 L

−2 ξ

+ ξ

12

− + ξ L2

+ ξ

12 L

−2

− ξ

12 ξ

− + ξ L2

+ ξ

12 L

−2 ξ

+ ξ

12

− + ξ L2

+ ξ

12 L

4 ξ2

− + ξ L2

+ ξ

12 L

:= ke EA

5.499999997L −

6.000000001L

0.5000000007L

−6.000000001

L8.000000000

L −2.000000001

L0.5000000007

L −2.000000001

L1.500000000

L

This indicates that the element has become stiffer in the end where the two nodes are placed. For numerically integrated elements, full integration is defined as a quadrature rule sufficient to provide the exact integrals of all terms in the stiffness matrix if the element is undistorted. Use of full integration is the only sure way to avoid pitfalls as mesh instabilities. Instabilities might appear when reduced (less quadrature rule than full integration) integration is used. Instability may also be called a zero-energy mode, which refers to a nodal displacement vector that is not a rigid body mode but still produces zero strain energy. It is possible to determine the instability modes by using a eigen-value analysis of the element without any constraints. The first of three eigenvalues are zero due to the rigid body modes and the rest of the zero valued eigen-values are due the instability modes. Another term is selective integration, which means than different quadrature rule is used depending on the integrand. It is well known that the bilinear element in pure bending acts stiffer because of the spurious shear stresses in the element that are only zero in the middle of the element. Therefore, if one wants the exact shear stresses a one-point integration is necessary. However, to get the exact normal stresses a two-point integration is used.

Page 24: Adding Elements Into FEAP

Adding elements into FEAP January 2004

[email protected] 24

Post-processing For generation of a contour plot of stresses it is necessary to extrapolate or interpolate the stresses from Gauss points to nodal points. Imagine that stresses have been computed at the four Gauss points of a plane element shown in the next figure. One now wants to extrapolate or interpolate these stress values to other points in the element. In the figure, coordinate r is proportional to ξ and s is proportional to η .

Point 3 is located at ( )

=3

1,3

1,ηξ and ( ) ( )1,1, =rs . Therefore the proportional factor is 3 .

η

ξ

3

3

=

=

s

r

Stresses at any point P in the element are found by the usual shape functions derived above. Instead of using the patent reference system, the shape functions are expressed in s and r coordinates.

( )( )srN

N

i

iiip

±±=

= ∑=

1141

4

1

σσ

When examining finite element stress output it is not expected that stresses in adjacent elements will be the same along the common edge and that the stresses at nodes will be the same in all the elements that share the node or that the stress boundary conditions will be exactly satisfied. s In standard FEAP, it is possible to get the stresses at the integration point level as a function of the time steps. However, in many cases it is preferable to have the stresses and the corresponding strains. It might also be useful to select a specific range of integration points where stresses and strains are plotted for different time steps e.g. in a wave propagation problem. Therefore, it is necessary to define new arrays where the stresses and strains are stored for each in-tegration point and for every time step. The arrays have to be defined in the subroutine pcontr.f . c$Id: pcontr.f,v 1.4 1999/10/22 22:11:44 rlt Exp $ subroutine pcontr() c * * F E A P * * A Finite Element Analysis Program c.... Copyright (c) 1984-1999: Robert L. Taylor c-----[--.----+----.----+----.-----------------------------------------] c Purpose: Control program for FEAP problem input and solution. if (up(1).eq.0) then setvar = ualloc(1, 'SINP' ,(numel*9)*9, 2) !Real if (.not.setvar) then write(*,*) 'UALLOC error - SINP' stop endif call pzero(hr(up(1)),l5*9) !integer endif !up(1).eq.1

Page 25: Adding Elements Into FEAP

Adding elements into FEAP January 2004

[email protected] 25

The array for the stresses is named SINP and has the dimension (numel*9,9), which is the number of elements used, multiplied with the highest possible number of integration points per element and one can store up till 9 different values for each integration point. Now FEAP reserves memory space for the defined arrays and they are given a pointer with a specific number. The pointer for the user array gets the number 1. Therefore if data from the array is need in a spe-cific subroutine, it is possible to type hr(up(1)) to access the data from anywhere in FEAP. The stresses are computed in subroutine estrsd.f as shown above. In this routine, one simply adds selected stress values (or all of them) to the user-defined array SINP. If the post-processing program Tecplot is used, it is necessary to create a user macro, where one makes the file readable for Tecplot. An example of a user macro is shown below. subroutine umacr1(lct,ctl,prt) implicit none write(*,*) '' write(*,*) 'pmacr=>umaclib=>umacr1=>tecplt' write(*,*) '' if(pcomp(uct,'mac1',4)) then write(*,*) 'setting umacr1: TECP' uct = 'TECP' else call tecplt(hr(nph+numnp), $ hr(up(1)), ! sinp - stress at inp $ hr(up(2)), ! cinp - coor at inp $ hr(up(3)), ! stinp - strains at inp $ hr(np(25)), ! d material properties $ hr(np(43)), ! x $ hr(np(40)), ! u $ hr(np(44)), ! xl $ mr(np(33)), ! ix $ hr(np(51)), ! history variables $ ctl, ! key-words $ lct ) ! filename endif end Here the user defined array SINP is used.

Page 26: Adding Elements Into FEAP

Adding elements into FEAP January 2004

[email protected] 26

References [1] FEAP, A Finite Element Analysis Program. Version 7.1, Programmer Manual. Robert

L. Taylor. [2] The Finite Element Method, T.J.R. Hughes. [3] Concept and Applications of Finite Element Analysis, R.D. Cook. [4] The Finite Element Method: An introduction, G.N. Wells. [5] Experimental Stress Analysis, James W. Dally, Third edition.