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

Barry Smith bsmith at mcs.anl.gov
Fri Sep 16 12:43:46 CDT 2016


> 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
> 



More information about the petsc-users mailing list