Documentos de Académico
Documentos de Profesional
Documentos de Cultura
1
1 Introduction
2 Problem Setup
w 1 2
+ p = (w )w + w, (2.1)
t Re
w = 0, (2.2)
for some 2-dimensional domain and given boundary and initial conditions.
1
where w = (u, v) is the velocity field, p is the pressure of the system, and Re
1
ut + px = (u2 )x (uv)y + (uxx + vyy ), (2.3)
Re
1
vt + py = (v 2 )x (uv)x + (vxx + vyy ), (2.4)
Re
ux + vy = 0, (2.5)
u(x, 1, t) = 1, (2.9)
2
For visualization purposes, we introduce the stream function, q, which denotes
the path of a particle at any instance in time. The stream function is defined
the time evolution independently from the spatial one, i.e we need to solve the
spatial part at each time step. To do so, we use Chorins projection method [1],
field. The main idea behind the projection method is to ignore the pressure
3
Recall the PDE:
1
ut + px = (u2 )x (uv)y + (uxx + vyy ), (3.1)
Re
1
vt + py = (v 2 )x (uv)x + (vxx + vyy ), (3.2)
Re
ux + vy = 0, (3.3)
U Un
= ((U n )2 )x (U n V n )y (3.4)
t
VVn
= ((V n )2 )y (U n V n )x . (3.5)
t
at any given time step n, for some intermediate values U , V . Now, for some
U U 1
= (U + Uyy
) (3.6)
t Re xx
V V 1
= (V + Vyy
). (3.7)
t Re xx
We then perform the pressure correction to the previous terms and obtain
U n+1 U
= (P n+1 )x (3.8)
t
V n+1 V
= (P n+1 )y , (3.9)
t
Wn+1 Wn
= P n+1 , (3.10)
t t
4
where W = (U, V ). Note that if we take the divergence on both sides of 3.10,
Lastly, the stream function can be computed by taking the gradient on both
(Q) = W Qx = V, Qy = U (3.12)
= 2 Q = Uy Vx (3.14)
Note that with this formulation we are solving Poissons equation 4 times (one
for each of the parameters we are interested on) on each time step. This in turns
results ideal since Laplaces equation is one of the most studied PDEs and given
its matrix form we can apply numerically efficient algorithms such as Multigrid
and Conjugate Gradient. We use a staggered grid and a finite difference scheme
the non-linear terms is given in [4]. The evolution in time is given by a Taylor
time-stepping.
Following the approach in [1], [2] and [4], we use a staggered grid with the
pressure p in the cell midpoints, the velocities u placed on the vertical cell inter-
faces, and the velocities v placed on the horizontal cell interfaces. The stream
5
Figure 3.1: Depiction of the staggered grid.
Thanks to the discretization used, we are left with four Laplaces equations
that can be solved iteratively. Note, however, that there are other approaches
namely Conjugate Gradient and Multigrid, and see how they compare. Addi-
tionally, we also compute the solution of those Laplaces equations via MAT-
6
appropriate algorithm in order to solve directly. For all experiments run we
consider grid-sizes of the form 2n , since this is a more friendly mesh-size for the
multigrid method.
rithm. Note that there are more advanced forms of this algorithm that include
4.1.2 2D Multigrid
[3]. The algorithm is given bellow. The only difference between the 1D and
operators are constructed. Denote the restriction operator by IhH and the inter-
h
polation operator by IH . Denote the coarsest mesh-size by h0 and let H = 2h.
with initial guess x0 , using nu iterations. The algorithm is shown in Figure 4.2.
7
Figure 4.2: V-Cycle Algorithm, as given in [3].
In the previous case, we denote the 2-D interpolation operator by the Kronecker
h
IH = ihH ihH , (4.1)
where
1
2
1
1
1
ihH
= 2 . (4.2)
2
..
1
.
1
2
1
Moreover, we get that the restriction operator can be associated with the inter-
polation operator by
h
I2h = 4(Ih2h )T . (4.3)
8
4.2 Testing the Solvers
We implement the solver for the Navier-Stokes equation using both conjugate
gradient and 2-D multigrid on a matrix of size 4096 4096 using a 2 3 GHz
Quad-Core Intel Xeon with 16GB RAM . The results obtained are shown in
figure 4.3 and 4.4. On Figure 4.3, we get the norm of the residuals provided at
each level of the of the v-cycle, being step 1 and 5 the finest coarse size and 3
being the coarsest one. We are relaxing 4 times on each level using Gauss-Seidel.
Figure 4.4 shows the residuals for conjugate gradient. Note that for U and V
the convergence is pretty fast, whilst it takes a larger number of iterations for
both methods (see next section). In general, it can be said that both methods
9
Figure 4.3: Residuals Multigrid. Top: U, V. Bottom P,Q.
10
4.3 Results and Comparison
Solving the 2D Navier-Stokes equation on a square grid [0, 1] with N 2 points and
integrating for t [0, 1] and using CG, Multigrid (V-cycle), and MATLABs \
(which uses a Cholesky factorization given that the matrices are sparse, SPD)
in order to solve the arising Laplaces equations, we obtain the running times
As we can see from Table 4.1, multigrid is much more efficient than both con-
solver runs faster than our version of CG, however, this could be in part because
of the heavy optimization that the backslash solver has and the fact that we
where n is the number of restarts, however, this method proved to be very inef-
ficient, even when the number of restarts was low. Moreover, this method has
A visualization of the result is given by Figure 4.5, where we denote the pressure
field in color, the streamline function, that is, the trajectory a particle would
take at any given point by the contour plot, and the velocity as a vector field.
11
Re = 1e+03 t = 0.01 x 10
3
Re = 1e+03 t = 0.2 Re = 1e+03 t = 0.4 Re = 1e+03 t = 0.6 Re = 1e+03 t = 0.8
1 1 1 1 1
2
0.9 0.9 0.9 0.9 0.9
1.5
0.8 0.8 0.8 0.8 0.8
0.5
y
0.5
0.3 0.3 0.3 0.3 0.3
0 0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0 0.2 0.4 0.6 0.8 1
x
Figure 4.5: Progression of the solution for different times, from left to right,
5 Final Remarks
tioned before, GMRES was not included in the analysis since when doing the
than conjugate gradient. This is due to the fact that we are dealing with very
large matrices and as such, the GMRES algorithm needs to orthogonalize against
Given the clever idea of pressure projection we are able to solve the N-S equa-
tions by solving Laplaces equation for each of the parameters (u, v, p, q) for each
fast numerical algorithms that exist for these type of methods. In this case we
fast numerical methods that we did not considered, such as spectral methods.
12
In general, we consider that the methods used in this project have been proved
13
References
[1] A.J. Chorin, Numerical solution of the Navier-Stokes equations. Math. Com-
[3] Y. Saad. Iterative methods for sparse linear systems. Society for Industrial
14