[petsc-dev] KSPMonitor and petsc4py

Pierre Jolivet pierre.jolivet at enseeiht.fr
Mon Feb 25 13:21:26 CST 2019


I’m not sure this is the expected behavior. Is it?
$ git diff ex100.py
diff --git a/src/ksp/ksp/examples/tutorials/ex100.py b/src/ksp/ksp/examples/tutorials/ex100.py
index dbb3f8e012..051637ce1d 100644
--- a/src/ksp/ksp/examples/tutorials/ex100.py
+++ b/src/ksp/ksp/examples/tutorials/ex100.py
@@ -29,6 +29,7 @@ def RunTest():
     ksp.setOperators(A, A)
     ksp.setFromOptions()
     ksp.solve(b, x)
+    ksp.solve(b, x)

     r = b.duplicate()
     A.mult(x, r)

$ mpirun -np 8 python ./ex100.py -ksp_converged_reason -ksp_monitor
  0 KSP Residual norm 5.101520253035e-04
  1 KSP Residual norm 1.168905135944e-03
[..]
 12 KSP Residual norm 5.101520253035e-05
 13 KSP Residual norm 7.504522604366e-20
Linear solve converged due to CONVERGED_RTOL iterations 13
 13 KSP Residual norm 5.101520253035e-04
 14 KSP Residual norm 1.168905135944e-03
[..]
 25 KSP Residual norm 5.101520253035e-05
 26 KSP Residual norm 7.504522604366e-20
Linear solve converged due to CONVERGED_RTOL iterations 26

Shouldn’t the iterate number be reset to 0 for the 2nd KSPSolve?

Thanks,
Pierre


More information about the petsc-dev mailing list