<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"><meta http-equiv="Content-Type" content="text/html charset=windows-1252"><style type="text/css">body { background: rgba(255, 255, 255, 255); }</style></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi all,<div><br></div><div>I’m solving a non-linear advection-diffusion problem in 2D and am testing the routine on various meshes. The non-linearity is handled via Newton’s method. If I consider the unit square [0,1]^2, my results were fine. I tried testing on [-1,1]^2 and got either garbage results or a warning about zero pivots.</div><div><br></div><div>I thought my Jacobian might be computed incorrectly, but I think that isn’t the case since I applied -pc-factor_shift_type POSITIVE DEFINITE and miraculously got the correct result now. But in applying this factor shift over various trials on the same problem, the results seem to be pretty random. Since I am testing on manufactured solutions, I force the problem to be linear since I have prior knowledge of the exact solution and Newton’s method should converge in one iteration. For instance, this is what the result should be (iterations and errors are for each Newton iteration)</div><div><br></div><div></div><div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"></div><blockquote type="cite"><div style="margin: 0px; font-size: 11px; font-family: Menlo;">student-113-wless94-099:NonlinearAdvectionDiffusion justindong$ ./main -pc_factor_shift_type POSITIVE_DEFINITE</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Iteration: 1, Error: 0.000000e+00</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Iterations for convergence: 1</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Iteration: 1, Error: 0.000000e+00</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Iterations for convergence: 1</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Iteration: 1, Error: 0.000000e+00</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Iterations for convergence: 1</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Iteration: 1, Error: 0.000000e+00</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Iterations for convergence: 1</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Iteration: 1, Error: 0.000000e+00</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Iterations for convergence: 1</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Error in L2-norm:</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">4.55137e-02 </div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">3.28222e-03 </div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">2.24076e-04 </div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">1.41531e-05 </div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">8.87205e-07 </div><div style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Error in H1-norm:</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">4.72542e-01 </div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">6.63469e-02 </div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">9.33978e-03 </div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">1.18329e-03 </div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">1.48449e-04 </div><div style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Convergence in L2-norm:</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">3.793556 </div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">3.872613 </div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">3.984794 </div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">3.995709 </div><div style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Convergence in H1-norm:</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">2.832342 </div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">2.828567 </div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">2.980589 </div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">2.994760 </div></blockquote></div><div><br></div><div>But then this call gives a completely different result.</div><div><br></div><div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"></div><blockquote type="cite"><div style="margin: 0px; font-size: 11px; font-family: Menlo;">student-113-wless94-099:NonlinearAdvectionDiffusion justindong$ ./main -pc_factor_shift_type POSITIVE_DEFINITE</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Iteration: 1, Error: 1.116824e-01</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Iteration: 2, Error: 1.788701e-14</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Iterations for convergence: 2</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Iteration: 1, Error: 4.592120e-02</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Iteration: 2, Error: 6.520052e-03</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Iteration: 3, Error: 0.000000e+00</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Iterations for convergence: 3</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Iteration: 1, Error: 4.706179e-02</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Iteration: 2, Error: 0.000000e+00</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Iterations for convergence: 2</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Iteration: 1, Error: 0.000000e+00</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Iterations for convergence: 1</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Iteration: 1, Error: 0.000000e+00</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Iterations for convergence: 1</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Error in L2-norm:</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">1.20600e-01 </div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">4.33519e-02 </div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">4.70623e-02 </div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">1.41531e-05 </div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">8.87205e-07 </div><div style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Error in H1-norm:</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">6.04173e-01 </div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">1.72409e-01 </div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">1.82071e-01 </div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">1.18329e-03 </div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">1.48449e-04 </div><div style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Convergence in L2-norm:</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">1.476068 </div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">-0.118478 </div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">11.699236 </div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">3.995709 </div><div style="margin: 0px; font-size: 11px; font-family: Menlo; min-height: 13px;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">Convergence in H1-norm:</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">1.809128 </div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">-0.078670 </div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">7.265561 </div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">2.994760 </div></blockquote></div><div><br></div><div><br></div><div>Since I’m still just testing various examples using my code, I could just run it until it gives me the correct result, but that seems silly. Is there anyway I can get consistent results? I know I can specify the amount of the shift, but since I’m not well versed in these solvers, I’m not sure what to specify.</div></body></html>