[petsc-users] MatSOR and GaussSeidel

Cyrill Vonplanta cyrill.von.planta at usi.ch
Tue Aug 23 03:51:04 CDT 2016


Dear PETSc-Users,

I am debugging a smoother of ours and i was wondering what settings of MatSOR exactly form one ordinary Gauss Seidel smoothing step. Currently I use:

ierr = MatSOR(A,b,1.0,(MatSORType)(SOR_ZERO_INITIAL_GUESS | SOR_FORWARD_SWEEP),0,1,1,x); CHKERRV(ierr);

I expect this to be the same as this naïve Gauss-Seidel step:


for (int i=0;i<m;i++){

      sum_i = 0;

      sum_i += ps_b_values[i];

      for (int j=0;j<m;j++){

        sum_i -= ps_A_values[i+j*m]*ps_x_values[j];

      }

      ps_x_values[i] += sum_i/ps_A_values[i*m +i];

}

The ps_* refer to the data parts of PETSc types (everything is serial and dense in my toy example. Initial x is zero.m is dimension of A). However the convergence history looks different. Am I missing something here?

Best Cyrill



More information about the petsc-users mailing list