<br><div class="gmail_extra">On Tue, Nov 6, 2012 at 12:38 PM, NAN ZHAO <span dir="ltr"><<a href="mailto:zhaonanavril@gmail.com" target="_blank">zhaonanavril@gmail.com</a>></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">

Dear all,<div><br></div><div>I tried to solve a 18 by 18 linear system with KSPsolve, the right hand vector and matrix can be found in the file in the attachment. The right hand vector has several zeros and the corresponding row in the matrix only have values in diagonal, I expected zero at this element but got -1 for the answer. I am using the tutorial code in  petsc-3.2-p6/src/ksp/ksp/examples/tutorials/ex1.c as an example to assemble the matrix and vector and to solve the system. I also include the code in the attachment. I am working on a solution now but have run out of ideas. </div>


<div><br></div><div>If you have any hint on the potential solution to this problems let me know.</div></blockquote><div><br></div><div>There are just so many errors here its hard to begin:</div><div><br></div><div>  1) Your exact solution u does not match the rhs</div>

<div><br></div><div>  2) I changed b to match u</div><div><br></div><div>  3) The solver you chose was not solving the problem. The default works fine</div><div><br></div><div>Here is the fixed up code. Our job is not to debug your code.</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>Thanks,</div><div>Nan </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<br>
</div>