Module Arkode.MRIStep.InnerStepper

module InnerStepper: sig .. end

Integrators for problems on the MRIStep fast time-scale.


type ('d, 'k) t = ('d, 'k) inner_stepper 

Inner steppers are used to solve the auxiliary initial value problem of an MRIStep integrator's fast time-scale.

val from_arkstep : ('d, 'k) Arkode.ARKStep.session -> ('d, 'k) t

Wrap an Arkode.ARKStep.session for use as an inner stepper.

Creation

type 'd evolvefn = float -> float -> 'd -> unit 

The function efn t0 tout v advances the state vector v for the inner (fast) ODE system from time t0 to time tout.

Within the function, raising a Sundials.RecoverableFailure exception indicates a recoverable error. Any other exception is treated as an unrecoverable error.

type fullrhs_mode = fullrhs_mode = 
| Start (*

It's the beginning of the simulation.

*)
| End (*

It's the end of a successful step.

*)
| Other (*

Some other reason, e.g., for dense output.

*)

A flag indicating why the full RHS function has been called.

type 'd full_rhsfn = float -> 'd -> 'd -> fullrhs_mode -> unit 

The function rhsfn t v f m updates f with the value of the full right-hand-side function of the inner (fast) ODE at time t and for dependent variable values v.

Within the function, raising a Sundials.RecoverableFailure exception indicates a recoverable error. Any other exception is treated as an unrecoverable error.

type 'd resetfn = float -> 'd -> unit 

The function rfn tR vR rests the inner (fast) stepper state to time tR and dependent variable values vR.

Within the function, raising a Sundials.RecoverableFailure exception indicates a recoverable error. Any other exception is treated as an unrecoverable error.

val make : ?context:Sundials.Context.t ->
evolve_fn:'d evolvefn ->
full_rhs_fn:'d full_rhsfn ->
?reset_fn:'d resetfn ->
unit -> ('d, 'k) t

Creates an inner stepper. An inner stepper is defined by obligatory functions to evolve the state vector and calculate the right-hand side, and an optional function to reset the internal state. Inner stepper “content” can be implemented in OCaml using function closures.

By default, the session is created using the context returned by Sundials.Context.default, but this can be overridden by passing an optional context argument.

Applying and Accessing Forcing Data

val add_forcing : ('d, 'k) t -> float -> ('d, 'k) Nvector.t -> unit

Computes the forcing term at the given time and adds it to the given inner (fast) right-hand-side vector.

type 'd forcing_data = {
   tshift : float; (*

Time shift to apply to the current time, $t^S_{n,i-1}$ .

*)
   tscale : float; (*

Time scaling to apply to the current time, $h^S\Delta C^S_i$ .

*)
   forcing : 'd array; (*

An array of forcing vectors $\hat{\gamma}_i^{{k}}$ .

*)
}

The data necessary to computer the forcing term. This includes the shift and scaling factors for the normalized time $\tau = (t - t^S_{n,i-1})/(h^S\Delta c^S_i)$ and the array of polynomial coefficient vectors $\hat{\gamma}_i^{{k}}$ .

val get_forcing_data : ('d, 'k) t ->
'd forcing_data

Return the data necessary to compute the forcing term.