<div class="gmail_quote">On Wed, Apr 25, 2012 at 04:52, Bao Kai <span dir="ltr"><<a href="mailto:paeanball@gmail.com">paeanball@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Dear All,<br>
<br>
I am solving a problem with pure boundary conditions with SNES with<br>
PETSc. I got the correct result with the following code, and it seems<br>
that Petsc detected the singularity and managed to solve that ( by<br>
adding another constraint like \sigma p_i=0?). However, it was much<br>
slower compared to other simulations with well defined boundary<br>
conditions.<br>
<br>
I know how to tell the solver to remove the null space for linear<br>
solver ksp. I am wondering if somebody can tell me how to tell the<br>
snes solver to remove the null space so that the solution may be much<br>
faster.<br></blockquote><div><br></div><div>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).</div>
<div> </div></div>