[petsc-users] 2D vector in 3D dmda

Aurelien Ponte aurelien.ponte at ifremer.fr
Sat Sep 17 02:58:47 CDT 2016


Thanks Barry for your answer !

I guess my concern is of the second type:
By grid metric terms I meant essentially grid spacings which look like:
dx(i,j), dy(i,j) and dz(k) where (i,j,k) are indices running along the 3 
dimensions of the grid.
Storing dx(i,j) into a 3D array seemed like a bit waste of memory to me 
but I must
be wrong. The elliptic problem I am solving for is close to a poisson 
equation btw.
I guess I can at least store dx and dy into a single dxy 3D array.

Thanks again,

Aurelien



Le 16/09/16 à 19:43, Barry Smith a écrit :
>> On Sep 16, 2016, at 9:29 AM, Aurelien PONTE <aurelien.ponte at ifremer.fr> wrote:
>>
>> Hi,
>>
>> I've started using petsc4py in order to solve a 3D problem (inversion of elliptic operator).
>> I would like to store 2D metric terms describing the grid
>
>       What do you mean by 2D metric terms describing the grid?
>
>       Do you want to store something like a little dense 2d array for each grid point? If so create another 3D DA with a dof = the product of the dimensions of the little dense 2d array and then store the little dense 2d arrays at in a global vector obtained from that DA.
>
>      Or is the grid uniform in one dimension and not uniform in the other two and hence you want to store the information about the non-uniformness in only a 2d array so as to not "waste" the redundant information in the third direction? Then I recommend just "waste" the redundant information in the third dimension; it is trivial compared to all the data you need to solve the problem.
>
>      Or do you mean something else?
>
>    Barry
>     
>> I am working on but don't know
>> how to do that given my domain is tiled in 3D directions:
>>
>> self.da = PETSc.DMDA().create([self.grid.Nx, self.grid.Ny, self.grid.Nz],
>>                                       stencil_width=2)
>>
>> I create my 3D vectors with, for example:
>>
>> self.Q = self.da.createGlobalVec()
>>
>> What am I supposed to do for a 2D vector?
>> Is it a bad idea?
>>
>> thanks
>>
>> aurelien
>>


-- 
Aurélien Ponte
Tel: (+33) 2 98 22 40 73
Fax: (+33) 2 98 22 44 96
UMR 6523, IFREMER
ZI de la Pointe du Diable
CS 10070
29280 Plouzané



More information about the petsc-users mailing list