<div dir="ltr">Yes. To be precise this is the set of functions I call:<div><br></div><div>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,0,0)">ierr</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">MatNullSpaceCreate</span><span style="color:rgb(0,0,0)">(</span><font color="#800000">mpicomm</font><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">PETSC_FALSE</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">1</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">&</span><span style="color:rgb(128,0,0)">null_space</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">&</span><span style="color:rgb(128,0,0)">A_null_space</span><span style="color:rgb(0,0,0)">);</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">CHKERRXX</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,0,0)">ierr</span><span style="color:rgb(0,0,0)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,0,0)">ierr</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">MatSetNullSpace</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,0,0)">A</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,0)">A_null_space</span><span style="color:rgb(0,0,0)">);</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">CHKERRXX</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,0,0)">ierr</span><span style="color:rgb(0,0,0)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,0,0)">ierr</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">KSPSetNullSpace</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,0,0)">ksp</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,0)">A_null_space</span><span style="color:rgb(0,0,0)">);</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">CHKERRXX</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,0,0)">ierr</span><span style="color:rgb(0,0,0)">);</span></pre>
</pre><pre style="margin-top:0px;margin-bottom:0px"><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,0,0)">ierr</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">MatNullSpaceRemove</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,0,0)">A_null_space</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,0)">rhs_</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">NULL</span><span style="color:rgb(0,0,0)">);</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">CHKERRXX</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,0,0)">ierr</span><span style="color:rgb(0,0,0)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,0,0)">ierr</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">KSPSolve</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,0,0)">ksp</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,0)">rhs_</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">solution</span><span style="color:rgb(0,0,0)">);</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">CHKERRXX</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,0,0)">ierr</span><span style="color:rgb(0,0,0)">);</span></pre>
</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)"><br></span></pre></pre></pre></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Mar 6, 2014 at 3:33 PM, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div class="">On Thu, Mar 6, 2014 at 5:24 PM, Mohammad Mirzadeh <span dir="ltr"><<a href="mailto:mirzadeh@gmail.com" target="_blank">mirzadeh@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi guys,<div><br></div><div>I have a discretization of Poisson equation with Neumann bc for embedded boundary grids in such a way that that nullspace is not the usual constant vector. Instead the nullspace is constant in the domain of interest and zero elsewhere. </div>
<div><br></div><div>I compute this nullspace myself and have checked it against MATLAB by dumping the matrix and computing the nullspace explicitly using null function -- they match and there is only this single vector. Then I take this calculated vector and subtract it off the matrix and rhs.</div>
</div></blockquote><div><br></div></div><div>"subtract it off the matrix" does not make sense to me. Are you calling KSPSetNullSpace()?</div><div><br></div><div> Matt</div><div class=""><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div>However, I am having convergence issues. For instance this is the output of ksp_monitor_true_residual for one particular run:</div><div><br></div><div>
<pre style="margin-top:0px;margin-bottom:0px"><font color="#000000"> 0 KSP preconditioned resid norm 3.033840960250e+02 true resid norm 2.332886580745e-01 ||r(i)||/||b|| 1.000000000000e+00
1 KSP preconditioned resid norm 1.018974811826e+01 true resid norm 1.941629896918e-02 ||r(i)||/||b|| 8.322864527335e-02
2 KSP preconditioned resid norm 5.450493684941e-02 true resid norm 1.029339589324e-02 ||r(i)||/||b|| 4.412300185615e-02
3 KSP preconditioned resid norm 3.944064039516e-02 true resid norm 1.030277925024e-02 ||r(i)||/||b|| 4.416322394443e-02
4 KSP preconditioned resid norm 6.286181172600e-05 true resid norm 1.030243055045e-02 ||r(i)||/||b|| 4.416172923059e-02
5 KSP preconditioned resid norm 4.349133658643e-06 true resid norm 1.030239080406e-02 ||r(i)||/||b|| 4.416155885630e-02
6 KSP preconditioned resid norm 9.279429568232e-08 true resid norm 1.030239169298e-02 ||r(i)||/||b|| 4.416156266666e-02
7 KSP preconditioned resid norm 3.032522248740e-09 true resid norm 1.030239175066e-02 ||r(i)||/||b|| 4.416156291393e-02
8 KSP preconditioned resid norm 6.533747246875e-09 true resid norm 1.030239175718e-02 ||r(i)||/||b|| 4.416156294184e-02
9 KSP preconditioned resid norm 6.083185162500e-12 true resid norm 1.030239175259e-02 ||r(i)||/||b|| 4.416156292220e-02
10 KSP preconditioned resid norm 5.510319622225e-12 true resid norm 1.030239175259e-02 ||r(i)||/||b|| 4.416156292221e-02
11 KSP preconditioned resid norm 5.456758524534e-12 true resid norm 1.030239175259e-02 ||r(i)||/||b|| 4.416156292221e-02
12 KSP preconditioned resid norm 5.456756081783e-12 true resid norm 1.030239175259e-02 ||r(i)||/||b|| 4.416156292221e-02
13 KSP preconditioned resid norm 5.456755930952e-12 true resid norm 1.030239175259e-02 ||r(i)||/||b|| 4.416156292221e-02
14 KSP preconditioned resid norm 5.456755930949e-12 true resid norm 1.030239175259e-02 ||r(i)||/||b|| 4.416156292221e-02
15 KSP preconditioned resid norm 5.456755930949e-12 true resid norm 1.030239175259e-02 ||r(i)||/||b|| 4.416156292221e-02</font><br></pre><pre style="margin-top:0px;margin-bottom:0px"></pre><pre style="margin-top:0px;margin-bottom:0px">
<br></pre><pre style="margin-top:0px;margin-bottom:0px">As you can see, the true residual is quite large and moreover it does not reduce beyond a certain point. This is using hypre as preconditioner, but the situation is equally bad with several other preconditioner (ilu, sor, jacobi, or even none). As for the solution itself, the error has poor to none convergence under grid refinement. All this suggests that the linear system is not converging in my case. </pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px">Do you have any idea/suggestions why this is happening and how I can avoid it?</pre><pre style="margin-top:0px;margin-bottom:0px">
<br></pre><pre style="margin-top:0px;margin-bottom:0px">Thanks</pre></div></div>
</blockquote></div></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener
</font></span></div></div>
</blockquote></div><br></div>