[petsc-users] DMDA Question

TAY wee-beng zonexo at gmail.com
Wed Dec 7 05:49:56 CST 2011

```Hi,

Sorry to hijack the discussion but I'm currently thinking of
implementing DMDA for staggered grids in 2D and later on in 3D.

I am not sure if my problem is exactly the same as that of Tim but I
don't really understand his problem.

So for my case, I have a staggered grid for my finite volume CFD code.
So the grid looks like this:

Do I need to create 3 DMDA, for u,v,p? When computing the flux, I will
also need to interpolate u and v velocities on the u or v cells. I hope
you can suggest the best way to approach this problem.

Btw, in the discussion, there's also some mention of DOF. However, I
thought each variable (u,v,p) will have only 1 DOF, is that not so?

Thanks!

Yours sincerely,

TAY wee-beng

On 2/12/2011 8:12 PM, Barry Smith wrote:
>     Tim,
>
>      Unfortunately the DMDA was not designed with the idea of staggered grids (or mixed discretizations) in mind so they are not straightforward like we would like them to be.
>
>      Do I understand you want two DMDA
>
> 1) one that has locations for cell vertices (or face centers)?
>
> 2) and one that locations for cell centers?
>
>     Once we understand what you want we may be able to make a suggestion.
>
>     Barry
>
>
> On Dec 2, 2011, at 1:08 PM, Tim Gallagher wrote:
>
>> Hi,
>>
>> I'm trying to create some grids for a finite volume simulation and am a little stuck on the best way to tackle it. The approach now is to use DMDACreate3d with known number of I, J, K points and PETSC_DECIDE for the processors. Then I am trying to create another DMDA with the same distribution to store the cell centers and actual solution vector. The problem with is is the following:
>>
>> Consider 9 points and two processors. Processor one gets points [1,5] with point 6 as a ghost and processor two gets points [6,9] with point 5 as a ghost. But now to create/store cell centers, processor two needs point 4 to construct a cell center for it's ghost.
>>
>> I can certainly fetch that point and do the calculation, but I feel like there is a more elegant way to do this out there. Has anybody used a DMDA to create a dual DMDA?
>>
>> Any advice would be appreciated,
>>
>> Tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20111207/12041fc2/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ecdhigbj.png
Type: image/png
Size: 47018 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20111207/12041fc2/attachment-0001.png>
```