FEM: notes - University Corporation for Atmospheric … Scientist: Amik St-Cyr... · Homework: n...

8
FEM: notes HOMs Class Amik St-Cyr

Transcript of FEM: notes - University Corporation for Atmospheric … Scientist: Amik St-Cyr... · Homework: n...

Page 1: FEM: notes - University Corporation for Atmospheric … Scientist: Amik St-Cyr... · Homework: n Goto n Download homework for HOMs class (day 1). n Construct and compare Q1 and Q2

FEM: notesHOMs ClassAmik St-Cyr

Page 2: FEM: notes - University Corporation for Atmospheric … Scientist: Amik St-Cyr... · Homework: n Goto n Download homework for HOMs class (day 1). n Construct and compare Q1 and Q2

Ritz linear functions:

1 2 3 4

K1 K2 K3

!1

K1 K2 K3

!2

1 2 3 4

K1 K2 K3

!3

1 2 3 4

K1 K2 K3

!4

1 2 3 4

Page 3: FEM: notes - University Corporation for Atmospheric … Scientist: Amik St-Cyr... · Homework: n Goto n Download homework for HOMs class (day 1). n Construct and compare Q1 and Q2

On a single element:

1!1

1

!

"̂1(!) "̂2(!)

nKc = nK

d = 2

!1 = !1 !2 = 1 "̂j(!)

"̂1(!) =(! ! 1)

(!1! 1)=

(1! !)2

"̂2(!) =(! ! (!1))(1! (!1))

=(! + 1)

2

d"̂1(!)d!

= !12

d"̂2(!)d!

= +12

d"K1 (x)dx

= ! 1hK

d"K2 (x)dx

= +1

hK

K̂ K

nKc = nK

d = 3! = 0

Page 4: FEM: notes - University Corporation for Atmospheric … Scientist: Amik St-Cyr... · Homework: n Goto n Download homework for HOMs class (day 1). n Construct and compare Q1 and Q2

Ritz quadratic functions:

1 2 3 4 5 6 7K1 K2 K3

!1

1 2 3 4 5 6 7K1 K2 K3

!2

1 2 3 4 5 6 7K1 K2 K3

!3

1 2 3 4 5 6 7K1 K2 K3

!4

1 2 3 4 5 6 7K1 K2 K3

!5

1 2 3 4 5 6 7K1 K2 K3

!6

1 2 3 4 5 6 7K1 K2 K3

!7

1 2 3 4 5 6 7K1 K2 K3

!1

1 2 3 4 5 6 7K1 K2 K3

!2

1 2 3 4 5 6 7K1 K2 K3

!3

1 2 3 4 5 6 7K1 K2 K3

!4

1 2 3 4 5 6 7K1 K2 K3

!5

1 2 3 4 5 6 7K1 K2 K3

!6

1 2 3 4 5 6 7K1 K2 K3

!7

Page 5: FEM: notes - University Corporation for Atmospheric … Scientist: Amik St-Cyr... · Homework: n Goto n Download homework for HOMs class (day 1). n Construct and compare Q1 and Q2

On a single element:

1!1

1

!

"̂1(!)"̂2(!)"̂3(!)

Kd"K

1 (x)dx

=(2! ! 1)

hK

d"K2 (x)dx

=(2! + 1)

hK

d"K3 (x)dx

=!4!

hK

m m + 1nK

c = m + 1"̂i(!) m

"̂j(!i) = #ji

Page 6: FEM: notes - University Corporation for Atmospheric … Scientist: Amik St-Cyr... · Homework: n Goto n Download homework for HOMs class (day 1). n Construct and compare Q1 and Q2

Matlab example:% Elemental Mass matrix 1D

Mhat1D = [2/3 1/3;1/3 2/3];

% Elemental Stiffness matrix 1D

Khat1D = [1/2 -1/2;-1/2 1/2];

M = zeros(n,n);K = zeros(n,n);

% Assembly

for i=1:n-1 h = x(i+1) -x(i); M(i:i+1,i:i+1) = M(i:i+1,i:i+1) + 0.5*h*Mhat1D(:,:); K(i:i+1,i:i+1) = K(i:i+1,i:i+1) + (2/h)*Khat1D(:,:);end

Page 7: FEM: notes - University Corporation for Atmospheric … Scientist: Amik St-Cyr... · Homework: n Goto n Download homework for HOMs class (day 1). n Construct and compare Q1 and Q2

Matlab example:%% Solve the problem % % u - delta u = f%% Dirichlet u(-1)=u(1)=1%

f = 1 + 2*sin(x);f = Operators.M1DQ1*f';

A = Operators.M1DQ1 + Operators.K1DQ1;

% Impose boundary % conditions:

u = zeros(N,1);u(1) = 1;u(N) = 1;f = f-A*u;

% Solve for interior homogeneous block:u(2:N-1,1) = A(2:N-1,2:N-1)\f(2:N-1);

% Plot and compute errorplot(x,u)norm(u - 1 - sin(x'))

Page 8: FEM: notes - University Corporation for Atmospheric … Scientist: Amik St-Cyr... · Homework: n Goto n Download homework for HOMs class (day 1). n Construct and compare Q1 and Q2

Homework:

n Goto www.image.ucar.edu/staff/amik

n Download homework for HOMs class (day 1).

n Construct and compare Q1 and Q2 FEM.