[petsc-users] KSP linear solver
Que Cat
quecat001 at gmail.com
Sat Jan 18 13:46:45 CST 2014
Dear Petsc-Users,
I debug my code. I solve the small linear system using KSP.
The matrix is:
row 0: (0, -123354) (1, 6.92922e-310) (2, 123354) (3, 1.38582e-309)
row 1: (0, 1.3858e-309) (1, 91156.6) (2, 6.92901e-310) (3, 91156.6)
row 2: (0, 8768.96) (1, 2.47033e-323) (2, -171955) (3, 1.02212e-316)
(4, 163186) (5, 0)
row 3: (0, 0) (1, -59201.7) (2, 0) (3, 156037) (4, 0) (5, 93996.1)
row 4: (2, 13422.8) (3, 0) (4, -13422.8) (5, 0)
row 5: (2, 0) (3, -58000.3) (4, 0) (5, 59201.7)
the RHS vector:
-9115.66
-17760.5
-425.926
-35400.9
9541.58
-17520.2
the solution I got was:
-2.00943e+52
-1.17929e+18
-2.00943e+52
7.121e+16
-2.00943e+52
-7.0943e+16
I checked with matlab and I got the totally different solution. I guess
there is something wrong with the linear solver I set up as follow:
KSPSetOperators(ksp, mat_A, mat_A, SAME_NONZERO_PATTERN);
// set the linear solve options
KSPSetType(ksp, KSPGMRES);
KSPGMRESSetRestart(ksp, 100);
// set preconditioning options
KSPGetPC(ksp, &pc);
PCSetType(pc, PCBJACOBI);
KSPSetFromOptions(ksp);
// Solve the linear system
KSPSolve(ksp,vec_rhs,vec_sol);
Could anyone give me a suggestion where should be the source of error?
Thank you!
Que
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140118/41a037f5/attachment.html>
More information about the petsc-users
mailing list