Re: [petsc-users] Multiple solves with PCMG fail

2014-11-10 Thread Filippo Leonardi
Super late update, sorry. Not sure if I understood you correctly: if(n) { PetscValidScalarPointer(r,3); ierr = PetscPrintf(PETSC_COMM_WORLD, --- n = %d nonzero if.\n, n);CHKERRQ(ierr); } else { ierr = PetscPrintf(PETSC_COMM_WORLD, --- n = 0 else.\n);CHKERRQ(ierr); } I get

Re: [petsc-users] Multiple solves with PCMG fail

2014-11-10 Thread Mark Adams
It does not look like you are in fact using the branch with this fix. The branch code looks like: if (n) PetscValidScalarPointer(r,3); *and* if (n) PetscValidScalarPointer(r,4); So if you now put the check for argument 4 inside of your if statement then you will have reimplemented my

Re: [petsc-users] Multiple solves with PCMG fail

2014-11-10 Thread Filippo Leonardi
Switched branch and now it works. No error and the solution is correct. I guess i not that more inefficient since the times when the rhs is zero is not that often, otherwise you wouldn't solve the system that way. I'm stupid: somehow I was in master and didn't notice that. Sorry for the

[petsc-users] MatSolve in CG

2014-11-10 Thread De Groof, Vincent Frans Maria
Dear all, I am writing a few variations on the PCG algorithm. Starting with my own PCG implementation, I noticed that my routine is quite a bit slower (~20%). I think I tracked it down to the MatSolve calls in PCApply. I am using BDDC as the preconditioner. In the Petsc PCG function, each

Re: [petsc-users] Nullspaces for schur complement PCs

2014-11-10 Thread Matthew Knepley
On Fri, Nov 7, 2014 at 11:04 AM, Lawrence Mitchell lawrence.mitch...@imperial.ac.uk wrote: Hi petsc-dev, I'm solving a pure Neumann mixed Poisson-like problem, preconditioning with a schur complement. The pressure space has a nullspace of the constant functions and so I attach the

Re: [petsc-users] Nullspaces for schur complement PCs

2014-11-10 Thread Lawrence Mitchell
On 10 Nov 2014, at 21:48, Matthew Knepley knep...@gmail.com wrote: On Fri, Nov 7, 2014 at 11:04 AM, Lawrence Mitchell lawrence.mitch...@imperial.ac.ukwrote: Hi petsc-dev, I'm solving a pure Neumann mixed Poisson-like problem, preconditioning with a schur complement. The pressure space

Re: [petsc-users] Nullspaces for schur complement PCs

2014-11-10 Thread Matthew Knepley
On Mon, Nov 10, 2014 at 5:34 PM, Lawrence Mitchell lawrence.mitch...@imperial.ac.uk wrote: On 10 Nov 2014, at 21:48, Matthew Knepley knep...@gmail.com wrote: On Fri, Nov 7, 2014 at 11:04 AM, Lawrence Mitchell lawrence.mitch...@imperial.ac.ukwrote: Hi petsc-dev, I'm solving a pure

Re: [petsc-users] Nullspaces for schur complement PCs

2014-11-10 Thread Jed Brown
Matthew Knepley knep...@gmail.com writes: at which point the nullspace is not attached, no? Crap, that is right. I think we should propagate the nullspace from pmat[1]. Uh, there is no reason pmat[1] can be expected to have the same null space. pmat[1] is the zero matrix in some important

[petsc-users] petsc4py 3.5 BOUND CONSTRAINED optimization example

2014-11-10 Thread André Timótheo
How can I model this kind of problem with petsc 3.5.2 and petsc4py? The demo examples are unconstrained optimization ones in all the petsc versions... Please, I need any python scrip to deal with problems like: minimize sum(x) subject to. x = 0 and Ax = b It will be great. Sorry about the