0% found this document useful (0 votes)
6 views8 pages

Fem 2

Uploaded by

1536268388tom
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views8 pages

Fem 2

Uploaded by

1536268388tom
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

FEM Project II

1900010694

1 Stokes: MINI elements 1


1.1 FEM Construction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Stiffness matrix, RHS, B.C. and Error estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2 Stokes: Pressure-robustness 4
2.1 MINI elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.2 Scott-Vogelius elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.2.1 Stiffness matrix, RHS and B.C. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.2.2 Error Estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

3 Application on Lid-driven Cavity 7


3.1 MINI elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.2 Scott-Vogelius elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

1 Stokes: MINI elements


1.1 FEM Construction
Consider the following Stokes problem on Ω := (0, 1)2 ,


 −µ∆⃗u + ∇p = f⃗ in Ω ⊂ R2


−∇ · ⃗u = 0 in Ω,



 ⃗u = ⃗g on ∂Ω.

Multiply LHS by ⃗v , q and perform an integration-by parts, we obtain



 a(⃗u, ⃗v ) + b(⃗v , p) = F (⃗v ) ⃗v ∈ H
⃗ 1 (Ω) 0
 b(⃗u, q) = 0 q ∈ L20 (Ω)
∫ ∫ ∫
a(⃗u, ⃗v ) = µ ∇⃗u : ∇⃗v , b(⃗u, p) = − p div⃗u, F (⃗v ) = f⃗ · ⃗v
Ω Ω Ω
We select the exact solution as below
 
sin(2πy)(1 − cos(2πx))
µ = 1, ⃗u =  , p = 2π(cos(2πy) − cos(2πx))
sin(2πx)(cos(2πy) − 1)

1
1.2 Stiffness matrix, RHS, B.C. and Error estimation 1 STOKES: MINI ELEMENTS

hence we have ⃗g = 0 and


 
−4π 2 sin(2πy)(2 cos(2πx) − 1) + 4π 2 sin(2πx)
f⃗ =  
4π 2 sin(2πx)(2 cos(2πy) − 1) − 4π 2 sin(2πy)

We use MINI elements and quasi-uniform triangular mesh to construct a corresponding FEM problem.
Namely
Vh = P
⃗1 ⊕ B
⃗ T , Q h = P1

Define Vh (0) := Vh ∩ H
⃗ 1 (Ω), then we can write the corresponding FEM problem
0

 a(⃗uh , ⃗vh ) + b(⃗vh , ph ) = F (⃗vh ) ∀ ⃗vh ∈ Vh (0)
Find uh ∈ Vh (0), ph ∈ Qh such that
 b(⃗uh , qh ) = 0 ∀ qh ∈ Q h

To solve this FEM problem, we shall first write this discrete variational form into a linear equation solving
problem. It’s obvious that we can just verify the equation with respect to all the base function of (v⃗h , qh ).
Noticed that
∑ ∑
vh = ⃗ci φi , qh = di ϕ i
i i

and in bilinear form a(·, ·) b(·, ·) we have


 
(∇φi , ∇φj ) 0
(∇⃗ci φi , ∇⃗cj φj ) = (⃗ci · ⃗cj )(∇φi , ∇φj ) = c⃗j T   ⃗ci =: c⃗j T Aji c⃗i
0 (∇φi , ∇φj )
 
−(∂ φ , ϕ )
cj φj , di ϕi ) = c⃗j T   di =: c⃗j T Bji di .
x j i
−(div⃗
−(∂y φj , ϕi )
   
(⃗
ci ) i (F (φj ))j
Let A = (Aji ) B = (Bji ), combine u :=   and b :=  . Then the problem is transformed into
(di )i (F (ϕj )j )
the a linear equation solving problem  
A B
 u = b
BT 0

1.2 Stiffness matrix, RHS, B.C. and Error estimation


We will use the built-in P1bP1 Element Builder in iFEM Package to assemble stiffness matrix, RHS and
B.C. The way iFEM assemble stiffness matrix A is slightly different from what we have discussed. The GREAT-A
matrix in iFEM is constructed as
A = diag{A, D, A, D}

while A corresponds with P1 and D corresponds with BT . B.C., RHS and Error estimation are all built-in and
we can just run the code below.

1 option.elemType = 'P1bP1';
2 pde = Stokesdata1;
3 pde.f = @(p) exactf(p(:, 1), p(:, 2));
4 pde.exactu = @(p) exactu(p(:, 1), p(:, 2));
5 pde.exactp = @(p) exactp(p(:, 1), p(:, 2));
6 pde.g_D = @(p) [0,0];
7 [soln,eqn,err,time,solver] = femStokes(mesh,pde,option);

2
1.3 Results 1 STOKES: MINI ELEMENTS

1.3 Results
We are going to show the streamline diagram of u⃗h and the surface graph of ph . We also tests the error
order of the numerical solution, from which we learned O(h 2 ) for ||⃗u − u⃗h ||H 1 , O(h2 ) for ||⃗u − u⃗h ||L2 , O(h 2 ) for
3 3

||p − ph ||L2 .

1: Surface u1h 2: Surface u2h 3: Surface ph

4: Quiver u⃗h

5: Quiver u⃗h

3
2 STOKES: PRESSURE-ROBUSTNESS

2 Stokes: Pressure-robustness
During the error estimation for u⃗h , we will obtain an inequality just like
1
|⃗u − u⃗h |H 1 ≲ inf |⃗u − v⃗h | + inf ||p − qh ||L2
v⃗h ∈Vhdiv µ qh ∈Qh
while Vhdiv = {v⃗h ∈ Vh : b(qh , v⃗h ) = 0, ∀qh ∈ Qh }. The pressure term in error estimation plays a role as
pollution, which can have a significant effect when µ → 0. FEM methods that can escape from this pollution
effect are defined as pressure-robust.

2.1 MINI elements


MINI elements are lack of pressure-robustness. Although MINI elements are conforming, we cannot obtain
divergence free namely divVh ⊂ Qh . We are going to verify this by calculating the error estimation at µ =
1, 1e − 2, 1e − 4, 1e − 6. Assume
 
1 7 0
⃗u = 0, p = y3 − y2 + y − , f⃗ =  
2 12 3y 2 − y + 1

then we can just multiply f⃗ by 1


µ
and use the existing computation pipeline to finish the test. The results are
shown below. We don’t even need to plot the curve |⃗u − u⃗h |H 1 ∼ 1
µ
to see the linear relationship between them,
which indicates that |⃗u − u⃗h |H 1 in MINI elements are polluted by 1
inf ||p
µ q ∈Q
− qh ||L2 term.
h h

1
µ
1 102 104 106
h = 2−4 5.43e-06 5.43e-04 5.43e-02 5.43
h = 2−5 6.93e-07 6.93e-05 6.93e-03 6.93e-01
|⃗u − u⃗h |H 1
h = 2−6 8.76e-08 8.76e-06 8.76e-04 8.76e-02
h = 2−7 1.10e-08 1.10e-06 1.10e-04 1.10e-02

2.2 Scott-Vogelius elements


Scott-Vogelius elements can be simply noted as P⃗4 − P3−1 , while Vh = P⃗4 refers to 2-dim Lagrange P4
elements and Qh = P3−1 refers to Discontinuous Lagrange P3 elements. It is obvious that this Stokes pair is
conforming and divergence-free. According to [1], given a regular mesh with each vertex being ’uniformly not
singular’, we can obtain the inf-sup stability for P⃗4 − P3−1 .
Unfortunately, we have to assmeble the stiffness matrix and RHS manually.

2.2.1 Stiffness matrix, RHS and B.C.

We use barycentric Lagrange node groups to define FEM function basis. The order of nodes are plotted
below. We decide to arrange the coefficients of u⃗h and ph in a specific order.

(u⃗h 1 , u⃗h 2 , ph ) = (Node1 , Edge1 , Elem1 , Node2 , Edge2 , Elem2 , Elemp )

Node contains 1 coefficient while Edge and Elem contains 3 coefficient such as local 4, 5, 6 and local 13, 14,
15. When 2 elements are sharing a same edge, conefficients on edge will start from the node with the smallest
number. Since ph is discontinuous, Elemp contains 10 coefficients.

4
2.2 Scott-Vogelius elements 2 STOKES: PRESSURE-ROBUSTNESS

3
3
6
5
7
5 6

8
15 4
4
7 10
13 14
9

1 10 11 12 2 1 8 9 2

The stiffness matrix consists of A and B due to our previous discussion. A can be written into A =
diag{A, A} while
aij = µ(∇φi , ∇φj )
 
Bx
Matrix B can be written into B =   while
By

bxij = −(∂x φi , ϕj ).

π 3π
All the elements can be divided into 2 classes: the 2
rotation class and the 2
rotation class. We can
pre-calculate the local ATij = (∇φi , ∇φj ), BTij = −(∂x φi , ϕj ) in each class and assemble the stiffness matrix by
simply adding them together.

1 for t = 1:NT
2 localType = formLocalType();
3 localMap = formLocalMap();
4 for ti = 1:15
5 for tj = 1:15
6 index = index + 1;
7 i(index) = localMap(ti);
8 j(index) = localMap(tj);
9 s(index) = AT(ti,tj,localType);
10 end
11 end
12 end
13 A = sparse(i, j, s, N+NE, N+NE)

Assembling B shares the same process.

1 for t = 1:NT
2 localType = formLocalType();
3 localMap = formLocalMap();
4 for ti = 1:15
5 for tj = 1:10
6 index = index + 1;
7 i(index) = localMap(ti);
8 j(index) = localMap(tj);
9 s(index) = BTx(ti,tj,localType);

5
2.2 Scott-Vogelius elements 2 STOKES: PRESSURE-ROBUSTNESS

10 end
11 end
12 end
13 Bx = sparse(i, j, s, N+NE, N+NE)

B.C. construction is trivial.  


0 ∫
RHS construction requires us to calculate integrations such as T f⃗ ·  . Since the computation cost
φi
is heavy, we have to find a numerical integration method which has to be high-order due to our elements’
selection. Luckily we can directly find the integration nodes data on website [4]. We are going to choose Order
6 integration method on this website.
After these work, we can solve the FEM problem and try to estimate the results. We test this porject on
our 1st problem and print the streamline diagram. It seems that this project works as well as MINI elements.

⃗ 4 − P3−1 to solve Problem 1. Quiver ⃗uh


6: Use P

2.2.2 Error Estimation

Realizing that ⃗u = 0 in our previous example yields


∑ ∑ 1 T
||∇(⃗u − u⃗h )||2L2 = ||∇u⃗h ||2L2 = ( ci ∇φ⃗i , cj ∇φ⃗j ) = ⃗c A⃗c.
i j
µ

Hence we can easily calculate the |⃗u − u⃗h |H 1 ∼ 1


µ
and list them below. From the table we can see all |u⃗h |H 1
are small regardless of the selection of h. Although there is a linear growth relationship between |⃗u − u⃗h |H 1
1
and µ
, considering that we are using numerical integration and linear-solver and small µ may results in larger
condition number of A, part of this magnitude of error can be seen as other errors such as rounding errors or
MATLAB function handle errors. The latter appears when we are calculating P4 polynomial basis and testing
our polynomials on barycentric points in standard triangle, whose order is around 1e-8 and 1e-10 when µ = 1.

1
µ
1 102 104 106
h = 2−3 3.05e-10 4.95e-9 4.62e-07 4.61e-05
|⃗u − u⃗h |H 1 h = 2−4 2.17e-10 1.38e-9 1.04e-05 4.26e-05
h = 2−5 4.55e-11 1.22e-8 4.24e-07 4.24e-05

6
3 APPLICATION ON LID-DRIVEN CAVITY

3 Application on Lid-driven Cavity


Now we are trying to use MINI elements from Problem 1 and Scott-Vogelius elements from Problem 3 to
solve Lid-driven Cavity problem, which has the form
 
1
f⃗ = 0, ⃗g |{y=1} =  .
0

We are going to plot the streamline diagram of ⃗uh as below. The ph however seems too large and has a bad
display effect.

3.1 MINI elements

7: Use MINI elements to solve Lid-driven Cavity

7
3.2 Scott-Vogelius elements REFERENCES

3.2 Scott-Vogelius elements

⃗ 4 − P3−1 to solve Lid-driven Cavity


8: Use P

References
[1] Boffi D, Brezzi F, Fortin M. Mixed finite element methods and applications[M]. Heidelberg: Springer, 2013.

[2] Cioncolini A, Boffi D. The MINI mixed finite element for the Stokes problem: An experimental investiga-
tion[J]. Computers & Mathematics with Applications, 2019, 77(9): 2432-2446.

[3] Hu X, Lee S, Mu L, et al. Pressure-robust enriched Galerkin methods for the Stokes equations[J]. Journal
of Computational and Applied Mathematics, 2024, 436: 115449.

[4] https://mathsfromnothing.au/triangle-quadrature-rules/?i=1

You might also like