Re: [petsc-users] How to speed up geometric multigrid

2013-10-03 Thread Jed Brown
Michele Rosso writes: > Barry, > > thank you, I hope to be able to fix this bug. > On a side note, I took a look at ex34.c and I noticed that the nullspace > is removed not only from the matrix but from the rhs as well. Why is > this done? You need the right hand side to be consistent if you w

Re: [petsc-users] How to speed up geometric multigrid

2013-10-03 Thread Michele Rosso
Barry, thank you, I hope to be able to fix this bug. On a side note, I took a look at ex34.c and I noticed that the nullspace is removed not only from the matrix but from the rhs as well. Why is this done? Thank you. Michele On 10/02/2013 06:22 PM, Barry Smith wrote: You will need t

Re: [petsc-users] How to speed up geometric multigrid

2013-10-02 Thread Barry Smith
You will need to fix DMCreateInterpolation_DA_3D_Q0() to support periodic boundary conditions. It might be really easy, I'm not sure why it has that condition currently. Barry On Oct 2, 2013, at 6:33 PM, Michele Rosso wrote: > Barry, > > thank you, I tried but it seems the periodic bo

Re: [petsc-users] How to speed up geometric multigrid

2013-10-02 Thread Michele Rosso
Barry, thank you, I tried but it seems the periodic boundaries are problematic: [0]PETSC ERROR: - Error Message [0]PETSC ERROR: Invalid argument! [0]PETSC ERROR: Cannot handle periodic grid in x! [0]PETSC ERROR:

Re: [petsc-users] How to speed up geometric multigrid

2013-10-02 Thread Barry Smith
Ok, so piecewise constant pressures. The default DMDA multigrid is using piecewise linear interpolation. Isn't going to work well at all. You need to first add ierr = DMDASetInterpolationType(da, DMDA_Q0);CHKERRQ(ierr); after you create the DM. You should be seeing much better convergence

Re: [petsc-users] How to speed up geometric multigrid

2013-10-02 Thread Matthew Knepley
On Wed, Oct 2, 2013 at 5:12 PM, Michele Rosso wrote: > Barry, > > sorry for not replying to your other e-mail earlier. > The equation I am solving is: > > [image: $\nabla\cdot(\frac{1}{\rho}\nabla p)=\nabla\cdot u^*$] > > where [image: $p$] is the pressure field, [image: $\rho$] the density > fi

Re: [petsc-users] How to speed up geometric multigrid

2013-10-02 Thread Michele Rosso
Dave, I am using a 2D decomposition, so if I increase the number of levels, I have to decrease the number of processors I am using in order to have enough grid points per processor for the multigrid to work. Michele On 10/02/2013 03:05 PM, Dave May wrote: And why are you fixed on 5 levels?

Re: [petsc-users] How to speed up geometric multigrid

2013-10-02 Thread Michele Rosso
Barry, sorry for not replying to your other e-mail earlier. The equation I am solving is: where is the pressure field, the density field and   the velocity field. Since I am using finite difference on a staggered grid, the pressure i

Re: [petsc-users] How to speed up geometric multigrid

2013-10-02 Thread Dave May
And why are you fixed on 5 levels? On Wednesday, 2 October 2013, Barry Smith wrote: > > Something is wrong, you should be getting better convergence. Please > answer my other email. > > > On Oct 2, 2013, at 1:10 PM, Michele Rosso > > wrote: > > > Thank you all for your contribution. > > So far

Re: [petsc-users] How to speed up geometric multigrid

2013-10-02 Thread Barry Smith
Something is wrong, you should be getting better convergence. Please answer my other email. On Oct 2, 2013, at 1:10 PM, Michele Rosso wrote: > Thank you all for your contribution. > So far the fastest solution is still the initial one proposed by Jed in an > earlier round: > > -ksp_atol 1

Re: [petsc-users] How to speed up geometric multigrid

2013-10-02 Thread Michele Rosso
Thank you all for your contribution. So far the fastest solution is still the initial one proposed by Jed in an earlier round: -ksp_atol 1e-9 -ksp_monitor_true_residual -ksp_view -log_summary -mg_coarse_pc_factor_mat_solver_package superlu_dist -mg_coarse_pc_type lu-mg_levels_ksp_max_it

Re: [petsc-users] How to speed up geometric multigrid

2013-10-01 Thread Barry Smith
On Oct 2, 2013, at 12:28 AM, Jed Brown wrote: > "Mark F. Adams" writes: >> run3.txt uses: >> >> -ksp_type richardson >> >> This is bad and I doubt anyone recommended it intentionally. Hell this is normal multigrid without a Krylov accelerator. Under normal circumstances with geometric

Re: [petsc-users] How to speed up geometric multigrid

2013-10-01 Thread Jed Brown
"Mark F. Adams" writes: > run3.txt uses: > > -ksp_type richardson > > This is bad and I doubt anyone recommended it intentionally. I would have expected FGMRES, but Barry likes Krylov smoothers and Richardson is one of a few methods that can tolerate nonlinear preconditioners. > You also have,

Re: [petsc-users] How to speed up geometric multigrid

2013-10-01 Thread Mark F. Adams
On Oct 1, 2013, at 7:02 PM, Michele Rosso wrote: > Barry, > > I repeated the previous runs since I noticed that it was not using the options > > -mg_levels_ksp_max_it 3 > > They are faster then before now but still slower than my initial test and > anyway the solution time increases consider

Re: [petsc-users] How to speed up geometric multigrid

2013-10-01 Thread Barry Smith
Thanks. Unacceptably poor convergence of multigrid here. What kind of discretization are you using for your "projection method"? Is is cell centered? What kind of boundary conditions? If you are using cell-centered (piece-wise constant) then the interpolation you are getting is all wro

Re: [petsc-users] How to speed up geometric multigrid

2013-09-30 Thread Barry Smith
I wasn't expecting this. Try -pc_mg_type full -ksp_type richardson -mg_levels_pc_type bjacobi -mg_levels_ksp_type gmres -mg_levels_ksp_max_it 3 -mg_coarse_pc_factor_mat_solver_package superlu_dist -mg_coarse_pc_type lu -pc_mg_galerkin -pc_mg_levels 5 -pc_type mg -log_summary -pc_mg_log -k

Re: [petsc-users] How to speed up geometric multigrid

2013-09-24 Thread Michele Rosso
Barry, thank you! I absolutely do not need such accuracy!!! In my code I set an accuracy of 10^(-5) for the rtol instead of atol. Thanks for pointing that out. I only need to solve up to discretization error. Anyway I will try all the variants (this time by setting the proper tolerance!) you

Re: [petsc-users] How to speed up geometric multigrid

2013-09-24 Thread Barry Smith
Thanks. The balance of work on the different levels and across processes looks ok. So it is is a matter of improving the convergence rate. The initial residual norm is very small. Are you sure you need to decrease it to 10^-12 Start with a really robust multigrid smoother use -pc_mg_t

Re: [petsc-users] How to speed up geometric multigrid

2013-09-23 Thread Michele Rosso
Thank you very much! I will make some tests and let you know how it goes. Michele On 09/23/2013 01:24 PM, Mark F. Adams wrote: Ah yes, I agree, geometric MG with Galerkin is worth trying. On Sep 23, 2013, at 3:36 PM, Dave May > wrote: Hey Michele, I think G

Re: [petsc-users] How to speed up geometric multigrid

2013-09-23 Thread Mark F. Adams
Ah yes, I agree, geometric MG with Galerkin is worth trying. On Sep 23, 2013, at 3:36 PM, Dave May wrote: > Hey Michele, > > I think Galerkin MG, even with a jump in the coefficient of 10^3, can be made > more robust and faster for your problem. > I'd start by trying different smoothers. Try

Re: [petsc-users] How to speed up geometric multigrid

2013-09-23 Thread Mark F. Adams
On Sep 23, 2013, at 11:55 AM, Michele Rosso wrote: > Hi, > > I am successfully using PETSc to solve a 3D Poisson's equation with CG + MG . > Such equation arises from a projection algorithm for a multiphase > incompressible flow simulation. > I set up the solver as I was suggested to do

Re: [petsc-users] How to speed up geometric multigrid

2013-09-23 Thread Michele Rosso
On 09/23/2013 09:24 AM, Mark F. Adams wrote: On Sep 23, 2013, at 11:55 AM, Michele Rosso > wrote: Hi, I am successfully using PETSc to solve a 3D Poisson's equation with CG + MG . Such equation arises from a projection algorithm for a multiphase incompressible flow

Re: [petsc-users] How to speed up geometric multigrid

2013-09-23 Thread Barry Smith
Run with the additional option -pc_mg_log and send us the log file. Barry Maybe we should make this the default somehow. On Sep 23, 2013, at 10:55 AM, Michele Rosso wrote: > Hi, > > I am successfully using PETSc to solve a 3D Poisson's equation with CG + MG . > Such equation arises

Re: [petsc-users] How to speed up geometric multigrid

2013-09-23 Thread Dave May
Hey Michele, I think Galerkin MG, even with a jump in the coefficient of 10^3, can be made more robust and faster for your problem. I'd start by trying different smoothers. Try cheby/(bjacobi or asm), or gmres/(bjacobi or asm). When using cheby, make sure you ask for the spectrum estimate. Definit

Re: [petsc-users] How to speed up geometric multigrid

2013-09-23 Thread Mark F. Adams
>> > The simulation does start with both phases and the geometry is supposed to > become more complex as the simulation progresses. > But so far the run is stopped before there are significant changes in the > shape of the droplet. Humm, not sure why you are seeing degradation then. I imagi

Re: [petsc-users] How to speed up geometric multigrid

2013-09-23 Thread Michele Rosso
The boundary conditions are periodic. The equation I am solving is: div(beta*grad(u))= f where beta is 1 inside the gas phase, 0.001 inside the liquid phase and a value in between for the nodes close to the interface. The system matrix is built so to remain symmetric positive defined de

Re: [petsc-users] How to speed up geometric multigrid

2013-09-23 Thread Mark F. Adams
On Sep 23, 2013, at 12:27 PM, Michele Rosso wrote: > The boundary conditions are periodic. > The equation I am solving is: > >div(beta*grad(u))= f > > where beta is 1 inside the gas phase, 0.001 inside the liquid phase and a > value in between for the nodes close to the interface. T

Re: [petsc-users] How to speed up geometric multigrid

2013-09-23 Thread Matthew Knepley
On Mon, Sep 23, 2013 at 9:34 AM, Michele Rosso wrote: > > On 09/23/2013 09:24 AM, Mark F. Adams wrote: > > > On Sep 23, 2013, at 11:55 AM, Michele Rosso wrote: > > Hi, > > I am successfully using PETSc to solve a 3D Poisson's equation with CG + > MG . Such equation arises from a projection al

Re: [petsc-users] How to speed up geometric multigrid

2013-09-23 Thread Michele Rosso
On 09/23/2013 09:48 AM, Mark F. Adams wrote: On Sep 23, 2013, at 12:27 PM, Michele Rosso > wrote: The boundary conditions are periodic. The equation I am solving is: div(beta*grad(u))= f where beta is 1 inside the gas phase, 0.001 inside the liquid phase and

Re: [petsc-users] How to speed up geometric multigrid

2013-09-23 Thread Matthew Knepley
On Mon, Sep 23, 2013 at 8:55 AM, Michele Rosso wrote: > Hi, > > I am successfully using PETSc to solve a 3D Poisson's equation with CG + > MG . Such equation arises from a projection algorithm for a multiphase > incompressible flow simulation. > I set up the solver as I was suggested to do in