On Tue, Nov 6, 2012 at 12:38 PM, NAN ZHAO <zhaonanavril at gmail.com> wrote:
> Dear all, > > 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. > > If you have any hint on the potential solution to this problems let me > know. > There are just so many errors here its hard to begin: 1) Your exact solution u does not match the rhs 2) I changed b to match u 3) The solver you chose was not solving the problem. The default works fine Here is the fixed up code. Our job is not to debug your code. Matt > Thanks, > Nan > -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20121106/aef73fa8/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: ex1.c Type: text/x-csrc Size: 12961 bytes Desc: not available URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20121106/aef73fa8/attachment.c>
