Setting tolerances for multigrid

Knut Erik Teigen knutert at stud.ntnu.no
Fri Jun 15 12:09:00 CDT 2007


When running with those options I get this after the first timestep for
both one and two levels:
159 KSP preconditioned resid norm 1.397494864058e-07 true resid norm
4.996893774970e-02 ||Ae||/||Ax|| 1.577132216812e-10
Linear solve converged due to CONVERGED_RTOL

However, after the second timestep they start to get different.
With two levels the norm is actually lower, but still, the computation
diverges after about 6 time steps. With one level the computation runs
smoothly. Here are the numbers:

-dmmg_nlevels 1
  0 KSP preconditioned resid norm 1.674785901465e+02 
true resid norm 4.083933362528e+08 ||Ae||/||Ax|| 1.000000000000e+00
  1 KSP preconditioned resid norm 6.256839347623e+01 
true resid norm 4.220478752135e+07 ||Ae||/||Ax|| 1.033434774147e-01
(...)
159 KSP preconditioned resid norm 1.318896741223e-07 
true resid norm 5.104451971417e-02 ||Ae||/||Ax|| 1.249886204866e-10
Linear solve converged due to CONVERGED_RTOL

-dmmg_nlevels 2
  0 KSP preconditioned resid norm 1.674785901465e+02 
true resid norm 4.083933362528e+08 ||Ae||/||Ax|| 1.000000000000e+00
  1 KSP preconditioned resid norm 6.252455641723e+01 
true resid norm 5.561545924132e+07 ||Ae||/||Ax|| 1.361811134129e-01
(...) 
159 KSP preconditioned resid norm 1.305901659826e-07 
true resid norm 4.297164043386e-02 ||Ae||/||Ax|| 1.052212086224e-10
Linear solve converged due to CONVERGED_RTOL

-Knut Erik-

On Fri, 2007-06-15 at 10:10 -0500, Barry Smith wrote:
>   You need to make sure the linear solvers are converging properly
> before even worrying about time-stepping. Run with -ksp_monitor_true_residual
> (-ksp_truemonitor on older versions of PETSc) and -ksp_converged_reason
> 
>    Barry
> 
> 
> On Fri, 15 Jun 2007, Knut Erik Teigen wrote:
> 
> > The computation runs just fine with -dmmg_nlevels 1.
> > I use a grid of 65x129, with three levels, so that the coarsest grid is
> > 17x33. 
> > I've diffed the solutions, and they are equal for the first two time
> > steps, but then they start to differ somewhat. Here is an excerpt:
> > -dmmg_nlevels 1:
> > 65.0427492820557        65.0216231814457      64.9793945321386        
> > -dmmg_nlevels 3:
> > 65.0920864319067        65.0711253401585      65.0292265582817
> > 
> > Using 2 or 4 levels produce the same result as 3 levels.
> > 
> > -Knut Erik-
> > 
> > 
> > 
> > On Fri, 2007-06-15 at 10:21 +0200, Matthew Knepley wrote:
> > > This does not sound right to me. I think something must be
> > > configured incorrectly. All MG does is accelerate the solution
> > > of the fine grid problem. I think something must be wrong with
> > > the specification here. It is easy to check. Run with -dmmg_nlevels 1
> > > which just solves on the fine grid.
> > > 
> > >   Matt
> > > 
> > > On 6/15/07, Knut Erik Teigen <knutert at stud.ntnu.no> wrote:
> > > > Thanks, Matthew. It seems like the tolerances weren't my problem,
> > > > though. Even with a tolerance of 1e-10, the computation diverges after
> > > > only a few time steps when using multigrid. With ordinary linear
> > > > solvers, I can use a tolerance of 1e-4 and still get a satisfactory
> > > > solution.
> > > > Could it be that the Galerkin approximation for the coarser levels is
> > > > too inaccurate for my problem?
> > > >
> > > > -Knut Erik-
> > > >
> > > > On Thu, 2007-06-14 at 11:32 -0500, Matthew Knepley wrote:
> > > > > On 6/14/07, Knut Erik Teigen <knutert at stud.ntnu.no> wrote:
> > > > > > Hello,
> > > > > >
> > > > > > How do I set the tolerances for the KSP solvers when using the
> > > > > > DMMG routines without using command line arguments? It seems that
> > > > > > I can use the argument -ksp_rtol on the command line, but in the code I
> > > > > > can't use KSPSetTolerances since I don't have access to the KSP solver
> > > > > > context?
> > > > >
> > > > > You can use DMMGGetKSP() for the finest level, and dmmg[level]->ksp for
> > > > > any others.
> > > > >
> > > > > > Also, I see there is a reference to the function DMMGSetUseGalerkin
> > > > > > in the source code, but I can't find the documentation for it.
> > > > > > Does this function not exist yet? Again I would like to use
> > > > > > -dmmg_galerkin, but setting it in the code instead of on the command
> > > > > > line.
> > > > >
> > > > > I think you want this:
> > > > >
> > > > > http://www-unix.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/DA/DMMGSetUseGalerkinCoarse.html
> > > > >
> > > > >   Matt
> > > > >
> > > > > > Regards,
> > > > > > Knut Erik Teigen
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > 
> > > 
> > 
> > 
> 
> 




More information about the petsc-users mailing list