Hi Jed<br><br>I am not going to set Dirichlet conditions.<br>I just look at the webpage (maybe you wrote ) someone recommended<br><br><a href="http://www.cfd-online.com/Forums/main/15709-singular-linear-system-pressure-poisson-equation.html">http://www.cfd-online.com/Forums/main/15709-singular-linear-system-pressure-poisson-equation.html</a><br>
<br>&quot;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).
                &quot;<br><br>Since I am studying the performance of the preconditioners, it would be great for me that the spectrum would not be disrupted.<br>It seems like KSPSetNullSpace(...) could better handle it.<br>My code only has the application of the matrix not forming the matrix explicitly. <br>
<br>Maybe I just fix one value is 1.<br>Hailong<br><br><br><div class="gmail_quote">On Mon, Dec 5, 2011 at 9:36 PM, Jed Brown <span dir="ltr">&lt;<a href="mailto:jedbrown@mcs.anl.gov">jedbrown@mcs.anl.gov</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><p>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.</p>

<p>I think you might misunderstand KSPSetNullSpace.</p><div class="HOEnZb"><div class="h5">
<div class="gmail_quote">On Dec 5, 2011 6:59 PM, &quot;Hailong Xiao&quot; &lt;<a href="mailto:xiaohl1986@gmail.com" target="_blank">xiaohl1986@gmail.com</a>&gt; wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="gmail_quote">Hi<div><br></div><div>I am solving an elliptic problem with Neumann boundary condition with dmda routines by snes solver.</div><div>I set up the residue by DMDASetLocalFunction.</div><div>Besides the way like fix the first value to be one by myself, is there way to do it by petsc routine? like the <span style="font-family:Simsun;background-color:rgb(213,234,255);font-size:medium">KSPSetNullSpace() rountine does?</span></div>


<span><font color="#888888">
<div><br clear="all"><div><span style="color:rgb(0,0,0)">-- </span></div></div></font></span></div>Hailong<br>
</blockquote></div>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Hailong<br>