









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










Implementation:
we construct element contributions
to the stiffness matrix
A
k
=
{
a
(k
) ij
}
,^
a
(k
) ij
=
∫
4
k
∇
ψ
k,i
· ∇
ψ
k,j
ie. a
(k
) ij
=
∫
4
k
∂ψ
k,i ∂x
∂ψ
k,j ∂x
∂ψ
k,i ∂y
∂ψ
k,j ∂y
d
x
d
y,
i, j
= 1
,^
2
,^
3
and the element load vector f
k
=
{
f
( k
) i^
}
, f
(
k
) i^
=
∫
4
k
f ψ
k,i
∫
∂
Ω
N
∩
∂
4
k
g
N
ψ
k,i
, i
= 1
,^
2
,^
3
Note: we ignore any Dirichlet boundary conditions at thisstage
FEM – p.2/
For the integral over the element we need a (triangle)quadrature such as
∫
4
∗
r
(
ξ, η
)d
ξ
d
η
≈
L ∑ `
=
w
`
r
(
ξ
`
, η
`
) =
1 2
r
(
/
3
,^
1
/
so that we may approximate
∫
4
k
f
(
x, y
)
ψ
k,i
(
x, y
)d
x
d
y
=
∫
4
∗
f
3 ∑ j
=
x
j
χ
j
(
ξ, η
)
,
3 ∑ j=
y
j
χ
j
(
ξ, η
)
χ
(i
ξ, η
)
|J
k
|d
ξ
d
η
by simply evaluating the integrand on the right hand side(|
J
k
|^
is the Jacobian of the transformation
(
x, y
)
→
(
ξ, η
)
as before)
Then we
assemble
the global stiffness matrix and load
vector by collecting all of the contributions to the stiffnessmatrix
Aloc
(
k
,^
i
,^
j
)
,^
i
,^
j
=
1
,^
2
,^
3
,^
k
=
1
,^
2
,...
K
and load vector
floc
(
k
,^
i
)
,^
i
=
1
,^
2
,^
3
,^
k
=
1
,^
2
,...
K
from all of the elements
4
k
, k
= 1
,^
2
,... , K
:
12
11
8
2
3
7
10
9
4
6
1
5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
1
2
3
4
5
6
7
8
9
10
11
12
13
14
9
12
9
6
10
11
4
4
6
5
5
2
1
8
10
10
6
7
7
7
6
3
3
7
3
3
3
7
12
11
10
10
11
8
9
6
7
3
2
1
4
5
︸
︷︷
︸
=
P
T
FEM – p.8/
That is the index
m
=
P
(
k
,^
i
)
specifies the global node
number of local node
i
in element
k
Assembly just then relies on indirect addressing:
for k
=
1
→
14
for j
=
1
→
3
for i
=
1
→
3
A
(
P
(
k
,^
i
)
,^
P
(
k
,^
j
)) =
A
(
P
(
k
,^
i
)
,^
P
(
k
,^
j
)) +
Aloc
(
k
,^
i
,^
j
)
end loop if
(
P
(
k
,^
j
)) =
f
(
P
(
k
,^
j
)) +
floc
(
k
,^
j
)
end loop j end loop k
starting with a zero matrix
A
and zero vector
f
FEM – p.9/
This just represents the reversal of the localisation toelements:
If we write
Au
=
[
A
B
T
B
C
] [
u w
]
=
[
b c
]
=
f
with
A
∈
R
n
×
n
being the desired Galerkin coefficient
matrix,
u = (u
1
,... ,
u
n
)
T
being the vector of unknown
coefficients and
w = (u
n
,... ,
u
n
n
∂^
)
T
being the vector
of coefficients known from the Dirichlet boundary conditionsin the Galerkin solution
u
h
=
n ∑ j
=
u
j
φ
j
n
n
∂
∑ j
=
n
u
j
φ
j
∈ H
1 E
then
A
u = b
−
B
T
w
That is the term
−
B
T
w
is exactly the final term in
fi
=
∫
Ω
φ
i
f
∫
∂
Ω
N
φ
i
g
N
−
n
n
∂
∑ j
=
n
u
j
∫
Ω
∇
φ
j
· ∇
φ
i
This is in fact usually achieved by overwriting the unwantedequations by
u
n
i^
=
known boundary value at node
n
i
= d
i
,
say,
d
∈
R
n
∂^
and changing the right hand side terms of the
wanted equations as indicated above giving
[
A
0
0
I
] [
u w
]
=
[
b
−
B
T
w
d
]
=
[
b
−
B
T
d
d
]
Note: It is not necessary to have listed the Dirichletboundary nodes last as we have done.