Using PETSc in structured c-grid for CFD and multigrid

Berend van Wachem berend at tfd.chalmers.se
Fri Jan 26 01:53:19 CST 2007


Hi,

I am not an expert - but have used PETSc for both structured and
unstructured grids.

When you use an unstructured code for a structured grid, there is
additional overhead (addressing, connectivity) which is redundant; this
information is not required for solving on a structured grid. I would say
this is maximum a 10% efficiency loss for bigger problems - it does not
affect solving the matrix, only in gathering your coefficients. I would
not rewrite my CFD code for this.

If you only deal with structured grids, using the PETSc DA framework
should work for you - you are not saving all connectivity. The DA
framework is not difficult at all, according to my opinion. Look at a few
examples that come with PETSc. I use a block structured solver - using
multiple DA's within one problem. Let me know if you are interested in
this, and I can send you parts of code.

Multigrid is certainly possible (I would reccomend through HYPRE,
discussed on the mailinglist, although I still have problems with it), but
the question is how efficient it will be for your CFD problem. For an
efficient multigrid in CFD, it is important to consider the coefficient
structure arising from the momentum equations - the grouping of cells
should occur following the advection term. Only then will you achieve
linear scaling with the problem size. For instance, consider a rotating
flow in a square box. Most multigrid algorithms will group cells in
"squares" which will not lead to a significant improvement, as the flow
(advection, pressure grad) does not move in these squares. In fact, to
have an efficient multigrid algorithm, the cels should be grouped along
the circular flow. As this cannot be seen directly from the pressure
coefficients, I doubt any "automatic" multigrid algorithm (in Hypre or
Petsc) would be able to capture this, but don't quote me on it - I am not
100% sure. So concluding, if you want to do efficient multigridding for
CFD, you will need to point out which cells are grouped into which
structure, based upon the upwind advection coefficients.

Good luck,

Berend.


> Hi,
>
> I was discussing with another user in another forum (cfd-online.com) about
> using PETSc in my cfd code. I am now using KSP to solve my momentum and
> poisson eqn by inserting values into the matrix. I was told that using
> PETSc
> this way is only for unstructured grids. It is very inefficient and much
> slower if I'm using it for my structured grid because I am not exploiting
> the regular structure of my grid.
>
> Is that true? I'm solving flow around airfoil using c-grid.
>
> So how can I improve? Is it by using DA? I took a glance and it seems
> quite
> complicated.
>
> Also, is multigrid available in PETSc? Chapter 7 discusses about it but it
> seems very brief. Is there a more elaborate tutorial besides that c
> examples?
>
> Hope someone can give me some ideas.
>
> Thank you.
>





More information about the petsc-users mailing list