1434 *
catch (std::exception &exc)
1436 * std::cerr << std::endl
1438 * <<
"----------------------------------------------------"
1440 * std::cerr <<
"Exception on processing: " << std::endl
1441 * << exc.what() << std::endl
1442 * <<
"Aborting!" << std::endl
1443 * <<
"----------------------------------------------------"
1449 * std::cerr << std::endl
1451 * <<
"----------------------------------------------------"
1453 * std::cerr <<
"Unknown exception!" << std::endl
1454 * <<
"Aborting!" << std::endl
1455 * <<
"----------------------------------------------------"
1462<a name=
"Results"></a><h1>Results</h1>
1465Now we use the method we discussed above to solve Navier Stokes equations with
1466viscosity @f$1/400@f$ and @f$1/7500@f$.
1468<a name=
"Testcase1LowReynoldsNumber"></a><h3> Test
case 1: Low Reynolds Number </h3>
1471In the
first test
case the viscosity is
set to be @f$1/400@f$. As we discussed in the
1472introduction, the
initial guess is the solution to the corresponding Stokes
1473problem. In the following table, the residuals at each Newton
's iteration on
1474every mesh is shown. The data in the table shows that Newton's iteration
1475converges quadratically.
1477<table align=
"center" class=
"doxtable">
1479 <th>@f$\mathrm{Re}=400@f$</th>
1480 <th colspan=
"2">Mesh0</th>
1481 <th colspan=
"2">Mesh1</th>
1482 <th colspan=
"2">Mesh2</th>
1483 <th colspan=
"2">Mesh3</th>
1484 <th colspan=
"2">Mesh4</th>
1487 <th>Newton iter </th>
1584The following figures show the sequence of generated grids. For the
case
1585of @f$\mathrm{Re}=400@f$, the
initial guess is obtained by solving Stokes on an
1586@f$8 \times 8@f$ mesh, and the mesh is refined adaptively. Between meshes, the
1587solution from the coarse mesh is interpolated to the fine mesh to be used as an
1590<table align=
"center">
1593 <img src=
"https://www.dealii.org/images/steps/developer/step-57.Re400_Mesh0.png" width=
"232px" alt=
"">
1596 <img src=
"https://www.dealii.org/images/steps/developer/step-57.Re400_Mesh1.png" width=
"232px" alt=
"">
1599 <img src=
"https://www.dealii.org/images/steps/developer/step-57.Re400_Mesh2.png" width=
"232px" alt=
"">
1604 <img src=
"https://www.dealii.org/images/steps/developer/step-57.Re400_Mesh3.png" width=
"232px" alt=
"">
1607 <img src=
"https://www.dealii.org/images/steps/developer/step-57.Re400_Mesh4.png" width=
"232px" alt=
"">
1612This picture is the graphical streamline result of lid-driven cavity with
1613@f$\mathrm{Re}=400@f$.
1614<img src=
"https://www.dealii.org/images/steps/developer/step-57.Re400_Streamline.png" alt=
"">
1616Then the solution is compared with a reference solution
1617from @cite Ghia1982 and the reference solution data can be found in the file
"ref_2d_ghia_u.txt".
1619<img src=
"https://www.dealii.org/images/steps/developer/step-57.compare-Re400.svg" style=
"width:50%" alt=
"">
1623<a name=
"Testcase2HighReynoldsNumber"></a><h3> Test
case 2: High Reynolds Number </h3>
1626Newton
's iteration requires a good initial guess. However, the nonlinear term
1627dominates when the Reynolds number is large, so that the solution to the Stokes
1628equations may be far away from the exact solution. If the Stokes solution acts
1629as the initial guess, the convergence will be lost. The following picture
1630shows that the nonlinear iteration gets stuck and the residual no longer decreases
1631in further iterations.
1633<img src="https://www.dealii.org/images/steps/developer/step-57.Re7500_loss_convergence.svg" style="width:50%" alt="">
1635The initial guess, therefore, has to be obtained via a continuation method
1636which has been discussed in the introduction. Here the step size in the continuation method, that is @f$|\nu_{i}-\nu_{i+1}|@f$, is 2000 and the initial
1637mesh is of size @f$32 \times 32@f$. After obtaining an initial guess, the mesh is
1638refined as in the previous test case. The following picture shows that at each
1639refinement Newton's iteration has quadratic convergence. 52 steps of Newton
's
1640iterations are executed for solving this test case.
1642<img src="https://www.dealii.org/images/steps/developer/step-57.Re7500_get_convergence.svg" style="width:50%" alt="">
1644We also show the residual from each step of Newton's iteration on every
1645mesh. The quadratic convergence is clearly visible in the table.
1647<table align=
"center" class=
"doxtable">
1649 <th>@f$\mathrm{Re}=7500@f$</th>
1650 <th colspan=
"2">Mesh0</th>
1651 <th colspan=
"2">Mesh1</th>
1652 <th colspan=
"2">Mesh2</th>
1653 <th colspan=
"2">Mesh3</th>
1654 <th colspan=
"2">Mesh4</th>
1657 <th>Newton iter </th>
1767The sequence of generated grids looks like
this:
1768<table align=
"center">
1771 <img src=
"https://www.dealii.org/images/steps/developer/step-57.Re7500_Mesh0.png" width=
"232px" alt=
"">
1774 <img src=
"https://www.dealii.org/images/steps/developer/step-57.Re7500_Mesh1.png" width=
"232px" alt=
"">
1777 <img src=
"https://www.dealii.org/images/steps/developer/step-57.Re7500_Mesh2.png" width=
"232px" alt=
"">
1782 <img src=
"https://www.dealii.org/images/steps/developer/step-57.Re7500_Mesh3.png" width=
"232px" alt=
"">
1785 <img src=
"https://www.dealii.org/images/steps/developer/step-57.Re7500_Mesh4.png" width=
"232px" alt=
"">
1789We compare our solution with the reference solution from @cite Erturk2005 .
1790<img src=
"https://www.dealii.org/images/steps/developer/step-57.compare-Re7500.svg" style=
"width:50%" alt=
"">
1791The following picture presents the graphical result.
1792<img src=
"https://www.dealii.org/images/steps/developer/step-57.Re7500_Streamline.png" alt=
"">
1794Furthermore, the error consists of the nonlinear error,
1795which decreases as we perform Newton iterations, and the discretization error,
1796which depends on the mesh size. That is why we have to
refine the
1797mesh and repeat Newton
's iteration on the next finer mesh. From the table above, we can
1798see that the final residual (nonlinear error) is below @f$10^{-12}@f$ on each mesh, but the
1799following picture shows us the difference between solutions on subsequently finer
1802<img src="https://www.dealii.org/images/steps/developer/step-57.converge-Re7500.svg" style="width:50%" alt="">
1805<a name="extensions"></a>
1807<a name="Possibilitiesforextensions"></a><h3>Possibilities for extensions</h3>
1810<a name="Comparetoothersolvers"></a><h4>Compare to other solvers</h4>
1813It is easy to compare the currently implemented linear solver to just using
1814UMFPACK for the whole linear system. You need to remove the nullspace
1815containing the constant pressures and it is done in @ref step_56 "step-56". More interesting
1816is the comparison to other state of the art preconditioners like PCD. It turns
1817out that the preconditioner here is very competitive, as can be seen in the
1818paper @cite HeisterRapin2013.
1820The following table shows the timing results between our iterative approach
1821(FGMRES) compared to a direct solver (UMFPACK) for the whole system
1822with viscosity set to 1/400. Even though we use the same direct solver for
1823the velocity block in the iterative solver, it is considerably faster and
1824consumes less memory. This will be even more pronounced in 3d.
1826<table align="center" class="doxtable">
1828 <th>Refinement Cycle</th>
1830 <th>Iterative: Total/s (Setup/s)</th>
1831 <th>Direct: Total/s (Setup/s)</th>
1836 <td>0.10 (0.06)</td>
1837 <td>0.13 (0.12)</td>
1842 <td>0.58 (0.37)</td>
1843 <td>1.03 (0.97)</td>
1848 <td>3.59 (2.73)</td>
1849 <td>7.78 (7.53)</td>
1854 <td>29.17 (24.94)</td>
1860<a name="3dcomputations"></a><h4>3d computations</h4>
1863The code is set up to also run in 3d. Of course the reference values are
1864different, see @cite Yang1998 for example. High resolution computations are not doable
1865with this example as is, because a direct solver for the velocity block does
1866not work well in 3d. Rather, a parallel solver based on algebraic or geometric
1867multigrid is needed -- see below.
1869<a name="Parallelization"></a><h4>Parallelization</h4>
1872For larger computations, especially in 3d, it is necessary to implement MPI
1873parallel solvers and preconditioners. A good starting point would be @ref step_55 "step-55",
1874which uses algebraic multigrid for the velocity block for the Stokes
1875equations. Another option would be to take a look at the list of codes
1876in the <a href="https://www.dealii.org/code-gallery.html">deal.II code
1877gallery</a>, which already contains parallel Navier-Stokes solvers.
1880<a name="PlainProg"></a>
1881<h1> The plain program</h1>
1882@include "step-57.cc"
__global__ void set(Number *val, const Number s, const size_type N)
void refine(Triangulation< dim, spacedim > &tria, const Vector< Number > &criteria, const double threshold, const unsigned int max_to_mark=numbers::invalid_unsigned_int)