[petsc-users] PETSc KSPBCGSL with HYPRE boomeramg preconditioner ksp_monitor in poisson function
Barry Smith
bsmith at mcs.anl.gov
Sun Sep 17 00:20:46 CDT 2017
> On Sep 17, 2017, at 12:17 AM, Hao Zhang <hbcbh1999 at gmail.com> wrote:
>
> OK. I will check the output Calling KSPView()
>
> I am experimenting with -start_in_debugger. it's for serial not for parallel, right?
It can be for parallel, opens an xterm with the debugger for each MPI process. You need to type cont in all the windows
>
> On Sun, Sep 17, 2017 at 1:12 AM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>
> Should work in the code also. Call KSPSetTolerances() and then call KSPView() to see what it is set to
>
> > On Sep 17, 2017, at 12:11 AM, Hao Zhang <hbcbh1999 at gmail.com> wrote:
> >
> > Yes. but only works via command line option.before was set up in the code.
> >
> > On Sun, Sep 17, 2017 at 12:44 AM, Barry Smith <bsmith at mcs.anl.gov> wrote:
> >
> > > On Sep 16, 2017, at 11:33 PM, Hao Zhang <hbcbh1999 at gmail.com> wrote:
> > >
> > > thanks.
> > >
> > > Yes. KSPSetTolerances is used.
> > >
> > > tolerance is set to be 1.e-14
> >
> > There is the rtol and atol are you sure you set the atol to 1e-14?
> >
> > >
> > > I was thinking if there is a debug option I could use from PETSc to get some insight? GDB was used.
> >
> > You can use the command line option -start_in_debugger
> >
> >
> > >
> > > On Sun, Sep 17, 2017 at 12:25 AM, Barry Smith <bsmith at mcs.anl.gov> wrote:
> > >
> > > > On Sep 16, 2017, at 10:39 PM, Hao Zhang <hbcbh1999 at gmail.com> wrote:
> > > >
> > > > hi,
> > > >
> > > > I am using KSPBCGSL method and HYPRE boomeramg precondtioner passed into KSPsolve for poisson equation as part of incompressible NS.
> > > >
> > > > I have two questions
> > > > Q1 is number of iterations for the same solver. max_iter = 20 for the same poisson function
> > > >
> > > > KSPGetIterationNumber() is used to set up max_iter = 20
> > >
> > > What do you mean, KSPGetIterationNumber() tells you the current number of iterations. You cannot use it to set the maximum number of iterations. Use KSPSetTolerances() or -ksp_max_it <its> to set the number
> > > >
> > > >
> > > > 0 KSP Residual norm 4.512245447770e-04
> > > > 2 KSP Residual norm 6.396709069731e-07
> > > > 4 KSP Residual norm 1.757784220489e-10
> > > > 6 KSP Residual norm 1.501464709144e-14
> > > > 8 KSP Residual norm 1.376381429122e-18
> > > > 10 KSP Residual norm 1.072650548945e-19
> > > > In poisson_func(): num_iter = 10, rel_residual = 1.072651e-19
> > > >
> > > > and the very same function at the next time step gives: remind you guys max_iter = 20. I assume the number of iterations should stop at num_iter = 2.
> > >
> > > Why would it stop at num_iter 2. The number of iterations allowed is the same for each solve, it does not accumulate over all solves.
> > >
> > > > but the solver seems to keep iterating util hitting the max_iter.
> > > > 0 KSP Residual norm 5.107005838093e-16
> > > > 2 KSP Residual norm 3.353634821198e-20
> > > > 4 KSP Residual norm 1.835096039266e-23
> > > > 6 KSP Residual norm 1.645496102409e-23
> > > > 8 KSP Residual norm 1.645496099837e-23
> > > > 10 KSP Residual norm 1.645496099836e-23
> > > > 12 KSP Residual norm 1.645496099530e-23
> > > > 14 KSP Residual norm 1.645496034473e-23
> > > > 16 KSP Residual norm 1.645461130961e-23
> > > > 18 KSP Residual norm 1.645460451075e-23
> > > > In poisson_func(): num_iter = 18, rel_residual = 1.645460e-23
> > >
> > > But the way it is almost never realistic to try to get residual norms to be this small. You might consider using something like -ksp_atol 1.e-16 or something
> > >
> > > >
> > > > Q2 is: it seems HYPRE with KSPsolve works with coarse mesh but when I double the mesh size. the solve halted indefinitely. ksp_monitor didn't produce any results.
> > > > is there a way to understand what's happening?
> > >
> > > You could run in the debugger and use control c to interrupt the code when it is "hanging" and type bt to see the stack trace for the hanging.
> > >
> > >
> > > >
> > > > --
> > > > Hao Zhang
> > > > Dept. of Applid Mathematics and Statistics,
> > > > Stony Brook University,
> > > > Stony Brook, New York, 11790
> > >
> > >
> > >
> > >
> > > --
> > > Hao Zhang
> > > Dept. of Applid Mathematics and Statistics,
> > > Stony Brook University,
> > > Stony Brook, New York, 11790
> >
> >
> >
> >
> > --
> > Hao Zhang
> > Dept. of Applid Mathematics and Statistics,
> > Stony Brook University,
> > Stony Brook, New York, 11790
>
>
>
>
> --
> Hao Zhang
> Dept. of Applid Mathematics and Statistics,
> Stony Brook University,
> Stony Brook, New York, 11790
More information about the petsc-users
mailing list