kinsol_ors.py

assimulo.examples.kinsol_ors.run_example(with_plots=True)[source]

Example to demonstrate the use of the Sundials solver Kinsol with a user provided Jacobian and a preconditioner. The example is the ‘Problem 4’ taken from the book by Saad: Iterative Methods for Sparse Linear Systems.

on return:

  • alg_mod problem instance
  • alg_solver solver instance

No initialization defined for the problem.
No finalization defined for the problem.
Final Run Statistics: ORS Example 

 Number of function evaluations              : 56
 Number of Nonlinear Iterations              : 55
 Number of Backtrack Operations (Linesearch) : 0
 Number of Beta-condition Failures           : 0
 Number of Jacobian*Vector Evaluations       : 581
 Number of F-Eval During Jac*Vec-Eval        : 0
 Number of Linear Iterations                 : 526
 Number of Linear Convergence Failures       : 52

Solver options:

 Solver                  : Kinsol
 Linear Solver           : SPGMR
 Globalization Strategy  : NONE
 Function Tolerances     : 1.23081131069e-08
 Step Tolerances         : 3.6668528625e-11
 Variable Scaling        : [ 1.  1.  1. ...,  1.  1.  1.]
 Function Scaling        : [ 1.  1.  1. ...,  1.  1.  1.]

Elapsed simulation time: 0.423460960388 seconds.
No initialization defined for the problem.
No finalization defined for the problem.
Final Run Statistics: ORS Example (Preconditioned) 

 Number of function evaluations              : 26
 Number of Nonlinear Iterations              : 25
 Number of Backtrack Operations (Linesearch) : 0
 Number of Beta-condition Failures           : 0
 Number of Jacobian*Vector Evaluations       : 253
 Number of F-Eval During Jac*Vec-Eval        : 0
 Number of Linear Iterations                 : 228
 Number of Linear Convergence Failures       : 22

Solver options:

 Solver                  : Kinsol
 Linear Solver           : SPGMR
 Globalization Strategy  : NONE
 Function Tolerances     : 1.23081131069e-08
 Step Tolerances         : 3.6668528625e-11
 Variable Scaling        : [ 1.  1.  1. ...,  1.  1.  1.]
 Function Scaling        : [ 1.  1.  1. ...,  1.  1.  1.]

Elapsed simulation time: 0.421674013138 seconds.
('Error                 , in y: ', 0.00025515052048339564)
('Error (preconditioned), in y: ', 7.989264342458871e-05)
_images/kinsol_ors.png

Note

Press [source] (to the top right) to view the example.