[petsc-users] Convergence problem in solving a symmetric positive definite matrix in a CFD code

Jed Brown jedbrown at mcs.anl.gov
Fri Dec 13 10:37:42 CST 2013


"Xiao, Jianjun (IKET)" <jianjun.xiao at kit.edu> writes:
> The calculation did not converge at the first time step with
> PCR+JACOBI. 

Your matrix has a negative diagonal, but CR requires an SPD
preconditioner.  CG requires that too, but it automatically attempts to
flip the sign to make up for people formulating as a negative-definite
system.

Here is what happens if you flip the sign in the file.

~/petsc/src/ksp/ksp/examples/tutorials$ ./ex10 -f /tmp/binaryoutput_PD -rhs 0 -ksp_type cr -pc_type jacobi -ksp_monitor_true_residual -ksp_converged_reason
  0 KSP preconditioned resid norm 4.580179811550e-01 true resid norm 1.118033988750e+01 ||r(i)||/||b|| 1.000000000000e+00
  1 KSP preconditioned resid norm 3.433059076126e-01 true resid norm 1.171499592651e+01 ||r(i)||/||b|| 1.047821089913e+00
  2 KSP preconditioned resid norm 3.224273883310e-01 true resid norm 1.186428209805e+01 ||r(i)||/||b|| 1.061173651019e+00
  3 KSP preconditioned resid norm 3.161490448951e-01 true resid norm 1.190487417460e+01 ||r(i)||/||b|| 1.064804316720e+00
  4 KSP preconditioned resid norm 3.134497494248e-01 true resid norm 1.191266712565e+01 ||r(i)||/||b|| 1.065501339451e+00
  5 KSP preconditioned resid norm 3.116324194377e-01 true resid norm 1.190750014933e+01 ||r(i)||/||b|| 1.065039191039e+00
  6 KSP preconditioned resid norm 3.103182665201e-01 true resid norm 1.189333423670e+01 ||r(i)||/||b|| 1.063772153295e+00
  7 KSP preconditioned resid norm 3.099146457154e-01 true resid norm 1.188235324536e+01 ||r(i)||/||b|| 1.062789983572e+00
  8 KSP preconditioned resid norm 3.098484368758e-01 true resid norm 1.187621039989e+01 ||r(i)||/||b|| 1.062240550770e+00
  9 KSP preconditioned resid norm 3.098427227728e-01 true resid norm 1.187506497491e+01 ||r(i)||/||b|| 1.062138100845e+00
 10 KSP preconditioned resid norm 3.098403289528e-01 true resid norm 1.187404392635e+01 ||r(i)||/||b|| 1.062046775486e+00
 11 KSP preconditioned resid norm 3.098364579073e-01 true resid norm 1.187232365639e+01 ||r(i)||/||b|| 1.061892909863e+00
 12 KSP preconditioned resid norm 3.098258616063e-01 true resid norm 1.186975299234e+01 ||r(i)||/||b|| 1.061662982680e+00
 13 KSP preconditioned resid norm 3.097972567200e-01 true resid norm 1.186780996443e+01 ||r(i)||/||b|| 1.061489192980e+00
 14 KSP preconditioned resid norm 3.094048026767e-01 true resid norm 1.184190035808e+01 ||r(i)||/||b|| 1.059171767338e+00
 15 KSP preconditioned resid norm 3.072833013214e-01 true resid norm 1.174521125483e+01 ||r(i)||/||b|| 1.050523631035e+00
 16 KSP preconditioned resid norm 2.958951624767e-01 true resid norm 1.115235499681e+01 ||r(i)||/||b|| 9.974969552830e-01
 17 KSP preconditioned resid norm 2.755553854179e-01 true resid norm 8.534143514965e+00 ||r(i)||/||b|| 7.633170011680e-01
 18 KSP preconditioned resid norm 9.919182748576e-02 true resid norm 2.746916984686e+00 ||r(i)||/||b|| 2.456917242523e-01
 19 KSP preconditioned resid norm 1.583757214911e-02 true resid norm 4.932287392439e-01 ||r(i)||/||b|| 4.411571957624e-02
 20 KSP preconditioned resid norm 3.653926848384e-03 true resid norm 9.899702253503e-02 ||r(i)||/||b|| 8.854562878336e-03
 21 KSP preconditioned resid norm 5.722006539625e-04 true resid norm 2.492171919704e-02 ||r(i)||/||b|| 2.229066329629e-03
 22 KSP preconditioned resid norm 1.094837296062e-04 true resid norm 4.041397396052e-03 ||r(i)||/||b|| 3.614735720665e-04
 23 KSP preconditioned resid norm 3.160350857762e-05 true resid norm 1.114526226356e-03 ||r(i)||/||b|| 9.968625619355e-05
 24 KSP preconditioned resid norm 3.789869369652e-06 true resid norm 1.371099464070e-04 ||r(i)||/||b|| 1.226348642229e-05
Linear solve converged due to CONVERGED_RTOL iterations 24
Number of iterations =  24
Residual norm 0.00013711



That's pretty much the same as CG.  If you think something is "wrong",
you'll have to show us exactly what you think is wrong, the output you
see and what you expect, and provide steps to reproduce.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20131213/0e3bb0be/attachment.pgp>


More information about the petsc-users mailing list