Module Ida.Alternate

module Alternate: sig .. end

Alternate Linear Solvers.


type ('data, 'kind) linit = ('data, 'kind) Ida.session -> unit 

Functions that initialize linear solver data, like counters and statistics.

Raising any exception in this function (including Sundials.RecoverableFailure) is treated as an unrecoverable error.

type ('data, 'kind) lsetup = ('data, 'kind) Ida.session -> 'data lsetup_args -> unit 

Functions that prepare the linear solver for subsequent calls to lsolve. The call lsetup s y y' res tmp has as arguments

This function may raise a Sundials.RecoverableFailure exception to indicate that a recoverable error has occurred. Any other exception is treated as an unrecoverable error.

The vectors in Ida.Alternate.lsetup_args should not be accessed after the function returns.

type 'data lsetup_args = 'data alternate_lsetup_args = {
   lsetup_y : 'data; (*

The predicted $y$ vector for the current step.

*)
   lsetup_y' : 'data; (*

The predicted $\dot{y}$ vector for the current step.

*)
   lsetup_res : 'data; (*

The value of the residual function at y and y', i.e., $F(t_n, y_{\text{pred}}, \dot{y}_{\text{pred}})$.

*)
   lsetup_tmp : 'data Ida.triple; (*

Temporary storage vectors.

*)
}

Arguments to Ida.Alternate.lsetup.

type ('data, 'kind) lsolve = ('data, 'kind) Ida.session ->
'data lsolve_args -> 'data -> unit

Functions that solve the linear equation $Mx = b$. $M$ is a preconditioning matrix chosen by the user, and $b$ is the right-hand side vector calculated within the function. $M$ should approximate $J = \frac{\partial F}{\partial y} + c_j\frac{\partial F}{\partial \dot{y}}$, and $c_j$ is available through Ida.Alternate.get_cj. The call lsolve s b weight ycur y'cur rescur has as arguments:

Raising Sundials.RecoverableFailure indicates a recoverable error. Any other exception is treated as an unrecoverable error.

type 'data lsolve_args = 'data alternate_lsolve_args = {
   lsolve_ewt : 'data; (*

The error weights.

*)
   lsolve_y : 'data; (*

The solver's current approximation to $y(t_n)$.

*)
   lsolve_y' : 'data; (*

The solver's current approximation to $y'(t_n)$.

*)
   lsolve_res : 'data; (*

The current residual value.

*)
}

Arguments to Ida.Alternate.lsolve.

type ('data, 'kind) callbacks = ('data, 'kind) alternate_linsolv = {
   linit : ('data, 'kind) linit option;
   lsetup : ('data, 'kind) lsetup option;
   lsolve : ('data, 'kind) lsolve;
}

The callbacks needed to implement an alternate linear solver.

val solver : (('data, 'kind) Ida.session ->
('data, 'kind) Nvector.t -> ('data, 'kind) callbacks) ->
('data, 'kind) Ida.session_linear_solver

Creates a linear solver from a function returning a set of callbacks. The creation function is passed a session and a vector. The latter indicates the problem size and can, for example, be cloned.

Solver internals

val get_cj : ('data, 'kind) Ida.session -> float

Returns the current cj value.

val get_cjratio : ('data, 'kind) Ida.session -> float

Returns the current cjratio value.