You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Driven cavity problem. The domain is [-1,1]^2. Stokes equation with zero Dirichlet boundary condition except on the top:
22
-
23
-
$$ \{ y=1; -1 <= x <= 1 | u = 1, v = 0 \}.$$
24
-
25
-
## Step 1: Gauss-Seidel smoothing of velocity
19
+
1. Gauss-Seidel smoothing of velocity to update `u`;
20
+
2. form the residual for the continuity equation `rp = g-Bu`;
21
+
3. solve the Poisson equation for pressure `Ap*ep = rp` by G-S;
22
+
4. distribute the correction to velocity by `u = u + B'*ep`;
23
+
5. update the pressure by `p = p - Ap*ep`.
26
24
27
-
Given a pressure approximation, relax the momentum equation to update velocity. See [Project: Multigrid Methods](projectMG.md) on the matrixfree implemenation of G-S relaxation.
25
+
Every step can be implemented in a matrix-free version.
28
26
29
-
Note that the boundary or near boundary dof should be updated diffeently. The stencil should be changed according to different boundary conditions.
27
+
Then use DGS as an iterative method to solve the Stokes equation for a fixed level. As the level increases, the iteration steps will increase to achieve the same tolerance, e.g. the relative residual norm is less than $10^{-3}$.
To debug your code, let the exact solution be zero. Start from a random initial guess. The DGS iteration will push all unknowns to zero.
32
30
33
-
1. Gauss-Seidel smoothing of velocity to update `u`;
34
-
* form the residual for the continuity equation `rp = g-Bu`;
35
-
* solve the Poisson equation for pressure `Ap*ep = rp` by G-S;
36
-
* distribute the correction to velocity by `u = u + B'*ep`;
37
-
* update the pressure by `p = p - Ap*ep`.
38
31
39
-
Every step can be implemented in a matrix-free version; see [Progamming of MAC for Stokes equations](http://math.uci.edu/~chenlong/226/MACcode.pdf).
40
32
41
-
Use DGS as an iterative method to solve the Stokes equation. The iteration steps could be very large but will converges.
42
-
43
-
# Step 3: Two level method
33
+
## Step 2: Two Level Method
44
34
45
35
The two level method is
46
36
47
-
1.presmoothing by DGS
48
-
* form residuals for momentum and continunity equations
49
-
* restrict the residual to the coarse grid
50
-
* iterate DGS in the coarse grid till converge
51
-
* prolongate the correction to the fine grid
52
-
* postsmoothing by DGS
37
+
1.Presmoothing by DGS
38
+
2. Form residuals for momentum and continunity equations
39
+
3. Restrict the residual to the coarse grid
40
+
4. Use DGS in the coarse grid till converge (Step 1)
41
+
5. Prolongate the correction to the fine grid
42
+
6. Postsmoothing by DGS
53
43
54
-
Note: the index map between coarse and fine grids are slightly different for `u,v,p`; see [Progamming of MAC for Stokes equations](http://math.uci.edu/~chenlong/226/MACcode.pdf).
44
+
Note: the index map between coarse and fine grids are slightly different for `u,v,p`.
55
45
56
46
Test your two level methods for different levels. It should convergence in less than 20 steps and indepedent of the number of levels.
57
47
58
-
## Step 4: Vcycle multigrid method
59
48
60
-
Recrusively apply the two-level method to the coarse grid problem
61
-
in the previous step to get a V-cycle method.
62
49
63
-
* Test the convergence of Vcycle method. Record the iteration steps needed to push the relative residual smaller than a tolerance.
50
+
## Step 3: Vcycle Multigrid Method
51
+
52
+
Recrusively apply the two-level method to the coarse grid problem in the previous step to get a V-cycle method.
53
+
54
+
* Test the convergence of Vcycle method. Record the iteration steps needed to push the relative residual smaller than a tolerance say $10^{-3}$.
64
55
65
56
* Compute the error between the computed approximation to the exact solution and show the convergence rate in terms of mesh size `h`.
57
+
58
+
59
+
60
+
## Step 4: Test Examples
61
+
62
+
1.**Analytic solution.** We use a simple model of colliding flow with analytic solutions to test the code. The domain is $[-1,1]^2$ Compute the data `f` and Dirichlet boundary condition `g_D` for the analytic solution:
63
+
$$
64
+
u = 20xy^3; \quad v = 5x^4 - 5y^4; \quad p = 60x^2y - 20y^3 + {\rm constant}.
65
+
$$
66
+
Choose the constant s.t. the integral of $p$ over the domain is zero.
67
+
68
+
2.**Driven cavity problem.** The domain is $[-1,1]^2$ . Stokes equation with $f=0,g=0$ and zero Dirichlet boundary condition except on the top:
0 commit comments