[petsc-users] Setting GAMG options C code

Matthew Knepley knepley at gmail.com
Tue Jul 4 08:28:50 CDT 2017


On Tue, Jul 4, 2017 at 7:31 AM, Harshad Sahasrabudhe <hsahasra at purdue.edu>
wrote:

> Hello,
>
> I am using PCGAMG+KSPBCGS for shift and invert spectral transformation in
> SLEPc. I optimized the options that I need for GAMG using command line:
>
> -st_ksp_type bcgs
> -st_pc_type gamg
> -st_pc_gamg_agg_nsmooths 1
> -st_mg_levels_ksp_type chebyshev
> -st_mg_levels_pc_type jacobi
> -st_mg_levels_ksp_max_it 8
> -st_pc_gamg_threshold 0.01
>
> How can I set these options inside my production code? Is okay to use PetscOptionsSetValue
> for setting the options as following?
>
>           ierr = PetscOptionsSetValue(NULL, "-st_mg_levels_ksp_type",
> "chebyshev");
>           chkerr(ierr);
>           ierr = PetscOptionsSetValue(NULL, "-st_mg_levels_pc_type",
> "jacobi");
>           chkerr(ierr);
>           ierr = PetscOptionsSetValue(NULL, "-st_mg_levels_ksp_max_it",
> "8");
>           chkerr(ierr);
>           ierr = PetscOptionsSetValue(NULL, "-st_pc_gamg_threshold",
> "0.01");
>           chkerr(ierr);
>

I have a different opinion than Jose. I think the above lines are a better
way to lock in the setup.

1) It is very difficult to get the order correct when you use the API

2) For deeply nested solvers it can be either inflexible (you assume a
structure) or laborious (since
you check for certain structures at each level)

  Thanks,

    Matt


> Thanks!
> Harshad
>



-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

http://www.caam.rice.edu/~mk51/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170704/4b6d7c21/attachment.html>


More information about the petsc-users mailing list