module Spils:sig
..end
Common definitions for Scaled Preconditioned Iterative Linear Solvers.
type 'd
prec_solve_arg = {
|
rhs : |
(* | Right-hand side vector of the linear system. | *) |
|
gamma : |
(* | Scalar $\gamma$ in the Newton matrix given by $A = M - \gamma J$. | *) |
|
delta : |
(* | Input tolerance for iterative methods. | *) |
|
left : |
(* |
| *) |
}
Arguments passed to the preconditioner solver function.
type'd
prec_solve_fn =(unit, 'd) Arkode.Common.jacobian_arg ->
'd prec_solve_arg -> 'd -> unit
Callback functions that solve a linear system involving a
preconditioner matrix. In the call prec_solve_fn jac arg z
,
jac
is a Arkode.Common.jacobian_arg
with one work vector, arg
is
a Arkode.Spils.prec_solve_arg
that specifies the linear system, and z
is
computed to solve $P\mathtt{z} = \mathtt{arg.rhs}$.
$P$ is a preconditioner matrix, which approximates, however crudely,
the Newton matrix $A = M - \gamma J$ where
$J = \frac{\partial f_I}{\partial y}$.
Raising Sundials.RecoverableFailure
indicates a recoverable error.
Any other exception is treated as an unrecoverable error.
jac
, arg
, and z
should not
be accessed after the function has returned.type'd
prec_setup_fn =(unit, 'd) Arkode.Common.jacobian_arg -> bool -> float -> bool
Callback functions that preprocess or evaluate Jacobian-related data
needed by Arkode.Spils.prec_solve_fn
. In the call prec_setup_fn jac jok gamma
,
jac
is a Arkode.Common.jacobian_arg
with three work vectors, jok
indicates
whether any saved Jacobian-related data can be reused with the current
value of gamma
, and gamma
is the scalar $\gamma$ in the Newton
matrix $A = M - \gamma J$ where $J$ is the Jacobian matrix.
A function should return true
if Jacobian-related data was updated
and false
if saved data was reused.
Raising Sundials.RecoverableFailure
indicates a recoverable error.
Any other exception is treated as an unrecoverable error.
jac
should not be accessed after the
function has returned.type('d, 'k, 's)
preconditioner =('d, 'k, 's) SpilsTypes.preconditioner
Specifies a preconditioner, including the type of preconditioning
(none, left, right, or both) and callback functions.
The following functions and those in Arkode.Spils.Banded
and Arkode_bbd
construct preconditioners.
The Arkode.Spils.prec_solve_fn
is usually mandatory. The Arkode.Spils.prec_setup_fn
can be
omitted if not needed.
module Banded:sig
..end
Banded preconditioners.
type'd
jac_times_setup_fn =(unit, 'd) Arkode.Common.jacobian_arg -> unit
Callback functions that preprocess or evaluate Jacobian-related data
needed by the jac_times_vec_fn. In the call jac_times_setup_fn arg
,
arg
is a Arkode.Common.jacobian_arg
with no work vectors.
Raising Sundials.RecoverableFailure
indicates a recoverable error.
Any other exception is treated as an unrecoverable error.
arg
should not be accessed after the
function has returned.type'd
jac_times_vec_fn =('d, 'd) Arkode.Common.jacobian_arg -> 'd -> 'd -> unit
Callback functions that compute the Jacobian times a vector. In the
call jac_times_vec_fn arg v jv
, arg
is a Arkode.Common.jacobian_arg
with
one work vector, v
is the vector multiplying the Jacobian, and jv
is
the vector in which to store the
result—$\mathtt{jv} = J\mathtt{v}$.
Raising Sundials.RecoverableFailure
indicates a recoverable error.
Any other exception is treated as an unrecoverable error.
arg
nor v
or jv
should be
accessed after the function has returned.