How do you know it is diverging? Because it looks weird? You are comparing it to something?<br>
<br>While marching in time, it only takes 20-30 iterations to solve for pressure. <br>After a very long integrattion in time, all of a sudden the pressure lsys does not converge even in 10,000 iterations. So, that&#39;s why I am saying it is converging. <br>

<br>
    How accurately are you solving the linear system?<br>
I tried rtol = 1e-10 and 1e-12. <br><br>     What strange behavior?  Is the right hand side for the pressure 
solution reasonable but the solution &quot;strange&quot;? How do you know you are 
not giving &quot;bad stuff&quot; to the pressure solve?<br>
<span class="HOEnZb"><font color="#888888"><span style="color:rgb(0,0,0)">For my case, I get huge pressure gradients close to the solid boundaries. That, indeed, causes very small delta_t&#39;s when I keep integrating. That should not happen cause at this stage of my simulations, nothing is really happening in the flow field. Very small velocities and velocity gradients. </span><br style="color:rgb(0,0,0)">

<span style="color:rgb(0,0,0)">I am trying to find the problem, since I have only seen this for such big problem size, i.e. 100 million grid points. That makes it really hard to see if the I am feeding back rhs into the pressure linear system. </span><br style="color:rgb(0,0,0)">

<br style="color:rgb(0,0,0)"><span style="color:rgb(0,0,0)">Best, </span><br style="color:rgb(0,0,0)"><span style="color:rgb(0,0,0)">Mohamad</span><br><br><br><br></font></span><br><br><br><div class="gmail_quote">On Sun, Jan 8, 2012 at 6:47 PM, Barry Smith <span dir="ltr">&lt;<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="im"><br>
On Jan 8, 2012, at 5:13 PM, Mohamad M. Nasr-Azadani wrote:<br>
<br>
&gt; Thanks Barry and Matt,<br>
&gt;<br>
&gt; Barry,<br>
&gt;   Also if you are really solving the Poisson problem you should use multigrid; if simple geometry then geometric multigrid if complicated geometry probably easier to use hypre BoomerAMG. No sane person solves Poisson problem with anything but a multigrid or FFT based solver.<br>


&gt;<br>
&gt; In my main code, I am actually doing what you suggested, i.e. GMRES + boomerAMG to solve for my Poisson equation. I have not used the KSPSetNullSpace() though.<br>
&gt; The problem is that my code (CFD, incompressible flow 3D) diverges after a long time integration<br>
<br>
</div>    How do you know it is diverging? Because it looks weird? You are comparing it to something?<br>
<br>
<br>
    How accurately are you solving the linear system?<br>
<div class="im"><br>
<br>
&gt; and I am trying to find out why.<br>
&gt; The system that I have is a fairly big one, i.e. 100 million grid points and more.<br>
&gt; I see that pressure solution (which is obviously coupled to the velocity field) starts showing strange behavior.<br>
<br>
</div>     What strange behavior?  Is the right hand side for the pressure solution reasonable but the solution &quot;strange&quot;? How do you know you are not giving &quot;bad stuff&quot; to the pressure solve?<br>
<span class="HOEnZb"><font color="#888888"><br>
   Barry<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
&gt; That&#39;s why I tried to first double check my pressure solver.<br>
&gt;<br>
&gt; Based on your experience, do you think that not using a nullspace() for the pressure solver for that linear system size could have caused it to diverge?<br>
&gt;<br>
&gt;<br>
&gt; Matt,<br>
&gt; 1) Matlab could be doing a lot of things. I am betting that they scale the problem, so -pc_type jacobi.<br>
&gt;<br>
&gt; That could be right. The reason that I relied on the MATLAB&#39;s gmres solver to behave exactly similar to PETSc was just their &quot;help&quot; saying that<br>
&gt; ************<br>
&gt;  X = GMRES(A,B,RESTART,TOL,MAXIT,M1,M2) use preconditioner M or M=M1*M2<br>
&gt;     and effectively solve the system inv(M)*A*X = inv(M)*B for X. If M is<br>
&gt;     [] then a preconditioner is not applied.<br>
&gt; ************<br>
&gt;<br>
&gt; Best,<br>
&gt; Mohamad<br>
&gt;<br>
&gt; On Sat, Jan 7, 2012 at 5:39 PM, Barry Smith &lt;<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>&gt; wrote:<br>
&gt;<br>
&gt; On Jan 7, 2012, at 4:00 PM, Mohamad M. Nasr-Azadani wrote:<br>
&gt;<br>
&gt; &gt; Hi guys,<br>
&gt; &gt;<br>
&gt; &gt; I am trying to narrow down an issue with my Poisson solver.<br>
&gt; &gt; I have the following problem setup<br>
&gt; &gt;<br>
&gt; &gt; Laplace(f) = rhs(x,z,y)<br>
&gt; &gt; 0 &lt;= x,y,z &lt;= (Lx,Ly,Lz)<br>
&gt; &gt;<br>
&gt; &gt; I solve the Poisson equation in three dimensions with the analytical function f(x,y,z) defined by<br>
&gt; &gt;<br>
&gt; &gt; f(x,z,y) = cos(2*pi*x/Lx)*cos(2*pi*y/Ly)*cos(2*pi*z/Lz) + K<br>
&gt; &gt; where Lx = Ly =Lz = 1.0 and K is a constant I use to set f(Lx,Ly,Lz) = 0.0.<br>
&gt; &gt;<br>
&gt; &gt; Second order descritization is used for the Poisson equation.<br>
&gt; &gt; Also, Neumann boundary condition is used everywhere, but I set the top-right-front node&#39;s value to zero to get rid of the Nullspaced matrix manually.<br>
&gt;<br>
&gt;   Please don&#39;t do this. That results in a unnecessaryly huge condition number. Use KSPSetNullSpace.()<br>
&gt;<br>
&gt;   Also if you are really solving the Poisson problem you should use multigrid; if simple geometry then geometric multigrid if complicated geometry probably easier to use hypre BoomerAMG. No sane person solves Poisson problem with anything but a multigrid or FFT based solver.<br>


&gt;<br>
&gt;   Barry<br>
&gt;<br>
&gt; &gt; I use 20 grid points in each direction.<br>
&gt; &gt;<br>
&gt; &gt; The problem is:<br>
&gt; &gt; I use GMRES(20) without any preconditioners (rtol = 1e-12) to solve the linear system.<br>
&gt; &gt; It takes 77,000 iterations to converge!!!!<br>
&gt; &gt;<br>
&gt; &gt; For the size of only 8,000 unknowns, even though the lsys is not preconditioned, I guess that is a LOT of iterations.<br>
&gt; &gt; Next, I setup the exact same problem in MATLAB and use their GMRES solver function.<br>
&gt; &gt; I set the same parameters and MATLAB tells me that it converges using only 3870 iterations.<br>
&gt; &gt;<br>
&gt; &gt; I know that there might be some internal differences between MATLAB and PETSc&#39;s implementations of this method, but given the fact that these two solvers are not preconditioned, I am wondering about this big difference?<br>


&gt; &gt;<br>
&gt; &gt; Any ideas?<br>
&gt; &gt;<br>
&gt; &gt; Best,<br>
&gt; &gt; Mohamad<br>
&gt; &gt;<br>
&gt;<br>
&gt;<br>
<br>
</div></div></blockquote></div><br>