[petsc-users] On pure boundary conditions with SNES

Jed Brown jedbrown at mcs.anl.gov
Wed Apr 25 06:28:42 CDT 2012


On Wed, Apr 25, 2012 at 04:52, Bao Kai <paeanball at gmail.com> wrote:

> 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.
>

If it's just the constant, you can use -ksp_constant_null_space, but if it
converged (did the residual actually go to zero?), the problem might have
already been consistent. To set the null space more directly, use
SNESGetKSP, then KSPSetNullSpace; with petsc-dev, you can just call
MatSetNullSpace() on the operator (and preconditioning matrix, if
applicable).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120425/671eeebe/attachment.htm>


More information about the petsc-users mailing list