[petsc-users] DMDA with dof=4, multigrid solver
Sun, Hui
hus003 at ucsd.edu
Fri Feb 27 19:25:33 CST 2015
Thank you Barry. Another question: I observe that in those ksp examples, whenever multigrid is used, DMDA is also used, besides, KSPSetComputeOperators and KSPSetComputeRHS are also used.
Is it true that
1) Only DMDA can use mg?
2) We have to set up matrices and rhs using KSPSetComputeOperators and KSPSetComputeRHS? We cannot create a matrix and add it to KSP if we want to use mg?
Best,
Hui
________________________________________
From: Barry Smith [bsmith at mcs.anl.gov]
Sent: Friday, February 27, 2015 5:11 PM
To: Sun, Hui
Cc: petsc-users at mcs.anl.gov
Subject: Re: [petsc-users] DMDA with dof=4, multigrid solver
> 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