Using PETSc in structured c-grid for CFD and multigrid

Barry Smith bsmith at mcs.anl.gov
Wed Jan 31 11:47:31 CST 2007


  The glueing might be able to be handled by using periodic for that
dimension of the DA you create. But this gets tricky if you have any 
nodes that have "an extra degree of freedom".

   Barry


On Wed, 31 Jan 2007, Berend van Wachem wrote:

> Hi Ben,
> 
> The challenge in your problem is how you "glue" the C grid in the back; 
> there you will need to do some additional scattering. I would set-up 
> the IS for this, and then use that to scatter the values 
> into "ghostcells" which will be present on the block(s).
> 
> Berend.
> 
> > Thank you Berend! I'll go through DA again. I'm also looking at
> > HYPRE. Its way of creating grids and linking them seems intuitive.
> > Btw, is there a mailing list for HYPRE similar to PETSc to discuss
> > problems? I find that their explanation are quite brief.
> >
> > I tried to install HYPRE 2.0 on windows using cygwin but it failed.
> > I then install it as an external software thru PETSc. I think it's
> > installing HYPRE 1.0 or something. But similarly, there's illegal
> > operation.
> >
> > Installing HYPRE 2.0 on my school's linux worked, though there's
> > seems to be some minor error. So what's the best way to employ
> > multigird? Is it to install as an external software thru PETSc or
> > just use HYPRE on its own?
> >
> > Btw, it will be great if you can send me parts of your code
> > regarding DA.
> >
> > Thank you very much!
> >
> > On 1/26/07, Berend van Wachem <berend at tfd.chalmers.se> wrote:
> > > 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