4
$\begingroup$

I want to use the PETSc library to do some numerical work on finite element and parallel computing, but I wonder what I should know first to use these libraries. Could you give me some guiding information? Any answer of comment will be appreciated. Thank you.

$\endgroup$
  • 1
    $\begingroup$ Reading the manual takes forever...I suggest looking for some examples, like the ones in Fenics. $\endgroup$ – Shuhao Cao Jun 20 '13 at 3:23
  • 1
    $\begingroup$ I suggest you have a look into the PETSc tutorial by @JedBrown. $\endgroup$ – Jan Jun 20 '13 at 11:20
  • 1
    $\begingroup$ I would say that you should at the very least know terminology such as Krylov solver and preconditioning. Even a very rudimentary understanding of these topics will help you set the solver options. I would check out Yousef Saad's book "Iterative Methods for Sparse Linear Systems". $\endgroup$ – John Mousel Jun 21 '13 at 2:33
  • $\begingroup$ @JohnMousel I think I have read this book before. But it is a good advice to read deeply. Many thanks. $\endgroup$ – eccstartup Jun 21 '13 at 4:51
  • 1
    $\begingroup$ I've found that looking at the C code makes things harder to understand. It's not very clear when you have a metric crap-ton of 'ierrs = funcCall(...)' everywhere in your code. I looked at petsc4py first and was able to understand it a lot better. Check this (unfinished) tutorial out: github.com/JesseLu/petsc4py-tutorial $\endgroup$ – hadsed Jun 25 '13 at 21:07
4
$\begingroup$

PETSc is an outstanding linear algebra library. It also has modules for nonlinear solvers and, to some degree, for meshes and finite elements, but the latter aren't frequently used as there are much more comprehensive finite element packages out there. So, if you're interested in FEM calculations, my recommendation would be to go with one of the other packages (which oftentimes use PETSc internally to do their linear algebra computations).

If your goal is to do linear algebra, however, then PETSc is the right tool. As has been mentioned, the example programs help, but the manual is pretty decent to get an overview of what is available. You won't have to read the whole thing -- just stick with those parts you're particularly interested in.

$\endgroup$
  • $\begingroup$ Thanks, useful to me. But confused, a little bit difficult to grasp the whole package. $\endgroup$ – eccstartup Jun 23 '13 at 2:41
1
$\begingroup$

Start with src/ksp/ksp/examples/tutorials/ex2.c or ex2f.F and work your way upwards.

PETSc is very easy to use. You just have to worry about local element level calculations (matrices, rhs etc.) and PETSc takes care of everything else (e.g. parallel assembly and solving).

Developing a parallel high performance FE code quickly is very easy with PETSc even if you don't have a strong background in scientific computing.

There is a slight learning curve and a PETSc way of doing things but you should be productive fairly quickly.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.