CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Main CFD Forum (
-   -   Anyone has PETSc learning experience? (

bearcat March 23, 2010 16:14

Anyone has PETSc learning experience?

does anyone have a successful experience learning PETSc? Though I know some MPI programmings, I found the PETSc learning very tough at the beginning. Overally, I think the package is not very well prepared for beginners. The user manual only covers a small fraction of basic usage. I read through it but still feel very difficult to understand the example codes. The accompanying documents provide little mathematical fundamentals and not much explanation/flow charts to the tutorial codes. Those ppt introductions make new-comers confused. And it's not practical to scrutinize every functions/utilities.

Thank you.

ganesh March 24, 2010 15:01

Dear Bearcat,

Well, PetSc has a steep learning curve, as the users themselves mention. PetSc is definitely a very powerful and well built platform, but whether to use it extensively or not would depend on the particular application you intend to to use it for. For instance, for linear solvers with preconditioners, I found LiS ( as a better documented option with good F90 support (because F90 is what I like and use!), and easier to learn, although the calls are quite similar to those in PetSc. What LiS lacks are non-linear solvers (such as Newton-Krylov solvers) for which I turned to PetSc. Other possibilities for non-linear solvers in open source libraries that I haven't looked at but could be worthwhile is the SUNDIALS package among others. PetSc turns out to be a comprehensive library that goes beyond just a set of solvers (allows for objects that can help in parallel programming and multigrid) and that is why an increasing number of users are utilising it. However, my own limited experience tells me that using PetSc extensively with an unstructured framework could be all the more cumbersome (definitely possible), and I suggest that you employ the library only where it is extremely useful/needed (such as a Newton--Krylov solver that is difficult and time-consuming to write, but not for time stepping that can be relatively easily coded by the user). This way it allows a better learning of the underlying concepts (because you code most of the program) and leaves only a few portions to the PetSc library. This keeps the total effort that you need to put into PetSc relatively less and yet serves your purpose.

Hope this helps.



jed March 25, 2010 07:58

PETSc's philosophy is deeply about composition and extensibility. I understand that not everything important is covered in the user's manual, but there is a tradeoff between skipping topics and overwhelming new users with verbosity that may not relate to their problem. If you can suggest specific ways to improve the user's manual, we would love to hear them. Just explaining which aspects you find challenging or confusing is useful because it helps us to improve the documentation and tutorials/courses that some of use give.

You might also consider moving this discussion to the petsc-users mailing list where there is a larger community of users and you'll usually get very quick response from the developers.

quarkz March 25, 2010 21:33

I don't think it's that bad. My recommendation is that you read about the basic stuffs on vectors/matrix. 2-3 simple examples and then focus on the type of questions you need to solve and using specific examples as templates. hope that helps. it's really a great software :-)

All times are GMT -4. The time now is 21:25.