On Fri, Nov 2, 2012 at 10:15 AM, NAN ZHAO <zhaonanavril at gmail.com> wrote:
> Dear all, > > I am using PETSC to solve a nonlinear system with newton's method. I > actually calculate the jacobian matrix in each newton iteration and solve > the linear system by KSPsolve. However, I found one thing > really brothers me is the ultra small numbers in the matrix (MPIBAIJ > matrix). In the sparse matrix I create some location should be zero but I > got some small values like 1e-23 instead. I use matzeroentries each time I > give new value to the matrix and this problem still exist. What makes me > more confuse is that if I do not use matzeroentries each time I give new > values to the matrix, the locations which should be zero get exactly > 0.0000e0 (although other values is wrong, cause I add new value to the > location when I assemble the matrix, I can not use insert as the procedure > is like finite element assembling). Does anyone have insight of why this > happens? P.S. I tried destroy the matrix each time I give the new value but > same thing happens. > You are not doing what you think you are doing. This has nothing to do with MatZeroEntries(). You are inserting weird values in the matrix, probably by misspecifying a length, so that MatSetValues() reads off the end of an array. Run your code through valgrind. Matt > Regards, > 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/20121102/9dab3439/attachment.html>
