<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><font face="tahoma, sans-serif">Dear Petsc developer:            </font></div><div dir="ltr"><font face="tahoma, sans-serif">Hi,            </font></div><div dir="ltr"><font face="tahoma, sans-serif">Thank you for your previous help.            </font></div><div dir="ltr"><font face="tahoma, sans-serif">I recently modeled on PETSc's SNES example and wrote a computer program myself. This program is mainly for solving nonlinear equations of thermal hydraulics.</font><font face="simhei, sans-serif"> </font><br></div><div dir="ltr"><p class="gmail-15" style="margin-left:18pt;text-indent:21pt"><span style="font-family:宋体;color:rgb(51,51,51);letter-spacing:0pt;font-size:10.5pt">∇</span><span style="font-family:宋体;color:rgb(51,51,51);letter-spacing:0pt;font-size:10.5pt">·(λ</span><span style="font-family:宋体;color:rgb(51,51,51);letter-spacing:0pt;font-size:10.5pt">∇</span><span style="font-family:宋体;color:rgb(51,51,51);letter-spacing:0pt;font-size:10.5pt">T</span><span style="font-family:宋体;color:rgb(51,51,51);letter-spacing:0pt;font-size:10.5pt"><font face="宋体">)</font> - </span><span style="font-family:宋体;color:rgb(51,51,51);letter-spacing:0pt;font-size:10.5pt">∇</span><span style="font-family:宋体;color:rgb(51,51,51);letter-spacing:0pt;font-size:10.5pt">_y<font face="宋体">(ρ</font><font face="Arial">*Cp*u</font><font face="宋体">) </font><font face="Arial">- T_source = 0</font></span><span style="font-family:宋体;color:rgb(51,51,51);letter-spacing:0pt;font-size:10.5pt"></span></p><p class="gmail-15" style="margin-left:18pt;text-indent:21pt"><span style="font-family:宋体;color:rgb(51,51,51);letter-spacing:0pt;font-size:10.5pt">w*<font face="宋体">ρ</font><font face="Arial">*u = </font><font face="宋体">ρ</font><font face="Arial">g - </font></span><span style="font-family:宋体;color:rgb(51,51,51);letter-spacing:0pt;font-size:10.5pt">∇</span><span style="font-family:宋体;color:rgb(51,51,51);letter-spacing:0pt;font-size:10.5pt">_y<font face="宋体">(</font><font face="Arial">P</font><font face="宋体">)</font></span><span style="font-family:宋体;color:rgb(51,51,51);letter-spacing:0pt;font-size:10.5pt"></span></p><p class="MsoNormal" style="margin:0pt 0pt 0.0001pt;text-align:justify;font-family:等线;font-size:10.5pt"><span style="font-family:宋体;color:rgb(51,51,51);letter-spacing:0pt;font-size:10.5pt">     ∇</span><span style="font-family:宋体;color:rgb(51,51,51);letter-spacing:0pt;font-size:10.5pt">·( <font face="Arial">1/w * </font></span><span style="font-family:宋体;color:rgb(51,51,51);letter-spacing:0pt;font-size:10.5pt">∇</span><span style="font-family:宋体;color:rgb(51,51,51);letter-spacing:0pt;font-size:10.5pt">P <font face="宋体">) </font><font face="Arial">=  - </font></span><span style="font-family:宋体;color:rgb(51,51,51);letter-spacing:0pt;font-size:10.5pt">∇</span><span style="font-family:宋体;color:rgb(51,51,51);letter-spacing:0pt;font-size:10.5pt"><font face="宋体">(</font> ρ<font face="Arial">g / w </font><font face="宋体">)</font></span></p><p class="MsoNormal" style="margin:0pt 0pt 0.0001pt;text-align:justify"><font color="#333333" face="tahoma, sans-serif">Where P, T and u are variables, the distribution represents pressure, temperature and velocity. The rest are nonlinear physical parameters and constants.            </font></p><p class="MsoNormal" style="margin:0pt 0pt 0.0001pt;text-align:justify"><font color="#333333" face="tahoma, sans-serif">Because the program is very preliminary, so I use - snes_mf so that I can save the part of writing to calculate the Jacobian matrix.            </font></p><p class="MsoNormal" style="margin:0pt 0pt 0.0001pt;text-align:justify"><font color="#333333" face="tahoma, sans-serif">After compiling and passing, I found that the residual function had not dropped to a small enough level, but the program stopped, as follows:</font><br></p></div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div dir="ltr"><div dir="ltr"><p class="MsoNormal" style="margin:0pt 0pt 0.0001pt;text-align:justify"><font color="#333333" face="tahoma, sans-serif">Setting Up: </font><font face="tahoma, sans-serif">-snes_mf  -snes_monitor  -draw_pause  10  -snes_view</font></p><p class="gmail-15" style="text-indent:45pt"><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt">0 SNES Function norm 3.724996516631e+09 </span><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt"><span></span></span></p><p class="gmail-15" style="margin-left:18pt;text-indent:21pt"><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt">  1 SNES Function norm 2.194322909557e+09 </span><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt"><span></span></span></p><p class="gmail-15" style="margin-left:18pt;text-indent:21pt"><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt">  2 SNES Function norm 1.352051559826e+09 </span><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt"><span></span></span></p><p class="gmail-15" style="margin-left:18pt;text-indent:21pt"><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt">  3 SNES Function norm 1.522311916217e+08 </span><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt"><span></span></span></p><p class="gmail-15" style="margin-left:18pt;text-indent:21pt"><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt">SNES Object: 1 MPI processes</span><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt"><span></span></span></p><p class="gmail-15" style="margin-left:18pt;text-indent:21pt"><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt">  type: newtonls</span><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt"><span></span></span></p><p class="gmail-15" style="margin-left:18pt;text-indent:21pt"><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt">  maximum iterations=50, maximum function evaluations=10000</span><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt"><span></span></span></p><p class="gmail-15" style="margin-left:18pt;text-indent:21pt"><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt">  tolerances: relative=1e-08, absolute=1e-50, solution=1e-08</span><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt"><span></span></span></p><p class="gmail-15" style="margin-left:18pt;text-indent:21pt"><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt">  total number of linear solver iterations=1298</span><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt"><span></span></span></p><p class="gmail-15" style="margin-left:18pt;text-indent:21pt"><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt">  total number of function evaluations=11679</span><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt"><span></span></span></p><p class="gmail-15" style="margin-left:18pt;text-indent:21pt"><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt">  norm schedule ALWAYS</span><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt"><span></span></span></p><p class="gmail-15" style="margin-left:18pt;text-indent:21pt"><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt">  SNESLineSearch Object: 1 MPI processes</span><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt"><span></span></span></p><p class="gmail-15" style="margin-left:18pt;text-indent:21pt"><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt">    type: bt</span><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt"><span></span></span></p><p class="gmail-15" style="margin-left:18pt;text-indent:21pt"><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt">      interpolation: cubic</span><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt"><span></span></span></p><p class="gmail-15" style="margin-left:18pt;text-indent:21pt"><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt">      alpha=1.000000e-04</span><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt"><span></span></span></p><p class="gmail-15" style="margin-left:18pt;text-indent:21pt"><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt">    maxstep=1.000000e+08, minlambda=1.000000e-12</span><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt"><span></span></span></p><p class="gmail-15" style="margin-left:18pt;text-indent:21pt"><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt">    tolerances: relative=1.000000e-08, absolute=1.000000e-15, lambda=1.000000e-08</span><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt"><span></span></span></p><p class="gmail-15" style="margin-left:18pt;text-indent:21pt"><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt">    maximum iterations=40</span><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt"><span></span></span></p><p class="gmail-15" style="margin-left:18pt;text-indent:21pt"><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt">  KSP Object: 1 MPI processes</span><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt"><span></span></span></p><p class="gmail-15" style="margin-left:18pt;text-indent:21pt"><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt">    type: gmres</span><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt"><span></span></span></p><p class="gmail-15" style="margin-left:18pt;text-indent:21pt"><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt">      restart=30, using Classical (unmodified) Gram-Schmidt Orthogonalization with no iterative refinement</span><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt"><span></span></span></p><p class="gmail-15" style="margin-left:18pt;text-indent:21pt"><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt">      happy breakdown tolerance 1e-30</span><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt"><span></span></span></p><p class="gmail-15" style="margin-left:18pt;text-indent:21pt"><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt">    maximum iterations=10000, initial guess is zero</span><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt"><span></span></span></p><p class="gmail-15" style="margin-left:18pt;text-indent:21pt"><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt">    tolerances:  relative=1e-05, absolute=1e-50, divergence=10000.</span><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt"><span></span></span></p><p class="gmail-15" style="margin-left:18pt;text-indent:21pt"><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt">    left preconditioning</span><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt"><span></span></span></p><p class="gmail-15" style="margin-left:18pt;text-indent:21pt"><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt">    using PRECONDITIONED norm type for convergence test</span><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt"><span></span></span></p><p class="gmail-15" style="margin-left:18pt;text-indent:21pt"><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt">  PC Object: 1 MPI processes</span><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt"><span></span></span></p><p class="gmail-15" style="margin-left:18pt;text-indent:21pt"><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt">    type: none</span><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt"><span></span></span></p><p class="gmail-15" style="margin-left:18pt;text-indent:21pt"><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt">    linear system matrix = precond matrix:</span><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt"><span></span></span></p><p class="gmail-15" style="margin-left:18pt;text-indent:21pt"><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt">    Mat Object: 1 MPI processes</span><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt"><span></span></span></p><p class="gmail-15" style="margin-left:18pt;text-indent:21pt"><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt">      type: mffd</span><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt"><span></span></span></p><p class="gmail-15" style="margin-left:18pt;text-indent:21pt"><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt">      rows=300, cols=300</span><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt"><span></span></span></p><p class="gmail-15" style="margin-left:18pt;text-indent:21pt"><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt">        Matrix-free approximation:</span><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt"><span></span></span></p><p class="gmail-15" style="margin-left:18pt;text-indent:21pt"><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt">          err=1.49012e-08 (relative error in function evaluation)</span><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt"><span></span></span></p><p class="gmail-15" style="margin-left:18pt;text-indent:21pt"><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt">          Using wp compute h routine</span><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;text-transform:none;font-style:normal;font-size:7.5pt"><span></span></span></p><p class="MsoNormal" style="margin:0pt 0pt 0.0001pt;text-align:justify"></p><p class="gmail-15" style="margin-left:18pt;text-indent:21pt"><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;font-size:7.5pt">              Does not compute normU</span><span style="font-family:"Times New Roman";color:rgb(51,51,51);letter-spacing:0pt;font-size:7.5pt"></span></p></div></div></blockquote><font color="#333333"><font face="tahoma, sans-serif" style="">I would like to know why the residual function can not continue to decline, and why the program will stop before convergence. </font></font></div><div dir="ltr"><font color="#333333"><font face="tahoma, sans-serif" style="">I do not know much about the convergence criteria and convergence rules of PETSc for solving nonlinear equations. I hope I can get your help. </font><br></font></div><div><font color="#333333"><font face="tahoma, sans-serif" style="">I'm looking forward to your reply~</font></font></div><div><font color="#333333"><font face="tahoma, sans-serif" style=""><br></font></font></div><div><font color="#333333"><font face="tahoma, sans-serif" style="">Thanks,</font></font></div><div><font color="#333333"><font face="tahoma, sans-serif" style="">Yingjie</font></font></div></div>