Question on using DMMG
Barry Smith
bsmith at mcs.anl.gov
Thu Feb 19 15:41:09 CST 2009
On Feb 19, 2009, at 3:22 PM, Randall Mackie wrote:
> I'm trying to modify my code to use the DMMG routines to solve my
> system
> by multi-grid, instead of the usual krylov solver. In my previous
> code,
> I would set up a DA for my finite difference grid, set the matrix
> preallocation using MATCreateMPIAIJ, then fill the matrix, etc.
>
> In the code I've modified to use DMMG, here is my sequence of routines
> so far:
>
> call DMMGCreate(...)
> call DACreate3D(....) ! to set the DA on the finest level
> call DMMGSetDM(...)
>
>
> call DMMGSETKSP(...)
>
>
> Questions:
>
> 1) I want to set the DA on the finest level and use Galerkin to get
> the coarser matrices. So, is the DACreate above the way to do this?
The current design always has you setting the coarsest DA; DMMG
generates all the finer ones
automatically. This is independent of using Galerkin coarse grids or
not.
To have DMMG use Galerkin to generate the coarser matrices call
DMMGSetUseGalerkinCoarse()
after you se the number of levels or use the option -dmmg_galerkin
>
>
> 2) How do I set the matrix preallocation here for use in the DMMG
> routines?
> Would I use the same MATCreateMPIAIJ as before, and if so, where do I
> put that? In the routine that fills the Jacobian, or in the main
> program
> someplace?
DMMG manages all this for you; it creates the empty matrices
(based on the DA stencil) and gives them
the right nonzero structure.
See, for example, src/ksp/ksp/examples/tutorials/ex34.c
Barry
>
>
>
> Thanks, Randy
More information about the petsc-users
mailing list