[petsc-users] Non-uniform Cartisian Grid

Matthew Knepley knepley at gmail.com
Fri Feb 22 15:20:13 CST 2013


On Fri, Feb 22, 2013 at 3:57 PM, Zhenglun (Alan) Wei <zhenglun.wei at gmail.com
> wrote:

> Dear all,
> I hope you're having a nice day.
> I wonder if anyone could point out a example for me about the
> DMDASetCoordinates(). I found this
> (
> http://www.mcs.anl.gov/petsc/petsc-current/src/dm/impls/da/dacorn.c.html#DMDASetCoordinates
> )
> online; however it does not really demonstrate how to create the
> 'coordinate vector - c'.
> Also, I found that in the petsc sub-folder:
> /petsc-dev/src/dm/impls/patch has a patch.c, which I suppose that it
> does a local refinement for mesh. Does this a mature model that we can
> use or just a testing code?
>

Look at KSP ex49. In the routine DMDACoordViewGnuplot2d() it reads out the
coordinates.
You could just as easily set them in this fashion.

   Matt


> thanks,
> Alan
>
> On 11/7/2012 6:55 PM, Barry Smith wrote:
> > 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
>
>


-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130222/95edb952/attachment.html>


More information about the petsc-users mailing list