From 82a2c7072de7ea1961ad601f604cc8bf6123f708 Mon Sep 17 00:00:00 2001 From: Umberto Zerbinati Date: Tue, 4 Jun 2024 02:39:38 +0100 Subject: [PATCH] Stokes tables Signed-off-by: Umberto Zerbinati --- docs/src/PETScPC/stokes.py.rst | 36 +++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/docs/src/PETScPC/stokes.py.rst b/docs/src/PETScPC/stokes.py.rst index de32860..8bae2b9 100755 --- a/docs/src/PETScPC/stokes.py.rst +++ b/docs/src/PETScPC/stokes.py.rst @@ -73,6 +73,17 @@ We can construct the Schur complement preconditioner using the following code: : printrates=True, initialize=False) Draw(gfu) +The Schur complement preconditioner converge in a few iterations, but it is not very efficient since we need to invert the Schur complement. + +.. list-table:: Preconditioners performance + :widths: auto + :header-rows: 1 + + * - Preconditioner + - Iterations + * - Schur complement + - 4 (9.15e-14) + Notice that the Schur complement is dense hence inverting it is not a good idea. Not only that but to perform the inversion of the Schur complement had to write a lot of "boilerplate" code. Since our discretization is inf-sup stable it is possible to prove that the mass matrix of the pressure space is spectrally equivalent to the Schur complement. This means that we can use the mass matrix of the pressure space as a preconditioner for the Schur complement. @@ -93,6 +104,17 @@ We will also invert the Laplacian block using a `PETSc PC` of type `LU`. :: maxsteps=100, printrates=True, initialize=False) Draw(gfu) +.. list-table:: Preconditioners performance + :widths: auto + :header-rows: 1 + + * - Preconditioner + - Iterations + * - Schur complement + - 4 (9.15e-14) + * - Mass & LU + - 66 (2.45e-08) + We can also construct a multi-grid preconditioner for the top left block of the saddle point problem, as we have seen in :doc:`poisson.py`. :: def DoFInfo(mesh, fes): @@ -124,7 +146,19 @@ We can also construct a multi-grid preconditioner for the top left block of the solvers.MinRes (mat=K, pre=C, rhs=rhs, sol=sol, tol=1e-8, maxsteps=100, printrates=True, initialize=False) - +.. list-table:: Preconditioners performance + :widths: auto + :header-rows: 1 + + * - Preconditioner + - Iterations + * - Schur complement + - 4 (9.15e-14) + * - Mass & LU + - 66 (2.45e-08) + * - Mass & Two Level Additivew Schwarz + - 100 (4.68e-06) + The mass matrix as a preconditioner doesn't seem to be ideal, in fact, our Krylov solver took many iterations to converge with a direct LU factorization of the velocity block and did not converge at all with `HYPRE`. To resolve this issue we resort to an augmented Lagrangian formulation, i.e.