Skip to content

Commit

Permalink
Fix after Patrick comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Umberto Zerbinati committed Jun 28, 2024
1 parent 2e6ebce commit b27f3a8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
18 changes: 8 additions & 10 deletions docs/src/PETScKSP/poisson.py.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand All @@ -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.
Expand Down Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions docs/src/PETScPC/stokes.py.rst
Original file line number Diff line number Diff line change
@@ -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::
Expand Down
2 changes: 1 addition & 1 deletion docs/src/SLEPcEPS/poisson.py.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.::
Expand Down

0 comments on commit b27f3a8

Please sign in to comment.