[petsc-users] [petsc-maint] norm L2 problemQuestion about changing the norm used in nonlinear solvers (L2 Euclidean vs. L2 Lebesgue)

Ali ALI AHMAD ali.ali_ahmad at utt.fr
Fri Jun 13 03:55:45 CDT 2025



Thank you for your message. 




To answer your question: I would like to use the L 2 norm in the sense of Lebesgue for all three purposes , especially the third one . 




1- For displaying residuals during the nonlinear iterations, I would like to observe the convergence behavior using a norm that better reflects the physical properties of the problem. 




2- For convergence testing , I would like the stopping criterion to be based on a weighted L 2 norm that accounts for the geometry of the mesh (since I am working with unstructured, anisotropic triangular meshes). 




3 - Most importantly , I would like to modify the inner product used in the algorithm so that it aligns with the weighted L 2 norm (since I am working with unstructured, anisotropic triangular meshes). 


Best regards, 
Ali ALI AHMAD 

De: "Barry Smith" <bsmith at petsc.dev> 
À: "Ali ALI AHMAD" <ali.ali_ahmad at utt.fr> 
Cc: "petsc-users" <petsc-users at mcs.anl.gov>, "petsc-maint" <petsc-maint at mcs.anl.gov> 
Envoyé: Vendredi 13 Juin 2025 03:14:06 
Objet: Re: [petsc-maint] norm L2 problemQuestion about changing the norm used in nonlinear solvers (L2 Euclidean vs. L2 Lebesgue) 

You haven't answered my question. Where (conceptually) and for what purpose do you want to use the L2 norm. 
1) displaying norms to observe the convergence behavior 

2) in the convergence testing to determine when to stop 

3) changing the "inner product" in the algorithm which amounts to preconditioning. 

Barry 





On Jun 12, 2025, at 9:42 AM, Ali ALI AHMAD <ali.ali_ahmad at utt.fr> wrote: 

Thank you for your answer. 

I am currently working with the nonlinear solvers newtonls (with bt , l2 , etc.) and newtontr (using newton , cauchy , and dogleg strategies) combined with the linear solver gmres and the ILU preconditioner, since my Jacobian matrix is nonsymmetric. 

I also use the Eisenstat-Walker method for newtonls , as my initial guess is often very far from the exact solution. 

What I would like to do now is to replace the standard Euclidean L 2 norm with the L 2 norm in the Lebesgue sense in the above numerical algorithm , because my problem is defined on an unstructured, anisotropic triangular mesh where a weighted norm would be more physically appropriate. 

Would you be able to advise me on how to implement this change properly? 

I would deeply appreciate any guidance or suggestions you could provide. 

Thank you in advance for your help. 

Best regards, 
Ali ALI AHMAD 


De: "Ali ALI AHMAD" <ali.ali_ahmad at utt.fr> 
À: "Barry Smith" <bsmith at petsc.dev> 
Cc: "petsc-users" <petsc-users at mcs.anl.gov>, "petsc-maint" <petsc-maint at mcs.anl.gov> 
Envoyé: Jeudi 12 Juin 2025 15:28:02 
Objet: Re: [petsc-maint] norm L2 problemQuestion about changing the norm used in nonlinear solvers (L2 Euclidean vs. L2 Lebesgue) 

Thank you for your answer. 

I am currently working with the nonlinear solvers newtonls (with bt , l2 , etc.) and newtontr (using newton , cauchy , and dogleg strategies) combined with the linear solver gmres and the ILU preconditioner, since my Jacobian matrix is nonsymmetric. 

I also use the Eisenstat-Walker method for newtonls , as my initial guess is often very far from the exact solution. 

What I would like to do now is to replace the standard Euclidean L 2 norm with the L 2 norm in the Lebesgue sense , because my problem is defined on an unstructured, anisotropic triangular mesh where a weighted norm would be more physically appropriate. 

Would you be able to advise me on how to implement this change properly? 

I would deeply appreciate any guidance or suggestions you could provide. 

Thank you in advance for your help. 

Best regards, 
Ali ALI AHMAD 

De: "Barry Smith" <bsmith at petsc.dev> 
À: "Ali ALI AHMAD" <ali.ali_ahmad at utt.fr> 
Cc: "petsc-users" <petsc-users at mcs.anl.gov>, "petsc-maint" <petsc-maint at mcs.anl.gov> 
Envoyé: Jeudi 12 Juin 2025 14:57:40 
Objet: Re: [petsc-maint] norm L2 problemQuestion about changing the norm used in nonlinear solvers (L2 Euclidean vs. L2 Lebesgue) 

Do you wish to use a different norm 

1) ONLY for displaying (printing out) the residual norms to track progress 

2) in the convergence testing 

3) to change the numerical algorithm (for example using the L2 inner product instead of the usual linear algebra R^N l2 inner product). 

For 1) use SNESMonitorSet() and in your monitor function use SNESGetSolution() to grab the solution and then VecGetArray(). Now you can compute any weighted norm you want on the solution. 

For 2) similar but you need to use SNESSetConvergenceTest 

For 3) yes, but you need to ask us specifically. 

Barry 



BQ_BEGIN

On Jun 11, 2025, at 4:45 AM, Ali ALI AHMAD <ali.ali_ahmad at utt.fr> wrote: 

Dear PETSc team, 

I hope this message finds you well. 

I am currently using PETSc in a C++, where I rely on the nonlinear solvers `SNES` with either `newtonls` or `newtontr` methods. I would like to ask if it is possible to change the default norm used (typically the L2 Euclidean norm) to a custom norm, specifically the L2 norm in the sense of Lebesgue (e.g., involving cell-wise weighted integrals over the domain). 

My main goal is to define a custom residual norm that better reflects the physical quantities of interest in my simulation. 

Would this be feasible within the PETSc framework? If so, could you point me to the recommended approach (e.g., redefining the norm manually, using specific PETSc hooks or options)? 

Thank you very much in advance for your help and for the great work on PETSc! 

Best regards, 


Ali ALI AHMAD 
PhD Student 
University of Technology of Troyes - UTT - France 
GAMMA3 Project - Office H008 - Phone No: +33 7 67 44 68 18 
12 rue Marie Curie - CS 42060 10004 TROYES Cedex 





BQ_END


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20250613/22d78f74/attachment-0001.html>


More information about the petsc-users mailing list