From: Timo Heister <timo.heister@gmail.com> Date: Tue, 17 Jan 2017 16:04:55 +0000 (-0500) Subject: address some left-over comments X-Git-Tag: v8.5.0-rc1~227^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F3116%2Fhead;p=dealii.git address some left-over comments --- diff --git a/examples/step-57/doc/intro.dox b/examples/step-57/doc/intro.dox index be97c6f08d..396f4eac5a 100644 --- a/examples/step-57/doc/intro.dox +++ b/examples/step-57/doc/intro.dox @@ -125,9 +125,11 @@ Now, Newton's iteration can be used to solve for the update terms: <li> Initialization: Initial guess $u_0$ and $p_0$, tolerance $\tau$; <li> Linear solve to compute update term $\delta\textbf{u}^{k}$ and $\delta p^k$; <li> Update the approximation: $\textbf{u}^{k+1} = \textbf{u}^{k} + \delta\textbf{u}^{k}$ and $p^{k+1} = p^{k} + \delta p^{k}$; - <li> Check residual norm: $E^{k+1} = \|F(\mathbf{u}^{k+1}, p^{k+1})\|$. - If $E^{k+1} \leq \tau$, STOP. - If $E^{k+1} > \tau$, back to step 2. + <li> Check residual norm: $E^{k+1} = \|F(\mathbf{u}^{k+1}, p^{k+1})\|$: + <ul> + <li>If $E^{k+1} \leq \tau$, STOP. + <li>If $E^{k+1} > \tau$, back to step 2. + </ul> </ol> <h3> Finding an Initial Guess </h3> @@ -236,7 +238,7 @@ Instead of solving the above system, we can solve the equivalent system \right) @f} with a parameter $\gamma$ and an invertible matrix W. Here -$\gamma B^TW^{-1}B & B^{T}$ is the Augmented Lagrangian term and +$\gamma B^TW^{-1}B$ is the Augmented Lagrangian term and see [1] for details. Denoting the system matrix of the new system by $G$ and the right-hand diff --git a/examples/step-57/doc/results.dox b/examples/step-57/doc/results.dox index f1475d646d..86d9c8c7a4 100644 --- a/examples/step-57/doc/results.dox +++ b/examples/step-57/doc/results.dox @@ -20,7 +20,7 @@ every mesh is shown. The data in the table shows that Newton's iteration converg <th colspan="2">Mesh4</th> </tr> <tr> - <th>Newton's iter </th> + <th>Newton iter </th> <th>Residual </th> <th>FGMRES </th> <th>Residual </th> @@ -33,112 +33,112 @@ every mesh is shown. The data in the table shows that Newton's iteration converg <th>FGMRES </th> </tr> <tr> - <th>1 </th> - <th>7.40396e-3</th> - <th>3 </th> - <th>1.05562e-3 </th> - <th>3 </th> - <th>4.94796e-4 </th> - <th>3 </th> - <th>2.5624e-4 </th> - <th>2 </th> - <th>1.26733e-4 </th> - <th>2 </th> + <td>1 </td> + <td>7.40396e-3</td> + <td>3 </td> + <td>1.05562e-3 </td> + <td>3 </td> + <td>4.94796e-4 </td> + <td>3 </td> + <td>2.5624e-4 </td> + <td>2 </td> + <td>1.26733e-4 </td> + <td>2 </td> </tr> <tr> - <th>2 </th> - <th>3.86766e-3 </th> - <th>4 </th> - <th>1.3549e-5 </th> - <th>3 </th> - <th>1.41981e-6 </th> - <th>3 </th> - <th>1.29108e-6 </th> - <th>4 </th> - <th>6.14794e-7 </th> - <th>4 </th> + <td>2 </td> + <td>3.86766e-3 </td> + <td>4 </td> + <td>1.3549e-5 </td> + <td>3 </td> + <td>1.41981e-6 </td> + <td>3 </td> + <td>1.29108e-6 </td> + <td>4 </td> + <td>6.14794e-7 </td> + <td>4 </td> </tr> <tr> - <th>3 </th> - <th>1.60421e-3</th> - <th>4 </th> - <th>1.24836e-9 </th> - <th>3 </th> - <th>9.11557e-11 </th> - <th>3 </th> - <th>3.35933e-11 </th> - <th>3 </th> - <th>5.86734e-11 </th> - <th>2 </th> + <td>3 </td> + <td>1.60421e-3</td> + <td>4 </td> + <td>1.24836e-9 </td> + <td>3 </td> + <td>9.11557e-11 </td> + <td>3 </td> + <td>3.35933e-11 </td> + <td>3 </td> + <td>5.86734e-11 </td> + <td>2 </td> </tr> <tr> - <th>4 </th> - <th>9.26748e-4 </th> - <th>4 </th> - <th>2.75537e-14 </th> - <th>4 </th> - <th>1.39986e-14 </th> - <th>5 </th> - <th>2.18864e-14 </th> - <th>5 </th> - <th>3.38787e-14 </th> - <th>5 </th> + <td>4 </td> + <td>9.26748e-4 </td> + <td>4 </td> + <td>2.75537e-14 </td> + <td>4 </td> + <td>1.39986e-14 </td> + <td>5 </td> + <td>2.18864e-14 </td> + <td>5 </td> + <td>3.38787e-14 </td> + <td>5 </td> </tr> <tr> - <th>5 </th> - <th>1.34601e-5</th> - <th>4 </th> - <th> </th> - <th> </th> - <th> </th> - <th> </th> - <th> </th> - <th> </th> - <th> </th> - <th> </th> + <td>5 </td> + <td>1.34601e-5</td> + <td>4 </td> + <td> </td> + <td> </td> + <td> </td> + <td> </td> + <td> </td> + <td> </td> + <td> </td> + <td> </td> </tr> <tr> - <th>6 </th> - <th>2.5235e-8 </th> - <th>5 </th> - <th> </th> - <th> </th> - <th> </th> - <th> </th> - <th> </th> - <th> </th> - <th> </th> - <th> </th> + <td>6 </td> + <td>2.5235e-8 </td> + <td>5 </td> + <td> </td> + <td> </td> + <td> </td> + <td> </td> + <td> </td> + <td> </td> + <td> </td> + <td> </td> </tr> <tr> - <th>7 </th> - <th>1.38899e-12 </th> - <th>4 </th> - <th> </th> - <th> </th> - <th> </th> - <th> </th> - <th> </th> - <th> </th> - <th> </th> - <th> </th> + <td>7 </td> + <td>1.38899e-12 </td> + <td>4 </td> + <td> </td> + <td> </td> + <td> </td> + <td> </td> + <td> </td> + <td> </td> + <td> </td> + <td> </td> </tr> <tr> - <th>8 </th> - <th>4.68224e-15 </th> - <th>4 </th> - <th> </th> - <th> </th> - <th> </th> - <th> </th> - <th> </th> - <th> </th> - <th> </th> - <th> </th> + <td>8 </td> + <td>4.68224e-15 </td> + <td>4 </td> + <td> </td> + <td> </td> + <td> </td> + <td> </td> + <td> </td> + <td> </td> + <td> </td> + <td> </td> </tr> </table> -The following figures show the sequence of the generated grids. For the case +The following figures show the sequence of generated grids. For the case of Re=400, the initial guess is obtained by solving Stokes on an $8 \times 8$ mesh, and the mesh is refined adaptively. Between meshes, the solution from the coarse mesh is interpolated to the fine mesh to be used as an initial guess. @@ -193,11 +193,10 @@ iterations are executed for solving this test case. <img src="https://www.dealii.org/images/steps/developer/step-57.Re7500_get_convergence.svg" style="width:50%" alt=""> -Also we show the residual from each step of Newton's iteration on every -mesh. The quadratic convergence is shown clearly in the table. +We also show the residual from each step of Newton's iteration on every +mesh. The quadratic convergence is clearly visible in the table. <table align="center" border="1"> - <tr> <th> </th> <th colspan="2">Mesh0</th> @@ -206,9 +205,8 @@ mesh. The quadratic convergence is shown clearly in the table. <th colspan="2">Mesh3</th> <th colspan="2">Mesh4</th> </tr> - <tr> - <th>Newton's iter </th> + <th>Newton iter </th> <th>Residual </th> <th>FGMRES </th> <th>Residual </th> @@ -220,103 +218,96 @@ mesh. The quadratic convergence is shown clearly in the table. <th>Residual </th> <th>FGMRES </th> </tr> - <tr> - <th>1 </th> - <th>1.89223e-6 </th> - <th>6 </th> - <th>4.2506e-3 </th> - <th>3 </th> - <th>1.42993e-3 </th> - <th>3 </th> - <th>4.87932e-4 </th> - <th>2 </th> - <th>1.89981e-04 </th> - <th>2 </th> + <td>1 </td> + <td>1.89223e-6 </td> + <td>6 </td> + <td>4.2506e-3 </td> + <td>3 </td> + <td>1.42993e-3 </td> + <td>3 </td> + <td>4.87932e-4 </td> + <td>2 </td> + <td>1.89981e-04 </td> + <td>2 </td> </tr> - <tr> - <th>2 </th> - <th>3.16439e-9</th> - <th>8 </th> - <th>1.3732e-3 </th> - <th>7 </th> - <th>4.15062e-4 </th> - <th>7 </th> - <th>9.11191e-5 </th> - <th>8 </th> - <th>1.35553e-5</th> - <th>8 </th> + <td>2 </td> + <td>3.16439e-9</td> + <td>8 </td> + <td>1.3732e-3 </td> + <td>7 </td> + <td>4.15062e-4 </td> + <td>7 </td> + <td>9.11191e-5 </td> + <td>8 </td> + <td>1.35553e-5</td> + <td>8 </td> </tr> - <tr> - <th>3 </th> - <th>1.7628e-14</th> - <th>9 </th> - <th>2.19455e-4 </th> - <th>6 </th> - <th>1.78805e-5 </th> - <th>6 </th> - <th>5.26782e-7 </th> - <th>7 </th> - <th>9.37391e-9 </th> - <th>7 </th> + <td>3 </td> + <td>1.7628e-14</td> + <td>9 </td> + <td>2.19455e-4 </td> + <td>6 </td> + <td>1.78805e-5 </td> + <td>6 </td> + <td>5.26782e-7 </td> + <td>7 </td> + <td>9.37391e-9 </td> + <td>7 </td> </tr> - <tr> - <th>4 </th> - <th> </th> - <th> </th> - <th>8.82693e-6 </th> - <th>6 </th> - <th>6.82096e-9 </th> - <th>7 </th> - <th>2.27696e-11 </th> - <th>8 </th> - <th>1.25899e-13</th> - <th>9 </th> + <td>4 </td> + <td> </td> + <td> </td> + <td>8.82693e-6 </td> + <td>6 </td> + <td>6.82096e-9 </td> + <td>7 </td> + <td>2.27696e-11 </td> + <td>8 </td> + <td>1.25899e-13</td> + <td>9 </td> </tr> - <tr> - <th>5 </th> - <th> </th> - <th> </th> - <th>1.29739e-7</th> - <th>7 </th> - <th>1.25167e-13 </th> - <th>9 </th> - <th>1.76128e-14 </th> - <th>10 </th> - <th> </th> - <th> </th> + <td>5 </td> + <td> </td> + <td> </td> + <td>1.29739e-7</td> + <td>7 </td> + <td>1.25167e-13 </td> + <td>9 </td> + <td>1.76128e-14 </td> + <td>10 </td> + <td> </td> + <td> </td> </tr> - <tr> - <th>6 </th> - <th> </th> - <th> </th> - <th>4.43518e-11</th> - <th>7 </th> - <th> </th> - <th> </th> - <th> </th> - <th> </th> - <th> </th> - <th> </th> + <td>6 </td> + <td> </td> + <td> </td> + <td>4.43518e-11</td> + <td>7 </td> + <td> </td> + <td> </td> + <td> </td> + <td> </td> + <td> </td> + <td> </td> </tr> - <tr> - <th>7 </th> - <th> </th> - <th> </th> - <th>6.42323e-15 </th> - <th>9 </th> - <th> </th> - <th> </th> - <th> </th> - <th> </th> - <th> </th> - <th> </th> + <td>7 </td> + <td> </td> + <td> </td> + <td>6.42323e-15 </td> + <td>9 </td> + <td> </td> + <td> </td> + <td> </td> + <td> </td> + <td> </td> + <td> </td> </tr> </table> The sequence of generated grids looks like this: @@ -377,40 +368,35 @@ consumes less memory. This will be even more pronounced in 3d. <table align="center" border="1"> <tr> - <td>Ref</td> - <td>DoFs</td> - <td>Iterative: Total/s (Setup/s)</td> - <td>Direct: Total/s (Setup/s)</td> + <th>Ref</th> + <th>DoFs</th> + <th>Iterative: Total/s (Setup/s)</th> + <th>Direct: Total/s (Setup/s)</th> </tr> - <tr> <td>5</td> <td>9539</td> <td>0.10 (0.06)</td> <td>0.13 (0.12)</td> </tr> - <tr> <td>6</td> <td>37507</td> <td>0.58 (0.37)</td> <td>1.03 (0.97)</td> </tr> - <tr> <td>7</td> <td>148739</td> <td>3.59 (2.73)</td> <td>7.78 (7.53)</td> </tr> - <tr> <td>8</td> <td>592387</td> <td>29.17 (24.94)</td> <td>(>4GB RAM)</td> </tr> - </table> diff --git a/examples/step-57/step-57.cc b/examples/step-57/step-57.cc index 468df2e0f2..0760f493cf 100644 --- a/examples/step-57/step-57.cc +++ b/examples/step-57/step-57.cc @@ -189,7 +189,7 @@ namespace Step57 // Schur complement preconditioner is defined in this part. As discussed in // the introduction, the preconditioner in Krylov iterative methods is // implemented as a matrix-vector product operator. In practice, the Schur - // complement preconditioner is decomposed as a product of three matrices(as + // complement preconditioner is decomposed as a product of three matrices (as // presented in the first section). The $\tilde{A}^{-1}$ in the first factor // involves a solve for the linear system $\tilde{A}x=b$. Here we solve // this system via a direct solver for simplicity. The computation involved @@ -516,6 +516,13 @@ namespace Step57 { pressure_mass_matrix.reinit(sparsity_pattern.block(1,1)); pressure_mass_matrix.copy_from(system_matrix.block(1,1)); + + // Note that settings this pressure block to zero is not identical to + // not assembling anything in this block, because this operation here + // will (incorrectly) delete diagonal entries that come in from + // hanging node constraints for pressure DoFs. This means that our + // whole system matrix will have rows that are completely + // zero. Luckily, FGMRES handles these rows without any problem. system_matrix.block(1,1) = 0; } } @@ -545,7 +552,7 @@ namespace Step57 { const ConstraintMatrix &constraints_used = initial_step ? nonzero_constraints : zero_constraints; - SolverControl solver_control (system_matrix.m(),1e-4*system_rhs.l2_norm(), true); + SolverControl solver_control (system_matrix.m(), 1e-4*system_rhs.l2_norm(), true); SolverFGMRES<BlockVector<double> > gmres(solver_control); SparseILU<double> pmass_preconditioner;