[petsc-users] 2-norm of solution update suddenly becomes zero after a few iterations

Barry Smith bsmith at petsc.dev
Sat Aug 22 10:10:01 CDT 2020



  Pranay

   Newton's method is generally the best choice for nonlinear problems as Matt notes but PETSc also provides an implementation of Picard's method with SNESSetPicard() https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESSetPicard.html <https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESSetPicard.html>

   We implement the defect correction form of the Picard iteration because it converges much more generally when inexact linear solvers are used then the direct Picard iteration A(x^n) x^{n+1} = b(x^n), which is what Matt just said.

   Based on your email it looks like you using the direct Picard iteration algorithm. 

   With your current code you can likely easily switch to trying SNESSetPicard() and then switch to trying Newton with  SNESSetFunction(), https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESSetFunction.html <https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESSetFunction.html>  and SNESSetJacobian() https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESSetJacobian.html <https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESSetJacobian.html>

   PETSc is designed to make it as simple as possible to switch between various algorithms to help determine the best for your exact problem. 

   SNES uses KSP for is linear solvers so you get full access to all the possible preconditioners, for larger problems as Matt notes, once you have the best nonlinear convergence selected tuning the linear solver is the most important thing to do for speed. We recommend when possible first getting good nonlinear convergence using a direct linear solver and then switching to an iterative solver as an optimization, for large problems you almost always should to switch to an iterative solver when the problem size increases.

    Barry


> On Aug 22, 2020, at 7:24 AM, Matthew Knepley <knepley at gmail.com> wrote:
> 
> On Sat, Aug 22, 2020 at 2:07 AM baikadi pranay <pranayreddy865 at gmail.com <mailto:pranayreddy865 at gmail.com>> wrote:
> Hello,
> 
> I am trying to solve the Poisson equation in 2D for heterostructure devices. I have linearized the equation and discretized it using FDM. I am using BiCGStab to iteratively solve for the solution as follows:
> 
> Step 1: Solve A^(i-1) x^(i) = b^(i-1)     {i = 1 to N where convergence is reached}
> Step 2: Use x^{i} to update the central coefficients of A^{i-1} to get A^{i} and                          similarly  update b^{i-1} to get b^{i}
> Step3: If ( ||x^{i}-x^{i-1}||_2 , the 2-norm of the solution update, is greater than a                     tolerance, then go back to Step 1  to solve the new system of equations                     using BiCGStab. Else, exit the loop.
> 1) I am facing the following problem with this procedure:
> The 2-norm of the solution update is suddenly becoming zero after a few iterations in some cases. I print out the getconvergedreason and there are not red flags there, so I am kind of confused whey this behaviour is being observed. This behaviour is leading to "false convergences", in the sense that the solutions obtained are not physical.
> 
> A similar behaviour was observed when I used SOR instead of BiCGStab. At this point I am starting to suspect if it is wrong to use linear solvers on the poisson equation which is a nonlinear equation (although linearized). If you could please comment on this, that would be very helpful.  
> 
> Any help with this problem is greatly appreciated. Please let me know if you need any further information. 
> 
> 1) You are coding up the Picard method by hand to solve your nonlinear equation. If the operator is not contractive, this can stagnate, as you are seeing. You
>     could try another solver, like Newton's method. We have a variety of nonlinear solves in the SNES class.
> 
> 2) It is not clear from your description whether you linear solver is converging. BiCGStab without a preconditioner is a terrible solver for Poisson. We usually
>     recommend starting with Algebraic Multigrid, like Hypre which is great at 2D Poisson. You can monitor the convergence of your linear solver using
> 
>       -knp_monitor_true_solution -ksp_converged_reason
> 
>    We want to see this information with any questions about convergence.
> 
>   Thanks,
> 
>      Matt
>  
> Thank you,
> 
> Sincerely,
> Pranay.
> 
>> 
> 
> -- 
> What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.
> -- Norbert Wiener
> 
> https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>

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


More information about the petsc-users mailing list