Você está na página 1de 17

LINEAR INTERPOLATION SHAPE FUNCTIONS

In the finite element method for one-dimensional problems, the region of interest is
divided into elements connecting nodes. The elements and nodes are identified by a
numbering system. The elements are numbered 1, 2, , Ne. The nodes of an element are
identified by 1 and 2 in the local node numbering system. A connectivity table relates
the local node numbers to the global numbers.

Element Node
Element numbers
1 2 3 4 e 1 2 local
1 1 2
1 2 3 4 5
Global numbering 2 2 3 global
3 3 4
4 4 5

Local numbering 1 2
+X

Fig. 1. Element and node numbering for a 4 element model.

Assume that the solution to a problem is the unknown function u(x). The aim of the finite
element method is to find an approximate solution v(x) by calculating its values at the
nodes from an interpolation function ve(x) defined between two nodes.

u v ve(x)

ve1 ve2

e
+X 1 2 +X
Unknown solution u(x)
Approximate solution
v(x) = ve(x)

Fig. 2. Linear interpolation ve(x) used within each element to give the
approximate solution v(x). ve1 and ve2 are the nodal values of the
approximation function in local coordinates.

To specify the location along the X-axis of a point, both global and local coordinate
systems are used, as shown in figure 3. The global coordinates of the nodes are xi (i = 1,
2, , Ne+1. The local coordinate system is often referred to as a natural or instrinsic
coordinate system, denoted by where

a05/fem/doc/shape_functions_1d.doc Monday, March 13, 2017 11:21:50 AM 1


2( x xi ) 2( x xi )
1 1 , (1)
xi 1 xi hi

for the ith element of length hi = xi+1 xi. At node 1 of an element, = -1 and at node 2,
= +1.
ith element
1 2
x=0

xi +X
xi+1
x

= -1 = +1
hi

Fig. 3. Coordinate systems for a typical element.

From equation (1), we have the relationship

d 2 hi
and dx d (2)
dx hi 2

The natural coordinate system is used to define the linear interpolation shape functions,
N1 and N2 used for the interpolation within the ith element

vi() = N1() ve1 + N2() ve2 (3)

where ve1 and ve2 are the local nodal values of the function v(x) and

1
N1 ( ) (4a)
2

1
N 2 ( ) (4b)
2

The interpolation functions are straight lines, with N1(-1) = 1, N1(+1) = 0, N2(-1) = 0 and
N2(+1) = 1 as shown in figure 4.

a05/fem/doc/shape_functions_1d.doc Monday, March 13, 2017 11:21:50 AM 2


N v

1 N1 N2

ve2
ve1
0

1 2 1 2
= -1 =0 = +1 = -1 = +1

Fig. 4. Linear interpolation shape functions and linear interpolation using


N1 and N2.

The derivates of the element interpolation function vi and the shape functions N1 and N2
with respect to and x are

dN1 1 dN 2 1
(5a)
d 2 d 2

dN1 dN1 d 1 2 1 dN 2 1
(5b)
dx d dx 2 hi hi dx hi

dvi 1 1
ve1 ve 2 (6a)
d 2 2

dvi dvi d 1 1 1
ve1 ve 2 ve1 ve 2 (6b)
dx d dx hi hi hi

The interpolation function and its first derivative can be written in matrix form as

vi [N]{v e } (7)

dvi 1 1 dvi 1 1
[ ]{v e } [ ]{v e } (8)
d 2 2 dx hi hi

where

ve1
[N] = [N1 N2] and {v e } (9)
ve 2

a05/fem/doc/shape_functions_1d.doc Monday, March 13, 2017 11:21:50 AM 3


The coordinate transformation in equation (1) can also be written in matrix form using
the shape functions

xe1
x = [N] {xe} = [N1 N2] (10)
xe 2

where xe1 and xe2 are the local nodal X coordinates. When both the approximation
function v and coordinate x are interpolated using the same shape functions, the
formulation is called isoparametric.

We can calculate the integrals of the shape function with respect to x over an element by
calculating the area under the curves for N1 and N2,

hi hi hi
o
N1 dx N 2 dx
o 2
(11a)
and

hi dN1 dN1 hi dN dN 1
0 dx dx
dx
0 dx
2
dx
2
dx
hi
(11b)

hi dN1 dN 2 hi dN dN 1
0 dx dx
dx
0 dx
2
dx
1
dx
hi
(11c)

ONE-DIMENSIONAL STEADY-STATE HEAT TRANSFER

In the steady-state heat transfer in one direction, our goal is to find the temperature
distribution. A heat flux occurs and a temperature gradient exists along only one
coordinate axis and the temperature at each point is independent of time. Many actual
situations involving heat transfer can be modeled based upon the one-dimensional steady-
state transfer of heat.

Heat transfer by conduction through a material occurs when a temperature difference


occurs within the material or between the material and surroundings. The one-
dimensional conduction process along the X-axis is described by Fouriers law and is the
heat flux equation is given by

dT ( x )
q( x ) ( x ) (12)
dx

a05/fem/doc/shape_functions_1d.doc Monday, March 13, 2017 11:21:50 AM 4


where T(x) is the temperature field in the material (K or C), q(x) is the heat flux (W.m-
2
), (x) is the thermal conductivity (W.m-1.K-1) which is a property of the material and
dT/dx is the temperature gradient (K.m-1). The minus sign indicates the direction of heat
transfer is in the direction of decreasing temperature.

There is convective transfer of heat between a fluid and a solid surface as a result of a
temperature difference. The equation for heat transfer by convection is

q hc Ts T (13)

Where q is the convective heat flux (W.m-2), hc is the convection heat transfer coefficient
(W.m-2.K-1), Ts is the surface temperature of the material and T is the fluid temperature.

Heat transfer can also occur by radiation where the heat flux is proportional to the fourth
power of the absolute temperature. This method of heat heat transfer will not be
considered in our models.

Consider the heat conduction through a wall as shown in figure ? The cross section area
of the wall is A and assume a uniform internal generation of heat per unit volume QV
(W.m-3), for example, a wire of resistance R with a current I (QV = I2R/V). QV is usually
called a source when QV > 0 and a sink when QV < 0. For a steady-state situation, the heat
flux and the internal heat generation for a volume element must equal the heat flux
leaving an element for the temperature to remain independent of time, therefore,

dq
q A QV Adx q A (14)
dx
Using Fouriers law and rearranging the equations gives a simple differential equation
governing the one-dimensional steady state conduction of heat through the material

d dT ( x )
( x) QV 0 (15)
dx dx

where T(x) is the temperature along the material which can be determined by solving
equation (15) given the boundary conditions.

The boundary conditions are mainly of three types:

1. Dirichlet condition: the nodal values are specified by the boundary conditions. For
example, the temperatures at the ends of the material are specified

x=0 T(0) = To and x=L T(L) = TL (16a)

2. Neumann condition: the heat fluxes are specified at the boundaries. For example,
where the inside surface is insulated and the flux is zero and the outside surface is a
convection surface

a05/fem/doc/shape_functions_1d.doc Monday, March 13, 2017 11:21:50 AM 5


q(0) = 0 and q( L) hc Ts T (16b)

3. Cauchy or mixed condition: Both field values and the field gradients are specified
by the boundary conditions. For example, the inside wall is maintained at a constant
temperature and convective occurs at the outside surface

T(0) = and q( L) hc Ts T (16c)

FINITE ELEMENT METHOD

Galerkins approach
To find the approximate temperature distribution (T v) along the material using the
finite element method, we first define for each element, as in equation (7)

vi [N]{v e } (17)

The thermal conductivity within each element i is assumed to be constant. In the


Galerkin approach, to find the unknown nodal temperatures we solve the equation

L d dv
0 dx dx QV [N] dx 0

(18)

Apply integration by parts to the left hand side of equation (18) to give

L
dv L d [ N ] dv L
N 0 dx QV N dx 0
(19)
dx 0
dx dx o

The first term is determined by the boundary conditions at the ends of the material and
can be assigned the values Q1 and QNe+1 which corresponds to the heat flux into the first
element and the heat flux out of the last element.

We can use the isoparametric representation with equation (19), so that for the ith element
we can write

hi
hi d [ N ] dvi dv hi
i dx i N QVi N dx
0 dx dx dx 0
o (20)

Using equations (5) and (6), the right hand side of equation (20) can be expressed as

a05/fem/doc/shape_functions_1d.doc Monday, March 13, 2017 11:21:50 AM 6


hi
dvi hi
i N1 QV i N1 dx qe1 (21a)
dx o
0

hi
dv hi
i N2 i QV i N 2 dx qe 2 (21b)
dx o
0

and we can define the column vector {qe}for an element as

qe1
q (22)
qe 2
e

The left hand side of equation (20) can be expressed as

hi d [N] dvi hi dN j dN1 dN 2 ve1


o
i
dx dx
dx i
0 dx dx dx
dx
ve 2
(23)

where the column vector {ve} gives the local nodal values of the unknown function

ve1
ve (24)
ve 2

Let the thermal coefficient matrix for an element be

hi dN j dN1 dN 2
[k e ] i 0 dx dx dx
dx (25a)

and using equation (11)

hi dN1 dN1 hi dN1 dN 2 i


ke11 i
0 dx dx
dx i
hi
ke12 i
0 dx dx
dx
hi
(25b)

hi dN 2 dN1 i hi dN 2 dN 2
ke21 i 0 dx dx
dx
hi
ke 22 i 0
k
dx dx
dx i
hi
(25c)

i 1 1
[ke ] 1 1 (25d)
hi

Therefore, the matrix equation for an element is

a05/fem/doc/shape_functions_1d.doc Monday, March 13, 2017 11:21:50 AM 7


ke ve qe (26)

Assembly Procedure

We need to assemble the global matrices [K], [V] and [Q] from the element matrices [ke],
{ve} and {qe}. For a three element model, the assembly process involves:

1. Construction of the global column matrix for the unknown nodal temperatures {V}

V1 v11
V v1 v 2
V 2

2 1
(27)
V 3 v 22 v 31
V 4 v 32

where terms such as v21 is the unknown value for element 2 and local node 1. The
values of V1 and V4 may be determined by the boundary conditions at the external
nodes.

2. Construction of the global column matrix {Q}

Q1 q11
Q q1 q2
Q 2

2 1
(28)
Q 3 q22 q31
Q 4 q32

where terms such as q32 is the heat flux across the local node 2 for element 3. If all
quantities are measured in their S.I. unit, then the Qs are measured in watts in this
problem on heat conduction. The Qs represent the rate of heat transfer or heat flux
across each node and the values Q1 and Q4 represent the heat fluxes at the external
boundaries, into and out of the material respectively.

3. Construction of the global thermal coefficient matrix [K] of (Ne +1) rows and
(Ne+1) columns

k111 k112 0 0
k1 k122 k 211 k 212 0
K 21 (29)
0 k 221 k 222 k 311 k 312

0 0 0 k 321 k 322

Each term in the matrix [K] has the S.I. units of W.K-1 (W.C-1). The thermal
coefficient matrix [K] is a banded and sparse matrix because the nonzero terms are
clustered about its main diagonal, and outside this band all the terms are zero. The

a05/fem/doc/shape_functions_1d.doc Monday, March 13, 2017 11:21:50 AM 8


banded and spare matrix results from the connectivity of a finite element mesh and
for area and volume elements, efficient numbering of the nodes, the width of the
band can be minimized. Usually the [K] matrix is symmetric.

The integration by parts of equation (18) has two important implications: (1) it gives
information of the boundary values and (2) it lowered the order of the highest order
derivative appearing in the integrals of the thermal coefficient matrix [K]. The generality
of this assembly process for the finite element method is very advantageous, since a
computer code developed for the solution of one class of problem can be applied to other
classes of problems. The complete system of equations solved by the finite element
method is always of the form

[K ] {V} = {Q} (30)

where {V} is the column matrix of nodal values for the assemblage.

Introducing the boundary conditions

Regardless of the type of problem, the system of equation to be solved after the assembly
process will have the form

[K ] {V} = {Q} (31)

The physics of the problem determines the boundary conditions that apply. We require at
every node that we know either the Vi or Qi. There are a variety of ways to apply the
boundary conditions.

Method 1: Modification of [K] and {Q} matrices


One way is to modify the matrices [K] and [Q]. For the three element model, equation
(27) expands to the form

K11 K12 K13 K14 V1 Q1


K K 22 K 23 K 24 V 2 Q
21 2
(32)
K 31 K 32 K 33 K 34 V 3 Q3

K 41 K 42 K 43 K 44 V 4 Q4

Suppose that the values V1 and V3 were specified in the problem as

V1 = 1 and V3 = 2

Then applying the boundary conditions, equation (28) becomes

a05/fem/doc/shape_functions_1d.doc Monday, March 13, 2017 11:21:50 AM 9


1 0 00 V1 1
0 K 0K 24 V 2 Q2 K 211 K 23 3

22 (33)
0 0 1 0 V 3 3

0 K 42 0 K 44 V 4 Q4 K 411 K 43 3
This set of equations with unaltered dimensions can be solved to find all the unknown
nodal values.

Method 2: Penalty approach


Another way in which the boundary conditions can be introduced and preserves the
sparse, banded and usually symmetric properties of the [K] matrix is to modify the
diagonal terms of [K] associated with the known nodal by multiplying them by a large
number, say 1015, while the corresponding terms in {Q} are multiplied by the product of
the large number and the corresponding diagonal term. With this procedure we obtain

K11 1015 K12 K13 K14 V1 1 K11 1015


V
K 21 K 22 K 23 K 24 2 Q2
15
Q3 K 33 10
K K 34
31 K 32 K 33 1015
V 3
V 4
K 41 K 42 K 43 K 44
Q4

Again, the system of simultaneous equations can be solved to find the unknown nodal
values.

Example: Conduction through a composite slab with Dirichlet Boundary conditions

Consider a composite slab with a uniform cross-sectional area A consisting of two


materials having thicknesses L1 and L2 and thermal conductivities 1 and 2. The
temperatures at the outer surfaces of the materials are T1 and T2. We can calculate for the
steady-state case, the temperature Tx at the interface between the two materials and the
rate of heat transfer (heat flux) through the slab H.

Parameters
L1 = 0.100 m L2 = 0.050 m 1 = 20 W.m-1.C-1 2 = 50 W.m-1.C-1
T1 = 100 C T2 = 0C

Solution: analytic (exact) calculation

The heat flux equation for conduction is

a05/fem/doc/shape_functions_1d.doc Monday, March 13, 2017 11:21:50 AM 10


dT ( x )
q( x )
dx

In the steady-state, the heat flux through both materials must be the same. Therefore, q1 =
q2 and we can write

Tx T1 T2 Tx
1 2
L1 L2
And rearranging

Tx
2 / L2 T2 1 / L1 T1
2 / L2 1 / L1
Results of calculation

Tx = 16.6667 C

q = 1.66667104 W.m-2

Matlab Code
% example_xxx.m

clear
clc

% Input parameters ******************************


% Lengths
L(1) = 0.1;
L(2) = 0.05;
% Thermal conductivities
s(1) = 20;
s(2) = 50;
% Temperatures at outer surfaces
T(1) = 100;
T(2) = 0;

% Calculations ***********************************
c = s./L;
% Temperature at interface Tx = T(3)
T(3) = (c(1)*T(1) + c(2)*T(2))/(c(1)+c(2));

% Heat flux density I = H/A


I(1) = -c(1)*(T(3)-T(1));
I(2) = -c(2)*(T(2)-T(3));

a05/fem/doc/shape_functions_1d.doc Monday, March 13, 2017 11:21:50 AM 11


% Output parameters
fprintf('Temp at interface Tx = %0.5g deg C \n',T(3))
disp(' ')
fprintf('Heat flux density I = %0.4e W.m^-2 \n',I(1))

Solution: fem

Results of calculation
Nodal positions

x=
0
0.0500
0.1000
0.1250
0.1500

Nodal temperatures - Method 1: Modification of [K] and {Q} matrices

V1 =
100.0000
58.3333
16.6667
8.3333
0

Nodal temperatures - Method 2: Penalty approach

V2 =
100.0000
58.3333
16.6667
8.3334
0.0000

Temp at interface Tx = 16.6667 deg C

Heat flux density q = 1.6667e+004 W.m^-2

The results are identical to the exact solution, because the temperature gradient within
each material is a linear function and a linear interpolation function is used.

a05/fem/doc/shape_functions_1d.doc Monday, March 13, 2017 11:21:50 AM 12


100

90

80

70
Temperature T ( C)
o

60

50

40

30

20

10

0
0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16
Position x (m)

Matlab Code
% example_xxx1.m

clear
clc

% Input parameters ******************************


Ne = 4; % number of elements
% Lengths
L(1) = 0.1;
L(2) = 0.05;
% Thermal conductivities
s(1) = 20;
s(2) = 50;
% Temperatures at outer surfaces
T(1) = 100;
T(2) = 0;

% Setup *****************************************
% Coefficients c = sigma/h
h = zeros(1,Ne);
c = zeros(1,Ne);
h(1:Ne/2) = L(1)/2;
h(Ne/2+1:Ne) = L(2)/2;
sigma(1:Ne/2) = s(1);

a05/fem/doc/shape_functions_1d.doc Monday, March 13, 2017 11:21:50 AM 13


sigma(Ne/2+1:Ne) = s(2);
c = sigma ./ h;

Ke = [1 -1;-1 1];

x = zeros(Ne+1,1);
for cc = 2 : Ne+1
x(cc) = x(cc-1) + h(cc-1);
end

% Assembly thermal coefficient matrix


K = zeros(Ne+1,Ne+1);
for c1 = 1 : Ne
K(c1:c1+1,c1:c1+1) = K(c1:c1+1,c1:c1+1) + c(c1) * Ke;
end

% Matrix for unknown nodal values


V = zeros(Ne+1,1);

% Q matrix
Q = zeros(Ne+1,1);

% INTRODUCING THE BOUNDARY CONDITIONS ***********


% Method 1: Modification of [K] and {Q} matricies
V1 = zeros(Ne+1,1);
Q1 = zeros(Ne+1,1);
K1 = K;

Q1(1) = T(1);
Q1(5) = T(2);
Q1(2) = Q(2) - K(2,1)*T(1) - K(2,5)*T(2);
Q1(3) = Q(3) - K(3,1)*T(1) - K(3,5)*T(2);
Q1(4) = Q(4) - K(4,1)*T(1) - K(4,5)*T(2);

% Modify [K] matrix


K1(1,:) = 0; K1(:,1) = 0; K1(1,1) = 1;
K1(5,:) = 0; K1(:,5) = 0; K1(5,5) = 1;

V1 = K1\Q1;

% Method 2: Penalty approach


V2 = zeros(Ne+1,1);
Q2 = Q;
K2 = K;

Kmax = max(max(K))*1e5;

a05/fem/doc/shape_functions_1d.doc Monday, March 13, 2017 11:21:50 AM 14


Q2(1) = Q(1) + Kmax * T(1);
Q2(5) = Q(5) + Kmax * T(2);

% Modify [K] matrix


K2(1,1) = K(1,1) + Kmax;
K2(5,5) = K(5,5) + Kmax;

V2 = K2\Q2;

% GRAPHICS **************************************
figure(1)
plot(x,V1,'o-','LineWidth',2)
xlabel('Position x (m)');
ylabel('Temperature T ( {^o} C)');

% OUTPUTS ***************************************
% Heat Flux density
I = - s(1)*(V1(2)-V1(1))/h(1);
disp(' ')
disp('Nodal positions')
x
disp(' ')
disp('Nodal temperatures - Method 1: Modification of [K] and {Q} matrices')
V1
disp('Nodal temperatures - Method 2: Penalty approach')
V2

fprintf('Temp at interface Tx = %0.6g deg C \n',V1(3))


disp(' ')
fprintf('Heat flux density I = %0.4e W.m^-2 \n',I)

a05/fem/doc/shape_functions_1d.doc Monday, March 13, 2017 11:21:50 AM 15


Example: Conduction through a composite slab with Cauchy Boundary conditions

A composite wall consists of three materials. The outer temperature at T(L) = 20 C.


Convection heat transfer takes place on the inner surface of the wall with T = 800 C and
hc = 25 W.m-2.C-1 Determine the temperature field T(x) within the wall. The thickness
and thermal conductivities of the three materials are

L1 = 0.3 m L2 = 0.15 m L3 = 0.15 m

1 = 20 W.m-2.K-1 2 = 30 W.m-1.K-1 3 = 50 W.m-2.K-1

Solution: fem

The matrix equation to solve is

[K] {V} = {Q}

which has to be modified by the boundary conditions

x = 0 q(0) hc T (0) T
where T(0) is the unknown temperature V1, hc = 25 W.m-2.C-1 and T = 800 C

x = L T(L) = V4 = 20 C

Consider a 3 element model with 4 nodes. The matrix equation can be written as

K11 K12 K13 K14 V1 Q1


K K 22 K 23 K 24 V 2 Q
21 2

K 31 K 32 K 33 K 34 V 3 Q3

K 41 K 42 K 43 K 44 V 4 Q4

Applying the boundary condition at x = 0, Q1 hc V1 T means that we have to


rearrange the matrix equation to give

K11 hc K12 K13 K14 V1 hc T


K K 22 K 23 K 24 V
21 2 Q 2

K 31 K 32 K 33 K 34 V 3 Q 3
V 4 Q 4
K 41 K 42 K 43 K 44

Applying the boundary condition at x = L, the matrix equation is modified to give

a05/fem/doc/shape_functions_1d.doc Monday, March 13, 2017 11:21:50 AM 16


K11 hc K12 K13 0 V1 hc T
K K 22 K 23 0 V K
2 25

21

K 31 K 32 K 33 0 V 3 K 35
V 4 T4
0 0 0 1

We can solve this set of simultaneous equations to find the unknown temperatures.

are shown in figure 4. Tstraight lines functions a

. ) defines nConsider a typical element e with local nodes 1 and 2.

a05/fem/doc/shape_functions_1d.doc Monday, March 13, 2017 11:21:50 AM 17

Você também pode gostar