Ah, okay. With petsc-dev, just call MatSetNullSpace(). With earlier versions, SNESGetKSP, KSPSetNullSpace. On Dec 5, 2011 8:10 PM, "Hailong Xiao" <xiaohl1986 at gmail.com> wrote:
> Hi Jed > > I am not going to set Dirichlet conditions. > I just look at the webpage (maybe you wrote ) someone recommended > > > http://www.cfd-online.com/Forums/main/15709-singular-linear-system-pressure-poisson-equation.html > > "You need to remove the null space. The best way is to tell the Krylov > solver about this (see KSPSetNullSpace(...) in PETSc) but you can also fix > the pressure at one point. That is, pick any row of your matrix and set it > to a row of the identity and put 0 on the right hand side. This should also > make the matrix nonsingular, but it disrupts the spectrum so may effect > convergence rates (highly preconditioner dependent). " > > Since I am studying the performance of the preconditioners, it would be > great for me that the spectrum would not be disrupted. > It seems like KSPSetNullSpace(...) could better handle it. > My code only has the application of the matrix not forming the matrix > explicitly. > > Maybe I just fix one value is 1. > Hailong > > > On Mon, Dec 5, 2011 at 9:36 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote: > >> There is not a PETSc function to set Dirichlet conditions. There are many >> ways to do it, you should pick a way they works well for your problem. >> >> I think you might misunderstand KSPSetNullSpace. >> On Dec 5, 2011 6:59 PM, "Hailong Xiao" <xiaohl1986 at gmail.com> wrote: >> >>> Hi >>> >>> I am solving an elliptic problem with Neumann boundary condition >>> with dmda routines by snes solver. >>> I set up the residue by DMDASetLocalFunction. >>> Besides the way like fix the first value to be one by myself, is there >>> way to do it by petsc routine? like the KSPSetNullSpace() rountine does? >>> >>> -- >>> Hailong >>> >> > > > -- > Hailong > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20111205/8508b30e/attachment.htm>
