Question on using DMMG

Randall Mackie rlmackie862 at gmail.com
Thu Feb 19 15:48:32 CST 2009


Barry,

I'm a little confused then, by how you set the size of the coarse grid
in relation to the fine grid. What if my fine grid is 283x107x113? Can
I just use a coarse grid of 3x3x3 and then the finer ones are generated
until it gets to my fine grid? I've been trying to follow ex22f.F, where
you set the coarse grid, and number of levels, but I can't figure out
the relation between the grid size on each level and how you specify
the grid size at the finest level.

In ex22f.F, when I run it, I see the first level is 27x27 (since the
3D grid is 3x3x3). Then at the next level it goes to 125x125 or 5x5x5.
Then the final level is 729x729, or 9x9x9.

Thanks, Randy

Barry Smith wrote:
> 
> 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