Hi again
First I will thank you guys for developing such a great product. Since i wrote the mails below I have developed a code simulating 2D plasmaphysics. At the moment I am using the Krylov subspace methods, KSP. Now that this is runnning I would like to see which improvements a MG precoditioner would give. Before starting doing so I would ask you guys whether you have any examples ? The documentation on the PCMG is a bit sparse (:-))
cheers Jens
PS. I will not forget to site you @:-)
-----Original Message-----
From: Barry Smith [mailto:petsc-maint@xxxxxxxxxxx]
Sent: Thu 3/30/2006 2:35 AM
To: jens.madsen@xxxxxxxx
Cc: petsc-maint@xxxxxxxxxxx
Subject: Re: SV: [PETSC #14613] DMMG question
On Wed, 29 Mar 2006, jens.madsen@xxxxxxxx wrote:
Hi Barry and Matt
Thank you for you quick response :-)
I have actually tried those command line options that you suggest. It is probably me not using the right terminology; I am not that experienced. I try to rephrase my problem.
As far as I understand the full multigrid always starts on the coarsest grid G_0. On the coarsest grid you calculate an approximate solution v_0 (using jacobi, GaussSeiddel, Krylov etc). This approximate solution is interpolated to a fine grid and used as an initial guess on this finer grid G_1. Now you make a few iterative sweeps on G_1 smoothening out the high k modes and get v_1. Restrict this approximate solution to G_0. Relax on G_0. Correct the solution v_1 and use this as an initial guess on an even finer grid G_2 etc. etc. In other words it combines "nested iteration" and "coarse grid correction".
You are correct this is exactly traditional full multigrid. The "PETSc full multigrid" is slightly
different. We start with a right hand side (and initial guess) on the finest grid, restrict the residual
to the coarsest grid and then start up the grids with nested iteration AND coarse grid correction.
Thus unlike "traditional" full multigrid you only need to define your problem on the finest grid.
We've found that this usually works better than just using regular V or W cycles. (BTW: PETSc full multigrid
can, of course, use either V or W cycles.
My "algorithm" is as follows:
1) apply initial conditions to Density,n, and Temperature,T.
2) find \phi solving a Poisson like equation using a multigrid scheme. Use \phi from previous timestep as an initial guess. n and T are variables in this equation.
3) Step n and T forward in time using the "stiffly stable" time stepping scheme. This is to be done using a pre-LU-factorized matrix.
4) goto 2)
I would like to make a V (or W) cycle starting on the finest grid instead. On the finest grid I would like to apply boundary conditions, provide the previous time step as an initial guess and use "coarse grid correction" only. My own code is (probably) full of errors :-) so I have tried running the multigrid examples under KSP and SNES with -pc_type richardson and/or, -pc_mg_type additive and/or -ksp_type preonly etc.What I can see using -ksp/snes_view is that the starting point is always the coarsest grid with dimensions given by DACreateNd ? The next MG-Grids are always finer. Can I make DMMG start on the finest grid with dimensions given in DACreateNd ?
You need to create a DA with a coarser size so that after it is refined the number of times it gives you
the grid you want. That is if you want 5 grid points with two levels you would create a DA with 3 grid
points and pass that into the DMMG. Sorry there is no way to start with a DA on the finest (but you get the
same effect by starting with a coarser DA.
Barry
Cheers and thanks Jens
________________________________
Fra: Barry Smith [mailto:petsc-maint@xxxxxxxxxxx]
Sendt: on 29-03-2006 17:20
Til: jens.madsen@xxxxxxxx
Cc: petsc-maint@xxxxxxxxxxx
Emne: Re: [PETSC #14613] DMMG question
Jens,
YOu can access any of the low level PCMG options from
DMMG. For example, -pc_type richardson gives you "multigrid
as a solve". -pc_mg_type additive gives you additive
-pc_mg_type multiplicative gives you standard v or w cycel
-pc_mg_type full gives "full" multigrid". -pg_mg_cycles 2
gives W cycle. -pc_mg_levels_pc_type sor gives SOR as the smoother
etc etc etc. Run with -help to see all the choices for the parts
of the multigrid process.
Barry
As Matt noted, using the PCMG directly requires YOU provide
a mesh infrastructure that manages the meshes, thus it is not
realistic for us to provide this whole infrastructure in an
example. We currently only provide the full infrastructure
for structured grids (in DMMG).
On Wed, 29 Mar 2006, jens.madsen@xxxxxxxx wrote:
Hi Petsc :-)
I am trying to use Petsc for solving plasma fluid equations. Is it
possible to use the DMMG with multiplicative or additive multigrid
schemes ? Also can I use multigrid as a solver not only as a
preconditioner in DMMG ?
Also I cannot find any examples using the "low-level" PCMG multigrid
interface ? Only a testprogram in the PC/TEST directory ?
Cheers Jens Madsen