Uploaded by Luke

2.3 Intro to FEM - Nodal Functions

advertisement
DD2370 Computational
Methods for Electromagnetics
FEM Nodal Functions
Stefano Markidis
Finite Element Method – Introduce Elements
• In order to improve the accuracy and also to be able to treat
longer intervals [a, b], we follow the steps bellow:
• Subdivide [a = x0, b = xn] into n subintervals, the elements, that
join at the nodes x1, x2,..., xn−1
• Select Nodal Basis (typical simple function)
• Apply the Galerkin method
• We get one equation per node
• we end up with a system of equations involving all the nodal
values.
• The equations adjusted to take into account the boundary
conditions, intermediate values can be taken by interpolation.
Nomenclature: Nodes and Edges
Nodes
element
Edges (oriented)
element
Example
–
Helmholtz
Equation
with
Finite
Element
e first model problem we choose a second-order ordinary differential e
ly the 1D Helmholtz equation:
!
"
df
d
˛
C ˇf D s;
!
dx
dx
a < x < b;
f .a/ D fa ;
f .b/ D fb :
f D f .x/ is the sought solution,
andthethe
material properties ˛ D ˛
Example from
textbook
ˇ.x/ and the source s D s.x/ are prescribed functions of x.
• We seek the function f(x) on the interval
a < x < b.
• We first divide this interval into elements.
• Let us assume 7 equally large elements.
• We call the endpoints of each element
(size=1) nodes, and they have the
coordinates xi = i-3.
Fig. 6.2 1D linear elements.
In particular, the basis
function '4 .x/ is emphasized
by a thick line
3
2
Basis functions [−]
1D Elements
We seek the function f .x/ on the interval a < x < b. According to the general
recipe for the FEM, we first divide this interval into subintervals (elements). Let
us assume, for example, a D !2 and b D 5 and divide the x-axis into 7 equally
large elements. We call the endpoints of each element nodes, and they have the
coordinates xi D i !3 where i D 1; 2; : : : ; 8. We introduce the nodal basis functions
'i .x/, which are linear on each interval, one at node i and zero at all other nodes,
as shown in Fig. 6.2. These basis functions are often called “tent functions.”
ϕ4
1
0
−1
−2
−2
−1
0
1
2
x [m]
3
4
5
We seek the function f .x/ on the interval a < x < b. According to the general
recipe for the FEM, we first divide this interval into subintervals (elements). Let
us assume, for example, a D !2 and b D 5 and divide the x-axis into 7 equally
large elements. We call the endpoints of each element nodes, and they have the
coordinates xi D i !3 where i D 1; 2; : : : ; 8. We introduce the nodal basis functions
'i .x/, which are linear on each interval, one at node i and zero at all other nodes,
as shown in Fig. 6.2. These basis functionsHere
are often
functions.”
we called
use ϕ“tent
instead
of v
Nodal Basis Functions
• Use a low-degree polynomial even
a 1st degree can do the work
• We introduce the nodal basis
functions which are linear on each
interval, one at node i and zero at
Fig. 6.2 1D linear elements.
all other nodes. These basis
In particular, the basis
' .x/ is emphasized
functions are often calledfunction
“tent
by a thick line
functions”
4
2
Basis functions [−]
• higher order polynomials are better
but too complicated to be
implemented
3
ϕ4 indexing starts from 1
1
0
−1
−2
−2
−1
0
1
2
x [m]
3
4
5
96
6 The Finite Element Method
6.2 1D Finite Element Analysis
Expansion of f(x) with nodal
basis
functions
97
1D Finite Element Analysis
97
As the first model problem we choose a second-order ordinary differential equation,
namely the 1D Helmholtz equation:
!
d
dx
!
"
df
˛
C ˇf D s;
dx
(6.1)
a < x < b;
(6.2)
f .a/ D fa ;
We seekWe
approximate
solutions
that arethat
expanded
in the basis
seek approximate
solutions
are expanded
in thefunctions
basis (in the
atowing,
are expanded
in the
the
basis
functions
(in thethis approximate solution):
f will denote
this
approximate
functions
(in
following,
f willsolution):
denote
mate solution):
D
(6.3)
f .b/ D fb :
8
X
j D1
fj 'j .x/:
f .x/ D
8
X
Here f D f .x/ is the sought solution, and the material properties ˛ D ˛.x/ and
ˇ D ˇ.x/ and the source s D s.x/ are prescribed functions of x.
There are many physical systems that are modeled by (6.1), for example, a
transversal wave in a 1D medium, such as a light wave propagating and being
reflected in dielectric layers. In this case we have f .x/ D Ez .x/, and the
coefficients are ˛.x/ D 1=!.x/, ˇ.x/ D j!".x/ ! ! 2 #.x/, where ! is the angular
frequency, and s.x/ D !j!Jz .x/ (which vanishes, unless there are current-carrying
conductors).
We seek the function f .x/ on the interval a < x < b. According to the general
recipe for the FEM, we first divide this interval into subintervals (elements). Let
us assume, for example, a D !2 and b D 5 and divide the x-axis into 7 equally
large elements. We call the endpoints of each element nodes, and they have the
coordinates xi D i !3 where i D 1; 2; : : : ; 8. We introduce the nodal basis functions
'i .x/, which are linear on each interval, one at node i and zero at all other nodes,
as shown in Fig. 6.2. These basis functions are often called “tent functions.”
fj 'j .x/:
(6.4)
j D1
One equation for each each
node.
(6.4)
Number of nodes = number of
elements + 1
e that f .xi / D fi , so that the expansion coefficients are the values of f at the
es. Since
f .a/ D fa are
andthe
f .b/
D fb of
arefknown,
ansion
coefficients
values
at the we set f1 D fa and f8 D fb .
Becausestep,
of boundary
method
fnb the
are next
known,
wewe
setfollow
f1 D Galerkin’s
fa and f8 D
fb . and choose the test functions
x/
D method
'i .x/, where
i D 2; 3;
: ; 7 (the
endpoints are excluded because the
kin’s
and choose
the: : test
functions
responding
function are
values
are known).
We the
multiply the residual of (6.1) by
; 7 (the endpoints
excluded
because
test function w .x/ and integrate from x D a to x D b. To move one of the
3
Basis functions [−]
2
ϕ4
1
0
−1
Fig. 6.2 1D linear elements.
In particular, the basis
function '4 .x/ is emphasized
by a thick line
−2
−2
−1
0
1
2
x [m]
3
4
5
nce f .a/ D fa and f .b/ D fb are known, we set f1 D fa and f8 D f
We apply
Galerkin
next step, we follow
Galerkin’s
methodMethod
and choose the test funct
'i .x/,
where
i
D
2;
3;
:
:
:
;
7
(the
endpoints
are
excluded
because
• We follow Galerkin’s method and choose the test functions wi = Phii where
i= 2,3,… ,7 (the
endpoints
excludedWe
because
the corresponding
function
nding function
values
are are
known).
multiply
the residual
of (6.1
values are known).
unction
w
.x/
and
integrate
from
x
D
a
to
x
D
b.
To
move
one
of
i
• We multiply the residual by the test function wi and integrate x from a a to
es fromb.f to the test function wi , we use integration by parts. This g
• To move one of the derivatives from f to the test function wi , we use integration by
form of the
original problem, which is the weighted average of the resid
parts
Z
b
a
!
"
˛w0i f 0 C ˇwi f ! wi s dx D 0:
Weak formulation
In this case, the boundary term vanishes since since wi(a) = wi(b) = 0
0 b
!a
(
se, the boundary term Œwi ˛f vanishes, since wi .a/ D wi .b/ D 0.
bstituting (6.4) into the weak form (6.5) and choosing w2 .x/ D '2
By substituting (6.4) into the weak form (6.5) and choosing w2 .x/ D
Z
D fa and
set f1 D fa and f8weDgenerate
fb . an equation involving six unknowns: the coefficients fj for the
b ! f .b/ D fb are known, we
"
Z
p, we follow
method
choose
the test functions
nodes xj", where
j D 2; 3; : : : ; 7. Next, we pick w3 .x/ D '3 .x/ to generate a
! dx
˛w0i Galerkin’s
f 0 C ˇwi f
! wbi sand
(6.5)
0 D
0 0:
and
on. In
the end, we have six equations
and six unknowns, an
˛wand
C
ˇwi fbecause
!equation,
wi=sthe
dxsowe
D
0:generate
(6.5)
where a•i By
D 2;
3; : :the
: ; 7 (the
endpoints
are
i f excluded
into
weak
form
choosing
w
Phi
an
equation
i
formulated
as ia system of linear equations Az D b with
a
nction values
are known).
We multiply the
the residual
of (6.1) fbyfor the interior nodes x ,
involving
six
unknowns:
coefficients
j
j$
Z b#
0 b x D a to x D b. To move one of the
wundary
integrate
from
i .x/ and
˛f
!
vanishes,
since
w
.a/
D
w
.b/
D
0.
term
Œw
i j =2,3,…,7.
i
i
a
˛'i0 'j0 C ˇ'i 'j dx;
Aij D
where
b
0
f (6.4)
toIn
thethis
testcase,
function
, we use
integration
by !parts.
gives
since wi .a/ D wa i .b/ D 0.
the wboundary
term
i form
i ˛f
into
the weak
(6.5)
andŒwchoosing
wThis
a vanishes,
2 .x/ D '2 .x/,
zj D fj ;
he original
which(6.4)
is the weighted
the residual:
By problem,
substituting
into theaverage
weak of
form
(6.5) and choosing
w .x/ D ' .x/,
uation involving six unknowns: the coefficients fj for the interior
2
Z b2
Z 3;bgenerate
we
an equation
involving
unknowns:
coefficients
the interior
bi D fj 'for
D 2;
we pick "w
to generatethe
a second
i s dx:
3 .x/ D 'six
3 .x/
!: : : ;0 7.0 Next,
a
˛w
f
C
ˇw
f
!
w
s
dx
D
0:
(6.5)
i
i
n. Innodes
the end,
havejsix
and
six unknowns,
xji ,we
where
D equations
2; 3; : : : ; 7.
Next,
we pick w3and
.x/this
D 'is3 .x/ to generate a second
a
Here, i D 2; 3; : : : ; 7 (for the equations) and j D 1; 2; : : : ; 8 (for the coeffi
stemequation,
of linearand
equations
D bend,
withwe have six equations
so on. Az
In the
and six
and
so A has 8 columns
and 6unknowns,
rows, z has 8 rows,
and this
b has 6isrows. The coeffic
f8 are known from the boundary conditions and can be moved to the rig
0ab system of linear equations Azand
formulated
as
D
b with
˛f
!
vanishes,
since
w
.a/
D
w
.b/
D
0.
oundary
term Œw
From boundary
i
i
i
Z b# a
side:
$
g (6.4) into the weak form
0 0 (6.5) and choosing w2 .x/ D '2 .x/,0 A A : : : A 1 2 f 3 2 b 3 2 A f C A f 3
22
23
27
2
2
21 1
28 8
(6.6)
Aij D six ˛'
i'
j Zdx;
i 'j C ˇ'
$
b # fj for the interiorB
uation involving
unknowns:
the
coefficients
6 f3 7 6 b3 7 6 A31 f1 C A38 f8 7
A32 A33 : : : A37 C
a
C
7
B
6 7 6 7 6
0
0
D
!
C
7
7
7:
B
6
6
6
:
:
:
:
:
:
: : : A 4 : 5 4 : 5 (6.6)
D 2; 3; : : : ; 7. Next, we pick w3A
.x/
generate
a
second
dx;
D'3 .x/ to˛'
'
C
ˇ'
'
:
:
:
5
@
4
ij D
i
j
: :
i j
: :
:
:
:
D we
fj ;have six equations and six
a unknowns, and this is A(6.7)
n. In thezjend,
f7
b7
A71 f1 C A78 f8
72 A73 : : : A77
stem of linear Zequations
Az D b with
b
z Df ;
(6.7)
bi DZ
Aij D
b
a
a
'i s dx:
j
Z b
#
$
˛'i0 'j0 C ˇ'i 'j dx;
bi D
The part of the system matrix A that remains on the left-hand side is squ
is, we have as(6.8)
many unknowns as equations. In the present case, the
j
'i s dx:
(6.6)
; 7 (for the equations) and j D 1; 2; a: : : ; 8 (for the coefficients),
(6.8)
Next Lecture - Example 2D Poisson Eq. with FEM
• We will used the same technology for solving 2D Poisson Problem
• Use simple linear approximation within the element
• Derive the matrix coefficients of Matrix A
• Solve numerically the linear system
Download