Thanks Barry and Matt, <div><br></div><div>Barry, </div><div><span class="Apple-style-span" style> 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.</span></div>
<div><br></div><div>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. </div><div>The problem is that my code (CFD, incompressible flow 3D) diverges after a long time integration and I am trying to find out why. </div>
<div>The system that I have is a fairly big one, i.e. 100 million grid points and more. <br>I see that pressure solution (which is obviously coupled to the velocity field) starts showing strange behavior. </div><div>That's why I tried to first double check my pressure solver.</div>
<div><br></div><div>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? </div><div><br></div><div><br></div><div>Matt, </div>
<div><div style>1) Matlab could be doing a lot of things. I am betting that they scale the problem, so -pc_type jacobi.</div></div><div><br></div><div>That could be right. The reason that I relied on the MATLAB's gmres solver to behave exactly similar to PETSc was just their "help" saying that </div>
<div>************</div><div><div> X = GMRES(A,B,RESTART,TOL,MAXIT,M1,M2) use preconditioner M or M=M1*M2</div><div> and effectively solve the system inv(M)*A*X = inv(M)*B for X. If M is</div><div> [] then a preconditioner is not applied.</div>
</div><div>************</div><div><br></div><div>Best, </div><div>Mohamad</div><div><br></div><div><div class="gmail_quote">On Sat, Jan 7, 2012 at 5:39 PM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><br>
On Jan 7, 2012, at 4:00 PM, Mohamad M. Nasr-Azadani wrote:<br>
<br>
> Hi guys,<br>
><br>
> I am trying to narrow down an issue with my Poisson solver.<br>
> I have the following problem setup<br>
><br>
> Laplace(f) = rhs(x,z,y)<br>
> 0 <= x,y,z <= (Lx,Ly,Lz)<br>
><br>
> I solve the Poisson equation in three dimensions with the analytical function f(x,y,z) defined by<br>
><br>
> f(x,z,y) = cos(2*pi*x/Lx)*cos(2*pi*y/Ly)*cos(2*pi*z/Lz) + K<br>
> where Lx = Ly =Lz = 1.0 and K is a constant I use to set f(Lx,Ly,Lz) = 0.0.<br>
><br>
> Second order descritization is used for the Poisson equation.<br>
> Also, Neumann boundary condition is used everywhere, but I set the top-right-front node's value to zero to get rid of the Nullspaced matrix manually.<br>
<br>
</div> Please don't do this. That results in a unnecessaryly huge condition number. Use KSPSetNullSpace.()<br>
<br>
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>
<span class="HOEnZb"><font color="#888888"><br>
Barry<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
> I use 20 grid points in each direction.<br>
><br>
> The problem is:<br>
> I use GMRES(20) without any preconditioners (rtol = 1e-12) to solve the linear system.<br>
> It takes 77,000 iterations to converge!!!!<br>
><br>
> For the size of only 8,000 unknowns, even though the lsys is not preconditioned, I guess that is a LOT of iterations.<br>
> Next, I setup the exact same problem in MATLAB and use their GMRES solver function.<br>
> I set the same parameters and MATLAB tells me that it converges using only 3870 iterations.<br>
><br>
> I know that there might be some internal differences between MATLAB and PETSc's implementations of this method, but given the fact that these two solvers are not preconditioned, I am wondering about this big difference?<br>
><br>
> Any ideas?<br>
><br>
> Best,<br>
> Mohamad<br>
><br>
<br>
</div></div></blockquote></div><br></div>