Hello, everyone!
I’m trying to solve the equation in the from of “(B-rC)w=Bv” based on the ‘cg’ iteration method with the preconditioner ‘ilu’ or ‘Jacobi’. In the equation, B is a 307724 * 307724 PETScMatrix, and the corresponding code is:
import dolfin as df
D = df.PETScMatrix(B.mat() - C.mat() * r[j])
solver = df.PETScKrylovSolver("cg", "ilu")
solver.parameters["absolute_tolerance"] = 1e-17
solver.parameters["maximum_iterations"] = 10000
solver.solve(D, w[ti], B * v[j])
After running the code, it reminded me an error shown in the below figure (the error is the same when the preconditioner is ‘ilu’ or ‘Jacobi’). What is the problem and how could I solve it?
Thanks ahead!
RuntimeError:
*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at
***
*** fenics-support@googlegroups.com
***
*** Remember to include the error message listed below and, if possible,
*** include a *minimal* running example to reproduce the error.
***
*** -------------------------------------------------------------------------
*** Error: Unable to solve linear system using PETSc Krylov solver.
*** Reason: Solution failed to converge in 10000 iterations (PETSc reason DIVERGED_ITS, residual norm ||r|| = 1.365103e-11).
*** Where: This error was encountered inside PETScKrylovSolver.cpp.
*** Process: 0
***
*** DOLFIN version: 2019.1.0
*** Git changeset: d0e78c11e813d2decc337bbee614a33128aa539f
Sorry, I forgot to provide the error information. By the way, my example producing the error is too large to show here, and this error occurs when I use the iteration solver to solve the above equation for building the Krylov subspace basis to solve the electric diffusion equation.
Actually, I also tried to use the same way to solve 2D Possion equation, and no errors occur, but when I introduce the process to the above problem, the error suddenly occurs.
Actually, I’ve tried to decrease the the value of the parameter “absolute_tolerance” to be 1e-10 for the preconditioner "jacobi’, it doesn’t return any error, but the calculation results are totally incorrect. While for the preconditioner ‘ilu’, it still returns error even without limiting the parameter “absolute_tolerance”, and the error is as follows:
RuntimeError:
*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at
***
*** fenics-support@googlegroups.com
***
*** Remember to include the error message listed below and, if possible,
*** include a *minimal* running example to reproduce the error.
***
*** -------------------------------------------------------------------------
*** Error: Unable to solve linear system using PETSc Krylov solver.
*** Reason: Solution failed to converge in 3 iterations (PETSc reason DIVERGED_INDEFINITE_PC, residual norm ||r|| = 1.424454e-03).
*** Where: This error was encountered inside PETScKrylovSolver.cpp.
*** Process: 0
***
*** DOLFIN version: 2019.1.0
*** Git changeset: d0e78c11e813d2decc337bbee614a33128aa539f
*** -------------------------------------------------------------------------