Académique Documents
Professionnel Documents
Culture Documents
Author:
Javier I. Camacho Hernandez
Contents
1 Problem Formulation 2
1.1 Governing Equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Mixed Formulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Analytical Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2 Discretization 3
2.1 Method of Weighted Residual(MWR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
O
2.2 System of Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
O
2.3 Derivation of the Equation 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
O
2.4 Derivation of the Equation 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.5 Derivation of the Equation 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.6 Representation of the System of Equations 1.6 . . . . . . . . . . . . . . . . . . . . . . . . 8
3 Matlab Implementation 9
3.1 Set-up Grid and Differentiation Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.2 Dirichlet Boundary Condition Implementation . . . . . . . . . . . . . . . . . . . . . . . . 9
3.3 Direct Solver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4 Results 11
4.1 Numerical Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.2 Error Distribution Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.2.1 Temperature Error Distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.2.2 Flux Error Distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.3 Convergence Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1
1. Problem Formulation
The main purpose of this problem is to use Spectral Finite Element Method (Galerkin Method(GM))to
solve a 2-D steady diffusion problem (Elliptic PDE).The nodes for the quadrature rule for GM are the roots
of a Gauss-Lobatto Legendre(GLL) polynomial,which are defined in the domain [1, 1]2 . The problem
is defined in a 2D domain = [1, 1]2 with an homogeneous Dirichlet boundary condition(DBCs),and
it is required to perform a discretization,and MATLAB implementation in order to solve the governing
equation. The particularity of the mixed formulation is that the solution of the scalar temperature field
can be equated at the same time as the solution of the vector field of the heat flux.
T (x, y)
q x = k (1.5)
x
T (x, y)
q y = k
y
Mixed Formulation(System of Equations) (Removing minus sign to have the Poissons Equation )
x y
q + q = f (x, y)
x y
T (x, y) T (x, y)
qx = qx =0 (1.6)
x x
T (x, y) T (x, y)
qy = qy =0
y y
2
2. Discretization
n
q x (x, y)
X
= q x (x, y) = x
qij .hi (x).hj (y) f or i, j = 0, 1, 2, , n (2.3)
i,j=0
n
q (x, y)
X y
y
= q y (x, y) = qij .hi (x).hj (y) f or i, j = 0, 1, 2, , n (2.4)
i,j=0
L T (x, y) f (x, y) = R(x, y) 6= 0 (2.5)
Z
R(x, y).(x, y) d = 0 (2.6)
n
X
(x, y) = kl .hk (x).hl (y) f or k, l = 0, 1, 2, , n (2.7)
k,l=0
Where:
L:Differential Operator
h(x, y):Basis functions/Trial Functions/Expansions Functions
T (x, y):Linear combinations of the basis functions.
kl :Test coefficients.
3
2.2 System of Equations
Applying MWR to the System of Equations Eq.1.6
Z
1 = x q x (x, y) + y q y (x, y) f (x, y) .(x, y)d = 0
Z
2 = q x (x, y) x T (x, y) .(x, y)d = 0 (2.8)
Z
3 = q y (x, y) y T (x, y) .(x, y)d = 0
Z+1Z
LHS1 = x q x (x, y).(x, y)dxdy
1
X " # Z+1Z
x=+1
ZX +1XX
x XXX
= q (x,
y).(x,
XXy) dy q x (x, y).x (x, y)dxdy
1 X x=1
X XXX 1
Z+1Z
(2.10)
LHS2 = y q y (x, y).(x, y)dxdy
1
X " # Z+1Z
y=+1
ZX+1XX
y XXX
= q (x,
y).(x,
XXy) dx q y (x, y).y (x, y)dydx
1 X y=1
X
XXX 1
Z Z
x
LHS = q (x, y).x (x, y)d q y (x, y).y (x, y)d
Rewriting Eq. 1 O
Z Z Z
1 = q x (x, y).x (x, y)d q y (x, y).y (x, y)d = f (x, y).(x, y)d (2.11)
| {z } | {z } | {z }
1.1 1.2 1.3
4
Expansion of term 1.1 from Eq.(2.11) by substitution of Eq.(2.3) and eq.(2.7).
The test coefficients kl are cancel out since they are present in all the terms.
Z "X n
# " n
X
#
x
1.1 = qij .hi (x).hj (y) .x hZ
Z
kl .hk (x).hl (y) d f or sub index = 0, 1, 2, , n
i,j=0 k,l=0
Z " X
n
#
0
x
= qij .hi (x).hj (y).hk (x).hl (y) d
i,j,k,l=0
(2.12)
hi (xm ) = im
(2.14)
x hi (xm ) = Dmi
x
1.1 = qij .im .jn .Dmk .ln .wnn .wmm f or sub index = 0, 1, 2, , n
(2.15)
x
= Dmk .wmm .mi .qij .jn .wnn .nl
Kronecker Product
AXB = C
(2.16)
B T A .vec(X) = vec(C)
x
Dmk .wmm .mi qij . .wnn .nl (2.17)
| {z } |{z} |jn {z }
A X B
!
y DxT .x .q x (2.18)
5
Expansion of term 1.2 from Eq.(2.11) by substitution of Eq.(2.3) and eq.(2.7).
The test coefficients kl are cancel out since they are present in all the terms.
Z "X n
# " n
X
#
y
1.2 = qij .hi (x).hj (y) .y
H
kl .hk (x).hl (y) d f or sub index = 0, 1, 2, , n
H
i,j=0 k,l=0
Z " X
n
#
y 0
= qij .hi (x).hj (y).hk (x).hl (y) d
i,j,k,l=0
(2.19)
Kronecker Product
y
km .wmm .mi qij . . .wnn .Dnl (2.22)
| {z } |{z} | jn {z }
A X B
!
DyT .y x .q y (2.23)
6
2.4 Derivation of the Equation 2 O
O
Separation of Eq. 2 into terms
Z
2 = q x (x, y) x T (x, y) .(x, y)d = 0
Z Z
(2.30)
= q x (x, y).(x, y)d x T (x, y).(x, y)d = 0
| {z } | {z }
2.1 2.2
x
2.1 = qij .im .jn .km .ln .wnn .wmm f or sub index = 0, 1, 2, , n
(2.33)
x
= km .wmm .mi qij .jn .wnn .nl
Kronecker Product
x
km .wmm .mi qij . .wnn .nl (2.34)
| {z } |{z} |jn {z }
A X B
!
y x .q x (2.35)
2.2 = Tij .Dmi .jn .km .ln .wnn .wmm f or sub index = 0, 1, 2, , n
(2.38)
= km .wmm .Dmi .Tij .jn .wnn .nl
7
Kronecker Product
.km .wmm .Dmi . Tij . .jn .wnn .nl (2.39)
| {z } |{z} | {z }
A X B
!
y .x .Dx .T (2.40)
8
3. Matlab Implementation
9
3.3 Direct Solver
10
4. Results
11
4.2 Error Distribution Analysis
4.2.1 Temperature Error Distribution
12
4.3 Convergence Analysis
13