[petsc-users] preconditioning

Matthew Knepley knepley at gmail.com
Tue Apr 21 13:40:11 CDT 2015


On Tue, Apr 21, 2015 at 1:35 PM, Sanjay Kharche <
Sanjay.Kharche at manchester.ac.uk> wrote:

>
>  Hi
>
>  I just tried Matt's suggestion and tried to guess other preconditioning
> options as well. I didnt have the time to think about their appropriateness.
>
>  All preconditioners worked with the actual ts/ex15. gmag took 13 times
> longer to finish than the case when I ran without any preconditioner. The
> fastest was the jacobi, followed by sor and bjacobi options to -pc_type I
> could not guess the names of the other listed preconditioners associated
> with ts and snes.
>

With a small timestep, Jacobi is going to beat the crap out of anything
else. However, in this case you should just be using
an explicit method, not solving the system. With a large timestep, GAMG
will win, although it will be beaten by GMG.


>
>  In my code however, I  found that sor and gamg did not work. I got error
> messages, and the first few lines are pasted below. My test was on 1 proc
> and 4 procs, both giving similar errors with differnent line numbers. The
> petsc part of my code is virtually identical to the example. Any comments
> on what is missing or can be changed?
>

You have a bug. There are not zeros on the diagonal of the heat oeprator.

  Matt


> cheers
> Sanjay
>
>
>
>
> [1]PETSC ERROR: --------------------- Error Message
> --------------------------------------------------------------
> [1]PETSC ERROR: Arguments are incompatible
> [1]PETSC ERROR: Zero diagonal on row 39
> [1]PETSC ERROR: Petsc Release Version 3.5.2, unknown
> [1]PETSC ERROR: ./sk2d on a linux-gnu-c-debug named atriumpc.ex.ac.uk by
> sanjay Tue Apr 21 19:28:53 2015
> [1]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++
> --with-fc=gfortran --download-fblaslapack --download-mpich
> --download-sundials --download-scalapack --with-c2html=0
> [1]PETSC ERROR: #1 MatInvertDiagonal_SeqAIJ() line 1724 in
> /media/6c6201d2-4e2e-4b24-8d04-263b5bc06dfa/sanjay/petsc/src/mat/impls/aij/seq/aij.c
> [1]PETSC ERROR: #2 MatSOR_SeqAIJ() line 1756 in
> /media/6c6201d2-4e2e-4b24-8d04-263b5bc06dfa/sanjay/petsc/src/mat/impls/aij/seq/aij.c
> [1]PETSC ERROR: #3 MatSOR_MPIAIJ() line 1483 in
> /media/6c6201d2-4e2e-4b24-8d04-263b5bc06dfa/sanjay/petsc/src/mat/impls/aij/mpi/mpiaij.c
> [1]PETSC ERROR: #4 MatSOR() line 3643 in
> /media/6c6201d2-4e2e-4b24-8d04-263b5bc06dfa/sanjay/petsc/src/mat/interface/matrix.c
> [1]PETSC ERROR: #5 PCApply_SOR() line 35 in
> /media/6c6201d2-4e2e-4b24-8d04-263b5bc06dfa/sanjay/petsc/src/ksp/pc/impls/sor/sor.c
> [1]PETSC ERROR: #6 PCApply() line 440 in
> /media/6c6201d2-4e2e-4b24-8d04-263b5bc06dfa/sanjay/petsc/src/ksp/pc/interface/precon.c
>
>
>
>  ------------------------------
> *From:* Matthew Knepley [knepley at gmail.com]
> *Sent:* 21 April 2015 16:51
> *To:* Sanjay Kharche
> *Cc:* petsc-users at mcs.anl.gov
> *Subject:* Re: [petsc-users] preconditioning
>
>    On Tue, Apr 21, 2015 at 10:49 AM, Sanjay Kharche <
> Sanjay.Kharche at manchester.ac.uk> wrote:
>
>>
>> Hi
>>
>> I am working through the KSP examples, but I will ask for any comments in
>> the mean time.
>>
>> I have a TS code for 2D/3D heat equation, starting from ts/ex15. How can
>> I easily modify this code to include a parallel preconditioner. As of now,
>> I just need to add a preconditioner which is easy to program. The
>> coefficients in my systems matrix are constant, but RHS changes at each
>> iteration.
>>
>
>  Use -pc_type gamg. You have the Laplacian + Identity, so this should
> work fine.
>
>    Thanks,
>
>      Matt
>
>
>> cheers
>> Sanjay
>>
>
>
>
>  --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which their
> experiments lead.
> -- Norbert Wiener
>



-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150421/9b7126dd/attachment-0001.html>


More information about the petsc-users mailing list