[petsc-dev] KSPMonitor and petsc4py

Smith, Barry F. bsmith at mcs.anl.gov
Sun Mar 3 21:15:49 CST 2019


   Pierre,

     I can confirm the problem.

   Lisandro,

     Could you please take a look at this? I have no explanation for why this would happen.

   Barry



> On Feb 25, 2019, at 1:21 PM, Pierre Jolivet via petsc-dev <petsc-dev at mcs.anl.gov> wrote:
> 
> 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