Stephen C. Jardin Princeton Plasma Physics...
Embed Size (px)
Transcript of Stephen C. Jardin Princeton Plasma Physics...
-
MHD Simulations for Fusion Applications
Lecture 3
The Galerkin Finite Element MethodStephen C. Jardin
Princeton Plasma Physics Laboratory
CEMRACS 10
Marseille, France
July 21, 2010
1
-
Outline of Remainder of Lectures
Galerkin method C1 finite elements Examples Split implicit time
differencing
Today Tomorrow Split implicit time
differencing for MHD Accuracy, spectral
pollution, and representation of the vector fields
Projections of the split implicit equations
Energy conserving subsets 3D solver strategy Examples
-
Weak Form of a Differential EquationConsider the ordinary differential equation on the domain [a,b]:
( ) ( ) ( ) ( ) (1)d dp x q x U x f xdx dx
+ =
We choose a function space H1, and multiply (1) by an arbitrary member of that function space, and integrate over the domain:
( ) ( ) ( ) ( ) ( ) ( ) (2 )b b
a a
d dV x p x q x U x dx V x f x adx dx
+ =
( ) ( ) ( ) ( ) (2 )b b
a a
dV dUp x q x VU dx V x f x bdx dx
+ =
Or, after integrating by parts (assuming the boundary term vanishes):
If we require that Eq. (2) hold for every function V(x) in the function space H1, it is called the weak form of Eq. (1). Note that only first derivatives occur in (2b), whereas 2nd derivatives occur in (1)
-
Galerkin Finite Element MethodThe Galerkin finite element method is a discretization of the weak form of the equation. To apply, we chose a finite dimensional subspace S of the infinite dimensional Hilbert space H1, and require that Eq. (2) hold for every function in S.
1( ) ( ) ( ) ( ) 1,
b bNji
j i j ij a a
dda p x q x dx x f x i Ndx dx
=
+ = =
1( ) ( )
N
j jj
U x a x=
=
( ) ( )
( ) ( )
bji
ij i ja
b
i ia
ij j iM a
ddM p x q x dxdx dx
b x f x
b
dx
= +
=
=
known basis functions that span Saj are amplitudes to be solved for
Letting Equation (2b) becomes
Or,
In the finite element method, the basis functions are low order polynomials
( ) ( )iV x x=
-
Simple Example: Linear Elements in 1D
1
( ) ( )N
j jj
U x a x=
=
( )i x 1( )i x +1( )i x
xixi-1 xi+10 L
1
0 0, (constants) ( )p p q q f f x= = =
, ati i j jx x = =
linear: xi = ih
h=L/N
0 , 0
2 1 0 01 2 1 01
0 1 2 10 0 1 2
i j i jp dx K p h
= =
i 0 , 0
4 1 0 01 4 1 00 1 4 160 0 1 4
i j i jhq v v dx A q
= =
mass matrixstiffness matrix
Leads to sparse, diagonally dominant matrices: Mi,j = Ki,j + Ai,j
i ib fdx=
ij j iM a b=
1( ) ( ) ( ) ( ) 1,
b bNji
j i j ij a a
dda p x q x dx x f x i Ndx dx
=
+ = =
Linear elements only overlap with their nearest neighbors
-
Note: We were able to solve a 2nd order ODE with linear elements!
1( ) ( )
N
j jj
U x a x=
=
( )i x 1( )i x +1( )i x
xixi-1 xi+10 L
1
1( ) ( ) ( ) ( ) 1,
b bNji
j i j ij a a
dda p x q x dx x f x i Ndx dx
=
+ = =
( ) ( ) ( ) ( )d dp x q x U x f xdx dx
+ = ( )
b
ia
dx x
ij j iM a b=
-
Extension to Higher Order EquationsSuppose we have a 4th order equation:
4
4 ( ) ( )d U x f xdx
=
Form the weak form: 44
3
3
2 2
2 2
( ) ( ) ( ) ( )
( ) ( )
( ) ( )
b b
i ia a
b bi
ia a
b bi
ia a
dx U x dx x f x dxdx
d d U dx x f x dxdx dx
d d U dx x f x dxdx dx
=
=
=
(assumes the boundary terms vanish)
Application of the Galerkin method to a 4th order equation requires that the second derivative of the basis functions be defined everywhere.
For a 2nd order equation, only the first derivative need be defined.
1
( ) ( )N
j jj
U x a x=
=
Integrate by parts twice:
-
Elements with higher continuityLinear elements are continuous, but only the function and first derivative are well defined. To represent a second derivative, both the function and first derivative must be continuous. They must be a subset of H2
j-1 j j+1j-1 j j+1
1 ( )j x 2 ( )j xThe Hermite Cubic elements associate two basis functions with each node j, defined on the interval xj-1 < x < xj+1 as:
( ) ( )( )
21
22
1, 1
2, 2
( ) 1 2 1
( ) 1
( )
( )
jj
jj
y y y
y y y
x xx
hx x
x hh
= +
=
=
=
These have the property that:1. In the interval xj < x < xj+1 , a complete
cubic can be represented by:
2. The first derivatives vanish at the element boundaries
3. The second derivatives are defined everywhere
1, 2, 1, 1 2, 1( ), ( ), ( ), ( ),j j j jx x x x + +
-
j-1 j j+1j-1 j j+1
1 ( )j x 2 ( )j x
Hermite Cubic Finite Elements
1, 2,1
( ) ( ) ( )N
j j j jj
U x a x b x =
= +
In the interval [ j , j+1 ] , the function is written as:
( )( )( )( )
1, 2, 1 1, 1 1 2, 1
21 1
31 1
2 30 1 2 3
( ) ( ) ( ) ( ) ( )
3 2 3
2 2
j j j j j j j j
j j j j j j
j j j j
U x a x b x a x b x
a b x a hb a hb x h
a hb a hb x h
c c x c x c x
+ + + +
+ +
+ +
= + + +
= + + +
+ + +
= + + +
Simple physical interpretation:
aj is value of function at node jbj is value of derivative at node j
0
12 2
123 2 3 2
13
1 0 0 00 1 0 0
3 / 2 / 3 / 1/2 / 1/ 2 / 1/
j
j
j
j
acbc
ac h h h hbc h h h h
+
+
=
i
Complete cubic polynomial determined by values of function and derivative at endpoints
-
j j+1
1 ( )j x
2 ( )j x
Hermite Cubic Finite Elements-2
1, 2,1
( ) ( ) ( )N
j j j jj
U x a x b x =
= +
In the interval [ j , j+1 ] , the function is written as:
( )( )( )( )
1, 2, 1 1, 1 1 2, 1
21 1
31 1
2 30 1 2 3
( ) ( ) ( ) ( ) ( )
3 2 3
2 2
j j j j j j j j
j j j j j j
j j j j
U x a x b x a x b x
a b x a hb a hb x h
a hb a hb x h
c c x c x c x
+ + + +
+ +
+ +
= + + +
= + + +
+ + +
= + + +
1 1( )j x +
2 1( )j x +Complete cubic in each interval!
-
Linear elements
1st Hermite cubic
2nd Hermite cubic
( )x
( )x
( )x
j-1 j j+1j-1 j j+1
j-1 j j+1
not defined
Comparison of elements and derivatives
-
Types of Finite Elements in 2D
Shape Order Continuity
, 0
( , ) i kiki k Mi k
x y C x y+