Looks reasonable. Send the output running with 

   -ksp_monitor -mg_levels_ksp_monitor -ksp_converged_reason 
-mg_levels_ksp_converged_reason

> On Sep 26, 2025, at 1:19 PM, Moral Sanchez, Elena 
> <[email protected]> wrote:
> 
> Dear Barry,
> 
> This is -ksp_view for the smoother at the finest level:
> KSP Object: (mg_levels_1_) 1 MPI process
>   type: cg
>     variant HERMITIAN
>   maximum iterations=10, nonzero initial guess
>   tolerances: relative=0.1, absolute=0.1, divergence=1e+30
>   left preconditioning
>   using UNPRECONDITIONED norm type for convergence test
> PC Object: (mg_levels_1_) 1 MPI process
>   type: none
>   linear system matrix = precond matrix:
>   Mat Object: 1 MPI process
>     type: python
>     rows=524, cols=524
>         Python: Solver_petsc.LeastSquaresOperator
> And at the coarsest level:
> KSP Object: (mg_coarse_) 1 MPI process
>   type: cg
>     variant HERMITIAN
>   maximum iterations=100, initial guess is zero
>   tolerances: relative=0.1, absolute=0.1, divergence=1e+30
>   left preconditioning
>   using UNPRECONDITIONED norm type for convergence test
> PC Object: (mg_coarse_) 1 MPI process
>   type: none
>   linear system matrix = precond matrix:
>   Mat Object: 1 MPI process
>     type: python
>     rows=344, cols=344
>         Python: Solver_petsc.LeastSquaresOperator
> And for the whole solver:
> KSP Object: 1 MPI process
>   type: cg
>     variant HERMITIAN
>   maximum iterations=100, nonzero initial guess
>   tolerances: relative=1e-08, absolute=1e-09, divergence=10000.
>   left preconditioning
>   using UNPRECONDITIONED norm type for convergence test
> PC Object: 1 MPI process
>   type: mg
>     type is MULTIPLICATIVE, levels=2 cycles=v
>       Cycles per PCApply=1
>       Not using Galerkin computed coarse grid matrices
>   Coarse grid solver -- level 0 -------------------------------
>     KSP Object: (mg_coarse_) 1 MPI process
>       type: cg
>         variant HERMITIAN
>       maximum iterations=100, initial guess is zero
>       tolerances: relative=0.1, absolute=0.1, divergence=1e+30
>       left preconditioning
>       using UNPRECONDITIONED norm type for convergence test
>     PC Object: (mg_coarse_) 1 MPI process
>       type: none
>       linear system matrix = precond matrix:
>       Mat Object: 1 MPI process
>         type: python
>         rows=344, cols=344
>             Python: Solver_petsc.LeastSquaresOperator
>   Down solver (pre-smoother) on level 1 -------------------------------
>     KSP Object: (mg_levels_1_) 1 MPI process
>       type: cg
>         variant HERMITIAN
>       maximum iterations=10, nonzero initial guess
>       tolerances: relative=0.1, absolute=0.1, divergence=1e+30
>       left preconditioning
>       using UNPRECONDITIONED norm type for convergence test
>     PC Object: (mg_levels_1_) 1 MPI process
>       type: none
>       linear system matrix = precond matrix:
>       Mat Object: 1 MPI process
>         type: python
>         rows=524, cols=524
>             Python: Solver_petsc.LeastSquaresOperator
>   Up solver (post-smoother) same as down solver (pre-smoother)
>   linear system matrix = precond matrix:
>   Mat Object: 1 MPI process
>     type: python
>     rows=524, cols=524
>         Python: Solver_petsc.LeastSquaresOperator
> Best,
> Elena
> 
> From: Barry Smith <[email protected] <mailto:[email protected]>>
> Sent: 26 September 2025 19:05:02
> To: Moral Sanchez, Elena
> Cc: [email protected] <mailto:[email protected]>
> Subject: Re: [petsc-users] setting correct tolerances for MG smoother CG at 
> the finest level
>  
>   
> Send the output using -ksp_view 
> 
> Normally one uses a fixed number of iterations of smoothing  on level with 
> multigrid rather than a tolerance, but yes PETSc should respect such a 
> tolerance.
> 
> Barry
> 
> 
>> On Sep 26, 2025, at 12:49 PM, Moral Sanchez, Elena 
>> <[email protected] <mailto:[email protected]>> 
>> wrote:
>> 
>> Hi, 
>> I am using multigrid (multiplicative) as a preconditioner with a V-cycle of 
>> two levels. At each level, I am setting CG as the smoother with certain 
>> tolerance.
>> 
>> What I observe is that in the finest level the CG continues iterating after 
>> the residual norm reaches the tolerance (atol) and it only stops when 
>> reaching the maximum number of iterations at that level. At the coarsest 
>> level this does not occur and the CG stops when the tolerance is reached.
>> 
>> I double-checked that the smoother at the finest level has the right 
>> tolerance. And I am using a Monitor function to track the residual.
>> 
>> Do you know how to make the smoother at the finest level stop when reaching 
>> the tolerance?
>> 
>> Cheers,
>> Elena.

Reply via email to