[petsc-users] On pure boundary conditions with SNES

Bao Kai paeanball at gmail.com
Wed Apr 25 04:52:57 CDT 2012


Dear All,

I am solving a problem with pure boundary conditions with SNES with
PETSc. I got the correct result with the following code, and it seems
that Petsc detected the singularity and managed to solve that ( by
adding another constraint like \sigma p_i=0?). However, it was much
slower compared to other simulations with well defined boundary
conditions.

I know how to tell the solver to remove the null space for linear
solver ksp.  I am wondering if somebody  can tell me how to tell the
snes solver to remove the null space so that the solution may be much
faster.

Thank you very much.

Best Regards,
Kai

       call SNESSetFunction(solv%snes, solv%resi, FormFunction, equ, ierr)

       call DMGetMatrix(solv%da, MATAIJ, solv%jac,ierr)
       call DMGetColoring(solv%da,IS_COLORING_GLOBAL,MATAIJ,iscoloring,ierr)
       call MatFDColoringCreate(solv%jac,iscoloring,matfdcoloring,ierr)
       call MatFDColoringSetFunction(matfdcoloring,FormFunction,equ,ierr)
       call MatFDColoringSetFromOptions(matfdcoloring,ierr)
       call SNESSetJacobian(solv%snes, solv%jac,
solv%jac,SNESDefaultComputeJacobianColor, matfdcoloring, ierr)
       call ISColoringDestroy(iscoloring,ierr)

       call SNESSetFromOptions(solv%snes,ierr)
       call SNESSolve(solv%snes,PETSC_NULL_OBJECT, solv%soln,ierr)
       call DMGetLocalVector(solv%da, soln_work, ierr)


More information about the petsc-users mailing list