Attached are outputs with these options.

What should I make of these?

From: Barry Smith <bsm...@petsc.dev>
Sent: Monday, December 6, 2021 2:16 PM
To: Fischer, Greg A. via petsc-users <petsc-users@mcs.anl.gov>
Cc: Fischer, Greg A. <fisch...@westinghouse.com>
Subject: Re: [petsc-users] KSPBuildResidual and KSPType compatibility

[External Email]

What do you get for -ksp_type ibcgs -ksp_monitor -ksp_monitor_true_residual

with and without  -ksp_pc_side right ?



On Dec 6, 2021, at 12:00 PM, Jed Brown 
<j...@jedbrown.org<mailto:j...@jedbrown.org>> wrote:

"Fischer, Greg A. via petsc-users" 
<petsc-users@mcs.anl.gov<mailto:petsc-users@mcs.anl.gov>> writes:


Hello petsc-users,

I would like to check convergence against the infinity norm, so I defined my 
own convergence test routine with KSPSetConvergenceTest. (I understand that it 
may be computationally expensive.)

I would like to do this with the "ibcgs" method. When I use KSPBuildResidual 
and calculate the NORM_2 against the output vector, I get a value that differs 
from the 2-norm that gets passed into the convergence test function. However, 
when I switch to the "gcr" method, the value I calculate matches the function 
input value.

IBCGS uses the preconditioned norm by default while GCR uses the 
unpreconditioned norm. You can use -ksp_norm_type unpreconditioned or 
KSPSetNormType() to make IBCGS use unpreconditioned.


Is the KSPBuildResidual function only compatible with a subset of the KSPType 
methods? If I want to evaluate convergence against the infinity norm, do I need 
to set KSPSetInitialGuessNonzero and continually re-start the solver with a 
lower tolerance values until I get a satisfactory value of the infinity norm?

Thanks,
Greg


________________________________

This e-mail may contain proprietary information of the sending organization. 
Any unauthorized or improper disclosure, copying, distribution, or use of the 
contents of this e-mail and attached document(s) is prohibited. The information 
contained in this e-mail and attached document(s) is intended only for the 
personal and private use of the recipient(s) named above. If you have received 
this communication in error, please notify the sender immediately by email and 
delete the original e-mail and attached document(s).


________________________________

This e-mail may contain proprietary information of the sending organization. 
Any unauthorized or improper disclosure, copying, distribution, or use of the 
contents of this e-mail and attached document(s) is prohibited. The information 
contained in this e-mail and attached document(s) is intended only for the 
personal and private use of the recipient(s) named above. If you have received 
this communication in error, please notify the sender immediately by email and 
delete the original e-mail and attached document(s).
  0 KSP Residual norm 2.434689662304e-01 
  0 KSP preconditioned resid norm 2.434689662304e-01 true resid norm 
1.413757649058e+09 ||r(i)||/||b|| 1.442188243865e-04
  1 KSP Residual norm 9.646169039586e-02 
  1 KSP preconditioned resid norm 9.646169039586e-02 true resid norm 
3.854926389612e+08 ||r(i)||/||b|| 3.932448764304e-05
  2 KSP Residual norm 2.108318474325e-02 
  2 KSP preconditioned resid norm 2.108318474325e-02 true resid norm 
1.827435583819e+08 ||r(i)||/||b|| 1.864185220968e-05
  3 KSP Residual norm 3.140975415372e-03 
  3 KSP preconditioned resid norm 3.140975415372e-03 true resid norm 
2.259287049438e+07 ||r(i)||/||b|| 2.304721197715e-06
  4 KSP Residual norm 1.321875593282e-03 
  4 KSP preconditioned resid norm 1.321875593282e-03 true resid norm 
9.312002567524e+06 ||r(i)||/||b|| 9.499266468104e-07
  5 KSP Residual norm 1.349713750082e-04 
  5 KSP preconditioned resid norm 1.349713750082e-04 true resid norm 
7.584349847357e+05 ||r(i)||/||b|| 7.736870739129e-08
  6 KSP Residual norm 2.137354098730e-05 
  6 KSP preconditioned resid norm 2.137354098730e-05 true resid norm 
1.124703166395e+05 ||r(i)||/||b|| 1.147320890177e-08
  7 KSP Residual norm 2.034205952502e-06 
  7 KSP preconditioned resid norm 2.034205952502e-06 true resid norm 
1.692772743759e+04 ||r(i)||/||b|| 1.726814318006e-09
  8 KSP Residual norm 1.838553406539e-06 
  8 KSP preconditioned resid norm 1.838553406539e-06 true resid norm 
3.944598727041e+03 ||r(i)||/||b|| 4.023924407903e-10
  9 KSP Residual norm 2.249951900303e-07 
  9 KSP preconditioned resid norm 2.249951900303e-07 true resid norm 
4.612036481625e+02 ||r(i)||/||b|| 4.704784301968e-11
 10 KSP Residual norm 2.267605319834e-07 
 10 KSP preconditioned resid norm 2.267605319834e-07 true resid norm 
4.374567022288e+02 ||r(i)||/||b|| 4.462539343816e-11
 11 KSP Residual norm 1.316889603610e-09 
 11 KSP preconditioned resid norm 1.316889603610e-09 true resid norm 
9.876281042798e+00 ||r(i)||/||b|| 1.007489255497e-12
 12 KSP Residual norm 5.524653398343e-10 
 12 KSP preconditioned resid norm 5.524653398343e-10 true resid norm 
9.946645204522e-01 ||r(i)||/||b|| 1.014667173643e-13
 13 KSP Residual norm 5.734932960763e-11 
 13 KSP preconditioned resid norm 5.734932960763e-11 true resid norm 
2.636378571788e-01 ||r(i)||/||b|| 2.689396011504e-14
 14 KSP Residual norm 3.466814234320e-11 
 14 KSP preconditioned resid norm 3.466814234320e-11 true resid norm 
1.020540591033e-01 ||r(i)||/||b|| 1.041063610695e-14
 15 KSP Residual norm 1.380556992542e-12 
 15 KSP preconditioned resid norm 1.380556992542e-12 true resid norm 
1.812502232170e-02 ||r(i)||/||b|| 1.848951560372e-15
 16 KSP Residual norm 1.710858173875e-13 
 16 KSP preconditioned resid norm 1.710858173875e-13 true resid norm 
1.854972473419e-02 ||r(i)||/||b|| 1.892275876024e-15
 17 KSP Residual norm 4.010603166139e-14 
 17 KSP preconditioned resid norm 4.010603166139e-14 true resid norm 
1.811218089618e-02 ||r(i)||/||b|| 1.847641593779e-15
 18 KSP Residual norm 8.225460750564e-14 
 18 KSP preconditioned resid norm 8.225460750564e-14 true resid norm 
1.809720777360e-02 ||r(i)||/||b|| 1.846114170647e-15
 19 KSP Residual norm 4.505576228085e-15 
 19 KSP preconditioned resid norm 4.505576228085e-15 true resid norm 
1.810377537457e-02 ||r(i)||/||b|| 1.846784138157e-15
  0 KSP Residual norm 3.562910745874e+12 
  0 KSP unpreconditioned resid norm 3.562910745874e+12 true resid norm 
9.802864883083e+12 ||r(i)||/||b|| 9.999999999999e-01
  1 KSP Residual norm 5.723178314494e+11 
  1 KSP unpreconditioned resid norm 5.723178314494e+11 true resid norm 
1.309816338090e+13 ||r(i)||/||b|| 1.336156678392e+00
  2 KSP Residual norm 1.248629101509e+11 
  2 KSP unpreconditioned resid norm 1.248629101509e+11 true resid norm 
1.321914278269e+13 ||r(i)||/||b|| 1.348497907535e+00
  3 KSP Residual norm 2.789050045707e+10 
  3 KSP unpreconditioned resid norm 2.789050045707e+10 true resid norm 
1.322449715686e+13 ||r(i)||/||b|| 1.349044112572e+00
  4 KSP Residual norm 5.902805719450e+09 
  4 KSP unpreconditioned resid norm 5.902805719450e+09 true resid norm 
1.322492200984e+13 ||r(i)||/||b|| 1.349087452247e+00
  5 KSP Residual norm 1.139096297092e+09 
  5 KSP unpreconditioned resid norm 1.139096297092e+09 true resid norm 
1.322491553786e+13 ||r(i)||/||b|| 1.349086792034e+00
  6 KSP Residual norm 2.215331630334e+08 
  6 KSP unpreconditioned resid norm 2.215331630334e+08 true resid norm 
1.322491920012e+13 ||r(i)||/||b|| 1.349087165625e+00
  7 KSP Residual norm 2.982118230699e+07 
  7 KSP unpreconditioned resid norm 2.982118230699e+07 true resid norm 
1.322491671673e+13 ||r(i)||/||b|| 1.349086912291e+00
  8 KSP Residual norm 4.935764827470e+06 
  8 KSP unpreconditioned resid norm 4.935764827470e+06 true resid norm 
1.322491694591e+13 ||r(i)||/||b|| 1.349086935670e+00
  9 KSP Residual norm 8.259983965854e+05 
  9 KSP unpreconditioned resid norm 8.259983965854e+05 true resid norm 
1.322491689258e+13 ||r(i)||/||b|| 1.349086930230e+00
 10 KSP Residual norm 1.372967526870e+05 
 10 KSP unpreconditioned resid norm 1.372967526870e+05 true resid norm 
1.322491689049e+13 ||r(i)||/||b|| 1.349086930017e+00
 11 KSP Residual norm 2.321043889055e+04 
 11 KSP unpreconditioned resid norm 2.321043889055e+04 true resid norm 
1.322491688921e+13 ||r(i)||/||b|| 1.349086929886e+00
 12 KSP Residual norm 2.451338240450e+03 
 12 KSP unpreconditioned resid norm 2.451338240450e+03 true resid norm 
1.322491688910e+13 ||r(i)||/||b|| 1.349086929875e+00
 13 KSP Residual norm 2.717874750155e+02 
 13 KSP unpreconditioned resid norm 2.717874750155e+02 true resid norm 
1.322491688907e+13 ||r(i)||/||b|| 1.349086929872e+00
 14 KSP Residual norm 3.774712779563e+01 
 14 KSP unpreconditioned resid norm 3.774712779563e+01 true resid norm 
1.322491688907e+13 ||r(i)||/||b|| 1.349086929872e+00
 15 KSP Residual norm 5.252618598928e+00 
 15 KSP unpreconditioned resid norm 5.252618598928e+00 true resid norm 
1.322491688907e+13 ||r(i)||/||b|| 1.349086929872e+00
 16 KSP Residual norm 9.580332336651e-01 
 16 KSP unpreconditioned resid norm 9.580332336651e-01 true resid norm 
1.322491688907e+13 ||r(i)||/||b|| 1.349086929872e+00
 17 KSP Residual norm 2.496716571135e-01 
 17 KSP unpreconditioned resid norm 2.496716571135e-01 true resid norm 
1.322491688907e+13 ||r(i)||/||b|| 1.349086929872e+00
 18 KSP Residual norm 6.196094547813e-02 
 18 KSP unpreconditioned resid norm 6.196094547813e-02 true resid norm 
1.322491688907e+13 ||r(i)||/||b|| 1.349086929872e+00
 19 KSP Residual norm 1.826932220157e-02 
 19 KSP unpreconditioned resid norm 1.826932220157e-02 true resid norm 
1.322491688907e+13 ||r(i)||/||b|| 1.349086929872e+00
 20 KSP Residual norm 5.325597453562e-03 
 20 KSP unpreconditioned resid norm 5.325597453562e-03 true resid norm 
1.322491688907e+13 ||r(i)||/||b|| 1.349086929872e+00
 21 KSP Residual norm 1.182978657939e-03 
 21 KSP unpreconditioned resid norm 1.182978657939e-03 true resid norm 
1.322491688907e+13 ||r(i)||/||b|| 1.349086929872e+00
 22 KSP Residual norm 2.916914632406e-04 
 22 KSP unpreconditioned resid norm 2.916914632406e-04 true resid norm 
1.322491688907e+13 ||r(i)||/||b|| 1.349086929872e+00
 23 KSP Residual norm 6.910550319071e-05 
 23 KSP unpreconditioned resid norm 6.910550319071e-05 true resid norm 
1.322491688907e+13 ||r(i)||/||b|| 1.349086929872e+00
 24 KSP Residual norm 8.792447309403e-06 
 24 KSP unpreconditioned resid norm 8.792447309403e-06 true resid norm 
1.322491688907e+13 ||r(i)||/||b|| 1.349086929872e+00
 25 KSP Residual norm 2.089564390065e-06 
 25 KSP unpreconditioned resid norm 2.089564390065e-06 true resid norm 
1.322491688907e+13 ||r(i)||/||b|| 1.349086929872e+00
 26 KSP Residual norm 4.903969811940e-08 
 26 KSP unpreconditioned resid norm 4.903969811940e-08 true resid norm 
1.322491688907e+13 ||r(i)||/||b|| 1.349086929872e+00
 27 KSP Residual norm 5.213370967750e-08 
 27 KSP unpreconditioned resid norm 5.213370967750e-08 true resid norm 
1.322491688907e+13 ||r(i)||/||b|| 1.349086929872e+00
 28 KSP Residual norm 4.901188920152e-09 
 28 KSP unpreconditioned resid norm 4.901188920152e-09 true resid norm 
1.322491688907e+13 ||r(i)||/||b|| 1.349086929872e+00
 29 KSP Residual norm 2.125003012864e-10 
 29 KSP unpreconditioned resid norm 2.125003012864e-10 true resid norm 
1.322491688907e+13 ||r(i)||/||b|| 1.349086929872e+00
 30 KSP Residual norm 2.392426360819e-11 
 30 KSP unpreconditioned resid norm 2.392426360819e-11 true resid norm 
1.322491688907e+13 ||r(i)||/||b|| 1.349086929872e+00
 31 KSP Residual norm 1.438505847901e-12 
 31 KSP unpreconditioned resid norm 1.438505847901e-12 true resid norm 
1.322491688907e+13 ||r(i)||/||b|| 1.349086929872e+00
 32 KSP Residual norm 9.315622777032e-14 
 32 KSP unpreconditioned resid norm 9.315622777032e-14 true resid norm 
1.322491688907e+13 ||r(i)||/||b|| 1.349086929872e+00
 33 KSP Residual norm 6.113560440391e-15 
 33 KSP unpreconditioned resid norm 6.113560440391e-15 true resid norm 
1.322491688907e+13 ||r(i)||/||b|| 1.349086929872e+00

Reply via email to