[petsc-users] DMDA with dof=4, multigrid solver

Barry Smith bsmith at mcs.anl.gov
Fri Feb 27 19:11:42 CST 2015


> On Feb 27, 2015, at 6:36 PM, Sun, Hui <hus003 at ucsd.edu> wrote:
> 
> I'm trying to work on 4 Poisson's equations defined on a DMDA grid, Hence the parameter dof in DMDACreate3d should be 4, and I've set stencil width to be 4, and stencil type to be star. 

  Use a stencil width of 1, not 4. The stencil width is defined in terms of dof. 
> 
> If I run the code with -pc_type ilu and -ksp_type gmres, it works alright. 
> 
> However, if I run with pc_type mg, it gives me an error saying that when it is doing MatSetValues, the argument is out of range, and there is a new nonzero at (60,64) in the matrix. However, that new nonzero is expected to be there, the row number 60 corresponds to i=15 and c=0 in x direction, and the column number 64 corresponds to i=16 and c=0 in x direction. So they are next to each other, and the star stencil with width 1 should include that. I have also checked with the memory allocations, and I'm found no problem. 
> 
> So I'm wondering if there is any problem of using multigrid on a DMDA with dof greater than 1? 

  No it handles dof > 1 fine.

  Send your code.

  Barry

> 
> Thank you! 



More information about the petsc-users mailing list