[petsc-users] A quick question on DMDACreate3d

Jed Brown jedbrown at mcs.anl.gov
Wed Dec 26 12:28:43 CST 2012


On Wed, Dec 26, 2012 at 12:05 PM, Zhenglun (Alan) Wei <z240w014 at ku.edu>wrote:

>  Dear folks,
>      I have a quick question on the DMDACreate3d.
>      In the manual, it says that the input format of this function is:
>
> PetscErrorCode  DMDACreate3d(MPI_Comm comm,DMDABoundaryType bx,DMDABoundaryType by,DMDABoundaryType bz,DMDAStencilType stencil_type,PetscInt M,
>                PetscInt N,PetscInt P,PetscInt m,PetscInt n,PetscInt p,PetscInt dof,PetscInt s,const PetscInt lx[],const PetscInt ly[],const PetscInt lz[],DM *da)
>
>
>      Now, I'm trying to manually define the "arrays containing the number
> of nodes in each cell along the x, y, and z coordinates". Therefore, my
> focus turns to 'lx[]', 'ly[]' and 'lz[]'. I suppose that they're not simply
> just three integers; they may be three integer type arrays, as I guess.
> However, I checked all examples listed for this function. None of them
> teaches me how to implement this three parameters except 'PETSC_NULL'.
> Could you please provide me an extra example to demonstrate how to use
> DMDACreate3d or DMDACreate2d with non-null 'lx[]', 'ly[]' and 'lz[]'.
>

It is used by snes/examples/tutorials/ex28.c in the 1D case to ensure that
the staggered grid has a specific compatible layout. As the docs say, these
are arrays of length m,n,p and must sum to M, N, and P.

     Or, a demonstration in 1D would be a good example. Say, I have a 1D
> uniform mesh; the number of grid in x-direction is 300. I want to use 4
> processes to evenly divide this mesh. What should I input for 'lx[]' for
> each process?
>
>
The defaults do this.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20121226/186b0d66/attachment.html>


More information about the petsc-users mailing list