Barry, sorry but I can see that with a simpler version, mg starts to work with 
dof = 4. So maybe there are some bugs in my original code. 


________________________________________
From: Sun, Hui
Sent: Friday, February 27, 2015 6:25 PM
To: Barry Smith
Cc: petsc-users@mcs.anl.gov
Subject: RE: [petsc-users] DMDA with dof=4, multigrid solver

Sorry, I misread your email. I thought you were saying that it only handles dof 
= 1 fine. Sure I will send you the code. However, the code has some other 
dependencies. Let me remove those and send it to you in one file. Thanks a lot.



________________________________________
From: Barry Smith [bsm...@mcs.anl.gov]
Sent: Friday, February 27, 2015 5:11 PM
To: Sun, Hui
Cc: petsc-users@mcs.anl.gov
Subject: Re: [petsc-users] DMDA with dof=4, multigrid solver

> On Feb 27, 2015, at 6:36 PM, Sun, Hui <hus...@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!

Reply via email to