You are on page 1of 8

1

CHAPTER ONE

Essential Background

MATLAB implementation 1.1: Mapped element


computations

ô Mapping
The calculations for mapping areas can easily be performed in Matlab. Consider finding mapping for a curved quadrilateral
area. All four sides are curved and are defined by three points on each side for a total of 8 points. The master element has
eight nodes as shown in the figure. The coordinates of the key points are as follows.

Master area y Quadrilateral


t
7 6 5 7 6 5
2.5
4
2 3
8 4 8
2 s 1.5 2
1
1 2 3
0.5
1 x
2 0.5 1 1.5
2

pts = [0.5, 0.5; 1.1, 1.6; 1.7, 2.1; 1.5, 2.5; 1.1, 2.8;

.75, 2.5; .5,2.5; .25, 1.5];

MatlabFiles\Chap01\Quad8Mapping.m
3

pts = @0.5, 0.5; 1.1, 1.6; 1.7, 2.1; 1.5, 2.5; 1.1, 2.8;
% Mapping for a quadrilateral defined by the following eight points

.75, 2.5; .5,2.5; .25, 1.5D;


xn=ptsH:,1L; yn= ptsH:,2L;
map=@D;
for s=−1:1ê10:1
for t=−1:1ê10:1

n = @−HH−1 + sL∗H−1 + tL∗H1 + s + tLLê4, ...


% 8 node serendipity interpolation functions

HH−1 + s^2L∗H−1 + tLLê2, ...


HH−1 + tL∗H1 − s^2 + t + s∗tLLê4,...

HH1 + sL∗H1 + tL∗H−1 + s + tLLê4, ...


−HH1 + sL∗H−1 + t^2LLê2, ...

HH−1 + sL∗H1 + s − tL∗H1 + tLLê4,...


−HH−1 + s^2L∗H1 + tLLê2, ...

HH−1 + sL∗H−1 + t^2LLê2D;


dns = @−HH−1 + tL∗H2∗s + tLLê4, s∗H−1 + tL, ...
HH−1 + tL∗H−2∗s + tLLê4,...
H1 − t^2Lê2, HH1 + tL∗H2∗s + tLLê4, ...
−Hs∗H1 + tLL, HH2∗s − tL∗H1 + tLLê4, ...
H−1 + t^2Lê2D;
dnt = @HH−1 + sL∗Hs + 2∗tLLê4, H−1 + s^2Lê2, ...

−HH1 + sL∗tL, HH1 + sL∗Hs + 2∗tLLê4, ...


−HH1 + sL∗Hs − 2∗tLLê4,...

H1 − s^2Lê2, ...
HH−1 + sL∗Hs − 2∗tLLê4, H−1 + sL∗tD;
x = n∗xn; y=n∗yn;
dxs=dns∗xn; dxt=dnt∗xn;

map=@map; @s, t, x, y, detJDD;


dys=dns∗yn; dyt=dnt∗yn; J=@dxs, dxt; dys, dytD; detJ = detHJL;

end
end
detJ=@D; x=@D; y=@D;

x = @x, mapHi:i+20,3LD;
for i=1:21:lengthHmapL

y = @y, mapHi:i+20,4LD;
detJ = @detJ, mapHi:i+20,5LD;
end
% Plot quadrilateral from mapped coordinates
% The surface plot shows detJ values
clf
hold on
meshHx,y, zerosHlengthHxLLL;
meshHx,y, detJL
titleH'Jacobian over mapped element'L
xlabelH'x'L; ylabelH'y'L; zlabelH'detJ'L
hold off
4

Jacobian over mapped element


3

2.5

2
y

1.5

0.5
0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8
x

ô Differentiation
ij ÅÅÅÅÅÅÅÅÅÅ y ij ÅÅÅÅ yz ij ÅÅÅÅ yz
jj ∑x zzz jj ∑s zz jj ∑t zz
jj ∑N2 zz jj ∑N2 zz jj ∑N2 zz
∑N1 ∑N1 ∑N1
ÅÅÅÅÅÅ ÅÅÅÅÅ
Bx = jj ÅÅÅÅÅÅÅÅÅÅ zz = ÅÅÅÅ
ÅÅÅÅÅ J j zz - ÅÅÅÅ
ÅÅÅÅÅ J j zz
jj ∑x zz detJ 22 jjj ÅÅÅÅ∑sÅÅÅÅÅÅ zz detJ 21 jjj ÅÅÅÅ∑tÅÅÅÅÅ zz
j z j z j z
1 1

k ª { k ª { k ª {

ÅÅÅÅÅÅ zy
jij ÅÅÅÅ∑y zz
ij ÅÅÅÅ
jj ∑s
yz
zz
ij ÅÅÅÅ
jj ∑t
yz
zz
jj z j zz jj ∑N2 zz
∑N1

j z
∑N1 ∑N1

j
ÅÅÅÅÅÅ ÅÅÅÅÅÅ
B y = jjj ÅÅÅÅÅÅÅÅ2ÅÅ zzz = - ÅÅÅÅ
detJ 12 j
ÅÅÅÅÅ J j ÅÅÅÅÅÅÅÅ2ÅÅ zz + ÅÅÅÅ
ÅÅÅÅÅ J j zz
jj ∑y zz jj ∑s zz detJ 11 jjj ÅÅÅÅ∑tÅÅÅÅÅÅ zz
j z j z j z
∑N 1 ∑N 1

k ª { k ª { k ª {

Consider evaluation of derivatives of the interpolation vector with respect to x and y at s = 1 ê 2 and t = -1 ê 4 for the 8 node
element.

MatlabFiles\Chap01\Quad8Derivatives.m
5

% Evaluation of derivatives of the interpolation vector


% with respect to x and y at s=1ê2 and t=−1ê4

coord = @0.5, 0.5; 1.1, 1.6; 1.7, 2.1; 1.5, 2.5; 1.1, 2.8;
% for the 8 node element.

.75, 2.5; .5,2.5; .25, 1.5D;

n = @HH1 − sL∗H1 − tLLê4 − HH1 − s^2L∗H1 − tLLê4 − ...


s = 1ê2; t=−1ê4;

HH1 − sL∗H1 − t^2LLê4, HH1 − s^2L∗H1 − tLLê2, ...


HH1 + sL∗H1 − tLLê4 − HH1 − s^2L∗H1 − tLLê4 − ...
HH1 + sL∗H1 − t^2LLê4, HH1 + sL∗H1 − t^2LLê2, ...
HH1 + sL∗H1 + tLLê4 − HH1 − s^2L∗H1 + tLLê4 − ...
HH1 + sL∗H1 − t^2LLê4, HH1 − s^2L∗H1 + tLLê2, ...
HH1 − sL∗H1 + tLLê4 − HH1 − s^2L∗H1 + tLLê4 − ...
HH1 − sL∗H1 − t^2LLê4, HH1 − sL∗H1 − t^2LLê2D;
dns=@Hs∗H1 − tLLê2 + H−1 + tLê4 + H1 − t^2Lê4, −Hs∗H1 − tLL, ...
H1 − tLê4 + Hs∗H1 − tLLê2 + H−1 + t^2Lê4, H1 − t^2Lê2, ...
H1 + tLê4 + Hs∗H1 + tLLê2 + H−1 + t^2Lê4, −Hs∗H1 + tLL, ...
H−1 − tLê4 + Hs∗H1 + tLLê2 + H1 − t^2Lê4, H−1 + t^2Lê2D;
dnt=@H−1 + sLê4 + H1 − s^2Lê4 + HH1 − sL∗tLê2, H−1 + s^2Lê2, ...
H−1 − sLê4 + H1 − s^2Lê4 + HH1 + sL∗tLê2, −HH1 + sL∗tL, ...
H1 + sLê4 + H−1 + s^2Lê4 + HH1 + sL∗tLê2, H1 − s^2Lê2, ...
H1 − sLê4 + H−1 + s^2Lê4 + HH1 − sL∗tLê2, −HH1 − sL∗tLD;
x = n∗coordH:,1L; y = n∗coordH:,2L;
dxs = dns∗coordH:,1L; dxt = dnt∗coordH:,1L;

J = @dxs, dxt; dys, dytD; detJ = detHJL;


dys = dns∗coordH:,2L; dyt = dnt∗coordH:,2L;

bx = HJH2, 2L∗dns − JH2, 1L∗dntLêdetJ;


by = H−JH1, 2L∗dns + JH1, 1L∗dntLêdetJ;
b=@bx; byD;
b

>> Quad8Derivatives

b =

Columns 1 through 6

0.2431 -0.1671 0.8863 0.0050 0.1459 -0.8701


0.1593 -1.1440 -0.4538 1.0378 0.0956 0.4644

Columns 7 through 8

0.4035 -0.6466
-0.0805 -0.0788

ô Area integration
Consider evaluation of the following integral over the quadrilateral using 3 µ 3 Gauss quadrature.

I = Ÿ Ÿ Bx BTx dx dy = Ÿ-1 Ÿ-1 Bx BTx detJ ds dt


1 1
6

where Bx is vector of x derivatives of the interpolation functions.

MatlabFiles\Chap01\Quad8AreaIntegration.m

gpLocs = @−sqrtH3ê5L,−sqrtH3ê5L; 0,−sqrtH3ê5L; sqrtH3ê5L,−sqrtH3ê5L;


% Integration over a square using 3x3 Gaussian quadrature

−sqrtH3ê5L,0; 0,0; sqrtH3ê5L,0;

gpWts = @5ê9 ∗ 5ê9, 8ê9 ∗ 5ê9, 5ê9 ∗ 5ê9, ...


−sqrtH3ê5L,sqrtH3ê5L; 0,sqrtH3ê5L; sqrtH3ê5L,sqrtH3ê5LD;

5ê9 ∗ 8ê9, 8ê9 ∗ 8ê9, 5ê9 ∗ 8ê9, ...


5ê9 ∗ 5ê9, 8ê9 ∗ 5ê9, 5ê9 ∗ 5ê9D;
kk=zerosH8L;
for i=1:lengthHgpWtsL

n = @HH1 − sL∗H1 − tLLê4 − HH1 − s^2L∗H1 − tLLê4 − ...


s = gpLocsHi, 1L; t = gpLocsHi, 2L; w = gpWtsHiL;

HH1 − sL∗H1 − t^2LLê4, HH1 − s^2L∗H1 − tLLê2, ...


HH1 + sL∗H1 − tLLê4 − HH1 − s^2L∗H1 − tLLê4 − ...
HH1 + sL∗H1 − t^2LLê4, HH1 + sL∗H1 − t^2LLê2, ...
HH1 + sL∗H1 + tLLê4 − HH1 − s^2L∗H1 + tLLê4 − ...
HH1 + sL∗H1 − t^2LLê4, HH1 − s^2L∗H1 + tLLê2, ...
HH1 − sL∗H1 + tLLê4 − HH1 − s^2L∗H1 + tLLê4 − ...
HH1 − sL∗H1 − t^2LLê4, HH1 − sL∗H1 − t^2LLê2D;
dns=@Hs∗H1 − tLLê2 + H−1 + tLê4 + H1 − t^2Lê4, −Hs∗H1 − tLL, ...
H1 − tLê4 + Hs∗H1 − tLLê2 + H−1 + t^2Lê4, H1 − t^2Lê2, ...
H1 + tLê4 + Hs∗H1 + tLLê2 + H−1 + t^2Lê4, −Hs∗H1 + tLL, ...
H−1 − tLê4 + Hs∗H1 + tLLê2 + H1 − t^2Lê4, H−1 + t^2Lê2D;
dnt=@H−1 + sLê4 + H1 − s^2Lê4 + HH1 − sL∗tLê2, H−1 + s^2Lê2, ...
H−1 − sLê4 + H1 − s^2Lê4 + HH1 + sL∗tLê2, −HH1 + sL∗tL, ...
H1 + sLê4 + H−1 + s^2Lê4 + HH1 + sL∗tLê2, H1 − s^2Lê2, ...
H1 − sLê4 + H−1 + s^2Lê4 + HH1 − sL∗tLê2, −HH1 − sL∗tLD;
x = n∗coordH:,1L; y = n∗coordH:,2L;
dxs = dns∗coordH:,1L; dxt = dnt∗coordH:,1L;

J = @dxs, dxt; dys, dytD; detJ = detHJL;


dys = dns∗coordH:,2L; dyt = dnt∗coordH:,2L;

bx = HJH2, 2L∗dns − JH2, 1L∗dntLêdetJ;


kk = kk + detJ∗w∗ bx'∗bx;
end
kk

>> Quad8AreaIntegration

kk =

Columns 1 through 6

0.1128 -0.0501 0.2559 -0.2070 0.0984 -0.2362


-0.0501 1.7982 -0.7017 0.5320 -0.2178 0.4111
0.2559 -0.7017 1.0736 -0.7571 0.3542 -0.6276
-0.2070 0.5320 -0.7571 1.3044 -0.4007 0.0857
0.0984 -0.2178 0.3542 -0.4007 0.2943 -0.6016
-0.2362 0.4111 -0.6276 0.0857 -0.6016 2.4999
0.2795 -0.4689 0.6061 -0.6751 0.5274 -1.7043
7

-0.2533 -1.3028 -0.2034 0.1178 -0.0542 0.1730

Columns 7 through 8

0.2795 -0.2533
-0.4689 -1.3028
0.6061 -0.2034
-0.6751 0.1178
0.5274 -0.0542
-1.7043 0.1730
1.6564 -0.2213
-0.2213 1.7442

ô Boundary integration
Consider evaluation of the following integral over side 3 of the quadrilateral using 3 point Gauss quadrature.

I = Ÿ Nc NcT dc = Ÿ-1 Nc NcT Jc da


1

side 3

where Nc is vector of the interpolation functions for side 3.

MatlabFiles\Chap01\Quad8LineIntegral.m

% Evaluate line integral along side 3 of the element

gpLocs = @−sqrtH3ê5L, 0, sqrtH3ê5LD;


% Use 3 point integration. Gauss point locations and weights

gpWts = @5ê9, 8ê9, 5ê9D;


ka=zerosH8L;
for i=1:lengthHgpWtsL

n = @0, 0, 0, 0, H1 − aLê2 + H−1 + a^2Lê2, ...


a = gpLocsHiL; w = gpWtsHiL;

1 − a^2,H1 + aLê2 + H−1 + a^2Lê2, 0D;


dna = @0, 0, 0, 0, −1ê2 + a, −2∗a, 1ê2 + a, 0D;
dxa = dna∗coordH:,1L; dya = dna∗coordH:,2L;
Jc=sqrtHdxa^2 + dya^2L;
ka = ka + Jc∗w∗n'∗n;
end
ka

>> Quad8LineIntegral

ka =

Columns 1 through 6

0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0.1420 0.0775
8

0 0 0 0 0.0775 0.3670
0 0 0 0 -0.0258 0.0258
0 0 0 0 0 0

Columns 7 through 8

0 0
0 0
0 0
0 0
-0.0258 0
0.0258 0
0.0645 0
0 0

You might also like