Sunteți pe pagina 1din 15

FINITE DIFFERENCE METHOD FOR STOKES EQUATIONS: MAC SCHEME

LONG CHEN

In this chapter, we present the most popular finite difference method, MAC [4], for
the Stokes equations and analyze the MAC scheme from different prospects. WE shall
consider the Stokes equation

−∆u + ∇p = f in Ω,
(1)
−∇ · u = 0 in Ω.
Here for the sake of simplicity, we fix the viscosity constant µ = 1.

1. MAC D ISCRETIZATION
Let u = (u, v) and f = (f1 , f2 ). We rewrite the Stokes equations into coordinate-wise
(2) −∆u + ∂x p = f1 ,
(3) −∆v + ∂y p = f2 ,
(4) ∂x u + ∂y v = 0.
The domain Ω = (0, 1)2 is decomposed into small squares with size h. We use two di-
mensional uniform grids for Ω = (0, 1)2 as a typical setting. Generalization to domains
composed by rectangles and to three dimensional domains composed by cubes is straight-
forward but with extra notation.
Standard central difference discretization of ∆ and ∂x , ∂y at vertices of the uniform grid
will not give a stable discretization of Stokes equations due to the failure of the discrete
inf-sup condition. To see this, one can view the 5-point stencil as using P1 element for
Laplacian operator and thus discretization at grid points is equivalent to use P1 − P1 un-
stable pair. Similarly changing pressure discretization to centers of cells corresponds to
P1 − P0 which is not stable neither.
The idea of MAC, Marker and Cell, is to place the unknown of (u, v, p) in different loca-
tions. Specifically the pressure p is located in the center of each cell and the x-component
velocity u on the middle points of vertical edges (red dots) and the y-component velocity
v on middle points of horizontal edges; see Figure 1.
The MAC scheme is to discretize the x-coordinate momentum equation (2) at vertical
edges, the y-coordinate momentum equation (3) at horizontal edges, and the continuity
equation (4) at cell centers using central difference schemes.
Let us introduce the indices system consistent to the matrix, which is easier for the
programming: i is the row index and j is the column index, running from 1 : n or 1 : n + 1,
where n the number of cells in one direction. The pressure is then discretized to a matrix
p(1:n,1:n), and the velocity is u(1:n,1:n+1), and v(1:n+1,1:n). One can easily
write out the mapping from the index (i, j) to the coordinate (xj , yi ) for different variables.
Note that it is not consistent with the traditional indices system where i for xi and j for
yj . The advtange to use the proposed index system is that once the mapping (algebraic to

Date: Create: Winter 2012. Last update: June 25, 2016.


1
WeWe
Weconsider
consider
considerStokes
Stokes
Stokes equation
equation
equation
888
> µ u ~ ~+ rp
~++rprp ~=f
==
f ~ ininin⌦,
~f
<> << µµ u
> u ⌦,
⌦,
(1.1)
(1.1)
(1.1) rrr
·u
~· ·u
~~
u=0
=0
=0 ininin⌦.
⌦.
⌦.
>
:> :>
: ~u
u ~=0
~u =0 onon
=0 on@⌦ @⌦
@⌦
where
where
where~u
u ~=
~ =(u,
u =(u,v)v)
(u, , and
t tt
v) , ,and~f
f
and ~=
~ ==
f (f(f , f, 2,f)ft).)t .t .
1(f 11 22

2.2.2.MAC
MAC
MACDDDISCRETIZATION
ISCRETIZATION
ISCRETIZATION
2 LONG CHEN

j jj j jj jjj

i ii i ii i ii

( A()A(index
A)(a)
)index
index
pforfor
for
p pp ( B()B( B
) )index
index
index
(b) ufor
forfor
u uu ( C( C
)( C)index
)index
index for
vfor
(c)for vvv

FFIGURE
F IGURE 1.1.1.
IGURE Index
Index
Index for
forfor
p,p,u,
p,u,u,
v.v.v.
F IGURE 1. Location and indices of (u, v, p) variables.
2.1.
2.1.2.1. MAC
MACMAC Scheme.
Scheme.
Scheme. Suppose
Suppose
Suppose wewewe have
havehave a arectangular
arectangular
rectangular decomposition,
decomposition,
decomposition, for
forfor each
eacheach cell,
cell,
cell, the
thede-
the de-
de-
geometry
gree
greegree
ofofof mapping)
freedoms
freedoms
freedoms forfor
uisuand
for fixed,
uand
and in
vare
v vare almost
are located
located
located all
ononplaces
on the
thethe of coding,
vertical
vertical
vertical edge
edgeedge we operate
centers
centers
centers and
and on
and the matrix
horizontal
horizontal
horizontal and
edge
edge
edge
2 such indices system is more SOLVING STOKES
intuitive to EQUATION
traverse WITH
in the MAC
matrix.METHOD
centers,
centers,
centers, respectively,
respectively,
respectively, and
and and
thethe
the degree
degree
degree ofofof freedoms
freedoms
freedoms forfor
for pressure
pressure
pressure pare
ppare are located
located
located atatatcell
cell
cell centers.
centers.
centers.
The
The MAC
MAC scheme
scheme is
is written
written
The MAC scheme is written as (µ = 1) as
as (µ(µ= = 1)1)
i,ji,j
i,j i i1,j
4u4u
4u u uui 1,j1,j i+1,j
u uui+1,j
i+1,j i,ji,j
uuui,j1 11 uu ui,j+1
i,j+1
i,j+1
ppi,jpi,ji,j ppi,j
pi,ji,j1 11 i,ji,ji,j
(2.1)
(2.1)
(2.1) + ++ === ff1f11
ui 1,j h2hh22 i 1,j
hhh
v
4vi,ji,j v ivvi1,j
i,j
4v4v i 1,j
1,j i+1,j
v vvi+1,j
i+1,j i,ji,j
v vv i,j1 11 v i,j+1
vvi,j+1
i,j+1
ppi pi i1,j1,j
1,j i,j
pppi,ji,j i,ji,ji,j
(2.2)
(2.2)
(2.2) 22 + ++ === ff2f22 i,j
h2hh p i 1,j
hhh v
i,j+1
i,j+1 i,ji,j i,j i,j
i,j i+1,j i+1,j
i+1,j
u uu
i,j+1
u uu v v v
i,j
vv v
(2.3)
u(2.3)
(2.3)
i,j 1
u i,j
ui,j+1 v i,j 1 v i,j ++ v+i,j+1 === 000
pi,j 1 pi,j hhh hhh
It’s
It’seasy
easytotosee
tosee
see that
that the
the above
above scheme
scheme has
has second
second order
order truncation
truncation error.
error.
i,j
ui,j+1
It’s easy that the above scheme has second order truncation error. u
pi,j
1 1 1 pi,j
ui+1,j

v i+1,j v i+1,j

( A ) equation for u ( B ) equation for v ( C ) equation for p

F IGURE 2. equation for u, v, p.


F IGURE 2. Indices of local stencils of MAC equations

Using this index system, the MAC scheme can be written as


2.2. Dirichlet boundary condition.
4ui,j − ui−1,j − ui+1,j − ui,j−1 − ui,j+1 pi,j − pi,j−1
(5)(1) Square domain 2
+ = f1i,j
h h
Consider a unit square domain with the grid spacing h for each direction. We
4v i,j − v i−1,j − v i+1,j − v i,j−1 − v i,j+1 pi−1,j − pi,j
(6) only consider the handling2 of boundary condition + for u on the=level f2i,j y = 2 . The
h
h h
same approach can be applied for the level y = 1 i,jh2 . Thei+1,j
handling of v on x = h2
ui,j+1 − ui,j v −v
(7) and x = 1 2 is similar.
h + =0
h h
Our difference
Since central aim is how to approximate
schemes uyy
are used, it is(jh,
h
) with
easy2to the the
see that numerial grid function
above scheme has
values u N 1,j
, u N,j
, u y=0,j
?
second order truncation error at interior nodes.
(a) The
We then Natural
discuss Taylor Series
discretization Expansion
of boundary Method.For Dirichlet boundary condi-
conditions.
Consider
tion, one can impose itthe infollowing
one directionTaylor seriesthe
by fixing expansions:
value laying on the boundary and by
extrapolation on the other direction. Let us take x-coordinate component velocity u as an
h h h 1 h h2
example. On
(2.4) edges
u(jh, 0 and x)= 1,uythe
0)x==u(jh, value) is +
(jh, givenuyy
by(jh,
the boundary
) + condition
O(h2 ), and no
equation is discretized on these 2 points. On edges
2 2 y= 2 0 and y 2= 1,4 however, there is no
unknownsu(jh, 3h
of u on )that h
edge and) weuneed h 1 h
(2.5) = u(jh, (jh,to modify
)h + the
y u stencil
(jh, at)hy2 = h/2,21).− h/2. As
+ O(h yy
2 2 2 2 2
Multiplying (2.4) by 2 and taking summation with (2.5) yields
h 4 2uy=0,j 3uN,j + uN 1,j
(2.6) uyy (jh, ) = ( ) + O(h2 ).
2 3 h2
Thus the scheme for the Laplacian term of u at y = h
2 is
FINITE DIFFERENCE METHOD FOR STOKES EQUATIONS: MAC SCHEME 3

an example, consider the discretization at the index (1, j). We introduce the ghost value
at y = 1 + h/2, i.e. u(0, j). Then we can discretize the momentum equation at (1, j)
using (5). The ghost value is then eliminated by the linear extrapolation, i.e, requiring
(u0,j + u1,j )/2 = gD (xj , 1). Therefore the modified discretization (5) is
5u1,j − u2,j − u1,j−1 − u1,j+1 p1,j − p1,j−1 2gD (xj , 1)
2
+ = f11,j + .
h h h2
In short
(8) (5, −1, −1, −1, −2)
is the stencil for u-unknowns near the horizontal boundaries.
We can also use the quadratic extrapolation, i.e., use u1/2,j , u1,j , u2,j to fit a quadratic
function and evaluate at u0,j to get u0,j = −2u1,j + 31 u2,j + 83 u1/2,j . The modified
boundary scheme is:
6u1,j − 43 u2,j − u1,j−1 − u1,j+1 p1,j − p1,j−1 1,j
8
3 gD (xj , 1)
2
+ = f 1 + .
h h h2
We denote this near boundary stencil by
4 8
(9) (6, − , −1, −1, − ).
3 3
The quadratic extrapolation will lead to a better accuracy and the detailed error analysis
can be found in Section 3. It will, however, destroy the symmetry of the matrix since the
coefficient connecting u1,j to u2,j is −4/3 not −1.
For Neumann boundary condition ∂u/∂n|∂Ω = gN , the ghost value will be eliminated
by the central difference discretization (u0,j − u1,j )/h = gN (xj , 1) and the modified
stencil is
3u1,j − u1,j−1 − u1,j+1 − u2,j p1,j − p1,j−1 gN (xj , 1)
2
+ = f11,j + .
h h h
Unlike the Dirichlet boundary condition, similar modification is needed for all grids points
on or near the boundary edges and for points near corners two ghost degree of freedom
(dof) should be introduced; see Chapter: Finite Difference Methods.
We can write the discrete problem in the matrix form with familiar notation:
    
A BT uh fh
(10) = .
B 0 ph 0
Exercise 1.1. Verify the matrix BB T is the standard 5-point stencil of Laplacian operator
discretized at at cell centers and with Neumann boundary conditions.

2. M ULTIGRID M ETHODS FOR MAC S CHEME


In this section we present a multigrid method for solving the MAC discretization of
Stokes equations (10). The key is the so-called Distributive Gauss-Seidel Relaxation
(DGS) smoother developed by Brandt and Dinar [1].

2.1. Distributive Gauss-Seidel Relaxation. The standard relaxations, e.g., the Gauss-
Seidel relaxation, are not applicable to the system (10), since the matrix is not diagonally
dominant, and especially the zero block in the diagonal hampers the relaxation. The idea
of the distributive relaxation is to transform the principle operators to the main diagonal
and apply the equation-wise decoupled relaxation.
4 LONG CHEN

Denote the Stokes operator by


 
A BT
L= ,
B 0
and the transformation matrix
 
I BT
M=
0 −BB T
then    
A AB T − B T BB T A 0 g
LM = ≈ := LM.
B BB T B Ap
Here Ap = BB T = − div grad represents a discrete Poisson for pressure. By “ ≈ ” we
mean that the commutator E = AB T − B T BB T is of low rank. Thus it can be safely
omitted in order to design relaxation methods.
Let us give a justification of ignoring E. In the continuous level, the (1, 2) block of
LM can be manipulate as
(−∆ + grad div)grad = curl curl grad = 0.
Here we use the identity
(11) − ∆ = −grad div +curl curl ,
and the fact
(12) curl grad = 0.
In short the operator of ∆ and grad is commute in the sense that
(13) ∆u gradp = gradu ∆p .
Here we use subscript to indicate different operators associated to velocity and pressure.
For specific discretization, we need to verify (11) and (12) still hold in the discretization.
Exercise 2.1. Verify for MAC scheme, E = 0 at interior nodes. Thus the rank of E is at
most n2 − (n − 1)2 .

The matrix M(LM) g −1 will be an good approximation of L−1 = M(LM)−1 . It


defines an iterative method for the original system

(14) g −1 (b − Lxk ),
xk+1 = xk + M(LM)

where to simply the notation denoted by xk = (uk , pk ), b = (f, g). It can be shown this is
indeed the projection method; see Chapter: Fast Solvers for Stokes Equations.
The so-called DGS smoother introduced by Brandt and Dinar [1] comes from consecu-
g Let Â, Âp be smoothers for A
tively Gauss-Seidel relaxation applied to the operator LM.
and Ap , respectively. We solve the transformed residual equation
 −1    
 0 δw r
= u
B Â−1
p δq rp

and update (u, p) through the distributive matrix M. One iteration can be performed by
the following algorithm.
FINITE DIFFERENCE METHOD FOR STOKES EQUATIONS: MAC SCHEME 5

Algorithm 2.1. [uk+1 , pk+1 ] ← DGS(uk , pk , f , g)


(1) Relax momentum equations
1
uk+ 2 = uk + Â−1 (f − Auk − B T pk ),
(2) Relax transformed continuity equations
1
δq = Â−1
p (g − Bu
k+ 2
) .
(3) Distribute the correction to the original variables
1
uk+1 = uk+ 2 + B T δq,
pk+1 = pk − BB T δq .

The uk+1 is still not used in the update of pk+1 but will contribute to the next update
of velocity uk+1+1/2 . If we skip uk+1 , the way of updating uk+1/2 and pk+1 can be
interpret as an inexact Uzawa using Ap Â−1p as an approximation for the inverse of the
Schur complement. From this point of view, the step (3) can be simplified as pk+1 =
pk + Buk+1/2 − g.
In the DGS iteration, only algebraic manipulation not the geometric realization of the
indices is needed. The neighboring indices of (i, j) for u, v, p can be found in Fig 2 in the
previous section.
When implement the Gauss-Seidel iteration for finite difference methods, the direct
update version is more efficient than the correction version. For example, the update for
velocity u(i,j) for i=2:n-1,j=2:n is simply
1 u(i,j) = (hˆ2*f1(i,j) + u(i-1,j) + u(i+1,j) + u(i,j-1) + u(i,j+1)...
2 - h*(p(i,j) - p(i,j-1)))/4;

For boundary and near boundary subscript i,j, the stencil should be modified to impose
the boundary condition. Red-black ordering can be used to vectorize the Gauss-Seidel
iteration. See Chapter: Programming of Finite Difference Methods.
After the update of velocity, we need to update the residual for the continuity equation,
i.e. compute rp = g − Bu = g + div u which can be done efficiently using the index
relation of p and u, v; see again Fig. 2 (C).
Then we apply Gauss-Seidel to solve the elliptic equation Ap δq = rp . Here recall
that Ap = BB T is the discrete Laplacian of pressure with Neumann boundary condi-
tion, i.e., (4, −1, −1, −1, −1) for interior cells and (3, −1, −1, −1) for boundary cells and
(2, −1, −1) for corners (dividing by h2 ). One Gauss-Seidel iteration for interior cells will
be
1 dq(i,j) = (hˆ2*rp(i,j) + dq(i-1,j) + dq(i+1,j) + dq(i,j-1) + dq(i,j+1))/4;

For boundary and corner cells, the stencil should be modified accordingly.
Then we should bring the correction dq to u, v, p through the distributive matrix.
Note that B T is just the discrete gradient operator. The update of u will be
1 u(i,j) = u(i,j) + (dq(i,j) - dq(i,j-1))/h;

The update of pressure requires the computation of Ap δq. Its matrix-free version is
1 p(i,j) = p(i,j) - (4*dq(i,j)-dq(i-1,j)-dq(i+1,j)-dq(i,j-1)-dq(i,j+1))/hˆ2;

For boundary and corner cells, the stencil should be modified accordingly.
6 LONG CHEN

2.2. Transfer Operators. At u- and v-grid points, we consider six-points restrictions, and
at p-grid points, a four-point cell-centered restriction. In the finite difference method, the
restriction is also applied to function values which is different with the finite element one
in a scaling.
In stencil notation, the restriction operators are
     
1 2 1 1 1 1 1
1 1 p 1
u
Rh,2h =  ∗  , Rh,2h
v
= 2 ∗ 2 , Rh,2h =  ∗ .
8 8 4
1 2 1 1 1 1 1

Let us explain the restriction operator Rh,2h


u
in details. Look at Figure 3 for a vertical edge
center degree of freedom. Point 0 is a degree of freedom for u on the coarse grid, and
points 1, · · · , 6 are degree of freedoms on the fine grid. Therefor the restriction at point 0
will be
1
u0 = (u1 + u2 + 2u3 + 2u4 + u5 + u6 ).
8
p
The explanation for the restriction operators Rh,2h
v
and Rh,2h are similar. Note that Rh,2h
u

and Rh,2h are only defined for interior edges, since the dof is prescribed via Dirichlet
v

boundary
14 conditions for SOLVING
boundary edges.
STOKES EQUATION WITH MAC METHOD

1 3 5
0 0
2 4 6

( A ) Fine grid ( B ) Coarse grid

F IGURE 9. Sketch
F IGURE of restriction
3. Sketch for vertical
of restriction foredge center
vertical dof center
edge 0 on coarse
dof 0grid, (A) fine grid
on coarse
points
grid, (A) 6 and coarse
· · · , points
fine1,grid 1, · · ·grid pointcoarse
, 6 and 0 on fine grid.
grid (B).0coarse
point gridgrid.
on fine point 0.
(B). coarse grid point 0.
For the prolongation operators, we typically apply bilinear interpolation of neighboring
coarse-grid unknowns in the staggered grid. See Figure 10. To compute the values at points
5, ·For
· · ,the
10,prolongation operators,
we first calculate we typically
a bilinear function apply
using bilinear interpolation
coarse grid points 1, ·of· ·neighboring
, 4, and the
coarse-grid unknowns in the staggered grid. See Figure 4. To compute
value for fine grid points 5, · · · , 10 are just the evaluation of the bilinear thefunction
values atatpoints
these
5, Onewe
· · · , 10,
points. first
can calculate
eaily derive athat:
bilinear function using coarse grid points 1, · · · , 4, and the
value for fine grid points 5, · · · , 10 are just the evaluation of the bilinear function at these
3 1 3 1
points. One can easily derive u5 = that:u1 + u2 , u6 = u2 + u1 ,
4 4 4 4
33 11 33 11
uu59 =
= uu13 + + uu24,, uu610== uu 2 4++ uu 1 ,3 ,
44 44 44 44
31 1 13 1
u97 = u (u3 5++ uu94),, uu10
8 == (u u 6 + u10u ).,
42 4 24 4 4 3
Following the same the approach, 1 one can also derive 1 formular for computing horizontal
u7 = (u5 + u9 ), u8 = (u6 + u10 ).
edge center degree of freedoms 2on fine grid from coarse 2 grid solution. Piecewise constant
(first-order) interpolation for the p variables.
Following the same approach, one can also derive formulae for computing horizontal
edge center degree of freedoms on the fine grid from the coarse grid solution. Piecewise
constant interpolation for the pressure p is used.
1 3 1 3
5 7 9

6 8 10
2 4 2 4
u5 = u1 + u2 , u6 = u2 + u1 ,
4 4 4 4
3 1 3 1
u9 = u3 + u4 , u10 = u4 + u3 ,
4 4 4 4
1 1
u7 = (u5 + u9 ), u8 = (u6 + u10 ).
2 2
Following the same the approach, one can also derive formular for computing horizontal
edge center degree of freedoms on fine grid from coarse grid solution. Piecewise constant
(first-order) interpolation for the p variables.
FINITE DIFFERENCE METHOD FOR STOKES EQUATIONS: MAC SCHEME 7

1 3 1 3
5 7 9

6 8 10
2 4 2 4

( A ) Coarse grid ( B ) Fine grid

F IGURE 10. Sketch of prolongation for vertical edge center dofs. (A) coarse grid points
F IGURE 4. Sketch of prolongation for vertical edge center dofs. (A)
1, · · · , 4 on coarse grid. (B). coarse grid points 1, · · · , 4 and fine grid
coarse grid points 1, · · · , 4 on coarse grid. (B). coarse grid points
points 5, · · · , 10 on fine grid.
1, · · · , 4 and fine grid points 5, · · · , 10 on fine grid.

4.5.2. V-cycle. A sketch of matlab routine for V-cycle.


3. C ONVERGENCE This code can be written in matrix
A NALYSIS
free form, i.e, we don’t have to write the whole matrix of MAC discretization. One can
In solution
treat this section
u, v,we provide
p and right convergence
hand side f1 ,analysis for MAC schemes. We first present a
f2 as matrix.
finite element interpretation developed by Han and Wu in [3] for which the discrete inf-sup
condition is easy to verify. Then we show the relation to MAC schemes and thus obtain the
stability of MAC schemes. With the standard truncation error analysis, we then obtain the
rate of convergence which depends on the way of imposing boundary condition. For the
quadratic extrapolation, a second order convergence in H 1 norm of velocity and L2 norm
of pressure can be obtained, while for the linear extrapolation, only first order result can be
proved.
Note that Han and Wu obtained only a first order convergence result for finite element
formulation (20) and Nicolaides [5] proved the first order convergence for a scheme equiv-
alent to linear extrapolation scheme (23). The second order convergence of the MAC
scheme for the steady state Stokes equations seems not rigorously proved before.
Denote the number of unknowns for velocity and pressure as Nu and Np , respectively,
and the size of discrete system as N := Nu + Np . The near boundary nodes for velocity
is labeled from 1 to Nb and interior nodes from Nb + 1 to Nu .
3.1. A Finite Element Method Interpretation. We follow the work of Han and Wu in [3]
to interprete the MAC as a special finite element method. Denote V := H 10 (Ω) as the
H 1 function with zero trace, and Q := L20 (Ω) the L2 functions with mean value zero
over domain Ω. The corresponding dual spaces are V0 = H −1 (Ω) and Q0 = L20 (Ω)
respectively. The Stokes operator L can then be understood as L : X → Y with X :=
V × Q and Y := V0 × Q0 .
The variational problem for (1) reads as: find (u, p) ∈ V × Q, such that
(
a(u, v) + b(v, p) = (f , v) for all v ∈ V,
(15)
b(u, q) = 0 for all q ∈ Q,
where (·, ·) is the L2 -inner product and
a(u, v) = (∇u, ∇v), b(v, q) = (− div v q).
To approximate the velocity space V and pressure space Q, we introduce subspaces Vh
and Qh based on three different meshes: triangulations Th1 , Th2 , and quadrangulation Th ,
8 LONG CHEN

× × × ×

× × × ×

× × × ×

× × × ×

× × × × × ×
(a) Mesh Th1 for u (b) Mesh Th2 for v (c) Mesh Th for p

F IGURE 5. The meshes for velocity and pressure

as shown in Figure 5. The triangulations Th1 and Th2 are modified from quadrangulations in
Han and Wu [3] by dividing rectangles into triangles using diagonals with positive slope.
Corresponding to the triangulations Th1 and Th2 , we define

V1h = {uh ∈ H01 (Ω) : uh |τ is a linear function, for all τ ∈ Th1 },


V2h = {vh ∈ H01 (Ω) : vh |τ is a linear function, for all τ ∈ Th2 },

and denote by Vh = V1h × V2h . Corresponding to the quadrangulation Th , we define

Qh = {qh ∈ L20 (Ω) : qh |τ = constant, for all τ ∈ Th }.


To discuss the boundary condition more conveniently, we introduce more notation. We
denote the boundary of Ω as Γ. The set of nodes for the velocity is denoted by Ωh and the
boundary nodes by Γh . The near boundary (nb) nodes for velocity is defined as:
Γunb = {(x, y) is a vertex of type ◦ | y = h/2 or 1 − h/2},
Γvnb = {(x, y) is a vertex of type × | x = h/2 or 1 − h/2},
Γnb = (Γunb , Γvnb ).
With a slight abuse of notation, we also use Γunb , Γvnb , Γnb , Ωh etc. to denote the indices

set. The interior nodes set is defined as Ωh = Ωh \(Γh ∪ Γnb ).
The discrete problem reads as: find (uh , ph ) ∈ Vh × Qh , such that
(
a(uh , v h ) + b(v h , ph ) = (f , v h ) for all v h ∈ Vh ,
(16)
b(uh , qh ) = 0 for all qh ∈ Qh .

With appropriate numerical quadrature, we are able to get a variant of MAC scheme.
It is easy to verify that the interior stencil corresponding to a(·, ·) is (4, −1, −1, −1, −1).
For near boundary nodes, again we take u as an example to derive the boundary stencil as
shown in Figure 6.
Denote the basis at point 1 as φ1 = (λ1 , 0)T , straightforward computation yields the
stencil for the near boundary node 1 is
9 3 3
a(uh , φ1 ) = u1 − u4 − u2 − u5 − 2u0 ,
2 4 4
FINITE DIFFERENCE METHOD FOR STOKES EQUATIONS: MAC SCHEME 9

4
3

τ3
τ4
τ2
p1 τ5 1 p2 2
h
5 τ1
y= 2
τ6
6
ih 0

F IGURE 6. Stencil computation for the near boundary points.

and the corresponding stencil will be denoted by


9 3 3
(17) ( , −1, − , − , −2).
2 4 4
One point quadrature at point 1 in Figure 6 is used to compute b(φ1 , ph ):
6 Z
X
b(φ1 , ph ) = − div φ1 · ph ≈ bh (φ1 , ph ) = h(p2 − p1 ),
i=1 τi
R
which is equivalent to use the middle point quadrature when computing e u · n ds for an
edge of the cell. That is
Z XZ
b(uh , χτ ) = − div uh dx = − uh · n ds ≈ h(ui,j+1 − ui,j ) + h(v i,j − v i+1,j ).
τ e∈∂τ e

Define the corresponding linear operators:


A : Vh → V0h , and hAuh , v h i = a(uh , v h ),
and


B : Vh → Q0h , B T : Qh → V0h , and hBv h , qh i = v h , B T qh := bh (v h , qh ).
And define the functional f h , f I ∈ V0h :
(18) hf h , v h i := (f , v h ) , for all v h ∈ Vh ,
and
Nu
X
(19) hf I , v h i = (f I , v h )h := h2 f (xi )v(xi ) , for all v h ∈ Vh ,
i=1

where xi is the velocity nodes. The inner product (·, ·)h is a discrete version of the L2 -inner
product (·, ·) of V. One can easily show that (u, u)h h (u, u) for any u ∈ V.
Using these notation, we can write the discrete problem (16) in the operator form:
    
A BT uh Πh f
(20) = .
B 0 ph 0
where (uh , ph ) ∈ Xh := Vh × Qh , Πh f = f h or f I , and (Πh f , 0) ∈ Yh := V0h × Q0h .
10 LONG CHEN

3.2. Connection between FE and FD. For the finite difference schemes and the finite
element scheme (20), we get the same stencil for the divergence operator, and the same
stencil for the interior part for the Laplacian operator. The only difference is the near
boundary stencil of the Laplacian operator, which accounts for different ways of imposing
the Dirichlet boundary condition. We explore their connection below.
First we define the relation between vectors and functions and that between matrices and
operators. We chose the standard hat basis function for Vh and the characteristic functions
of cells as the basis for Qh . Then a function can be identified as its coordinate vector and
vice verse. We put an arrow to indicate this isomorphism. For example, for uh ∈ Vh ,
~ h ∈ RNu is its coordinate vector and similarly for ph ∈ Qh , p~h ∈ RNp is its vector
u
representation. The following identities can be used to define a matrix by a linear operator
and vice verse:
(21) hAuh , v h i = ~v ht A~
~ uh ,

(22) ~ uh .
hBuh , qh i = ~qht B~
In the rest of this notes, we will mix the usage of a matrix form or operator form which
should be clear by the context.
Therefore we can rewrite the MAC schemes using operator notation
    
AL B T uh fI
(23) = ,
B 0 ph 0
    
AQ BT uh fI
(24) = .
B 0 ph 0
where AL corresponds to the stencil (8) and AQ for (9). The corresponding Stokes operator
will be denoted by Llh and Lqh , respectively.
We can now show the connection between finite difference methods and the finite el-
ement method using these notation. For the linear extrapolated finite difference scheme
(23), we denote AΓ = AL − A. By direct calculation, A ~ Γ has stencil ( 1 , − 1 , − 1 ) on Γnb
2 4 4
and equal to zero on all other parts.
For the quadratic extrapolated finite difference scheme (24), we denote matrix D: ~

~ = 4 I~ on Γnb .

(25) ~ = I~ in
D Ωh ,
D
3
~Q = D
Then we can easily verify the relation: A ~A~ by the stencil (9) and (17).
We shall prove the stability of schemes (23) and (24) by the stability results of finite
element method presented in [3] using these relations.

3.3. Stability of MAC Schemes. Following results of Lemma 4 and Lemma 6 in [3], we
have the stability of the finite element scheme as below. For completeness, we sketch a
proof below.
Lemma 3.1. There exists α, β > 0 independent of h, such that
hAuh , v h i hAuh , v h i
(26) inf sup = inf sup = α,
v h ∈Vh uh ∈Vh kuh kA kv h kA uh ∈Vh v h ∈Vh kuh kA kv h kA

hqh , Bv h i
(27) inf sup = β.
qh ∈Qh v h ∈Vh kqh kkv h kA
FINITE DIFFERENCE METHOD FOR STOKES EQUATIONS: MAC SCHEME 11

Proof. The inf-sup condition for A is trivial since hAuh , v h i = (∇uh , ∇v h ) is an inner
product on H 10 .
The inf-sup condition for B is more involved. For a given qh , the inf-sup condition in
the continuous level is applied to find v ∈ H 10 such that div v = qh and kvkA . kqh k.
Then a bounded Fortin operator Ih : H01 → Vh is defined such that div v = div Ih v, and
kIh vkA . kvkA . Let v h = Ih v, then we have div v h = qh and kv h kA . kqh k.
To define a Fortin operator, we first apply the integration by parts and write
Z Z
div u dx = u · n ds.
τ ∂τ

On the vertical edges, we define the nodal valueR on Th as the average of the integral of
1

x-component of velocity, i.e.R uh (xi , yj )h = e u ds. Similarly we define y-component


of velocity vh (xi , yj )h = e v ds. Therefore the boundary integral are preserved and
consequently
bh (uh , χτ ) = b(u, χτ ).
The H 1 -stability of such operator can be proved similarly as that in P1CR − P0 pairs for
Stokes equations; see Chapter: Finite element method for Stokes equations. 

The inf-sup condition of AL is based on the following norm equivalence. The finite
difference scheme is fitted into the finite element space, so that the trace theorem which
plays an essential role in the proof can be applied.
Lemma 3.2. The norm defined by AL is equivalent to the norm defined by A, that is:
(28) hAuh , uh i ≤ hAL uh , uh i . hAuh , uh i.
Consequently, the bilinear form hAL u, vi is stable in k · kA .
~L = A
Proof. Recall that A ~+A
~ Γ with A
~ Γ = ( 1 , − 1 , − 1 ) on Γnb . Therefore
2 4 4

hAL uh , uh i = hAuh , uh i + hAΓ uh , uh i


Noticing hAΓ uh , uh i = 4h|uh |21,Γnb ≥ 0, we easily get the first inequality. To prove the
other inequality, it is sufficient to prove:
hAΓ uh , uh i . hAuh , uh i.
By the inverse inequality and the trace theorem of H 1 (Ω), we obtain:
(29) hAΓ uh , uh i = 4h|uh |21,Γnb . |uh |21 ,Γnb . |uh |21,Ω . hAuh , uh i.
2

Since k · kAL is equivalent to k · kA , we conclude the stability of hAL u, vi by that of


hAu, vi . 

Then we study the non-symmetric case AQ . By the Lax-Milgram Lemma, it sufficies


to prove the corcevity and ellipticity of the bilinear form defined by AQ .
Lemma 3.3. The bilinear form defined by hAQ uh , v h i satisfies the following properties.
(1) Corcevity:
(30) hAQ uh , uh i ≥ kuh k2A , ∀uh ∈ Vh .
(2) Ellipticity:
(31) hAQ uh , v h i . kuh kA kv h kA , ∀uh , v h ∈ Vh .
12 LONG CHEN

~Q − A
Proof. The proof of the first part (30) is trivial, since A ~ = (D
~ − I)
~A ~ is semi-positive
definite. For the second part:
(32) hAQ uh , v h i = hAuh , Dv h i ≤ kuh kA kDv h kA .
It suffices to prove kDuh kA . kuh kA . To simplify the notation, we replace uh with
~ Γnb = I~Γnb u
u. We define uΓnb such that its coordinate vector u ~ . We can thus write
Du = u + 3 uΓnb .
1

We rewrite the A-norm as


X X 3 X
kuk2A = u ~ tA
~u~ = (ui − uj )2 + (ui − uj )2 + 2u2i ,
4
◦ i6=j,ij ⊂Γnb i∈Γnb
i6=j,ij ⊂Ωh

where ij denotes the edge connecting the i, j-th vertices.


We estimate the norm kuΓnb kA as:
X X 3 X 3
kuΓnb k2A = u~ tA
~u~ = u2i + (ui − uj )2 + 2u2i ≤ kuk2A .
4 2
i∈Γnb i6=j,ij ⊂Γnb i∈Γnb

In the last step, we have use the explicit formula of the stencil (9). By the triangle inequal-
ity,
1 1
kDukA = ku + uΓnb kA ≤ kukA + kuΓnb kA ,
3 3
√ √
we then get kDukA ≤ (1 + 6)/ 6kukA . 

Since the operator B is the same in all three schemes, by the relation (28) and (30)
of the norm defined by A, AL , and AQ , the inf-sup condition for B is also satisfied. We
summarize as the following theorem:
Theorem 3.4. Let uh , ph be the solution of any MAC scheme (23) , (24) and (20). We
have the stability result:
(33) |uh |1 + kph k . kf h k−1,h

In the operator form, kL−1 l −1


h kYh →Xh + k(Lh ) kYh →Xh + k(Lqh )−1 kYh →Xh ≤ C.
3.4. Consistency of MAC schemes. In this section, we prove the consistency of MAC
schemes using quadratic extrapolation and linear extrapolation. Although the consistency
error for boundary stencils is one order lower, using trace theorem, the overall consistency
error is second order for the quadratic extrapolation and first order for the linear one in the
right norm k · k−1,h .

3.4.1. Consistency error of the quadratic extrapolation. Let us do the truncation error
analysis for the near boundary nodes. Again we take the point (ih, h2 ) for u component as
an example. Consider the following Taylor series expansions:
(34)
h h2 h3
u(ih, 0) = u(ih, 0.5h) − uy (ih, 0.5h) + uyy (ih, 0.5h) − uyyy (ih, 0.5h) + O(h4 ),
2 8 48
(35)
h2 h3
u(ih, 1.5h) = u(ih, 0.5h) + uy (ih, 0.5h)h + uyy (ih, 0.5h) + uyyy (ih, 0.5h) + O(h4 ).
2 6
FINITE DIFFERENCE METHOD FOR STOKES EQUATIONS: MAC SCHEME 13

Multiplying (34) by 2 and taking summation with (35) yields the following first order
approximation
 
4 2u0 − 3u1 + u2
(36) − uyy (ih, 0.5h) = − + O(h).
3 h2
Thus the scheme for the momentum equation of u at point 1 in Figure 6 (y = 0.5h) is
4 2u0 − 3u1 + u2 u3 − 2u1 + u4 p2 − p1
− · 2
− 2
+ = f1 .
3 h h h
The scheme derived above for the near boundary points at the top is equivalent to the
quadratic extrapolated scheme (24). From the truncation error analysis, it is clear that the
quadratic extrapolated MAC scheme (24) is second order at the interior nodes but only first
order at the near boundary nodes. However, the difference of Πh Lx and Lqh Ih x will still
be second order under the weaker norm k · k−1,h .
◦ ◦
For any v h ∈ Vh , we denote v h := v Γnb + v h . It is obvious that k v h k ≤ kv h k.

Following the proof of Lemma 3.3, one can also prove | v h |1 . |v h |1 .
Lemma 3.5. For a function f ∈ H 2 (Ω) and its interpolation f I defined in (19), we have
◦ ◦
(37) |(f , v h ) − hf I , v h i| . h2 |f |2 kv h k, for any v h ∈ Vh .
Proof. For any interior basis function φi , i = N R b + 1, Nb + 2, ..., Nu , we consider the
linear functional ϕi (f ) = (f , φi ) − hf I , φi i = f φi − h2 f i . Since the support of φi is
symmetric, it is easy to check that the functional is bounded, and has zero value on linear
functions. By the standard scaling argument and the Bramble-Hilbert lemma, we have
|(f , φi ) − hf I , φi i| . h2 |f |2 . Then summing up with weight, we have
N Z
X u Nu
X
◦ ◦ ◦
(f , v h ) − hf I , v h i = f v i φi − 2
h f i v i . h2 |f |2 k v h k

i=Nb +1 i=Nb +1
.

1 T
Lemma 3.6. Assume u ∈ H 0 (Ω)∩W 3,∞ (Ω), ∆u ∈ H 2 (Ω), and p ∈ L20 (Ω) W 3,∞ (Ω).
For x = (u, p)t and Πh f = f I , we have:
(38) kΠh Lx − Lqh Ih xkYh . (kuk3,∞ + k∆uk2 + kpk3,∞ )h2
Proof. For any z h = (v h , qh ) ∈ Xh ,
|hΠh y − Lqh xI , z h i| = |hf I − Lqh xI , v h i| + |h0 − Lqh xI , qh i| := I1 + I2 .
The second term I2 can be easily estimated as
Nu +Np
X
I2 ≤ kh−2 BuI k∞ h2 |qh (xi )| . h2 kuk3,∞ kqh k.
i=Nu +1

Here we use the fact h BuI is the second order central difference scheme of − div u at
−2

cell centers.
We further split I1 into u and p parts as
I1 ≤ |h−(∆u)I − AQ uI , v h i| + |h(∇p)I − B T pI , v h i| = I1u + I1p .
Let ~tp be the vector representation of (∇p)I − h−2 B T pI . It is easy to verify, by the
Taylor series, k~tp k∞ . h2 kpk3,∞ . Then
I1p = (~tp , ~v h )h ≤ k~tp kh k~v h kh . h2 kpk3,∞ kv h k . h2 kpk3,∞ |v h |1 .
14 LONG CHEN

To estimate I1u , we further split it into the sum of near boundary part and interior part.

I1u ≤ |h−(∆u)I − AQ uI , v Γnb i| + |h−(∆u)I − AQ uI , v h i| = I11 + I12 .
Due to the density of C 3 (Ω) in W 3,∞ (Ω), by the Taylor expansion analysis (36), for the
near boundary nodes, i.e., 1 ≤ i ≤ Nb ,
|(−(∆u)I − h−2 AQ uI )(xi )| ≤ Chkuk3,∞ .
We can then estimate the near boundary part I11 as follows:
Nb
X
I11 . hkuk3,∞ h2 |v h (xi )| . h2 kuk3,∞ kv h kL1 (Γnb ) . h2 kuk3,∞ |v h |1 .
i=1

In the last inequality, we have applied the trace theorem for H 1 functions.
To estimate I12 , we interpret the finite difference scheme as the finite element scheme
while both methods get the same stencil for the interior part. We have
◦ ◦
I12 = |h(4u)I − 4u, v h i + h∇(u − uI ), ∇ v h i|
. h2 (k∆uk2 + kuk3 )|v h |1 .

In the above deducing, we have used Lemma 3.5 and the estimate |h∇(u − uI , ∇ v h i| .
h2 kuk3 |v h |1 on uniform grids; see for example [2].
Combining the estimate of I1 and I2 we have
|hΠh y − Lqh xI , z h i| . h2 (kuk3,∞ + k4uk2 + kpk3,∞ )kz h kXh
and Lemma 38 follows from the definition of the dual norm k · kYh . 
3.4.2. Consistency error of the linear extrapolation. For the near boundary stencil of the
linear extrapolated MAC (23), the scheme approximates −uxx − 43 uyy but not −∆u at
Γunb , which causes the loss of consistency near the boundary.
T
Lemma 3.7. Assume u ∈ H 10 ∩ W 3,∞ (Ω), ∆u ∈ H 2 (Ω), p ∈ L20 (Ω) W 3,∞ (Ω). For
x = (u, p)t and Πh f = f I , we have:
(39) kΠh Lx − Llh Ih xkYh . (kuk3,∞ + k4uk2 + kpk3,∞ )h
Proof. The proof is similar to (38) with the only different term is I11 for which
|(−(∆u)I − h−2 AL uI )(xi )| ≤ Ckuk3,∞ .
Therefore we can get the first order estimate
Nb
X
I11 . kuk3,∞ h2 |v h (xi )| . h2 kuk3,∞ kv h kL1 (Γnb ) . hkuk3,∞ |v h |1 .
i=1


3.5. Convergence. Based on the stability and consistency, we present our main results.
Theorem 3.8. Let uh , ph be the solution of the MAC scheme (24) with quadratic extrap-
olation, and let uI , pI be the nodal interpolation of the solution
T u, p of Stokes equations.
Assume u ∈ H 10 (Ω) ∩ W 3,∞ (Ω), ∆u ∈ H 2 (Ω), and p ∈ L20 W 3,∞ (Ω). Then
|uI − uh |1 + kpI − ph k . (kuk3,∞ + k4uk2 + kpk3,∞ )h2
Similarly for linear extrapolation MAC, only first order convergence is obtained.
FINITE DIFFERENCE METHOD FOR STOKES EQUATIONS: MAC SCHEME 15

Theorem 3.9. Let uh , ph be the solution of the MAC scheme (23) with linear extrapolation,
and let uI , pI be the nodal interpolation of the solution
T u, p of Stokes equations. Assume
u ∈ H 10 (Ω) ∩ W 3,∞ (Ω), ∆u ∈ H 2 (Ω), and p ∈ L20 W 3,∞ (Ω). Then
|uI − uh |1 + kpI − ph k . (kuk3,∞ + k4uk2 + kpk3,∞ )h
Remark 3.10. Using triangle inequality and interpolation error estimate, we can easily
get the first order convergence of linear extrapolation which is equivalent to MAC using
co-volume method in Niclaides [5]. In view of approximation theory, first order is already
optimal. The second order result for the quadratic extrapolation is known as superconver-
gence, i.e., two discrete solutions could be more closer.
Using the following discrete embedding theorem (in two dimensions only)
kv h k∞ . | log h||vh |1 ,
and the second order interpolation error estimate
ku − uI k∞ . kuk2,∞ h2 ,
we obtain the nearly second order maximum norm for the quadratic extrapolation scheme.
Corollary 3.11. Let uh , ph be the solution of the MAC scheme (24) with quadratic extrapo-
lation. Assume the solution
T u, p of Stokes equations satisfying u ∈ H 10 (Ω)∩W 3,∞ (Ω), ∆u ∈
H 2 (Ω), and p ∈ L20 W 3,∞ (Ω). Then
ku − uh k∞ . (kuk3,∞ + k4uk2 + kpk3,∞ )| log h|h2 .

ACKNOWLEDGMENT
Thanks for Wang Ming for the help on the preparation of the tex file, especially those
nice figures.

R EFERENCES
[1] A. Brandt and N. Dinar. Multi-grid solutions to elliptic flow problems. Technical Report 79, Institute for
Computer Applications in Science and Engineering. NASA Langley Research Center, Hampton, Virginia,
New York, 1979.
[2] J. Brandts and M. Krizek. Gradient superconvergence on uniform simplicial partitions of polytopes. IMA
journal of numerical analysis, 23:489–505, 2003.
[3] H. Han and X. Wu. A New Mixed Finite Element Formulation and the MAC Method for the Stokes Equations.
SIAM J. Numer. Anal., 35(2):560–571, 1998.
[4] F. H. Harlow and J. E. Welch. Numerical calculation of time-dependent viscous incompressible flow of fluid
with free surface. Physics of fluids, 8(12):2182, 1965.
[5] R. A. Nicolaides. Analysis and Convergence of the MAC Scheme. I. The Linear Problem. SIAM J. Numer.
Anal., 29(6):1579–1591, 1992.

S-ar putea să vă placă și