Log-level using PETScSNESSolver

Hi, I am using the PETScSNESSolver in the following way

solver_PETSc = PETScSNESSolver()
PETScOptions.set(“ksp_type”, “gmres”)

and solve my PDE via “solver_PETSc.solve(…)”

I want to suppress the terminal output. I tried both set_log_level(50) and set_log_active(False), but they did not suppress an output of the form

0 SNES Function norm 1.568206992927e-02
1 SNES Function norm 2.443894349845e-08
2 SNES Function norm 2.642940850512e-14
0 SNES Function norm 1.230183641735e-04
1 SNES Function norm 2.016155140597e-12

Is there a different command for the log level of the Petsc solver?

you could try setting solver_PETSc.parameters["krylov_solver"]["monitor_convergence"]=False

as shown here: Bitbucket

1 Like

Thanks a lot for your answer. Actually, this command did not work, but I checked the link and there is also the line

solver_PETSc.parameters[“report”] = False

and this one suppresses the output :slight_smile: Thanks again! :slightly_smiling_face: