On Mon, Jun 20, 2011 at 10:19 PM, Tian(ICT) <span dir="ltr">&lt;<a href="mailto:rongtian@ncic.ac.cn">rongtian@ncic.ac.cn</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<u></u>





<div bgcolor="#ffffff">
<div><font size="2">Thanks for quick answering.</font></div>
<div><font size="2">I looked into SNESSetFromOptions() in the debugger and MF was 
not chosen. </font></div>
<div><font size="2">Still the wired thing is the code never breaks at the 
point I set inside FormJacobian when running in the debug mode.</font></div>
<div><font size="2">I will leave this issue alone again and look at it 
later.</font></div>
<div><font size="2"></font> </div>
<div><font size="2">Actually I am struggling with a SNES solve. The followings are 
some outputs.</font></div>
<div><font size="2">-snes_ratiomonitor shows that residual norm almost equals to 
one but the SNES converged,</font></div>
<div><font size="2"></font><font size="2">is this a good 
convergence?</font></div></div></blockquote><div><br></div><div>No. Are you sure this system is consistent, meaning it has a solution? Have you tried putting in an</div><div>exact solution for a simpler problem?</div><div>
<br></div><div>  Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div bgcolor="#ffffff"><div> </div>
<div><font size="2">atol=1e-050, rtol=1e-008, stol=1e-008, maxit=50, 
maxf=10000<br>function.................<br>residual 
force.................<br>0<br>0<br>0<br>0<br>0<br>0<br>0<br>0<br>0<br>0<br>0<br>0<br>0<br>40000 
&lt;== initial 
value<br>0<br>0<br>40000<br>0<br>0<br>40000<br>0<br>0<br>40000<br>0<br>  0 
SNES Function norm 8.000000000000e+004 <br>  0 SNES Function norm 
8.000000000000e+004 
<br>-------------------&gt;Jacobian<br>function.................<br>residual 
force.................<br>-8.2245e+007<br>-5.12049e+006<br>1.03104e+008<br>2.44985e+007<br>-1.11118e+007<br>-3.144e+007<br>-2.37583e+007<br>-535905<br>2.79206e+007<br>5.63514e+007<br>-2.26332e+007<br>-7.54711e+007<br>-5.76723e+007<br>
1.544e+007<br>7.56104e+007<br>2.34587e+007<br>9.57426e+006<br>-2.56718e+007<br>2.7089e+007<br>3.32996e+007<br>-3.09772e+007<br>3.2278e+007<br>-1.87524e+007<br>-4.30752e+007<br>function.................<br>residual 
force.................<br>-8.2245e+007<br>-5.12049e+006<br>1.03104e+008<br>2.44985e+007<br>-1.11118e+007<br>-3.144e+007<br>-2.37583e+007<br>-535905<br>2.79206e+007<br>5.63514e+007<br>-2.26332e+007<br>-7.54711e+007<br>-5.76723e+007<br>
1.544e+007<br>7.56104e+007<br>2.34587e+007<br>9.57426e+006<br>-2.56718e+007<br>2.7089e+007<br>3.32996e+007<br>-3.09772e+007<br>3.2278e+007<br>-1.87524e+007<br>-4.30752e+007<br>function.................<br>residual 
force.................<br>-2.05272e+007<br>3.44926e+006<br>2.5202e+007<br>-1.55108e+006<br>-9.56839e+006<br>2.17527e+006<br>3.56516e+006<br>6.12324e+006<br>-5.9437e+006<br>1.41997e+007<br>-1.21796e+007<br>-1.92224e+007<br>
-1.63165e+007<br>1.00523e+007<br>2.14974e+007<br>-1.87655e+006<br>-3.44175e+006<br>4.3047e+006<br>1.50918e+007<br>1.66532e+007<br>-1.8379e+007<br>7.41472e+006<br>-1.09283e+007<br>-9.63423e+006<br>function.................<br>
residual 
force.................<br>-4.83477e+006<br>1.9056e+006<br>5.06631e+006<br>-1.74833e+006<br>-3.81725e+006<br>3.0505e+006<br>1.93196e+006<br>2.614e+006<br>-3.9812e+006<br>3.71686e+006<br>-4.00712e+006<br>-4.46187e+006<br>-4.24801e+006<br>
3.70415e+006<br>5.07447e+006<br>-1.59935e+006<br>-2.18778e+006<br>3.63332e+006<br>3.74435e+006<br>5.0913e+006<br>-5.46539e+006<br>3.03729e+006<br>-3.14292e+006<br>-2.91613e+006<br>function.................<br>residual 
force.................<br>-1.62518e+006<br>635442<br>1.14687e+006<br>-395026<br>-1.35624e+006<br>1.30091e+006<br>258576<br>922003<br>-1.54824e+006<br>1.34306e+006<br>-1.18937e+006<br>-1.19905e+006<br>-1.44957e+006<br>1.18631e+006<br>
1.32948e+006<br>-233476<br>-848651<br>1.52147e+006<br>630822<br>1.59179e+006<br>-1.62993e+006<br>1.4708e+006<br>-781281<br>-921506<br>function.................<br>residual 
force.................<br>-680584<br>150805<br>298173<br>-4235.39<br>-556100<br>495315<br>-83367.9<br>401881<br>-609708<br>583119<br>-325632<br>-382676<br>-608984<br>356434<br>416726<br>79947.2<br>-362413<br>611645<br>24823.1<br>
640620<br>-552863<br>689283<br>-145594<br>-276612<br>function.................<br>residual 
force.................<br>-252778<br>-43702.9<br>107996<br>39434.6<br>-252471<br>108972<br>-56021.1<br>202917<br>-167131<br>237714<br>-13235.2<br>-160064<br>-245478<br>46386.1<br>170214<br>53958.6<br>-164661<br>167576<br>
-41053<br>309826<br>-119435<br>264223<br>74941.4<br>-108128<br>function.................<br>residual 
force.................<br>-37722.5<br>-30354.3<br>12055.9<br>19055.1<br>-45688.3<br>-1869.42<br>-17961.6<br>41506<br>-11175<br>39667.1<br>24371.9<br>-24644.8<br>-40629.2<br>12856<br>25503.9<br>17749.7<br>-1976.73<br>10689.7<br>
-20792.3<br>89625.4<br>2237.53<br>40633.6<br>69659.9<br>-12797.9<br>function.................<br>residual 
force.................<br>-3191.46<br>-3795.77<br>508.943<br>2612.15<br>-4047.01<br>-1039.77<br>-2394.34<br>3957.38<br>-341.114<br>3526.13<br>3531.34<br>-1843.35<br>-3574.59<br>36099.4<br>1775.2<br>2391.73<br>35967.4<br>
179.561<br>-2883.93<br>44445.2<br>1264.25<br>3514.31<br>43842.1<br>-503.71<br>function.................<br>residual 
force.................<br>-268.146<br>-347.447<br>46.5142<br>257.768<br>-335.67<br>-97.6787<br>-234.991<br>341.388<br>-35.3256<br>299.924<br>338.987<br>-161.929<br>-306.308<br>39615<br>132.745<br>236.496<br>39642.5<br>-7.34212<br>
-285.009<br>40378.6<br>141.125<br>300.268<br>40366.6<br>-18.108<br>function.................<br>residual 
force.................<br>-22.758<br>-27.2585<br>11.605<br>23.791<br>-26.2078<br>-3.38911<br>-21.3068<br>28.26<br>-10.762<br>25.2783<br>28.3454<br>-19.8467<br>-27.0516<br>39963.9<br>11.1365<br>21.8233<br>39967.5<br>-1.27698<br>
-26.2771<br>40032.7<br>13.3758<br>26.5009<br>40032.8<br>-0.842484<br>  
1 SNES Function norm 7.999847670241e+004 <br>  1 SNES Function norm 
7.999847670241e+004 0.999981 
<br>-------------------&gt;Jacobian<br>function.................<br>residual 
force.................<br>-223.361<br>-326.156<br>36.1377<br>229.267<br>-321.922<br>-82.1057<br>-210.332<br>329.183<br>-52.6793<br>249.815<br>322.469<br>-153.907<br>-255.672<br>39637.8<br>127.173<br>211.072<br>39655.1<br>
12.6163<br>-250.93<br>40359<br>119.951<br>250.141<br>40344.5<br>-7.18602<br>function.................<br>residual 
force.................<br>-69.9794<br>-97.0147<br>18.7512<br>72.7704<br>-94.1566<br>-22.1285<br>-66.1397<br>98.02<br>-20.4693<br>78.3769<br>97.6066<br>-52.1529<br>-81.3498<br>39886.4<br>37.8587<br>66.7162<br>39894.4<br>0.222982<br>
-79.8688<br>40108.4<br>40.0624<br>79.4743<br>40106.3<br>-2.14464<br>  
2 SNES Function norm 7.999823436070e+004 <br>  2 SNES Function norm 
7.999823436070e+004 0.999997 
<br>-------------------&gt;Jacobian<br>function.................<br>residual 
force.................<br>-85.9273<br>-122.698<br>20.3604<br>89.7785<br>-119.971<br>-28.2927<br>-81.9324<br>124.468<br>-25.2852<br>96.1213<br>123.187<br>-63.7311<br>-99.4852<br>39858.1<br>47.741<br>82.4929<br>39866.9<br>
2.51439<br>-98.3175<br>40136.8<br>48.6046<br>97.2698<br>40133.2 
&lt;== almost no change<br>-1.91145<br>  3 SNES Function norm 
7.999822446658e+004 <br>  3 SNES Function norm 7.999822446658e+004 1 
<br>-------------------&gt;Jacobian<br>function.................<br>residual 
force.................<br>-90.9631<br>-130.918<br>20.7647<br>95.1669<br>-128.284<br>-30.1982<br>-86.9654<br>132.973<br>-26.9162<br>101.696<br>131.372<br>-67.3645<br>-105.178<br>39849.1<br>50.8645<br>87.519<br>39858<br>3.38427<br>
-104.154<br>40145.9<br>51.2208<br>102.878<br>40141.8<br>-1.7555<br>function.................<br>residual 
force.................<br>-87.4304<br>-125.151<br>20.4826<br>91.387<br>-122.451<br>-28.8623<br>-83.4344<br>127.006<br>-25.7711<br>97.7856<br>125.63<br>-64.8168<br>-101.185<br>39855.4<br>48.6736<br>83.9928<br>39864.2<br>2.77216<br>
-100.06<br>40139.5<br>49.3875<br>98.944<br>40135.8<br>-1.86551<br>function.................<br>residual 
force.................<br>-86.3776<br>-123.432<br>20.3972<br>90.2603<br>-120.714<br>-28.4634<br>-82.3823<br>125.228<br>-25.4307<br>96.6198<br>123.919<br>-64.0564<br>-99.9944<br>39857.3<br>48.0204<br>82.9421<br>39866.1<br>
2.59144<br>-98.8394<br>40137.6<br>48.8393<br>97.7713<br>40134<br>-1.89774<br>function.................<br>residual 
force.................<br>-86.0623<br>-122.918<br>20.3714<br>89.923<br>-120.194<br>-28.3439<br>-82.0673<br>124.696<br>-25.3288<br>96.2708<br>123.407<br>-63.8287<br>-99.6379<br>39857.9<br>47.8248<br>82.6276<br>39866.6<br>
2.53748<br>-98.474<br>40137.1<br>48.675<br>97.4202<br>40133.5<br>-1.90734<br>function.................<br>residual 
force.................<br>-85.9678<br>-122.764<br>20.3637<br>89.8218<br>-120.038<br>-28.3081<br>-81.9729<br>124.536<br>-25.2983<br>96.1661<br>123.253<br>-63.7604<br>-99.531<br>39858<br>47.7661<br>82.5333<br>39866.8<br>2.52132<br>
-98.3644<br>40136.9<br>48.6258<br>97.3149<br>40133.3<br>-1.91022<br>function.................<br>residual 
force.................<br>-85.9395<br>-122.717<br>20.3614<br>89.7915<br>-119.991<br>-28.2973<br>-81.9445<br>124.489<br>-25.2891<br>96.1347<br>123.207<br>-63.7399<br>-99.4989<br>39858.1<br>47.7485<br>82.505<br>39866.9<br>
2.51647<br>-98.3316<br>40136.8<br>48.611<br>97.2833<br>40133.2<br>-1.91108<br>function.................<br>residual 
force.................<br>-85.931<br>-122.704<br>20.3607<br>89.7824<br>-119.977<br>-28.2941<br>-81.936<br>124.474<br>-25.2863<br>96.1253<br>123.193<br>-63.7337<br>-99.4893<br>39858.1<br>47.7432<br>82.4965<br>39866.9<br>2.51502<br>
-98.3217<br>40136.8<br>48.6065<br>97.2738<br>40133.2<br>-1.91134<br>function.................<br>residual 
force.................<br>-85.9284<br>-122.699<br>20.3605<br>89.7796<br>-119.973<br>-28.2931<br>-81.9335<br>124.47<br>-25.2855<br>96.1225<br>123.189<br>-63.7319<br>-99.4864<br>39858.1<br>47.7416<br>82.494<br>39866.9<br>2.51458<br>
-98.3187<br>40136.8<br>48.6052<br>97.271<br>40133.2<br>-1.91142<br>function.................<br>residual 
force.................<br>-85.9277<br>-122.698<br>20.3604<br>89.7788<br>-119.972<br>-28.2928<br>-81.9327<br>124.469<br>-25.2853<br>96.1216<br>123.188<br>-63.7313<br>-99.4856<br>39858.1<br>47.7412<br>82.4932<br>39866.9<br>
2.51445<br>-98.3179<br>40136.8<br>48.6048<br>97.2702<br>40133.2<br>-1.91144<br>function.................<br>residual 
force.................<br>-85.9274<br>-122.698<br>20.3604<br>89.7786<br>-119.972<br>-28.2927<br>-81.9325<br>124.468<br>-25.2852<br>96.1214<br>123.187<br>-63.7312<br>-99.4853<br>39858.1<br>47.741<br>82.493<br>39866.9<br>2.51441<br>
-98.3176<br>40136.8<br>48.6047<br>97.2699<br>40133.2<br>-1.91145<br>function.................<br>residual 
force.................<br>-85.9274<br>-122.698<br>20.3604<br>89.7785<br>-119.971<br>-28.2927<br>-81.9324<br>124.468<br>-25.2852<br>96.1213<br>123.187<br>-63.7311<br>-99.4852<br>39858.1<br>47.741<br>82.4929<br>39866.9<br>
2.5144<br>-98.3175<br>40136.8<br>48.6047<br>97.2698<br>40133.2<br>-1.91145<br>function.................<br>residual 
force.................<br>-85.9273<br>-122.698<br>20.3604<br>89.7785<br>-119.971<br>-28.2927<br>-81.9324<br>124.468<br>-25.2852<br>96.1213<br>123.187<br>-63.7311<br>-99.4852<br>39858.1<br>47.741<br>82.4929<br>39866.9<br>
2.5144<br>-98.3175<br>40136.8<br>48.6046<br>97.2698<br>40133.2<br>-1.91145<br>function.................<br>residual 
force.................<br>-85.9273<br>-122.698<br>20.3604<br>89.7785<br>-119.971<br>-28.2927<br>-81.9324<br>124.468<br>-25.2852<br>96.1213<br>123.187<br>-63.7311<br>-99.4852<br>39858.1<br>47.741<br>82.4929<br>39866.9<br>
2.5144<br>-98.3175<br>40136.8<br>48.6046<br>97.2698<br>40133.2<br>-1.91145<br>function.................<br>residual 
force.................<br>-85.9273<br>-122.698<br>20.3604<br>89.7785<br>-119.971<br>-28.2927<br>-81.9324<br>124.468<br>-25.2852<br>96.1213<br>123.187<br>-63.7311<br>-99.4852<br>39858.1<br>47.741<br>82.4929<br>39866.9<br>
2.51439<br>-98.3175<br>40136.8<br>48.6046<br>97.2698<br>40133.2<br>-1.91145<br>function.................<br>residual 
force.................<br>-85.9273<br>-122.698<br>20.3604<br>89.7785<br>-119.971<br>-28.2927<br>-81.9324<br>124.468<br>-25.2852<br>96.1213<br>123.187<br>-63.7311<br>-99.4852<br>39858.1<br>47.741<br>82.4929<br>39866.9<br>
2.51439<br>-98.3175<br>40136.8<br>48.6046<br>97.2698<br>40133.2<br>-1.91145<br>function.................<br>residual 
force.................<br>-85.9273<br>-122.698<br>20.3604<br>89.7785<br>-119.971<br>-28.2927<br>-81.9324<br>124.468<br>-25.2852<br>96.1213<br>123.187<br>-63.7311<br>-99.4852<br>39858.1<br>47.741<br>82.4929<br>39866.9<br>
2.51439<br>-98.3175<br>40136.8<br>48.6046<br>97.2698<br>40133.2<br>-1.91145<br>function.................<br>residual 
force.................<br>-85.9273<br>-122.698<br>20.3604<br>89.7785<br>-119.971<br>-28.2927<br>-81.9324<br>124.468<br>-25.2852<br>96.1213<br>123.187<br>-63.7311<br>-99.4852<br>39858.1<br>47.741<br>82.4929<br>39866.9<br>
2.51439<br>-98.3175<br>40136.8<br>48.6046<br>97.2698<br>40133.2<br>-1.91145<br>function.................<br>residual 
force.................<br>-85.9273<br>-122.698<br>20.3604<br>89.7785<br>-119.971<br>-28.2927<br>-81.9324<br>124.468<br>-25.2852<br>96.1213<br>123.187<br>-63.7311<br>-99.4852<br>39858.1<br>47.741<br>82.4929<br>39866.9<br>
2.51439<br>-98.3175<br>40136.8<br>48.6046<br>97.2698<br>40133.2<br>-1.91145<br>function.................<br>residual 
force.................<br>-85.9273<br>-122.698<br>20.3604<br>89.7785<br>-119.971<br>-28.2927<br>-81.9324<br>124.468<br>-25.2852<br>96.1213<br>123.187<br>-63.7311<br>-99.4852<br>39858.1<br>47.741<br>82.4929<br>39866.9<br>
2.51439<br>-98.3175<br>40136.8<br>48.6046<br>97.2698<br>40133.2<br>-1.91145<br>function.................<br>residual 
force.................<br>-85.9273<br>-122.698<br>20.3604<br>89.7785<br>-119.971<br>-28.2927<br>-81.9324<br>124.468<br>-25.2852<br>96.1213<br>123.187<br>-63.7311<br>-99.4852<br>39858.1<br>47.741<br>82.4929<br>39866.9<br>
2.51439<br>-98.3175<br>40136.8<br>48.6046<br>97.2698<br>40133.2<br>-1.91145<br>function.................<br>residual 
force.................<br>-85.9273<br>-122.698<br>20.3604<br>89.7785<br>-119.971<br>-28.2927<br>-81.9324<br>124.468<br>-25.2852<br>96.1213<br>123.187<br>-63.7311<br>-99.4852<br>39858.1<br>47.741<br>82.4929<br>39866.9<br>
2.51439<br>-98.3175<br>40136.8<br>48.6046<br>97.2698<br>40133.2<br>-1.91145<br>  
4 SNES Function norm 7.999822446658e+004 <br>  4 SNES Function norm 
7.999822446658e+004 1 <br>SNES Object:<br>  type: tr<br>    
mu=0.25, eta=0.75, sigma=0.0001<br>    delta0=0.2, delta1=0.3, 
delta2=0.75, delta3=2<br>  maximum iterations=50, maximum function 
evaluations=10000<br>  tolerances: relative=1e-008, absolute=1e-050, 
solution=1e-008<br>  total number of linear solver iterations=4<br>  
total number of function evaluations=36<br>  KSP 
Object:<br>    type: gmres<br>      
GMRES: restart=30, using Classical (unmodified) Gram-Schmidt Orthogonalization 
with no iterative refinement<br>      GMRES: happy 
breakdown tolerance 1e-030<br>    maximum iterations=10000, 
initial guess is zero<br>    tolerances:  relative=1e-005, 
absolute=1e-050, divergence=10000<br>    left 
preconditioning<br>  PC Object:<br>    type: 
ilu<br>      ILU: 0 levels of 
fill<br>      ILU: factor fill ratio allocated 
1<br>      ILU: tolerance for zero pivot 
1e-012<br>           
out-of-place 
factorization<br>           
matrix ordering: natural<br>      ILU: factor fill 
ratio needed 1<br>           
Factored matrix 
follows<br>          Matrix 
Object:<br>            
type=seqaij, rows=24, 
cols=24<br>            
total: nonzeros=300, allocated 
nonzeros=840<br>              
using I-node routines: found 15 nodes, limit used is 5<br>    
linear system matrix = precond matrix:<br>    Matrix 
Object:<br>      type=seqaij, rows=24, 
cols=24<br>      total: nonzeros=300, allocated 
nonzeros=1920<br>        using I-node 
routines: found 15 nodes, limit used is 5<br>Nonlinear solve converged due to 
CONVERGED_TR_DELTA<br>STEP 0 (Newton iterations: 3)</font></div>
<div> </div>
<div><font size="2">WARNING! There are options you set that were not 
used!<br>WARNING! could be spelling mistake, etc!<br>Option left: 
name:-options_dump no value <br></font></div>
<div> </div>
<blockquote style="border-left:#000000 2px solid;padding-left:5px;padding-right:0px;margin-left:5px;margin-right:0px">
  <div style="font:10pt arial">----- Original Message ----- </div>
  <div style="font:10pt arial;background:#e4e4e4"><b>From:</b> 
  <a title="knepley@gmail.com" href="mailto:knepley@gmail.com" target="_blank">Matthew Knepley</a> 
  </div>
  <div style="font:10pt arial"><b>To:</b> <a title="petsc-users@mcs.anl.gov" href="mailto:petsc-users@mcs.anl.gov" target="_blank">PETSc users list</a> </div>
  <div style="font:10pt arial"><b>Sent:</b> Tuesday, June 21, 2011 5:46 
AM</div>
  <div style="font:10pt arial"><b>Subject:</b> Re: [petsc-users] MSVC debug 
  runs in a different branch.</div>
  <div><br></div>On Mon, Jun 20, 2011 at 9:40 PM, Tian(ICT) <span dir="ltr">&lt;<a href="mailto:rongtian@ncic.ac.cn" target="_blank">rongtian@ncic.ac.cn</a>&gt;</span> 
wrote:<br>
  <div class="gmail_quote">
  <blockquote style="border-left:#ccc 1px solid;margin:0px 0px 0px 0.8ex;padding-left:1ex" class="gmail_quote">Hi,<br>Good morning/evening!<br>I have this issue for 
    quite a while. Using MSVC with Petsc, when debuging the code, the 
    FormJacobian was never called, instead calling &quot;MatMFFDComputeJacobian(SNES 
    snes,Vec x,Mat *jac,Mat *B,MatStructure *flag,void *dummy)&quot;, though I donot 
    use matrix free option.<br><br>However, when runing the same thing in 
    command line (still a debug compilation), I can see FormJacobian was called 
    correctly.<br><br>Any hint?<br></blockquote>
  <div><br></div>
  <div>My guess is that you are getting the matrix-free option from somewhere 
  (maybe a .petscrc file?). You can use -options_dump to see</div>
  <div>everything passed in. If not, look at SNESSetFromOptions() in the 
  debugger, and see why it is choosing MF.</div>
  <div><br></div>
  <div>   Matt</div>
  <div> </div>
  <blockquote style="border-left:#ccc 1px solid;margin:0px 0px 0px 0.8ex;padding-left:1ex" class="gmail_quote">Rong<br><br></blockquote></div><br><br clear="all"><br>-- 
  <br>What most experimenters take for granted before they begin their 
  experiments is infinitely more interesting than any results to which their 
  experiments lead.<br>-- Norbert Wiener<br></blockquote></div>
</blockquote></div><br><br clear="all"><br>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener<br>