From b27f3a8ecbb998fbb04d73c6c5ef2e5bde5dc5b0 Mon Sep 17 00:00:00 2001 From: Umberto Zerbinati Date: Fri, 28 Jun 2024 02:02:06 +0100 Subject: [PATCH] Fix after Patrick comments --- docs/src/PETScKSP/poisson.py.rst | 18 ++++++++---------- docs/src/PETScPC/stokes.py.rst | 6 +++--- docs/src/SLEPcEPS/poisson.py.rst | 2 +- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/docs/src/PETScKSP/poisson.py.rst b/docs/src/PETScKSP/poisson.py.rst index 2d84431..5667607 100644 --- a/docs/src/PETScKSP/poisson.py.rst +++ b/docs/src/PETScKSP/poisson.py.rst @@ -101,15 +101,13 @@ We do this changing the flag :code:`"pc_type"` to :code:`"gamg"` :: - 35 We can also use the PETSc `BDDC` preconditioner. -Once again we will select this option via the flag :code:`"pc_type"` flag. -We will also use the flag :code:`"ksp_rtol"` to obtain a more accurate solution of the linear system. :: +Once again we will select this option via the flag :code:`"pc_type"` flag. :: solver = KrylovSolver(a, fes.FreeDofs(), solverParameters={"ksp_type": "cg", "ksp_monitor": "", "pc_type": "bddc", - "ngs_mat_type": "is", - "ksp_rtol": 1e-10}) + "ngs_mat_type": "is"}) gfu = GridFunction(fes) solver.solve(f.vec, gfu.vec) print ("BDDC L2-error:", sqrt (Integrate ( (gfu-exact)*(gfu-exact), mesh))) @@ -126,11 +124,11 @@ We will also use the flag :code:`"ksp_rtol"` to obtain a more accurate solution * - PETSc GAMG - 35 * - PETSc BDDC (N=2) - - 10 + - 5 * - PETSc BDDC (N=4) - - 12 + - 7 * - PETSc BDDC (N=6) - - 14 + - 9 We can see that for an increasing number of subdomains :math:`N` the number of iterations also increases. Notice that in all the cases we have considered, the :code:`KrylovSolver` class creates a PETSc matrix from the NGSolve matrix in order to assemble the required preconditioners. @@ -163,11 +161,11 @@ We will now use the :code:`KrylovSolver` class in a matrix-free fashion with the * - PETSc GAMG - 35 * - PETSc BDDC (N=2) - - 10 + - 5 * - PETSc BDDC (N=4) - - 12 + - 7 * - PETSc BDDC (N=6) - - 14 + - 9 * - Element-wise BDDC - 14 diff --git a/docs/src/PETScPC/stokes.py.rst b/docs/src/PETScPC/stokes.py.rst index 044d34d..85cd9d4 100755 --- a/docs/src/PETScPC/stokes.py.rst +++ b/docs/src/PETScPC/stokes.py.rst @@ -1,8 +1,8 @@ -Boffi-Lovadina Augmentation for Bernardi-Raugel discretisation of the Stokes problem +Augmented Lagrangian preconditioning for P2-P0 discretisation of the Stokes problem ====================================================================================== -In this tutorial, we explore constructing preconditioners for Bernardi-Raugel discretisations of the Stokes problem with Boffi-Lovadina augmentation. -In particular, we will consider a Bernardi-Raugel inf-sup stable discretisation of the Stokes problem, i.e. +In this tutorial, we explore constructing preconditioners for discretisations of the Stokes problem with Boffi-Lovadina augmentation. +In particular, we will consider a P2-P0 inf-sup stable discretisation of the Stokes problem, i.e. .. math:: diff --git a/docs/src/SLEPcEPS/poisson.py.rst b/docs/src/SLEPcEPS/poisson.py.rst index fd1eac1..ac0d8ba 100644 --- a/docs/src/SLEPcEPS/poisson.py.rst +++ b/docs/src/SLEPcEPS/poisson.py.rst @@ -71,7 +71,7 @@ We can discretise this problem using NGSolve as follows: :: m.Assemble() We can again solve the eigenvalue problem using ngsPETSc's `EigenSolver` class. -The mass matrix now has a large kernel, hence is no longer symmetric positive definite, therefore we can not use LOBPCG as a solver. +The matrix on the right-hand side of the generalised eigenvalue problem now has a large kernel, hence is no longer symmetric positive definite, therefore we can not use LOBPCG as a solver. Instead, we will use a Krylov-Schur solver with a shift-and-invert spectral transformation to target the smallest eigenvalues. Notice that because we are using a shift-and-invert spectral transformation we only need to invert the stiffness matrix which has a trivial kernel since we are using an inf-sup stable discretisation. If we tried to use a simple shift transformation to target the largest eigenvalues we would have run into the error of trying to invert a singular matrix.::