Below a piece of code is shown to solve a linear system.
ierr = KSPCreate(PETSC_COMM_WORLD,&ksp); CHKERRQ(ierr);
ierr = KSPSetOperators(ksp,A,A,DIFFERENT_NONZERO_PATTERN); CHKERRQ(ierr);
KSPSetType(ksp,KSPBCGS);
ierr = KSPSetTolerances(ksp,1.e-2/((m+1)*(n+1)),1.e-50,PETSC_DEFAULT, PETSC_DEFAULT); CHKERRQ(ierr);
ierr = KSPSetFromOptions(ksp);CHKERRQ(ierr);
ierr = PCSetType(pc,PCSOR);CHKERRQ(ierr);
ierr = KSPSolve(ksp,b,x);CHKERRQ(ierr);
According to the PETSC manual, PETSC uses GMRES with an ILU(0) preconditioner to solve SLE. I want to modify code to solve system using the BiCGStab method with a SSOR preconditioner.
Can someone help to do that?