Sunteți pe pagina 1din 4

TU Dortmund Institut fr Mechanik Simulation Methods in Solid Mechanics I

Dr.-Ing. Ralf Denzer Dipl.-Ing. Tobias Waenschmidt

9 Implementation of a 4-noded displacement-based quadrilateral nite element in MATLAB


The goal of this tutorial is the implementation of a 4-noded quadrilateral nite element with bilinear shape functions in the MATLAB-based FE-code. In particular, the code developed for the onedimensional truss example (fem1d_clampedbar.m) should be used as a basis and extended to the two-dimensional plane strain case. The MATLAB script is again divided into three main parts: Pre-Processing: Setup of the geometry, material and boundary conditions Analysis: Computation of the unknown displacements and stresses Post-Processing: Visualization of the computed results

9.1 Part 1: Pre-Processing


In contrast to the one-dimensional FE code, here the topology-specic variables like the coordinate list x and the connectivity list elem.cn, the boundary conditions dened in drlt and neum and the material parameters specied in matparam, are summarised to an own *.m-le. In doing so, we can easily switch between the geometries we want to analyse and besides dont have thousands of lines of input in the main code. Two input les are provided: 1. The *.m-le input_1quad4.m contains a square discretised by only one 4-noded quadrilateral nite element which is supported statically determined at the lower edge. It is loaded with a constant surface traction at the upper edge and a body force. This 1-element test is particulary useful for debugging reasons. 2. The *.m-le input_plate_hole.m contains a plate with a hole in its center discretised by nnp = 848 nodes and nel = 768 4-noded quadrilateral nite elements. It is supported statically determined at the lower edge and loaded with a constant displacement at the upper edge. Concerning the pre-processing, apparent dierences among others in comparison with the FE code for the one-dimensional case are e.g.

75

TU Dortmund Institut fr Mechanik Simulation Methods in Solid Mechanics I

Dr.-Ing. Ralf Denzer Dipl.-Ing. Tobias Waenschmidt

the global node coordinate list x is a nnp ndim matrix.


x=

x1 x2 x3 . . . xnnp

y1 y2 y3 . . . y nnp

with ndim = 2 and x being a matrix and no longer a vector and the body force b being a ndim 1-vector and no longer a scalar.

9.2 Part 2: Analysis: FE Calculation


As already mentioned, large parts of the FE-code in fem2d_quad4.m can directly be derived from the code developed for the 1d-truss example (fem1d_clampedbar.m) which should be used as a basis for the extension to the present 2d-case. The explicit coding steps should be implemented independently within this tutorial. In the following, for convenience, we provide the quadrature points and weights as well as the shape functions and their gradients.

9.2.1 Quadrature Points and Weights


The coordinates of quadrature points for a square master element are

1 1 = 3

1 3

1 , 2 = 3

1 3

1 , 3 = 3

1 3

1 , 4 = 3

1 3

. (9.1)

Within the code they have to be implemented as row vectors of the nqp ndim matrix qpt.

1 2 3 4 5 6 7 8 9 10 11 12 13

% number of quadrature points nqp = 4; % quadrature points qpt = zeros(nqp,ndm); qpt(1,:) = [sqrt(3.0)/3.0 qpt(2,:) = [ sqrt(3.0)/3.0 qpt(3,:) = [sqrt(3.0)/3.0 qpt(4,:) = [ sqrt(3.0)/3.0 % weights w8 = zeros(nqp,1); w8(1) = 1;

sqrt(3.0)/3.0]; sqrt(3.0)/3.0]; sqrt(3.0)/3.0]; sqrt(3.0)/3.0];

76

TU Dortmund Institut fr Mechanik Simulation Methods in Solid Mechanics I

Dr.-Ing. Ralf Denzer Dipl.-Ing. Tobias Waenschmidt

14 15 16

w8(2) = 1; w8(3) = 1; w8(4) = 1;

9.2.2 Shape Functions and Gradients


The bilinear shape functions for the -noded square master element are enumerated counter-clockwise in mathematical positive sense, i.e. N 1 (, ) = N 3 (, ) (1 )(1 ) (1 + )(1 ) , N 2 (, ) = 4 4

(9.2)

(1 + )(1 + ) (1 )(1 + ) = , N 4 (, ) = 4 4

Consequently, the gradients of the shape functions can be determined as (1 ) 4 (1 ) 4 (1 + ) 4


T

1 (, ) = 3 (, ) =

, 2 (, ) =

(1 ) 4 (1 + ) 4

(1 + ) 4 (1 ) 4

.
T

(9.3)

(1 + ) 4

4 (, ) =

Within the code the values of the shape functions and their gradients are implemented as vectors and matrices in the structural array masterelement which is associated with each quadrature point q.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

% shape functions and derivatives masterelement = repmat(struct('N', zeros(nen,1), 'gamma', zeros(nen,ndm)), nqp,1); for q = 1:nqp xi = qpt(q,1); eta = qpt(q,2); masterelement(q).N(1) masterelement(q).N(2) masterelement(q).N(3) masterelement(q).N(4) = = = = 0.25*(1.0xi)*(1.0eta); 0.25*(1.0+xi)*(1.0eta); 0.25*(1.0+xi)*(1.0+eta); 0.25*(1.0xi)*(1.0+eta); = = = = [0.25*(1.0eta) [ 0.25*(1.0eta) [ 0.25*(1.0+eta) [0.25*(1.0+eta) 0.25*(1.0xi)]; 0.25*(1.0+xi)]; 0.25*(1.0+xi)]; 0.25*(1.0xi)];

masterelement(q).gamma(1,:) masterelement(q).gamma(2,:) masterelement(q).gamma(3,:) masterelement(q).gamma(4,:) end

77

TU Dortmund Institut fr Mechanik Simulation Methods in Solid Mechanics I

Dr.-Ing. Ralf Denzer Dipl.-Ing. Tobias Waenschmidt

9.3 Part 3: Post-Processing


The post-processing is performed by means of using so-called patch objects (see the Matlab help for more information). Basically, the command patch(X,Y,C) creates a lled two-dimensional patch, where the elements of X and Y specify the vertices of a polygon (here the quadrilateral nite elements) and C determines the color of the patch. The respective code fragment, corresponding to the plotting of a stress-contour-plot of the 11 -component of the stress tensor could be implemented as given below.
1 2 3 4 5 6 7 8 9 10 11 12 13

figure(1); for e=1:nel xe = zeros(ndm, nen); for idm = 1:ndm xe(idm,:) = x(elem(e).cn,idm); end patch(xe(1,:), xe(2,:), save_av_stress{e}(1,1)) hold on end title('\sigma_{11}'); colorbar axis equal hold off

The results of the plate with a hole are visualised below. 11 N mm2 1 0.5 0 -0.5 -1 -1.5 -2 -2.5 -3 -3.5 -4
(a) normal stress 11 (b) normal stress 22

22

N mm2 12 10 8 6 4 2 0

12

N mm2 2.5 2 1.5 1 0.5 0 -0.5 -1 -1.5 -2 -2.5

(c) shear stress 12

Figure 9.1: Plate with hole subjected to nonzero displacement boundary conditions: contour-plot of the dierent stress-components (a)-(c).

78

S-ar putea să vă placă și