Re: [petsc-users] Galerkin multigrid coarsening

2014-01-31 Thread Torquil Macdonald Sørensen
On 30 January 2014 22:05, Jed Brown j...@jedbrown.org wrote:

  I did not have an opportunity to test what happens if I don't set any
  restriction, but I'm hoping it will then use P^T, as before.

 Yes, it will.

Only setting the interpolation, and not the restriction, results in a
crash for me (with output given at the bottom of this message).
Looking at the changed code, is it not the case that if restrct is
unset, the code will still try to use it in the MatMatMatMult() inside
the else-part of the new code? If restrct is not set, it will surely
differ from interpolate in the tests on lines 628 and 641, and
therefore trigger the else-part of the if-else constructs, thereby
causing this crash, right?

I applied the changes to the master-branch, so I'm hoping that is
not the reason for this problem. Here is the output I'm getting when
only setting the interpolation:

[0]PETSC ERROR: - Error Message

[0]PETSC ERROR: Null argument, when expecting valid pointer!
[0]PETSC ERROR: Null Object: Parameter # 1!
[0]PETSC ERROR:

[0]PETSC ERROR: Petsc Development GIT revision: v3.4.3-2428-g0a70bb0
GIT Date: 2014-01-30 13:56:44 -0600
[0]PETSC ERROR: See docs/changes/index.html for recent updates.
[0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.
[0]PETSC ERROR: See docs/index.html for manual pages.
[0]PETSC ERROR:

[0]PETSC ERROR: ./timeevolution.exe on a arch-linux2-cxx-debug named
enlil.uio.no by tmac Fri Jan 31 18:00:41 2014
[0]PETSC ERROR: Libraries linked from
/mn/anatu/cma-u3/tmac/usr/stow/petsc_complex_debug_cpp/lib
[0]PETSC ERROR: Configure run at Fri Jan 31 17:54:00 2014
[0]PETSC ERROR: Configure options
--prefix=/mn/anatu/cma-u3/tmac/usr/stow/petsc_complex_debug_cpp
--with-clanguage=C++ --with-scalar-type=complex
--with-shared-libraries=1 --with-debugging=1 --with-superlu=1
--with-superlu-lib=/mn/anatu/cma-u3/tmac/usr/lib/libsuperlu.so
--with-superlu-include=/mn/anatu/cma-u3/tmac/usr/include/superlu
--with-ptscotch=1
--with-ptscotch-include=/mn/anatu/cma-u3/tmac/usr/include/scotch
--with-ptscotch-lib=[/mn/anatu/cma-u3/tmac/usr/lib/libptscotch.so,/mn/anatu/cma-u3/tmac/usr/lib/libptscotcherr.so,/mn/anatu/cma-u3/tmac/usr/lib/libscotch.so,/mn/anatu/cma-u3/tmac/usr/lib/libscotcherr.so]
--with-blas-lib=/mn/anatu/cma-u3/tmac/usr/lib/libsatlas.so
--with-lapack-lib=/mn/anatu/cma-u3/tmac/usr/lib/libsatlas.so
--with-fortran-interfaces=0
[0]PETSC ERROR:

[0]PETSC ERROR: MatMatMatMult() line 9069 in
/work/petsc/src/mat/interface/matrix.c
[0]PETSC ERROR: PCSetUp_MG() line 631 in /work/petsc/src/ksp/pc/impls/mg/mg.c
[0]PETSC ERROR: PCSetUp() line 888 in /work/petsc/src/ksp/pc/interface/precon.c
[0]PETSC ERROR: KSPSetUp() line 278 in
/work/petsc/src/ksp/ksp/interface/itfunc.c
[0]PETSC ERROR: main() line 244 in /mn/anatu/cma-u3/tmac/research/sim/prog.cpp

Setting both the interpolation and restriction works fine, as I
mentioned in the earlier message.

Best regards
Torquil Sørensen


Re: [petsc-users] Galerkin multigrid coarsening

2014-01-31 Thread Jed Brown
Torquil Macdonald Sørensen torq...@gmail.com writes:

 On 30 January 2014 22:05, Jed Brown j...@jedbrown.org wrote:

  I did not have an opportunity to test what happens if I don't set any
  restriction, but I'm hoping it will then use P^T, as before.

 Yes, it will.

 Only setting the interpolation, and not the restriction, results in a
 crash for me (with output given at the bottom of this message).
 Looking at the changed code, is it not the case that if restrct is
 unset, the code will still try to use it in the MatMatMatMult() inside
 the else-part of the new code? If restrct is not set, it will surely
 differ from interpolate in the tests on lines 628 and 641, and
 therefore trigger the else-part of the if-else constructs, thereby
 causing this crash, right?

Sorry, this is my fault.  (I thought restrct was configured before
getting to this bit of code, but clearly not.)  Fixed now.


pgp1mS0E0xnYn.pgp
Description: PGP signature


[petsc-users] Galerkin multigrid coarsening

2014-01-30 Thread Boris Kaus
Hi,


While doing multigrid it is possible to explicitly set restriction and 
prolongation/interpolation operators in PETSC using PCMGSetRestriction and 
PCMGSetInterpolation.  In many cases, the restriction (R) and prolongation (P) 
operators are simply the transpose of each other (R=P’). 

Yet, in certain cases, for example variable viscosity Stokes with a staggered 
finite difference discretization, it is advantageous if they are different (see 
http://arxiv.org/pdf/1308.4605.pdf).

Accordding to the Wesseling textbook, Galerkin coarsening of the fine grid 
matrix is defined as:

Acoarse = R*A*P

Yet, as far as I can tell, PETSc seems to implement this as:

Acoarse = R*A*R’

even in the case that R is different from P’. 
Is there a way for PETSc to use the actually provided prolongation and 
restriction operators to compute the coarse grid approximation?

thanks!

Boris





___

Boris J.P. Kaus

Institute of Geosciences, 
Geocycles Research Center 
Center for Computational Sciences.
University of Mainz, Mainz, Germany
Office: 00-285
Tel:+49.6131.392.4527

http://www.geo-dynamics.eu
___




Re: [petsc-users] Galerkin multigrid coarsening

2014-01-30 Thread Jed Brown
Boris Kaus k...@uni-mainz.de writes:

 While doing multigrid it is possible to explicitly set restriction and
 prolongation/interpolation operators in PETSC using PCMGSetRestriction
 and PCMGSetInterpolation.  In many cases, the restriction (R) and
 prolongation (P) operators are simply the transpose of each other
 (R=P’).

 Yet, in certain cases, for example variable viscosity Stokes with a
 staggered finite difference discretization, it is advantageous if they
 are different (see http://arxiv.org/pdf/1308.4605.pdf).

 Accordding to the Wesseling textbook, Galerkin coarsening of the fine
 grid matrix is defined as:

 Acoarse = R*A*P

 Yet, as far as I can tell, PETSc seems to implement this as:

 Acoarse = R*A*R’

Certainly, the code just had an outdated assumption.  I think I have
added support for this (it does R*A*P when R!=P), but I don't have a
test case readily available.  Could you try branch
'jed/pcmg-galerkin-rap' (if you were using v3.4/maint) or 'next' if
you've been tracking petsc-dev?


pgpJYCCQqyXQs.pgp
Description: PGP signature


Re: [petsc-users] Galerkin multigrid coarsening

2014-01-30 Thread Kaus, Boris
Thanks Jed,

I'll give it a try and let you know. Might take a bit though.


Boris 

 On Jan 30, 2014, at 17:45, Jed Brown j...@jedbrown.org wrote:
 
 Boris Kaus k...@uni-mainz.de writes:
 
 While doing multigrid it is possible to explicitly set restriction and
 prolongation/interpolation operators in PETSC using PCMGSetRestriction
 and PCMGSetInterpolation.  In many cases, the restriction (R) and
 prolongation (P) operators are simply the transpose of each other
 (R=P’).
 
 Yet, in certain cases, for example variable viscosity Stokes with a
 staggered finite difference discretization, it is advantageous if they
 are different (see http://arxiv.org/pdf/1308.4605.pdf).
 
 Accordding to the Wesseling textbook, Galerkin coarsening of the fine
 grid matrix is defined as:
 
 Acoarse = R*A*P
 
 Yet, as far as I can tell, PETSc seems to implement this as:
 
 Acoarse = R*A*R’
 
 Certainly, the code just had an outdated assumption.  I think I have
 added support for this (it does R*A*P when R!=P), but I don't have a
 test case readily available.  Could you try branch
 'jed/pcmg-galerkin-rap' (if you were using v3.4/maint) or 'next' if
 you've been tracking petsc-dev?


Re: [petsc-users] Galerkin multigrid coarsening

2014-01-30 Thread Torquil Macdonald Sørensen
On 30/01/14 17:45, Jed Brown wrote:
 Boris Kaus k...@uni-mainz.de writes:

 While doing multigrid it is possible to explicitly set restriction and
 prolongation/interpolation operators in PETSC using PCMGSetRestriction
 and PCMGSetInterpolation.  In many cases, the restriction (R) and
 prolongation (P) operators are simply the transpose of each other
 (R=P’).

 Yet, in certain cases, for example variable viscosity Stokes with a
 staggered finite difference discretization, it is advantageous if they
 are different (see http://arxiv.org/pdf/1308.4605.pdf).

 Accordding to the Wesseling textbook, Galerkin coarsening of the fine
 grid matrix is defined as:

 Acoarse = R*A*P

 Yet, as far as I can tell, PETSc seems to implement this as:

 Acoarse = R*A*R’
 Certainly, the code just had an outdated assumption.  I think I have
 added support for this (it does R*A*P when R!=P), but I don't have a
 test case readily available.  Could you try branch
 'jed/pcmg-galerkin-rap' (if you were using v3.4/maint) or 'next' if
 you've been tracking petsc-dev?

This question was similar to my recent unanswered one:

http://lists.mcs.anl.gov/pipermail/petsc-users/2014-January/020382.html

I just tried jed/pcmg-galerkin-rap, and it seems to work fineI verified
that the coarse system matrix is R*A*P, for a two-level PCMG. I'm first
calling PCMGSetInterpolation() with a matrix P, and then
PCMGSetInterpolation() with a matrix R. Previously R was ignored, and I got

A_c = P^T*A*P

With jed/pcmg-galerkin-rap, I'm getting:

A_c = R*A*P

So now I can experiment with using R or P^T, which is very nice!

I did not have an opportunity to test what happens if I don't set any
restriction, but I'm hoping it will then use P^T, as before.

Best regards
Torquil Sørensen



Re: [petsc-users] Galerkin multigrid coarsening

2014-01-30 Thread Jed Brown
Torquil Macdonald Sørensen torq...@gmail.com writes:
 This question was similar to my recent unanswered one:

 http://lists.mcs.anl.gov/pipermail/petsc-users/2014-January/020382.html

That's why I Cc'd you.

 I just tried jed/pcmg-galerkin-rap, and it seems to work fineI verified
 that the coarse system matrix is R*A*P, for a two-level PCMG. I'm first
 calling PCMGSetInterpolation() with a matrix P, and then
 PCMGSetInterpolation() with a matrix R. Previously R was ignored, and I got

 A_c = P^T*A*P

 With jed/pcmg-galerkin-rap, I'm getting:

 A_c = R*A*P

 So now I can experiment with using R or P^T, which is very nice!

Thanks for testing.

 I did not have an opportunity to test what happens if I don't set any
 restriction, but I'm hoping it will then use P^T, as before.

Yes, it will.


pgpE1H7plLNgn.pgp
Description: PGP signature


Re: [petsc-users] Galerkin multigrid coarsening

2014-01-30 Thread Torquil Macdonald Sørensen
On 30/01/14 22:05, Jed Brown wrote:
 Torquil Macdonald Sørensen torq...@gmail.com writes:
 This question was similar to my recent unanswered one:

 http://lists.mcs.anl.gov/pipermail/petsc-users/2014-January/020382.html
 That's why I Cc'd you.


Thanks, I didn't notice that. I am actually very impressed with the
helpfulness from the Petsc developers on this mailing list.

- Torquil