linear interpolation shape functions · web viewthe aim of the finite element method is to find an...

22
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, …, N e . 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. 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 v e (x) defined between two nodes. a05/fem/doc/shape_functions_1d.doc Monday, July 25, 2022 6:15:32 PM 1 1 2 3 4 1 2 3 4 5 Globalnum bering Elem entnum bers Localnum bering 1 +X 2 Elem ent N ode e 2 3 local 4 1 2 3 4 5 3 4 1 2 1 2 global u v e 1 2 v e2 v e1 Unknown solution u ( x) Approxim ate solution v( x)= v e ( x) +X +X v e ( x)

Upload: others

Post on 10-Apr-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: LINEAR INTERPOLATION SHAPE FUNCTIONS · Web viewThe aim of the finite element method is to find an approximate solution v(x) by calculating its values at the nodes from an interpolation

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.

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.

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 Thursday, May 18, 2023 6:23:01 PM 1

1 2 3 41

2

3 4 5Global numbering

Element numbers

Local numbering 1+X

2

Element Nodee

2 3

local

4

123

4 5

3 4

1 2

1 2

global

u v

e

1 2

ve2ve1

Unknown solution u(x)Approximate solution

v(x) = ve(x)

+X +X

ve(x)

Page 2: LINEAR INTERPOLATION SHAPE FUNCTIONS · Web viewThe aim of the finite element method is to find an approximate solution v(x) by calculating its values at the nodes from an interpolation

, (1)

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

Fig. 3. Coordinate systems for a typical element.

From equation (1), we have the relationship

and (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

(4a)

(4b)

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 Thursday, May 18, 2023 6:23:01 PM 2

ith element1 2

x = 0

+ Xxi xi+1x

= -1 = +1

hi

Page 3: LINEAR INTERPOLATION SHAPE FUNCTIONS · Web viewThe aim of the finite element method is to find an approximate solution v(x) by calculating its values at the nodes from an interpolation

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

(5a)

(5b)

(6a)

(6b)

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

(7)

(8)

where

[N] = [N1 N2] and (9)

a05/fem/doc/shape_functions_1d.doc Thursday, May 18, 2023 6:23:01 PM 3

N v

1

0

N1 N2

1 12 2

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

ve1

ve2

Page 4: LINEAR INTERPOLATION SHAPE FUNCTIONS · Web viewThe aim of the finite element method is to find an approximate solution v(x) by calculating its values at the nodes from an interpolation

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

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

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,

(11a)

and

(11b)

(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 Fourier’s law and is the heat flux equation is given by

(12)

a05/fem/doc/shape_functions_1d.doc Thursday, May 18, 2023 6:23:01 PM 4

Page 5: LINEAR INTERPOLATION SHAPE FUNCTIONS · Web viewThe aim of the finite element method is to find an approximate solution v(x) by calculating its values at the nodes from an interpolation

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

(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,

(14)

Using Fourier’s law and rearranging the equations gives a simple differential equation governing the one-dimensional steady state conduction of heat through the material

(15)

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)

a05/fem/doc/shape_functions_1d.doc Thursday, May 18, 2023 6:23:01 PM 5

Page 6: LINEAR INTERPOLATION SHAPE FUNCTIONS · Web viewThe aim of the finite element method is to find an approximate solution v(x) by calculating its values at the nodes from an interpolation

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

q(0) = 0 and (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 (16c)

FINITE ELEMENT METHOD

Galerkin’s approachTo 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)

(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

(18)

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

(19)

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

(20)

a05/fem/doc/shape_functions_1d.doc Thursday, May 18, 2023 6:23:01 PM 6

Page 7: LINEAR INTERPOLATION SHAPE FUNCTIONS · Web viewThe aim of the finite element method is to find an approximate solution v(x) by calculating its values at the nodes from an interpolation

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

(21a)

(21b)

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

(22)

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

(23)

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

(24)

Let the thermal coefficient matrix for an element be

(25a)

and using equation (11)

(25b)

(25c)

(25d)

Therefore, the matrix equation for an element is

a05/fem/doc/shape_functions_1d.doc Thursday, May 18, 2023 6:23:01 PM 7

Page 8: LINEAR INTERPOLATION SHAPE FUNCTIONS · Web viewThe aim of the finite element method is to find an approximate solution v(x) by calculating its values at the nodes from an interpolation

(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}

(27)

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}

(28)

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

(29)

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

a05/fem/doc/shape_functions_1d.doc Thursday, May 18, 2023 6:23:01 PM 8

Page 9: LINEAR INTERPOLATION SHAPE FUNCTIONS · Web viewThe aim of the finite element method is to find an approximate solution v(x) by calculating its values at the nodes from an interpolation

clustered about its main diagonal, and outside this band all the terms are zero. The 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} matricesOne way is to modify the matrices [K] and [Q]. For the three element model, equation (27) expands to the form

(32)

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 Thursday, May 18, 2023 6:23:01 PM 9

Page 10: LINEAR INTERPOLATION SHAPE FUNCTIONS · Web viewThe aim of the finite element method is to find an approximate solution v(x) by calculating its values at the nodes from an interpolation

(33)

This set of equations with unaltered dimensions can be solved to find all the unknown nodal values.

Method 2: Penalty approachAnother 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

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 Thursday, May 18, 2023 6:23:01 PM 10

Page 11: LINEAR INTERPOLATION SHAPE FUNCTIONS · Web viewThe aim of the finite element method is to find an approximate solution v(x) by calculating its values at the nodes from an interpolation

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

And rearranging

Results of calculation

Tx = 16.6667 C

q = 1.66667×104 W.m-2

Matlab Code% example_xxx.m

clearclc

% Input parameters ******************************% LengthsL(1) = 0.1;L(2) = 0.05;% Thermal conductivitiess(1) = 20;s(2) = 50;% Temperatures at outer surfacesT(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/AI(1) = -c(1)*(T(3)-T(1));I(2) = -c(2)*(T(2)-T(3));

% Output parameters

a05/fem/doc/shape_functions_1d.doc Thursday, May 18, 2023 6:23:01 PM 11

Page 12: LINEAR INTERPOLATION SHAPE FUNCTIONS · Web viewThe aim of the finite element method is to find an approximate solution v(x) by calculating its values at the nodes from an interpolation

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 calculationNodal 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 Thursday, May 18, 2023 6:23:01 PM 12

Page 13: LINEAR INTERPOLATION SHAPE FUNCTIONS · Web viewThe aim of the finite element method is to find an approximate solution v(x) by calculating its values at the nodes from an interpolation

0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.160

10

20

30

40

50

60

70

80

90

100

Position x (m)

Tem

pera

ture

T (

o C)

Matlab Code% example_xxx1.m

clearclc

% Input parameters ******************************Ne = 4; % number of elements% LengthsL(1) = 0.1;L(2) = 0.05;% Thermal conductivitiess(1) = 20;s(2) = 50;% Temperatures at outer surfacesT(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 Thursday, May 18, 2023 6:23:01 PM 13

Page 14: LINEAR INTERPOLATION SHAPE FUNCTIONS · Web viewThe aim of the finite element method is to find an approximate solution v(x) by calculating its values at the nodes from an interpolation

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

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

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

% Assembly thermal coefficient matrixK = zeros(Ne+1,Ne+1);for c1 = 1 : NeK(c1:c1+1,c1:c1+1) = K(c1:c1+1,c1:c1+1) + c(c1) * Ke; end

% Matrix for unknown nodal valuesV = zeros(Ne+1,1);

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

% INTRODUCING THE BOUNDARY CONDITIONS ***********% Method 1: Modification of [K] and {Q} matriciesV1 = 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] matrixK1(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 approachV2 = zeros(Ne+1,1);Q2 = Q;K2 = K;

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

a05/fem/doc/shape_functions_1d.doc Thursday, May 18, 2023 6:23:01 PM 14

Page 15: LINEAR INTERPOLATION SHAPE FUNCTIONS · Web viewThe aim of the finite element method is to find an approximate solution v(x) by calculating its values at the nodes from an interpolation

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

% Modify [K] matrixK2(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 densityI = - s(1)*(V1(2)-V1(1))/h(1);disp(' ')disp('Nodal positions')xdisp(' ')disp('Nodal temperatures - Method 1: Modification of [K] and {Q} matrices')V1disp('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 Thursday, May 18, 2023 6:23:01 PM 15

Page 16: LINEAR INTERPOLATION SHAPE FUNCTIONS · Web viewThe aim of the finite element method is to find an approximate solution v(x) by calculating its values at the nodes from an interpolation

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 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

Applying the boundary condition at x = 0, means that we have to rearrange the matrix equation to give

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

a05/fem/doc/shape_functions_1d.doc Thursday, May 18, 2023 6:23:01 PM 16

Page 17: LINEAR INTERPOLATION SHAPE FUNCTIONS · Web viewThe aim of the finite element method is to find an approximate solution v(x) by calculating its values at the nodes from an interpolation

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 Thursday, May 18, 2023 6:23:01 PM 17