Professional Documents
Culture Documents
weighted residual formulation partial dierential equation Dirichlet boundary condition Neumann boundary condition Robin boundary condition
in on 0 on 1 on 2
n u = g1 n u + u = g 2
1. Multiply the residual of the PDE by a weighting function w vanishing on the Dirichlet boundary 0 and set the integral over equal to zero 2. Integrate by parts using the Neumann and Robin boundary conditions 3. Represent the approximate solution uh u as a linear combination of polynomial basis functions i dened on a given mesh (triangulation) 4. Substitute the functions uh and i for u and w in the weak formulation 5. Solve the resulting algebraic system for the vector of nodal values ui
i = 1, 2 i, j = 1, 2 x e
1 (x) + 2 (x) = 1, =
1 x2 x1
2 d dx
constant derivatives 2 |e = 2 x e
Basis functions
1 |e = 1 ,
1 1 = {2 , 2}
midpoint
Basis functions
1 , 2 , 12 P2 (e)
1 (x) = 1 (x)(21 (x) 1) 2 (x) = 2 (x)(22 (x) 1) 12 (x) = 41 (x)2 (x) Shape function uh |e uh (x) = u1 1 (x) + u2 2 (x) + u12 12 (x)
1 , 2 , 12 , 21 P3 (e)
2 (x) = 1 2 2 (x)(32 (x) 2)(32 (x) 1) 12 (x) = 9 2 1 (x)2 (x)(31 (x) 1) 21 (x) = 9 2 1 (x)2 (x)(32 (x) 1) Shape function
i1 i2 i3
Polynomial tting: i (x) = ci1 + ci2 x + ci3 y ( x ) = c + c x + c y = i 1 i 1 i 2 1 i 3 1 i 1 c 1 x y i1 1 1 1 x2 y2 ci2 = i (x2 ) = ci1 + ci2 x2 + ci3 y2 = i2 ci3 1 x3 y3 i (x3 ) = ci1 + ci2 x3 + ci3 y3 = i3
A
We have 3 systems of 3 equations for 9 unknowns. They can be solved for the unknown coecients cij by resorting to Cramers rule. det A = x2 y3 + x1 y2 + x3 y1 x2 y1 x3 y2 x1 y3 Area of the triangle |e| = 1 2 | det A| (also needed for quadrature rules)
i = 1, 2, 3
3
ei
1 2 | det Ai (x)|
1 x1 y1 A3 = 1 x2 y2 1 x y =
det Ai (x) det A
|ei (x)| |e |
i = 1, 2, 3
It is obvious that the barycentric coordinates satisfy |e1 (x)| + |e2 (x)| + |e3 (x)| = |e|, x e
x2 = {0, 1, 0},
x3 = {0, 0, 1}
1 1 x23 = {0, 2 , 2}
1 x13 = { 1 , 0 , 2 2 },
uh (x) = c1 + c2 x + c3 y + c4 x2 + c5 xy + c6 y 2 P2 (e)
+ basis (7 nodes) Extended P2
3 = 3 (23 1),
2 = 2 (22 1),
123 = 271 2 3 ,
ij = 4i j 121 2 3
i = i (2i 1) + 31 2 3 i, j = 1, 2, 3
Polynomial tting: 1 1 1 1 x1 x2 x3 x4 y1 y2 y3 y4
e=
i=1
ei
i = 1, . . . , 4
134 = 1 32 ,
123 = 1 34 ,
234 = 1 31
124 = 1 33
xijk =
Linear mapping in Rn
Fe : e e
Fe :
e = Fe ( e)
x = Fe ( x) =
i=1
xi i ( x),
x e
where i are the barycentric coordinates. This mapping is of the form + be , Fe ( x) = Be x Be Rnn , be Rn
x2 x1 x3 x1 y2 y1 y3 y1
n=3
x2 x1 x3 x1 x4 x1 Be = y2 y1 y3 y1 y4 y1 , z2 z1 z3 z1 z4 z1
+ be Fe ( x) = Be x xi = Fe ( xi )
= Fe ( xij )
= Fe
i + x xj + xk 3
= Fe ( xijk )
x e
i (x) = i ( x),
x = Fe ( x)
Note that i (xj ) = i ( xj ) = ij and the degree of basis functions (linear, quadratic, cubic etc.) is preserved since x depends linearly on x
= =
1 det J 1 det J
i y x y i x y x
i y y x i x x y
J =
x x x y
y x y y
Isoparametric mappings: it is possible to dene curved elements e using a mapping Fe of the same degree as the basis functions on the reference element e
+ Example. Extended quadratic element P2
e = Fe ( e) x = Fe ( x) =
i xi , x
i=1 3 P
ij xij , x P
ij
123 x123 x
xi i ( x) +
1 ( x) = 1 ( x)1 ( y ), 2 ( x) = 2 ( x)1 ( y ),
3 ( x) = 2 ( x)2 ( y) 4 ( x) = 1 ( x)2 ( y)
The space Q1 ( e) spanned by i consists of functions which are P1 for each variable In general
kn 1 k2 Qk ( e) = span{xk 1 x2 . . . xn }, 4
0 ki k,
i = 1, . . . , n
Isoparametric mapping
x = Fe ( x) =
i=1
xi i ( x),
The physical element e = Fe ( e) is a quadrilateral with straight sides which must be convex for Fe to be invertible. It is easy to verify that Fe ( xi ) = xi , i = 1, . . . , 4
uh (x) = c1 + c2 x + c3 y + c4 ( x y ) x = Fe ( x) =
i=1
i xi
bilinear mapping
1 |Si | Si
Degrees of freedom: ui =
uh (x(s)) ds uh (xi )
4
uh (x) =
j =1
uj j ( x) =
j =1
j ( cj x), x e
j
= [ 1 , 2 , 3 , 4 ]T , = [1, x , y , x 2 y 2 ]T , T c = T A1 u = T u
ui = aij =
aij cj
Si
1 |Si |
j ( x)ds
T A1 T =
1 ( x) =
1 ( x) =
3 1 +3 1 2 ( x2 y 2 ) 3 ( x) = 4 2x 2y
3 1 2 ( x) = 4 1 + 3 + 2 ( x2 y 2 ) 2x 2y 3 4 5 2 x + 3 + 3 x2 y 2 ) 2y 2 (
1 2 ( x) = 4 +y + ( x2 y 2 )
+x 2 y ( x2 y 2 )
4 ( x) =
4 ( x) =
1 +x ( x2 y 2 ) 3 ( x) = 4 3 4
2 x+y + ( x2 y 2 )
Nonparametric version: construct the basis functions directly using a local coordinate system rather than the transformation to a reference element
Products of 1D quadratic basis functions spanning the space Q2 ( e) 4 ( x) = 1 ( x)2 ( y ), 5 ( x) = 3 ( x)1 ( y ), 6 ( x) = 2 ( x)3 ( y ), 7 ( x) = 3 ( x)2 ( y) 8 ( x) = 1 ( x)3 ( y) 9 ( x) = 3 ( x)3 ( y) x e
x = Fe ( x) =
i=1
xi i ( x)
e = Fe ( e) is curved
Products of 1D linear basis functions spanning the space Q1 ( e) 1 ( x) = 1 ( x)1 ( y )1 ( z ), 2 ( x) = 2 ( x)1 ( y )1 ( z ), 3 ( x) = 2 ( x)2 ( y )1 ( z ), 4 ( x) = 1 ( x)2 ( y )1 ( z ), Basis functions on the physical element
x e
Isoparametric mapping
8
x = Fe ( x) =
i=1
xi i ( x)
Galerkin discretization: u0 = 0,
uh =
j =1 1
u j j
uj
j =1 0
di dj dx = dx dx
f i dx,
0
i = 1, . . . , N ek = [xk1 , xk ]
Au = F,
j =1
uj
k=1 ek
di dj dx = dx dx
aij
f i dx,
k=1 ek Fi
i = 1, . . . , N
aij =
k=1 N
ak ij =
1 di dj 0 dx dx 1 0
dx
Fi =
k=1
Fik =
f i dx
Element stiness matrix and load vector ek = [xk1 , xk ] dk1 dk1 dk1 dk dx dx dx dx dx dx ek ek k a = , fk = dk dk dk dk1 dx dx dx ek dx dx ek dx Coecients of the global system Au = F ak1 k1 ak1 k A= ak k1 ak k
ek
f k1 dx f k dx
ek
f 1
1 = x
kxx x ,
xxk1 xk xk1
x(k1)x , x
1 x 1 x
x ek = [xk1 , xk ]
Hence,
ak =
1 1 1 1
fk =
x 2
1 1
Implementation of Dirichlet boundary conditions 1. Row/column elimination: u0 = g0 whereas the second one turns into the rst equation is superuous a11 u1 + a12 u2 + a13 u3 = F1 a10 g0 F0 := g0
3. Penalty method / addition of a large number to the diagonal a00 := a00 + , F0 := F0 + g0 symmetry is preserved
= g1
FN =
eN
f N dx + g1
Galerkin FEM:
j =1/2
uj
k=1
ek
di dj dx dx
dx =
k=1
ek
f i dx,
i = 1, . . . , N
ek = [xk1 , xk ],
x = {1 (x), 2 (x)}
dk1 41 1 = dx x dk1/2 2 1 = 4 dx x dk 1 2 dx = 4 x
k1 = 1 (21 1),
ak =
2 R
3 dk1 dk dx dx dx ek 7 R dk1/2 dk dx 7 dx dx 5 ek R dk dk dx ek dx dx R
1 3x
3 7 8 1 4 8 16 8 5 1 8 7
f dx k 1 ek k f = ek f k1/2 dx = f k dx ek
x 6
1 4 1
f (x) dx =
e
( f x)| det J | dx i i = J 1
x e
i = J i
For instance, the entries of the element stiness matrix are given by aij =
e
i j d x =
j )| det J | dx i ) (J 1 (J 1
n
Numerical integration
e
g ( x) dx
w i g ( xi ),
i=0
( g ( x) = f x)| det J |
x 1 =
1 2
1 6
3,
x 2 =
1 2
1 6
3,
e = [0, 1]
(inconvenient access)
nonzero elements in arbitrary order auxiliary array of row numbers auxiliary array of column numbers
2. Compact storage
A(NNZ) ILD(N+1) ICOL(NNZ)
(convenient access)
nonzero elements stored row-by-row pointers to the beginning of each row auxiliary array of column numbers
Example
1 2 A= 0 7
2 4 3 0
0 3 6 5
7 0 5 8
A = (1, 2, 7, 4, 2, 3, 6, 3, 5, 8, 7, 5) ICOL = (1, 2, 4, 2, 1, 3, 3, 2, 4, 4, 1, 3) IROW = (1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4) NNZ = 12, ILD = (1, 4, 7, 10, 13)