1431 *
catch (std::exception &exc)
1433 * std::cerr << std::endl
1435 * <<
"----------------------------------------------------"
1437 * std::cerr <<
"Exception on processing: " << std::endl
1438 * << exc.what() << std::endl
1439 * <<
"Aborting!" << std::endl
1440 * <<
"----------------------------------------------------"
1446 * std::cerr << std::endl
1448 * <<
"----------------------------------------------------"
1450 * std::cerr <<
"Unknown exception!" << std::endl
1451 * <<
"Aborting!" << std::endl
1452 * <<
"----------------------------------------------------"
1459<a name=
"Results"></a><h1>Results</h1>
1462Now we use the method we discussed above to solve Navier Stokes equations with
1463viscosity @f$1/400@f$ and @f$1/7500@f$.
1465<a name=
"Testcase1LowReynoldsNumber"></a><h3> Test
case 1: Low Reynolds Number </h3>
1468In the
first test
case the viscosity is
set to be @f$1/400@f$. As we discussed in the
1469introduction, the
initial guess is the solution to the corresponding Stokes
1470problem. In the following table, the residuals at each Newton
's iteration on
1471every mesh is shown. The data in the table shows that Newton's iteration
1472converges quadratically.
1474<table align=
"center" class=
"doxtable">
1476 <th>@f$\mathrm{Re}=400@f$</th>
1477 <th colspan=
"2">Mesh0</th>
1478 <th colspan=
"2">Mesh1</th>
1479 <th colspan=
"2">Mesh2</th>
1480 <th colspan=
"2">Mesh3</th>
1481 <th colspan=
"2">Mesh4</th>
1484 <th>Newton iter </th>
1581The following figures show the sequence of generated grids. For the
case
1582of @f$\mathrm{Re}=400@f$, the
initial guess is obtained by solving Stokes on an
1583@f$8 \times 8@f$ mesh, and the mesh is refined adaptively. Between meshes, the
1584solution from the coarse mesh is interpolated to the fine mesh to be used as an
1587<table align=
"center">
1590 <img src=
"https://www.dealii.org/images/steps/developer/step-57.Re400_Mesh0.png" width=
"232px" alt=
"">
1593 <img src=
"https://www.dealii.org/images/steps/developer/step-57.Re400_Mesh1.png" width=
"232px" alt=
"">
1596 <img src=
"https://www.dealii.org/images/steps/developer/step-57.Re400_Mesh2.png" width=
"232px" alt=
"">
1601 <img src=
"https://www.dealii.org/images/steps/developer/step-57.Re400_Mesh3.png" width=
"232px" alt=
"">
1604 <img src=
"https://www.dealii.org/images/steps/developer/step-57.Re400_Mesh4.png" width=
"232px" alt=
"">
1609This picture is the graphical streamline result of lid-driven cavity with
1610@f$\mathrm{Re}=400@f$.
1611<img src=
"https://www.dealii.org/images/steps/developer/step-57.Re400_Streamline.png" alt=
"">
1613Then the solution is compared with a reference solution
1614from [4] and the reference solution data can be found in the file
"ref_2d_ghia_u.txt".
1616<img src=
"https://www.dealii.org/images/steps/developer/step-57.compare-Re400.svg" style=
"width:50%" alt=
"">
1618<a name=
"Testcase2HighReynoldsNumber"></a><h3> Test
case 2: High Reynolds Number </h3>
1621Newton
's iteration requires a good initial guess. However, the nonlinear term
1622dominates when the Reynolds number is large, so that the solution to the Stokes
1623equations may be far away from the exact solution. If the Stokes solution acts
1624as the initial guess, the convergence will be lost. The following picture
1625shows that the nonlinear iteration gets stuck and the residual no longer decreases
1626in further iterations.
1628<img src="https://www.dealii.org/images/steps/developer/step-57.Re7500_loss_convergence.svg" style="width:50%" alt="">
1630The initial guess, therefore, has to be obtained via a continuation method
1631which 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
1632mesh is of size @f$32 \times 32@f$. After obtaining an initial guess, the mesh is
1633refined as in the previous test case. The following picture shows that at each
1634refinement Newton's iteration has quadratic convergence. 52 steps of Newton
's
1635iterations are executed for solving this test case.
1637<img src="https://www.dealii.org/images/steps/developer/step-57.Re7500_get_convergence.svg" style="width:50%" alt="">
1639We also show the residual from each step of Newton's iteration on every
1640mesh. The quadratic convergence is clearly visible in the table.
1642<table align=
"center" class=
"doxtable">
1644 <th>@f$\mathrm{Re}=7500@f$</th>
1645 <th colspan=
"2">Mesh0</th>
1646 <th colspan=
"2">Mesh1</th>
1647 <th colspan=
"2">Mesh2</th>
1648 <th colspan=
"2">Mesh3</th>
1649 <th colspan=
"2">Mesh4</th>
1652 <th>Newton iter </th>
1762The sequence of generated grids looks like
this:
1763<table align=
"center">
1766 <img src=
"https://www.dealii.org/images/steps/developer/step-57.Re7500_Mesh0.png" width=
"232px" alt=
"">
1769 <img src=
"https://www.dealii.org/images/steps/developer/step-57.Re7500_Mesh1.png" width=
"232px" alt=
"">
1772 <img src=
"https://www.dealii.org/images/steps/developer/step-57.Re7500_Mesh2.png" width=
"232px" alt=
"">
1777 <img src=
"https://www.dealii.org/images/steps/developer/step-57.Re7500_Mesh3.png" width=
"232px" alt=
"">
1780 <img src=
"https://www.dealii.org/images/steps/developer/step-57.Re7500_Mesh4.png" width=
"232px" alt=
"">
1784We compare our solution with reference solution from [5].
1785<img src=
"https://www.dealii.org/images/steps/developer/step-57.compare-Re7500.svg" style=
"width:50%" alt=
"">
1786The following picture presents the graphical result.
1787<img src=
"https://www.dealii.org/images/steps/developer/step-57.Re7500_Streamline.png" alt=
"">
1789Furthermore, the error consists of the nonlinear error,
1790which decreases as we perform Newton iterations, and the discretization error,
1791which depends on the mesh size. That is why we have to
refine the
1792mesh and repeat Newton
's iteration on the next finer mesh. From the table above, we can
1793see that the residual (nonlinear error) is below 1e-12 on each mesh, but the
1794following picture shows us the difference between solutions on subsequently finer
1797<img src="https://www.dealii.org/images/steps/developer/step-57.converge-Re7500.svg" style="width:50%" alt="">
1799<a name="extensions"></a>
1801<a name="Possibilitiesforextensions"></a><h3>Possibilities for extensions</h3>
1804<a name="Comparetoothersolvers"></a><h4>Compare to other solvers</h4>
1807It is easy to compare the currently implemented linear solver to just using
1808UMFPACK for the whole linear system. You need to remove the nullspace
1809containing the constant pressures and it is done in @ref step_56 "step-56". More interesting
1810is the comparison to other state of the art preconditioners like PCD. It turns
1811out that the preconditioner here is very competitive, as can be seen in the
1814The following table shows the timing results between our iterative approach
1815(FGMRES) compared to a direct solver (UMFPACK) for the whole system
1816with viscosity set to 1/400. Even though we use the same direct solver for
1817the velocity block in the iterative solver, it is considerably faster and
1818consumes less memory. This will be even more pronounced in 3d.
1820<table align="center" class="doxtable">
1822 <th>Refinement Cycle</th>
1824 <th>Iterative: Total/s (Setup/s)</th>
1825 <th>Direct: Total/s (Setup/s)</th>
1830 <td>0.10 (0.06)</td>
1831 <td>0.13 (0.12)</td>
1836 <td>0.58 (0.37)</td>
1837 <td>1.03 (0.97)</td>
1842 <td>3.59 (2.73)</td>
1843 <td>7.78 (7.53)</td>
1848 <td>29.17 (24.94)</td>
1854<a name="3dcomputations"></a><h4>3d computations</h4>
1857The code is set up to also run in 3d. Of course the reference values are
1858different, see [6] for example. High resolution computations are not doable
1859with this example as is, because a direct solver for the velocity block does
1860not work well in 3d. Rather, a parallel solver based on algebraic or geometric
1861multigrid is needed. See below.
1863<a name="Parallelization"></a><h4>Parallelization</h4>
1866For larger computations, especially in 3d, it is necessary to implement MPI
1867parallel solvers and preconditioners. A good starting point would be @ref step_55 "step-55",
1868which uses algebraic multigrid for the velocity block for the Stokes
1869equations. Another option would be to take a look at the list of codes
1870in the <a href="https://www.dealii.org/code-gallery.html">deal.II code
1871gallery</a>, which already contains parallel Navier-Stokes solvers.
1874<a name="PlainProg"></a>
1875<h1> The plain program</h1>
1876@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)