Hi everyone,
I am solving a linear problem with the PETSc.KSP solver.
I have turned on the ksp_view option and I get nice info from the solver.
solver = PETSc.KSP().create(my_domain.comm)
opts = PETSc.Options()
opts[“ksp_type”] = “cg”
opts[“ksp_view”] = None
solver.setFromOptions()
But how do I turn off the view option (this is few pages of output for each solve)?
thanks!
(dolfinx, jupyter, macos)
nate
October 26, 2022, 3:57pm
2
You can just remove it, or comment it out, e.g.
# opts[“ksp_view”] = None
If you only want to view it at some specific point you can call ksp.view()
where ksp
is your PETSc KSP
instantiation.
dokken
October 26, 2022, 4:11pm
3
You can also set options for individual solvers by using a option prefix. This is for instance done in: dolfinx/petsc.py at 3d6b15eb947fc42342e26c484ba31a3c46658e32 · FEniCS/dolfinx · GitHub
thank you for your answer. The problem is once I have set the ksp_view on, I cannot remove it. Commenting the line and re-executing the (jupyter) cell does not change the verbosity (I still get lots of info). (Of course, if I restart the kernel, this is OK…)
Thanks for the solver.view() trick.