[petsc-users] A quick question on DMDACreate3d
Barry Smith
bsmith at mcs.anl.gov
Wed Dec 26 12:27:50 CST 2012
On 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[]'.
> 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?
If you use lx of PETSC_NULL it will default to putting 75 points on each process. Manually you would declare lx[4] and set lx[0] = lx[1] = lx[2] = lx[3] =75. Note that all processes need to provide the exact same values in lx, ly and lz
>
> thank you so much and Happy New Year!! :)
> Alan
>
>
>
More information about the petsc-users
mailing list