I am trying to solve Euler equations on unstructured grids. Consequently, the problem reduces to solving Ax=b where A is a sparse matrix. Right know I am using Gauss-Seidel (GS) in a serial manner however, I need a parallel code. Since the grid is unstructured I cannot use red-black GS. Is there a fast parallel solver for this kind of situation?

  • $\begingroup$ What about GMRES or BiCGStab methods? $\endgroup$
    – nicoguaro
    Commented Oct 1, 2014 at 0:51
  • 4
    $\begingroup$ This is a very large question. As nicoguaro mentioned, there are iterative methods like GMRES, BiCGStab, etc. The effectiveness of each of these solvers will depend also on your choice of discretization of the Euler equations, and possibly the physics of your specific problem. Finally, most of the time, you'll need a good preconditioner to get fast convergence. How large is your matrix? There are direct solvers that can work very well on unstructured grids in many cases. $\endgroup$
    – Jesse Chan
    Commented Oct 1, 2014 at 1:06
  • 3
    $\begingroup$ First write your code using PETSc, then later you can easily experiment with solvers/preconditioners. $\endgroup$
    – stali
    Commented Oct 1, 2014 at 15:40
  • $\begingroup$ You may want to look at the answers to this question: scicomp.stackexchange.com/questions/104/… $\endgroup$
    – Paul
    Commented Nov 3, 2014 at 17:56

3 Answers 3


I suggest using PETSc, which has parallel solvers like GMRES, bi Conjugate Gradient, etc. Multiple preconditioners are also available. Furthermore, there might also be the option of the SNES nonlinear solvers. As to which set of solver+preconditioner combination works best, it's likely problem-specific. PETSc will allow you to switch between them easily.

You may also wish to consider using FEniCS+PETSc. With FEniCS, you specify the weak form of the equations and it will figure out how to assemble the matrix for you. FEniCS interfaces with the PETSc solvers to do the calculation. In fact, a simple Google search for "petsc euler equations" yields the following link: http://www.csc.kth.se/~jjan/transfer/reportMHAF.pdf. In the appendix, you can see the FEniCS source code to do the linearised Euler equations (as well as the incompressible Navier Stokes equations).


I used two very good parallel libraries for sparse matrix: Hypre and MUMPS. The first has very good AMG solver and several iterative methods, it can be run in parallel with either shared (OpenMP) or distributed memory (MPI). The second one implements direct LU factorization.

  • $\begingroup$ BoomerAMG (in Hypre) is not effective when applied directly to the Euler equations. You could use Euclid (a parallel ILU solver in Hypre), but scalability is limited and DD methods usually perform better for these CFD problems. Direct solvers are not suitable for 3D CFD applications due to the large vertex separators needed at practical mesh resolution as well as the number of solves needed for a solution (either convergence to steady state, or number of time steps). If you use PETSc, you can try all these and more with run-time options. [Disclaimer: I'm a PETSc developer] $\endgroup$
    – Jed Brown
    Commented Nov 4, 2014 at 1:43

The question of how to solve sparse linear systems is ubiquitous in computational sciences. As a general rule the better the method, the harder and more complicated it is to implement. I suspect AMG (Algebraic Multi-grid) will be the best method for the problem you describe as multi-grid methods are among the fastest for solving linear systems currently. If you are implementing this yourself though, it will be much harder than your current GS (especially in parallel). If you are just looking for a package then I would use Kirill's answer. At the very least I would look into GMRES or BiCGStab as suggested above or even SOR. You can definitely find a faster method than GS.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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