[petsc-users] help needed for -snes_mf_operator

Barry Smith bsmith at mcs.anl.gov
Wed Apr 25 15:02:56 CDT 2012


   The true residual decreases nicely without matrix free operator, otherwise it does not decrease.  This likely means the preconditioner is no good for the matrix free, but is good for the matrix based. This means that the matrix based multiply is not the same as the matrix free multiply. These means one of the matrix multiplies is wrong. My guess is that your "exact" Jacobian  is wrong. Run with -snes_type test and see what it reports.

   You can also run the code with the options -snes_mf -pc_type none and then again with just -pc_type none (just for a few KSP iterations) and compare the residual norms. If the matrix free and the matrix define the same matrix vector product then these residuals for the first few iterations should be pretty similar.


   Barry

On Apr 25, 2012, at 12:42 PM, Dominik Szczerba wrote:

>> Start by comparing residuals, with an without. Is SNES 0 the same? Is KSP 0
>> the same? KSP 1?
> 
> BCGS, with the option:
> 
>  0 SNES Function norm 1.747536282885e+01
>  0 KSP unpreconditioned resid norm 1.747536282885e+01 true resid norm
> 1.747536282885e+01 ||r(i)||/||b|| 1.000000000000e+00
>  1 KSP unpreconditioned resid norm 6.112827145626e-01 true resid norm
> 1.751036369876e+01 ||r(i)||/||b|| 1.002002869425e+00
> 
> BCGS, without:
> 
>  0 SNES Function norm 1.747536282885e+01
>  0 KSP unpreconditioned resid norm 1.747536282885e+01 true resid norm
> 1.747536282885e+01 ||r(i)||/||b|| 1.000000000000e+00
>  1 KSP unpreconditioned resid norm 2.930616102426e-01 true resid norm
> 2.930616102426e-01 ||r(i)||/||b|| 1.676998715922e-02
> 
> GMRES, with the option:
> 
>  0 SNES Function norm 1.747536282885e+01
>  0 KSP unpreconditioned resid norm 1.747536282885e+01 true resid norm
> 1.747536282885e+01 ||r(i)||/||b|| 1.000000000000e+00
>  1 KSP unpreconditioned resid norm 6.122286256494e-01 true resid norm
> 1.747536251439e+01 ||r(i)||/||b|| 9.999999820055e-01
> 
> GMRES, without:
> 
>  0 SNES Function norm 1.747536282885e+01
>  0 KSP unpreconditioned resid norm 1.747536282885e+01 true resid norm
> 1.747536282885e+01 ||r(i)||/||b|| 1.000000000000e+00
>  1 KSP unpreconditioned resid norm 6.122286294217e-01 true resid norm
> 6.122286294218e-01 ||r(i)||/||b|| 3.503381505824e-02
> 
> Dominik



More information about the petsc-users mailing list