[petsc-users] Non-uniform Cartisian Grid

Barry Smith bsmith at mcs.anl.gov
Wed Nov 7 18:55:45 CST 2012


On Nov 7, 2012, at 6:50 PM, Alan <zhenglun.wei at gmail.com> wrote:

> Dear folks,
> I hope you're having a nice day.
> I'm testing the Poisson solver in /src/ksp/ksp/examples/tutorials/ex45.
> It uses the 'DMDACreate3d' to generate a Cartisian structured grid and
> solve it with uniform grid size. However, I attempt to modify it to
> obtain solution with a Cartsian structured grid and non-uniform grid (It
> is not unstructured local refined mesh). Should I still use the
> 'DMDACreate3d' and implement different grid size in 'ComputeMatrix' and
> 'ComputeRHS'? In other words, does 'DMDACreate3d' itself include any
> mesh size information?

   You can use DMDASetCoordinates() and DMDAGetCoordinates() (called DMSetCoordinates() and DMGetCoordinates() in petsc-dev) to keep track of the coordinates but you are responsible for generating the correctly scaled entries in the matrix etc.

   Barry

> 
> thanks,
> Alan



More information about the petsc-users mailing list