[petsc-users] Non-uniform Cartisian Grid
Barry Smith
bsmith at mcs.anl.gov
Tue Feb 26 20:46:04 CST 2013
On Feb 26, 2013, at 4:49 PM, "Zhenglun (Alan) Wei" <zhenglun.wei at gmail.com> wrote:
> Dear folks,
> I have one question for the ex49.
> It do show a way to 'get' the 'coord' by the 'DMDAVecGetArray'. Should I just modified the coordinate on the 'coord' in order to obtain a non-uniform grid? and then, use DMDAVecRestoreArray to link the modified 'coord' back to 'cda' so that the 'coord' will be updated to the mesh I want?
Yes, you can do this.
>
> thanks,
> Alan
>
> On 2/22/2013 3:20 PM, Matthew Knepley wrote:
>> 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
>
More information about the petsc-users
mailing list