<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Nov 29, 2013 at 1:11 AM, Justin Dong <span dir="ltr"><<a href="mailto:jsd1@rice.edu" target="_blank">jsd1@rice.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">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</div></div></blockquote><div><br></div>
<div>I still think your code has a problem. There should be no indefiniteness with the discretizations i am familiar with. Simplify the problem until</div><div>you understand everything. Make it linear diffusion on the new grid. Should be exactly the same as the old grid. If you get indefiniteness when</div>
<div>adding advection, go to the element that causes it and see what is happening. None of the methods you use are non-deterministic, so I am</div><div>guessing you have an uninitialized variable. Check with valgrind.</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 style="word-wrap:break-word"><div> 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>
</div></blockquote></div><br><br clear="all"><div><br></div>-- <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
</div></div>