Module Sundials_LinearSolver.Iterative

module Iterative: sig .. end

Iterative Linear Solvers


Definitions in this module are more conveniently accessed through session-specific iterative linear solver modules like Cvode.Spils and Ida.Spils. For example, Cvode.Spils.spbcgs is an alias for Sundials_LinearSolver.Iterative.spbcgs.

Types

type ('data, 'kind, 'tag) linear_solver = ('data, 'kind, 'tag) Sundials_LinearSolver_impl.Iterative.linear_solver 

An iterative linear solver. The type variables specify the Nvector.nvector data ('data) and kind ('kind), and the iterative method ('tag).

A linear solver of this type must be converted to session-specific form by Cvode.Spils.solver, Ida.Spils.solver, etc. before being attached to a session.

type gramschmidt_type = Sundials_LinearSolver_impl.Iterative.gramschmidt_type = 
| ModifiedGS (*

Modified Gram-Schmidt orthogonalization (MODIFIED_GS)

*)
| ClassicalGS (*

Classical Gram Schmidt orthogonalization (CLASSICAL_GS)

*)

The type of Gram-Schmidt orthogonalization in iterative linear solvers.

Solvers

val spbcgs : ?maxl:int ->
('d, 'k) Nvector.t ->
('d, 'k, [ `Spbcgs ]) linear_solver

Krylov iterative solver using the scaled preconditioned biconjugate stabilized (Bi-CGStab) method. The maxl arguments gives the maximum dimension of the Krylov subspace (defaults to 5). The nvector argument is used as a template.

val spfgmr : ?maxl:int ->
?max_restarts:int ->
?gs_type:gramschmidt_type ->
('d, 'k) Nvector.t ->
('d, 'k, [ `Spfgmr ]) linear_solver

Krylov iterative solver using the scaled preconditioned flexible generalized minimum residual (GMRES) method. The maxl arguments gives the maximum dimension of the Krylov subspace (defaults to 5). The nvector argument is used as a template.

NB: max_restarts is ignored by CVODE, CVODES, and ARKODE for Config.sundials_version < 3.0.0.

val spgmr : ?maxl:int ->
?max_restarts:int ->
?gs_type:gramschmidt_type ->
('d, 'k) Nvector.t ->
('d, 'k, [ `Spgmr ]) linear_solver

Krylov iterative solver using the scaled preconditioned generalized minimum residual (GMRES) method. The maxl arguments gives the maximum dimension of the Krylov subspace (defaults to 5). The nvector argument is used as a template.

NB: max_restarts is ignored by CVODE, CVODES, and ARKODE for Config.sundials_version < 3.0.0.

val sptfqmr : ?maxl:int ->
('d, 'k) Nvector.t ->
('d, 'k, [ `Sptfqmr ]) linear_solver

Krylov iterative with the scaled preconditioned transpose-free quasi-minimal residual (SPTFQMR) method. The maxl arguments gives the maximum dimension of the Krylov subspace (defaults to 5). The nvector argument is used as a template.

val pcg : ?maxl:int ->
('d, 'k) Nvector.t ->
('d, 'k, [ `Pcg ]) linear_solver

Krylov iterative solver using the preconditioned conjugate gradient (PCG) method. The maxl arguments gives the maximum dimension of the Krylov subspace (defaults to 5). The nvector argument is used as a template.

module Custom: sig .. end

Custom iterative linear solvers.

module Algorithms: sig .. end

Low-level routines on arrays.

Solver parameters

val set_maxl : ('d, 'k, [< `Pcg | `Spbcgs | `Sptfqmr ])
linear_solver -> int -> unit

Updates the number of linear solver iterations to allow.

val set_gs_type : ('d, 'k, [< `Spfgmr | `Spgmr ]) linear_solver ->
gramschmidt_type -> unit

Sets the Gram-Schmidt orthogonalization to use.

val set_max_restarts : ('d, 'k, [< `Spfgmr | `Spgmr ]) linear_solver ->
int -> unit

Sets the number of GMRES restarts to allow.

NB: This feature is not supported by CVODE, CVODES, and ARKODE for Config.sundials_version < 3.0.0.

type preconditioning_type = Sundials_LinearSolver_impl.Iterative.preconditioning_type = 
| PrecNone (*

No preconditioning

*)
| PrecLeft (*

$(P^{-1}A)x = P^{-1}b$

*)
| PrecRight (*

$(AP^{-1})Px = b$

*)
| PrecBoth (*

$(P_L^{-1}AP_R^{-1})P_Rx = P_L^{-1}b$

*)

The type of preconditioning in Krylov solvers.

val set_prec_type : ('d, 'k, 'f) linear_solver ->
preconditioning_type -> unit

Change the preconditioning direction without modifying callback functions.

Raises Sundials_LinearSolver.IllegalPrecType if the current preconditioner is PrecNone and the given argument is not (since no callback functions are specified in this case. May raise Sundials_LinearSolver.IllegalPrecType if the given type is not allowed by the underlying solver.