Kirill Voronin <[email protected]> writes: > Hello! > > Thanks Matthew Knepley and Barry Smith for the answers to my previous > questions! > > I am solving Ax = b with PETSC BiCGStab with user-defined preconditioner > and want to compare it with other iteration process. > > The question is > 1) > Is there a possibility to monitor a user-defined function of residual > norm(e.g., useer-defined computation of NORM_1) at each iteration of PETSC > solver?
KSPMonitorSet your own implementation, written similarly to this: http://www.mcs.anl.gov/petsc/petsc-current/src/ksp/ksp/interface/iterativ.c.html#KSPMonitorTrueResidualMaxNorm > (I cannot rewrite the user-defined routine for residual norm using > PETSC interface since it is just fixed and given to me)? > > ------ > It seems now that the residual norm (L1 = NORM_1) is calculated somewhat > different through PETSC and user-defined routine. You're comparing VecNorm(X,NORM_1,&nrm1) to a user-defined function that purports to compute the same thing? What is your implementation? > The difference is rather > small but still for comparison with other solver I would prefer to have > the same numbers. > As a result, by now I have different values of residual norms measured for > the same data by PETSC and external user-defined routine. (I checked it > just be getting arrays from PETSC vectors and then giving them to the > user-defined routine of residual norm). > > I found KSPSetConvergenceTest but the convergence is measured always in > terms of NORM_2 of the error as far as I understand. Your convergence test can use any norm you want, but it's expensive to build a residual for some Krylov methods (e.g., GMRES), so you might not be happy with the performance.
signature.asc
Description: PGP signature
