Thanks Barry. I think have found the trouble. The user-provided routine UserSOR takes in input the parameter its, which is the number of relaxations (its=2 in my case). I didn't understand this fact, then I wrote UserSOR as a single relaxation. Now I added a code line: "while(its--)" at the beginning of UserSOR and everything is fine. It remains unclear why the preconditioned residual is zero, but now the code works.
Best regards, Armando petsc-users-request at mcs.anl.gov ha scritto: > Send petsc-users mailing list submissions to > petsc-users at mcs.anl.gov > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.mcs.anl.gov/mailman/listinfo/petsc-users > or, via email, send a message with subject or body 'help' to > petsc-users-request at mcs.anl.gov > > You can reach the person managing the list at > petsc-users-owner at mcs.anl.gov > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of petsc-users digest..." > > > Today's Topics: > > 1. number of pre- and post- smoothing in multigrid as a > preconditioner (coco at dmi.unict.it) > 2. Re: number of pre- and post- smoothing in multigrid as a > preconditioner (Barry Smith) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Thu, 24 May 2012 01:04:56 +0200 > From: coco at dmi.unict.it > To: petsc-users at mcs.anl.gov > Subject: [petsc-users] number of pre- and post- smoothing in multigrid > as a preconditioner > Message-ID: > <20120524010456.Horde.I1kaUuph4B9PvW0YaN4gN_A at mbox.dmi.unict.it> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed; DelSp=Yes > > Dear all, > > I am using multigrid as a preconditioner and I noticed that if I try > to perform 2 or more pre (or post) smoothing I obtain the same results > as I perform just 1 smoothing. The ksp_view output is the following: > > [...] > > Down solver (pre-smoother) on level 1 ------------------------------- > KSP Object: (mg_levels_1_) 1 MPI processes > type: richardson > Richardson: damping factor=1 > maximum iterations=2, initial guess is zero > tolerances: relative=0, absolute=0, divergence=inf > left preconditioning > using PRECONDITIONED norm type for convergence test > PC Object: (mg_levels_1_) 1 MPI processes > type: sor > SOR: type = local_symmetric, iterations = 1, local iterations > = 1, omega = 1 > linear system matrix = precond matrix: > Matrix Object: 1 MPI processes > type: shell > rows=18522, cols=18522 > > [...] > > Even if maximum iterations=2 and the tolerances are zeros, it performs > just one iteration. Anyway, the converged reason for the down smoother > is 4, then it seems it converges with the maximum iterations, but the > results I obtain are the same as in the case I set 1 pre smoothing. > I implemented the relaxation in a routine UserSOR and I registered it > as MATOP_SOR for the matrix of the kspSmootherDown context (together > with a MATOP_MULT). > > Finally, the output of the KSPMonitorTrueResidualNorm() for the first > iteration is: > 1 KSP preconditioned resid norm 0.000000000000e+00 true resid norm > 5.094557710929e+02 ||r(i)||/||b|| 2.001351267432e+00 > > Thank you. > Armando > > > > ------------------------------ > > Message: 2 > Date: Wed, 23 May 2012 18:15:31 -0500 > From: Barry Smith <bsmith at mcs.anl.gov> > To: PETSc users list <petsc-users at mcs.anl.gov> > Subject: Re: [petsc-users] number of pre- and post- smoothing in > multigrid as a preconditioner > Message-ID: <0D966127-FEB5-47E8-9290-F6D89DAD907C at mcs.anl.gov> > Content-Type: text/plain; charset=us-ascii > > > On May 23, 2012, at 6:04 PM, coco at dmi.unict.it wrote: > >> Dear all, >> >> I am using multigrid as a preconditioner and I noticed that if I >> try to perform 2 or more pre (or post) smoothing I obtain the same >> results as I perform just 1 smoothing. The ksp_view output is the >> following: >> >> [...] >> >> Down solver (pre-smoother) on level 1 ------------------------------- >> KSP Object: (mg_levels_1_) 1 MPI processes >> type: richardson >> Richardson: damping factor=1 >> maximum iterations=2, initial guess is zero >> tolerances: relative=0, absolute=0, divergence=inf >> left preconditioning >> using PRECONDITIONED norm type for convergence test >> PC Object: (mg_levels_1_) 1 MPI processes >> type: sor >> SOR: type = local_symmetric, iterations = 1, local >> iterations = 1, omega = 1 >> linear system matrix = precond matrix: >> Matrix Object: 1 MPI processes >> type: shell >> rows=18522, cols=18522 >> >> [...] >> >> Even if maximum iterations=2 and the tolerances are zeros, it >> performs just one iteration. Anyway, the converged reason for the >> down smoother is 4, then it seems it converges with the maximum >> iterations, but the results I obtain are the same as in the case I >> set 1 pre smoothing. >> I implemented the relaxation in a routine UserSOR and I registered >> it as MATOP_SOR for the matrix of the kspSmootherDown context >> (together with a MATOP_MULT). >> >> Finally, the output of the KSPMonitorTrueResidualNorm() for the >> first iteration is: >> 1 KSP preconditioned resid norm 0.000000000000e+00 true resid norm >> 5.094557710929e+02 ||r(i)||/||b|| 2.001351267432e+00 > > With that 0 residual norm it has to stop. Something is wrong that > the preconditioned residual is 0 while unpreconditioned is nonzero. > That cannot be true to since the smoother is suppose to be a linear > operator. Investigate why the it thinks the preconditioned residual > is 0 but the nonpreconditioned is not. > > Barry > >> >> Thank you. >> Armando >> > > > > ------------------------------ > > _______________________________________________ > petsc-users mailing list > petsc-users at mcs.anl.gov > https://lists.mcs.anl.gov/mailman/listinfo/petsc-users > > > End of petsc-users Digest, Vol 41, Issue 90 > *******************************************
