This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

custom preconditioner

+7 votes

I'd like to precondition a linear solve $Ax=b$ with the inverse of another linear operator $B$.
Is there a way to define preconditioning objects in Python with FEniCS?

asked Jul 4, 2013 by nschloe FEniCS User (7,120 points)

2 Answers

+3 votes
 
Best answer

Yes, look at the class KrylovSolver and in particular the function

set_operators(A, P)

Check stokes-iterative demo for example.

answered Jul 4, 2013 by logg FEniCS Expert (11,790 points)
selected Jul 18, 2013 by nschloe

The documentation of KrylovSolver is a bit unclear here. With the preconditioner P, are we solving $PAx=Pb$, $P^{-1}Ax = P^{-1}b$, or are we talking about a right preconditioner altogether? How are the systems $P^{-1}$ solved/approximated, and how can I influence the solution parameters?

I think this works differently. By set_operators(A, P) you just supply $A$ and $P\approx A$ or (typically $P=A$) which is used in a construction of actual preconditioning $Q^{-1}Ax=Q^{-1}b$ or $AQ^{-1}Qx=b$. Operator $Q\approx P$ is constructed by actual preconditioning algorithm outside of DOLFIN.

+4 votes

Use PETScUserPreconditioner. You just supply method for calculation of values of mapping $b\rightarrow B^{-1}b$.

answered Jul 5, 2013 by Jan Blechta FEniCS Expert (51,420 points)
...